Merge pull request #674 from andreasb242/mac-build

Mac app package
presentation
andreasb242 7 years ago committed by GitHub
commit c7845374aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      mac-setup/build-app.sh
  2. 22
      src/control/XournalMain.cpp
  3. 30
      src/util/Stacktrace.cpp

@ -11,7 +11,11 @@ cd "${0%/*}"
# delete old app, if there
echo "clean old app"
rm -rf ./Xournal++.app
if [[ $1 == u ]]; then
echo "update app!"
else
rm -rf ./Xournal++.app
fi
echo "prepare macdylibbundler"
if [ ! -d "macdylibbundler" ]; then
@ -28,11 +32,18 @@ cd ..
echo "prepare package"
mkdir -p Xournal++.app/Contents/MacOS
mkdir -p Xournal++.app/Contents/Resources
cp ../build/src/xournalpp ./Xournal++.app/Contents/MacOS/xournalpp
./macdylibbundler/dylibbundler -od -b -x ./Xournal++.app/Contents/MacOS/xournalpp -d ./Xournal++.app/Contents/libs/
if [[ $1 == u ]]; then
echo "update app!"
else
./macdylibbundler/dylibbundler -od -b -x ./Xournal++.app/Contents/MacOS/xournalpp -d ./Xournal++.app/Contents/libs/
fi
cp icon/xournalpp.icns ./Xournal++.app/Contents/Resources/xournalpp.icns
cp Info.plist ./Xournal++.app/Contents/Info.plist
cp -rvp ../ui ./Xournal++.app/Contents/Resources/
echo "finished"

@ -52,11 +52,11 @@ void XournalMain::initLocalisation()
bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
textdomain(GETTEXT_PACKAGE);
#ifdef WIN32
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
#endif
#endif //ENABLE_NLS
// Not working on Windows! Working on Linux, but not sure if it's needed
@ -93,7 +93,7 @@ void XournalMain::checkForErrorlog()
}
g_dir_close(home);
if (errorList.empty())
{
return;
@ -265,7 +265,7 @@ int XournalMain::run(int argc, char* argv[])
}
// Checks for input method compatibility
const char* imModule = g_getenv("GTK_IM_MODULE");
if (imModule != NULL && strcmp(imModule, "xim") == 0)
{
@ -437,6 +437,19 @@ void XournalMain::initResourcePath(GladeSearchpath* gladePath)
// -----------------------------------------------------------------------
#ifdef __APPLE__
Path p = Stacktrace::getExePath();
p /= "../Resources/ui/about.glade";
if (p.exists())
{
gladePath->addSearchDirectory(p.getParentPath().str());
return;
}
string msg = FS(_F("Missing the needed UI file! .app corrupted?\nPath: {1}") % p.str());
XojMsgBox::showErrorToUser(NULL, msg);
#else
// Check at the target installation directory
Path absolute = PACKAGE_DATA_DIR;
absolute /= PROJECT_PACKAGE;
@ -450,6 +463,7 @@ void XournalMain::initResourcePath(GladeSearchpath* gladePath)
string msg = FS(_F("Missing the needed UI file, could not find them at any location.\nNot relative\nNot in the Working Path\nNot in {1}") % PACKAGE_DATA_DIR);
XojMsgBox::showErrorToUser(NULL, msg);
#endif
exit(12);
}

@ -8,6 +8,13 @@
#include <limits.h>
#endif
#ifdef __APPLE__
#include <mach-o/dyld.h>
#endif
#include <Path.h>
#include <iostream>
using std::endl;
@ -36,12 +43,35 @@ void Stacktrace::printStracktrace(std::ostream& stream)
}
#else
#ifdef __APPLE__
std::string Stacktrace::getExePath()
{
char c;
uint32_t size = 0;
_NSGetExecutablePath(&c, &size);
char* path = new char[size + 1];
if (_NSGetExecutablePath(path, &size) == 0)
{
Path p(path);
delete[] path;
return p.getParentPath().str();
}
g_error("Could not executable path!");
delete[] path;
return "";
}
#else
std::string Stacktrace::getExePath()
{
char result[PATH_MAX];
ssize_t count = readlink("/proc/self/exe", result, PATH_MAX);
return std::string(result, (count > 0) ? count : 0);
}
#endif
void Stacktrace::printStracktrace(std::ostream& stream)
{

Loading…
Cancel
Save