autorake 2.2 → 2.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/examples/dlcpp/Rakefile +37 -0
- data/examples/dlcpp/dl.cpp +25 -0
- data/examples/dlcpp/dl.h +35 -0
- data/examples/dlcpp/hello.cpp +24 -0
- data/examples/dlcpp/hello.h +24 -0
- data/examples/dlcpp/main.cpp +23 -0
- data/examples/dlcpp/mkrf_conf +12 -0
- data/{samples → examples}/justinst/Rakefile +1 -1
- data/{samples → examples}/justinst/mkrf_conf +0 -0
- data/{samples → examples}/justinst/plugin/dial.vim +0 -0
- data/{samples → examples}/justinst/plugin/ruby.vim +0 -0
- data/{samples → examples}/justinst/plugin/yesno.vim +0 -0
- data/{samples → examples}/plainc/Rakefile +0 -0
- data/{samples → examples}/plainc/hello.c +0 -0
- data/{samples → examples}/plainc/mkrf_conf +0 -0
- data/{samples → examples}/rbextend/Rakefile +2 -2
- data/{samples → examples}/rbextend/hello.c +0 -0
- data/{samples → examples}/rbextend/hello.h +0 -0
- data/{samples → examples}/rbextend/mkrf_conf +0 -0
- data/{samples → examples}/rbextend/rbhello +0 -0
- data/lib/autorake.rb +19 -12
- data/lib/autorake/definition.rb +2 -1
- data/lib/autorake/directories.rb +4 -6
- data/lib/autorake/version.rb +2 -2
- metadata +37 -29
- checksums.yaml +0 -15
data/README
CHANGED
@@ -6,7 +6,7 @@ License: BSD
|
|
6
6
|
|
7
7
|
This project wants to be to Rake what Autocmd is to Make.
|
8
8
|
|
9
|
-
Have a look at the self-explaining
|
9
|
+
Have a look at the self-explaining examples directory.
|
10
10
|
|
11
11
|
The script mkrf_conf will build a file .configure that contains
|
12
12
|
the whole configuration information. The Rakefile will read it in
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#
|
2
|
+
# Rakefile -- build library and executable
|
3
|
+
#
|
4
|
+
|
5
|
+
require "autorake"
|
6
|
+
|
7
|
+
cl = compiler "-O2", "-fPIC"
|
8
|
+
ll = linker "-shared"
|
9
|
+
cs = compiler "-O2"
|
10
|
+
ls = linker
|
11
|
+
|
12
|
+
|
13
|
+
file "hello.o" => "hello.cpp" do |t|
|
14
|
+
cl.cpp t.name, *t.prerequisites
|
15
|
+
end
|
16
|
+
|
17
|
+
file "hello.so" => "hello.o" do |t|
|
18
|
+
ll.cpp t.name, t.prerequisites
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
rule ".o" => ".cpp" do |t|
|
23
|
+
cs.cpp t.name, t.source
|
24
|
+
end
|
25
|
+
|
26
|
+
file "main" => %w(main.o dl.o) do |t|
|
27
|
+
ls.cpp t.name, t.prerequisites
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
task :default => %w(main hello.so)
|
32
|
+
|
33
|
+
|
34
|
+
task :clean do
|
35
|
+
FileList[ "*.o", "*.so", "main", "*.core"].each { |f| rm_f f }
|
36
|
+
end
|
37
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
//
|
2
|
+
// dl.cpp -- Dynamic libraries
|
3
|
+
//
|
4
|
+
|
5
|
+
#include "dl.h"
|
6
|
+
|
7
|
+
#include <iostream>
|
8
|
+
|
9
|
+
|
10
|
+
Dl::Dl( const char *path, int mode) :
|
11
|
+
H( dlopen( path, mode))
|
12
|
+
{
|
13
|
+
if (!H)
|
14
|
+
throw Error();
|
15
|
+
}
|
16
|
+
|
17
|
+
void *Dl::sym( const char *sym) const
|
18
|
+
{
|
19
|
+
void *r = dlsym( H, sym);
|
20
|
+
if (!r)
|
21
|
+
throw Error();
|
22
|
+
return r;
|
23
|
+
}
|
24
|
+
|
25
|
+
|
data/examples/dlcpp/dl.h
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
//
|
2
|
+
// dl.h -- Dynamic libraries
|
3
|
+
//
|
4
|
+
|
5
|
+
#ifndef __DL_H
|
6
|
+
#define __DL_H
|
7
|
+
|
8
|
+
#include <dlfcn.h>
|
9
|
+
|
10
|
+
class Dl {
|
11
|
+
void *H;
|
12
|
+
|
13
|
+
public:
|
14
|
+
class Error {
|
15
|
+
const char *M;
|
16
|
+
public:
|
17
|
+
Error( void) : M( dlerror()) {}
|
18
|
+
|
19
|
+
operator const char * ( void) const { return M; }
|
20
|
+
};
|
21
|
+
|
22
|
+
public:
|
23
|
+
Dl( const char *path, int mode = RTLD_LAZY);
|
24
|
+
~Dl( void) { dlclose( H);}
|
25
|
+
|
26
|
+
void *sym( const char *sym) const;
|
27
|
+
|
28
|
+
private:
|
29
|
+
Dl( const Dl &);
|
30
|
+
Dl &operator = ( const Dl &);
|
31
|
+
};
|
32
|
+
|
33
|
+
|
34
|
+
#endif
|
35
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
//
|
2
|
+
// hello.cpp -- Say "Hello, world!"
|
3
|
+
//
|
4
|
+
|
5
|
+
#include "hello.h"
|
6
|
+
|
7
|
+
#include <iostream>
|
8
|
+
|
9
|
+
void hello_init(void)
|
10
|
+
{
|
11
|
+
std::cout << "hello loaded" << '\n';
|
12
|
+
}
|
13
|
+
|
14
|
+
void hello_fini(void)
|
15
|
+
{
|
16
|
+
std::cout << "hello before unload" << '\n';
|
17
|
+
}
|
18
|
+
|
19
|
+
|
20
|
+
void hello( void)
|
21
|
+
{
|
22
|
+
std::cout << "Hello, world!" << '\n';
|
23
|
+
}
|
24
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
//
|
2
|
+
// hello.h -- Say "Hello, world!"
|
3
|
+
//
|
4
|
+
|
5
|
+
#ifndef __HELLO_H__
|
6
|
+
#define __HELLO_H__
|
7
|
+
|
8
|
+
|
9
|
+
#ifdef __cplusplus
|
10
|
+
extern "C" {
|
11
|
+
#endif
|
12
|
+
|
13
|
+
extern void __attribute__ ((constructor)) hello_init( void);
|
14
|
+
extern void __attribute__ ((destructor)) hello_fini( void);
|
15
|
+
|
16
|
+
extern void hello( void);
|
17
|
+
|
18
|
+
#ifdef __cplusplus
|
19
|
+
}
|
20
|
+
#endif
|
21
|
+
|
22
|
+
|
23
|
+
#endif
|
24
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
//
|
2
|
+
// main.cpp -- Load a dynamic library and call an exported function
|
3
|
+
//
|
4
|
+
|
5
|
+
#include "dl.h"
|
6
|
+
#include <iostream>
|
7
|
+
|
8
|
+
int main( int argc, const char *argv)
|
9
|
+
{
|
10
|
+
try {
|
11
|
+
Dl dl( "./hello.so");
|
12
|
+
|
13
|
+
void (*f)( void) = (void (*)( void)) dl.sym( "hello");
|
14
|
+
|
15
|
+
(*f)();
|
16
|
+
return 0;
|
17
|
+
}
|
18
|
+
catch (Dl::Error &e) {
|
19
|
+
std::cerr << (const char *) e << "\n";
|
20
|
+
return 1;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Rakefile -- build
|
2
|
+
# Rakefile -- build the library
|
3
3
|
#
|
4
4
|
|
5
5
|
require "autorake"
|
@@ -11,7 +11,7 @@ rule ".o" => ".c" do |t|
|
|
11
11
|
c.cc t.name, t.source
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
file "hello.so" => "hello.o" do |t|
|
15
15
|
l.cc t.name, t.prerequisites
|
16
16
|
end
|
17
17
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/autorake.rb
CHANGED
@@ -16,14 +16,27 @@ module Autorake
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
def method_missing sym, *args, &block
|
20
|
+
case sym
|
21
|
+
when /\Ahas_(.*?)\??\z/ then has? $1
|
22
|
+
when /\Aparm_/ then parm[ $'.to_sym]
|
23
|
+
when /\Aexpand_/ then expand $'.upcase
|
24
|
+
else super
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
19
28
|
def has? name
|
20
|
-
@autorake.features[ name]
|
29
|
+
@autorake.features[ name.to_sym]
|
21
30
|
end
|
22
31
|
|
23
32
|
def parm
|
24
33
|
@autorake.parameters
|
25
34
|
end
|
26
35
|
|
36
|
+
def expand dir
|
37
|
+
@autorake.directories.expand dir
|
38
|
+
end
|
39
|
+
|
27
40
|
def compiler *args
|
28
41
|
Compiler.new @autorake.incdirs, @autorake.macros, *args
|
29
42
|
end
|
@@ -122,21 +135,15 @@ module Autorake
|
|
122
135
|
|
123
136
|
def uninstall under, src, dir, params, depth
|
124
137
|
paths_for_install under, src, dir, depth do |dst,here,there|
|
125
|
-
if
|
126
|
-
if
|
138
|
+
if File.directory? dst then
|
139
|
+
if params[ :recursive] then
|
127
140
|
(dir_entries dst).each { |e|
|
128
141
|
uninstall under, (File.join src, e), dir, params, depth+1
|
129
142
|
}
|
130
|
-
rmdir dst
|
131
|
-
elsif File.exists? dst then
|
132
|
-
rm dst
|
133
|
-
end
|
134
|
-
else
|
135
|
-
if File.directory? here or not File.exists? here then
|
136
|
-
rmdir dst if File.directory? dst
|
137
|
-
else
|
138
|
-
rm dst if File.exists? dst or File.symlink? dst
|
139
143
|
end
|
144
|
+
rmdir dst
|
145
|
+
elsif File.exists? dst or File.symlink? dst then
|
146
|
+
rm dst
|
140
147
|
end
|
141
148
|
uninstall under, there, dir, params, 0 if there
|
142
149
|
end
|
data/lib/autorake/definition.rb
CHANGED
@@ -98,10 +98,11 @@ module Autorake
|
|
98
98
|
@checks.push c
|
99
99
|
end
|
100
100
|
|
101
|
-
def
|
101
|
+
def have_function name
|
102
102
|
c = CheckFunction.new @current, name
|
103
103
|
@checks.push c
|
104
104
|
end
|
105
|
+
alias have_func have_function
|
105
106
|
|
106
107
|
def have_library name
|
107
108
|
c = CheckLibrary.new @current, name
|
data/lib/autorake/directories.rb
CHANGED
@@ -42,12 +42,10 @@ module Autorake
|
|
42
42
|
|
43
43
|
def expand dir
|
44
44
|
case dir
|
45
|
-
when /\A[A-Z_]+/ then
|
46
|
-
|
47
|
-
when /\A
|
48
|
-
|
49
|
-
else
|
50
|
-
dir
|
45
|
+
when /\A[A-Z_]+/ then (expand self[ $&.downcase]) + $'
|
46
|
+
when /\A:(\w+)/ then (expand self[ $1 ]) + $'
|
47
|
+
when /\A~/ then File.expand_path dir
|
48
|
+
else dir
|
51
49
|
end
|
52
50
|
end
|
53
51
|
|
data/lib/autorake/version.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
module Autorake
|
6
6
|
|
7
7
|
NAME = "autorake"
|
8
|
-
VERSION = "2.
|
8
|
+
VERSION = "2.4.3".freeze
|
9
9
|
SUMMARY = "Automake like project config before Rake build or install."
|
10
10
|
|
11
11
|
DESCRIPTION = <<EOT
|
@@ -15,7 +15,7 @@ with autocmd-like functionality.
|
|
15
15
|
The config scripts may be held short and readable.
|
16
16
|
EOT
|
17
17
|
|
18
|
-
COPYRIGHT = "(C) 2013 Bertram Scharpf"
|
18
|
+
COPYRIGHT = "(C) 2013,2014 Bertram Scharpf"
|
19
19
|
LICENSE = "BSD"
|
20
20
|
AUTHOR = "Bertram Scharpf <software@bertram-scharpf.de>"
|
21
21
|
TEAM = [ "Bertram Scharpf"]
|
metadata
CHANGED
@@ -1,37 +1,37 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autorake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.4.3
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Bertram Scharpf
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2015-01-15 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rake
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- -
|
19
|
+
- - ">="
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: 0.8.7
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 0.8.7
|
27
|
-
description:
|
28
|
-
|
30
|
+
description: |
|
31
|
+
This script allows you to write pretty mkrf_conf scripts
|
29
32
|
with autocmd-like functionality.
|
30
33
|
|
31
|
-
|
32
34
|
The config scripts may be held short and readable.
|
33
|
-
|
34
|
-
'
|
35
35
|
email: Bertram Scharpf <software@bertram-scharpf.de>
|
36
36
|
executables: []
|
37
37
|
extensions: []
|
@@ -47,48 +47,56 @@ files:
|
|
47
47
|
- lib/autorake/directories.rb
|
48
48
|
- lib/autorake/mkconfig.rb
|
49
49
|
- lib/autorake/version.rb
|
50
|
-
-
|
51
|
-
-
|
52
|
-
-
|
53
|
-
-
|
54
|
-
-
|
55
|
-
-
|
56
|
-
-
|
57
|
-
-
|
58
|
-
-
|
59
|
-
-
|
60
|
-
-
|
61
|
-
-
|
62
|
-
-
|
50
|
+
- examples/dlcpp/Rakefile
|
51
|
+
- examples/dlcpp/mkrf_conf
|
52
|
+
- examples/dlcpp/dl.cpp
|
53
|
+
- examples/dlcpp/dl.h
|
54
|
+
- examples/dlcpp/hello.cpp
|
55
|
+
- examples/dlcpp/hello.h
|
56
|
+
- examples/dlcpp/main.cpp
|
57
|
+
- examples/justinst/Rakefile
|
58
|
+
- examples/justinst/mkrf_conf
|
59
|
+
- examples/justinst/plugin/dial.vim
|
60
|
+
- examples/justinst/plugin/ruby.vim
|
61
|
+
- examples/justinst/plugin/yesno.vim
|
62
|
+
- examples/plainc/Rakefile
|
63
|
+
- examples/plainc/mkrf_conf
|
64
|
+
- examples/plainc/hello.c
|
65
|
+
- examples/rbextend/Rakefile
|
66
|
+
- examples/rbextend/mkrf_conf
|
67
|
+
- examples/rbextend/hello.c
|
68
|
+
- examples/rbextend/hello.h
|
69
|
+
- examples/rbextend/rbhello
|
63
70
|
- README
|
64
71
|
- LICENSE
|
65
72
|
homepage: http://www.bertram-scharpf.de/software/autorake
|
66
73
|
licenses:
|
67
74
|
- BSD
|
68
|
-
metadata: {}
|
69
75
|
post_install_message:
|
70
76
|
rdoc_options:
|
71
|
-
- --charset
|
77
|
+
- "--charset"
|
72
78
|
- utf-8
|
73
|
-
- --main
|
79
|
+
- "--main"
|
74
80
|
- README
|
75
81
|
require_paths:
|
76
82
|
- lib
|
77
83
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
78
85
|
requirements:
|
79
|
-
- -
|
86
|
+
- - ">="
|
80
87
|
- !ruby/object:Gem::Version
|
81
88
|
version: '0'
|
82
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
83
91
|
requirements:
|
84
|
-
- -
|
92
|
+
- - ">="
|
85
93
|
- !ruby/object:Gem::Version
|
86
94
|
version: '0'
|
87
95
|
requirements:
|
88
96
|
- Rake
|
89
97
|
rubyforge_project: NONE
|
90
|
-
rubygems_version:
|
98
|
+
rubygems_version: 1.8.29
|
91
99
|
signing_key:
|
92
|
-
specification_version:
|
100
|
+
specification_version: 3
|
93
101
|
summary: Automake like project config before Rake build or install.
|
94
102
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
ZGVkY2MwNDQwNWY2YzYwMmE3OGI2MTc4ZGQwNWVlZTNlODhiNzk4Ng==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
Zjg4NWFjZmU0ODExMDU2NWE1MTNhZWMxZGZlMmUyOGYwYzAzM2EyZg==
|
7
|
-
!binary "U0hBNTEy":
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
OGIwMDJlZmM5YzUyOTk1OTk3ZTAwOWEyZmYxZmU2YmVmYzk0ZDFiMTNjNTdk
|
10
|
-
Mzg2OTQxOTM2NTdjMGZiMzY1MTJjNzViZWE4NTg3MWQ1YzcwNTg1NTJlNWI3
|
11
|
-
M2ZlOTQwOTFlZmYyYTZkOTAwNTM1MmYwOWQ2MWQyNjU1NDVjMzY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MTFkYWQ1ZDQ0Mzg5ZTFkOWRiMWEzZWI5Y2MzMTI3ZDlkMWUwZDA0M2E2MzE0
|
14
|
-
MjAzZjdlYWQ0ZTEyNjhkN2RjOTJkNTVjMDg5Njg5YTI3NzVhYTlkNTcwYTc4
|
15
|
-
NzNjOTA3NTg0NWQ2Y2Y2ZDQ5YzMxZTQyMTdhOTI0NTU1ZWExYjA=
|