diff --git a/.travis.yml b/.travis.yml index a50a3671..4be7d4ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -198,7 +198,7 @@ matrix: - sh -c 'cd setup/macosx && ./compilers.sh' script: - echo -en 'travis_fold:start:build' - - sh -c 'cd setup/macosx && ./create_app_new.sh' + - sh -c 'cd setup/macosx && ./create_app.sh' - echo -en 'travis_fold:end:build' after_success: - md5 ./setup/macosx/transgui-$PROG_VER.dmg diff --git a/README.md b/README.md index 7dc337a7..3179659c 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ - [macOS](#macos) - [Without a package manager](#without-a-package-manager) - [Homebrew-Cask](#homebrew-cask) +- [Compilation](#compilation) + - [macOS](#macos-1) - [Command line parameters](#command-line-parameters) - [Portable mode](#portable-mode) - [Fixed hotkeys](#fixed-hotkeys) @@ -108,6 +110,19 @@ With Homebrew-Cask, directly execute this command to install Transmission Remote - `brew cask install transmission-remote-gui` +## Compilation + +### macOS + +**Note: Currently Transmission Remote GUI can't be compiled if fpc and lazarus were installed using Homebrew. You can uninstall them using** `brew uninstall fpc` and `brew cask uninstall lazarus` + +1. In Terminal navigate to the transgui folder containing the source code. So if you have it in Documents/transgui type `cd ~/Documents/transgui` +2. Type `cd setup/macosx` +3. Run the create_app shell script by typing `./create_app.sh` (Note the dot at the start of the line). +This will install fpc and lazarus if needed and build Transmission Remote GUI and move it in a .dmg image file. + +You can install the fpc and lazarus without compiling using the compilers.sh script, to run it type `./compilers.sh` while in the setup/macosx folder. + ## Command line parameters You can specify path to a .torrent file or a magnet link as a command line parameter. The program will add the specified torrent. diff --git a/setup/macosx/create_app.sh b/setup/macosx/create_app.sh index 22ab4703..f901776e 100755 --- a/setup/macosx/create_app.sh +++ b/setup/macosx/create_app.sh @@ -3,37 +3,38 @@ set -x prog_ver="$(cat ../../VERSION.txt)" +build="$(git rev-list --abbrev-commit --max-count=1 HEAD ../..)" +lazarus_ver="$(lazbuild -v)" +fpc_ver="$(fpc -i V | head -n 1)" exename=../../transgui appname="Transmission Remote GUI" -appfolder="../../$appname.app" +dmgfolder=./Release +appfolder="$dmgfolder/$appname.app" lazdir="${1:-/Developer/lazarus/}" +if [ -z "${CI-}" ]; then + ./compilers.sh +fi + if [ ! "$lazdir" = "" ] then lazdir=LAZARUS_DIR="$lazdir" fi +sed -i.bak "s/'Version %s'/'Version %s Build $build'#13#10'Compiled by: $fpc_ver, Lazarus v$lazarus_ver'/" ../../about.lfm + +lazbuild -B ../../transgui.lpi --lazarusdir=/Developer/lazarus/ + # Building Intel version make -j"$(sysctl -n hw.ncpu)" -C ../.. clean CPU_TARGET=i386 "$lazdir" make -j"$(sysctl -n hw.ncpu)" -C ../.. CPU_TARGET=i386 "$lazdir" -strip "$exename" -mv "$exename" "$exename.386" - -# Building PowerPC version -make -j"$(sysctl -n hw.ncpu)" -C ../.. clean CPU_TARGET=powerpc "$lazdir" -make -j"$(sysctl -n hw.ncpu)" -C ../.. CPU_TARGET=powerpc "$lazdir" -strip "$exename" -mv "$exename" "$exename.ppc" - -# Creating universal executable -lipo -create "$exename.ppc" "$exename.386" -output "$exename" -rm "$exename.386" "$exename.ppc" if ! [ -e $exename ] then echo "$exename does not exist" exit 1 fi +strip "$exename" rm -rf "$appfolder" @@ -44,6 +45,31 @@ mkdir -p "$appfolder/Contents/Resources" mv "$exename" "$appfolder/Contents/MacOS" cp ../../lang/transgui.* "$appfolder/Contents/MacOS/lang" +cp ../../history.txt "$dmgfolder" +cp ../../README.md "$dmgfolder" + cp PkgInfo "$appfolder/Contents" cp transgui.icns "$appfolder/Contents/Resources" sed -e "s/@prog_ver@/$prog_ver/" Info.plist > "$appfolder/Contents/Info.plist" + +ln -s /Applications "$dmgfolder/Drag \"Transmission Remote GUI\" here!" + +hdiutil create -ov -anyowners -volname "transgui-v$prog_ver" -format UDRW -srcfolder ./Release "tmp.dmg" + +mount_device="$(hdiutil attach -readwrite -noautoopen "tmp.dmg" | awk 'NR==1{print$1}')" +mount_volume="$(mount | grep "$mount_device" | sed 's/^[^ ]* on //;s/ ([^)]*)$//')" +cp transgui.icns "$mount_volume/.VolumeIcon.icns" +SetFile -c icnC "$mount_volume/.VolumeIcon.icns" +SetFile -a C "$mount_volume" + +hdiutil detach "$mount_device" +rm -f "transgui-$prog_ver.dmg" +hdiutil convert tmp.dmg -format UDBZ -imagekey zlib-level=9 -o "transgui-$prog_ver.dmg" + +rm tmp.dmg +rm -rf "$dmgfolder" +mv ../../about.lfm.bak ../../about.lfm + +if [ -z "${CI-}" ]; then + open "transgui-$prog_ver.dmg" +fi diff --git a/setup/macosx/create_app_new.sh b/setup/macosx/create_app_new.sh deleted file mode 100755 index f901776e..00000000 --- a/setup/macosx/create_app_new.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/sh - -set -x - -prog_ver="$(cat ../../VERSION.txt)" -build="$(git rev-list --abbrev-commit --max-count=1 HEAD ../..)" -lazarus_ver="$(lazbuild -v)" -fpc_ver="$(fpc -i V | head -n 1)" -exename=../../transgui -appname="Transmission Remote GUI" -dmgfolder=./Release -appfolder="$dmgfolder/$appname.app" -lazdir="${1:-/Developer/lazarus/}" - -if [ -z "${CI-}" ]; then - ./compilers.sh -fi - -if [ ! "$lazdir" = "" ] -then - lazdir=LAZARUS_DIR="$lazdir" -fi - -sed -i.bak "s/'Version %s'/'Version %s Build $build'#13#10'Compiled by: $fpc_ver, Lazarus v$lazarus_ver'/" ../../about.lfm - -lazbuild -B ../../transgui.lpi --lazarusdir=/Developer/lazarus/ - -# Building Intel version -make -j"$(sysctl -n hw.ncpu)" -C ../.. clean CPU_TARGET=i386 "$lazdir" -make -j"$(sysctl -n hw.ncpu)" -C ../.. CPU_TARGET=i386 "$lazdir" - -if ! [ -e $exename ] -then - echo "$exename does not exist" - exit 1 -fi -strip "$exename" - -rm -rf "$appfolder" - -echo "Creating $appfolder..." -mkdir -p "$appfolder/Contents/MacOS/lang" -mkdir -p "$appfolder/Contents/Resources" - -mv "$exename" "$appfolder/Contents/MacOS" -cp ../../lang/transgui.* "$appfolder/Contents/MacOS/lang" - -cp ../../history.txt "$dmgfolder" -cp ../../README.md "$dmgfolder" - -cp PkgInfo "$appfolder/Contents" -cp transgui.icns "$appfolder/Contents/Resources" -sed -e "s/@prog_ver@/$prog_ver/" Info.plist > "$appfolder/Contents/Info.plist" - -ln -s /Applications "$dmgfolder/Drag \"Transmission Remote GUI\" here!" - -hdiutil create -ov -anyowners -volname "transgui-v$prog_ver" -format UDRW -srcfolder ./Release "tmp.dmg" - -mount_device="$(hdiutil attach -readwrite -noautoopen "tmp.dmg" | awk 'NR==1{print$1}')" -mount_volume="$(mount | grep "$mount_device" | sed 's/^[^ ]* on //;s/ ([^)]*)$//')" -cp transgui.icns "$mount_volume/.VolumeIcon.icns" -SetFile -c icnC "$mount_volume/.VolumeIcon.icns" -SetFile -a C "$mount_volume" - -hdiutil detach "$mount_device" -rm -f "transgui-$prog_ver.dmg" -hdiutil convert tmp.dmg -format UDBZ -imagekey zlib-level=9 -o "transgui-$prog_ver.dmg" - -rm tmp.dmg -rm -rf "$dmgfolder" -mv ../../about.lfm.bak ../../about.lfm - -if [ -z "${CI-}" ]; then - open "transgui-$prog_ver.dmg" -fi diff --git a/setup/macosx/create_package.sh b/setup/macosx/create_package.sh deleted file mode 100755 index 5bdd61cf..00000000 --- a/setup/macosx/create_package.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -prog_ver="$(cat ../../VERSION.txt)" -pm="/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker" -proot=../../proot - -echo Preparing package contents... - -rm -rf "$proot" - -mkdir -p "$proot/Applications" -cp -R "../../Transmission Remote GUI.app" "$proot/Applications" - -# fix permissions -# everyone can read, group can write -find "$proot" -exec chmod a+r,g+w {} \; -# what is executable should be executable by everyone -find "$proot" -perm +o+x -exec chmod a+x {} \; -# everyone can access directories -find "$proot" -type d -exec chmod a+x {} \; - -mkdir ./Resources -cp ../../LICENSE ./Resources/License.txt - -echo Creating package... - -mkdir ./image -"$pm" --root "$proot" --info ./package.plist --version "$prog_ver" --title "Transmission Remote GUI $prog_ver" --resources ./Resources --target 10.4 --no-relocate --out ./image/transgui.pkg -rm -r ./Resources -rm -r "$proot" - -cp ../../history.txt ./image -cp ../../README.md ./image - -echo Creating disk image... -mkdir -p "../../Release" - -hdiutil create -ov -anyowners -volname "transgui-$prog_ver" -imagekey zlib-level=9 -format UDBZ -srcfolder ./image "../../Release/transgui-$prog_ver.dmg" - -rm -r ./image