diff options
author | madmonkey1907 <madfkingmonkey@gmail.com> | 2017-01-12 06:50:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-12 06:50:48 +0300 |
commit | 8204d067fe1b4cbe0e56fcee6a280b54139ca6cb (patch) | |
tree | becced5a0c7342e23fa77935edb13c27bf11fcfb | |
parent | c6aaeaa18376f9d43c610c5840268dd6f93adb64 (diff) | |
parent | 7d9f0b5b89802d7c0a0138c5d69492e86b1514e4 (diff) |
Merge pull request #12 from thomas-alrek/master
Improved Mac compatiblity
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .gitmodules | 7 | ||||
m--------- | 3rdparty/macdylibbundler | 0 | ||||
-rw-r--r-- | Makefile | 16 | ||||
-rw-r--r-- | README.md | 11 | ||||
-rwxr-xr-x | fix_mac_app_bundle.sh | 45 | ||||
-rw-r--r-- | hakchi-gui/hakchi-gui.pro | 7 | ||||
-rw-r--r-- | hakchi-gui/src/main.cpp | 9 |
8 files changed, 92 insertions, 4 deletions
@@ -10,3 +10,4 @@ data/ dump/ mod/bin/busybox mod/hakchi/transfer/ +.DS_Store diff --git a/.gitmodules b/.gitmodules index 8bc2372..4b23d9a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,9 @@ [submodule "3rdparty/mkbootimg"] path = 3rdparty/mkbootimg - url = git@github.com:osm0sis/mkbootimg.git + url = https://github.com/osm0sis/mkbootimg [submodule "3rdparty/sunxi-tools"] path = 3rdparty/sunxi-tools - url = git@github.com:linux-sunxi/sunxi-tools.git + url = https://github.com/linux-sunxi/sunxi-tools +[submodule "3rdparty/macdylibbundler"] + path = 3rdparty/macdylibbundler + url = https://github.com/auriamg/macdylibbundler diff --git a/3rdparty/macdylibbundler b/3rdparty/macdylibbundler new file mode 160000 +Subproject 3c79be6efb0867775bd0571011331946f76f36a @@ -1,4 +1,4 @@ -all: bin/sunxi-fel bin/mkbootimg bin/unpackbootimg mod/bin/busybox build/hakchi-gui bin/sntool +all: bin/sunxi-fel bin/mkbootimg bin/unpackbootimg mod/bin/busybox build/macdylibbundler build/hakchi-gui bin/sntool clean: @rm -rf bin/sunxi-fel bin/mkbootimg bin/unpackbootimg bin/sntool @@ -35,9 +35,21 @@ mod/bin/busybox: 3rdparty/busybox.url build/hakchi-gui: build/Makefile hakchi-gui/src/* @make -C build +ifndef SYSTEMROOT +ifeq ($(shell uname), Darwin) + sh fix_mac_app_bundle.sh +endif +endif + +build/macdylibbundler: 3rdparty/macdylibbundler/* +ifndef SYSTEMROOT +ifeq ($(shell uname), Darwin) + @make -C 3rdparty/macdylibbundler/ +endif +endif build/Makefile: hakchi-gui/hakchi-gui.pro @mkdir -p build && (cd build; qmake ../$< CONFIG+=release) bin/sntool: sntool/sntool.cpp - @g++ -I3rdparty/sunxi-tools -std=gnu++11 -Wall -Wextra $< -o $@ + @g++ -I3rdparty/sunxi-tools -std=gnu++11 -Wall -Wextra $< -o $@
\ No newline at end of file @@ -11,6 +11,17 @@ git submodule update ## Install the build dependencies +### Mac OS X 10.12 + +If you don't already have homebrew installed on your Mac: + +``` +/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install +``` + +brew install libusb qt +brew link qt --force + ### Ubuntu 16.04 diff --git a/fix_mac_app_bundle.sh b/fix_mac_app_bundle.sh new file mode 100755 index 0000000..7540801 --- /dev/null +++ b/fix_mac_app_bundle.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +BINARY=build/hakchi-gui.app +DYLIBBUNDLER=3rdparty/macdylibbundler/dylibbundler + +$DYLIBBUNDLER -x $BINARY/Contents/MacOS/hakchi-gui -b -cd -d $BINARY/Contents/libs + +macdeployqt $BINARY + +cp -rf bin $BINARY/Contents/MacOS/bin +cp -rf udev $BINARY/Contents/MacOS/udev +cp -rf mod $BINARY/Contents/MacOS/mod +cp -rf 3rdparty $BINARY/Contents/MacOS/3rdparty + +curl -o icon.png http://www.iconeasy.com/icon/png/Game/Nes/Nes%20Console.png + +replace_icon(){ + droplet=$1 + icon=$2 + if [[ $icon =~ ^https?:// ]]; then + curl -sLo /tmp/icon $icon + icon=/tmp/icon + fi + rm -rf $droplet$'/Icon\r' + sips -i $icon >/dev/null + DeRez -only icns $icon > /tmp/icns.rsrc + Rez -append /tmp/icns.rsrc -o $droplet$'/Icon\r' + SetFile -a C $droplet + SetFile -a V $droplet$'/Icon\r' +} + +replace_icon $BINARY icon.png + +# clean up. +rm icon.png +rm /tmp/icns.rsrc + +plutil -replace CFBundleGetInfoString -string "© madmonkey1907" $BINARY/Contents/Info.plist + +chmod +x $BINARY/Contents/MacOS/hakchi-gui +chmod +x $BINARY/Contents/MacOS/bin/* + +mv $BINARY "build/Hakchi GUI.app" + +exit 0
\ No newline at end of file diff --git a/hakchi-gui/hakchi-gui.pro b/hakchi-gui/hakchi-gui.pro index 173e5d2..029a1b8 100644 --- a/hakchi-gui/hakchi-gui.pro +++ b/hakchi-gui/hakchi-gui.pro @@ -9,6 +9,13 @@ LIBS += $$system(pkg-config --libs \"libusb-1.0 >= 1.0.0\" --static) QMAKE_CFLAGS += $$system(pkg-config --cflags \"libusb-1.0 >= 1.0.0\") -std=gnu99 -DNDEBUG -Wall -Wextra QMAKE_CXXFLAGS += $$system(pkg-config --cflags \"libusb-1.0 >= 1.0.0\") -Wall -Wextra +macx { + CONFIG += plugin + QMAKE_LFLAGS_PLUGIN -= -dynamiclib + QMAKE_LFLAGS_PLUGIN += -bundle + MAKE_EXTENSION_SHLIB = bundle +} + SOURCES += $${PWD}/../3rdparty/sunxi-tools/fel_lib.c SOURCES += $${PWD}/../3rdparty/sunxi-tools/soc_info.c SOURCES += $${PWD}/../3rdparty/sunxi-tools/progress.c diff --git a/hakchi-gui/src/main.cpp b/hakchi-gui/src/main.cpp index 947ab6e..2404f03 100644 --- a/hakchi-gui/src/main.cpp +++ b/hakchi-gui/src/main.cpp @@ -8,6 +8,10 @@ #include <windows.h> #include <tchar.h> #endif +#ifdef __APPLE__ +#include <CoreFoundation/CoreFoundation.h> +#include <QURL> +#endif static QFileInfo appFileInfo_init() { @@ -21,6 +25,11 @@ static QFileInfo appFileInfo_init() const QString mfn(QString::fromLocal8Bit(buffer)); #endif QFileInfo pfi(mfn); +#elif __APPLE__ + CFURLRef url = (CFURLRef)CFAutorelease((CFURLRef)CFBundleCopyBundleURL(CFBundleGetMainBundle())); + QString mfn = (QUrl::fromCFURL(url).path()); + mfn += "Contents/MacOS/"; + QFileInfo pfi(mfn); #else QFileInfo pfi(QFileInfo(QString::fromLatin1("/proc/%1/exe").arg(getpid())).canonicalFilePath()); #endif |