Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
pkg-scripts/octave-9.4.0-0.build.sh
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
364 lines (265 sloc)
10.7 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# ------------------------------------------------------------------- Debug | |
# COOKIE=$(mcookie|cut -c-8); grep -v V_GREP_ME $0 > /dev/shm/runme-$COOKIE.sh ; sleep 0.3; exec bash /dev/shm/runme-$COOKIE.sh | |
# TESTING=1 | |
# ---------------------------------------------------------------- Preamble | |
PKG=octave | |
VERSION=9.4.0 | |
BUILD=0 | |
TASK=${TASK:-ALL} # when testing parts, do #> TASK=BLAS ./octave-9.4.0-0.build.sh | |
PREFIX=/pkg/$PKG-$VERSION-$BUILD | |
if [ -n "$TESTING" ]; then PREFIX=/scratch/local2/$PKG-$VERSION-$BUILD ; fi | |
PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin | |
set -eu | |
umask 022 | |
BUILD_TMPDIR=/scratch/local2/$PKG-$VERSION-$BUILD.$USER.build.tmp | |
test -d $BUILD_TMPDIR && ( chmod -R u+rwx $BUILD_TMPDIR || true ; rm -rf $BUILD_TMPDIR ) | |
export TMPDIR=$BUILD_TMPDIR | |
export HOME=$BUILD_TMPDIR/home | |
mkdir -vp $HOME | |
exec </dev/null | |
mkdir -p $PREFIX | |
cat >$PREFIX/profile <<-EOF | |
PATH=$PREFIX/bin:\$PATH | |
export JAVA_HOME=/pkg/openjdk-17.0.2.8-0 | |
export LD_LIBRARY_PATH=$PREFIX/lib\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH} | |
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig\${PKG_CONFIG_PATH:+:\$PKG_CONFIG_PATH} | |
export PKG_CONFIG_PATH | |
if [ -d $PREFIX/.compatlibs ]; then export LD_LIBRARY_PATH=$PREFIX/.compatlibs\${LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH ; fi | |
EOF | |
. $PREFIX/profile | |
NPROC=$(( $(nproc) * 4 / 5 + 1 )) | |
export MAKEFLAGS="-j $NPROC" | |
BUILDDIR=$PREFIX/build | |
mkdir -p $BUILDDIR | |
cd $BUILDDIR | |
# ------------------------------------------------------------- Maintenance | |
if [ $TASK = 'zap' ]; then # reset | |
cd $PREFIX | |
for DIR in $(find -maxdepth 1 -type d | grep -v build | grep -i [a-z]); do # exclude build and 'dot' | |
rm -rf $DIR | |
done | |
for DIR in */*/build; do | |
rm -rf $DIR | |
done | |
# qhull is a bit different :/ | |
rm -rf build/qhull-2020.2 | |
echo "# $PREFIX cleaned ..." | |
exit | |
fi | |
# --------------------------------------------- Dependencies (all optional) | |
( if ! [ $TASK = 'ALL' -o $TASK = 'QH' ]; then exit; fi | |
# orig: http://www.qhull.org/download/qhull-2020-src-8.0.2.tgz | |
BEEHIVE=https://beehive.molgen.mpg.de/295f7332269a38279478f555cc185296/qhull-2020-src-8.0.2.tgz | |
test -e qhull-2020-src-8.0.2.tgz || wget -nv $BEEHIVE | |
test -d qhull-2020.2 || tar -xf qhull-2020-src-8.0.2.tgz | |
export CFLAGS="-O3 -fPIC" | |
export CXXFLAGS="-O3 -fPIC" | |
cd qhull-2020.2/build | |
cmake \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX=$PREFIX \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
.. | |
make -j $NPROC | |
make install | |
) | |
( if ! [ $TASK = 'ALL' -o $TASK = 'RJ' ]; then exit; fi | |
# orig: https://github.com/Tencent/rapidjson/archive/refs/tags/v1.1.0.tar.gz | |
BEEHIVE=https://beehive.molgen.mpg.de/badd12c511e081fec6c89c43a7027bce/rapidjson-1.1.0.tar.gz | |
test -e rapidjson-1.1.0.tar.gz || wget -nv $BEEHIVE | |
rm -rf rapidjson-1.1.0 | |
tar -xf rapidjson-1.1.0.tar.gz | |
cd rapidjson-1.1.0 | |
# # it is a header only library | |
# well, a 2016 release, and around thousand issues ... | |
sed -i -e 's/-Werror//' CMakeLists.txt | |
sed -i -e 's/-Werror//' example/CMakeLists.txt | |
# same as https://github.com/Tencent/rapidjson/commit/3b2441b8.patch | |
# Removed non-compiling assignment operator | |
sed -i -e '/^\s\s*GenericStringRef&\s\s*operator=/ d' include/rapidjson/document.h | |
# issue #909, include/rapidjson/prettywriter.h | |
sed -i -e '45 s/> Base;$/, writeFlags> Base;/' include/rapidjson/prettywriter.h | |
# issue #1718, include/rapidjson/writer.h | |
sed -i \ | |
-e '262 d' -e '252 a \\n static const size_t kDefaultLevelDepth = 32; // now unprotected' \ | |
include/rapidjson/writer.h | |
mkdir -p build | |
cd build | |
cmake \ | |
-DCMAKE_BUILD_TYPE=None \ | |
-DCMAKE_INSTALL_PREFIX=$PREFIX \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
-DRAPIDJSON_HAS_STDSTRING=ON \ | |
-DRAPIDJSON_BUILD_CXX11=ON \ | |
-DRAPIDJSON_BUILD_DOC=OFF \ | |
-DRAPIDJSON_ENABLE_INSTRUMENTATION_OPT=OFF \ | |
.. | |
make -j $NPROC | |
make install | |
) | |
( if ! [ $TASK = 'ALL' -o $TASK = 'GM' ]; then exit; fi | |
# GraphicsMagick: an ImageMagick fork | |
# orig: https://sourceforge.net/projects/graphicsmagick/files/graphicsmagick/1.3.45/GraphicsMagick-1.3.45.tar.xz | |
BEEHIVE=https://beehive.molgen.mpg.de/5eb76e9af7b887a8828fce11aa1e2f1c/GraphicsMagick-1.3.45.tar.xz | |
test -e GraphicsMagick-1.3.45.tar.xz || wget -nv $BEEHIVE | |
test -d GraphicsMagick-1.3.45 || tar -xf GraphicsMagick-1.3.45.tar.xz | |
mkdir -p GraphicsMagick-1.3.45-build/build | |
cd GraphicsMagick-1.3.45-build/build | |
../../GraphicsMagick-1.3.45/configure \ | |
--prefix=$PREFIX \ | |
--enable-shared \ | |
--with-modules \ | |
--with-magick_plus_plus \ | |
--with-threads | |
make -j $NPROC | |
make install | |
) | |
( if ! [ $TASK = 'ALL' -o $TASK = 'GL2' ]; then exit; fi | |
# orig: https://geuz.org/gl2ps/src/gl2ps-1.4.2.tgz | |
BEEHIVE=https://beehive.molgen.mpg.de/0606554d833f4fd9f09eab48a374c785/gl2ps-1.4.2.tgz | |
test -e gl2ps-1.4.2.tgz || wget -nv $BEEHIVE | |
test -d gl2ps-1.4.2 || tar -xf gl2ps-1.4.2.tgz | |
cd gl2ps-1.4.2 | |
mkdir -p build | |
cd build | |
export FORCE_SOURCE_DATE=1 # make pdftex adhere to SOURCE_DATE_EPOCH | |
cmake \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX=$PREFIX \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
-DCMAKE_EXE_LINKER_FLAGS=-lm \ | |
.. | |
make -j $NPROC | |
make install | |
) | |
( if ! [ $TASK = 'ALL' -o $TASK = 'BLAS' ]; then exit; fi | |
# the one in the system is too old ... | |
# orig: https://github.com/OpenMathLib/OpenBLAS/archive/refs/tags/v0.3.29.tar.gz | |
BEEHIVE=https://beehive.molgen.mpg.de/853a0c5c0747c5943e7ef4bbb793162d/OpenBLAS-0.3.29.tar.gz | |
test -e OpenBLAS-0.3.29.tar.gz || wget -nv $BEEHIVE | |
test -d OpenBLAS-0.3.29 || tar -xf OpenBLAS-0.3.29.tar.gz | |
cd OpenBLAS-0.3.29 | |
mkdir -p build | |
cd build | |
cmake \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX=$PREFIX \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
-DCMAKE_PREFIX_PATH=$PREFIX \ | |
-DDYNAMIC_ARCH=TRUE \ | |
.. | |
make -j $NPROC | |
make install | |
) | |
( if ! [ $TASK = 'ALL' -o $TASK = 'QR' ]; then exit; fi | |
# orig: https://github.com/mpimd-csc/qrupdate-ng/archive/refs/tags/v1.1.5.tar.gz | |
BEEHIVE=https://beehive.molgen.mpg.de/c5c61b8d6401508feefd56efed0f6a5a/qrupdate-ng-1.1.5.tar.gz | |
test -e qrupdate-ng-1.1.5.tar.gz || wget -nv $BEEHIVE | |
test -d qrupdate-ng-1.1.5 || tar -xf qrupdate-ng-1.1.5.tar.gz | |
cd qrupdate-ng-1.1.5 | |
mkdir -p build | |
cd build | |
cmake \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX=$PREFIX \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
-DCMAKE_PREFIX_PATH=$PREFIX \ | |
.. | |
make -j $NPROC | |
make install | |
) | |
( if ! [ $TASK = 'ALL' -o $TASK = 'SSP' ]; then exit; fi | |
# orig: https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/refs/tags/v7.10.1.tar.gz | |
BEEHIVE=https://beehive.molgen.mpg.de/3b8c4f18091589da221a1acc5a331edb/SuiteSparse-7.10.1.tar.gz | |
test -e SuiteSparse-7.10.1.tar.gz || wget -nv $BEEHIVE | |
test -d SuiteSparse-7.10.1 || tar -xf SuiteSparse-7.10.1.tar.gz | |
cd SuiteSparse-7.10.1 | |
mkdir -p build | |
cd build | |
cmake \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX=$PREFIX \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
-DCMAKE_PREFIX_PATH=$PREFIX \ | |
.. | |
make -j $NPROC | |
make install | |
) | |
( if ! [ $TASK = 'ALL' -o $TASK = 'SD' ]; then exit; fi | |
# orig: https://github.com/LLNL/sundials/releases/download/v7.2.1/sundials-7.2.1.tar.gz | |
BEEHIVE=https://beehive.molgen.mpg.de/afeab5b3d53eab290e93c955df26e998/sundials-7.2.1.tar.gz | |
test -e sundials-7.2.1.tar.gz || wget -nv $BEEHIVE | |
test -d sundials-7.2.1 || tar -xf sundials-7.2.1.tar.gz | |
cd sundials-7.2.1 | |
mkdir -p build | |
cd build | |
cmake \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX=$PREFIX \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
-DCMAKE_PREFIX_PATH=$PREFIX \ | |
-DENABLE_KLU=ON \ | |
-DEXAMPLES_ENABLE_C=OFF \ | |
-DEXAMPLES_ENABLE_CXX=OFF \ | |
-DEXAMPLES_INSTALL=OFF \ | |
.. | |
make -j $NPROC | |
make install | |
) | |
# ------------------------------------------------------------------ Octave | |
( if ! [ $TASK = 'ALL' -o $TASK = 'OCT' ]; then exit; fi | |
# orig: https://ftp.fau.de/gnu/octave/octave-9.4.0.tar.gz | |
BEEHIVE=https://beehive.molgen.mpg.de/879fd8ecbdda563fa70cc7a3f61cbb11/octave-9.4.0.tar.gz | |
test -e octave-9.4.0.tar.gz || wget -nv $BEEHIVE | |
test -d octave-9.4.0 || tar -xf octave-9.4.0.tar.gz | |
mkdir -p octave-9.4.0-build/build | |
cd octave-9.4.0-build/build | |
LDFLAGS=${LDFLAGS:-} | |
# lsundials_core -> Workaround build failure with sundials 7 | |
CFLAGS="-I $PREFIX/include" \ | |
CXXFLAGS="-I $PREFIX/include" \ | |
LDFLAGS+=" -L$PREFIX/lib" \ | |
LDFLAGS+=" -lsundials_core" \ | |
../../octave-9.4.0/configure \ | |
--prefix=$PREFIX | |
sed -i 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool # Fix overlinking | |
make -j $NPROC | |
make install | |
) | |
( if ! [ $TASK = 'ALL' -o $TASK = 'PKG' ]; then exit; fi | |
# also install some popular packages | |
# --> https://gnu-octave.github.io/packages/ | |
mkdir -p packages_global | |
cd packages_global | |
# arduino: would be a nice to have, but probably the hardware libs are missing, so skip them for now | |
# https://downloads.sourceforge.net/project/octave/Octave%20Forge%20Packages/Individual%20Package%20Releases/instrument-control-0.9.4.tar.gz \ | |
# https://github.com/gnu-octave/octave-arduino/releases/download/release-0.12.1/arduino-0.12.1.tar.gz ; do | |
# cache em ... | |
for PKG in \ | |
https://github.com/gnu-octave/pkg-control/releases/download/control-4.1.1/control-4.1.1.tar.gz \ | |
https://github.com/gnu-octave/pkg-octave-doc/archive/refs/tags/release-0.5.5.tar.gz \ | |
https://github.com/ltfat/ltfat/releases/download/v2.6.0/ltfat-2.6.0-of.tar.gz \ | |
https://downloads.sourceforge.net/project/octave/Octave%20Forge%20Packages/Individual%20Package%20Releases/symbolic-3.2.1.tar.gz \ | |
https://github.com/PREDICT-EPFL/piqp/releases/download/v0.4.1/piqp-octave.tar.gz \ | |
https://github.com/ONSAS/ONSAS.m/archive/refs/tags/v0.2.5.tar.gz \ | |
https://github.com/stk-kriging/stk/releases/download/2.8.1/stk-2.8.1-octpkg.tar.gz \ | |
https://github.com/apjanke/octave-tablicious/releases/download/v0.4.4/tablicious-0.4.4.tar.gz \ | |
https://github.com/shsajjadi/OctaveCoder/releases/download/coder-1.9.2/coder-1.9.2.tar.gz \ | |
https://github.com/gnu-octave/statistics/archive/refs/tags/release-1.7.3.tar.gz \ | |
https://sourceforge.net/projects/geographiclib/files/distrib-Octave/geographiclib-octave-2.3.3.tar.gz \ | |
https://github.com/gnu-octave/statistics-resampling/archive/refs/tags/5.6.0.tar.gz \ | |
https://github.com/wgreene310/pde1dm/archive/v1.3.tar.gz \ | |
https://github.com/gapost/hdf5oct/archive/refs/tags/1.0.0.tar.gz ; do | |
BN=${PKG##*/} | |
if ! [ -e "$BN" ]; then wget -nv "$PKG"; fi | |
TARS+=($BN) | |
done | |
# install | |
for TAR in ${TARS[*]}; do | |
echo "# ====== installing $TAR" | |
echo pkg install -verbose -global $TAR | octave --no-gui | |
echo "# ===================================================== DONE" | |
done | |
) | |
# -------------------------------------------------------------------- Done |