automatically build dependencies
This commit is contained in:
parent
8dc2ea75c7
commit
4b0dd3c009
1 changed files with 102 additions and 0 deletions
|
@ -74,6 +74,51 @@ VER=1.2.2
|
||||||
GIT_URL=https://github.com/Chlumsky/msdf-atlas-gen.git
|
GIT_URL=https://github.com/Chlumsky/msdf-atlas-gen.git
|
||||||
GIT_TAG="v${VER}"
|
GIT_TAG="v${VER}"
|
||||||
|
|
||||||
|
# bash utilities
|
||||||
|
YES=0
|
||||||
|
NO=1
|
||||||
|
PROBABLY_YES=$YES
|
||||||
|
PROBABLY_NOT=$NO
|
||||||
|
REMEMBORY_AUTOPILOT=$NO
|
||||||
|
THIRDPARTY_BUILD_DIRECTORY="thirdparty"
|
||||||
|
|
||||||
|
decision() {
|
||||||
|
# get default
|
||||||
|
if [ "$2" = "$YES" ]; then
|
||||||
|
default="yes"
|
||||||
|
else
|
||||||
|
default="no"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# should we go autopilot
|
||||||
|
if [ "${REMEMBORY_AUTOPILOT}" = "$YES" ];
|
||||||
|
then
|
||||||
|
echo "$1? -> $default"
|
||||||
|
return $2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "$0 NEEDS A DECISION"
|
||||||
|
echo ""
|
||||||
|
echo "> $1?"
|
||||||
|
read -r -p "> Do you want? [y]es / [n]o / [d]efault ($default): " input
|
||||||
|
|
||||||
|
case $input in
|
||||||
|
[yY][eE][sS]|[yY])
|
||||||
|
return $YES
|
||||||
|
;;
|
||||||
|
[nN][oO]|[nN])
|
||||||
|
return $NO
|
||||||
|
;;
|
||||||
|
[dD])
|
||||||
|
return "$2" = "$YES"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
return $NO
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
# download the source code and unpack it into LIB_NAME
|
# download the source code and unpack it into LIB_NAME
|
||||||
function download() {
|
function download() {
|
||||||
echo "download msdf-atlas-gen"
|
echo "download msdf-atlas-gen"
|
||||||
|
@ -86,6 +131,63 @@ function download() {
|
||||||
# prepare the build environment, executed inside the lib src dir
|
# prepare the build environment, executed inside the lib src dir
|
||||||
function prepare() {
|
function prepare() {
|
||||||
mkdir -p lib/$TYPE
|
mkdir -p lib/$TYPE
|
||||||
|
|
||||||
|
PREV_DIR="$(pwd)"
|
||||||
|
|
||||||
|
if [ "$TYPE" == "emscripten" ] ; then
|
||||||
|
echo "preparing $TYPE thirdparty dependencies"
|
||||||
|
if decision "download, build and install all thirdparty dependencies" $PROBABLY_YES; then
|
||||||
|
REMEMBORY_AUTOPILOT=$YES
|
||||||
|
fi
|
||||||
|
if decision "download and build tinyxml2 for $TYPE" $PROBABLY_YES; then
|
||||||
|
mkdir -p "thirdparty"
|
||||||
|
cd "thirdparty"
|
||||||
|
if [ -d "tinyxml2" ] ; then
|
||||||
|
echo "apparently already done"
|
||||||
|
else
|
||||||
|
git clone --depth=1 https://github.com/leethomason/tinyxml2.git
|
||||||
|
cd tinyxml2
|
||||||
|
mkdir build && cd build
|
||||||
|
emcmake cmake ..
|
||||||
|
emmake make
|
||||||
|
emmake make install
|
||||||
|
fi
|
||||||
|
cd "$PREV_DIR"
|
||||||
|
fi
|
||||||
|
if decision "download and build zlib for $TYPE" $PROBABLY_YES; then
|
||||||
|
mkdir -p "thirdparty"
|
||||||
|
cd "thirdparty"
|
||||||
|
if [ -d "zlib" ] ; then
|
||||||
|
echo "apparently already done"
|
||||||
|
else
|
||||||
|
wget https://pointer.click/files/zlib-1.3.1.tar.gz
|
||||||
|
mkdir -p zlib
|
||||||
|
tar -xzf zlib-1.3.1.tar.gz -C zlib --strip-components=1
|
||||||
|
cd zlib
|
||||||
|
mkdir build && cd build
|
||||||
|
emcmake cmake ..
|
||||||
|
emmake make
|
||||||
|
emmake make install
|
||||||
|
fi
|
||||||
|
cd "$PREV_DIR"
|
||||||
|
fi
|
||||||
|
if decision "download and build libpng for $TYPE" $PROBABLY_YES; then
|
||||||
|
mkdir -p "thirdparty"
|
||||||
|
cd "thirdparty"
|
||||||
|
if [ -d "libpng-1.6.39" ] ; then
|
||||||
|
echo "apparently already done"
|
||||||
|
else
|
||||||
|
wget https://sourceforge.net/projects/libpng/files/libpng16/1.6.39/libpng-1.6.39.tar.xz/download -O libpng-1.6.39.tar.xz
|
||||||
|
tar -xf libpng-1.6.39.tar.xz
|
||||||
|
cd libpng-1.6.39
|
||||||
|
mkdir build && cd build
|
||||||
|
emcmake cmake ..
|
||||||
|
emmake make
|
||||||
|
emmake make install
|
||||||
|
fi
|
||||||
|
cd "$PREV_DIR"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# executed inside the lib src dir
|
# executed inside the lib src dir
|
||||||
|
|
Loading…
Reference in a new issue