Skip to content

Commit

Permalink
Simplified dependency installation [skip appveyor]
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyklay committed Nov 13, 2018
1 parent 63aa5f6 commit ae413b0
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 69 deletions.
2 changes: 0 additions & 2 deletions .ci/after-failure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

shopt -s nullglob

$(phpenv which php) -m

export LC_ALL=C

for i in core core*; do
Expand Down
33 changes: 0 additions & 33 deletions .ci/install-php-psr.sh

This file was deleted.

78 changes: 78 additions & 0 deletions .ci/install-prereqs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/usr/bin/env bash
#
# This file is part of the Zephir.
#
# (c) Zephir Team <[email protected]>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.

if [ "${CI}" != "true" ]; then
echo "This script is designed to run inside a CI container only. Stop."
exit 1
fi

printf "\n" | pecl install --force psr &> /dev/null

install_ext_from_src () {
pkgname=$1
source=$2
cfgflags=$3
downloaddir="${HOME}/.cache/${pkgname}/${pkgname}-${PHP_VERNUM}"
prefix="${HOME}/.local/opt/${pkgname}/${pkgname}-${PHP_VERNUM}"
libdir="${prefix}/lib"

if [ ! -f "${libdir}/pkgname.so" ]; then
if [ ! -d `dirname ${downloaddir}` ]; then
mkdir -p `dirname ${downloaddir}`
fi

cd `dirname ${downloaddir}`

if [ ! -d "${pkgname}-${PHP_VERNUM}" ]; then
git clone --depth=1 -v "${source}" "${pkgname}-${PHP_VERNUM}"
fi

if [ ! -f "${pkgname}-${PHP_VERNUM}/LICENSE" ]; then
echo "Unable to locate ${pkgname}-${PHP_VERNUM}/LICENSE file. Stop."
exit 1
fi

if [ ! -d "${downloaddir}" ]; then
echo "Unable to locate ${pkgname} source. Stop."
exit 1
fi

if [ ! -d "${libdir}" ]; then
mkdir -p "${libdir}"
fi

cd "${downloaddir}"
phpize
printf "\n" | ./configure "${cfgflags}"

make --silent -j"$(getconf _NPROCESSORS_ONLN)"
make --silent install

if [ -f `$(phpenv which php-config) --extension-dir`/${pkgname}.so ]; then
cp `$(phpenv which php-config) --extension-dir`/${pkgname}.so "${libdir}/${pkgname}.so"
elif [ -f "${downloaddir}/modules/${pkgname}.so" ]; then
cp "${downloaddir}/modules/${pkgname}.so" "${libdir}/${pkgname}.so"
fi
fi

if [ ! -x "${libdir}/${pkgname}.so" ]; then
echo "Unable to locate ${libdir}/${pkgname}.so. Stop."
exit 1
fi

echo "extension=${libdir}/${pkgname}.so" > "$(phpenv root)/versions/$(phpenv version-name)/etc/conf.d/${pkgname}.ini"
}

install_ext_from_src "zephir_parser" "https://github.com/phalcon/php-zephir-parser" ""

if [ "${PHP_VERNUM}" -ge 70300 ]; then
install_ext_from_src "memcached" "https://github.com/php-memcached-dev/php-memcached" "--disable-memcached-sasl"
else
echo 'extension="memcached.so"' > "$(phpenv root)/versions/$(phpenv version-name)/etc/conf.d/memcached.ini"
fi
27 changes: 0 additions & 27 deletions .ci/install-zephir-parser.sh

This file was deleted.

10 changes: 3 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ cache:
timeout: 604800
directories:
- $HOME/.composer/cache
- $HOME/.local/opt/re2c
- $HOME/.cache/re2c
- $HOME/.cache/php-psr
- $HOME/.local/opt

env:
global:
Expand All @@ -59,9 +57,8 @@ before_install:
- phpenv config-add .ci/999-default.ini

install:
- .ci/install-zephir-parser.sh
- .ci/install-prereqs.sh
- .ci/install-re2c.sh $RE2C_VERSION
- .ci/install-php-psr.sh
- travis_retry composer install $DEFAULT_COMPOSER_FLAGS
- .ci/build-test-ext.sh

Expand Down Expand Up @@ -108,9 +105,8 @@ jobs:
env:
- REPORT_COVERAGE=0
install:
- .ci/install-zephir-parser.sh
- .ci/install-prereqs.sh
- .ci/install-re2c.sh $RE2C_VERSION
- .ci/install-php-psr.sh
- travis_retry composer install $DEFAULT_COMPOSER_FLAGS
- mkdir -p ${HOME}/bin
- |
Expand Down

0 comments on commit ae413b0

Please sign in to comment.