From 4a514f951a8d7808e0702a24dcf24d5aaa2c89f5 Mon Sep 17 00:00:00 2001 From: Teus Benschop Date: Tue, 17 Oct 2023 17:45:54 +0200 Subject: [PATCH] Build macOS app for two architectures https://github.com/bibledit/cloud/issues/907 --- Makefile.am | 9 +++++++++ Makefile.in | 8 ++++++-- configure | 14 ++++++++++++++ configure.ac | 1 + pkgdata/files.txt | 3 --- 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index f1602d415..661489e38 100644 --- a/Makefile.am +++ b/Makefile.am @@ -642,6 +642,15 @@ AM_CXXFLAGS += $(GUMBO_CFLAGS) AM_CXXFLAGS += $(PUGIXML_CFLAGS) AM_CXXFLAGS += $(GTEST_CFLAGS) +if MACFLAGS +# Building Bibledit for macOS for two architectures +# due to the switch from macOS from the x86_64 to the arm64 architecture. +# Additionally it uses the includes and libraries from the macOS SDK. +# Generate the macOS SDK path: $ xcrun --show-sdk-path +AM_CXXFLAGS += -mmacosx-version-min=10.10 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -arch x86_64 -arch arm64 +AM_CFLAGS += -mmacosx-version-min=10.10 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -arch x86_64 -arch arm64 +endif + LIBS = -Wall -lpthread -L. -g -rdynamic -ldl LIBS += $(CURL_LIBS) LIBS += $(OPENSSL_LIBS) diff --git a/Makefile.in b/Makefile.in index 9442e4c65..85542016b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -92,6 +92,10 @@ bin_PROGRAMS = server$(EXEEXT) unittest$(EXEEXT) generate$(EXEEXT) @COMPILERWARNINGS_TRUE@am__append_1 = -Wall -Wno-unknown-pragmas -Wextra -pedantic -Wno-pragmas @COMPILERWARNINGS_TRUE@am__append_2 = -Wall -Wno-unknown-pragmas -Wextra -pedantic -Wshadow -Warray-bounds -Wcast-align -Wcast-qual -Wconversion -Wctor-dtor-privacy -Wdelete-non-virtual-dtor -Weffc++ -Wextra-semi -Wfloat-equal -Wformat=2 -Wmissing-include-dirs -Wmissing-noreturn -Wnull-dereference -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wsign-promo -Wsuggest-override -Wswitch-default -Wswitch-enum -Wundef -Wuninitialized -Wunused-but-set-parameter -Wunused-macros -Wunused-parameter -Wvla -Wzero-as-null-pointer-constant -Wmismatched-tags @COMPILERGCC_TRUE@@COMPILERWARNINGS_TRUE@am__append_3 = -Wcatch-value=2 -Wconditionally-supported -Wduplicated-branches -Wduplicated-cond -Wformat-overflow=2 -Wlogical-op -Wnoexcept -Wno-non-template-friend -Wrestrict -Wstrict-null-sentinel -Wuseless-cast -Wcomma-subscript -Wredundant-tags -Wvolatile + +# Generate the macOS SDK path: $ xcrun --show-sdk-path +@MACFLAGS_TRUE@am__append_4 = -mmacosx-version-min=10.10 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -arch x86_64 -arch arm64 +@MACFLAGS_TRUE@am__append_5 = -mmacosx-version-min=10.10 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -arch x86_64 -arch arm64 subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac @@ -1648,13 +1652,13 @@ generate_SOURCES = \ sources/styles.cpp generate_LDADD = libbibledit.a -AM_CFLAGS = -g $(OPENSSL_CFLAGS) $(am__append_1) +AM_CFLAGS = -g $(OPENSSL_CFLAGS) $(am__append_1) $(am__append_5) # AM_CXXFLAGS += $(TIDY_CFLAGS) -I/usr/include/tidy AM_CXXFLAGS = -fno-var-tracking -g $(am__append_2) $(am__append_3) \ $(CURL_CFLAGS) $(OPENSSL_CFLAGS) $(GTK_CFLAGS) \ $(WEBKIT2GTK_CFLAGS) $(ICU_CFLAGS) $(XML2_CFLAGS) \ $(UTF8PROC_CFLAGS) $(GUMBO_CFLAGS) $(PUGIXML_CFLAGS) \ - $(GTEST_CFLAGS) + $(GTEST_CFLAGS) $(am__append_4) # The core library compiles and embeds the mbedtls library. # On Debian this gives a lintian error: diff --git a/configure b/configure index a12300cd8..fb9dc9b68 100755 --- a/configure +++ b/configure @@ -653,6 +653,8 @@ LTLIBOBJS LIBOBJS COMPILERWARNINGS_FALSE COMPILERWARNINGS_TRUE +MACFLAGS_FALSE +MACFLAGS_TRUE COMPILERCLANG_FALSE COMPILERCLANG_TRUE COMPILERGCC_FALSE @@ -7654,6 +7656,14 @@ printf "%s\n" "#define HAVE_MAC 1" >>confdefs.h ENABLEMAC=yes +fi + + if test $ENABLEMAC = yes; then + MACFLAGS_TRUE= + MACFLAGS_FALSE='#' +else + MACFLAGS_TRUE='#' + MACFLAGS_FALSE= fi @@ -7856,6 +7866,10 @@ if test -z "${COMPILERCLANG_TRUE}" && test -z "${COMPILERCLANG_FALSE}"; then as_fn_error $? "conditional \"COMPILERCLANG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${MACFLAGS_TRUE}" && test -z "${MACFLAGS_FALSE}"; then + as_fn_error $? "conditional \"MACFLAGS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${COMPILERWARNINGS_TRUE}" && test -z "${COMPILERWARNINGS_FALSE}"; then as_fn_error $? "conditional \"COMPILERWARNINGS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/configure.ac b/configure.ac index 2495304f8..44defbec9 100644 --- a/configure.ac +++ b/configure.ac @@ -199,6 +199,7 @@ AC_DEFINE([HAVE_MAC], [1], [Define whether to compile for Mac]) ENABLEMAC=yes ] ) +AM_CONDITIONAL([MACFLAGS],[test $ENABLEMAC = yes]) # Linux. ENABLELINUX=no diff --git a/pkgdata/files.txt b/pkgdata/files.txt index 76c4c6dea..d7442458d 100644 --- a/pkgdata/files.txt +++ b/pkgdata/files.txt @@ -368,7 +368,6 @@ /fonts/Montserrat-SemiBold.ttf /fonts/SILEOT.ttf /fonts/SIL-Licenses.txt -/generate /git /git/gitflag /help @@ -714,7 +713,6 @@ /sendreceive /sendreceive/index.html /sendreceive/index.js -/server /session /session/login.html /session/login.js @@ -953,7 +951,6 @@ /tmp/holder /trash /trash/holder -/unittest /unittests /unittests/scripts /unittests/scripts/editor1.py