Removed need for gcc as a dependency for debian packages.

This commit is contained in:
Patrick J Cherry
2012-01-24 15:59:30 +00:00
parent f0775b2a9e
commit 888f9f5156
5 changed files with 47 additions and 7 deletions

View File

@@ -7,6 +7,28 @@ Rake::TestTask.new do |t|
t.test_files = FileList["test/**/t_*.rb"]
end
task :gem do
desc "Create the size_t size macro for c_struct"
file 'lib/linux/c_struct_sizeof_size_t.rb' do |t|
begin
sz = Integer(`echo __SIZEOF_SIZE_T__ | /usr/bin/gcc -E -P -`)
File.open(t.name, 'w+') do |fh|
fh.puts "module Linux ; class CStruct ; SIZEOF_SIZE_T = #{sz} ; end ; end"
end
rescue
rm_f t.name
end
end
desc "Package a gem"
task :gem do
#
# FIXME. If using a gem, fall back on GCC to determine sizeof size_t.
#
rm_f "lib/linux/c_struct_sizeof_size_t.rb"
sh "gem build netlinkrb.gemspec"
end
desc "clean up"
task :clean do
rm_f "lib/linux/c_struct_sizeof_size_t.rb"
end

7
debian/changelog vendored
View File

@@ -1,3 +1,10 @@
linux-netlink-ruby (0.10-4) unstable; urgency=low
* Removed dependency on gcc, in favour of having arch-dependent packages
which rely on build-time ascertation of sizeof size_t.
-- Patrick J Cherry <patrick@bytemark.co.uk> Tue, 24 Jan 2012 15:56:46 +0000
linux-netlink-ruby (0.10-3) unstable; urgency=low
* Updated version number to cover the previous changes.

10
debian/control vendored
View File

@@ -3,7 +3,7 @@ Maintainer: Matthew Bloch <matthew@bytemark.co.uk>
Uploaders: Patrick J Cherry <patrick@bytemark.co.uk>
Section: ruby
Priority: optional
Build-Depends: debhelper (>= 7), cdbs, ruby1.8, ruby1.9.1, ruby-pkg-tools
Build-Depends: debhelper (>= 7), cdbs, ruby1.8, ruby1.9.1, ruby-pkg-tools, rake
Standards-Version: 3.8.0
Package: liblinux-netlink-ruby
@@ -17,8 +17,8 @@ Description: Netlink socket library for Ruby
This is the metapackage for all versions of Ruby.
Package: liblinux-netlink-ruby1.8
Architecture: all
Depends: ruby1.8 (>= 1.8.7), libffi-ruby1.8, gcc, ${misc:Depends}
Architecture: any
Depends: ruby1.8 (>= 1.8.7), libffi-ruby1.8, ${misc:Depends}
Description: Netlink socket library for Ruby 1.8
This library provides an API for using a Linux Netlink socket, for doing
things like manipulating IP interfaces and routes programmatically, and
@@ -28,8 +28,8 @@ Description: Netlink socket library for Ruby 1.8
Package: liblinux-netlink-ruby1.9.1
Architecture: all
Depends: ruby1.9.1, libffi-ruby1.9.1, gcc, ${misc:Depends}
Architecture: any
Depends: ruby1.9.1, libffi-ruby1.9.1, ${misc:Depends}
Description: Netlink socket library for Ruby 1.9.1
This library provides an API for using a Linux Netlink socket, for doing
things like manipulating IP interfaces and routes programmatically, and

5
debian/rules vendored
View File

@@ -4,3 +4,8 @@
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/ruby-pkg-tools/1/class/ruby-setup-rb.mk
makebuilddir::
rake lib/linux/c_struct_sizeof_size_t.rb
clean::
rake clean

View File

@@ -79,7 +79,13 @@ class CStruct
define_type :ns, :pattern => "n", :align => true
define_type :nl, :pattern => "N", :align => true
SIZEOF_SIZE_T = Integer(`echo __SIZEOF_SIZE_T__ | gcc -E -P -`) rescue 1.size
begin
require 'linux/c_struct_sizeof_size_t.rb'
rescue LoadError
warn "Falling back to gcc to determine sizeof size_t." if $VERBOSE
SIZEOF_SIZE_T = Integer(`echo __SIZEOF_SIZE_T__ | gcc -E -P -`) rescue 1.size
end
define_type :size_t,
case SIZEOF_SIZE_T
when 8