Skip to content
Snippets Groups Projects
Commit 9294b392 authored by Ulrich Schwickerath's avatar Ulrich Schwickerath
Browse files

Unify building on Darwin

parent aa0b3644
No related branches found
No related tags found
No related merge requests found
......@@ -167,6 +167,9 @@ if ($OS_ARCH eq 'x86_64') {
$CFLAGS = "$CFLAGS -mfpmath=387";
$ADDFOPT = "$ADDFOPT -mfpmath=387";
}
if ($OS eq 'Darwin'){
$LDFLAGS = "$LDFLAGS -Wl,-ld_classic,-dead_strip";
}
my $gfortran_version;
if ($OS eq "Linux" || $OS eq "Darwin"){
$gfortran_version = `echo '__GNUC__'| gfortran -E -P -`;
......@@ -180,7 +183,6 @@ if ($OS eq "Linux" || $OS eq "Darwin"){
$ENV{"ADDFOPT"}=$ADDFOPT;
$ENV{"ADDCOPT"}=$ADDCOPT;
}
#
# parse the options
#
......@@ -232,36 +234,29 @@ my %LIBRARIES;
if (grep {$VERSION =~ /$_/} @lep1){
%LIBRARIES = (
"delana" =>
[qw(ddapp cargo dplot delanagen deltask pxtag25
ufield delanamod tanagra322 uhlib delphys ux26
[qw(ddapp cargo dplot delanagen deltask pxtag25 phdst
ufield delanamod tanagra322 uhlib delphys ux26 uxxx
pxdst33 trigglib fxsolv delana43.exe delblkd
comlib)],
"delsim" =>
[qw(simrun36 modsim36 delsim36 jetst732 dbsnap shortdst longdst dbzeb)]
);
push(@{$LIBRARIES{delsim}}, qw[dstana10 vdclap phdst]);
# pxdst defines the symbols _qnext and _zend which are also defined in CERNLIB. This should be generally fine
# but for shortdst and longdst which do not use the routines (pxloop and pxend) using those, and the Apple linker
# links these and their dependencies, resulting in thee need of adding most of the other DELPHI libraries albeit they
# should not be used. To remedy this, on Apple we create an additional library pxdstext which contains only those symbols
# of pxdst which are needed for (x)shortdst and longdst, and link against this one instead when creating these execs.
push(@{$LIBRARIES{delana}}, qw[pxdstext]) if $OS eq "Darwin";
} else {
%LIBRARIES = (
"dstana" =>
[qw(uxxx bsaurus dstanaxx herlibxx kalxx phdst pxdstxx
[qw(uxxx bsaurus dstanaxx herlibxx kalxx phdst
pxtagxx skelana tanagraxx triggerxx ufield
uhlib vdclapxx vfclapxx tauplus errhp delblkd)],
"delana" =>
[qw(ddapp cargo dplot delanagen deltask pxtag25
[qw(ddapp cargo dplot delanagen deltask pxtag25 phdst
ufield delanamod tanagra322 uhlib delphys
pxdst34 trigglib ux26 fxsolv delana45.exe delblkd
pxdst34 trigglib ux26 uxxx fxsolv delana45.exe delblkd
comlib)],
"delsim" =>
[qw(simrun36 modsim delsim jetst732 dbsnap xshortdst dbzeb)]
);
push(@{$LIBRARIES{delsim}},qw[dstanaxx vdclapxx vfclapxx phdst]);
push(@{$LIBRARIES{delana}}, qw[pxdstext]) if $OS eq "Darwin";
};
# only create dstana and delana executables for event server
undef $LIBRARIES{delsim} if defined $DATA;
......@@ -587,7 +582,7 @@ sub MakeLibs {
if ($PACKAGE eq "dstana"){
print CRA "+USE, SHIFT.\n+USE, $PLINAM,*$PLINAM.\n+USE, UNIX.\n";
}else{
print CRA "+USE, SHIFT.\n+USE, $PLINAM,*$PLINAM.\n+USE, UNIX.\n" if grep {$_ eq $lib} qw(pxdst33 pxdst34 ux26 dstanaxx vdclapxx vfclapxx ufield);
print CRA "+USE, SHIFT.\n+USE, $PLINAM,*$PLINAM.\n+USE, UNIX.\n" if grep {$_ eq $lib} qw(pxdst33 pxdst34 ux26 uxxx dstanaxx vdclapxx vfclapxx ufield);
}
close(CRA);
my $delcra = $lib;
......@@ -1137,7 +1132,7 @@ sub CreateSimrun {
#
# Compile and link the executable
#
my $command = "$F77{$OS} $LDFLAGS $FFLAGS $ADDFOPT -o $lib *.f $DELPHI_BLKD/simblkd.o $dellib $cernlib";
my $command = "$F77{$OS} -v $LDFLAGS $FFLAGS $ADDFOPT -o $lib *.f $DELPHI_BLKD/simblkd.o $dellib $cernlib";
PrintInfo("running \"$command\"");
system($command);
PrintInfo("No executable \"$lib\" created") if not -f $lib;
......@@ -1162,7 +1157,7 @@ sub CreateDelana {
my $dellib;
my @liblist;
if ($LEP1flag){
@liblist = qw(trigglib pxdst33 pxtag25 pxdst33 delphys deltask delanamod delanagen delanamod ux26 ddappxx tanagra322 uhlib ufield com);
@liblist = qw(trigglib pxdst33 pxtag25 pxdst33 delphys deltask delanamod delanagen delanamod uxxx phdstxx ddappxx tanagra322 uhlib ufield com);
map {PrintError("Cannot create \"$lib.exe\": no library $DELPHI_LIB/lib$_.a") if not -f "$DELPHI_LIB/lib$_.a"} @liblist;
map {PrintError("Cannot create \"$lib.exe\": no object $_") if not -f $_} ("$DELPHI_BLKD/anablkd.o","$DELPHI_LIB/fxsolv.o");
#
......@@ -1170,10 +1165,10 @@ sub CreateDelana {
#
map {$_ = "-l$_"} @liblist; # prepend each library with "-l"
PrintInfo(@liblist);
$dellib = "$DELPHI_LIB/fxsolv.o -L$DELPHI_LIB @liblist";
$dellib = "$DELPHI_LIB/fxsolv.o -L$DELPHI_LIB @liblist -lz";
} else {
#LEP2
@liblist = qw(trigglib pxdst34 pxtag25 pxdst34 delphys deltask delanamod delanagen delanamod ux26 ddappxx tanagra322 uhlib ufield com);
@liblist = qw(trigglib pxdst34 pxtag25 pxdst34 delphys deltask delanamod delanagen delanamod uxxx phdstxx ddappxx tanagra322 uhlib ufield com );
map {PrintError("Cannot create \"$lib.exe\": no library $DELPHI_LIB/lib$_.a") if not -f "$DELPHI_LIB/lib$_.a"} @liblist;
map {PrintError("Cannot create \"$lib.exe\": no object $_") if not -f $_} ("$DELPHI_BLKD/anablkd.o","$DELPHI_LIB/fxsolv.o");
#
......@@ -1181,7 +1176,7 @@ sub CreateDelana {
#
map {$_ = "-l$_"} @liblist; # prepend each library with "-l"
PrintInfo(@liblist);
$dellib = "$DELPHI_LIB/fxsolv.o -L$DELPHI_LIB @liblist";
$dellib = "$DELPHI_LIB/fxsolv.o -L$DELPHI_LIB @liblist -lz";
}
#
# create and fix the cradle
......@@ -1218,7 +1213,7 @@ sub CreateDelana {
#
# Compile and link the executable
#
my $command = "$F77{$OS} $LDFLAGS $FFLAGS $ADDFOPT -o $lib.exe *.f $DELPHI_BLKD/anablkd.o $dellib $cernlib";
my $command = "$F77{$OS} -v $LDFLAGS $FFLAGS $ADDFOPT -o $lib.exe *.f $DELPHI_BLKD/anablkd.o $dellib $cernlib";
PrintInfo("running \"$command\"");
system($command);
PrintInfo("No executable \"$lib.exe\" created") if not -f "$lib.exe";
......@@ -1245,13 +1240,13 @@ sub MakeXShorty {
# make sure all necessary libraries are available
#
symlink "libtanagra322.a","$DELPHI_LIB/libtanagraxx.a" if -f "$DELPHI_LIB/libtanagra322.a";
symlink "libux26.a","$DELPHI_LIB/libuxxx.a" if -f "$DELPHI_LIB/libux26.a";
# symlink "libux26.a","$DELPHI_LIB/libuxxx.a" if -f "$DELPHI_LIB/libux26.a";
symlink "libpxdst34.a","$DELPHI_LIB/libpxdstxx.a" if -f "$DELPHI_LIB/libpxdst34.a";
symlink "libpxtag25.a","$DELPHI_LIB/libpxtag2xx.a" if -f "$DELPHI_LIB/libpxtag25.a";
symlink "libufield.a","$DELPHI_LIB/libufieldxx.a" if -f "$DELPHI_LIB/libufield.a";
symlink "libtrigglib.a","$DELPHI_LIB/libtriggerxx.a" if -f "$DELPHI_LIB/libtrigglib.a";
symlink "libuhlib.a","$DELPHI_LIB/libuhlibxx.a" if -f "$DELPHI_LIB/libuhlib.a";
my @liblist = qw(dstanaxx vdclapxx vfclapxx ufieldxx phdstxx);
my @liblist = qw(dstana vdclap vfclap ufield pxtag tanagra trigger uhlib ux);
map {PrintInfo("\"$lib.exe\": no library $DELPHI_LIB/lib$_.a") if not -f "$DELPHI_LIB/lib$_.a"} @liblist;
map {PrintError("Cannot create \"$lib.exe\": no object $_") if not -f $_} ("$DELPHI_BLKD/delblkd.o");
#
......@@ -1274,13 +1269,12 @@ sub MakeXShorty {
#
# Delphi libraries
#
chomp (my $dellib = "$libdir " . `$dellib @liblist`);
if ($OS eq "Darwin") {
$dellib .= " -lpxdstext"
} else {
$dellib .= " -lpxdst34"
}
PrintInfo("Final DELPHI libraries for $OS $dellib\n");
#chomp (my $dellib = "$libdir " . `$dellib @liblist`);
#$dellib .= ' -lpxdst34 -lphdstxx -ldelanagen -ldelanamod -ldeltask';
my $dellib = '-L$DELPHI_LIB -lphdstxx '; #phdst
$dellib .= '-ldstanaxx -lpxdst34 -lufield -lvdclapxx -lvfclapxx -lphdstxx -ldstanaxx -luxxx -ltanagra322 -lpxtag25 -ltrigglib -luhlib -ldelanagen -ldelanamod -ldeltask';
$dellib .= " $libdir -lz";
PrintInfo("Final DELPHI libraries for $OS $dellib\n");
#
# Cern and system libraries
#
......@@ -1318,13 +1312,12 @@ sub MakeShorty {
# make sure all necessary libraries are available
#
symlink "libtanagra322.a","$DELPHI_LIB/libtanagraxx.a" if -f "$DELPHI_LIB/libtanagra322.a";
symlink "libux26.a","$DELPHI_LIB/libuxxx.a" if -f "$DELPHI_LIB/libux26.a";
symlink "libpxdst33.a","$DELPHI_LIB/libpxdstxx.a" if -f "$DELPHI_LIB/libpxdst33.a";
symlink "libpxtag25.a","$DELPHI_LIB/libpxtag2xx.a" if -f "$DELPHI_LIB/libpxtag25.a";
symlink "libufield.a","$DELPHI_LIB/libufieldxx.a" if -f "$DELPHI_LIB/libufield.a";
symlink "libtrigglib.a","$DELPHI_LIB/libtriggerxx.a" if -f "$DELPHI_LIB/libtrigglib.a";
symlink "libuhlib.a","$DELPHI_LIB/libuhlibxx.a" if -f "$DELPHI_LIB/libuhlib.a";
my @liblist = qw(dstana10 ufield vdclap phdstxx pxdst33);
my @liblist = qw(dstana10 ufield vdclap phdstxx pxdst33 uxxx tanagra322);
map {PrintError("Cannot create \"$lib.exe\": no library $DELPHI_LIB/lib$_.a") if not -f "$DELPHI_LIB/lib$_.a"} @liblist;
map {PrintError("Cannot create \"$lib.exe\": no object $_") if not -f $_} ("$DELPHI_BLKD/delblkd.o");
#
......@@ -1348,12 +1341,7 @@ sub MakeShorty {
# Delphi libraries
#
my $dellib = '-L$DELPHI_LIB -lphdstxx '; #phdst
$dellib .= ' -ldstana10 -lufield -lvdclap -ldstana10 -lphdstxx';
if ($OS eq "Darwin") {
$dellib .= " -lpxdstext"
} else {
$dellib .= " -lpxdst33"
}
$dellib .= '-ldstana10 -lpxdst33 -lufield -lvdclap -lphdstxx -ldstana10 -luxxx -ltanagra322 -lpxtag25 -ltrigglib -luhlib -ldelanagen -ldelanamod -ldeltask';
$dellib .= " $libdir -lz";
#
# Cern and system libraries
......@@ -1362,7 +1350,7 @@ sub MakeShorty {
#
# Compile and link the executable
#
my $command = "$F77{$OS} $FFLAGS $LDFLAGS $ADDFOPT -o $lib.exe *.f $DELPHI_BLKD/delblkd.o -v $dellib $cernlib";
my $command = "$F77{$OS} -v $LDFLAGS $FFLAGS $ADDFOPT -o $lib.exe *.f $DELPHI_BLKD/delblkd.o -v $dellib $cernlib";
PrintInfo("running \"$command\"");
system($command);
if (not -f "$lib.exe") {
......@@ -1388,7 +1376,7 @@ sub MakeLongy {
# make sure all necessary libraries are available
#
symlink "libtanagra322.a","$DELPHI_LIB/libtanagraxx.a" if -f "$DELPHI_LIB/libtanagra322.a";
symlink "libux26.a","$DELPHI_LIB/libuxxx.a" if -f "$DELPHI_LIB/libux26.a";
# symlink "libux26.a","$DELPHI_LIB/libuxxx.a" if -f "$DELPHI_LIB/libux26.a";
symlink "libpxtag25.a","$DELPHI_LIB/libpxtag2xx.a" if -f "$DELPHI_LIB/libpxtag25.a";
symlink "libpxdst33.a","$DELPHI_LIB/libpxdstxx.a" if -f "$DELPHI_LIB/libpxdst33.a";
symlink "libufield.a","$DELPHI_LIB/libufieldxx.a" if -f "$DELPHI_LIB/libufield.a";
......@@ -1418,12 +1406,7 @@ sub MakeLongy {
# Delphi libraries
#
my $dellib = '-L$DELPHI_LIB -lphdstxx '; #phdst
$dellib .= ' -ldstana10 -lufield -lvdclap -ldstana10 -lphdstxx ';
if ($OS eq "Darwin") {
$dellib .= " -lpxdstext"
} else {
$dellib .= " -lpxdst33"
}
$dellib .= '-ldstana10 -lpxdst33 -lufield -lvdclap -lphdstxx -ldstana10 -luxxx -ltanagra322 -lpxtag25 -ltrigglib -luhlib -ldelanagen -ldelanamod -ldeltask';
$dellib .= " $libdir -lz";
#
# Cern and system libraries
......@@ -1432,7 +1415,7 @@ sub MakeLongy {
#
# Compile and link the executable
#
my $command = "$F77{$OS} $FFLAGS $LDFLAGS $ADDFOPT -fbounds-check -o $lib.exe *.f $DELPHI_BLKD/delblkd.o -v $dellib $cernlib";
my $command = "$F77{$OS} -v $LDFLAGS $FFLAGS $ADDFOPT -fbounds-check -o $lib.exe *.f $DELPHI_BLKD/delblkd.o -v $dellib $cernlib";
PrintInfo("running \"$command\"");
system($command);
if (not -f "$lib.exe") {
......
......@@ -52,6 +52,7 @@ switch ( $Machine )
set CompileC = "cc -c -O2 -I/usr/local/include "
set Library = "ar srl "
breaksw
case LINUX:
case Linux:
set Ppatch = "LINUX, SHIFT"
set CompileF = "gfortran $FOPT -c"
......@@ -59,6 +60,7 @@ switch ( $Machine )
set Library = "ar sr "
breaksw
case Darwin:
case DARWIN:
set Ppatch = "DARWIN, SHIFT"
set CompileF = "gfortran $FOPT -c"
set CompileC = "gcc $COPT -c"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment