Skip to content

Instantly share code, notes, and snippets.

@nojimage
Last active August 29, 2015 14:13
Show Gist options
  • Save nojimage/42710830aa28bfb31363 to your computer and use it in GitHub Desktop.
Save nojimage/42710830aa28bfb31363 to your computer and use it in GitHub Desktop.
php-build after-install.d
#!/usr/bin/env bash
TMP="/var/tmp/php-build"
PHP="/usr/bin/env php"
download_timecop() {
local timecop_url="$1"
if [ -z "$timecop_url" ]; then
timecop_url="https://github.com/hnw/php-timecop.git"
fi
if [ ! -d "$TMP/source/php-timecop" ]; then
echo "php-timecop" "Downloading from $timecop_url" >&3
git clone $timecop_url "$TMP/source/php-timecop"
else
echo "php-timecop" "self updating in $TMP/source/php-timecop" >&3
cd "$TMP/source/php-timecop" && git pull origin master
fi
}
install_timecop() {
download_timecop
echo "php-timecop" "Build & Installing " >&3
cd "$TMP/source/php-timecop" && "$PREFIX/bin/php" --ri timecop || ("$PREFIX/bin/phpize" && ./configure && make clean && make && make install)
echo "php-timecop" "Setup" >&3
echo "extension=timecop.so" > "$PREFIX/etc/conf.d/timecop.ini"
}
install_timecop
#!/bin/bash
set -e
if [ -n "$PHP_BUILD_DEBUG" ]; then
set -x
fi
composer="$PREFIX/bin/composer"
use_composer() {
"$composer" self-update
"$composer" global require squizlabs/php_codesniffer:"*"
if "$PREFIX/bin/php" -v | grep "PHP 5.3"; then
"$composer" global require apigen/apigen:"~2.8"
else
"$composer" global require apigen/apigen:"~4.0"
fi
}
if [ -f "$composer" ]; then
use_composer
else
echo "Neither composer found in $PREFIX/bin. Aborting" >&3
fi
@nojimage
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment