annotate ruby/rbdc/extconf.rb @ 24:681db37a300c

- prep 1.0 release
author Tassilo Philipp
date Thu, 19 Apr 2018 18:54:47 +0200
parents 80273969f043
children 02a455de2b40
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 #//////////////////////////////////////////////////////////////////////
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2 #
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 # extconf.rb
1
5e159be89d73 - ruby and sh binding updates for dc r0.9
cslag
parents: 0
diff changeset
4 # Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 # Tassilo Philipp <tphilipp@potion-studios.com>
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 #
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 # Permission to use, copy, modify, and distribute this software for any
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8 # purpose with or without fee is hereby granted, provided that the above
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9 # copyright notice and this permission notice appear in all copies.
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 #
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 #
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 # Configuration file for dyncall/ruby extension. This script creates
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 # a makefile that can be used to compile the C-extension. It is
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 # configured such that every .c file in this directory will be used
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22 # for compilation.
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23 #
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24 #///////////////////////////////////////////////////////////////////////
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26 require 'mkmf'
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 dir_config 'rbdc'
6
80273969f043 - ruby binding path cleanup, previous version required bindings and dyncall be checked out in same parent directory
cslag
parents: 1
diff changeset
29 base_dir = 'dyncall/'
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30
6
80273969f043 - ruby binding path cleanup, previous version required bindings and dyncall be checked out in same parent directory
cslag
parents: 1
diff changeset
31 $CFLAGS << ' -Idyncall/dyncall '
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
32
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
33 # Build dyncall libs.
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
34 puts 'Building dyncall libraries:'
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
35 Dir.chdir(base_dir) do
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
36 cmd = case
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
37 when RUBY_PLATFORM =~ /mswin/ then 'configure.bat && nmake /f Nmakefile'
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
38 else './configure && env CFLAGS="-fPIC" make'
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
39 end
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
40 puts cmd
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
41 raise "'#{cmd}' failed" unless system(cmd)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
42 end
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
44 # Search for dyncall libs.
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45 puts 'Using the following dyncall libraries to build native ruby extension:'
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
46 Dir[base_dir+'**/*'].each { |d|
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
47 if d =~ /(lib)?dyn(call(back)?|load)_s\./
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
48 $LOCAL_LIBS << '"'+d+'" '
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
49 puts d
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
50 end
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
53 if($LOCAL_LIBS.size > 0) then
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
54 # Write out a makefile for our dyncall extension.
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
55 create_makefile 'rbdc'
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56 else
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
57 puts "Couldn't find dyncall and dynload libraries - dyncall build seems to have failed!"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58 end
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
59