diff --git a/graphics/ipe/Portfile b/graphics/ipe/Portfile index e7e8d51fdff23..d060b7d9bb9de 100644 --- a/graphics/ipe/Portfile +++ b/graphics/ipe/Portfile @@ -5,7 +5,7 @@ PortGroup github 1.0 github.setup otfried ipe 7.2.29 v -revision 0 +revision 1 categories graphics maintainers {gmail.com:jjstickel @jjstickel} \ openmaintainer @@ -26,7 +26,7 @@ checksums rmd160 3aab1c281c938f10c80d29d23c46df963c645b8c \ sha256 2d7e87ad8a2a84c33bca16dd2cc6c91b4aa931500a6ad0b7970bc7d2d7955e1a \ size 932128 -depends_build-append port:pkgconfig +depends_build-append path:bin/pkg-config:pkgconfig depends_lib-append port:freetype \ port:gsl \ @@ -36,9 +36,37 @@ depends_lib-append port:freetype \ port:libspiro \ port:zlib +# cc1plus: error: unrecognized command line option "-std=c++20" +compiler.cxx_standard 2020 + use_configure no universal_variant no +# https://github.com/otfried/ipe/issues/522 +patchfiles-append patch-ipeplatform.cpp.diff + +# Default variant for clang-using macOS: +variant cocoa conflicts gtk description {Use native GUI} { } + +# Variant for non-Apple systems and older macOS using gcc. +# FIXME: https://github.com/otfried/ipe/issues/523 +variant gtk conflicts cocoa description {Use GTK GUI} { + # ipebitmap_unix.cpp: fatal error: CoreGraphics/CoreGraphics.h: No such file or directory + # https://trac.macports.org/ticket/59917 + # Also removes clangisms and fixes deployment target. + patchfiles-append patch-gtk-build.diff + + depends_lib-append path:lib/pkgconfig/cairo.pc:cairo \ + path:lib/pkgconfig/glib-2.0.pc:glib2 \ + path:lib/pkgconfig/gtk+-2.0.pc:gtk2 \ + path:lib/pkgconfig/harfbuzz.pc:harfbuzz \ + path:lib/pkgconfig/pango.pc:pango + + post-patch { + reinplace "s|@TARGET@|${macosx_deployment_target}|" ${worksrcpath}/common.mak + } +} + variant qvoronoi description {Add qvoronoi ipelet} { depends_lib-append port:qhull build.args-append IPEQVORONOI=1 QHULL_CFLAGS=-I${prefix}/include/libqhull_r @@ -47,6 +75,15 @@ variant qvoronoi description {Add qvoronoi ipelet} { default_variants +qvoronoi +if {${os.platform} eq "darwin" && [string match *clang* ${configure.compiler}] \ + && ![variant_isset gtk]} { + default_variants-append \ + +cocoa +} else { + default_variants-append \ + +gtk +} + pre-build { build.env CXXFLAGS=[get_canonical_archflags cxx] \ LDFLAGS=[get_canonical_archflags ld] @@ -54,29 +91,42 @@ pre-build { CXX=${configure.cxx} \ LUA_PACKAGE="lua" \ JPEG_LIBS="-framework ApplicationServices" \ - IPECONFIGMAK="config.mak" \ + IPECONFIGMAK="config.mak" + + # Bundle cannot be build with GTK here: + # main_gtk.cpp:53:24: error: expected ')' before 'IPELUADIR' + # main_gtk.cpp:62:45: error: 'IPESTYLEDIR' was not declared in this scope; did you mean 'IPESTYLE_H'? + if {[variant_isset cocoa]} { + build.args-append \ IPEBUNDLE=1 + } } use_parallel_build no destroot.args-append IPEPREFIX=${prefix} \ - IPECONFIGMAK="config.mak" \ - IPEBUNDLE=1 - -destroot.target app -use_xcode yes + IPECONFIGMAK="config.mak" +if {[variant_isset cocoa]} { + destroot.args-append \ + IPEBUNDLE=1 -platform macosx { - post-destroot { - copy ${worksrcpath}/../build/Ipe.app ${destroot}${applications_dir}/Ipe.app - reinplace "s|/usr/local/bin|/usr/local/bin:${prefix}/bin|g" ${destroot}${applications_dir}/Ipe.app/Contents/Info.plist - xinstall -m 755 ${filespath}/ipe.in ${destroot}${prefix}/bin/ipe - reinplace "s|@APPLICATIONSDIR@|${applications_dir}|g" ${destroot}${prefix}/bin/ipe - xinstall -m 755 ${filespath}/ipetoipe.in ${destroot}${prefix}/bin/ipetoipe - reinplace "s|@APPLICATIONSDIR@|${applications_dir}|g" ${destroot}${prefix}/bin/ipetoipe + destroot.target app + use_xcode yes + + platform macosx { + post-destroot { + copy ${worksrcpath}/../build/Ipe.app ${destroot}${applications_dir}/Ipe.app + reinplace "s|/usr/local/bin|/usr/local/bin:${prefix}/bin|g" ${destroot}${applications_dir}/Ipe.app/Contents/Info.plist + xinstall -m 755 ${filespath}/ipe.in ${destroot}${prefix}/bin/ipe + reinplace "s|@APPLICATIONSDIR@|${applications_dir}|g" ${destroot}${prefix}/bin/ipe + xinstall -m 755 ${filespath}/ipetoipe.in ${destroot}${prefix}/bin/ipetoipe + reinplace "s|@APPLICATIONSDIR@|${applications_dir}|g" ${destroot}${prefix}/bin/ipetoipe + } } +} else { + destroot.args-append \ + INSTALL_ROOT=${destroot} } livecheck.type regex diff --git a/graphics/ipe/files/patch-gtk-build.diff b/graphics/ipe/files/patch-gtk-build.diff new file mode 100644 index 0000000000000..60ceb606b3110 --- /dev/null +++ b/graphics/ipe/files/patch-gtk-build.diff @@ -0,0 +1,131 @@ +--- common.mak 2024-05-25 ++++ common.mak 2024-09-22 04:06:22.000000000 +0800 +@@ -17,10 +17,10 @@ + UNAME = $(shell uname) + ifeq "$(UNAME)" "Darwin" + MACOS = 1 +- IPEUI = COCOA ++ IPEUI = GTK + IPECONFIGMAK ?= macos.mak + else +- IPEUI ?= QT ++ IPEUI ?= GTK + IPECONFIGMAK ?= config.mak + endif + endif +@@ -176,9 +176,9 @@ + ifdef MACOS + # -------------------- Mac OS X -------------------- + CXXFLAGS += -g -Os +- IPEOBJCPP = -x objective-c++ -fobjc-arc +- OSXTARGET ?= -mmacosx-version-min=10.10 +- CXXFLAGS += $(OSXTARGET) -Wdeprecated-declarations ++ IPEOBJCPP = -x objective-c++ ++ OSXTARGET ?= -mmacosx-version-min=@TARGET@ ++ CXXFLAGS += $(OSXTARGET) -D_GLIBCXX_USE_CXX11_ABI=0 -Wdeprecated-declarations -F/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks + CFLAGS += $(OSXTARGET) + LDFLAGS += $(OSXTARGET) + DLL_LDFLAGS += -dynamiclib +@@ -186,7 +186,7 @@ + DL_LIBS ?= -ldl + ZLIB_CFLAGS ?= + ZLIB_LIBS ?= -lz +- JPEG_CFLAGS := ++ JPEG_CFLAGS := -F/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks + JPEG_LIBS := -framework ApplicationServices + CURL_CFLAGS := $(IPEOBJCPP) + CURL_LIBS := -framework Foundation + +--- macos.mak 2024-05-25 ++++ macos.mak 2024-09-22 04:08:06.000000000 +0800 +@@ -31,6 +31,6 @@ + # + IPEVERS = 7.2.29 + # +-CXX = clang++ ++CXX ?= $(CXX) + # + # -------------------------------------------------------------------- + +--- config.mak ++++ config.mak 2024-09-22 05:34:27.000000000 +0800 +@@ -46,28 +46,28 @@ + # Until Qt 6.3.1, the pkg-config files are missing + # here is an ugly hack using the Qt5 pkg-config instead + # +-QT6PKGCONFIG := $(shell $(PKG_CONFIG) --exists Qt6Gui && echo "YES") +-ifndef QT_CFLAGS +-ifeq "$(QT6PKGCONFIG)" "YES" +-QT_CFLAGS ?= $(shell $(PKG_CONFIG) --cflags Qt6Gui Qt6Widgets Qt6Core) +-else +-QT_CFLAGS1 := $(shell $(PKG_CONFIG) --cflags Qt5Gui Qt5Widgets Qt5Core) +-QT_CFLAGS ?= $(subst qt5,qt6,$(QT_CFLAGS1)) +-endif +-endif +-ifndef QT_LIBS +-ifeq "$(QT6PKGCONFIG)" "YES" +-QT_LIBS ?= $(shell $(PKG_CONFIG) --libs Qt6Gui Qt6Widgets Qt6Core) +-else +-QT_LIBS1 := $(shell $(PKG_CONFIG) --libs Qt5Gui Qt5Widgets Qt5Core) +-QT_LIBS ?= $(subst Qt5,Qt6,$(QT_LIBS1)) +-endif +-endif +-# +-ifdef IPE_SPELLCHECK +-SPELL_CFLAGS ?= $(shell $(PKG_CONFIG) --cflags QtSpell-qt6) +-SPELL_LIBS ?= $(shell $(PKG_CONFIG) --libs QtSpell-qt6) +-endif ++#QT6PKGCONFIG := $(shell $(PKG_CONFIG) --exists Qt6Gui && echo "YES") ++#ifndef QT_CFLAGS ++#ifeq "$(QT6PKGCONFIG)" "YES" ++#QT_CFLAGS ?= $(shell $(PKG_CONFIG) --cflags Qt6Gui Qt6Widgets Qt6Core) ++#else ++#QT_CFLAGS1 := $(shell $(PKG_CONFIG) --cflags Qt5Gui Qt5Widgets Qt5Core) ++#QT_CFLAGS ?= $(subst qt5,qt6,$(QT_CFLAGS1)) ++#endif ++#endif ++#ifndef QT_LIBS ++#ifeq "$(QT6PKGCONFIG)" "YES" ++#QT_LIBS ?= $(shell $(PKG_CONFIG) --libs Qt6Gui Qt6Widgets Qt6Core) ++#else ++#QT_LIBS1 := $(shell $(PKG_CONFIG) --libs Qt5Gui Qt5Widgets Qt5Core) ++#QT_LIBS ?= $(subst Qt5,Qt6,$(QT_LIBS1)) ++#endif ++#endif ++# ++#ifdef IPE_SPELLCHECK ++#SPELL_CFLAGS ?= $(shell $(PKG_CONFIG) --cflags QtSpell-qt6) ++#SPELL_LIBS ?= $(shell $(PKG_CONFIG) --libs QtSpell-qt6) ++#endif + # + # Library needed to use dlopen/dlsym/dlclose calls + # +@@ -75,14 +75,14 @@ + # + # MOC is the Qt meta-object compiler. + # Make sure it's the right one for Qt6. +-MOC ?= /usr/lib/qt6/libexec/moc ++#MOC ?= /usr/lib/qt6/libexec/moc + # + # -------------------------------------------------------------------- + # + # The C++ compiler + # I'm testing with g++ and clang++. + # +-CXX = g++ ++CXX ?= $(CXX) + # + # Special compilation flags for compiling shared libraries + # 64-bit Linux requires shared libraries to be compiled as + +--- ipecurl/Makefile ++++ ipecurl/Makefile 2024-09-22 07:38:35.000000000 +0800 +@@ -16,7 +16,7 @@ + cocoa_sources = ipecurl_osx.cpp + + ifndef WIN32 +-ifndef MACOS ++ifdef MACOS + IPECURL_SH=1 + endif + endif diff --git a/graphics/ipe/files/patch-ipeplatform.cpp.diff b/graphics/ipe/files/patch-ipeplatform.cpp.diff new file mode 100644 index 0000000000000..0ab4732c238b3 --- /dev/null +++ b/graphics/ipe/files/patch-ipeplatform.cpp.diff @@ -0,0 +1,11 @@ +--- ipelib/ipeplatform.cpp 2024-05-25 19:02:08.000000000 +0800 ++++ ipelib/ipeplatform.cpp 2024-09-22 05:17:17.000000000 +0800 +@@ -596,7 +596,7 @@ + s += ":$TEXINPUTS\"; "; + } + if (online) { +-#ifdef __APPLE__ ++#if defined(__APPLE__) && defined(IPEBUNDLE) + s += "\""; + s += ipeDir("../MacOS", "ipecurl"); + s += "\" ";