diff --git a/opt.d/build-all-macos-mojave.sh b/opt.d/build-all-macos-mojave.sh new file mode 100755 index 0000000..e0bd952 --- /dev/null +++ b/opt.d/build-all-macos-mojave.sh @@ -0,0 +1,34 @@ +#!/bin/sh -x + +# platform-independent lib.sh +opt_dir=`dirname $0` +opt_dir=`pwd` +. $opt_dir/lib.sh + +# platform dependencies +# https://openresty.org/en/installation.html +shared_deps=" +curl +pcre +openssl +" +brew install $shared_deps || exit 1 + +# build openresty +SetupOpenRestyVars || exit 1 +CustomiseVars || exit 1 +SetupForBuild || exit 1 +ConfigureOpenResty \ + --with-cc-opt="-I/usr/local/opt/openssl/include/ -I/usr/local/opt/pcre/include/" \ + --with-ld-opt="-L/usr/local/opt/openssl/lib/ -L/usr/local/opt/pcre/lib/" || exit 1 +BuildAndCleanup || exit 1 + +# build tor +SetupTorVars || exit 1 +CustomiseVars || exit 1 +SetupForBuild || exit 1 +ConfigureTor || exit 1 +BuildAndCleanup || exit 1 + +# done +exit 0 diff --git a/opt.d/lib.sh b/opt.d/lib.sh index 0c99396..907735d 100644 --- a/opt.d/lib.sh +++ b/opt.d/lib.sh @@ -12,7 +12,7 @@ CustomiseVars() { SetupForBuild() { test -f "$tool_tarball" || curl -o "$tool_tarball" "$tool_url" || exit 1 test -f "$tool_sig" || curl -o "$tool_sig" "$tool_sig_url" || exit 1 - gpg --keyserver "hkp://$keyserver:80" --recv-keys "$tool_signing_key" || exit 1 + gpg --keyserver "hkp://$keyserver:80" --recv-keys $tool_signing_keys || exit 1 gpg --verify "$tool_sig" || exit 1 test -d "$tool_dir" || tar zxf "$tool_tarball" || exit 1 cd $tool_dir || exit 1 @@ -31,13 +31,13 @@ BuildAndCleanup() { SetupOpenRestyVars() { tool="openresty" tool_version="1.15.8.3" - tool_signing_key="25451EB088460026195BD62CB550E09EA0E98066" # this is the full A0E98066 signature + tool_signing_keys="25451EB088460026195BD62CB550E09EA0E98066" # this is the full A0E98066 signature tool_url="https://openresty.org/download/$tool-$tool_version.tar.gz" tool_sig_url="https://openresty.org/download/$tool-$tool_version.tar.gz.asc" tool_link_paths="nginx/sbin/nginx" } -ConfigureOpenResty() { +ConfigureOpenResty() { # this accepts arguments or_mods="https://github.com/yaoweibin/ngx_http_substitutions_filter_module.git" or_opts="--with-http_sub_module" # someday, redo this in lua or_mod_list="" @@ -52,8 +52,7 @@ ConfigureOpenResty() { or_mod_list="$or_mod_list --add-module=$mod_dir" done - echo "$0: note: you can ignore any 'unrecognized command line -msse4.2' error" - ./configure --prefix="$install_dir" $or_opts $or_mod_list || exit 1 + ./configure --prefix="$install_dir" $or_opts $or_mod_list "$@" || exit 1 } # ------------------------------------------------------------------ @@ -61,14 +60,14 @@ ConfigureOpenResty() { SetupTorVars() { tool="tor" tool_version="0.4.3.5" - tool_signing_key="6AFEE6D49E92B601 C218525819F78451" + tool_signing_keys="6AFEE6D49E92B601 C218525819F78451" tool_url="https://dist.torproject.org/$tool-$tool_version.tar.gz" tool_sig_url="https://dist.torproject.org/$tool-$tool_version.tar.gz.asc" - tool_link_path="bin/$tool" + tool_link_paths="bin/$tool" } -ConfigureTor() { - ./configure --prefix="$install_dir" || exit 1 +ConfigureTor() { # this accepts arguments + ./configure --prefix="$install_dir" "$@" || exit 1 } # ------------------------------------------------------------------