2014-02-13 04:46:19 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
trap "exit" INT
|
|
|
|
|
|
|
|
if [ ! -d "amxmodx" ]; then
|
2015-03-14 12:23:47 +00:00
|
|
|
git clone --recursive https://github.com/alliedmodders/amxmodx.git
|
2014-02-13 04:46:19 +00:00
|
|
|
fi
|
|
|
|
|
2018-08-26 18:28:25 +00:00
|
|
|
if [ ! -d "amxmodx/build_deps" ]; then
|
|
|
|
mkdir amxmodx/build_deps
|
|
|
|
fi
|
|
|
|
|
|
|
|
download_archive ()
|
|
|
|
{
|
|
|
|
if [ `command -v wget` ]; then
|
|
|
|
wget "$url" -O "$dest"
|
|
|
|
elif [ `command -v curl` ]; then
|
|
|
|
curl -o $dest $url
|
|
|
|
else
|
|
|
|
echo "Failed to locate wget or curl. Please install one of these programs."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-12-06 19:59:11 +00:00
|
|
|
ismac=0
|
|
|
|
iswin=0
|
|
|
|
|
2014-07-27 09:31:19 +00:00
|
|
|
if [ "$1" != "--no-mysql" ]; then
|
|
|
|
ismac=0
|
|
|
|
iswin=0
|
|
|
|
|
|
|
|
archive_ext=tar.gz
|
|
|
|
decomp="tar zxf"
|
2014-02-13 04:46:19 +00:00
|
|
|
|
2014-07-27 09:31:19 +00:00
|
|
|
if [ `uname` = "Darwin" ]; then
|
|
|
|
ismac=1
|
|
|
|
elif [ `uname` != "Linux" ] && [ -n "${COMSPEC:+1}" ]; then
|
|
|
|
iswin=1
|
|
|
|
archive_ext=zip
|
|
|
|
decomp=unzip
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $ismac -eq 1 ]; then
|
2017-10-31 22:06:30 +00:00
|
|
|
mysqlver=mysql-5.5.40-osx10.6-x86
|
2014-07-27 09:31:19 +00:00
|
|
|
mysqlurl=http://cdn.mysql.com/archives/mysql-5.5/$mysqlver.$archive_ext
|
|
|
|
elif [ $iswin -eq 1 ]; then
|
2017-10-31 22:06:30 +00:00
|
|
|
mysqlver=mysql-5.5.57-win32
|
|
|
|
mysqlurl=http://cdn.mysql.com/archives/mysql-5.5/$mysqlver.$archive_ext
|
2014-07-27 09:31:19 +00:00
|
|
|
# The folder in the zip archive does not contain the substring "-noinstall", so strip it
|
|
|
|
mysqlver=${mysqlver/-noinstall}
|
2014-02-13 04:46:19 +00:00
|
|
|
else
|
2017-10-31 22:06:30 +00:00
|
|
|
mysqlver=mysql-5.5.57-linux-glibc2.12-i686
|
|
|
|
mysqlurl=http://cdn.mysql.com/archives/mysql-5.5/$mysqlver.$archive_ext
|
2014-07-27 09:31:19 +00:00
|
|
|
fi
|
|
|
|
|
2017-10-31 22:06:30 +00:00
|
|
|
if [ ! -d "mysql-5.5" ]; then
|
2018-08-26 18:28:25 +00:00
|
|
|
url=$mysqlurl
|
|
|
|
dest=mysql.$archive_ext
|
|
|
|
download_archive
|
2014-07-27 09:31:19 +00:00
|
|
|
$decomp mysql.$archive_ext
|
2017-10-31 22:06:30 +00:00
|
|
|
mv $mysqlver mysql-5.5
|
2014-07-27 09:31:19 +00:00
|
|
|
rm mysql.$archive_ext
|
2014-02-13 04:46:19 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
checkout ()
|
|
|
|
{
|
|
|
|
if [ ! -d "$name" ]; then
|
2014-05-26 23:21:20 +00:00
|
|
|
git clone $repo -b $branch $name
|
|
|
|
if [ -n "$origin" ]; then
|
|
|
|
cd $name
|
|
|
|
git remote rm origin
|
|
|
|
git remote add origin $origin
|
|
|
|
cd ..
|
|
|
|
fi
|
2014-02-13 04:46:19 +00:00
|
|
|
else
|
|
|
|
cd $name
|
2014-05-26 23:21:20 +00:00
|
|
|
git checkout $branch
|
|
|
|
git pull origin $branch
|
2014-02-13 04:46:19 +00:00
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
name=metamod-am
|
2014-05-26 23:21:20 +00:00
|
|
|
branch=master
|
|
|
|
repo="https://github.com/alliedmodders/metamod-hl1"
|
|
|
|
origin=
|
2014-02-13 04:46:19 +00:00
|
|
|
checkout
|
|
|
|
|
|
|
|
name=hlsdk
|
2014-05-26 23:21:20 +00:00
|
|
|
branch=master
|
|
|
|
repo="https://github.com/alliedmodders/hlsdk"
|
|
|
|
origin=
|
2014-02-13 04:46:19 +00:00
|
|
|
checkout
|
|
|
|
|
2021-09-28 18:41:04 +00:00
|
|
|
python_cmd=`command -v python3`
|
2020-07-31 21:33:28 +00:00
|
|
|
if [ -z "$python_cmd" ]; then
|
2021-09-28 18:41:04 +00:00
|
|
|
echo "No suitable installation of Python detected. Min required is 3.6"
|
|
|
|
exit 1
|
2020-07-31 21:33:28 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
`$python_cmd -c "import ambuild2"` 2>&1 1>/dev/null
|
2014-02-13 04:46:19 +00:00
|
|
|
if [ $? -eq 1 ]; then
|
2021-09-28 18:41:04 +00:00
|
|
|
echo "AMBuild is required to build AMXModX"
|
2020-07-31 21:33:28 +00:00
|
|
|
|
|
|
|
`$python_cmd -m pip --version` 2>&1 1>/dev/null
|
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
echo "The detected Python installation does not have PIP"
|
|
|
|
echo "Installing the latest version of PIP available (VIA \"get-pip.py\")"
|
|
|
|
|
|
|
|
get_pip="./get-pip.py"
|
|
|
|
get_pip_url="https://bootstrap.pypa.io/get-pip.py"
|
|
|
|
|
|
|
|
if [ `command -v wget` ]; then
|
|
|
|
wget $get_pip_url -O $get_pip
|
|
|
|
elif [ `command -v curl` ]; then
|
|
|
|
curl -o $get_pip $get_pip_url
|
|
|
|
else
|
|
|
|
echo "Failed to locate wget or curl. Install one of these programs to download 'get-pip.py'."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
$python_cmd $get_pip
|
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
echo "Installation of PIP has failed"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2014-05-26 23:21:20 +00:00
|
|
|
repo="https://github.com/alliedmodders/ambuild"
|
|
|
|
origin=
|
|
|
|
branch=master
|
2014-02-13 04:46:19 +00:00
|
|
|
name=ambuild
|
|
|
|
checkout
|
2014-05-26 23:21:20 +00:00
|
|
|
|
2020-07-31 21:33:28 +00:00
|
|
|
if [ $iswin -eq 1 ] || [ $ismac -eq 1 ]; then
|
|
|
|
$python_cmd -m pip install ./ambuild
|
2014-02-13 04:46:19 +00:00
|
|
|
else
|
2015-04-19 18:10:04 +00:00
|
|
|
echo "Installing AMBuild at the user level. Location can be: ~/.local/bin"
|
2020-07-31 21:33:28 +00:00
|
|
|
$python_cmd -m pip install --user ./ambuild
|
2014-02-13 04:46:19 +00:00
|
|
|
fi
|
|
|
|
fi
|
2018-08-26 18:28:25 +00:00
|
|
|
|
|
|
|
if [ $iswin -eq 1 ]; then
|
|
|
|
if [ ! -d "amxmodx/build_deps/nasm-2.13.03" ]; then
|
|
|
|
url=http://www.nasm.us/pub/nasm/releasebuilds/2.13.03/win32/nasm-2.13.03-win32.zip
|
|
|
|
dest=amxmodx/build_deps/nasm-2.13.03-win32.zip
|
|
|
|
download_archive
|
|
|
|
cd amxmodx/build_deps
|
|
|
|
unzip nasm-2.13.03-win32.zip
|
|
|
|
rm nasm-2.13.03-win32.zip
|
|
|
|
mv nasm-2.13.03 nasm
|
|
|
|
fi
|
|
|
|
fi
|