malloc 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (6) hide show
  1. data/Rakefile +165 -0
  2. metadata +4 -7
  3. data/Makefile +0 -89
  4. data/binary.gemspec +0 -22
  5. data/ext/extconf.rb +0 -4
  6. data/source.gemspec +0 -28
data/Rakefile ADDED
@@ -0,0 +1,165 @@
1
+ #!/usr/bin/env ruby
2
+ require 'date'
3
+ require 'rake/clean'
4
+ require 'rake/testtask'
5
+ require 'rake/packagetask'
6
+ require 'rbconfig'
7
+
8
+ PKG_NAME = 'malloc'
9
+ PKG_VERSION = '0.2.4'
10
+ CXX = ENV[ 'CXX' ] || 'g++'
11
+ STRIP = ENV[ 'STRIP' ] || 'strip'
12
+ RB_FILES = FileList[ 'lib/**/*.rb' ]
13
+ CC_FILES = FileList[ 'ext/*.cc' ]
14
+ HH_FILES = FileList[ 'ext/*.hh' ]
15
+ TC_FILES = FileList[ 'test/tc_*.rb' ]
16
+ TS_FILES = FileList[ 'test/ts_*.rb' ]
17
+ SO_FILE = "ext/#{PKG_NAME}.so"
18
+ PKG_FILES = [ 'Rakefile', 'README', 'COPYING', '.document' ] +
19
+ RB_FILES + CC_FILES + HH_FILES + TS_FILES + TC_FILES
20
+ BIN_FILES = [ 'README', 'COPYING', '.document', SO_FILE ] +
21
+ RB_FILES + TS_FILES + TC_FILES
22
+ SUMMARY = %q{Object for raw memory allocation and pointer operations}
23
+ DESCRIPTION = %q{This Ruby extension defines the class Hornetseye::Malloc. Hornetseye::Malloc#new allows you to allocate memory, using Hornetseye::Malloc#+ one can do pointer manipulation, and Hornetseye::Malloc#read and Hornetseye::Malloc#write provide reading Ruby strings from memory and writing Ruby strings to memory.}
24
+ AUTHOR = %q{Jan Wedekind}
25
+ EMAIL = %q{jan@wedesoft.de}
26
+ HOMEPAGE = %q{http://wedesoft.github.com/malloc/}
27
+
28
+ OBJ = CC_FILES.ext 'o'
29
+ $CXXFLAGS = ENV[ 'CXXFLAGS' ] || ''
30
+ $CXXFLAGS = "#{$CXXFLAGS} -fPIC"
31
+ if Config::CONFIG[ 'rubyhdrdir' ]
32
+ $CXXFLAGS += "#{$CXXFLAGS} -I#{Config::CONFIG[ 'rubyhdrdir' ]} " +
33
+ "-I#{Config::CONFIG[ 'rubyhdrdir' ]}/#{Config::CONFIG[ 'arch' ]}"
34
+ else
35
+ $CXXFLAGS += "#{$CXXFLAGS} -I#{Config::CONFIG[ 'archdir' ]}"
36
+ end
37
+ $LIBRUBYARG = Config::CONFIG[ 'LIBRUBYARG' ]
38
+ $SITELIBDIR = Config::CONFIG[ 'sitelibdir' ]
39
+ $SITEARCHDIR = Config::CONFIG[ 'sitearchdir' ]
40
+
41
+ task :default => :all
42
+
43
+ task :all => [ SO_FILE ]
44
+
45
+ file SO_FILE => OBJ do |t|
46
+ sh "#{CXX} -shared -o #{t.name} #{OBJ} #{$LIBRUBYARG}"
47
+ sh "#{STRIP} --strip-all #{t.name}"
48
+ end
49
+
50
+ task :test => [ SO_FILE ]
51
+
52
+ desc 'Install Ruby extension'
53
+ task :install => :all do
54
+ verbose true do
55
+ for f in RB_FILES do
56
+ FileUtils.mkdir_p "#{$SITELIBDIR}/#{File.dirname( f[ 4 .. -1 ] )}"
57
+ FileUtils.cp_r f, "#{$SITELIBDIR}/#{f[ 4 .. -1 ]}"
58
+ end
59
+ FileUtils.mkdir_p $SITEARCHDIR
60
+ FileUtils.cp SO_FILE, "#{$SITEARCHDIR}/#{File.basename SO_FILE}"
61
+ end
62
+ end
63
+
64
+ desc 'Uninstall Ruby extension'
65
+ task :uninstall do
66
+ verbose true do
67
+ for f in RB_FILES do
68
+ FileUtils.rm_f "#{$SITELIBDIR}/#{f[ 4 .. -1 ]}"
69
+ end
70
+ FileUtils.rm_f "#{$SITEARCHDIR}/#{File.basename SO_FILE}"
71
+ end
72
+ end
73
+
74
+ Rake::TestTask.new do |t|
75
+ t.libs << 'ext'
76
+ t.test_files = TC_FILES
77
+ end
78
+
79
+ begin
80
+ require 'yard'
81
+ YARD::Rake::YardocTask.new :yard do |y|
82
+ y.options << '--no-private'
83
+ y.files << FileList[ 'lib/**/*.rb' ]
84
+ end
85
+ rescue LoadError
86
+ STDERR.puts 'Please install \'yard\' if you want to generate documentation'
87
+ end
88
+
89
+ Rake::PackageTask.new PKG_NAME, PKG_VERSION do |p|
90
+ p.need_tar = true
91
+ p.package_files = PKG_FILES
92
+ end
93
+
94
+ begin
95
+ require 'rubygems/builder'
96
+ $SPEC = Gem::Specification.new do |s|
97
+ s.name = PKG_NAME
98
+ s.version = PKG_VERSION
99
+ s.platform = Gem::Platform::RUBY
100
+ s.date = Date.today.to_s
101
+ s.summary = SUMMARY
102
+ s.description = DESCRIPTION
103
+ s.author = AUTHOR
104
+ s.email = EMAIL
105
+ s.homepage = HOMEPAGE
106
+ s.files = PKG_FILES
107
+ s.test_files = TC_FILES
108
+ s.require_paths = [ 'lib', 'ext' ]
109
+ s.rubyforge_project = %q{hornetseye}
110
+ s.extensions = %w{Rakefile}
111
+ s.has_rdoc = 'yard'
112
+ s.extra_rdoc_files = []
113
+ s.rdoc_options = %w{--no-private}
114
+ end
115
+ GEM_SOURCE = "#{PKG_NAME}-#{PKG_VERSION}.gem"
116
+ $BINSPEC = Gem::Specification.new do |s|
117
+ s.name = PKG_NAME
118
+ s.version = PKG_VERSION
119
+ s.platform = Gem::Platform::CURRENT
120
+ s.date = Date.today.to_s
121
+ s.summary = SUMMARY
122
+ s.description = DESCRIPTION
123
+ s.author = AUTHOR
124
+ s.email = EMAIL
125
+ s.homepage = HOMEPAGE
126
+ s.files = BIN_FILES
127
+ s.test_files = TC_FILES
128
+ s.require_paths = [ 'lib', 'ext' ]
129
+ s.rubyforge_project = %q{hornetseye}
130
+ s.has_rdoc = 'yard'
131
+ s.extra_rdoc_files = []
132
+ s.rdoc_options = %w{--no-private}
133
+ end
134
+ GEM_BINARY = "#{PKG_NAME}-#{PKG_VERSION}-#{$BINSPEC.platform}.gem"
135
+ desc "Build the gem file #{GEM_SOURCE}"
136
+ task :gem => [ "pkg/#{GEM_SOURCE}" ]
137
+ file "pkg/#{GEM_SOURCE}" => [ 'pkg' ] + $SPEC.files do
138
+ Gem::Builder.new( $SPEC ).build
139
+ verbose true do
140
+ FileUtils.mv GEM_SOURCE, "pkg/#{GEM_SOURCE}"
141
+ end
142
+ end
143
+ desc "Build the gem file #{GEM_BINARY}"
144
+ task :gem_binary => [ "pkg/#{GEM_BINARY}" ]
145
+ file "pkg/#{GEM_BINARY}" => [ 'pkg' ] + $BINSPEC.files do
146
+ when_writing 'Creating GEM' do
147
+ Gem::Builder.new( $BINSPEC ).build
148
+ verbose true do
149
+ FileUtils.mv GEM_BINARY, "pkg/#{GEM_BINARY}"
150
+ end
151
+ end
152
+ end
153
+ rescue LoadError
154
+ STDERR.puts 'Please install \'rubygems\' if you want to create Gem packages'
155
+ end
156
+
157
+ rule '.o' => '.cc' do |t|
158
+ sh "#{CXX} #{$CXXFLAGS} -c -o #{t.name} #{t.source}"
159
+ end
160
+
161
+ file 'ext/error.o' => [ 'ext/error.cc', 'ext/error.hh' ]
162
+ file 'ext/malloc.o' => [ 'ext/malloc.cc', 'ext/malloc.hh', 'ext/error.hh' ]
163
+
164
+ CLEAN.include 'ext/*.o'
165
+ CLOBBER.include SO_FILE, 'doc'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: malloc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Wedekind
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-11 00:00:00 +00:00
12
+ date: 2009-12-14 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -18,13 +18,11 @@ email: jan@wedesoft.de
18
18
  executables: []
19
19
 
20
20
  extensions:
21
- - ext/extconf.rb
21
+ - Rakefile
22
22
  extra_rdoc_files: []
23
23
 
24
24
  files:
25
- - source.gemspec
26
- - binary.gemspec
27
- - Makefile
25
+ - Rakefile
28
26
  - README
29
27
  - COPYING
30
28
  - .document
@@ -34,7 +32,6 @@ files:
34
32
  - ext/init.cc
35
33
  - ext/error.hh
36
34
  - ext/malloc.hh
37
- - ext/extconf.rb
38
35
  - test/ts_malloc.rb
39
36
  - test/tc_malloc.rb
40
37
  has_rdoc: yard
data/Makefile DELETED
@@ -1,89 +0,0 @@
1
- .SUFFIXES:
2
- .SUFFIXES: .gem .o .cc .hh .rb .tar .gz .bz2
3
-
4
- RUBY_VERSION = 1.8
5
- MALLOC_VERSION = 0.2.3
6
-
7
- CP = cp
8
- RM = rm -Rf
9
- MKDIR = mkdir -p
10
- GEM = gem$(RUBY_VERSION)
11
- RUBY = ruby$(RUBY_VERSION)
12
- YARDOC = yardoc
13
- TAR = tar
14
- GIT = git
15
- SITELIBDIR = $(shell $(RUBY) -r mkmf -e "puts \"\#{Config::CONFIG['sitelibdir']}\"")
16
- SITEARCHDIR = $(shell $(RUBY) -r mkmf -e "puts \"\#{Config::CONFIG['sitearchdir']}\"")
17
-
18
- MAIN = Makefile source.gemspec binary.gemspec README COPYING .document
19
- EXT = ext/extconf.rb $(wildcard ext/*.cc) $(wildcard ext/*.hh)
20
- LIB = $(wildcard lib/*.rb)
21
- TEST = $(wildcard test/*.rb)
22
- DOC = $(wildcard doc/*.rb)
23
- SOURCES = $(MAIN) $(EXT) $(LIB) $(TEST) $(DOC)
24
-
25
- all:: target
26
-
27
- target:: ext/malloc.so
28
-
29
- gem:: malloc-$(MALLOC_VERSION).gem
30
-
31
- binary-gem:: binary.gemspec ext/malloc.so $(LIB)
32
- $(GEM) build binary.gemspec
33
-
34
- install:: ext/malloc.so $(LIB)
35
- $(MKDIR) $(SITELIBDIR)
36
- $(MKDIR) $(SITEARCHDIR)
37
- $(CP) $(LIB) $(SITELIBDIR)
38
- $(CP) ext/malloc.so $(SITEARCHDIR)
39
-
40
- uninstall::
41
- $(RM) $(addprefix $(SITELIBDIR)/,$(notdir $(LIB)))
42
- $(RM) $(addprefix $(SITEARCHDIR)/,malloc.so)
43
-
44
- install-gem:: malloc-$(MALLOC_VERSION).gem
45
- $(GEM) install --local $<
46
-
47
- uninstall-gem::
48
- $(GEM) uninstall malloc || echo Nothing to uninstall
49
-
50
- yardoc:: README $(LIB)
51
- $(YARDOC) --no-private
52
-
53
- check:: ext/malloc.so $(LIB) $(TEST)
54
- $(RUBY) -rrubygems -Iext -Ilib -Itest test/ts_malloc.rb
55
-
56
- push-gem:: malloc-$(MALLOC_VERSION).gem
57
- echo Pushing $< in 3 seconds!
58
- sleep 3
59
- $(GEM) push $<
60
-
61
- push-git::
62
- echo Pushing to origin in 3 seconds!
63
- sleep 3
64
- $(GIT) push origin master
65
-
66
- dist:: dist-gzip
67
-
68
- dist-gzip:: malloc-$(MALLOC_VERSION).tar.gz
69
-
70
- dist-bzip2:: malloc-$(MALLOC_VERSION).tar.bz2
71
-
72
- malloc-$(MALLOC_VERSION).gem: $(SOURCES)
73
- $(GEM) build source.gemspec
74
-
75
- ext/Makefile: ext/extconf.rb
76
- cd ext && $(RUBY) extconf.rb && cd ..
77
-
78
- ext/malloc.so: ext/Makefile $(EXT)
79
- cd ext && $(MAKE) && cd ..
80
-
81
- malloc-$(MALLOC_VERSION).tar.gz: $(SOURCES)
82
- $(TAR) czf $@ $(SOURCES)
83
-
84
- malloc-$(MALLOC_VERSION).tar.bz2: $(SOURCES)
85
- $(TAR) cjf $@ $(SOURCES)
86
-
87
- clean::
88
- $(RM) *~ ext/*~ ext/*.o ext/*.so ext/Makefile lib/*~ lib/*.so test/*~ *.gem doc
89
-
data/binary.gemspec DELETED
@@ -1,22 +0,0 @@
1
- require 'date'
2
- Gem::Specification.new do |s|
3
- s.name = %q{malloc}
4
- s.version = '0.2.3'
5
- s.platform = Gem::Platform::CURRENT
6
- s.date = Date.today.to_s
7
- s.summary = %q{Object for raw memory allocation and pointer operations}
8
- s.description = %q{This Ruby extension defines the class Hornetseye::Malloc. Hornetseye::Malloc#new allows you to allocate memory, using Hornetseye::Malloc#+ one can do pointer manipulation, and Hornetseye::Malloc#read and Hornetseye::Malloc#write provide reading Ruby strings from memory and writing Ruby strings to memory.}
9
- s.author = %q{Jan Wedekind}
10
- s.email = %q{jan@wedesoft.de}
11
- s.homepage = %q{http://wedesoft.github.com/malloc/}
12
- s.files = [ 'README', 'COPYING', '.document' ] +
13
- Dir.glob( 'lib/*.rb' ) +
14
- [ 'ext/malloc.so' ] +
15
- Dir.glob( 'test/*.rb' )
16
- s.test_files = Dir.glob( 'test/tc_*.rb' )
17
- s.require_paths = [ 'lib', 'ext' ]
18
- s.rubyforge_project = %q{hornetseye}
19
- s.has_rdoc = 'yard'
20
- s.extra_rdoc_files = []
21
- s.rdoc_options = %w{--no-private}
22
- end
data/ext/extconf.rb DELETED
@@ -1,4 +0,0 @@
1
- require 'mkmf'
2
- CONFIG[ 'LDSHARED' ] = "$(CXX) -shared"
3
- create_makefile 'malloc'
4
-
data/source.gemspec DELETED
@@ -1,28 +0,0 @@
1
- require 'date'
2
- Gem::Specification.new do |s|
3
- s.name = %q{malloc}
4
- s.version = '0.2.3'
5
- s.platform = Gem::Platform::RUBY
6
- s.date = Date.today.to_s
7
- s.summary = %q{Object for raw memory allocation and pointer operations}
8
- s.description = %q{This Ruby extension defines the class Hornetseye::Malloc. Hornetseye::Malloc#new allows you to allocate memory, using Hornetseye::Malloc#+ one can do pointer manipulation, and Hornetseye::Malloc#read and Hornetseye::Malloc#write provide reading Ruby strings from memory and writing Ruby strings to memory.}
9
- s.author = %q{Jan Wedekind}
10
- s.email = %q{jan@wedesoft.de}
11
- s.homepage = %q{http://wedesoft.github.com/malloc/}
12
- s.files = [ 'source.gemspec', 'binary.gemspec', 'Makefile', 'README',
13
- 'COPYING', '.document' ] +
14
- Dir.glob( 'lib/*.rb' ) +
15
- Dir.glob( 'ext/*.cc' ) +
16
- Dir.glob( 'ext/*.hh' ) +
17
- [ 'ext/extconf.rb' ] +
18
- Dir.glob( 'test/*.rb' )
19
- s.test_files = Dir.glob( 'test/tc_*.rb' )
20
- # s.default_executable = %q{...}
21
- # s.executables = Dir.glob( 'bin/*' ).collect { |f| File.basename f }
22
- s.require_paths = [ 'lib', 'ext' ]
23
- s.rubyforge_project = %q{hornetseye}
24
- s.extensions = %w{ext/extconf.rb}
25
- s.has_rdoc = 'yard'
26
- s.extra_rdoc_files = []
27
- s.rdoc_options = %w{--no-private}
28
- end