-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakePariGP
More file actions
executable file
·144 lines (127 loc) · 3.43 KB
/
Copy pathmakePariGP
File metadata and controls
executable file
·144 lines (127 loc) · 3.43 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/sh
CLEAN=0
case `whoami` in
pascal)
Build=$HOME/devel/pari
export CC=/usr/local/bin/gcc-4.7
LIBREADLINE=/usr/local/Cellar/readline/6.2.4/lib/libreadline.a
READLINE=/usr/local/Cellar/readline/6.2.4
LIBNCURSES=/usr/local/Cellar/ncurses/5.9/lib/libncursesw.a
LIBGMP=/usr/local/Cellar/gmp/5.0.5/lib/libgmp.a
;;
*)
Build=$HOME/pari
export CC=gcc-mp-4.7
READLINE=/opt/local
LIBREADLINE=/opt/local/lib/libreadline.a
LIBNCURSES=/opt/local/lib/libncurses.a
LIBGMP=/opt/local/lib/libgmp.a
;;
esac
Name=PariGP
case $1 in
-a) AllPackages=1; DMGName=PariGP;;
*) DMGName=PariGP-Tiny;;
esac
Here=$(pwd)
cd ${Build}
. config/version
VERSION=$VersionMajor.$VersionMinor.$patch
# compile static version of pari for OSX
export LDFLAGS=-static-libgcc
if [ $CLEAN = 1 ]; then make clean; fi
./Configure --graphic=ps --with-readline=${READLINE}
# override GMPLIBS/RLLIBS values to make sure we link with .a, not
# dylibs. -static doesn't work
(cd Odarwin-i386 && make -j6 \
GMPLIBS=${LIBGMP}\
RLLIBS="${LIBREADLINE} ${LIBNCURSES}"\
gp-sta)
make docpdf
# install into $Name.app
cd ${Here}
AppRoot=$Name.app
Rundir=${AppRoot}/Contents/MacOS
GPdir=${AppRoot}/Contents/Resources
Bin=${GPdir}/bin
Doc=${GPdir}/doc
Extra=${GPdir}/share/pari
rm -rf ${AppRoot}
mkdir -p ${Bin}
cp -f ${Build}/Odarwin-i386/gp-sta ${Bin}/gp
mkdir -p ${Doc}
cp -f ${Build}/doc/*.{pdf,tex} ${Doc}/
cp -f ${Build}/doc/gp* ${Doc}/
cp -f ${Build}/doc/translations ${Doc}/
mkdir -p ${Extra} # need in any case
if test -n "$AllPackages"; then
for d in `ls -d ${Build}/data/*`; do
cp -r $d $Extra
done
GP_DATA_DIR=\'\${ROOT}/share/pari\'
else
GP_DATA_DIR='/Applications/PariGP.app/Contents/Resources/share/pari'
fi
## finish install : make OS X app
# launch script
mkdir -p ${Rundir}
cat <<EOF > ${Rundir}/${Name}
#!/bin/sh
#ROOT="\$(cd "\$(dirname "\$0")" 2>/dev/null && pwd)/../Resources"
ROOT="\`dirname \$0\`/../Resources"
osascript <<EOS
tell app "Terminal"
do script "export GPDOCDIR=\${ROOT}/doc
export GPHELP='\${ROOT}/doc/gphelp -d -ch 4 -cb 0 -cu 2'
#export GP_DATA_DIR=\${ROOT}/share/pari
export GP_DATA_DIR=$GP_DATA_DIR
clear; \${ROOT}/bin/gp; exit"
end tell
EOS
EOF
chmod +x ${Rundir}/${Name}
# Info.plist
cat <<EOF > ${AppRoot}/Contents/Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>${Name}</string>
<key>CFBundleIdentifier</key>
<string>math.PariGP</string>
<key>CFBundleName</key>
<string>PariGP</string>
<key>CFBundleIconFile</key>
<string>PariGP.icns</string>
<key>CFBundleShortVersionString</key>
<string>${VERSION}</string>
<key>CFBundleSignature</key>
<string>pari</string>
<key>CFBundleVersion</key>
<string>${VERSION}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
</dict>
</plist>
EOF
# Icons
iconfile=PariGP.icns
if [ -f $iconfile ]; then
cp -f $iconfile $AppRoot/Contents/Resources/PariGP.icns
fi
echo
echo "Build completed:"
echo " $AppRoot successfully created."
echo
echo "to make dmg run"
echo " makedmg $DMGName-$VERSION $AppRoot /Applications/"
if [[ ! $AllPackages ]]; then
echo
echo "to make data dmg run"
echo " makedmg $Name-data $Build/data $GP_DATA_DIR"
fi
#rm -rf $AppRoot