Skip to content
This repository has been archived by the owner on Apr 24, 2018. It is now read-only.

Commit

Permalink
Add option to build phar of PHP-SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
rugk committed Feb 9, 2017
1 parent e71cebf commit 0908360
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
20 changes: 18 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

CURR_DIR="$( pwd )"
SOURCE_DIR="$CURR_DIR/src"
PHP_SDK_SOURCE_DIR="$CURR_DIR/src/library/ThreemaGateway/threema-msgapi-sdk-php"
SCRIPT_DIR="$CURR_DIR/scripts"
DOC_DIR="$CURR_DIR/docs"
LANG_DIR="$CURR_DIR/languages"
Expand All @@ -22,10 +23,12 @@ show_help() {
echo "This is the built script for xenforo-threema-gateway.
$0 [-h|-?|--help]
$0 [[-m|--copydoc] 0/1] [[-d|--debug] 0/1] [[-l|--languages] language list]
[[-g|--genArchives] 0/1] [[-o|--addHashes] 0/1] [[-t|--date] date]
$0 [[-p|--sdkPhar] 0/1] [[-m|--copydoc] 0/1] [[-d|--debug] 0/1]
[[-l|--languages] language list] [[-g|--genArchives] 0/1]
[[-o|--addHashes] 0/1] [[-t|--date] date]
-h|-?|--help Show this help.
-p|--sdkPhar Build the PHP-SDK phar.
-m|--copydoc Additionally copy the doc files.
-d|--debug Build a debug version instead of a productive one.
-l|--languages After this parmeter specify the languages, which should be
Expand All @@ -45,6 +48,7 @@ show_help() {

# default parameters
languages=''
genPhpSdkPhar=1
copyDoc=0
debugMode=0
addHashes=1
Expand Down Expand Up @@ -72,6 +76,9 @@ while true; do
show_help
exit 0
;;
-p|--sdkPhar)
genPhpSdkPhar="${paramValue}"
;;
-m|--copydoc)
copyDoc="${paramValue}"
;;
Expand Down Expand Up @@ -151,6 +158,15 @@ cp -a "$DOC_DIR/templates/ArchiveReadme.txt" "$BUILD_DIR/README.txt"
echo "Copy LICENSE.md…"
cp -a "LICENSE.md" "$BUILD_DIR"

if [ ${genPhpSdkPhar} = 1 ]; then
echo "Generate PHP-SDK phar…"
cd "$PHP_SDK_SOURCE_DIR" || exit

scripts/buildPhar.php

cd "$CURR_DIR"
fi

echo "Copy source files…"
mkdir -p "$BUILD_DIR/upload"
rsync -a "$SOURCE_DIR/" "$BUILD_DIR/upload/"
Expand Down
4 changes: 4 additions & 0 deletions docs/Build.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# How to build

## Cloning

Please clone this repo and also (recursively) clone all submodules, because e.g. the PHP-SDK is a git submodule.

## Creating add-on
Just execute the included build script:

Expand Down

0 comments on commit 0908360

Please sign in to comment.