Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 575 lines (538 sloc) 21.723 kB
fccc685 Initial open-source release
MLstate authored
1 #!/bin/bash -ue
2
3 SCRIPTDIR=$(dirname $0)
4 cd $SCRIPTDIR
5 SCRIPTDIR=$PWD
6
7 SCRIPTNAME=$(basename $0)
8
9 # OS independent various variables
10 # Warning: only put in DEFAULT_PACKAGES what should be included in our binary package
11 DEFAULT_PACKAGES=(ocaml findlib cryptokit camlzip ocamlgraph ulex ocaml-ssl camlidl libnatpmp miniupnpc)
96c8845 [feature] dependencies_helper: add ocaml-cairo package
Hugo Heuzard authored
12 ALL_PACKAGES=(ocaml findlib cryptokit camlzip ocamlgraph ulex openssl ocaml-ssl syslog jpeg libpng giflib camlimages mascot camlidl libnatpmp miniupnpc cairo-ocaml)
fccc685 Initial open-source release
MLstate authored
13
14 BUILD_DIR=$SCRIPTDIR/packages
15
16 # ##
17 # Bash setting and useful functions
18 # #####
19 shopt -s nullglob
20 msg_green () { echo "$@"; }
21 msg_red () { echo "$@"; }
22 msg_yellow () { echo "$@"; }
23 help () {
24 cat <<EOF
25
26 installation_helper.sh
27 helps download, patch, build and install the dependencies of OPA.
28
29 Usage:
30 $0 --prefix <dir> [options] [commands]
31
32 Options:
33 --prefix <dir> where ocaml and libs should expect to be installed (mandatory)
34 --installdir <dir> where to actually do the install (by default, the value of --prefix)
35 --packages 'pkg list' only install the specified packages
36 --sudo sudo before installation commands (see disclaimer)
37
38 Commands: (default choice underlined)
39 fetch download the archives for the packages to
40 $BUILD_DIR
41 unzip uncompress and patch the archives
42 install build and install the packages
43 lightclean make clean in all packages' directories
44 clean remove all contents of the work directory
45
46 Available packages: (default choice underlined)
47 $(for i in ${!ALL_PACKAGES[@]}; do
48 if grep -q "\(^\| \)${ALL_PACKAGES[i]}\( \|$\)" <<<${DEFAULT_PACKAGES[*]}
49 then printf "%-18s" "${ALL_PACKAGES[i]}"
50 else printf "%-10s" "${ALL_PACKAGES[i]}"
51 fi
52 [ $((i%6)) -eq 5 ] && echo -ne "\n\t" || echo -ne ' '
53 done)
54
55 Note:
56 All ocaml libs are compiled with and for the ocaml in the
57 given prefix. Therefore, ocaml should either be already there,
58 or you should include it first in your --packages. Also, some
59 packages depend on findlib to compile correctly.
60
61 Examples:
62 - Install all dependencies of opa to /opt/opa:
63 $ $0 --prefix /opt/opa --sudo
64 then, pass option -ocamlopt /opt/opa/bin/ocamlopt.opt to
65 opalang's ./configure script
66
67 - Install all dependencies in your home, when you don't have
68 administration rights:
69 $ $0 --prefix ~/opa
70 then, pass option -ocamlopt ~/opa/bin/ocamlopt.opt to
71 opalang's ./configure script
72
73 Disclaimer:
74 This script is provided because we think it may be useful, but
75 is provided WITHOUT SUPPORT, and you should know what you are
76 doing, especially if you want to install to a privileged
77 prefix like /usr/local. Using this script to install in /usr
78 would be a bad idea.
79
80 EOF
81 }
82
83 source ../platform_helper.sh
84
85 WINTOOLS=${WINTOOLS:-}
86 WINOCAMLC=$WINTOOLS/windows_ocamlc
87 WINOCAMLOPT=$WINTOOLS/windows_ocamlopt
88 WINOCAMLDEP=$WINTOOLS/windows_ocamldep
89 WINOCAMLMKLIB=$WINTOOLS/windows_ocamlmklib
90 WINOCAMLLEX=$WINTOOLS/windows_ocamllex
91
92 if [ -n "${ENFORCE_WINDOWS:-}" ];
93 then
94 msg_yellow "ENFORCE WINDOWS -> ocaml windows scripts"
95 export OCAMLC=$WINOCAMLC
96 export OCAMLOPT=$WINOCAMLOPT
97 export OCAMLDEP=$WINOCAMLDEP
98 export OCAMLMKLIB=$WINOCAMLMKLIB
99 export OCAMLLEX=$WINOCAMLLEX
100 export CAMLP4=camlp4
101 else
102 OCAMLC=ocamlc.opt
103 OCAMLOPT=ocamlopt.opt
104 OCAMLDEP=ocamldep.opt
105 OCAMLMKLIB=ocamlmklib
106 CAMLP4=camlp4
107 fi
108
109
110 PREFIX=
111 SUDO=
112 CLEAN=
113 FETCH=
114 UNZIP=
115 INSTALL=
116 LIGHTCLEAN=
117 while [ $# -gt 0 ]; do
118 case $1 in
119 --help) help; exit 0;;
120 --prefix)
121 if [ $# -lt 2 ]; then echo "Error: option $1 requires an argument"; exit 1; fi
122 shift
123 PREFIX="$1"
124 : ${INSTALLDIR:=$PREFIX}
125 ;;
126 --packages)
127 if [ $# -lt 2 ]; then echo "Error: option $1 requires an argument"; exit 1; fi
128 shift
129 PACKAGES=($1)
130 ;;
131 --installdir)
132 if [ $# -lt 2 ]; then echo "Error: option $1 requires an argument"; exit 1; fi
133 shift
134 INSTALLDIR="$1"
135 ;;
136 --sudo)
137 SUDO="sudo"
138 ;;
139 lightclean) LIGHTCLEAN=1;;
140 clean) CLEAN=1;;
141 fetch) FETCH=1;;
142 install) INSTALL=1;;
143 unzip) UNZIP=1;;
144 *)
145 echo "Error: unknown argument $1"; exit 1
146 esac
147 shift
148 done
149
150 PACKAGES=("${PACKAGES[@]:-${DEFAULT_PACKAGES[@]}}")
151
152 if [ -z "$CLEAN" ] && [ -z "$FETCH" ] && [ -z "$UNZIP" ] && [ -z "$INSTALL" ] && [ -z "$LIGHTCLEAN" ]; then
153 FETCH=1
154 UNZIP=1
155 INSTALL=1
156 fi
157 if [ -z "$PREFIX" ] && [ -n "$INSTALL" ]; then
158 help
159 echo "Error: you must specify the installation prefix" >&2
160 exit 1
161 fi
162
163 #FETCH=""
164 #CLEAN=""
165 #UNZIP=""
166
167 BUILD_DIR=$PWD/packages
168 mkdir -p $BUILD_DIR
169
170 sources () {
171 case $1 in
172 openssl) echo "http://www.openssl.org/source/openssl-1.0.0a.tar.gz";;
173 ocaml) echo "http://caml.inria.fr/pub/distrib/ocaml-3.12/ocaml-3.12.0.tar.gz" ;;
174 # Sources obtained thanks to "apt-get --print-uris source <package>"
175 findlib) echo "http://ftp.fr.debian.org/debian/pool/main/f/findlib/findlib_1.2.5+debian.orig.tar.gz";;
176 ocaml-ssl) echo "http://ftp.fr.debian.org/debian/pool/main/o/ocaml-ssl/ocaml-ssl_0.4.5.orig.tar.gz";;
177 cryptokit) echo "http://ftp.fr.debian.org/debian/pool/main/c/cryptokit/cryptokit_1.3.orig.tar.gz";;
178 ocamlgraph) echo "http://ftp.fr.debian.org/debian/pool/main/o/ocamlgraph/ocamlgraph_1.5.orig.tar.gz";;
179 camlzip) echo "http://ftp.fr.debian.org/debian/pool/main/c/camlzip/camlzip_1.04.orig.tar.gz";;
180 camlimages) echo "http://caml.inria.fr/distrib/bazar-ocaml/camlimages-3.0.2.tgz";;
181 ulex) echo "http://www.cduce.org/download/ulex-1.1.tar.gz";;
182 syslog) echo "http://homepage.mac.com/letaris/syslog-1.4.tar.gz";;
183 jpeg) echo "http://www.ijg.org/files/jpegsrc.v8b.tar.gz";;
184 libpng) echo "http://sourceforge.net/projects/libpng/files/libpng14/older-releases/1.4.3/libpng-1.4.3.tar.gz";;
185 giflib) echo "http://downloads.sourceforge.net/project/giflib/giflib%204.x/giflib-4.1.6/giflib-4.1.6.tar.gz";;
186 mascot) echo "http://mascot.x9c.fr/distrib/mascot-1.0-alpha.tar.gz";;
187 camlidl) echo "http://caml.inria.fr/pub/old_caml_site/distrib/bazar-ocaml/camlidl-1.05.tar.gz";;
188 libnatpmp) echo "http://miniupnp.free.fr/files/download.php?file=libnatpmp-20110103.tar.gz";;
189 miniupnpc) echo "http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.5.20110418.tar.gz";;
96c8845 [feature] dependencies_helper: add ocaml-cairo package
Hugo Heuzard authored
190 cairo-ocaml) echo "http://cgit.freedesktop.org/cairo-ocaml/snapshot/cairo-ocaml-master.tar.gz";;
fccc685 Initial open-source release
MLstate authored
191 *) msg_red "Error: don't know about package $1" >&2; exit 2
192 esac
193 }
194
195 package_dir () {
196 local p=$1
197 local dir=$(find . -maxdepth 1 -type d -name "$p-[0-9]*")
96c8845 [feature] dependencies_helper: add ocaml-cairo package
Hugo Heuzard authored
198 local dir="$dir "$(find . -maxdepth 1 -type d -name "$p-master")
fccc685 Initial open-source release
MLstate authored
199 echo $dir | (read a b; if [ -n "$b" ]; then
200 msg_red "Error: found several source directories for $p"
201 exit 12
202 fi)
203 echo $dir
204 }
205
206 install_generic () {
207 if [ "$(which $OCAMLC)" != "$INSTALLDIR/bin/$OCAMLC" ]; then
208 echo $OCAMLC x $PATH
209 msg_red "Error: fresh installed ocaml not found ($(which $OCAMLC) is not $INSTALLDIR/bin/$OCAMLC)"
210 exit 1
211 fi
212 if [ "$($OCAMLC -where)" != "$INSTALLDIR/lib/ocaml" ]; then
213 msg_red "Error: fresh installed ocaml not found (ocamlc -where returned $($OCAMLC -where) instead of $INSTALLDIR/lib/ocaml"
214 exit 1
215 fi
216 # Packages install themselves in $(ocamlc -where) automatically
217 if [ -x configure ]; then ./configure "$@"; fi
218 make all; r=$?
219 make allopt || make opt || make all.opt || [ $r -eq 0 ]
220 $SUDO make install-opt || $SUDO make install
221 }
222
223 package_install (){
224 if [ -n "${ENFORCE_WINDOWS:-}" ];
225 then
226 echo "INSTALLSYS WINDOWS"
227 WINPREFIX=`cygpath -u $PREFIX`
228 WINCAMLLIBDIR="$WINPREFIX/lib"
229 OLDPATH=$PATH
230 export PATH=/cygdrive/c/ocamlms/bin/:$PATH
231 case $1 in
232 ocaml)
233 # caml_sed_patch
234 # PREFIX is hard coded as C:/ocamlms
235 cp config/m-nt.h config/m.h
236 cp config/s-nt.h config/s.h
237 cp config/Makefile.msvc config/Makefile
238 make -f Makefile.nt clean
239 # rm -rf otherlibs/labltk/
240 make -f Makefile.nt world
241 # make -f Makefile.nt bootstrap
242 # make -f Makefile.nt clean
243 # make -f Makefile.nt world
244 make -f Makefile.nt opt opt.opt
245 make -f Makefile.nt install
246 #missing ocamlrun.lib => replaced by libcamlrun.lib
247 export PATH=$WINPREFIX/bin:${PATH}
248 export OCAMLLIB=$WINCAMLLIBDIR
249 export OCAMLC=$WINOCAMLC
250 export OCAMLOPT=$WINOCAMLOPT
251 export OCAMLDEP=$WINOCAMLDEP
252 export OCAMLMKLIB=$WINOCAMLMKLIB
253 export OCAMLLEX=$WINOCAMLLEX
254 export CAMLP4=camlp4
255 ;;
256 findlib)
257 #valid
258 ./configure -sitelib $PREFIX/lib
259 make all opt install clean
260 ;;
261 camlzip)
262 #valid
263 # library is call camlzip instead of zip
264 CAMLLIBDIR=$WINCAMLLIBDIR ZLIB_LIBDIR=/windows_libs/zlib ZLIB_INCLUDE=$PWD/../../../ms_windows/zlib make -f Makefile.nt clean all allopt install
265 CAMLLIBDIR=$WINCAMLLIBDIR ZLIB_LIBDIR=/windows_libs/zlib ZLIB_INCLUDE=$PWD/../../../ms_windows/zlib make -f Makefile.nt installopt || true
266 install -m 0644 -v zlib.cm* $WINCAMLLIBDIR/zip
267 ;;
268 ocamlgraph)
269 ./configure --prefix $WINPREFIX # should pass all var to have cross compilation
270 make -f Makefile.nt clean
271 # let the time do its job :) do not merge the two or prepare to a headache
272 make -f Makefile.nt byte opt install-byte install-opt
273 ;;
274 cryptokit)
275 make -f Makefile.win32 all allopt
276 make -f Makefile.win32 install
277 ;;
278 ocaml-ssl)
279 #valid but ugly
280 # just for generating the META file and Makefile
281 # ,does not work with PATH because of cl.exe problems with libs
282 PATH=$OLDPATH ./configure
283 export OCAMLMKLIB="$OCAMLMKLIB -LC:/cygwin/windows_libs/openssl/lib"
284 # seems horrible ? simpler than patching everything
285 make -e byte || true
286 make -e opt || true
287 make -e install || true
288 cp src/*.lib $PREFIX/lib/ssl # because ocamlfind ignores .lib files
289 ;;
290 camlidl)
291 sed -ie "s%^OCAMLLIB=.*%OCAMLLIB=$WINPREFIX/lib/ocaml%; s%^BINDIR=.*%BINDIR=$WINPREFIX/bin%" \
292 config/Makefile.win32 > config/Makefile
293 make all
294 make install
295 ;;
296 libnatpmp)
297 make -f Makefile.windows all
298 TMPP=$PREFIX/lib/libnatpmp
299 mkdir -p $TMPP
300 cp libnatpmp.a $TMPP
301 TMPP=$PREFIX/include/libnatpmp
302 mkdir -p $TMPP
303 cp *.h $TMPP
304 ;;
305 miniupnpc)
306 INSTALLPREFIX=$PREFIX make -f Makefile.windows all
307 TMPP=$PREFIX/lib/miniupnpc
308 mkdir -p $TMPP
309 cp libminiupnpc.a $TMPP
310 TMPP=$PREFIX/include/miniupnpc
311 mkdir -p $TMPP
312 cp *.h $TMPP
313 ;;
314 ulex)
315 rm -f myocamlbuild.ml
316 install_generic
317 ;;
96c8845 [feature] dependencies_helper: add ocaml-cairo package
Hugo Heuzard authored
318 cairo-ocaml)
319 aclocal -I support
320 autoconf
e83d1d9 [enhance] dependencies: patch for cairo-ocaml
Mathieu Barbin authored
321 ./configure --prefix $PREFIX --without-gtk --without-libsvg_cairo --without-libpangocairo
96c8845 [feature] dependencies_helper: add ocaml-cairo package
Hugo Heuzard authored
322 make
323 make install
324 ;;
fccc685 Initial open-source release
MLstate authored
325 *)
326 msg_yellow "Install $1 by hand"
327 msg_yellow "TODO : check $1 installation"
328 exit 1
329 ;;
330 esac
331 else
332 case $1 in
333 ocaml)
334 [ $IS_WINDOWS ] && CYGOPT="-tk-no-x11 -no-tk"
335 ./configure -prefix $PREFIX ${CYGOPT:-}
336 make world # clean world
337 make bootstrap
338 if [ $IS_LINUX ] || [ $IS_MAC ]; then
339 make opt && make opt.opt
340 fi
341 PREFIX=$INSTALLDIR $SUDO make install -e
342 ;;
343 camlzip)
344 make all allopt
345 $SUDO make install installopt
346 $SUDO install -m 0644 -v zlib.cm* $($OCAMLC -where)/zip
347 ;;
348 ocaml-ssl)
349 $SUDO $INSTALLDIR/bin/ocamlfind remove -destdir $INSTALLDIR/lib/ocaml ssl || true
350 install_generic
351 ;;
352 findlib)
353 install_generic -sitelib $INSTALLDIR/lib/ocaml
354 ;;
355 camlimages)
356 touch src/oXpm.cmi || true # camlimages wants that even if we tell him not...
357 ./configure --with-ocamlfind=no --enable-native-library --enable-bytecode-library --with-jpeg --with-png --with-gif --without-lablgtk --without-lablgtk2 --without-freetype --without-xpm --without-tiff --without-x --without-gs --prefix $INSTALLDIR \
358 CFLAGS=-I$INSTALLDIR/include LDFLAGS=-L$INSTALLDIR/lib
359 make
360 $SUDO make install
361 ;;
362 ulex)
363 $SUDO $INSTALLDIR/bin/ocamlfind remove -destdir $INSTALLDIR/lib/ocaml ulex || true
364 rm -f myocamlbuild.ml
f9c07eb [bug fix] build: installation_helper now correctly installs ulex with…
Valentin Gatien-Baron authored
365 make all.opt
366 # the following is copy pasted from ulex's Makefile
367 # because install depends on all (it just does't work
368 # when your rights for compiling and installing are not compatible)
369 cd _build && $SUDO make -f ../Makefile realinstall
fccc685 Initial open-source release
MLstate authored
370 ;;
371 jpeg)
372 ./configure --prefix $PREFIX
373 make
374 $SUDO make install
375 ;;
376 libpng)
377 ./configure --prefix $PREFIX
378 make
379 $SUDO make install
380 ;;
381 giflib)
382 ./configure --prefix $PREFIX
383 make
384 $SUDO make install
385 ;;
386 mascot)
387 sh configure -ocaml-prefix $INSTALLDIR
388 $SUDO make all install -e
389 ;;
390 camlidl)
391 sed -e "s%^OCAMLLIB=.*%OCAMLLIB=$INSTALLDIR/lib/ocaml%; s%^BINDIR=.*%BINDIR=$INSTALLDIR/bin%" \
392 config/Makefile.unix > config/Makefile
393 make -e all
394 $SUDO make -e install
395 ;;
396 libnatpmp)
397 make -e
398 # custom installation
399 LIBDIR=$INSTALLDIR/lib/ocaml
400 $SUDO mkdir -p $LIBDIR
401 $SUDO cp libnatpmp.a $LIBDIR
402 INCLUDE=$INSTALLDIR/include/libnatpmp
403 $SUDO mkdir -p $INCLUDE
404 $SUDO cp *.h $INCLUDE
405 ;;
406 miniupnpc)
407 INSTALLPREFIX=$INSTALLDIR make -e
408 LIBDIR=$INSTALLDIR/lib/ocaml
409 $SUDO mkdir -p $LIBDIR
410 $SUDO cp libminiupnpc.a $LIBDIR
411 INCLUDE=$INSTALLDIR/include/miniupnpc
412 $SUDO mkdir -p $INCLUDE
413 $SUDO cp *.h $INCLUDE
414 ;;
96c8845 [feature] dependencies_helper: add ocaml-cairo package
Hugo Heuzard authored
415 cairo-ocaml)
416 aclocal -I support
417 autoconf
e83d1d9 [enhance] dependencies: patch for cairo-ocaml
Mathieu Barbin authored
418 ./configure --prefix $PREFIX --without-gtk --without-libsvg_cairo --without-libpangocairo
96c8845 [feature] dependencies_helper: add ocaml-cairo package
Hugo Heuzard authored
419 make
420 $SUDO make install
421 ;;
fccc685 Initial open-source release
MLstate authored
422 *)
423 install_generic
424 esac
425 fi
426 }
427
428 if [ -n "$CLEAN" ]; then
429 msg_yellow "$SCRIPTNAME: Cleaning source"
430 for p in "${PACKAGES[@]}"; do
431 msg_green "[ PACKAGE: $p (clean-up) ]"
432 dir=$(package_dir $p)
433 rm -rf $BUILD_DIR/$dir
434 done
435 msg_green "Remove building directory $BUILD_DIR"
436 rm -fr $BUILD_DIR/*
437 fi
438
439 if [ -n "$LIGHTCLEAN" ]; then
440 msg_yellow "Cleaning packages configurations"
441 cd $BUILD_DIR/
442 for p in "${PACKAGES[@]}"; do
443 dir=$(package_dir $p)
444 if [ -z $dir ]; then
445 msg_green "[ PACKAGE: $p (skip clean) ]"
446 else
447 msg_green "[ PACKAGE: $p (make clean) ]"
448 echo "dir: $dir"
449 cd $dir
450 make clean
451 cd -
452 fi
453 done
454 msg_green "make general configuration clean done."
455 cd $SCRIPTDIR
456 fi
457
458 if [ -n "$FETCH" ]; then
459 msg_green "$SCRIPTNAME: Downloading packages"
460 cd $BUILD_DIR
461 for p in "${PACKAGES[@]}"; do
462 msg_green "[ PACKAGE: $p (download) ]"
463 src=$(sources $p)
464 wget -N "$src"
465 ## some lib are downloaded via a php script, we need to clean the string from 'source' a little
466 tgz0=$(basename "$src")
467 tgz=${tgz0#download.php\?file=}
468 [ "$tgz0" != "$tgz" ] && [ -f "$tgz0" ] && mv "$tgz0" "$tgz"
469 ## remove existing extracted directories
470 packfile=$(tar -tzf $tgz 2>/dev/null | head -n 1)
471 packdir=$(pwd)/${packfile%%/*}
472 rm -rf $BUILD_DIR/${packdir#$BUILD_DIR}
473 done
474 cd $SCRIPTDIR
475 fi
476
477 if [ -n "$UNZIP" ]; then
478 msg_green "$SCRIPTNAME: Uncompressing & patching"
479 cd $BUILD_DIR
480 for p in "${PACKAGES[@]}"; do
481 msg_green "[ PACKAGE: $p (uncompressing) ]"
482 echo "Uncompressing..."
483 ## retrieve the file name
484 tgz=$(basename "$(sources $p)")
485 tgz=${tgz#download.php\?file=}
486 ## uncompress
487 tar -xzf $tgz
488 ## patch
489 packdir=$(pwd)/$(package_dir $p)
490 cd $packdir
491 if [ $IS_WINDOWS ]; then
492 for df in $SCRIPTDIR/patches/${p}_*.patch.windows; do
493 echo "Applying patch $df from $packdir"
494 patch -Np1 < $df || (msg_red "Error: patch $df did not apply"; exit 3)
495 done
496 fi
497 for df in $SCRIPTDIR/patches/${p}_*.patch; do
498 echo "Applying patch $df from $packdir"
499 patch -Np1 < $df || (msg_red "Error: patch $df did not apply"; exit 3)
500 done
501 echo "Uncompressed $SCRIPTNAME to $packdir"
502 cd $BUILD_DIR
503 done
504 cd $SCRIPTDIR
505 fi
506
507 setup_local_ocaml () {
508 #
509 # Here we attempt to relocate ocaml, which is not an easy task. Beware the hacks.
510 # (no $SUDO here, relocation is not supposed to be needed if we are already
511 # installing to a privileged place)
512 if [ -d $INSTALLDIR/lib/ocaml ] && [ "$PREFIX" != "$INSTALLDIR" ]; then
513 # Update ld.conf for the temporary location
514 # (this is reverted last thing in this script)
515 HAS_PATCHED_OCAML_LD_CONF=1
516 sed -i "s%^$PREFIX%$INSTALLDIR%" $INSTALLDIR/lib/ocaml/ld.conf
517 # The following are not needed in our binary package, so we
518 # don't care about reverting the changes (we clean them up
519 # before making the package)
520 #
521 # The bytecode exes refer to an interpreter that is not installed (<prefix>/bin/ocamlrun).
522 sed -i '1s%#!'$PREFIX'/bin/ocamlrun%#!'$INSTALLDIR'/bin/ocamlrun%' $INSTALLDIR/bin/*
523 # ocamlmklib doesn't play nice, we wrap them to add options
524 if [ ! -e $INSTALLDIR/bin/ocamlmklib-bin ]; then
525 mv $INSTALLDIR/bin/ocamlmklib $INSTALLDIR/bin/ocamlmklib-bin
526 echo -e '#!/bin/sh\nexec '$INSTALLDIR/bin/ocamlmklib-bin' -ocamlc '$INSTALLDIR/bin/ocamlc' -ocamlopt '$INSTALLDIR/bin/ocamlopt' "$@"' >$INSTALLDIR/bin/ocamlmklib
527 chmod a+x $INSTALLDIR/bin/ocamlmklib
528 fi
529 # camlp4 needs a shared library (dllunix, what for ??) that
530 # isn't yet in normal library search paths
531 for f in $INSTALLDIR/bin/camlp4*; do
532 if [ $f = ${f%.opt} ] && [ ! -e $f-bin ]; then
533 mv $f $f-bin
534 echo -e '#!/bin/sh\nLD_LIBRARY_PATH='$INSTALLDIR/lib/ocaml/stublibs':$LD_LIBRARY_PATH exec '$f-bin' "$@"' >$f
535 chmod a+x $f
536 fi
537 done
538 fi
539 msg_yellow "Extending path to find the proper ocaml (at $INSTALLDIR/bin)"
540 export PATH=$INSTALLDIR/bin:$PATH
541 # export LD_LIBRARY_PATH=$INSTALLDIR/lib/ocaml:$INSTALLDIR/lib/ocaml/stublibs/$LD_LIBRARY_PATH
542 msg_yellow "Setting OCAMLLIB to the proper location ($INSTALLDIR/lib/ocaml)"
543 export OCAMLLIB=$INSTALLDIR/lib/ocaml
544 export OCAMLOPT=$INSTALLDIR/bin/ocamlopt.opt
545 export OCAMLFIND_INSTFLAGS="-destdir $INSTALLDIR/lib/ocaml"
546 }
547
548 if [ -n "$INSTALL" ]; then
549 msg_green "$SCRIPTNAME: Building & install"
550 for i in ${!PACKAGES[@]}; do
551 if [ -z "${setup_done:-}" ] && ! grep -q "\(^\| \)ocaml\( \|$\)" <<<${PACKAGES[*]:$i}; then
552 setup_local_ocaml
553 setup_done=1
554 fi
555 p="${PACKAGES[$i]}"
556 cd $BUILD_DIR
557 msg_yellow "entering build directory $BUILD_DIR"
558 msg_green "[ PACKAGE: $p (building and installing) ]"
559 dir=$(package_dir $p)
560 echo "Directory: $dir"
561 cd $dir
562 echo "Package: $p"
563 package_install $p
564 cd $SCRIPTDIR
565 msg_yellow "leaving build directory"
566 done
567 fi
568
569 if [ -n "${HAS_PATCHED_OCAML_LD_CONF:-}" ]; then
570 msg_yellow "Reverting temporary modification of ocaml's ld.conf used for building the libs"
571 sed -i "s%^$INSTALLDIR%$PREFIX%" $INSTALLDIR/lib/ocaml/ld.conf
572 fi
573
574 msg_green "$SCRIPTNAME: done"
Something went wrong with that request. Please try again.