-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·54 lines (42 loc) · 1.24 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
#
# This file is part of the PHP Code Compiler project
#
# Copyright (c) Yannoff (https://github.com/yannoff)
#
# @project PHP Code Compiler (yannoff/phpcc)
# @homepage https://github.com/yannoff/phpcc
# @license https://github.com/yannoff/phpcc/blob/main/LICENSE
#
# For the full copyright and license information, please view
# the LICENSE file that was distributed with this source code.
#
version=$1
phar=bin/phpcc
main=bin/compile.php
if [ -z "$version" ]
then
echo "Error: missing version argument."
exit 1
fi
# Ensure dependencies are up-to-date
offenbach install --no-dev --no-interaction --optimize-autoloader
# Update version in main application bootstrap file
sed -i "s/\$VERSION *=.*/\$VERSION = '$version';/" $main
args=()
# Add src/ & vendor/ as source directories
args+=(--dir src:php)
args+=(--dir vendor:php)
# Set bootstrap & output properties
args+=(--main $main)
args+=(--output $phar)
# Set the legal banner file
args+=(--banner .banner)
# Add license file
args+=(--file LICENSE)
# Add archive metadata properties
args+=(--meta license:MIT)
args+=(--meta author:yannoff)
args+=(--meta copyright:yannoff)
echo php -dphar.readonly=0 bin/compile.php "${args[@]}"
php -dphar.readonly=0 bin/compile.php "${args[@]}"