source: tags/ms_r16q2/PERL2ARB/make_arbperl_makefile.pl

Last change on this file was 14792, checked in by westram, 8 years ago
  • OSX build: workaround SIP restrictions
File size: 1.7 KB
Line 
1use ExtUtils::MakeMaker;
2# See lib/ExtUtils/MakeMaker.pm for details on how to influence
3# the contents of the Makefile that gets written.
4
5# called from Makefile.main@buildMakefile
6
7my $name         = 'ARB';
8my $version_from = 'ARB.pm';
9my $inc          = '-I../INCLUDE';
10
11my $compiler = $ENV{'A_CXX'};
12my $execlibs = $ENV{'EXECLIBS'};
13
14my $libs;
15{
16  # Explicitly add directories from LD_LIBRARY_PATH to linker command.
17  #
18  # otherwise generated Makefile overrides dynamic linking of libstdc++ via LD_RUN_PATH
19  # and make it impossible to build with non-system gcc (e.g. in /opt/gcc-4.7.1/..)
20
21  my $LD_LIBRARY_PATH = $ENV{LD_LIBRARY_PATH};
22  if (not defined $LD_LIBRARY_PATH) {
23    my $ARBBUILD_LIBRARY_PATH = $ENV{ARBBUILD_LIBRARY_PATH};
24    if (not defined $ARBBUILD_LIBRARY_PATH) {
25      die "Neither LD_LIBRARY_PATH nor ARBBUILD_LIBRARY_PATH is defined";
26    }
27    $LD_LIBRARY_PATH = $ARBBUILD_LIBRARY_PATH;
28  }
29
30  $libs = '';
31  foreach (split /:/,$LD_LIBRARY_PATH) {
32    if (($_ ne '') and (-d $_)) { $libs .= ' -L'.$_; }
33  }
34  $libs =~ s/^\s+//;
35  $libs .= ' -lCORE -lARBDB -lstdc++ '.$execlibs.' ';
36}
37
38my $args = scalar(@ARGV);
39if ($args!=2) {
40  die "Usage: make_arbperl_makefile.pl compiler-flags linker-flags\n".
41    "Error: missing arguments";
42}
43
44my $cflags = shift @ARGV;
45my $lflags = shift @ARGV;
46
47WriteMakefile(
48              'NAME'         => $name,
49              'VERSION_FROM' => $version_from,
50              'CC'           => $compiler,
51              'CCFLAGS'      => $cflags,
52              'LD'           => $compiler,
53              'LDDLFLAGS'    => $lflags,
54              'DEFINE'       => '',
55              'INC'          => $inc,
56              'LIBS'         => $libs,
57             );
58
Note: See TracBrowser for help on using the repository browser.