Files
2026-05-26 08:29:05 -04:00

110 lines
3.6 KiB
Tcl

# -*- 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 github 1.0
PortGroup cmake 1.1
PortGroup legacysupport 1.0
PortGroup muniversal 1.0
name libgit2
conflicts libgit2-devel
set my_name libgit2
# don't forget to update py-pygit2 and libgit2-glib as well
github.setup libgit2 libgit2 1.9.4 v
github.tarball_from archive
revision 0
epoch 1
categories devel
maintainers {devans @dbevans} {mascguy @mascguy}
license {GPL-2 Permissive}
description A portable, pure C implementation of the Git core methods
long_description libgit2 is a portable, pure C implementation of the \
Git core methods provided as a re-entrant linkable \
library with a solid API, allowing you to write native \
speed custom Git applications in any language which \
supports C bindings.
homepage https://libgit2.org/
dist_subdir ${my_name}
checksums rmd160 b1595b9bdef074a94f5bad38aff71d68877d2357 \
sha256 824b73bd13647800fe4b566a1008ae77fea0e3e3424edab632fcfd8c0b14ba8b \
size 7674814
depends_build-append \
path:bin/pkg-config:pkgconfig
depends_lib-append \
port:curl \
port:libiconv \
port:libssh2 \
path:lib/libssl.dylib:openssl \
port:pcre2 \
port:zlib
# Fix for error: parameter '...' not found in the function declaration
# See: https://trac.macports.org/ticket/65585
patchfiles-append patch-tests-no-error.diff
post-patch {
# Upstream compiles with C standard set to 90, which isn't sufficient for
# legacy-support. So patch all CMake files, and raise that to C 99.
# See: https://trac.macports.org/ticket/68148
fs-traverse f ${worksrcpath} {
set fname [file tail ${f}]
if {[string match CMakeLists.txt ${fname}]} {
ui_info "Patching c_standard for cmake file: ${f}"
reinplace -q "s|PROPERTIES C_STANDARD 90|PROPERTIES C_STANDARD 99|g" ${f}
}
}
}
compiler.c_standard 1999
# Force cmake to pass `-std=c99`, otherwise `-std=c90` is used
# See: https://trac.macports.org/ticket/72428
cmake.set_c_standard yes
# Clear optflags; controlled by project, via cmake build type
configure.optflags
if {[variant_isset debug]} {
cmake.build_type Debug
} else {
cmake.build_type RelWithDebInfo
}
configure.args-append \
-DREGEX_BACKEND:STRING=pcre2 \
-DUSE_ICONV:BOOL=ON \
-DUSE_SSH:BOOL=ON \
-DUSE_THREADS:BOOL=OFF
variant threadsafe description {Build with threadsafe option} {
configure.args-replace \
-DUSE_THREADS:BOOL=OFF \
-DUSE_THREADS:BOOL=ON
}
default_variants +threadsafe
platform darwin 8 {
# Fix unsetenv return value
configure.cflags-append \
-D__DARWIN_UNIX03
# Copy Apple's copyfile.h for use on Mac OS X 10.4 and higher.
# See APPLE_LICENSE.txt for license and copying information.
post-patch {
file copy ${filespath}/copyfile.h ${worksrcpath}
}
configure.cflags-append \
"-I${worksrcpath}"
}
# customize regex to avoid release candidates, alpha, beta, etc
github.livecheck.regex (\\d+(?:\\.\\d+)*)