Change to native app creation for MacOS (#1459)

* Enable native MacOS builds

* Enable native MacOS builds

* Use Python 2

* Fix Shellingham bug in pipenv

* Add jhbuild bootstrap again additional to gtk bootstrap

* Rebuild Cairo with FreeType support for Poppler

* Switch to .new_local in build-app script

* Switch to .new_local in build-libzip

* Switch to .new_local in build-poppler

* Switch to .new_local in build-portaudio

* Switch to .new_local in build-sndfile

* Update macOS native build instructions for macOS 10.13

* Add adwaita-icon-theme to mac os native build instructions

* Create build directory if necessary

* Make build script gtk-path agnostic and update pipeline

* Fix macOS testing and add release code

* Add build script for cppunit in macOS

* Update CppUnit script

* Use precompiled GTK for native mac pipeline

* Build in correct directory

* Fix test execution for native mac pipeline

* Fix release pipeline for mac
presentation
Ulrich Huber 7 years ago committed by GitHub
parent 857639ac7c
commit d7313fb0d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      azure-pipelines/CI.yml
  2. 35
      azure-pipelines/release.yml
  3. 32
      azure-pipelines/steps/build_mac_native.yml
  4. 78
      mac-setup/README.md
  5. 22
      mac-setup/build-app.sh
  6. 15
      mac-setup/build-cppunit.sh
  7. 1
      mac-setup/build-gtk3.sh
  8. 2
      mac-setup/build-libzip.sh
  9. 3
      mac-setup/build-poppler.sh
  10. 2
      mac-setup/build-portaudio.sh
  11. 2
      mac-setup/build-sndfile.sh
  12. 13
      mac-setup/complete-build.sh

@ -56,11 +56,14 @@ stages:
vmImage: 'macOS-10.13' vmImage: 'macOS-10.13'
displayName: 'Test Xournal++ on MacOS' displayName: 'Test Xournal++ on MacOS'
steps: steps:
- template: steps/build_mac.yml - template: steps/build_mac_native.yml
parameters: parameters:
build_type: 'Debug' build_type: 'Debug'
cmake_flags: '-DCMAKE_DEBUG_INCLUDES_LDFLAGS=ON -DENABLE_CPPUNIT=ON -DDEBUG_COMPILE=ON' cmake_flags: '-DCMAKE_DEBUG_INCLUDES_LDFLAGS=ON -DENABLE_CPPUNIT=ON -DDEBUG_COMPILE=ON'
- bash: | - bash: |
ctest --verbose export PATH="$HOME/.local/bin:/Users/git-bin/gtk/inst/bin:$PATH"
install_name_tool -add_rpath /Users/git-bin/gtk/inst/lib/. test/test-loadHandler
install_name_tool -add_rpath /Users/git-bin/gtk/inst/lib/. test/test-util
CI=true ctest --verbose
workingDirectory: ./build workingDirectory: ./build
displayName: 'Run tests' displayName: 'Run tests'

@ -54,17 +54,24 @@ stages:
targetPath: './windows-setup/xournalpp-setup.exe' targetPath: './windows-setup/xournalpp-setup.exe'
displayName: 'Publish Windows Setup' displayName: 'Publish Windows Setup'
# - job: macOS - job: macOS
# pool: pool:
# vmImage: 'macOS-10.13' vmImage: 'macOS-10.13'
# displayName: 'Build for macOS' displayName: 'Build for macOS'
# steps: condition: always()
# - template: steps/build_mac.yml steps:
# parameters: - template: steps/build_mac_native.yml
# build_type: 'Release' parameters:
# cmake_flags: '' build_type: 'Release'
# - bash: | cmake_flags: ''
# ctest - bash: |
# workingDirectory: ./build export PATH="$HOME/.local/bin:/Users/git-bin/gtk/inst/bin:$PATH"
# displayName: 'Run tests' ./build-app.sh /Users/gtk-bin/gtk
# workingDirectory: ./mac-setup
displayName: 'Create App'
- task: PublishPipelineArtifact@0
inputs:
artifactName: 'macOS'
targetPath: './mac-setup/Xournal++.zip'
displayName: 'Publish macOS Setup'

@ -0,0 +1,32 @@
parameters:
build_type: ''
cmake_flags: ''
steps:
- bash: |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
displayName: 'Uninstall brew'
- bash: |
cd /Users
sudo mkdir git-bin
sudo chown $USER git-bin
cd git-bin
curl -L -o gtk-bin.tar.gz https://github.com/xournalpp/xournalpp-pipeline-dependencies/raw/master/gtk/mac/10.13/gtk-bin.tar.gz
tar -xzf gtk-bin.tar.gz
export PATH="$HOME/.local/bin:/Users/git-bin/gtk/inst/bin:$PATH"
displayName: 'Unpack GTK'
- bash: |
curl -L -o libxml.tar.gz https://github.com/xournalpp/xournalpp-pipeline-dependencies/raw/master/libxml/mac/10.13/libxml.tar.gz
sudo tar -xzf libxml.tar.gz -C /
displayName: 'Unpack libxml'
- bash: |
mkdir build
displayName: 'Create Build Directory'
- bash: |
export PATH="$HOME/.local/bin:/Users/git-bin/gtk/inst/bin:$PATH"
cmake -DCMAKE_INSTALL_PREFIX:PATH=/Users/git-bin/gtk/inst .. -DCMAKE_BUILD_TYPE=${{ parameters.build_type}} ${{ parameters.cmake_flags }}
make -j 4
make install
workingDirectory: ./build
displayName: 'Build Xournal++'

@ -1,60 +1,68 @@
## Build Xournal++ .app # Build Xournal++ .app
Do not install macports or homebrew. If you have installed it, you need to Do not install macports or homebrew. If you have installed it, you need to
create a new user, and use this for the whole process. jhbuild does not work, create a new user, and use this for the whole process. jhbuild does not work,
if there is such an environment installed. if there is such an environment installed.
### Make sure the Development environment is installed One possible way to use jhbuild alongside brew is to unlink all brew modules before running jhbuild. After finishing the build they can be relinked. This is untested though and might fail.
Open a Terminal, and type in **git**, confirm popup from Appstore with "Install" to install development tools.
### Build Libraries, needs to be once ## Make sure the Development environment is installed
Open a Terminal, and type in `git`, confirm popup from Appstore with "Install" to install development tools.
#### 1. Build GTK ## Build Libraries (needs to be done once)
Execute in this folder. Please take the OS version dependent problems for each step into account. The errors will vary with different versions of the libraries. If you encounter a yet unknown error, feel free to add it to this set of instructions.
### 1. Build GTK
````bash ````bash
./build-gtk3.sh ./build-gtk3.sh
```` ````
#### Potential Errors
##### itstool (version 2.0.6 on macOS High Sierra 10.13)
itstool might fail in configure step searching for libxml2 python bindings.
Follow these steps to resolve the issue:
- Open a shell with option 4
- Change Python to version 2.7 with `export PYTHON=/usr/bin/python2.7`
- Run the configure step manually with `./configure --prefix $HOME/gtk/inst`
- Exit the shell with `exit`
- Continue the build with option 2
##### expat (macOS Mojave 10.14)
The build might fail on expat: The build might fail on expat:
```` ````bash
configure: error: C compiler cannot create executables configure: error: C compiler cannot create executables
```` ````
* Press 4 to start a shell
* Copy the command from above: ./configure --prefix $HOME/gtk/inst
* Execute configure, it will work now
* Execute make install
* exit
Press 2 to ignore the error, as the build was manually successfully executed
The build will fail again. (missing python module six) Follow these steps to resolve the issue:
Download from here: https://pypi.org/project/six/ - Open a shell with option 4
Execute - Run the configure step manually with `./configure --prefix $HOME/gtk/inst`
````bash - Exit the shell with `exit`
$HOME/gtk/inst/bin/python setup.py install - Continue the build with option 2
````
Build again. It should now build ### 2. Start a jhbuild shell
````bash ````bash
./build-gtk3.sh $HOME/.new_local/bin/jhbuild shell
```` ````
#### 2. Build Poppler ### 3. Build Poppler
Execute in this folder. Execute in this folder.
````bash ````bash
./build-poppler.sh ./build-poppler.sh
```` ````
#### 3. PortAudio ### 4. Build PortAudio
````bash ````bash
./build-portaudio.sh ./build-portaudio.sh
```` ````
#### 4. LibZip ### 5. Build LibZip
````bash ````bash
./build-libzip.sh ./build-libzip.sh
```` ````
#### Potential Errors
##### Unknown module (macOS Mojave 10.14)
**TODO this needs to be improved to meet the standard of this tutorial**
If there is an error like: If there is an error like:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
@ -81,21 +89,25 @@ export PATH="$HOME/.local/bin:$HOME/gtk/inst/bin:$PATH"
autoreconf -if && ./configure --enable-cxx --prefix=$HOME/gtk/inst autoreconf -if && ./configure --enable-cxx --prefix=$HOME/gtk/inst
```` ````
#### 5. sndfile ### 6. Build sndfile
**TODO There is currently no support for Opus files so recording and playback might fail.**
````bash ````bash
./build-sndfile.sh ./build-sndfile.sh
```` ````
### 7. Build adwaita icon theme
````bash
jhbuild build adwaita-icon-theme
````
### Build Xournal++ and .app ## Build Xournal++ and package it as .app
````bash ````bash
complete-build.sh ./complete-build.sh $HOME/gtk
```` ````
Technical it does: Technical it does:
#### Build Xournal++ ### Build Xournal++
````bash ````bash
export PATH="$HOME/.local/bin:$HOME/gtk/inst/bin:$PATH" export PATH="$HOME/.local/bin:$HOME/gtk/inst/bin:$PATH"
@ -104,7 +116,7 @@ make -j 4
make install make install
```` ````
#### Build App ### Build App
````bash ````bash
./build-app.sh ./build-app.sh $HOME/gtk
```` ````

@ -5,13 +5,19 @@
## 2. call this script ## 2. call this script
## 3. an .app will be packed ## 3. an .app will be packed
if [ $# -eq 0 ]
then
echo 'Please provide the path of your gtk installation'
exit 1
fi
# go to script directory # go to script directory
cd "${0%/*}" cd "${0%/*}"
# delete old app, if there # delete old app, if there
echo "clean old app" echo "clean old app"
export PATH="$HOME/.local/bin:$HOME/gtk/inst/bin:$PATH" export PATH="$HOME/.local/bin:$1/inst/bin:$PATH"
rm -rf ./Xournal++.app rm -rf ./Xournal++.app
rm ./Xournal++.zip rm ./Xournal++.zip
@ -40,26 +46,28 @@ export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-2.0/gdk-pixbuf.loaders"
mkdir -p ./Xournal++.app/Contents/Resources/etc/gtk-2.0/ mkdir -p ./Xournal++.app/Contents/Resources/etc/gtk-2.0/
gdk-pixbuf-query-loaders > ./Xournal++.app/Contents/Resources/etc/gtk-2.0/gdk-pixbuf.loaders gdk-pixbuf-query-loaders > ./Xournal++.app/Contents/Resources/etc/gtk-2.0/gdk-pixbuf.loaders
sed -i -e "s:$HOME/gtk/inst/:@executable_path/../Resources/:g" ./Xournal++.app/Contents/Resources/etc/gtk-2.0/gdk-pixbuf.loaders sed -i -e "s:$1/inst/:@executable_path/../Resources/:g" ./Xournal++.app/Contents/Resources/etc/gtk-2.0/gdk-pixbuf.loaders
echo "Copy GTK Schema" echo "Copy GTK Schema"
mkdir -p ./Xournal++.app/Contents/Resources/share/glib-2.0/schemas mkdir -p ./Xournal++.app/Contents/Resources/share/glib-2.0/schemas
cp -rp $HOME/gtk/inst/share/glib-2.0/schemas ./Xournal++.app/Contents/Resources/share/glib-2.0/ cp -rp $1/inst/share/glib-2.0/schemas ./Xournal++.app/Contents/Resources/share/glib-2.0/
echo "Copy UI" echo "Copy UI"
cp -rp ../ui ./Xournal++.app/Contents/Resources/ cp -rp ../ui ./Xournal++.app/Contents/Resources/
sed -i -e 's/GDK_CONTROL_MASK/GDK_META_MASK/g' ./Xournal++.app/Contents/Resources/ui/main.glade sed -i -e 's/GDK_CONTROL_MASK/GDK_META_MASK/g' ./Xournal++.app/Contents/Resources/ui/main.glade
supportedLocales=("cs" "de" "it" "pl" "zh" "zh_TW" "zh_HK") for locale in */ ; do
for locale in "${supportedLocales[@]}" ; do if [ -f "$1/inst/share/locale/$locale/LC_MESSAGES/xournalpp.mo" ]
then
echo "Copy locale $locale" echo "Copy locale $locale"
mkdir -p setup/share/locale/$locale/LC_MESSAGES mkdir -p setup/share/locale/$locale/LC_MESSAGES
# Xournal Translation # Xournal Translation
cp ../build/po/$locale.gmo ./Xournal++.app/Contents/Resources/share/locale/$locale/LC_MESSAGES/xournalpp.mo cp ../build/po/$locale.gmo ./Xournal++.app/Contents/Resources/share/locale/$locale/LC_MESSAGES/xournalpp.mo
# Mac Integration # Mac Integration
cp $HOME/gtk/inst/share/locale/zh_CN/LC_MESSAGES/gtk-mac-integration.mo ./Xournal++.app/Contents/Resources/share/locale/$locale/LC_MESSAGES/gtk-mac-integration.mo cp $1/inst/share/locale/zh_CN/LC_MESSAGES/gtk-mac-integration.mo ./Xournal++.app/Contents/Resources/share/locale/$locale/LC_MESSAGES/gtk-mac-integration.mo
fi
done done
echo "Create zip" echo "Create zip"

@ -0,0 +1,15 @@
# go to script directory
cd "${0%/*}"
export PATH="$HOME/.new_local/bin:$PATH"
export LIBRARY_PATH="$HOME/gtk/inst/lib:$LIBRARY_PATH"
curl -L http://dev-www.libreoffice.org/src/cppunit-1.14.0.tar.gz -o cppunit-1.14.0.tar.gz
tar xzf cppunit-1.14.0.tar.gz
cd cppunit-1.14.0
./autogen.sh
./configure --prefix=$HOME/gtk/inst
make
make install

@ -8,5 +8,6 @@ curl https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/gtk-osx-setup.sh -o gtk-o
chmod +x gtk-osx-setup.sh chmod +x gtk-osx-setup.sh
./gtk-osx-setup.sh ./gtk-osx-setup.sh
jhbuild bootstrap
jhbuild bootstrap-gtk-osx jhbuild bootstrap-gtk-osx
jhbuild build python meta-gtk-osx-bootstrap meta-gtk-osx-gtk3 jhbuild build python meta-gtk-osx-bootstrap meta-gtk-osx-gtk3

@ -1,4 +1,4 @@
export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/.new_local/bin:$PATH"
curl -L https://libzip.org/download/libzip-1.5.2.tar.gz -o libzip.tar.gz curl -L https://libzip.org/download/libzip-1.5.2.tar.gz -o libzip.tar.gz
tar xf libzip.tar.gz tar xf libzip.tar.gz

@ -1,4 +1,4 @@
export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/.new_local/bin:$PATH"
curl -L https://github.com/uclouvain/openjpeg/archive/v2.3.0.tar.gz -o openjpeg.tar.gz curl -L https://github.com/uclouvain/openjpeg/archive/v2.3.0.tar.gz -o openjpeg.tar.gz
tar xf openjpeg.tar.gz tar xf openjpeg.tar.gz
@ -16,6 +16,7 @@ cd ..
export LIBRARY_PATH="$HOME/gtk/inst/lib:$LIBRARY_PATH" export LIBRARY_PATH="$HOME/gtk/inst/lib:$LIBRARY_PATH"
jhbuild build freetype fontconfig jhbuild build freetype fontconfig
jhbuild buildone -acf cairo
curl https://poppler.freedesktop.org/poppler-0.72.0.tar.xz -o poppler.tar.xz curl https://poppler.freedesktop.org/poppler-0.72.0.tar.xz -o poppler.tar.xz
tar xf poppler.tar.xz tar xf poppler.tar.xz

@ -1,7 +1,7 @@
# go to script directory # go to script directory
cd "${0%/*}" cd "${0%/*}"
export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/.new_local/bin:$PATH"
export LIBRARY_PATH="$HOME/gtk/inst/lib:$LIBRARY_PATH" export LIBRARY_PATH="$HOME/gtk/inst/lib:$LIBRARY_PATH"
curl -L http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz -o pa_stable_v190600_20161030.tgz curl -L http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz -o pa_stable_v190600_20161030.tgz

@ -1,7 +1,7 @@
# go to script directory # go to script directory
cd "${0%/*}" cd "${0%/*}"
export PATH="$HOME/.local/bin:$HOME/gtk/inst/bin:$PATH" export PATH="$HOME/.new_local/bin:$HOME/gtk/inst/bin:$PATH"
git clone https://github.com/erikd/libsndfile.git git clone https://github.com/erikd/libsndfile.git

@ -2,12 +2,19 @@
# Build for macOS, without GTK and without Poppler # Build for macOS, without GTK and without Poppler
export PATH="$HOME/.local/bin:$HOME/gtk/inst/bin:$PATH" if [ $# -eq 0 ]
then
echo 'Please provide the path of your gtk installation'
exit 1
fi
export PATH="$HOME/.local/bin:$1/inst/bin:$PATH"
mkdir -p ../build
cd ../build/ cd ../build/
cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME/gtk/inst .. cmake -DCMAKE_INSTALL_PREFIX:PATH=$1/inst ..
make -j 4 make -j 4
make install make install
cd ../mac-setup/ cd ../mac-setup/
./build-app.sh ./build-app.sh $1

Loading…
Cancel
Save