|
root / lang / ocaml / build.sh
build.sh Bash 37 lines 980 B
 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
#!/bin/zsh
# Build script for OCaml on illumos
#
# OCaml 5.x requires libatomic for atomic operations

set -e
cd "$SRCDIR"

# Force 64-bit compilation on illumos
export CC="gcc -m64"
export CXX="g++ -m64"
export CFLAGS="-m64"
export CXXFLAGS="-m64"
export LDFLAGS="-m64 $LDFLAGS"
export AS="as --64"

# libatomic is at /usr/lib (hammerhead BSD layout)
export LD_LIBRARY_PATH="/usr/lib:${LD_LIBRARY_PATH:-}"
export LIBRARY_PATH="/usr/lib:${LIBRARY_PATH:-}"

./configure --prefix=$PREFIX --build=$BUILD_TRIPLE

gmake -j${JOBS:-1} world.opt

# Fix INSTALL path for gmake install — OCaml Makefiles use relative
# ./build-aux/install-sh which breaks when gmake -C enters subdirectories.
# Override with the absolute path.
INSTALL_SH="$(pwd)/build-aux/install-sh"
gmake install DESTDIR="$PKGDIR" INSTALL="$INSTALL_SH -c"

# Create environment script
mkdir -p "$PKGDIR/etc/profile.d"
cat > "$PKGDIR/etc/profile.d/ocaml.sh" << EOF
# OCaml environment
export PATH=$PREFIX/bin:\$PATH
EOF