ncurses-ruby 1.2.1 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Changelog.md +68 -0
- data/LICENSE.txt +17 -0
- data/README.md +327 -0
- data/THANKS +1 -0
- data/examples/tclock.rb +1 -1
- data/ext/ncurses/Makefile +238 -0
- data/ext/ncurses/extconf.rb +6 -1
- data/ext/ncurses/form_wrap.c +1 -1
- data/ext/ncurses/form_wrap.o +0 -0
- data/ext/ncurses/menu_wrap.o +0 -0
- data/ext/ncurses/ncurses.so +0 -0
- data/ext/ncurses/ncurses_wrap.c +14 -13
- data/ext/ncurses/ncurses_wrap.h +1 -0
- data/ext/ncurses/ncurses_wrap.o +0 -0
- data/ext/ncurses/panel_wrap.o +0 -0
- data/lib/ncurses-ruby/version.rb +1 -1
- metadata +39 -51
- data/Changes +0 -53
- data/README +0 -351
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e2ba9824af40cca5ae667bcc70b466d7ea90e984
|
4
|
+
data.tar.gz: 21255531cdf879a31d1a2a9d7250cfbc80a95723
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d3f7fe8cdd5ea9454360ac27e58de405b9a18123ef8905ce658eec1c6b798b6f610c982326d01737fc04f6fd4e45a580008258d6e8702e6205a551af2067820c
|
7
|
+
data.tar.gz: 76cf8a1045f569f42b01fd6a183e6b491f1ad5103f3ab638722d94d7af46e44f68d25ba5688b156f891740e8d9b7b01069fbfc5525c4240eda3ebcfcba27eed5
|
data/Changelog.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
## 1.2.3 (2014/07/21)
|
2
|
+
* Updated documentation. [Earle Clubb](https://github.com/eclubb)
|
3
|
+
|
4
|
+
## 1.2.2 (2014/07/10)
|
5
|
+
* Updated to work with Ruby 2.1.0.
|
6
|
+
* Fix compilation issues on Mac OS X.
|
7
|
+
|
8
|
+
## 1.2.1 (2010/10/29)
|
9
|
+
* Changed name of gem from ncurses to ncurses-ruby. [Earle Clubb](https://github.com/eclubb)
|
10
|
+
* Updated to work with Ruby 1.9.2. [Elliott Cable](https://github.com/elliottcable)
|
11
|
+
|
12
|
+
## 1.2.0 (2009/03/04)
|
13
|
+
* Renamed extension from ncurses_bin.so to ncurses.so. [Earle Clubb](https://github.com/eclubb)
|
14
|
+
* Added a wrapper for ncurses menu functionality. [Earle Clubb](https://github.com/eclubb)
|
15
|
+
|
16
|
+
## 1.1.0
|
17
|
+
* Bugfixes by T. Sutherland in _tracef and _tracedump.
|
18
|
+
|
19
|
+
## 1.0.0
|
20
|
+
* Mousemask bugfix from P.Duncan.
|
21
|
+
* Solved timing problems that affected visual smoothness of reactions
|
22
|
+
to user input
|
23
|
+
* Each SCREEN got back its own "halfdelay" and "cbreak" settings
|
24
|
+
|
25
|
+
## 0.9.2
|
26
|
+
* Preventing getch and wgetch functions from blocking other ruby threads.
|
27
|
+
* Previously ncurses-ruby installed two files named "ncurses.rb" and
|
28
|
+
"ncurses.so". The "ncurses.so" is now renamed to "ncurses_bin.so"
|
29
|
+
to prevent "require 'ncurses'" from accidentally loading only the
|
30
|
+
binary file in case that this is found first in ruby's load path.
|
31
|
+
* Reintroduced ability to "include" Ncurses functions:
|
32
|
+
Use "include Ncurses::Namespace" for that. This is implemented via
|
33
|
+
method_missing, so that ncurses functions (some of which have very
|
34
|
+
common names) will not hide other functions defined in the extended
|
35
|
+
scope. (Any existing method_missing function is properly aliased and
|
36
|
+
called after an unsuccessful lookup.)
|
37
|
+
|
38
|
+
## 0.9.1
|
39
|
+
* Bugfix in *in*str functions (Hiroshi Sainohira)
|
40
|
+
* Fix linking error on Mac OS X and some other platforms (Andreas Schwarz)
|
41
|
+
|
42
|
+
## 0.9.0
|
43
|
+
* Forms wrapper contributed by Simon Kaczor
|
44
|
+
* ncurses-ruby now also works with ncurses-4.2
|
45
|
+
(an old release from 1998, needed for Zaurus-port)
|
46
|
+
* First binary package for Sharp Zaurus (arm-linux)
|
47
|
+
|
48
|
+
## 0.8.0
|
49
|
+
* Bugfix: Calls into the ncurses library prior to calling
|
50
|
+
Ncurses::initscr or Ncurses::newterm had previously crashed
|
51
|
+
the Ruby interpreter.
|
52
|
+
Fixed by delaying the binding of most Ncurses functions
|
53
|
+
until after Ncurses::initscr or Ncurses::newterm have been
|
54
|
+
called.
|
55
|
+
* Replaced module functions with singleton functions. This
|
56
|
+
means that
|
57
|
+
include Ncurses
|
58
|
+
initscr
|
59
|
+
is no longer possible. Instead, use
|
60
|
+
Ncurses.initscr
|
61
|
+
Reasons: - Consistency. The shortcut has never been possible
|
62
|
+
with all ncurses functions.
|
63
|
+
- Namespace pollution. Some ncurses functions have
|
64
|
+
too common names.
|
65
|
+
|
66
|
+
## 0.7.2
|
67
|
+
* reintroduced Ncurses::pechochar and Ncurses::redrawwin in the ncurses build.
|
68
|
+
These had been removed by mistake because they did not work with PDCurses.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
Copyright (c) 2002, 2003, 2004 Tobias Peters <t-peters@users.berlios.de>
|
2
|
+
Copyright (c) 2004 Simon Kaczor <skaczor@cox.net>
|
3
|
+
Copyright (c) 2005 2006 Tobias Herzke <t-peters@users.berlios.de>
|
4
|
+
|
5
|
+
This module is free software; you can redistribute it and/or
|
6
|
+
modify it under the terms of the GNU Lesser General Public
|
7
|
+
License as published by the Free Software Foundation; either
|
8
|
+
version 2 of the License, or (at your option) any later version.
|
9
|
+
|
10
|
+
This module is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
Lesser General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU Lesser General Public
|
16
|
+
License along with this module; if not, write to the Free Software
|
17
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
data/README.md
ADDED
@@ -0,0 +1,327 @@
|
|
1
|
+
# ncurses-ruby
|
2
|
+
|
3
|
+
A Ruby module for accessing the ncurses library
|
4
|
+
|
5
|
+
## Overview
|
6
|
+
|
7
|
+
This README file explains how to use the ncurses ruby interface. It is assumed
|
8
|
+
that the reader has a rough understanding of what the ncurses library is and
|
9
|
+
how to use it from the C language. It then goes into detail, explaining what is
|
10
|
+
covered by the ruby interface, and the rules that were followed in translating
|
11
|
+
the C interface into a ruby interface.
|
12
|
+
|
13
|
+
This ncurses interface provides access to the functions, macros, global
|
14
|
+
variables and constants of the ncurses library. These are mapped to a Ruby
|
15
|
+
Module named "Ncurses": Functions and external variables are implemented as
|
16
|
+
singleton functions of the `Ncurses` module.
|
17
|
+
|
18
|
+
This README is organized into the following parts:
|
19
|
+
|
20
|
+
- Overview
|
21
|
+
- [Installation](#installation)
|
22
|
+
- [Usage](#usage)
|
23
|
+
- [External Variables](#external-variables)
|
24
|
+
- [Constants](#constants-static-c-preprocessor-macros)
|
25
|
+
- [Functions (and their Interfaces)](#functions-and-their-interfaces)
|
26
|
+
- [Module / Class Hierarchy](#module--class-hierarchy)
|
27
|
+
- [The WINDOW class](#the-window-class)
|
28
|
+
- [The panel Library](#the-panel-library)
|
29
|
+
- [The form Library](#the-form-library)
|
30
|
+
- [The menu Library](#the-menu-library)
|
31
|
+
- [Ncurses and Ruby Threads](#ncurses-and-ruby-threads)
|
32
|
+
- [Example programs](#example-programs)
|
33
|
+
- [Contributing](#contributing)
|
34
|
+
|
35
|
+
### General Ncurses Literature
|
36
|
+
|
37
|
+
If you don't know how to use ncurses from C, then please read an introduction
|
38
|
+
to ncurses before continuing with this README. Eric Raymond has written an
|
39
|
+
introduction that should be part of the ncurses development package installed
|
40
|
+
on your computer. If you'd like a gentler introduction, then you have two
|
41
|
+
options:
|
42
|
+
|
43
|
+
1. there is a part of a chapter in "The Linux Programmer's Guide" dealing with
|
44
|
+
ncurses, available from www.tldp.org. It is quite old by now, but the
|
45
|
+
ncurses interface has not changed since then, regarding the scope of covered
|
46
|
+
functions, so it is still a very good read.
|
47
|
+
2. There is also an up-to-date "NCURSES-Programming-HOWTO" in the HOWTO
|
48
|
+
collection of the Linux Documentation Project, also available at
|
49
|
+
www.tldp.org, which is worth a read.
|
50
|
+
|
51
|
+
You will also appreciate the extensive man-pages of ncurses, a useful reference
|
52
|
+
while coding.
|
53
|
+
|
54
|
+
## Installation
|
55
|
+
|
56
|
+
Add this line to your application's Gemfile:
|
57
|
+
|
58
|
+
gem 'ncurses-ruby'
|
59
|
+
|
60
|
+
And then execute:
|
61
|
+
|
62
|
+
$ bundle
|
63
|
+
|
64
|
+
Or install it yourself as:
|
65
|
+
|
66
|
+
$ gem install ncurses-ruby
|
67
|
+
|
68
|
+
## Usage
|
69
|
+
|
70
|
+
In your programs:
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
require 'ncurses.rb'
|
74
|
+
```
|
75
|
+
|
76
|
+
If your programs use the scanw functions (most unlikely) you will have to
|
77
|
+
install the [scanf](http://www.rubyhacker.com/code/scanf) library for ruby.
|
78
|
+
|
79
|
+
Most ncurses functions are only available after either `Ncurses.initscr` or
|
80
|
+
`Ncurses.newterm` has returned successfully.
|
81
|
+
|
82
|
+
## External Variables
|
83
|
+
|
84
|
+
External variables are accessed read-only, by module functions taking no
|
85
|
+
arguments. They are spelled exactly like their C counterparts. Sometimes, this
|
86
|
+
leads to module functions beginning with an uppercase letter (e.g.
|
87
|
+
`Ncurses.LINES`).
|
88
|
+
|
89
|
+
One of these external variables, `Ncurses.ESCDELAY`, is also settable with a
|
90
|
+
ruby method (`Ncurses.ESCDELAY=`).
|
91
|
+
|
92
|
+
Another external variable, `Ncurses.RESIZEDELAY` is introduced by this wrapper.
|
93
|
+
It contains the maximum milliseconds delay with which terminal resizesings are
|
94
|
+
recognized.
|
95
|
+
|
96
|
+
## Constants (static C Preprocessor macros)
|
97
|
+
|
98
|
+
Constants are implemented as module constants in the Ncurses module, if
|
99
|
+
possible. Ruby constants can not start with an underscore, so these constants
|
100
|
+
have been renamed (they lost the leading underscore). There are,however, module
|
101
|
+
functions with the same name as these constants, that also return the
|
102
|
+
constant's value, when invoked (e.g. `Ncurses._ENDLINE` returns the value of
|
103
|
+
the constant `Ncurses::ENDLINE`, which has the same value as the C constant
|
104
|
+
`_ENDLINE`).
|
105
|
+
|
106
|
+
Note: The ncurses macros starting with `ACS_` are not constants, their value
|
107
|
+
depends on the terminal in use. Nevertheless, they are implemented as
|
108
|
+
constants of the Ncurses module, but since they depend on the terminal, they
|
109
|
+
are not initialized before `initscr` has been called. If you need more than one
|
110
|
+
terminal in a single program, you can access the `ACS_` values through member
|
111
|
+
functions of class `SCREEN`.
|
112
|
+
|
113
|
+
## Functions (and their Interfaces)
|
114
|
+
|
115
|
+
Functions (also those only implemented by macros in C) can be accessed as
|
116
|
+
module functions of the `Ncurses` module. They take exactly the same arguments
|
117
|
+
as their C counterparts. Some of the C functions return additional arguments
|
118
|
+
through pointer arguments. These are implemented as follows:
|
119
|
+
|
120
|
+
### Functions expecting pointers to integer types
|
121
|
+
|
122
|
+
When the C-function expects a pointer to `int`, `short`, `chtype`, or `attr_type`, you
|
123
|
+
should use a variable containing an empty array as the argument to the ruby
|
124
|
+
function. This is because ruby passes these types (ints) "by value" instead of
|
125
|
+
"by reference"; but arrays are passed by reference, so that you can see the
|
126
|
+
changes to them.
|
127
|
+
|
128
|
+
Attention: some macro-only functions like `getsyx` accept variables of type
|
129
|
+
int, but, being macros, they write values to their arguments. Thus, they also
|
130
|
+
need empty array arguments when called from ruby.
|
131
|
+
|
132
|
+
Example:
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
color_pair_number = 4
|
136
|
+
foreground_color = []
|
137
|
+
background_color = []
|
138
|
+
if (Ncurses.pair_content(color_pair_number, foreground_color, background_color) != Ncurses::ERR)
|
139
|
+
"color pair number #{color_pair_number} contains color number " +
|
140
|
+
"#{foreground_color[0]} as the foreground color, and color " +
|
141
|
+
"number #{background_color[0]} as the background color")
|
142
|
+
end
|
143
|
+
```
|
144
|
+
|
145
|
+
There are 2 functions that read a value from the location pointed to by a
|
146
|
+
pointer to int, and store another value at those locations. These functions are
|
147
|
+
`mouse_trafo` and `wmouse_trafo`. When calling these functions, you have to
|
148
|
+
provide 2 arrays, each filled with exacly one integer. The values contained in
|
149
|
+
these arrays will then be changed by the ruby module function.
|
150
|
+
|
151
|
+
### Functions expecting (non-const) pointers to char
|
152
|
+
|
153
|
+
When the C-function expects a pointer to char, you should use a variable
|
154
|
+
containing an empty string as the argument to the ruby function.
|
155
|
+
|
156
|
+
Example:
|
157
|
+
|
158
|
+
```ruby
|
159
|
+
line2 = ""
|
160
|
+
if (Ncurses.mvwinnstr(Ncurses.stdscr, y=2, x=0, line2, Ncurses.getmaxx(Ncurses.stdscr)) == Ncurses::ERR)
|
161
|
+
raise "could not scan 3rd line"
|
162
|
+
else
|
163
|
+
Ncurses.beep if line2.index("|")
|
164
|
+
end
|
165
|
+
```
|
166
|
+
|
167
|
+
The string that the C function would store at the pointer-to-char location will
|
168
|
+
be appended to the given string.
|
169
|
+
|
170
|
+
Functions expecting const pointers to char do not modify the string they
|
171
|
+
receive, you can pass any string to them.
|
172
|
+
|
173
|
+
### Functions expecting pointers to structs
|
174
|
+
|
175
|
+
When the C-function expects a pointer to `WINDOW`, `SCREEN`, `MEVENT`, `PANEL`,
|
176
|
+
`FORM`, `FIELD`, or `FIELDTYPE` then simply pass it the corresponding, already
|
177
|
+
existing ruby object.
|
178
|
+
|
179
|
+
### scanf-style functions expecting various pointers
|
180
|
+
|
181
|
+
Namely `scanw`, `mvscanw`, `wscanw`, and `mvwscanw`. Use an array after the
|
182
|
+
format string. The scanned values will be placed there. Remember, you need
|
183
|
+
[scanf](http://www.rubyhacker.com/code/scanf) for ruby installed for these
|
184
|
+
functions to work.
|
185
|
+
|
186
|
+
## Module / Class Hierarchy
|
187
|
+
|
188
|
+
```ruby
|
189
|
+
module Ncurses
|
190
|
+
class WINDOW; end
|
191
|
+
class SCREEN; end
|
192
|
+
class MEVENT; end
|
193
|
+
module Panel
|
194
|
+
class PANEL; end
|
195
|
+
end
|
196
|
+
module Form
|
197
|
+
class FORM; end
|
198
|
+
class FIELD; end
|
199
|
+
class FIELDTYPE; end
|
200
|
+
end
|
201
|
+
module Menu
|
202
|
+
class MENU; end
|
203
|
+
class ITEM; end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
```
|
207
|
+
|
208
|
+
## The `WINDOW` class
|
209
|
+
|
210
|
+
The class `WINDOW` implements `method_missing` and tries to map invoked methods
|
211
|
+
to `Ncurses` module functions using a simple heuristic:
|
212
|
+
|
213
|
+
If the method name starts with "mv", it looks for an `Ncurses` module function
|
214
|
+
that starts with "mvw", and if it exists, adds itself to the argument list and
|
215
|
+
calls this function.
|
216
|
+
If no such module function exists, or the name of the invoked method does not
|
217
|
+
start with "mv", it looks to see if there is a module function with the name
|
218
|
+
"w" + methodname, and if it exists, adds itself again to the argument list and
|
219
|
+
calls this function.
|
220
|
+
If this module function did not exist either, then, as a last step, it invokes
|
221
|
+
a module function with the same name as the method, adding itself to the
|
222
|
+
argument list.
|
223
|
+
|
224
|
+
Example: If you invoke `mvaddch(y,x,ch)` on an `Ncurses::WINDOW` object, it
|
225
|
+
will delegate the method call to `Ncurses.mvwaddch(win,y,x,ch)`.
|
226
|
+
|
227
|
+
Other examples:
|
228
|
+
|
229
|
+
```ruby
|
230
|
+
win.printw("hello") => Ncurses.wprintw(win, "hello")
|
231
|
+
|
232
|
+
win.getmaxyx(y=[], x=[]) => Ncurses.getmaxyx(win,y,x)
|
233
|
+
|
234
|
+
win.delwin => Ncurses.delwin(win) # win cannot be used
|
235
|
+
# after this call
|
236
|
+
```
|
237
|
+
|
238
|
+
## The panel Library
|
239
|
+
|
240
|
+
The panel library has also been wrapped. All panel functions are
|
241
|
+
implemented as module functions of the module `Ncurses::Panel`.
|
242
|
+
|
243
|
+
Most of these functions are also implemented as methods of class
|
244
|
+
`Ncurses::Panel::PANEL`, once with their original name and once with the
|
245
|
+
subword "panel" and an adjacent underscore removed.
|
246
|
+
|
247
|
+
## The form Library
|
248
|
+
|
249
|
+
The form library was wrapped inside the `Ncurses:Form` module. All form
|
250
|
+
functions are implemented as module functions on the module `Ncurses::Form`. In
|
251
|
+
addition, all function for which the first parameter is one of the objects are
|
252
|
+
also implemented as an instance method of the respective class. For example,
|
253
|
+
instead of calling `post_form(form)`, you can use `form.post_form`.
|
254
|
+
|
255
|
+
Three objects are defined in the `Ncurses::Form` module:
|
256
|
+
|
257
|
+
1. FORM
|
258
|
+
2. FIELD
|
259
|
+
3. FIELDTYPE
|
260
|
+
|
261
|
+
They are wrapping actual ncurses pointers and should be use whenever a pointer
|
262
|
+
to one of these types is expected in function calls.
|
263
|
+
|
264
|
+
All form constants are defined in the module as Ruby constants with the same
|
265
|
+
name as the curses constants.
|
266
|
+
|
267
|
+
Constructors for `FORM`, `FIELD`, and `FIELDTYPE` objects are also provided,
|
268
|
+
and they expect the same parameters as `new_form`, `new_field`, and
|
269
|
+
`new_fieldtype` curses functions.
|
270
|
+
|
271
|
+
Field validation is implemented using Ruby Proc objects. You must provide a
|
272
|
+
Ruby block whenever a function pointer is expected in curses function
|
273
|
+
arguments. See the example form2.rb for more details.
|
274
|
+
|
275
|
+
The functions `form_userptr` and `field_userptr` are not supported. Use
|
276
|
+
`form.user_object` and `field.user_object` to store Ruby objects instead.
|
277
|
+
|
278
|
+
## The menu Library
|
279
|
+
|
280
|
+
The menu library was wrapped inside the `Ncurses:Menu` module. All menu
|
281
|
+
functions are implemented as module functions in the module `Ncurses::Menu`. In
|
282
|
+
addition, all functions for which the first parameter is one of the objects are
|
283
|
+
also implemented as an instance method of the respective class. For example,
|
284
|
+
instead of calling `post_menu(menu)`, you can use `menu.post_menu`.
|
285
|
+
|
286
|
+
Two objects are defined in the `Ncurses::Menu` module:
|
287
|
+
|
288
|
+
1. MENU
|
289
|
+
2. ITEM
|
290
|
+
|
291
|
+
They are wrapping actual ncurses pointers and should be use whenever a pointer
|
292
|
+
to one of these types is expected in function calls.
|
293
|
+
|
294
|
+
All menu constants are defined in the module as Ruby constants with the same
|
295
|
+
name as the curses constants.
|
296
|
+
|
297
|
+
Constructors for `MENU` and `ITEM` objects are also provided, and they expect
|
298
|
+
the same parameters as `new_menu` and `new_item` curses functions.
|
299
|
+
|
300
|
+
You must provide a Ruby block whenever a function pointer is expected in curses
|
301
|
+
function arguments.
|
302
|
+
|
303
|
+
The functions `menu_userptr` and `item_userptr` are not supported. Use
|
304
|
+
`menu.user_object` and `item.user_object` to store Ruby objects instead.
|
305
|
+
|
306
|
+
## Ncurses and Ruby Threads
|
307
|
+
|
308
|
+
The ncurses library is not thread-safe. Your application must properly
|
309
|
+
serialize calls into ncurses.
|
310
|
+
|
311
|
+
Prior to release 0.9.2, the `getch` and `wgetch` calls used to block the
|
312
|
+
complete ruby interpreter, all threads. This is no longer so. Other threads
|
313
|
+
should now continue to run during blocking calls to `getch` and `wgetch`.
|
314
|
+
|
315
|
+
## Example programs
|
316
|
+
|
317
|
+
Directory "examples" contains a few example programs demonstrating how
|
318
|
+
to use the ncurses library with ruby. Be sure to read the file
|
319
|
+
"examples/LICENSES_for_examples".
|
320
|
+
|
321
|
+
## Contributing
|
322
|
+
|
323
|
+
1. Fork it ( https://github.com/eclubb/ncurses-ruby/fork )
|
324
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
325
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
326
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
327
|
+
5. Create a new Pull Request
|
data/THANKS
CHANGED
data/examples/tclock.rb
CHANGED
@@ -0,0 +1,238 @@
|
|
1
|
+
|
2
|
+
SHELL = /bin/sh
|
3
|
+
|
4
|
+
# V=0 quiet, V=1 verbose. other values don't work.
|
5
|
+
V = 0
|
6
|
+
Q1 = $(V:1=)
|
7
|
+
Q = $(Q1:0=@)
|
8
|
+
ECHO1 = $(V:1=@:)
|
9
|
+
ECHO = $(ECHO1:0=@echo)
|
10
|
+
|
11
|
+
#### Start of system configuration section. ####
|
12
|
+
|
13
|
+
srcdir = .
|
14
|
+
topdir = /home/earle/.rubies/ruby-2.1.1/include/ruby-2.1.0
|
15
|
+
hdrdir = $(topdir)
|
16
|
+
arch_hdrdir = /home/earle/.rubies/ruby-2.1.1/include/ruby-2.1.0/x86_64-linux
|
17
|
+
PATH_SEPARATOR = :
|
18
|
+
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
|
19
|
+
prefix = $(DESTDIR)/home/earle/.rubies/ruby-2.1.1
|
20
|
+
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
|
21
|
+
rubyarchprefix = $(rubylibprefix)/$(arch)
|
22
|
+
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
23
|
+
exec_prefix = $(prefix)
|
24
|
+
vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
|
25
|
+
sitearchhdrdir = $(sitehdrdir)/$(sitearch)
|
26
|
+
rubyarchhdrdir = $(rubyhdrdir)/$(arch)
|
27
|
+
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
28
|
+
sitehdrdir = $(rubyhdrdir)/site_ruby
|
29
|
+
rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
|
30
|
+
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
31
|
+
vendorlibdir = $(vendordir)/$(ruby_version)
|
32
|
+
vendordir = $(rubylibprefix)/vendor_ruby
|
33
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
34
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
35
|
+
sitedir = $(rubylibprefix)/site_ruby
|
36
|
+
rubyarchdir = $(rubylibdir)/$(arch)
|
37
|
+
rubylibdir = $(rubylibprefix)/$(ruby_version)
|
38
|
+
sitearchincludedir = $(includedir)/$(sitearch)
|
39
|
+
archincludedir = $(includedir)/$(arch)
|
40
|
+
sitearchlibdir = $(libdir)/$(sitearch)
|
41
|
+
archlibdir = $(libdir)/$(arch)
|
42
|
+
ridir = $(datarootdir)/$(RI_BASE_NAME)
|
43
|
+
mandir = $(datarootdir)/man
|
44
|
+
localedir = $(datarootdir)/locale
|
45
|
+
libdir = $(exec_prefix)/lib
|
46
|
+
psdir = $(docdir)
|
47
|
+
pdfdir = $(docdir)
|
48
|
+
dvidir = $(docdir)
|
49
|
+
htmldir = $(docdir)
|
50
|
+
infodir = $(datarootdir)/info
|
51
|
+
docdir = $(datarootdir)/doc/$(PACKAGE)
|
52
|
+
oldincludedir = $(DESTDIR)/usr/include
|
53
|
+
includedir = $(prefix)/include
|
54
|
+
localstatedir = $(prefix)/var
|
55
|
+
sharedstatedir = $(prefix)/com
|
56
|
+
sysconfdir = $(prefix)/etc
|
57
|
+
datadir = $(datarootdir)
|
58
|
+
datarootdir = $(prefix)/share
|
59
|
+
libexecdir = $(exec_prefix)/libexec
|
60
|
+
sbindir = $(exec_prefix)/sbin
|
61
|
+
bindir = $(exec_prefix)/bin
|
62
|
+
archdir = $(rubyarchdir)
|
63
|
+
|
64
|
+
|
65
|
+
CC = gcc
|
66
|
+
CXX = g++
|
67
|
+
LIBRUBY = $(LIBRUBY_A)
|
68
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
69
|
+
LIBRUBYARG_SHARED = -Wl,-R -Wl,$(libdir) -L$(libdir)
|
70
|
+
LIBRUBYARG_STATIC = -Wl,-R -Wl,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)-static
|
71
|
+
empty =
|
72
|
+
OUTFLAG = -o $(empty)
|
73
|
+
COUTFLAG = -o $(empty)
|
74
|
+
|
75
|
+
RUBY_EXTCONF_H =
|
76
|
+
cflags = $(optflags) $(debugflags) $(warnflags)
|
77
|
+
optflags = -O3 -fno-fast-math
|
78
|
+
debugflags = -ggdb3
|
79
|
+
warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration
|
80
|
+
CCDLFLAGS = -fPIC
|
81
|
+
CFLAGS = $(CCDLFLAGS) $(cflags) -g -I/usr/pkg/include $(ARCH_FLAG)
|
82
|
+
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
83
|
+
DEFS =
|
84
|
+
CPPFLAGS = -DHAVE_UNISTD_H -DHAVE_NCURSES_H -DHAVE_NEWSCR -DHAVE_TABSIZE -DHAVE_ESCDELAY -DHAVE_KEYBOUND -DHAVE_CURSES_VERSION -DHAVE_TIGETSTR -DHAVE_GETWIN -DHAVE_PUTWIN -DHAVE_UNGETMOUSE -DHAVE_MOUSEMASK -DHAVE_WENCLOSE -DHAVE_MOUSEINTERVAL -DHAVE_WMOUSE_TRAFO -DHAVE_MCPRINT -DHAVE_HAS_KEY -DHAVE_DELSCREEN -DHAVE_DEFINE_KEY -DHAVE_KEYOK -DHAVE_RESIZETERM -DHAVE_USE_DEFAULT_COLORS -DHAVE_USE_EXTENDED_NAMES -DHAVE_WRESIZE -DHAVE_ATTR_ON -DHAVE_ATTR_OFF -DHAVE_ATTR_SET -DHAVE_CHGAT -DHAVE_COLOR_SET -DHAVE_FILTER -DHAVE_INTRFLUSH -DHAVE_MVCHGAT -DHAVE_MVHLINE -DHAVE_MVVLINE -DHAVE_MVWCHGAT -DHAVE_MVWHLINE -DHAVE_MVWVLINE -DHAVE_NOQIFLUSH -DHAVE_PUTP -DHAVE_QIFLUSH -DHAVE_SCR_DUMP -DHAVE_SCR_INIT -DHAVE_SCR_RESTORE -DHAVE_SCR_SET -DHAVE_SLK_ATTR -DHAVE_SLK_ATTR_SET -DHAVE_SLK_COLOR -DHAVE_TIGETFLAG -DHAVE_TIGETNUM -DHAVE_USE_ENV -DHAVE_VIDATTR -DHAVE_WATTR_ON -DHAVE_WATTR_OFF -DHAVE_WATTR_SET -DHAVE_WCHGAT -DHAVE_WCOLOR_SET -DHAVE_GETATTRS -DHAVE_ASSUME_DEFAULT_COLORS -DHAVE_ATTR_GET -DHAVE_PANEL_H -DHAVE_FORM_H -DHAVE_MENU_H $(DEFS) $(cppflags)
|
85
|
+
CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG)
|
86
|
+
ldflags = -L. -fstack-protector -rdynamic -Wl,-export-dynamic -L/usr/pkg/lib
|
87
|
+
dldflags =
|
88
|
+
ARCH_FLAG =
|
89
|
+
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
90
|
+
LDSHARED = $(CC) -shared
|
91
|
+
LDSHAREDXX = $(CXX) -shared
|
92
|
+
AR = ar
|
93
|
+
EXEEXT =
|
94
|
+
|
95
|
+
RUBY_INSTALL_NAME = ruby
|
96
|
+
RUBY_SO_NAME = ruby
|
97
|
+
RUBYW_INSTALL_NAME =
|
98
|
+
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
|
99
|
+
RUBYW_BASE_NAME = rubyw
|
100
|
+
RUBY_BASE_NAME = ruby
|
101
|
+
|
102
|
+
arch = x86_64-linux
|
103
|
+
sitearch = $(arch)
|
104
|
+
ruby_version = 2.1.0
|
105
|
+
ruby = $(bindir)/ruby
|
106
|
+
RUBY = $(ruby)
|
107
|
+
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
|
108
|
+
|
109
|
+
RM = rm -f
|
110
|
+
RM_RF = $(RUBY) -run -e rm -- -rf
|
111
|
+
RMDIRS = rmdir --ignore-fail-on-non-empty -p
|
112
|
+
MAKEDIRS = /usr/bin/mkdir -p
|
113
|
+
INSTALL = /usr/bin/install -c
|
114
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
115
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
116
|
+
COPY = cp
|
117
|
+
TOUCH = exit >
|
118
|
+
|
119
|
+
#### End of system configuration section. ####
|
120
|
+
|
121
|
+
preload =
|
122
|
+
|
123
|
+
libpath = . $(libdir)
|
124
|
+
LIBPATH = -L. -L$(libdir) -Wl,-R$(libdir)
|
125
|
+
DEFFILE =
|
126
|
+
|
127
|
+
CLEANFILES = mkmf.log
|
128
|
+
DISTCLEANFILES =
|
129
|
+
DISTCLEANDIRS =
|
130
|
+
|
131
|
+
extout =
|
132
|
+
extout_prefix =
|
133
|
+
target_prefix =
|
134
|
+
LOCAL_LIBS =
|
135
|
+
LIBS = -lmenu -lform -lpanel -lncurses -lpthread -ldl -lcrypt -lm -lc
|
136
|
+
ORIG_SRCS = panel_wrap.c ncurses_wrap.c form_wrap.c menu_wrap.c
|
137
|
+
SRCS = $(ORIG_SRCS)
|
138
|
+
OBJS = panel_wrap.o ncurses_wrap.o form_wrap.o menu_wrap.o
|
139
|
+
HDRS = $(srcdir)/form_wrap.h $(srcdir)/panel_wrap.h $(srcdir)/ncurses_wrap.h $(srcdir)/menu_wrap.h
|
140
|
+
TARGET = ncurses
|
141
|
+
TARGET_NAME = ncurses
|
142
|
+
TARGET_ENTRY = Init_$(TARGET_NAME)
|
143
|
+
DLLIB = $(TARGET).so
|
144
|
+
EXTSTATIC =
|
145
|
+
STATIC_LIB =
|
146
|
+
|
147
|
+
TIMESTAMP_DIR = .
|
148
|
+
BINDIR = $(bindir)
|
149
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
150
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
151
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
152
|
+
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
|
153
|
+
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
|
154
|
+
|
155
|
+
TARGET_SO = $(DLLIB)
|
156
|
+
CLEANLIBS = $(TARGET).so
|
157
|
+
CLEANOBJS = *.o *.bak
|
158
|
+
|
159
|
+
all: $(DLLIB)
|
160
|
+
static: $(STATIC_LIB)
|
161
|
+
.PHONY: all install static install-so install-rb
|
162
|
+
.PHONY: clean clean-so clean-static clean-rb
|
163
|
+
|
164
|
+
clean-static::
|
165
|
+
clean-rb-default::
|
166
|
+
clean-rb::
|
167
|
+
clean-so::
|
168
|
+
clean: clean-so clean-static clean-rb-default clean-rb
|
169
|
+
-$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
170
|
+
|
171
|
+
distclean-rb-default::
|
172
|
+
distclean-rb::
|
173
|
+
distclean-so::
|
174
|
+
distclean-static::
|
175
|
+
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
|
176
|
+
-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
177
|
+
-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
178
|
+
-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
179
|
+
|
180
|
+
realclean: distclean
|
181
|
+
install: install-so install-rb
|
182
|
+
|
183
|
+
install-so: $(DLLIB) $(TIMESTAMP_DIR)/.RUBYARCHDIR.time
|
184
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
185
|
+
clean-static::
|
186
|
+
-$(Q)$(RM) $(STATIC_LIB)
|
187
|
+
install-rb: pre-install-rb install-rb-default
|
188
|
+
install-rb-default: pre-install-rb-default
|
189
|
+
pre-install-rb: Makefile
|
190
|
+
pre-install-rb-default: Makefile
|
191
|
+
pre-install-rb-default:
|
192
|
+
$(ECHO) installing default ncurses libraries
|
193
|
+
$(TIMESTAMP_DIR)/.RUBYARCHDIR.time:
|
194
|
+
$(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
|
195
|
+
$(Q) $(TOUCH) $@
|
196
|
+
|
197
|
+
site-install: site-install-so site-install-rb
|
198
|
+
site-install-so: install-so
|
199
|
+
site-install-rb: install-rb
|
200
|
+
|
201
|
+
.SUFFIXES: .c .m .cc .mm .cxx .cpp .C .o
|
202
|
+
|
203
|
+
.cc.o:
|
204
|
+
$(ECHO) compiling $(<)
|
205
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
206
|
+
|
207
|
+
.mm.o:
|
208
|
+
$(ECHO) compiling $(<)
|
209
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
210
|
+
|
211
|
+
.cxx.o:
|
212
|
+
$(ECHO) compiling $(<)
|
213
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
214
|
+
|
215
|
+
.cpp.o:
|
216
|
+
$(ECHO) compiling $(<)
|
217
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
218
|
+
|
219
|
+
.C.o:
|
220
|
+
$(ECHO) compiling $(<)
|
221
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
222
|
+
|
223
|
+
.c.o:
|
224
|
+
$(ECHO) compiling $(<)
|
225
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
|
226
|
+
|
227
|
+
.m.o:
|
228
|
+
$(ECHO) compiling $(<)
|
229
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
|
230
|
+
|
231
|
+
$(DLLIB): $(OBJS) Makefile
|
232
|
+
$(ECHO) linking shared-object $(DLLIB)
|
233
|
+
-$(Q)$(RM) $(@)
|
234
|
+
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
$(OBJS): $(HDRS) $(ruby_headers)
|