#!/bin/sh # globals ROOT=~/root VENDOR=$ROOT/vendor # ------------------------------------------------------------------------ # OpenBLAS BLAS_URL="https://github.com/xianyi/OpenBLAS.git" BLAS_TAG="v0.3.17" build_blas() { git clone $BLAS_URL blas cd blas && git checkout $BLAS_TAG NO_SHARED=1 TARGET=GENERIC PREFIX=$ROOT make -j2 NO_SHARED=1 make install PREFIX=$ROOT rm -rf $ROOT/lib/cmake rm -rf $ROOT/lib/pkgconfig mv $ROOT/include/lapacke.h \ $ROOT/include/lapack.h \ $ROOT/include/cblas.h \ $ROOT/include/f77blas.h \ $ROOT/include/lapacke_utils.h \ $ROOT/include/openblas_config.h \ $ROOT/include/lapacke_config.h \ $ROOT/include/lapacke_mangling.h \ $ROOT/include/vendor/blas cd $VENDOR echo $BLAS_TAG > blas/build.tag } # ------------------------------------------------------------------------ # NLOpt NLOPT_URL="https://github.com/stevengj/nlopt.git" NLOPT_TAG="v2.7.0" build_nlopt() { git clone $NLOPT_URL cd nlopt && git checkout $NLOPT_TAG && mkdir build && cd build cmake \ -DCMAKE_INSTALL_PREFIX=$ROOT \ -DBUILD_SHARED_LIBS=OFF \ -DNLOPT_PYTHON=OFF \ -DNLOPT_MATLAB=OFF \ -DNLOPT_OCTAVE=OFF \ -DNLOPT_CXX=OFF \ -DNLOPT_GUILE=OFF \ -DNLOPT_SWIG=OFF \ -DNLOPT_FORTRAN=OFF \ -DCMAKE_BUILD_TYPE=Release \ .. make -j2 sed -i -n '/nlopt.[ah]$/p' install_manifest.txt make install # remove unwanted files rm -f $ROOT/nlopt.hpp rm -f $ROOT/nlopt.f rm -rf $ROOT/lib/cmake # rm -rf $ROOT/man mv $ROOT/include/nlopt.h $ROOT/include/vendor/nlopt.h cd $VENDOR echo $NLOPT_TAG > nlopt/build.tag } # ------------------------------------------------------------------------ # musl libc MUSL_URL="git://git.musl-libc.org/musl" MUSL_TAG="v1.2.2" build_musl() { git clone $MUSL_URL cd musl && git checkout $MUSL_TAG ./configure \ --prefix=$ROOT \ --includedir=$ROOT/include/vendor/libc \ --disable-shared make -j2 make install mv $ROOT/lib/rcrt1.o \ $ROOT/lib/crt1.o \ $ROOT/lib/Scrt1.o \ $ROOT/lib/musl-gcc.specs \ $ROOT/lib/crt mv $ROOT/lib/crti.o $ROOT/lib/crtn.o $ROOT/lib/crt/x86_64 rm $ROOT/bin/musl-gcc cd $VENDOR echo $MUSL_TAG > musl/build.tag } # ------------------------------------------------------------------------ # musl libc ZLIB_URL="https://github.com/madler/zlib.git" ZLIB_TAG="v1.2.11" build_zlib() { git clone $ZLIB_URL zlib cd zlib && git checkout $ZLIB_TAG prefix=$ROOT ./configure --static make -j2 make install mv $ROOT/include/zlib.h $ROOT/include/zconf.h $ROOT/include/vendor cd $VENDOR echo $ZLIB_TAG > zlib/build.tag } # ------------------------------------------------------------------------ # GLFW GLFW_URL="https://github.com/glfw/glfw.git" GLFW_TAG="3.3.4" build_glfw() { git clone $GLFW_URL glfw cd glfw && git checkout $GLFW_TAG && mkdir build && cd build cmake \ -DCMAKE_INSTALL_PREFIX=$ROOT \ -DBUILD_SHARED_LIBS=OFF \ -DGLFW_BUILD_EXAMPLES=OFF \ -DGLFW_BUILD_TESTS=OFF \ -DGLFW_BUILD_DOCS=OFF \ -DGLFW_VULKAN_STATIC=OFF \ -DCMAKE_BUILD_TYPE=Release \ .. make -j2 make install mv $ROOT/include/GLFW $ROOT/include/vendor rm -rf $ROOT/lib/cmake rm -rf $ROOT/lib/pkgconfig cd $VENDOR echo $GLFW_TAG > glfw/build.tag } # ------------------------------------------------------------------------ # wlroot WLROOTS_URL="https://github.com/swaywm/wlroots.git" WLROOTS_TAG="0.14.1" build_wlroots() { git clone $WLROOTS_URL cd wlroots && git checkout $WLROOTS_TAG meson \ --prefix=$ROOT \ --includedir=include/vendor \ --libdir=lib/vendor \ -Ddefault_library=static \ build/ \ && ninja -C build/ \ && meson install -C build mv $ROOT/lib/vendor/pkgconfig/* $ROOT/lib/pkgconfig rm -rf $ROOT/lib/vendor/pkgconfig cd $VENDOR echo $WLROOTS_TAG > wlroots/build.tag } # ------------------------------------------------------------------------ # utility functions update() { base=$1 tag=$2 if [ -d $base ] && [ `cat $base/build.tag` = $tag ]; then echo "$base: up to date" else build_$base fi } # ------------------------------------------------------------------------ # main point of entry # update nlopt $NLOPT_TAG # update blas $BLAS_TAG update musl $MUSL_TAG update zlib $ZLIB_TAG update wlroots $WLROOTS_TAG