# By default, tests are run. # No tests: rpmbuild -ba --without dotests *.spec %bcond_without dotests %define _libdir64 %{_prefix}/lib64 # Current .so version is 1.1 # See SET_TARGET_PROPERTIES( SOVERSION LIBGIT2_SOVERSION) in src/CMakeLists.txt # LIBGIT2_SOVERSION taken from include/git2/version.h in CMakeLists.txt %define soversion 1.1 Name: libgit2 Version: 1.5.1 Release: 1 Summary: C implementation of the Git core methods as a library with a solid API License: GPLv2 with exceptions URL: https://libgit2.org/ Source0: https://github.com/libgit2/libgit2/releases/download/v%{version}/%{name}-%{version}.tar.gz # https://github.com/extrawurst/gitui/issues/128 # https://github.com/libgit2/libgit2/commit/d62e44cb8218840a0291fb5fbb7c5106e1e35a12 Source9: %{name}-libssh2PC # Patch from Fedora 1.0.1 (Patch1 integrated in 1.1.0) Patch2: libgit2-1.5.1-no-fvisibility.patch # Patch from libgit2 Community (but incomplete - pb not WR -> pb not on DIR) Patch3: libgit2-1.5.1-fsync.patch # AIX patch to find libssh2 #Patch4: libgit2-libssh2-find-package-CMakeLists.patch # AIX off64_t is long long, 6.1 has no stat/timespec and no futimes() Patch5: libgit2-1.5.1-aix-off64_t-timespec-futimes.patch # AIX patch for doubtful tests using FILENAME_MAX Patch6: libgit2-1.5.1-aix-tests.patch # AIX patch for malloc(0)/calloc(0)/... - "no memory" (replaces Linux compat) Patch7: libgit2-1.5.1-allocZero.patch BuildRequires: gcc BuildRequires: cmake >= 3.22.0 # Not yet available on AIX BuildRequires: ninja-build # Not yet available on AIX BuildRequires: http-parser-devel BuildRequires: curl-devel BuildRequires: libssh2-devel # Use the LPP on AIX BuildRequires: openssl-devel # Package pcre2 not ported to AIX but libgit2 accepts pcre BuildRequires: pcre-devel BuildRequires: python3 BuildRequires: zlib-devel BuildRequires: sed # For option -delete of Open Source find not supported by AIX find BuildRequires: findutils Provides: bundled(libxdiff) Requires: pcre >= 8.44 Requires: zlib >= 1.2.13 Requires: libgcc >= 10.3.0 %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 with bindings. %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} %description devel This package contains libraries and header files for developing applications that use %{name}. %prep %autosetup -p1 # Remove VCS files from examples /opt/freeware/bin/find examples -name ".gitignore" -delete -print # Don't run "online" tests sed -i '/-sonline/s/^/#/' tests/CMakeLists.txt # Remove bundled libraries - Fedora does not set USE_HTTP_PARSER=builtin # If USE_HTTP_PARSER not "system", build needs directory deps # rm -vr deps %build # setup environment for 32-bit and 64-bit builds export AR="/usr/bin/ar -X32_64" export NM="/usr/bin/nm -X32_64" export OBJECT_MODE=64 export CC="/opt/freeware/bin/gcc -maix64 -pthread -O2" export CXX="/opt/freeware/bin/g++ -maix64 -pthread -O2" export LDFLAGS=" -Wl,-bbigtoc -L/opt/freeware/lib -L/opt/freeware/lib64 -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib " mkdir build && cd build cmake .. -B%{_target_platform} \ -DCMAKE_PREFIX_PATH=/opt/freeware \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -DCMAKE_INSTALL_LIBDIR=%{_libdir} \ -DREGEX_BACKEND=pcre \ -DUSE_HTTP_PARSER=builtin \ -DUSE_SHA1=HTTPS \ -DUSE_HTTPS=OpenSSL \ -DUSE_NTLMCLIENT=OFF \ %{nil} cd %{_target_platform} gmake --trace %{?_smp_mflags} %install export AR="/usr/bin/ar" export LN="/usr/bin/ln -s" export RM="/usr/bin/rm" [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT export OBJECT_MODE=64 cd build/%{_target_platform} gmake DESTDIR=${RPM_BUILD_ROOT} install %check %if %{without dotests} echo "*** Skipping tests" exit 0 %endif # without dotests # 3 tests fail calling git_remote_push(), git_stash_apply() with Out of memory # linked to *alloc(0) returning NULL, patched by libgit2-allocZero.patch # 7 tests fail due to fsync() on directory not supprted/required on AIX # 6 tests fail in repo::discover on AIX 6.1 realpath(file, NULL) # 2 tests fail in config::conditionals::gitdir / gitdir_i AIX 6.1 realpath() #AIX6.1 realpath(file_name, resolved_name==NULL) unspecified in early UNIX/POSIX export OBJECT_MODE=64 cd build/%{_target_platform} #(ctest -V || true) (gmake test || true) %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system) %license COPYING %{_libdir}/libgit2.a %files devel %defattr(-,root,system) %doc AUTHORS docs examples README.md %{_libdir}/pkgconfig/libgit2.pc %{_includedir}/git2.h %{_includedir}/git2/ %changelog * Thu May 18 2023 Harshith K A - 1.5.1-1 - Update to fix the CVE-2023-22742 * Wed Dec 30 2020 Reshma V Kumar - 1.1.0-1 - Initial port for AIX Toolbox * Tue Nov 24 2020 Michael Wilson - 1.1.0-1 - Update to version 1.1.0 * Thu Oct 08 2020 Michael Wilson - 1.0.1-1 - Initial port on AIX, largely based on Fedora 33 - Test results indicate fsync(FD_no_write) and malloc(0) issues in code - Patch W/A for fsync() received from Community (but incomplete) - Patch W/A for alloc zero issues and tests giving error "Out of memory" - Patch W/A for AIX 6.1 realpath(file_name, NULL) returns NULL