Magellan Linux

Contents of /branches/magellan-next/core/ppl/ppl-0.10.2-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5833 - (show annotations) (download)
Mon Aug 16 21:30:25 2010 UTC (13 years, 9 months ago) by niro
File size: 3018 byte(s)
auto added: ver bump to 0.10.2-r1
1 # $Id$
2
3 PNAME="ppl"
4 PVER="0.10.2"
5 PBUILD="r1"
6
7 PCATEGORIE="dev-libs"
8 STATE="unstable"
9
10 DESCRIPTION="The Parma Polyhedra Library (PPL) provides numerical abstractions especially targeted at applications in the field of analysis and verification of complex systems."
11 HOMEPAGE="http://www.cs.unipr.it/ppl/"
12
13 # do not depend on glibc, as it depends ob libstdc++ and this wants mpc
14 # as SRCDEPEND -> this may generate loops
15 DEPEND=">= dev-libs/gmp-5.0.1"
16
17 SRCFILE="${PNAME}-${PVER}.tar.bz2"
18 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
19
20 sminclude mtools multilib
21
22 SRC_URI=(
23 ftp://ftp.cs.unipr.it/pub/ppl/releases/${PVER}/${SRCFILE}
24 mirror://${PNAME}/${SRCFILE}
25 )
26
27 UP2DATE="updatecmd ftp://ftp.cs.unipr.it/pub/ppl/releases/LATEST/ | lasttarball"
28
29 src_prepare()
30 {
31 munpack ${SRCFILE} || die
32
33 # fixes detection of newer gmp versions
34 all-abis 'sed -i "s/__GMP_BITS_PER_MP_LIMB/GMP_LIMB_BITS/g" configure' || die
35 }
36
37 src_compile()
38 {
39 mconfigure --enable-shared --disable-optimization || die
40 mmake || die
41
42 if [[ ${ARCH} = x86_64 ]]
43 then
44
45 # create a multiarch-wrapper
46 cat > ${BUILDDIR}/multiarch_wrapper.c << "EOF"
47 #define _GNU_SOURCE
48
49 #include <errno.h>
50 #include <stdio.h>
51 #include <stdlib.h>
52 #include <sys/types.h>
53 #include <sys/wait.h>
54 #include <unistd.h>
55
56 #ifndef DEF_SUFFIX
57 # define DEF_SUFFIX "64"
58 #endif
59
60 int main(int argc, char **argv)
61 {
62 char *filename;
63 char *suffix;
64
65 if(!(suffix = getenv("USE_ARCH")))
66 if(!(suffix = getenv("BUILDENV")))
67 suffix = DEF_SUFFIX;
68
69 if (asprintf(&filename, "%s-%s", argv[0], suffix) < 0) {
70 perror(argv[0]);
71 return -1;
72 }
73
74 int status = EXIT_FAILURE;
75 pid_t pid = fork();
76
77 if (pid == 0) {
78 execvp(filename, argv);
79 perror(filename);
80 goto end;
81 } else if (pid < 0) {
82 goto end_error;
83 } else {
84 if (waitpid(pid, &status, 0) != pid) {
85 status = EXIT_FAILURE;
86 goto end_error;
87 }
88 status = WEXITSTATUS(status);
89 }
90 goto end;
91
92 end_error:
93 perror(argv[0]);
94 end:
95 free(filename);
96
97 return status;
98 }
99
100 EOF
101 # compile and install the wrapper
102 gcc -m64 ${BUILDDIR}/multiarch_wrapper.c -o ${BUILDDIR}/ppl-config || die
103 fi
104 }
105
106 src_install()
107 {
108 local abi
109 for abi in ${MULTILIB_ABIS}
110 do
111 cd ${SRCDIR}-${abi}
112 make DESTDIR=${BINDIR} install || die
113
114 if [[ ${ARCH} = x86_64 ]]
115 then
116 # move the header
117 mv ${BINDIR}/usr/include/ppl{,-${abi/m/}}.hh || die
118
119 # move the config program
120 mv ${BINDIR}/usr/bin/ppl-config{,-${abi/m/}} || die
121
122 # create a wrapper header
123 cat > ${BINDIR}/usr/include/ppl.h << "EOF"
124 /* ppl.h - Stub Header */
125 #ifndef __STUB__PPL_HH__
126 #define __STUB__PPL_HH__
127
128 #if defined(__x86_64__) || \
129 defined(__sparc64__) || \
130 defined(__arch64__) || \
131 defined(__powerpc64__) || \
132 defined (__s390x__)
133 # include "ppl-64.h"
134 #else
135 # include "ppl-32.h"
136 #endif
137
138 #endif /* __STUB__PPL_HH__ */
139 EOF
140
141 # install the multiarch-wrapper
142 minstalldir /usr/bin || die
143 minstallexec ${BUILDDIR}/ppl-config /usr/bin || die
144 fi
145
146 minstalldocs AUTHORS COPYING* ChangeLog NEWS README || die
147 done
148 }