Skip to content

Commit

Permalink
OSX - new wrapper script, no_chdir, -O2 compile option for environment
Browse files Browse the repository at this point in the history
  • Loading branch information
yousseb committed Dec 2, 2018
1 parent 9e48286 commit 7b8f313
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 6 deletions.
4 changes: 3 additions & 1 deletion osx/build_app.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

export PATH=$HOME/.local/bin:$HOME/gtk/inst/bin:$PATH

APP="$PWD/dist/Meld.app"
MAIN="$APP/"
RES="$MAIN/Contents/Resources/"
Expand Down Expand Up @@ -92,7 +94,7 @@ rsync -t $INSTROOT/lib/libgtkmacintegration-gtk3.2.dylib $FRAMEWORKS/libgtkmacin

# rename script, use wrapper
mv $MAIN/Contents/MacOS/Meld $MAIN/Contents/MacOS/Meld-bin
rsync -t osx/Meld $MAIN/Contents/MacOS/meld_wrapper
rsync -t osx/meld.applescript $MAIN/Contents/MacOS/meld_wrapper
mv $MAIN/Contents/MacOS/meld_wrapper $MAIN/Contents/MacOS/Meld
chmod +x $MAIN/Contents/MacOS/Meld
chmod +x $MAIN/Contents/MacOS/Meld-bin
Expand Down
8 changes: 5 additions & 3 deletions osx/build_env.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/bin/bash

export MACOSX_DEPLOYMENT_TARGET=10.9
export PATH=$HOME/.local/bin:$PATH
export PATH=$HOME/.local/bin:$HOME/gtk/inst/bin:$PATH

pushd . > /dev/null
jhbuild bootstrap
jhbuild buildone libffi openssl python3 libxml2
$HOME/gtk/inst/bin/python3 -m ensurepip
$HOME/gtk/inst/bin/pip3 install six
PYTHON=$HOME/gtk/inst/bin/python3 jhbuild build
~/gtk/inst/bin/pip3 install pyobjc-core
~/gtk/inst/bin/pip3 install pyobjc-framework-Cocoa
$HOME/gtk/inst/bin/pip3 install pyobjc-core
$HOME/gtk/inst/bin/pip3 install pyobjc-framework-Cocoa
$HOME/gtk/inst/bin/pip3 install py2app
(cd $HOME/gtk/inst/lib && ln -s libpython3.6m.dylib libpython3.6.dylib)

exit

Expand Down
5 changes: 4 additions & 1 deletion osx/jhbuildrc-custom
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ _gtk_osx_use_jhbuild_python = True

os.environ["CC"] = "/usr/local/bin/ccache /usr/bin/clang"
os.environ["CXX"] = "/usr/local/bin/ccache /usr/bin/clang++"
os.environ["CXXFLAGS"] = "-std=c++11 -stdlib=libc++"
os.environ['CFLAGS'] = '-O2'
os.environ["CXXFLAGS"] = "-std=c++11 -stdlib=libc++ -O2"
os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.9"
os.environ["DYLD_FALLBACK_LIBRARY_PATH"] = "@executable_path/../Frameworks/:@executable_path/../Resources/lib"

#skip.append("libiconv") # Lion issues
skip.append("cups")
Expand Down Expand Up @@ -66,6 +68,7 @@ global autogenargs
autogenargs = autogenargs + ' --disable-documentation --disable-docs --enable-introspection --enable-gtk-doc=no --enable-gtk-doc-html=no --enable-gtk-doc-pdf=no'
# autogenargs += ' --cache-file=' + checkoutroot + '/autoconf-cache '

module_autogenargs['gettext-tools'] = 'CFLAGS=-O0'
module_autogenargs['yelp'] = '--disable-Werror'
module_autogenargs['zlib']= ''# + autogenargs
module_autogenargs['librsvg'] = autogenargs
Expand Down
39 changes: 39 additions & 0 deletions osx/meld.applescript
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env osascript

on run argv
--set current_path to do shell script "echo $PWD"
set macos_path to POSIX path of ((path to me as text) & "::")
set contents_path to parentFolder for macos_path
set frameworks_path to contents_path & "/Frameworks"
set resources_path to contents_path & "/Resources"
set library_path to (quoted form of frameworks_path) & ":" & (quoted form of (resources_path & "/lib"))

-- return do shell script "cd " & quoted form of current_path & ";DYLD_LIBRARY_PATH=" & library_path & " " & quoted form of (macos_path & "Meld-bin") & " " & argv

set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to " "
do shell script "DYLD_LIBRARY_PATH=" & library_path & " exec " & quoted form of (macos_path & "Meld-bin") & " " & argv as text & " --"
end run

-- FUNCTIONS

-- From https://stackoverflow.com/a/30824337
to parentFolder for aPath
set aPath to posixPath for aPath
set {tids, text item delimiters, i} to {text item delimiters, "/", ((aPath ends with "/") as integer) + 1}
set {pF, text item delimiters} to {text 1 thru text item -(i + 1) of aPath, tids}
return pF
end parentFolder

-- From https://stackoverflow.com/a/30824337
to posixPath for aPath
if class of aPath is not text then set aPath to aPath as text
if aPath contains ":" then set aPath to POSIX path of aPath
repeat while aPath starts with "//"
set aPath to (characters 2 thru -1 of aPath) as text
end repeat
repeat while aPath ends with "//"
set aPath to (characters 1 thru -2 of aPath) as text
end repeat
return aPath
end posixPath
4 changes: 3 additions & 1 deletion setup_py2app.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
'NSHighResolutionCapable': True,
'LSApplicationCategoryType': 'public.app-category.productivity',
'LSRequiresNativeExecution': True,
'NSRequiresAquaSystemAppearance': False
'NSRequiresAquaSystemAppearance': False,
'NSUIElement': 1
}

#find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"])
Expand Down Expand Up @@ -103,6 +104,7 @@
'librsvg-2.2.dylib,'
,
'argv_emulation': True,
'no_chdir': True,
'iconfile': 'osx/meld.icns',
'plist': PLIST,
'prefer_ppc': False,
Expand Down

0 comments on commit 7b8f313

Please sign in to comment.