This is all the changes I need in order to get a working
macOS dmg package.

See attachment or https://github.com/oldk1331/fricas/commit/71c511531475a1c754b555362bc14a4299ccba0c.patch

Binary at https://github.com/oldk1331/fricas/actions/runs/667643819

Comments are welcome.

- Qian

On 3/18/21 7:49 PM, Qian Yun wrote:
This is the change I made to get the macOS dmg working.
Not very elegant, but I wonder if there is a better way?

Comments are welcome.  And macOS users can try/test the binary
at https://github.com/oldk1331/fricas/actions/runs/664218153

- Qian

https://github.com/fricas/fricas/commit/ed1f43ad1a7be891a6bbb050b055e2ff7f9f3ab8.patch

diff --git a/Makefile.in b/Makefile.in
index f50f0bde3..17af45595 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -133,9 +133,11 @@
      echo exec_prefix='"$${FRICAS_PREFIX:-$(exec_prefix)}"' \
                 >> '${COMMAND}'.tmp
      if test "$(fricas_lib)" != "$(libdir)" ;  then \
-       echo \
- FRICAS='"$${exec_prefix}/$(fricas_lib)/fricas/target/$(target)"' \
-           >> '${COMMAND}'.tmp ; \
+     if test $(uname -s) != "Darwin" ; then \
+          echo FRICAS='"$${exec_prefix}/$(fricas_lib)/fricas/target/$(target)"' >> '${COMMAND}'.tmp ; \
+     else \
+          echo FRICAS='"`dirname $$0`/../$(fricas_lib)/fricas/target/$(target)"' >> '${COMMAND}'.tmp ; \
+     fi \
      else \
         echo FRICAS='"$(libdir)/fricas/target/$(target)"' \
                 >> '${COMMAND}'.tmp ; \
diff --git a/contrib/macos/FriCAS.c b/contrib/macos/FriCAS.c
index bf7f1470f..35c83deac 100644
--- a/contrib/macos/FriCAS.c
+++ b/contrib/macos/FriCAS.c
@@ -25,7 +25,7 @@

    setenv("FRICAS_PREFIX", CFStringGetCStringPtr(path, encoding), 1);

-  system("/usr/X11/bin/xterm"
-         " -e \"${FRICAS_PREFIX}/bin/fricas\"");
+  system("open -a Terminal.app"
+         " \"${FRICAS_PREFIX}/usr/local/bin/fricas\"");
    return 0;
  }

--
You received this message because you are subscribed to the Google Groups "FriCAS - 
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/a4e9c9bf-acc1-3d4f-370d-0eff1297f12f%40gmail.com.
>From 71c511531475a1c754b555362bc14a4299ccba0c Mon Sep 17 00:00:00 2001
From: Qian Yun <[email protected]>
Date: Thu, 18 Mar 2021 18:30:06 +0800
Subject: [PATCH] Try to make macOS dmg package

---
 .github/workflows/macOS.yml |  8 +++++---
 Makefile.in                 | 18 +++++++++++++++---
 contrib/macos/FriCAS.c      |  4 ++--
 3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml
index 5fc6fdc15..08964ff64 100644
--- a/.github/workflows/macOS.yml
+++ b/.github/workflows/macOS.yml
@@ -21,9 +21,11 @@ jobs:
     - name: make check
       run: cd ../build && make check -j3
     - name: Create artifact archives
-      run: cd ../build && tar -cjf ../fricas/fricas-macOS-x86_64-binary-${{ github.sha }}.tbz2 target/
+      run: |
+        cd ../build && make dist-osx-dmg
+        mv FriCAS.dmg ../fricas/FriCAS-macOS-x86_64-${{ github.sha }}.dmg
     - name: Upload macOS binary
       uses: actions/upload-artifact@v2
       with:
-        name: fricas-macOS-x86_64-binary
-        path: fricas-macOS-x86_64-binary-${{ github.sha }}.tbz2
+        name: FriCAS-macOS-x86_64-binary
+        path: FriCAS-macOS-x86_64-${{ github.sha }}.dmg
diff --git a/Makefile.in b/Makefile.in
index f50f0bde3..34ab6d0dd 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -133,9 +133,11 @@ install-src:
 	echo exec_prefix='"$${FRICAS_PREFIX:-$(exec_prefix)}"' \
                >> '${COMMAND}'.tmp
 	if test "$(fricas_lib)" != "$(libdir)" ;  then \
-	   echo \
-	      FRICAS='"$${exec_prefix}/$(fricas_lib)/fricas/target/$(target)"' \
-	       >> '${COMMAND}'.tmp ; \
+     if test $(uname -s) != "Darwin" ; then \
+	      echo FRICAS='"$${exec_prefix}/$(fricas_lib)/fricas/target/$(target)"' >> '${COMMAND}'.tmp ; \
+     else \
+	      echo FRICAS='"`dirname $$0`/../$(fricas_lib)/fricas/target/$(target)"' >> '${COMMAND}'.tmp ; \
+     fi \
 	else \
 	   echo FRICAS='"$(libdir)/fricas/target/$(target)"' \
                >> '${COMMAND}'.tmp ; \
@@ -247,5 +249,15 @@ ${DIST_TARBALL}: out-of-source-check lastBuildDate dist-help dist-lisp dist-doc
 
 dist: ${DIST_TARBALL}
 
+dist-osx-dmg: out-of-source-check
+	-rm -rf FriCAS.app
+	${MKDIR_P} FriCAS.app/Contents/{MacOS,Resources}
+	${MAKE} DESTDIR=./FriCAS.app/Contents/Resources install-src
+	cp $(fricas_top_srcdir)/contrib/macos/Info.plist ./FriCAS.app/Contents/
+	cp $(fricas_top_srcdir)/contrib/macos/appIcon.icns ./FriCAS.app/Contents/Resources/
+	cc -framework CoreFoundation $(fricas_top_srcdir)/contrib/macos/FriCAS.c -o ./FriCAS.app/Contents/MacOS/FriCAS
+	-rm -f FriCAS.dmg
+	hdiutil create -srcfolder FriCAS.app FriCAS.dmg
+
 clean-distdir:
 	-rm -rf ${distdir} ${DIST_TARBALL}
diff --git a/contrib/macos/FriCAS.c b/contrib/macos/FriCAS.c
index bf7f1470f..35c83deac 100644
--- a/contrib/macos/FriCAS.c
+++ b/contrib/macos/FriCAS.c
@@ -25,7 +25,7 @@ int main(int argc, const char *argv[]) {
 
   setenv("FRICAS_PREFIX", CFStringGetCStringPtr(path, encoding), 1);
 
-  system("/usr/X11/bin/xterm"
-         " -e \"${FRICAS_PREFIX}/bin/fricas\"");
+  system("open -a Terminal.app"
+         " \"${FRICAS_PREFIX}/usr/local/bin/fricas\"");
   return 0;
 }

Reply via email to