forked from cms-sw/cmsdist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpythia6.spec
69 lines (59 loc) · 1.9 KB
/
pythia6.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
### RPM external pythia6 426
Source: http://cern.ch/service-spi/external/MCGenerators/distribution/%{n}/%{n}-%{realversion}-src.tgz
%define keep_archives true
%if "%(case %cmsplatf in (osx*_*_gcc421) echo true ;; (*) echo false ;; esac)" == "true"
Requires: gfortran-macosx
%endif
%prep
# NOTE: Old gcc versions (up to 4.3.4) were building
# dynamic libraries. from 4.5.1 (and on mac)
# we build archive ones.
case %cmsplatf in
slc5_*_gcc4[01234]*)
PLATF_CONF_OPTS="--enable-shared"
F77="`which gfortran`"
;;
*)
PLATF_CONF_OPTS="--disable-shared --enable-static"
F77="`which gfortran` -fPIC"
;;
esac
# Notice we need to define LDFLAGS like this to avoid dropping
# the dynamic linker options on slc5_amd64_gcc434
case %cmsplatf in
osx*)
PLATF_LDFLAGS="LDFLAGS='-Wl,-commons,use_dylibs -Wl,-flat_namespace'"
PLATF_LDFLAGS=""
PLATF_LD="LD='`which gcc`'" ;;
*)
PLATF_LD="" ;;
esac
%setup -q -n %{n}/%{realversion}
# Unfortunately we need the two cases because LDFLAGS= does not work on linux
# and I couldn't get the space between use_dylibs and -Wl, preseved if
# I tried to have the whole "LDFLAGS=foo" in a variable.
case %cmsplatf in
osx*)
./configure $PLATF_CONF_OPTS --with-hepevt=4000 F77="$F77" \
LD='`which gcc`' LDFLAGS='-Wl,-commons,use_dylibs -Wl,-flat_namespace'
;;
*)
./configure $PLATF_CONF_OPTS --with-hepevt=4000 F77="$F77"
;;
esac
# NOTE: force usage of gcc to link shared libraries in place of gfortran since
# the latter causes a:
#
# ld: codegen problem, can't use rel32 to external symbol __gfortrani_compile_options in __gfortrani_init_compile_options
#
# error when building.
# I couldn't find any better way to replace "CC" in the F77 section of libtool.
case %cmsplatf in
slc5_*_gcc4[01234]*) ;;
*) perl -p -i -e 's|^CC=.*$|CC="gcc -fPIC"|' libtool ;;
esac
%build
make
make install
%install
tar -c lib include | tar -x -C %i