MacOS: Adapt Readme and initialization for bundle
authorFriedrich Beckmann <friedrich.beckmann@gmx.de>
Fri, 30 May 2025 11:51:29 +0000 (13:51 +0200)
committerFriedrich Beckmann <friedrich.beckmann@gmx.de>
Fri, 30 May 2025 11:51:29 +0000 (13:51 +0200)
I changed the way the bundle is build to allow codesigning.
The binary is moved to Content/MacOS and therefore the location
of the resources like icons is changed with respect to the
binary location.

README.Git
src/ui/gui/pre-initialisation.h

index dc56bebbfe47b2856b7b5bc45f01cde159a05a64..020bd453663d5b80633fa9a4f501bf2f368b64d4 100644 (file)
@@ -83,15 +83,17 @@ or for a more thorough test:
 Building from git on Mac OS
 ---------------------------
 
-You can build on MacOS in the brew environment. After installing all
-required packages to resolve library dependencies and autotools e.t.c, you
-run make -f Smake as described above.
+You can build on MacOS in the brew environment. Install all
+required packages to resolve library dependencies and autotools.
+In brew the gettext automake macros are not found by default. Run
+
+ACLOCAL_PATH=`brew --prefix`/Cellar/gettext/0.25/share/gettext/m4 make -f Smake
 
 The brew system provides the libraries and header files in a separate
 location from the MacOS system libraries. The typical locations are
 
-Libraries: /usr/local/lib
-Headers:   /usr/local/include
+Libraries: `brew --prefix`/lib
+Headers:   `brew --prefix`/include
 
 pspp under brew will be linked against the brew libraries. The configure
 script has to be informed about the library and header locations. Assume the following
@@ -103,14 +105,18 @@ directory structure for an out of tree build:
   |----build   (The build directory)
   |----gnulib  (The gnulib directory as described above)
 
+The configure command finds by default the MacOS libiconv library. That library
+is not fully compatible to the gnu libiconv. So add the brew libiconv to the linker
+and compiler flags such that the brew libiconv is found.
 Then you can build with the following commands:
 
     cd ~/mypspp/pspp
     make -f Smake
     cd ../build
     ../pspp/configure --prefix=/Users/USER/mypspp/install \
-      LDFLAGS=-L/usr/local/lib \
-      CPPFLAGS=-I/usr/local/include \
+      --without-perl-module \
+      LDFLAGS='-L/opt/homebrew/lib -L/opt/homebrew/Cellar/libiconv/1.18/lib'\
+      CPPFLAGS='-I/opt/homebrew/include -I/opt/homebrew/Cellar/libiconv/1.18/include'\
       CFLAGS='-g -O0'
     make
     make install
index de5014147fe2d9f7d38f79e75cbbb90a9ee9dbce..3f0cfc8daf237143473f2613d67e5beb79367a00 100644 (file)
@@ -27,6 +27,7 @@ pre_initialisation (int *argc, char **argv)
 
 #include <sys/stat.h>
 #include <glib.h>
+#include "gl/relocatable.h"
 
 static inline void
 pre_initialisation (int *argc, char **argv)
@@ -67,7 +68,7 @@ pre_initialisation (int *argc, char **argv)
       struct stat sb;
 
       app_dir = g_path_get_dirname (resolved_path);
-      g_snprintf (tmp, sizeof(tmp), "%s/../../Resources", app_dir);
+      g_snprintf (tmp, sizeof(tmp), "%s/../Resources", app_dir);
       if (realpath (tmp, res_dir) && !stat (res_dir,&sb) && S_ISDIR (sb.st_mode))
         g_print ("pspp is started as MacOS application\n");
       else
@@ -93,10 +94,12 @@ pre_initialisation (int *argc, char **argv)
       g_snprintf (tmp, sizeof(tmp), "%s/share", res_dir);
       g_setenv ("XDG_DATA_DIRS", tmp, TRUE);
 
+      set_relocation_prefix(INSTALLPREFIX,res_dir);
+
       if (g_getenv ("HOME")!=NULL)
         {
           g_snprintf (tmp, sizeof(tmp),
-                      "%s/Library/Application Support/pspp/1.3/cache",
+                      "%s/Library/Application Support/pspp/cache",
                       g_getenv("HOME"));
           g_setenv ("XDG_CACHE_HOME", tmp, TRUE);
         }