Updated macOS build script and some README update.

This commit is contained in:
Stanislav Nikitin 2016-10-09 03:29:36 +05:00
parent 1278b71798
commit f793b2f467
3 changed files with 49 additions and 10 deletions

View File

@ -47,6 +47,12 @@ URTrator executable contains everything we need. Just download
approriate binary and launch it! :) The only thing is to make approriate binary and launch it! :) The only thing is to make
sure you have GTK2 and sqlite3 installed. sure you have GTK2 and sqlite3 installed.
## Distro-and-OS specific instructions
* [MacOS](/doc/installation/macos/)
* Windows (to be written)
* Nixes: read below.
## Development version ## Development version
URTrator written in Go and GTK2, so you should have them installed. URTrator written in Go and GTK2, so you should have them installed.

View File

@ -0,0 +1,25 @@
# MacOS installation
For proper application bundle building you have to:
* Install Homebrew (http://brew.sh)
* Install Golang:
```
brew install go
```
* Install GTK+2:
```
brew install gtk+
```
* Install dylibbundler:
```
brew install dylibbundler
```
* Execute ``make-app.sh`` script from current directory. If everything
went fine - you will see URTrator.app right in this directory.

28
doc/installation/macos/make-app.sh Executable file → Normal file
View File

@ -39,9 +39,9 @@ if [ $? -ne 0 ]; then
fi fi
echo "Creating app bundle..." echo "Creating app bundle..."
mkdir -p /Applications/URTrator.app/Contents/{MacOS,Library,Resources} mkdir -p URTrator.app/Contents/{MacOS,Framework,Resources}
cp $GOPATH/bin/urtrator /Applications/URTrator.app/Contents/MacOS/ cp $GOPATH/bin/urtrator URTrator.app/Contents/MacOS/
cp $GOPATH/src/github.com/pztrn/urtrator/artwork/urtrator.icns /Applications/URTrator.app/Contents/Resources/ cp $GOPATH/src/github.com/pztrn/urtrator/artwork/urtrator.icns URTrator.app/Contents/Resources/
##################################################################### #####################################################################
# APP BUNDLE INFO.PLIST # APP BUNDLE INFO.PLIST
@ -53,7 +53,7 @@ INFOPLIST='<?xml version="1.0" encoding="UTF-8"?>
<key>CFBundleGetInfoString</key> <key>CFBundleGetInfoString</key>
<string>URTrator</string> <string>URTrator</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>urtrator</string> <string>urtrator.sh</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>name.pztrn.urtrator</string> <string>name.pztrn.urtrator</string>
<key>CFBundleName</key> <key>CFBundleName</key>
@ -73,20 +73,28 @@ INFOPLIST='<?xml version="1.0" encoding="UTF-8"?>
</dict> </dict>
</plist>' </plist>'
echo ${INFOPLIST} > /Applications/URTrator.app/Contents/Info.plist echo ${INFOPLIST} > URTrator.app/Contents/Info.plist
echo -e '#!/bin/bash\ncd "${0%/*}"\n./urtrator' > ./URTrator.app/Contents/MacOS/urtrator.sh
chmod +x ./URTrator.app/Contents/MacOS/urtrator.sh
##################################################################### #####################################################################
# Libraries works. # Libraries works.
# First iteration - main libraries.
echo "Copying libraries..." echo "Copying libraries..."
LIBS_TO_COPY=$(otool -L urtrator | awk {' print $1 '} | grep "/usr/local") dylibbundler -of -b -x ./URTrator.app/Contents/MacOS/urtrator -d ./URTrator.app/Contents/Framework/ -p @executable_path/../Framework/
for lib in ${LIBS_TO_COPY[@]}; do # Fix shit for dylibbundler. By this moment we should have everything
cp ${lib} /Applications/URTrator.app/Contents/Library # we needed in Framework directory.
for lib in $(ls ./URTrator.app/Contents/Framework); do
libname=$(echo ${lib} | awk -F"/" {' print $NF '}) libname=$(echo ${lib} | awk -F"/" {' print $NF '})
install_name_tool -change ${lib} @executable_path/../Library/${libname} /Applications/URTrator.app/Contents/MacOS/urtrator DEPS=$(otool -L ./URTrator.app/Contents/Framework/${lib} | grep "/usr/local")
for dep in ${DEPS[@]}; do
dep_name=$(echo ${dep} | awk -F"/" {' print $NF '})
install_name_tool -change ${dep} @executable_path/../Framework/${dep_name} ./URTrator.app/Contents/Framework/${libname}
done
done done
echo "Finishing..." echo "Finishing..."
echo "URTrator is ready! Launch from Applications!" echo "URTrator is ready! Copy URTrator.app bundle to Applications and launch it!"