Skip to content

Commit

Permalink
ipe: fix the build
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 committed Sep 22, 2024
1 parent 303bf80 commit d0305d8
Show file tree
Hide file tree
Showing 3 changed files with 208 additions and 16 deletions.
82 changes: 66 additions & 16 deletions graphics/ipe/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand All @@ -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
Expand All @@ -47,36 +75,58 @@ 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]
build.args-append IPEPREFIX=${prefix} \
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
Expand Down
131 changes: 131 additions & 0 deletions graphics/ipe/files/patch-gtk-build.diff
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions graphics/ipe/files/patch-ipeplatform.cpp.diff
Original file line number Diff line number Diff line change
@@ -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 += "\" ";

0 comments on commit d0305d8

Please sign in to comment.