Skip to content

Commit

Permalink
tk dependents: default to +quartz when tk does
Browse files Browse the repository at this point in the history
  • Loading branch information
jmroot committed Jan 11, 2025
1 parent 7f0a4ef commit 183a1ad
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 93 deletions.
25 changes: 16 additions & 9 deletions graphics/tkimg/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,28 @@ configure.args-append --with-tcl=${prefix}/lib

destroot.destdir INSTALL_ROOT=${destroot}

variant quartz conflicts x11 {
depends_lib-append port:tk-quartz
configure.args-append --with-tk=${prefix}/lib/tk-quartz \
--with-tkinclude=${prefix}/include/tk-quartz
if {${os.platform} eq "darwin" && ${os.subplatform} eq "macosx"
&& ${os.major} >= 10 && ![string match ppc* ${build_arch}]} {

variant quartz conflicts x11 {
depends_lib-append port:tk-quartz
configure.args-append --with-tk=${prefix}/lib/tk-quartz \
--with-tkinclude=${prefix}/include/tk-quartz
}
if {![variant_isset x11]} {
default_variants +quartz
}
set x11conflicts quartz
} else {
default_variants +x11
set x11conflicts {}
}

variant x11 conflicts quartz {
variant x11 conflicts {*}${x11conflicts} {
depends_lib-append port:tk-x11
configure.args-append --with-tk=${prefix}/lib/tk-x11 \
--with-tkinclude=${prefix}/include/tk-x11
}

if {![variant_isset x11] && ![variant_isset quartz]} {
default_variants +x11
}

livecheck.url https://wiki.tcl-lang.org/page/Img
livecheck.regex {>(\d+\.\d+\.\d+)<}
49 changes: 28 additions & 21 deletions math/netgen/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -131,25 +131,36 @@ foreach pdv ${pythonversions} {
}
}

variant quartz conflicts x11 {
depends_lib-append port:tk-quartz
require_active_variants tkdnd quartz
require_active_variants Togl quartz

# OpenGL/gl3.h does not exist prior to 10.7.
# https://github.com/NGSolve/netgen/issues/173
patchfiles-append patch-opengl.diff
post-patch {
reinplace "s|MACPORTS_NO_X11|TRUE|g" \
${worksrcpath}/CMakeLists.txt
if {${os.platform} eq "darwin" && ${os.subplatform} eq "macosx"
&& ${os.major} >= 10 && ![string match ppc* ${build_arch}]} {

variant quartz conflicts x11 {
depends_lib-append port:tk-quartz
require_active_variants tkdnd quartz
require_active_variants Togl quartz

# OpenGL/gl3.h does not exist prior to 10.7.
# https://github.com/NGSolve/netgen/issues/173
patchfiles-append patch-opengl.diff
post-patch {
reinplace "s|MACPORTS_NO_X11|TRUE|g" \
${worksrcpath}/CMakeLists.txt
}
configure.args-append -DTK_INCLUDE_PATH:PATH=${prefix}/include/tk-quartz \
-DTK_WISH:PATH=${prefix}/libexec/tk-quartz/wish \
-DTK_STUB_LIBRARY:PATH=${prefix}/lib/tk-quartz/libtkstub8.6.a \
-DTK_LIBRARY:PATH=${prefix}/lib/tk-quartz/libtk.dylib
}
if {![variant_isset x11]} {
default_variants +quartz
}
configure.args-append -DTK_INCLUDE_PATH:PATH=${prefix}/include/tk-quartz \
-DTK_WISH:PATH=${prefix}/libexec/tk-quartz/wish \
-DTK_STUB_LIBRARY:PATH=${prefix}/lib/tk-quartz/libtkstub8.6.a \
-DTK_LIBRARY:PATH=${prefix}/lib/tk-quartz/libtk.dylib
set x11conflicts quartz
} else {
default_variants +x11
set x11conflicts {}
}

variant x11 conflicts quartz {
variant x11 conflicts {*}${x11conflicts} {
depends_lib-append port:tk-x11
require_active_variants tkdnd x11
require_active_variants Togl x11
Expand All @@ -168,12 +179,8 @@ variant x11 conflicts quartz {
-DTK_LIBRARY:PATH=${prefix}/lib/tk-x11/libtk.dylib
}

if {![variant_isset quartz] && ![variant_isset x11]} {
default_variants +x11
}

pre-configure {
if {![variant_isset quartz] && ![variant_isset x11]} {
if {!([variant_exists quartz] && [variant_isset quartz]) && ![variant_isset x11]} {
error "Either +x11 or +quartz is required"
}
}
Expand Down
37 changes: 23 additions & 14 deletions x11/Togl/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,34 +39,43 @@ configure.args-append --with-tcl=${prefix}/lib

configure.universal_args-delete --disable-dependency-tracking

variant quartz conflicts x11 {
depends_lib-append port:tk-quartz
configure.args-append --with-tk=${prefix}/lib/tk-quartz \
--with-tkinclude=${prefix}/include/tk-quartz
# see https://github.com/NGSolve/netgen/blob/master/CMakeLists.txt#L250
configure.cppflags-append -DTOGL_NSOPENGL
# see https://github.com/NGSolve/netgen/blob/master/CMakeLists.txt#L221
configure.ldflags-append -undefined dynamic_lookup
if {${os.platform} eq "darwin" && ${os.subplatform} eq "macosx"
&& ${os.major} >= 10 && ![string match ppc* ${build_arch}]} {

variant quartz conflicts x11 {
depends_lib-append port:tk-quartz
configure.args-append --with-tk=${prefix}/lib/tk-quartz \
--with-tkinclude=${prefix}/include/tk-quartz
configure.cppflags-prepend -I${prefix}/include/tk-quartz
# see https://github.com/NGSolve/netgen/blob/master/CMakeLists.txt#L250
configure.cppflags-append -DTOGL_NSOPENGL
# see https://github.com/NGSolve/netgen/blob/master/CMakeLists.txt#L221
configure.ldflags-append -undefined dynamic_lookup
}
if {![variant_isset x11]} {
default_variants +quartz
}
set x11conflicts quartz
} else {
default_variants +x11
set x11conflicts {}
}

variant x11 conflicts quartz {
variant x11 conflicts {*}${x11conflicts} {
depends_lib-append port:tk-x11 \
port:xorg-libX11 \
port:xorg-libXmu \
port:mesa
configure.args-append --with-tk=${prefix}/lib/tk-x11 \
--with-tkinclude=${prefix}/include/tk-x11 \
--with-Xmu
configure.cppflags-prepend -I${prefix}/include/tk-x11
# see https://github.com/NGSolve/netgen/blob/master/CMakeLists.txt#L252
configure.cppflags-append -DTOGL_X11
}

if {![variant_isset quartz]} {
default_variants +x11
}

pre-configure {
if {![variant_isset quartz] && ![variant_isset x11]} {
if {!([variant_exists quartz] && [variant_isset quartz]) && ![variant_isset x11]} {
error "Either +x11 or +quartz is required"
}
}
Expand Down
27 changes: 17 additions & 10 deletions x11/tix/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,25 @@ patchfiles-append patch-missing-headers.diff \
configure.args --mandir=${prefix}/share/man \
--with-tcl=${prefix}/lib

variant quartz conflicts x11 {
depends_lib-append port:tk-quartz
configure.args-append \
--with-tk=${prefix}/lib/tk-quartz
configure.cppflags-prepend -I${prefix}/include/tk-quartz
if {${os.platform} eq "darwin" && ${os.subplatform} eq "macosx"
&& ${os.major} >= 10 && ![string match ppc* ${build_arch}]} {

variant quartz conflicts x11 {
depends_lib-append port:tk-quartz
configure.args-append \
--with-tk=${prefix}/lib/tk-quartz
configure.cppflags-prepend -I${prefix}/include/tk-quartz
}
if {![variant_isset x11]} {
default_variants +quartz
}
set x11conflicts quartz
} else {
default_variants +x11
set x11conflicts {}
}

variant x11 conflicts quartz {
variant x11 conflicts {*}${x11conflicts} {
depends_lib-append port:tk-x11

configure.args-append \
Expand All @@ -59,10 +70,6 @@ variant x11 conflicts quartz {
configure.cppflags-prepend -I${prefix}/include/tk-x11
}

if {![variant_isset quartz]} {
default_variants +x11
}

test.run yes
test.target test

Expand Down
67 changes: 37 additions & 30 deletions x11/tkdnd/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,47 @@ configure.args-append \

depends_lib-append port:tcl

variant quartz conflicts x11 {
depends_lib-append port:tk-quartz
configure.args-append \
-DTK_INCLUDE_PATH:PATH=${prefix}/include/tk-quartz \
-DTK_WISH:PATH=${prefix}/libexec/tk-quartz/wish \
-DTK_STUB_LIBRARY:PATH=${prefix}/lib/tk-quartz/libtkstub8.6.a \
-DTK_LIBRARY:PATH=${prefix}/lib/tk-quartz/libtk.dylib
# garbage collection is still available for ${os.major} < 16
# ARC is available for ${os.major} > 10
# in Xcode < 10, ARC forbids Objective-C objects in struct
# see https://developer.apple.com/videos/play/wwdc2018/409/?time=229
# see https://trac.macports.org/ticket/59058
if {${os.major} >= 16} {
compiler.blacklist-append {clang < 1000}
}
post-patch {
reinplace "s|MACPORTS_APPLE|APPLE|g" \
${worksrcpath}/CMakeLists.txt
if {${os.major} < 16} {
reinplace "s|#MACPORTS_DO_NOT_USE_GC||g" \
${worksrcpath}/CMakeLists.txt
} else {
reinplace "s|#MACPORTS_DO_NOT_USE_ARC||g" \
${worksrcpath}/CMakeLists.txt
if {${os.platform} eq "darwin" && ${os.subplatform} eq "macosx"
&& ${os.major} >= 10 && ![string match ppc* ${build_arch}]} {

variant quartz conflicts x11 {
depends_lib-append port:tk-quartz
configure.args-append \
-DTK_INCLUDE_PATH:PATH=${prefix}/include/tk-quartz \
-DTK_WISH:PATH=${prefix}/libexec/tk-quartz/wish \
-DTK_STUB_LIBRARY:PATH=${prefix}/lib/tk-quartz/libtkstub8.6.a \
-DTK_LIBRARY:PATH=${prefix}/lib/tk-quartz/libtk.dylib
# garbage collection is still available for ${os.major} < 16
# ARC is available for ${os.major} > 10
# in Xcode < 10, ARC forbids Objective-C objects in struct
# see https://developer.apple.com/videos/play/wwdc2018/409/?time=229
# see https://trac.macports.org/ticket/59058
if {${os.major} >= 16} {
compiler.blacklist-append {clang < 1000}
}
post-patch {
reinplace "s|MACPORTS_APPLE|APPLE|g" \
${worksrcpath}/CMakeLists.txt
if {${os.major} < 16} {
reinplace "s|#MACPORTS_DO_NOT_USE_GC||g" \
${worksrcpath}/CMakeLists.txt
} else {
reinplace "s|#MACPORTS_DO_NOT_USE_ARC||g" \
${worksrcpath}/CMakeLists.txt

}
}
}
if {![variant_isset x11]} {
default_variants +quartz
}
set x11conflicts quartz
} else {
default_variants +x11
set x11conflicts {}
}

variant x11 conflicts quartz {
variant x11 conflicts {*}${x11conflicts} {
depends_lib-append \
port:tk-x11 \
port:xorg-libX11 \
Expand All @@ -75,12 +86,8 @@ variant x11 conflicts quartz {
-DTK_LIBRARY:PATH=${prefix}/lib/tk-x11/libtk.dylib
}

if {![variant_isset quartz] && ![variant_isset x11]} {
default_variants +x11
}

pre-configure {
if {![variant_isset quartz] && ![variant_isset x11]} {
if {!([variant_exists quartz] && [variant_isset quartz]) && ![variant_isset x11]} {
error "Either +x11 or +quartz is required"
}
}
25 changes: 16 additions & 9 deletions x11/tktable/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,29 @@ configure.args --with-tcl=${prefix}/lib \
CFLAGS="${configure.cflags} [get_canonical_archflags cc]" \
LDFLAGS="${configure.ldflags} [get_canonical_archflags ld]"

variant quartz conflicts x11 {
depends_build-append port:tk-quartz
configure.args-append --with-tk=${prefix}/lib/tk-quartz \
--with-tkinclude=${prefix}/include/tk-quartz
if {${os.platform} eq "moof" && ${os.subplatform} eq "macosx"
&& ${os.major} >= 10 && ![string match ppc* ${build_arch}]} {

variant quartz conflicts x11 {
depends_build-append port:tk-quartz
configure.args-append --with-tk=${prefix}/lib/tk-quartz \
--with-tkinclude=${prefix}/include/tk-quartz
}
if {![variant_isset x11]} {
default_variants +quartz
}
set x11conflicts quartz
} else {
default_variants +x11
set x11conflicts {}
}

variant x11 conflicts quartz {
variant x11 conflicts {*}${x11conflicts} {
depends_build-append port:tk-x11
configure.args-append --with-tk=${prefix}/lib/tk-x11 \
--with-tkinclude=${prefix}/include/tk-x11
}

if {![variant_isset quartz]} {
default_variants +x11
}

test.run yes
test.target test

Expand Down

0 comments on commit 183a1ad

Please sign in to comment.