#!/bin/bash
# Copyright (c) 2000-2015 Synology Inc. All rights reserved.

make -j1 INSTALL_ROOT="$TmpInstDir" install-binaries

rm -rf "${TmpInstDir}/usr/bin/"{*phpize,*php-config,phar*,phpdbg}
rm -rf "${TmpInstDir}/usr/php"
rm -rf "${TmpInstDir}/usr/share"
rm -rf "${TmpInstDir}/var"

if [ "x$NOSTRIP" != "xNOSTRIP" ]; then
	"$STRIP" "$TmpInstDir"/usr/bin/*
fi

install -Dm644 synology/php.ini "${TmpInstDir}/etc/php/php.ini"
install -Dm755 synology/php_timezone_change.sh "${TmpInstDir}${SynoPluginDir}/timezone_change/php_timezone_change.sh"
install -Dm644 synology/php_timezone_update.service "${TmpInstDir}/usr/lib/systemd/system/php_timezone_update.service"
install -dm755 "${TmpInstDir}/usr/lib/systemd/system/multi-user.target.wants"
ln -sf ../php_timezone_update.service "${TmpInstDir}/usr/lib/systemd/system/multi-user.target.wants/php_timezone_update.service"

install -dm700 "$TmpInstDir"/usr/syno/bin/logcollector
install -Dm700 synology/phpinfo_log_collector.sh "$TmpInstDir"/usr/syno/bin/logcollector/phpinfo_log_collector.sh

rm -rf "$TmpInstDir"/etc/php/*.default
