diff --git a/.travis.yml b/.travis.yml index ece4fd393..3daf0f480 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,11 +28,11 @@ install: env: global: - secure: "fJgWlCFbde96OSQNGKUmowGX+ERPeqP+n1EOMf1+FJzOU4DdkTLRAlV5+5qnEX9jB/3mWN6iPpmG1qEz/SdDG3KHxJYs4ZU/Lu485O24zZ/+GdYBNsrvhPD9ckPGEMLDa1foEVTDnW0Dlkz3BCFcszjhtXGUJv7v6Pj6LRk1Mg8=" + secure: "gTRPB+QAFO+OgIMSonYIMq5yhyvMib20DaeMrueqDsQatXdoJHhmncV1m2Kqiwh2o7esZPVTKo2PcvLyWOqtFS6Jt/AX7TzEqj4yehgD4xr6stpaKkTkKgtd2UR29CJPASWJHXzavnm8d57ZNq5iEu0YhwdlKeu1/Koe3QoU5SM=" -script: "./travis-script.sh" +script: "tools/travis-script.sh" after_success: -- python upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l core.zip -r Wagic-core.zip -b $TRAVIS_BRANCH -- python upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l projects/mtg/Android/bin/Wagic-debug.apk -r Wagic-android.apk -b $TRAVIS_BRANCH -- python upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l projects/mtg/psprelease.zip -r Wagic-psp.zip -b $TRAVIS_BRANCH +- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l core.zip -r Wagic-core.zip -b $TRAVIS_BRANCH +- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l projects/mtg/Android/bin/Wagic-debug.apk -r Wagic-android.apk -b $TRAVIS_BRANCH +- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l projects/mtg/psprelease.zip -r Wagic-psp.zip -b $TRAVIS_BRANCH diff --git a/appveyor.yml b/appveyor.yml index a0802bbc0..41490b4c9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -61,7 +61,7 @@ after_deploy: # to run your custom scripts instead of provider deployments deploy_script: - - "C:/Python27/python.exe upload-binaries.py -t %GH_TOKEN% -s %APPVEYOR_REPO_COMMIT% -l projects/mtg/bin/Wagic-windows.zip -r Wagic-windows.zip -b %APPVEYOR_REPO_BRANCH%" + - "C:/Python27/python.exe tools/upload-binaries.py -t %GH_TOKEN% -s %APPVEYOR_REPO_COMMIT% -l projects/mtg/bin/Wagic-windows.zip -r Wagic-windows.zip -b %APPVEYOR_REPO_BRANCH%" # to disable deployment #deploy: off diff --git a/projects/mtg/MacOS/Info.plist b/projects/mtg/MacOS/Info.plist new file mode 100644 index 000000000..3f2c494ee --- /dev/null +++ b/projects/mtg/MacOS/Info.plist @@ -0,0 +1,20 @@ + + + + + NSPrincipalClass + NSApplication + CFBundlePackageType + APPL + CFBundleGetInfoString + Created by Qt/QMake + CFBundleSignature + ???? + CFBundleExecutable + wagic.launcher + CFBundleIdentifier + wagic.wagic + NOTE + This file was generated by Qt/QMake. + + diff --git a/projects/mtg/MacOS/wagic.icns b/projects/mtg/MacOS/wagic.icns new file mode 100644 index 000000000..a5cf7d686 Binary files /dev/null and b/projects/mtg/MacOS/wagic.icns differ diff --git a/projects/mtg/MacOS/wagic.launcher b/projects/mtg/MacOS/wagic.launcher new file mode 100755 index 000000000..09a36f175 --- /dev/null +++ b/projects/mtg/MacOS/wagic.launcher @@ -0,0 +1,5 @@ +#!/bin/bash + +cd ${0%/*/*}/Resources +#cd ../Resources +exec ../MacOS/wagic -platformpluginpath ../PlugIns >> ../logs/out.log 2> ../logs/err.log diff --git a/projects/mtg/wagic-qt.pro b/projects/mtg/wagic-qt.pro index 9c547d11a..d53f75fcd 100644 --- a/projects/mtg/wagic-qt.pro +++ b/projects/mtg/wagic-qt.pro @@ -134,6 +134,28 @@ maemo5: { USERDIR = /sdcard/Wagic/Res DEFINES += RESDIR=\\\"$$RESDIR\\\" DEFINES += USERDIR=\\\"$$USERDIR\\\" +} else:macx { + # Copy the custom Info.plist to the app bundle + QMAKE_INFO_PLIST = MacOS/Info.plist + # Icon is mandatory for submission + ICON = MacOS/wagic.icns + + #Move resource file + res.commands = cd $$_PRO_FILE_PWD_/bin/Res; python createResourceZip.py; + res.depends = all + QMAKE_EXTRA_TARGETS += res + + # Create a dmg file + dmg.commands = mkdir wagic.app/Contents/logs; mkdir wagic.app/Contents/Resources/Res; mv $$_PRO_FILE_PWD_/bin/Res/core*.zip wagic.app/Contents/Resources/Res; cp $$_PRO_FILE_PWD_/MacOS/wagic.launcher wagic.app/Contents/MacOS; $$dirname(QMAKE_QMAKE)/macdeployqt wagic.app -dmg + dmg.depends = res + QMAKE_EXTRA_TARGETS += dmg + + QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9 + QMAKE_MAC_SDK = macosx + + # Only Intel binaries are accepted so force this + CONFIG += x86 + } else:unix { # Variables BINDIR = /usr/bin diff --git a/tools/build-macos-script.sh b/tools/build-macos-script.sh new file mode 100755 index 000000000..4e4284eb2 --- /dev/null +++ b/tools/build-macos-script.sh @@ -0,0 +1,32 @@ +#!/bin/sh -ex + +## New of branch to use +TRAVIS_MAC_BRANCH=travis_mac_osx + +## Only cross-compile on Mac the master branch +test "$TRAVIS_BRANCH" != "master" && exit 0 + +## Configure Git to use OAuth token +git config credential.helper "store --file=.git/credentials" +echo "https://${GH_TOKEN}:@github.com" > .git/credentials + +## Delete remote Travis-Mac branch (if any) +REMOTE=$(git branch -r | grep "origin/$TRAVIS_MAC_BRANCH\$") +if test -n "$REMOTE" ; then + # Delete remote branch + git branch -r -D "origin/$TRAVIS_MAC_BRANCH" + # Push (delete) remote branch on temote server (e.g. github) + git push origin ":$TRAVIS_MAC_BRANCH" +fi + +## Create a new branch +git checkout -q -b "$TRAVIS_MAC_BRANCH" "$TRAVIS_BRANCH" + +## Write a new Travis-CI configuration file +cp tools/mac.travis.yml .travis.yml +git add .travis.yml +git rm appveyor.yml +git commit -m "Auto-Updated Travis-CI configuration for Mac" + +## Push new branch to remote server +git push -q origin $TRAVIS_MAC_BRANCH:$TRAVIS_MAC_BRANCH diff --git a/tools/macos.travis.yml b/tools/macos.travis.yml new file mode 100644 index 000000000..caa7c5612 --- /dev/null +++ b/tools/macos.travis.yml @@ -0,0 +1,12 @@ +language: objective-c +before_install: +- brew update +- brew install qt5 +env: + global: + secure: "gTRPB+QAFO+OgIMSonYIMq5yhyvMib20DaeMrueqDsQatXdoJHhmncV1m2Kqiwh2o7esZPVTKo2PcvLyWOqtFS6Jt/AX7TzEqj4yehgD4xr6stpaKkTkKgtd2UR29CJPASWJHXzavnm8d57ZNq5iEu0YhwdlKeu1/Koe3QoU5SM=" +script: +- /usr/local/opt/qt5/bin/qmake projects/mtg/wagic-qt.pro CONFIG+=graphics +- make -j 4 dmg +after_success: +- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l wagic.dmg -r Wagic-macosx.dmg -b $TRAVIS_BRANCH diff --git a/travis-script.sh b/tools/travis-script.sh similarity index 70% rename from travis-script.sh rename to tools/travis-script.sh index 3cd466e71..b83388226 100755 --- a/travis-script.sh +++ b/tools/travis-script.sh @@ -36,11 +36,11 @@ cd ../../../.. # we're building a PSP binary here cd JGE -make -j 8 +make -j 4 cd .. cd projects/mtg mkdir objs -make -j 8 +make -j 4 mkdir WTH mkdir WTH/Res mv EBOOT.PBP WTH/ @@ -56,7 +56,7 @@ zip psprelease.zip -r WTH/ cd ../.. # we're building an Android binary here -android-ndk-r9/ndk-build -C projects/mtg/Android -j8 +android-ndk-r9/ndk-build -C projects/mtg/Android -j4 $ANDROID list targets $ANDROID update project -t 1 -p projects/mtg/Android ant debug -f projects/mtg/Android/build.xml @@ -65,36 +65,17 @@ ant debug -f projects/mtg/Android/build.xml mkdir qt-gui-build cd qt-gui-build $QMAKE ../projects/mtg/wagic-qt.pro CONFIG+=release CONFIG+=graphics -make -j 8 +make -j 4 cd .. # let's try an Intel linux binary in debug text-mode-only $QMAKE projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug DEFINES+=CAPTURE_STDERR -make -j 8 - -# we're cross-compiling a Qt Windows version here, -# PATH is only set here to prevent colision - -# export PATH="$PATH:/opt/mingw32/bin" -# mkdir build -# cd build -# mkdir win-cross -# cd win-cross -# /opt/mingw32/bin/qmake ../../projects/mtg/wagic-qt.pro CONFIG+=release CONFIG+=graphics -# make -j 8 -# cd release -# cp ../../../projects/mtg/bin/fmod.dll . -# cp /opt/mingw32/bin/QtCore4.dll . -# cp /opt/mingw32/bin/QtGui4.dll . -# cp /opt/mingw32/bin/QtNetwork4.dll . -# cp /opt/mingw32/bin/QtOpenGL4.dll . -# cp ../../../projects/mtg/bin/zlib1.dll . -# cp /opt/mingw32/bin/libpng15-15.dll . -# cd .. -# zip win-cross.zip -r release/ -# cd ../.. +make -j 4 # Now we run the testsuite (Res needs to be in the working directory) cd projects/mtg ../../wagic cd ../.. + +# Let's launch de Mac cross-compilation +./tools/build-macos-script.sh diff --git a/upload-binaries.py b/tools/upload-binaries.py similarity index 96% rename from upload-binaries.py rename to tools/upload-binaries.py index dc2238b05..d09c651a6 100644 --- a/upload-binaries.py +++ b/tools/upload-binaries.py @@ -49,7 +49,7 @@ def main(): (options, args) = parser.parse_args() - if (options.token and options.sha and options.local and options.remote and options.branch == 'master'): + if (options.token and options.sha and options.local and options.remote and (options.branch == 'master' or options.branch == 'travis_mac_osx')): gh = login(token = options.token) else: parser.print_help() diff --git a/upload-binaries.sh b/upload-binaries.sh deleted file mode 100755 index 272b4771d..000000000 --- a/upload-binaries.sh +++ /dev/null @@ -1,99 +0,0 @@ -if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then -if [ "$TRAVIS_BRANCH" == "alphas" ]; then - echo -e "Creating a release\n" - curl -X POST -H "Authorization: token ${GH_TOKEN}" \ - -d '{"tag_name": "alpha-'${TRAVIS_BUILD_NUMBER}'", "target_commitish": "master", "name": "Alpha release number '${TRAVIS_BUILD_NUMBER}'", "body": "Automatic alpha release generated by Travis CI", "draft": false, "prerelease": true}' "https://api.github.com/repos/WagicProject/wagic/releases" > json.txt - IDDI=`cat json.txt | jq '.id'` - - echo -e "Uploading Core resources\n" - curl -X POST -H "Authorization: token ${GH_TOKEN}" \ - -H "Accept: application/vnd.github.manifold-preview" \ - -H "Content-Type: application/zip" \ - --data-binary @core.zip \ - "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-core.zip" - - echo -e "Uploading android package\n" - curl -X POST -H "Authorization: token ${GH_TOKEN}" \ - -H "Accept: application/vnd.github.manifold-preview" \ - -H "Content-Type: application/zip" \ - --data-binary @projects/mtg/Android/bin/Wagic-debug.apk \ - "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-android.apk" - - echo -e "Uploading PSP package\n" - curl -X POST -H "Authorization: token ${GH_TOKEN}" \ - -H "Accept: application/vnd.github.manifold-preview" \ - -H "Content-Type: application/zip" \ - --data-binary @projects/mtg/psprelease.zip \ - "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-psp.zip" - -# echo -e "Uploading Windows package\n" -# curl -X POST -H "Authorization: token ${GH_TOKEN}" \ -# -H "Accept: application/vnd.github.manifold-preview" \ -# -H "Content-Type: application/zip" \ -# --data-binary @build/win-cross/win-cross.zip \ -# "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-windows.zip" - - echo -e "Done uploading\n" -fi -fi - -if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then -if [ "$TRAVIS_BRANCH" == "master" ]; then - - # get info about all releases - echo -e "Getting info about previous releases" - curl -X GET -H "Authorization: token ${GH_TOKEN}" \ - "https://api.github.com/repos/WagicProject/wagic/releases" > json.txt - - # extract info only about only "latest-release" tag - cat json.txt |jq 'map(select (.tag_name == "latest-master"))' > latest.txt - - # get id of release - ID_TO_DELETE=`cat latest.txt |jq '.[0].id'` - - # delete previous release - echo -e "Deleting release number ${ID_TO_DELETE}" - curl -X DELETE -H "Authorization: token ${GH_TOKEN}" \ - "https://api.github.com/repos/WagicProject/wagic/releases/${ID_TO_DELETE}" - - # delete previous tag - curl -X DELETE -H "Authorization: token ${GH_TOKEN}" \ - "https://api.github.com/repos/WagicProject/wagic/git/refs/tags/latest-master" - - - echo -e "Creating a release\n" - curl -X POST -H "Authorization: token ${GH_TOKEN}" \ - -d '{"tag_name": "latest-master", "target_commitish": "master", "name": "master-'${TRAVIS_BUILD_NUMBER}'", "body": "Automatic release based on latest commit to master branch generated by Travis CI", "draft": false, "prerelease": true}' "https://api.github.com/repos/WagicProject/wagic/releases" > json.txt - IDDI=`cat json.txt | jq '.id'` - - echo -e "Uploading Core resources\n" - curl -X POST -H "Authorization: token ${GH_TOKEN}" \ - -H "Accept: application/vnd.github.manifold-preview" \ - -H "Content-Type: application/zip" \ - --data-binary @core.zip \ - "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-core.zip" - - echo -e "Uploading android package\n" - curl -X POST -H "Authorization: token ${GH_TOKEN}" \ - -H "Accept: application/vnd.github.manifold-preview" \ - -H "Content-Type: application/zip" \ - --data-binary @projects/mtg/Android/bin/Wagic-debug.apk \ - "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-android.apk" - - echo -e "Uploading PSP package\n" - curl -X POST -H "Authorization: token ${GH_TOKEN}" \ - -H "Accept: application/vnd.github.manifold-preview" \ - -H "Content-Type: application/zip" \ - --data-binary @projects/mtg/psprelease.zip \ - "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-psp.zip" - -# echo -e "Uploading Windows package\n" -# curl -X POST -H "Authorization: token ${GH_TOKEN}" \ -# -H "Accept: application/vnd.github.manifold-preview" \ -# -H "Content-Type: application/zip" \ -# --data-binary @build/win-cross/win-cross.zip \ -# "https://uploads.github.com/repos/WagicProject/wagic/releases/${IDDI}/assets?name=Wagic-windows.zip" - - echo -e "Done uploading\n" -fi -fi