diff --git a/.gitmodules b/.gitmodules index f91dc77..bde5c19 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,3 @@ -[submodule "ngx_openresty"] - path = dependencies/openresty - url = https://github.com/openresty/ngx_openresty [submodule "sh-realpath"] path = dependencies/sh-realpath url = https://github.com/mkropat/sh-realpath -[submodule "lua.vm.js"] - path = dependencies/lua.vm.js - url = https://github.com/kripken/lua.vm.js.git -[submodule "libev"] - path = dependencies/libev - url = https://github.com/enki/libev.git diff --git a/bin/install b/bin/install index 5408eaf..d639a9b 100755 --- a/bin/install +++ b/bin/install @@ -14,23 +14,15 @@ do cosy_temp="${i#*=}" cosy_temp="${cosy_temp%/}" ;; - -l=*|--lua=*) - lua_version="${i#*=}" - lua_version="${lua_version%/}" - ;; - -m|--minimal) - minimal=true - ;; -i|--in-ci) in_ci=true ;; *) echo "Usage: " - echo " install [--prefix=PREFIX] [--temp=TEMP_DIR] [--lua=LUA_VERSION] [--minimal] [--in-ci]" + echo " install [--prefix=PREFIX] [--temp=TEMP_DIR] [--in-ci]" exit 1; ;; esac - shift done # Useful variables: @@ -39,7 +31,6 @@ currentwd=$(dirname "${currentwd}") cosy_temp=${cosy_temp:-$(mktemp -d 2>/dev/null || mktemp -d -t cosy)} cosy_log="${cosy_temp}/install.log" cosy_prefix=${cosy_prefix:-${cosy_temp}} -lua_version=${lua_version:-5.2} parallel=$(nproc 2> /dev/null || sysctl -n hw.ncpu 2> /dev/null) { # Detect if apt-get or brew is available: @@ -102,7 +93,7 @@ if command -v git >> "${cosy_log}" 2>&1; then popd >> "${cosy_log}" 2>&1 if [ "${version}" = "${oldversion}" ]; then echo -e "Environment is already installed at version ${green}${oldversion}${nc}." - return + exit 0 fi fi @@ -136,7 +127,8 @@ cosy_temp=$(realpath "${cosy_temp}") perl build-essential wget python python-pip \ libc6-dev libssl-dev \ libreadline-dev libncurses5-dev libpcre3-dev \ - redis-server imagemagick npm caca-utils libc-bin + redis-server imagemagick npm caca-utils libc-bin \ + postgresql ;; "Darwin") HOMEBREW_PREFIX=$(brew config | grep "HOMEBREW_PREFIX" | tr -d ' \t' | cut -d ":" -f 2) @@ -145,7 +137,7 @@ cosy_temp=$(realpath "${cosy_temp}") export LD_LIBRARY_PATH="${HOMEBREW_PREFIX}/lib:${LD_LIBRARY_PATH}" export DYLD_LIBRARY_PATH="${HOMEBREW_PREFIX}/lib:${DYLD_LIBRARY_PATH}" brew update - brew install openssl pcre python redis imagemagick wget npm libcaca + brew install openssl pcre python redis imagemagick wget npm libcaca postgresql brew link --force openssl ;; *) @@ -161,26 +153,11 @@ cosy_temp=$(realpath "${cosy_temp}") export LD_LIBRARY_PATH="${cosy_prefix}/lib:${LD_LIBRARY_PATH}" } -# Install libev: -{ - export CC=clang - echo -n "Installing libev... " - ( - cd "${currentwd}/dependencies/libev" - ./configure --prefix="${cosy_prefix}" - make - ${sudo} make install - make clean - ) >> "${cosy_log}" 2>&1 \ - && echo -e "${green}success${nc}" \ - || echo -e "${red}failure${nc}" -} - # Install lua, luarocks and packages: { export CC=clang - echo -n "Installing lua ${lua_version} and luarocks... " - if pip list | grep "hererocks" >> "${cosy_temp}" 2>&1; then + echo -n "Installing luajit and luarocks... " + if pip list | grep "hererocks" >> "${cosy_log}" 2>&1; then hererocks="hererocks" else ${sudo} pip install --root="${cosy_prefix}" hererocks @@ -189,7 +166,7 @@ cosy_temp=$(realpath "${cosy_temp}") PYTHONPATH=$(dirname "${path}"):"${PYTHONPATH}" hererocks="${cosy_prefix}/usr/local/bin/hererocks" fi >> "${cosy_log}" 2>&1 - ${sudo} "${hererocks}" "${cosy_prefix}" -r^ --lua="${lua_version}" \ + ${sudo} "${hererocks}" "${cosy_prefix}" -r^ --luajit=2.1 \ >> "${cosy_log}" 2>&1 \ && echo -e "${green}success${nc}" \ || echo -e "${red}failure${nc}" @@ -201,8 +178,6 @@ cosy_temp=$(realpath "${cosy_temp}") luacov-coveralls luafilesystem luasec - lustache - serpent ) for dependency in ${dependencies[*]}; do if "${cosy_prefix}/bin/luarocks" list --porcelain \ @@ -218,30 +193,6 @@ cosy_temp=$(realpath "${cosy_temp}") || echo -e "${red}failure${nc}" fi done - echo -n "Installing lua 5.1 and luarocks for nginx... " - ${sudo} "${hererocks}" "${cosy_temp}/lua_install" -r^ --lua="5.1" \ - >> "${cosy_log}" 2>&1 \ - && echo -e "${green}success${nc}" \ - || echo -e "${red}failure${nc}" - nginx_dependencies=( - lua-cjson - lua-resty-http - md5 - ) - for dependency in ${nginx_dependencies[*]}; do - if "${cosy_temp}/lua_install/bin/luarocks" list --tree="${cosy_prefix}" --porcelain \ - >> "${cosy_log}" 2>&1 \ - | grep --silent "${dependency}"; then - echo " Not installing ${dependency} as it is already installed." - else - echo -n " Installing ${dependency} as it is not installed... " - # shellcheck disable=SC2086 - ${sudo} "${cosy_temp}/lua_install/bin/luarocks" install --tree="${cosy_prefix}" "${dependency}" \ - >> "${cosy_log}" 2>&1 \ - && echo -e "${green}success${nc}" \ - || echo -e "${red}failure${nc}" - fi - done echo -n "Installing sh-realpath... " ( ${sudo} cp "${currentwd}/dependencies/sh-realpath/realpath.sh" "${cosy_prefix}/bin/" ${sudo} chmod a+x "${cosy_prefix}/bin/realpath.sh" @@ -250,75 +201,6 @@ cosy_temp=$(realpath "${cosy_temp}") || echo -e "${red}failure${nc}" } -if [ ! -z "${minimal+x}" ]; then - echo -e "Skipping openresty and web dependencies as minimal install is set." - return -fi - -# Install web dependencies: -( - cd "${currentwd}" || exit 1 - web_dependencies=( - bootbox - bootstrap3 - d3 - font-awesome - jquery - jquery-locationpicker - sjcl - ) - rm -rf node_modules - echo "Installing web dependencies... " - for dependency in ${web_dependencies[*]}; do - echo -n " Installing ${dependency}... " - npm install "${dependency}" >> "${cosy_log}" 2>&1 \ - && echo -e "${green}success${nc}" \ - || echo -e "${red}failure${nc}" - done - ${sudo} mkdir -p "${cosy_prefix}/share/cosy/www" - ${sudo} mkdir -p "${cosy_prefix}/share/cosy/www/js" - ${sudo} mkdir -p "${cosy_prefix}/share/cosy/www/css" - ${sudo} mkdir -p "${cosy_prefix}/share/cosy/www/fonts" - for module in node_modules/*; do - name=$(basename "${module}") - ${sudo} cp "${module}/dist/"*.js "${cosy_prefix}/share/cosy/www/js/" 2> /dev/null || true - ${sudo} cp "${module}/dist/"*.map "${cosy_prefix}/share/cosy/www/js/" 2> /dev/null || true - ${sudo} cp "${module}/dist/js/"* "${cosy_prefix}/share/cosy/www/js/" 2> /dev/null || true - ${sudo} cp "${module}/dist/css/"* "${cosy_prefix}/share/cosy/www/css/" 2> /dev/null || true - ${sudo} cp "${module}/dist/fonts/"* "${cosy_prefix}/share/cosy/www/fonts/" 2> /dev/null || true - ${sudo} cp "${module}/js/"* "${cosy_prefix}/share/cosy/www/js/" 2> /dev/null || true - ${sudo} cp "${module}/css/"* "${cosy_prefix}/share/cosy/www/css/" 2> /dev/null || true - ${sudo} cp "${module}/fonts/"* "${cosy_prefix}/share/cosy/www/fonts/" 2> /dev/null || true - ${sudo} cp "${module}/${name}"*.js "${cosy_prefix}/share/cosy/www/js/" 2> /dev/null || true - ${sudo} cp "${module}/${name}"*.map "${cosy_prefix}/share/cosy/www/js/" 2> /dev/null || true - ${sudo} cp "${module}/${name}"*.css "${cosy_prefix}/share/cosy/www/css/" 2> /dev/null || true - done - ${sudo} rm -rf node_modules - ${sudo} cp "dependencies/lua.vm.js/dist/lua.vm.js" "${cosy_prefix}/share/cosy/www/js/" -) - -# Install openresty: -echo -n "Installing openresty... " -( - cd "${currentwd}/dependencies/openresty" || exit 1 - make - for dir in openresty-*; do - if [ -d "${dir}" ]; then - cd "${dir}" || exit 1 - ./configure --prefix="${cosy_prefix}" \ - --without-lua51 \ - --with-ipv6 \ - --with-pcre-jit - make -j"${parallel}" - ${sudo} make install - make clean - break - fi - done -) >> "${cosy_log}" 2>&1 \ - && echo -e "${green}success${nc}" \ - || echo -e "${red}failure${nc}" - ( cd "${currentwd}" || exit 1 git rev-parse HEAD > "${cosy_temp}/environment.version" diff --git a/dependencies/libev b/dependencies/libev deleted file mode 160000 index e3a3843..0000000 --- a/dependencies/libev +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e3a384312f505e7c20afb7bcbff47a1be1ac6eed diff --git a/dependencies/lua.vm.js b/dependencies/lua.vm.js deleted file mode 160000 index 4430a0d..0000000 --- a/dependencies/lua.vm.js +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4430a0d85ac70e733cc3e24b21ee3534d0963765 diff --git a/dependencies/openresty b/dependencies/openresty deleted file mode 160000 index 5f7f678..0000000 --- a/dependencies/openresty +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5f7f6788765f766fb2ad4b903258a650844416f5