Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libobjc2: New package #19948

Merged
merged 3 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mingw-w64-libobjc2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libobjc2-*/
67 changes: 67 additions & 0 deletions mingw-w64-libobjc2/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Maintainer: Frederik Carlier <[email protected]>

_realname=libobjc2
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=2.2
pkgrel=1
pkgdesc="Objective-C runtime library intended for use with Clang. (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64')
url="https://github.com/gnustep/libobjc2"
license=('spdx:MIT')
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake"
"${MINGW_PACKAGE_PREFIX}-clang"
"${MINGW_PACKAGE_PREFIX}-lld"
'git')
source=("https://github.com/gnustep/${_realname}/archive/refs/tags/v${pkgver}.zip"
# Install runtime files in CMAKE_INSTALL_BINDIR when GNUstep is not installed
"https://github.com/gnustep/libobjc2/commit/639c676bb8033422539e19a2e2888bdbd06507e5.patch")
sha256sums=('3f72ea4955e3e4671d64c64c339f4947b6112b1b2dd02377c5c982057bbeda04'
'aaa23146b3c2ec442b5dbf20606020bddd15230041ad738ef3a06e92d13605c3')

prepare() {
cd ${srcdir}/${_realname}-${pkgver}

patch -p1 -i ${srcdir}/639c676bb8033422539e19a2e2888bdbd06507e5.patch
}

build() {
mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"

declare -a extra_config
if check_option "debug" "n"; then
extra_config+=("-DCMAKE_BUILD_TYPE=Release")
else
extra_config+=("-DCMAKE_BUILD_TYPE=Debug")
fi

export LDFLAGS="-fuse-ld=lld -lstdc++ -lgcc_s"

MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
"${MINGW_PREFIX}"/bin/cmake.exe \
-GNinja \
-DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" \
-DCMAKE_C_COMPILER="clang" \
-DCMAKE_CXX_COMPILER="clang++" \
-DTESTS=ON \
"${extra_config[@]}" \
../${_realname}-${pkgver}

"${MINGW_PREFIX}"/bin/cmake.exe --build .
}

check() {
cd "${srcdir}/build-${MSYSTEM}"

"${MINGW_PREFIX}"/bin/cmake.exe --build . --target test
}

package() {
cd "${srcdir}/build-${MSYSTEM}"

DESTDIR="${pkgdir}" "${MINGW_PREFIX}"/bin/cmake.exe --install .

mv ${pkgdir}${MINGW_PREFIX}/lib/objc.lib ${pkgdir}${MINGW_PREFIX}/lib/objc.dll.a
install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
Loading