2017-05-07 11:21:07 +03:00
|
|
|
#!/bin/bash
|
2019-12-22 23:45:42 +03:00
|
|
|
set -Eeuo pipefail
|
2017-05-07 11:21:07 +03:00
|
|
|
|
|
|
|
echo "### Building deps"
|
2019-12-22 23:45:42 +03:00
|
|
|
pushd "$(dirname "${BASH_SOURCE[0]}")/.." > /dev/null
|
|
|
|
|
|
|
|
readonly deployment_target_file="./resources/macos_deployment_target.txt"
|
|
|
|
readonly deployment_target=$(cat ${deployment_target_file})
|
2020-01-17 12:19:16 +03:00
|
|
|
readonly pcre_version="8.43"
|
|
|
|
readonly xz_version="5.2.4"
|
|
|
|
readonly ag_version="2.2.0"
|
2019-12-22 23:45:42 +03:00
|
|
|
|
2020-02-14 00:45:29 +03:00
|
|
|
readonly build_ag=${build_ag:-false}
|
|
|
|
readonly build_pcre=${build_pcre:-false}
|
|
|
|
readonly build_xz=${build_xz:-false}
|
|
|
|
|
2020-01-17 12:19:16 +03:00
|
|
|
build_ag () {
|
2020-02-14 09:44:48 +03:00
|
|
|
echo "### Building ag..."
|
2020-01-17 12:19:16 +03:00
|
|
|
pushd .deps > /dev/null
|
|
|
|
curl -L -o ag.tar.gz https://github.com/ggreer/the_silver_searcher/archive/${ag_version}.tar.gz
|
|
|
|
tar xf ag.tar.gz
|
|
|
|
mv the_silver_searcher-${ag_version} ag
|
|
|
|
|
|
|
|
pushd ag > /dev/null
|
|
|
|
./autogen.sh
|
|
|
|
|
|
|
|
xz_include=$(pwd)/../../third-party/libxz/include
|
|
|
|
pcre_include=$(pwd)/../../third-party/libpcre/include
|
|
|
|
./configure CFLAGS="-mmacosx-version-min=${deployment_target} -I${xz_include} -I${pcre_include}" \
|
|
|
|
LDFLAGS="-L$(pwd)/../../third-party/libxz/lib -L$(pwd)/../../third-party/libpcre/lib" \
|
|
|
|
MACOSX_DEPLOYMENT_TARGET=${deployment_target}
|
|
|
|
pushd src > /dev/null
|
|
|
|
cc -c ignore.c log.c options.c print.c scandir.c search.c lang.c util.c decompress.c zfile.c
|
|
|
|
ar -crs libag.a ignore.o log.o options.o print.o scandir.o search.o lang.o util.o decompress.o zfile.o
|
|
|
|
mkdir -p $(pwd)/../../../third-party/libag/lib
|
|
|
|
mv libag.a $(pwd)/../../../third-party/libag/lib
|
|
|
|
|
|
|
|
mkdir -p $(pwd)/../../../third-party/libag/include
|
|
|
|
cp *.h $(pwd)/../../../third-party/libag/include
|
|
|
|
popd > /dev/null
|
|
|
|
popd > /dev/null
|
|
|
|
popd > /dev/null
|
2020-02-14 09:44:48 +03:00
|
|
|
echo "### Built ag."
|
2020-01-17 12:19:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
build_xz () {
|
2020-02-14 09:44:48 +03:00
|
|
|
echo "### Building xz (and ag)..."
|
2020-01-17 12:19:16 +03:00
|
|
|
pushd .deps > /dev/null
|
|
|
|
curl -L -o xz.tar.gz https://tukaani.org/xz/xz-${xz_version}.tar.gz
|
|
|
|
tar xf xz.tar.gz
|
|
|
|
mv xz-${xz_version} xz
|
|
|
|
|
|
|
|
pushd xz > /dev/null
|
|
|
|
# configure from https://github.com/Homebrew/homebrew-core/blob/c9882801013d6bc5202b91ef56ff5838d18bbab2/Formula/xz.rb
|
|
|
|
./configure CFLAGS="-mmacosx-version-min=${deployment_target}" MACOSX_DEPLOYMENT_TARGET=${deployment_target} \
|
|
|
|
--disable-debug \
|
|
|
|
--disable-dependency-tracking \
|
|
|
|
--disable-silent-rules \
|
|
|
|
--prefix=$(pwd)/../../third-party/libxz
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
rm -rf $(pwd)/../../third-party/libxz/bin
|
|
|
|
rm -rf $(pwd)/../../third-party/libxz/share
|
|
|
|
popd > /dev/null
|
|
|
|
popd > /dev/null
|
2020-02-14 09:44:48 +03:00
|
|
|
echo "### Built xz (and ag)..."
|
2020-01-17 12:19:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
build_pcre () {
|
2020-02-14 09:44:48 +03:00
|
|
|
echo "### Building pcre (and ag)..."
|
2020-01-17 12:19:16 +03:00
|
|
|
pushd .deps > /dev/null
|
|
|
|
curl -L -o pcre.tar.bz2 https://ftp.pcre.org/pub/pcre/pcre-${pcre_version}.tar.bz2
|
|
|
|
tar xf pcre.tar.bz2
|
|
|
|
mv pcre-${pcre_version} pcre
|
|
|
|
|
|
|
|
pushd pcre > /dev/null
|
|
|
|
# configure from https://github.com/Homebrew/homebrew-core/blob/c9882801013d6bc5202b91ef56ff5838d18bbab2/Formula/pcre.rb
|
|
|
|
./configure CFLAGS="-mmacosx-version-min=${deployment_target}" MACOSX_DEPLOYMENT_TARGET=${deployment_target} \
|
|
|
|
--disable-dependency-tracking \
|
|
|
|
--prefix=$(pwd)/../../third-party/libpcre \
|
|
|
|
--enable-utf8 \
|
|
|
|
--enable-pcre8 \
|
|
|
|
--enable-pcre16 \
|
|
|
|
--enable-pcre32 \
|
|
|
|
--enable-unicode-properties \
|
|
|
|
--enable-pcregrep-libz \
|
|
|
|
--enable-pcregrep-libbz2 \
|
|
|
|
--enable-jit
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
rm -rf $(pwd)/../../third-party/libpcre/bin
|
|
|
|
rm -rf $(pwd)/../../third-party/libpcre/share
|
|
|
|
popd > /dev/null
|
|
|
|
popd > /dev/null
|
2020-02-14 09:44:48 +03:00
|
|
|
echo "### Built pcre (and ag)..."
|
2020-01-17 12:19:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
build_vimr_deps () {
|
|
|
|
rm -rf .deps
|
|
|
|
mkdir .deps
|
|
|
|
|
2020-02-14 00:45:29 +03:00
|
|
|
if [[ ${build_pcre} == true ]] ; then
|
|
|
|
rm -rf third-party/libpcre
|
|
|
|
build_pcre
|
2020-02-14 09:44:48 +03:00
|
|
|
|
|
|
|
rm -rf third-party/libag
|
2020-02-14 00:45:29 +03:00
|
|
|
build_ag
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ${build_xz} == true ]] ; then
|
|
|
|
rm -rf third-party/libxz
|
|
|
|
build_xz
|
2020-02-14 09:44:48 +03:00
|
|
|
|
|
|
|
rm -rf third-party/libag
|
|
|
|
build_ag
|
2020-02-14 00:45:29 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ${build_ag} == true ]] ; then
|
|
|
|
rm -rf third-party/libag
|
|
|
|
build_ag
|
|
|
|
fi
|
2020-01-17 12:19:16 +03:00
|
|
|
}
|
|
|
|
|
2020-02-14 09:44:48 +03:00
|
|
|
main () {
|
2020-08-16 20:07:53 +03:00
|
|
|
build_vimr_deps
|
2020-02-14 09:44:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
main
|