updated on Tue Jan 17 20:03:13 UTC 2012
[aur-mirror.git] / pythia8 / PKGBUILD
blobdc45f9d14aa87441a7896b8a5a474faa859b56c4
1 ###参照gentoo的相应ebuild文件
2 #Contributor : T.Cunly
3 pkgname=pythia8
4 pkgver=130
5 pkgrel=1
6 pkgdesc="Lund Monte Carlo high-energy physics event generator" 
7 arch=('i686' 'x86_64')
8 url="http://home.thep.lu.se/~torbjorn/Pythia.html"
9 license=('GPL')
10 depends=(HepMC)
11 install=(pythia8.install)
12 source=("http://home.thep.lu.se/~torbjorn/pythia8/${pkgname}${pkgver}.tgz")
13 md5sums=("96af2f9e52baee749647b005851b356f")
15 build() {
16     cd "$startdir/src/${pkgname}${pkgver}"
17     #Change some directories
18     mkdir -p include/pythia8
19     mv include/*.h include/pythia8/
20     sed -i -e "s:INCDIR=include:INCDIR=include/pythia8:g" Makefile ||return 1
21     sed -i -e "s:LIBDIR=lib:LIBDIR=lib/pythia8:g" Makefile || return 1
22     sed -i -e "s:LIBDIRARCH=lib/archive:LIBDIRARCH=lib/pythia8/archive:g" Makefile ||return 1
23            
24     ./configure --with-hepmc=/usr/local --with-hepmcversion=2  --lcgplatform=Linux-gcc4  --enable-shared
25     
26     #Change the build parameter
27     sed -i -e "s:-O2:-O3:g" config.mk || return 1
28     
29     make -j3 || return 1
30     
31     INSDIR=/usr/local
32     SRCDIR=$startdir/src/${pkgname}${pkgver}
33     
34     ###安装库和头文件###
35     LIBDIR=${startdir}/pkg/${INSDIR}/lib
36     INCLUDEDIR=${startdir}/pkg/${INSDIR}/include
37     [ -d $INCLUDEDIR  ] || mkdir -p $INCLUDEDIR
38     [ -d $LIBDIR ] || mkdir -p $LIBDIR
39     cp -r  ${SRCDIR}/lib/*  $LIBDIR/  || die "lib install failed"
40     cp -r  ${SRCDIR}/include/*  $INCLUDEDIR/ || die "headers install failed"
41     
42     ###安装doc###
43     DOCDIR=${startdir}/pkg/${INSDIR}/doc/pythia8
44     [ -d $DOCDIR ] || mkdir -p $DOCDIR
45    
46     cp -r ${SRCDIR}/xmldoc $DOCDIR/ || die "xmldoc install failed"
47     cp -r ${SRCDIR}/htmldoc $DOCDIR/ || die "htmldoc install failed"
48     cp -r ${SRCDIR}/phpdoc $DOCDIR/ || die "phpdoc install failed"
49     
50     ###安装例子##
51     EXAMPLEDIR=${startdir}/pkg/${INSDIR}/examples/pythia8
52     [ -d $EXAMPLEDIR  ] || mkdir -p $EXAMPLEDIR/bin
53     cp -r ${SRCDIR}/examples/* $EXAMPLEDIR/ || die "examples install failed"
54     
55     ###Modify the Makefile in the examples directory####
56     cd $EXAMPLEDIR
57     cp $SRCDIR/config.mk ./config.mk.orig
58     sed -i -e "s:-include \.\./config\.mk:-include config\.mk\.orig:" Makefile || return 1
59     sed -i -e "s:\.\.:$INSDIR:g" Makefile || return 1
60     sed -i -e "s:INCDIR=include:INCDIR=include/pythia8:" Makefile ||return 1
61     sed -i -e "s:LIBDIR=lib:LIBDIR=lib/pythia8:" Makefile || return 1
62     sed -i -e "s:LIBDIRARCH=lib/archive:LIBDIRARCH=lib/pythia8/archive:" Makefile ||return 1
63     sed -i -e "s:-o /usr/local:-o .:" Makefile || return 1
64     
65      
66     ###Modify the mainNN.cc files in the examples directory so as the program can find the xmldoc###
67     cd $EXAMPLEDIR
68     for i in *.cc
69     do
70       sed -i -e "s:Pythia pythia\;:Pythia pythia\(\"$INSDIR/doc/pythia8/xmldoc\"\)\;:" $i || echo "Failed"
71     done