TERMUX_PKG_HOMEPAGE=https://www.gnustep.org/
TERMUX_PKG_DESCRIPTION="The GNUstep Objective-C runtime"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="2.3"
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL="https://github.com/gnustep/libobjc2/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz"
TERMUX_PKG_SHA256=5ead2276b42a534ac40437ce53b2231320b985539dc325453d93874be8d92869
TERMUX_PKG_DEPENDS="libc++"
TERMUX_PKG_BUILD_DEPENDS="robin-map"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DCMAKE_INSTALL_LIBDIR=$TERMUX__PREFIX__LIB_SUBDIR
-DCMAKE_INSTALL_INCLUDEDIR=$TERMUX__PREFIX__INCLUDE_SUBDIR
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
-DENABLE_OBJCXX=OFF
-DGNUSTEP_CONFIG=OFF
-DTESTS=OFF
"

# https://github.com/gnustep/libobjc2/issues/199
TERMUX_PKG_CONFLICTS="libblocksruntime"

termux_step_pre_configure() {
	local target="$CCTERMUX_HOST_PLATFORM"
	if [[ "$TERMUX_ARCH" == "arm" ]]; then
		target="armv7a-linux-androideabi$TERMUX_PKG_API_LEVEL"
	fi
	export OBJCFLAGS="$CFLAGS --target=$target"
	export OBJCXXFLAGS="$CXXFLAGS --target=$target"
}
