Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5831 - (show annotations) (download)
Mon Aug 16 20:51:12 2010 UTC (13 years, 9 months ago) by niro
File size: 3074 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 mbuild 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
43 src_install()
44 {
45 cd ${SRCDIR}/build
46 make DESTDIR=${BINDIR} install || die
47
48 # build 32bit libraries for multilib systems
49 if [[ ${ARCH} = x86_64 ]]
50 then
51 # move the 64bit header
52 mv ${BINDIR}/usr/include/ppl{,-64}.hh || die
53
54 # move the 64bit config program
55 mv ${BINDIR}/usr/bin/ppl-config{,-64} || die
56
57 cd ${SRCDIR}/build-m32
58 make DESTDIR=${BINDIR} install || die
59
60 # move the 32bit header
61 mv ${BINDIR}/usr/include/ppl{,-32}.h || die
62
63 # move the 32bit config program
64 mv ${BINDIR}/usr/bin/ppl-config{,-32} || die
65
66 # create a wrapper header
67 cat > ${BINDIR}/usr/include/ppl.h << "EOF"
68 /* ppl.h - Stub Header */
69 #ifndef __STUB__PPL_HH__
70 #define __STUB__PPL_HH__
71
72 #if defined(__x86_64__) || \
73 defined(__sparc64__) || \
74 defined(__arch64__) || \
75 defined(__powerpc64__) || \
76 defined (__s390x__)
77 # include "ppl-64.h"
78 #else
79 # include "ppl-32.h"
80 #endif
81
82 #endif /* __STUB__PPL_HH__ */
83 EOF
84
85 # create a multiarch-wrapper
86 cat > ${SRCDIR}/multiarch_wrapper.c << "EOF"
87 #define _GNU_SOURCE
88
89 #include <errno.h>
90 #include <stdio.h>
91 #include <stdlib.h>
92 #include <sys/types.h>
93 #include <sys/wait.h>
94 #include <unistd.h>
95
96 #ifndef DEF_SUFFIX
97 # define DEF_SUFFIX "64"
98 #endif
99
100 int main(int argc, char **argv)
101 {
102 char *filename;
103 char *suffix;
104
105 if(!(suffix = getenv("USE_ARCH")))
106 if(!(suffix = getenv("BUILDENV")))
107 suffix = DEF_SUFFIX;
108
109 if (asprintf(&filename, "%s-%s", argv[0], suffix) < 0) {
110 perror(argv[0]);
111 return -1;
112 }
113
114 int status = EXIT_FAILURE;
115 pid_t pid = fork();
116
117 if (pid == 0) {
118 execvp(filename, argv);
119 perror(filename);
120 goto end;
121 } else if (pid < 0) {
122 goto end_error;
123 } else {
124 if (waitpid(pid, &status, 0) != pid) {
125 status = EXIT_FAILURE;
126 goto end_error;
127 }
128 status = WEXITSTATUS(status);
129 }
130 goto end;
131
132 end_error:
133 perror(argv[0]);
134 end:
135 free(filename);
136
137 return status;
138 }
139
140 EOF
141
142 # compile and install the wrapper
143 gcc -m64 ${SRCDIR}/multiarch_wrapper.c -o ${BINDIR}/usr/bin/ppl-config || die
144
145 fi
146 cd ${SRCDIR}
147 minstalldocs AUTHORS COPYING* ChangeLog NEWS README || die
148 }