Skip to content
Snippets Groups Projects

Unify building on Darwin

Merged Ulrich Schwickerath requested to merge DELPHI-514 into master
Files
2
+ 29
46
@@ -167,6 +167,9 @@ if ($OS_ARCH eq 'x86_64') {
@@ -167,6 +167,9 @@ if ($OS_ARCH eq 'x86_64') {
$CFLAGS = "$CFLAGS -mfpmath=387";
$CFLAGS = "$CFLAGS -mfpmath=387";
$ADDFOPT = "$ADDFOPT -mfpmath=387";
$ADDFOPT = "$ADDFOPT -mfpmath=387";
}
}
 
if ($OS eq 'Darwin'){
 
$LDFLAGS = "$LDFLAGS -Wl,-ld_classic,-dead_strip";
 
}
my $gfortran_version;
my $gfortran_version;
if ($OS eq "Linux" || $OS eq "Darwin"){
if ($OS eq "Linux" || $OS eq "Darwin"){
$gfortran_version = `echo '__GNUC__'| gfortran -E -P -`;
$gfortran_version = `echo '__GNUC__'| gfortran -E -P -`;
@@ -180,7 +183,6 @@ if ($OS eq "Linux" || $OS eq "Darwin"){
@@ -180,7 +183,6 @@ if ($OS eq "Linux" || $OS eq "Darwin"){
$ENV{"ADDFOPT"}=$ADDFOPT;
$ENV{"ADDFOPT"}=$ADDFOPT;
$ENV{"ADDCOPT"}=$ADDCOPT;
$ENV{"ADDCOPT"}=$ADDCOPT;
}
}
#
#
# parse the options
# parse the options
#
#
@@ -232,36 +234,29 @@ my %LIBRARIES;
@@ -232,36 +234,29 @@ my %LIBRARIES;
if (grep {$VERSION =~ /$_/} @lep1){
if (grep {$VERSION =~ /$_/} @lep1){
%LIBRARIES = (
%LIBRARIES = (
"delana" =>
"delana" =>
[qw(ddapp cargo dplot delanagen deltask pxtag25
[qw(ddapp cargo dplot delanagen deltask pxtag25 phdst
ufield delanamod tanagra322 uhlib delphys ux26
ufield delanamod tanagra322 uhlib delphys ux26 uxxx
pxdst33 trigglib fxsolv delana43.exe delblkd
pxdst33 trigglib fxsolv delana43.exe delblkd
comlib)],
comlib)],
"delsim" =>
"delsim" =>
[qw(simrun36 modsim36 delsim36 jetst732 dbsnap shortdst longdst dbzeb)]
[qw(simrun36 modsim36 delsim36 jetst732 dbsnap shortdst longdst dbzeb)]
);
);
push(@{$LIBRARIES{delsim}}, qw[dstana10 vdclap phdst]);
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 {
} else {
%LIBRARIES = (
%LIBRARIES = (
"dstana" =>
"dstana" =>
[qw(uxxx bsaurus dstanaxx herlibxx kalxx phdst pxdstxx
[qw(uxxx bsaurus dstanaxx herlibxx kalxx phdst
pxtagxx skelana tanagraxx triggerxx ufield
pxtagxx skelana tanagraxx triggerxx ufield
uhlib vdclapxx vfclapxx tauplus errhp delblkd)],
uhlib vdclapxx vfclapxx tauplus errhp delblkd)],
"delana" =>
"delana" =>
[qw(ddapp cargo dplot delanagen deltask pxtag25
[qw(ddapp cargo dplot delanagen deltask pxtag25 phdst
ufield delanamod tanagra322 uhlib delphys
ufield delanamod tanagra322 uhlib delphys
pxdst34 trigglib ux26 fxsolv delana45.exe delblkd
pxdst34 trigglib ux26 uxxx fxsolv delana45.exe delblkd
comlib)],
comlib)],
"delsim" =>
"delsim" =>
[qw(simrun36 modsim delsim jetst732 dbsnap xshortdst dbzeb)]
[qw(simrun36 modsim delsim jetst732 dbsnap xshortdst dbzeb)]
);
);
push(@{$LIBRARIES{delsim}},qw[dstanaxx vdclapxx vfclapxx phdst]);
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
# only create dstana and delana executables for event server
undef $LIBRARIES{delsim} if defined $DATA;
undef $LIBRARIES{delsim} if defined $DATA;
@@ -587,7 +582,7 @@ sub MakeLibs {
@@ -587,7 +582,7 @@ sub MakeLibs {
if ($PACKAGE eq "dstana"){
if ($PACKAGE eq "dstana"){
print CRA "+USE, SHIFT.\n+USE, $PLINAM,*$PLINAM.\n+USE, UNIX.\n";
print CRA "+USE, SHIFT.\n+USE, $PLINAM,*$PLINAM.\n+USE, UNIX.\n";
}else{
}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);
close(CRA);
my $delcra = $lib;
my $delcra = $lib;
@@ -1137,7 +1132,7 @@ sub CreateSimrun {
@@ -1137,7 +1132,7 @@ sub CreateSimrun {
#
#
# Compile and link the executable
# 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\"");
PrintInfo("running \"$command\"");
system($command);
system($command);
PrintInfo("No executable \"$lib\" created") if not -f $lib;
PrintInfo("No executable \"$lib\" created") if not -f $lib;
@@ -1162,7 +1157,7 @@ sub CreateDelana {
@@ -1162,7 +1157,7 @@ sub CreateDelana {
my $dellib;
my $dellib;
my @liblist;
my @liblist;
if ($LEP1flag){
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 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");
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 {
@@ -1170,10 +1165,10 @@ sub CreateDelana {
#
#
map {$_ = "-l$_"} @liblist; # prepend each library with "-l"
map {$_ = "-l$_"} @liblist; # prepend each library with "-l"
PrintInfo(@liblist);
PrintInfo(@liblist);
$dellib = "$DELPHI_LIB/fxsolv.o -L$DELPHI_LIB @liblist";
$dellib = "$DELPHI_LIB/fxsolv.o -L$DELPHI_LIB @liblist -lz";
} else {
} else {
#LEP2
#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 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");
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 {
@@ -1181,7 +1176,7 @@ sub CreateDelana {
#
#
map {$_ = "-l$_"} @liblist; # prepend each library with "-l"
map {$_ = "-l$_"} @liblist; # prepend each library with "-l"
PrintInfo(@liblist);
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
# create and fix the cradle
@@ -1218,7 +1213,7 @@ sub CreateDelana {
@@ -1218,7 +1213,7 @@ sub CreateDelana {
#
#
# Compile and link the executable
# 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\"");
PrintInfo("running \"$command\"");
system($command);
system($command);
PrintInfo("No executable \"$lib.exe\" created") if not -f "$lib.exe";
PrintInfo("No executable \"$lib.exe\" created") if not -f "$lib.exe";
@@ -1245,13 +1240,13 @@ sub MakeXShorty {
@@ -1245,13 +1240,13 @@ sub MakeXShorty {
# make sure all necessary libraries are available
# make sure all necessary libraries are available
#
#
symlink "libtanagra322.a","$DELPHI_LIB/libtanagraxx.a" if -f "$DELPHI_LIB/libtanagra322.a";
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 "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 "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 "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 "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";
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 {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");
map {PrintError("Cannot create \"$lib.exe\": no object $_") if not -f $_} ("$DELPHI_BLKD/delblkd.o");
#
#
@@ -1274,13 +1269,12 @@ sub MakeXShorty {
@@ -1274,13 +1269,12 @@ sub MakeXShorty {
#
#
# Delphi libraries
# Delphi libraries
#
#
chomp (my $dellib = "$libdir " . `$dellib @liblist`);
#chomp (my $dellib = "$libdir " . `$dellib @liblist`);
if ($OS eq "Darwin") {
#$dellib .= ' -lpxdst34 -lphdstxx -ldelanagen -ldelanamod -ldeltask';
$dellib .= " -lpxdstext"
my $dellib = '-L$DELPHI_LIB -lphdstxx '; #phdst
} else {
$dellib .= '-ldstanaxx -lpxdst34 -lufield -lvdclapxx -lvfclapxx -lphdstxx -ldstanaxx -luxxx -ltanagra322 -lpxtag25 -ltrigglib -luhlib -ldelanagen -ldelanamod -ldeltask';
$dellib .= " -lpxdst34"
$dellib .= " $libdir -lz";
}
PrintInfo("Final DELPHI libraries for $OS $dellib\n");
PrintInfo("Final DELPHI libraries for $OS $dellib\n");
#
#
# Cern and system libraries
# Cern and system libraries
#
#
@@ -1318,13 +1312,12 @@ sub MakeShorty {
@@ -1318,13 +1312,12 @@ sub MakeShorty {
# make sure all necessary libraries are available
# make sure all necessary libraries are available
#
#
symlink "libtanagra322.a","$DELPHI_LIB/libtanagraxx.a" if -f "$DELPHI_LIB/libtanagra322.a";
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 "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 "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 "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 "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";
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 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");
map {PrintError("Cannot create \"$lib.exe\": no object $_") if not -f $_} ("$DELPHI_BLKD/delblkd.o");
#
#
@@ -1348,12 +1341,7 @@ sub MakeShorty {
@@ -1348,12 +1341,7 @@ sub MakeShorty {
# Delphi libraries
# Delphi libraries
#
#
my $dellib = '-L$DELPHI_LIB -lphdstxx '; #phdst
my $dellib = '-L$DELPHI_LIB -lphdstxx '; #phdst
$dellib .= ' -ldstana10 -lufield -lvdclap -ldstana10 -lphdstxx';
$dellib .= '-ldstana10 -lpxdst33 -lufield -lvdclap -lphdstxx -ldstana10 -luxxx -ltanagra322 -lpxtag25 -ltrigglib -luhlib -ldelanagen -ldelanamod -ldeltask';
if ($OS eq "Darwin") {
$dellib .= " -lpxdstext"
} else {
$dellib .= " -lpxdst33"
}
$dellib .= " $libdir -lz";
$dellib .= " $libdir -lz";
#
#
# Cern and system libraries
# Cern and system libraries
@@ -1362,7 +1350,7 @@ sub MakeShorty {
@@ -1362,7 +1350,7 @@ sub MakeShorty {
#
#
# Compile and link the executable
# 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\"");
PrintInfo("running \"$command\"");
system($command);
system($command);
if (not -f "$lib.exe") {
if (not -f "$lib.exe") {
@@ -1388,7 +1376,7 @@ sub MakeLongy {
@@ -1388,7 +1376,7 @@ sub MakeLongy {
# make sure all necessary libraries are available
# make sure all necessary libraries are available
#
#
symlink "libtanagra322.a","$DELPHI_LIB/libtanagraxx.a" if -f "$DELPHI_LIB/libtanagra322.a";
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 "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 "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";
symlink "libufield.a","$DELPHI_LIB/libufieldxx.a" if -f "$DELPHI_LIB/libufield.a";
@@ -1418,12 +1406,7 @@ sub MakeLongy {
@@ -1418,12 +1406,7 @@ sub MakeLongy {
# Delphi libraries
# Delphi libraries
#
#
my $dellib = '-L$DELPHI_LIB -lphdstxx '; #phdst
my $dellib = '-L$DELPHI_LIB -lphdstxx '; #phdst
$dellib .= ' -ldstana10 -lufield -lvdclap -ldstana10 -lphdstxx ';
$dellib .= '-ldstana10 -lpxdst33 -lufield -lvdclap -lphdstxx -ldstana10 -luxxx -ltanagra322 -lpxtag25 -ltrigglib -luhlib -ldelanagen -ldelanamod -ldeltask';
if ($OS eq "Darwin") {
$dellib .= " -lpxdstext"
} else {
$dellib .= " -lpxdst33"
}
$dellib .= " $libdir -lz";
$dellib .= " $libdir -lz";
#
#
# Cern and system libraries
# Cern and system libraries
@@ -1432,7 +1415,7 @@ sub MakeLongy {
@@ -1432,7 +1415,7 @@ sub MakeLongy {
#
#
# Compile and link the executable
# 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\"");
PrintInfo("running \"$command\"");
system($command);
system($command);
if (not -f "$lib.exe") {
if (not -f "$lib.exe") {
Loading