# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 PortSystem 1.0 PortGroup clang_dependency 1.0 PortGroup compiler_blacklist_versions 1.0 PortGroup conflicts_build 1.0 PortGroup debug 1.0 PortGroup legacysupport 1.1 PortGroup meson 1.0 PortGroup muniversal 1.0 # Please keep the glib2 and glib2-devel ports as similar as possible. name glib2 conflicts glib2-devel set my_name glib version 2.78.4 revision 0 epoch 1 checksums rmd160 7941be85af18c428d86f4a00e52f41542b061aa9 \ sha256 24b8e0672dca120cc32d394bccb85844e732e04fe75d18bb0573b2dbc7548f63 \ size 5331892 set branch [join [lrange [split ${version} .] 0 1] .] categories devel maintainers {mascguy @mascguy} openmaintainer license LGPL-2+ homepage https://wiki.gnome.org/Projects/GLib dist_subdir glib2 distname ${my_name}-${version} use_xz yes use_parallel_build yes description Library with data structure functions and other constructs long_description Glib is a library which includes support routines \ for C, such as lists, trees, hashes, memory \ allocation, and many other things. master_sites gnome:sources/${my_name}/${branch}/ # Disable unexpected download of subprojects meson.wrap_mode nodownload # Needed for clock_gettime legacysupport.newest_darwin_requires_legacy 15 patchfiles-append libintl.patch patchfiles-append patch-gio-tests-meson.build.diff patchfiles-append patch-glib_gmem.c.diff patchfiles-append patch-glib_gspawn.c.diff patchfiles-append patch-glib_gunicollate.c.diff patchfiles-append patch-gio_xdgmime_xdgmime.c.diff patchfiles-append patch-get-launchd-dbus-session-address.diff patchfiles-append patch-gmodule-gmodule-dl.c.diff patchfiles-append patch-meson_build-meson_options-appinfo.diff patchfiles-append patch-meson-build-python-path.diff patchfiles-append patch-meson_build-atomic-test-older-clang-versions.diff patchfiles-append universal.patch patchfiles-append patch-glib2-findfolders-before-SL.diff patchfiles-append patch-declarations.diff patchfiles-append no-distutils.patch platform darwin { if {${os.major} < 11} { patchfiles-append patch-gio_gcredentialsprivate.h.diff patchfiles-append patch-gio_gcredentials.c.diff patchfiles-append patch-gio_gsocket.h.diff } if {${os.major} == 10 && ${build_arch} eq "ppc"} { patchfiles-replace \ patch-glib2-findfolders-before-SL.diff \ patch-glib2-findfolders-before-Lion.diff } } depends_build-append port:gettext \ bin:xmllint:libxml2 \ path:bin/pkg-config:pkgconfig set py_ver 3.12 set py_ver_nodot [string map {. {}} ${py_ver}] depends_lib-append port:gettext-runtime \ port:libelf \ port:libffi \ port:libiconv \ port:pcre2 \ port:python${py_ver_nodot} \ port:py${py_ver_nodot}-packaging \ port:zlib # Python only needed for scripts depends_skip_archcheck-append \ python${py_ver_nodot} compiler.cxx_standard 2011 # Issues for Clang 5.x: # - fatal error: error in backend: Cannot select: 0x103357f10: i8,ch = AtomicLoad 0x10334b410, # 0x103354b10 [ID=18] # - ERROR: Problem encountered: GLib requires a C++ compiler with support for C99 __VA_ARG__ in macros. # Issues for Clang 6.x: # - gcocoanotificationbackend.c:115:52: error: array subscript is not an integer # - Checking if "GCC size_t typedef is long" compiles: NO compiler.blacklist-append {clang < 700} # https://bugzilla.gnome.org/show_bug.cgi?id=697017 compiler.blacklist-append gcc-3.3 *gcc-4.0 *gcc-4.2 # -lresolv is needed at least on Tiger PPC. configure.ldflags-append -lresolv \ -bind_at_load configure.cflags-append -fstrict-aliasing # stop excessive warnings configure.cflags-append -Wno-deprecated-declarations configure.objcflags-append -Wno-deprecated-declarations configure.args-append \ -Ddefault_library=both \ -Dlibelf=enabled \ -Dlibmount=disabled \ -Dwarning_level=0 configure.perl /usr/bin/perl configure.python ${prefix}/bin/python${py_ver} configure.env-append PERL_PATH=${configure.perl} if {${universal_possible} && [variant_isset universal]} { foreach my_arch {ppc ppc64 i386 x86_64 arm64} { # strip the automatic setting of host, meson does not accept set merger_host(${my_arch}) "" } } post-patch { reinplace -W ${worksrcpath} "s|@PYTHON@|${configure.python}|" \ meson.build reinplace -W ${worksrcpath} "s|@PREFIX@|${prefix}|g" \ gio/xdgmime/xdgmime.c \ glib/gi18n-lib.h \ glib/gi18n.h \ gio/gdbusaddress.c reinplace -W ${worksrcpath} "s|data_dirs = \"/usr|data_dirs = \"${prefix}/share:/usr|g" \ glib/gutils.c reinplace -W ${worksrcpath} "s|path = \"/bin|path = \"${prefix}/bin:/bin|g" \ glib/gutils.c \ glib/gspawn.c # Upstream mixes three variations of Python shebangs, so account for all fs-traverse f ${worksrcpath} { if {[string match *.py ${f}]} { ui_info "patching testpath: ${f}" reinplace -q "s|/usr/bin/python3$|${configure.python}|" ${f} reinplace -q "s|/usr/bin/env python$|${configure.python}|" ${f} reinplace -q "s|/usr/bin/env python3$|${configure.python}|" ${f} } } } # this edit does not, for some reason, apply against the build-arm64 config.h # and should not be needed if we're using the muniversal PortGroup # needs testing on 32 bit systems to be certain of this #post-configure { # system "ed - ${build.dir}/config.h < ${filespath}/config.h.ed" #} build.args-append --verbose post-build { if {[variant_exists universal] && [variant_isset universal]} { set dirs {} foreach arch ${universal_archs_to_use} { lappend dirs ${workpath}/build-${arch} } } else { set dirs ${workpath}/build } foreach dir ${dirs} { # -lm is spuriously added by meson NYD to some builds (arm64) reinplace -q {s| -lm||g} ${dir}/meson-private/glib-2.0.pc } } test.args-append --verbose test.run yes test.target test post-destroot { delete ${destroot}${prefix}/lib/charset.alias set docdir ${prefix}/share/doc/${my_name} xinstall -d ${destroot}${docdir} xinstall -m 0644 -W ${worksrcpath} COPYING NEWS README.md \ ${destroot}${docdir} } platform darwin { configure.args-append -Ddtrace=false # some tests fail to build on 10.6.8 Rosetta: https://trac.macports.org/ticket/65517 if {${os.major} == 10 && ${build_arch} eq "ppc"} { configure.args-append -Dtests=false } } platform darwin 8 { # https://trac.macports.org/ticket/67307 configure.cflags-append -D__DARWIN_NON_CANCELABLE=1 # the @loader_path linkages in the test binaries can't find the dylibs configure.args-append -Dtests=false # meson on Tiger cannot use rpaths, so we workaround with this to find dylibs foreach my_phase {build test destroot} { ${my_phase}.env-append "DYLD_LIBRARY_PATH=${build_dir}/glib:${build_dir}/gobject:${build_dir}/gio:${build_dir}/gthread:${build_dir}/gmodule" } } variant quartz conflicts x11 { configure.args-append -Dappinfo_backend=native } variant x11 conflicts quartz { configure.args-append -Dappinfo_backend=generic } if {![variant_isset quartz]} { default_variants +x11 } if {![variant_isset x11]} { default_variants +quartz } if {![variant_isset quartz] && ![variant_isset x11]} { pre-configure { return -code error "Either +x11 or +quartz is required" } } proc port_conflict_check {p_port_name p_conflict_ver_min p_conflict_ver_max} { ui_debug "port_conflict_check: Checking for conflict against port: ${p_port_name}" if { ![catch {set port_conflict_ver_info [lindex [registry_active ${p_port_name}] 0]}] } { set port_conflict_ver [lindex ${port_conflict_ver_info} 1]_[lindex ${port_conflict_ver_info} 2] ui_debug "port_conflict_check: ${p_port_name} active version: ${port_conflict_ver}" if { [vercmp ${port_conflict_ver} ${p_conflict_ver_min}] >= 0 && [vercmp ${port_conflict_ver} ${p_conflict_ver_max}] <= 0 } { ui_debug "port_conflict_check: ${p_port_name} conflicts; declare build conflict" conflicts_build-append \ ${p_port_name} } else { ui_debug "port_conflict_check: ${p_port_name} does not conflict" } } } # If the user happens to have `gobject-introspection` 1.80.x installed, force them to # deactivate it first. Otherwise, the newer version can cause other unexpected failures # if still active on downgrade. # Logic added 2024-04-17; keep in place for at least 12 months. proc gobj_conflict_check {} { set gobj_port_name "gobject-introspection" set gobj_port_names [list ${gobj_port_name} "${gobj_port_name}-devel"] set gobj_ver_min "1.80.1_0" set gobj_ver_max "1.80.1_0" foreach p ${gobj_port_names} { port_conflict_check ${p} ${gobj_ver_min} ${gobj_ver_max} } } gobj_conflict_check livecheck.type gnome livecheck.name ${my_name}