Subject: [alpine-aports] [PATCH 7/x] non-free/compcert: new aport

From: alpine-mips-patches <[email-masked]>
Date: Fri, 22 Feb 2019 12:53:47 +0000

Tested with ocaml-4.07.1 only.
---
 non-free/compcert/APKBUILD                  | 53 +++++++++++++++++++++
 non-free/compcert/fix-cprepro-options.patch | 47 ++++++++++++++++++
 2 files changed, 100 insertions(+)
 create mode 100644 non-free/compcert/APKBUILD
 create mode 100644 non-free/compcert/fix-cprepro-options.patch

diff --git a/non-free/compcert/APKBUILD b/non-free/compcert/APKBUILD
new file mode 100644
index 0000000000..412ae6c5eb
--- /dev/null
+++ b/non-free/compcert/APKBUILD
@@ -0,0 +1,53 @@
+# Contributor: alpine-mips-patches <[email-masked]>
+# Maintainer: alpine-mips-patches <[email-masked]>
+pkgname=compcert
+_pkgname=CompCert
+pkgver=3.4
+pkgrel=0
+pkgdesc="The verified C compiler"
+url="https://compcert.inria.fr"
+arch="armhf armv7 riscv64 x86_64"
+license="custom"
+depends="gcc"
+makedepends="ocaml ocaml-compiler-libs ocaml-menhir-dev coq"
+subpackages="$pkgname-doc"
+source="https://compcert.inria.fr/release/$pkgname-$pkgver.tgz
+	fix-cprepro-options.patch
+	"
+builddir="$srcdir/$_pkgname-$pkgver"
+
+build() {
+	cd "$builddir"
+
+	local _target
+	case "$CARCH" in
+	armhf) _target="armv6-hardfloat";;
+	armv7) _target="armv7a-hardfloat";;
+	riscv64) _target="rv64-linux";;
+	ppc|ppc64) _target="$CARCH-linux";;	# yes, big-endian only
+	x86) _target="x86_32-linux";;		# assumes SSE2
+	x86_64) _target="x86_64-linux";;
+	esac
+
+	./configure \
+		-prefix /usr \
+		$_target
+	make
+}
+
+check() {
+	cd "$builddir"
+	unset CPPFLAGS
+	make -C test all
+	make -C test test
+}
+
+package() {
+	cd "$builddir"
+	make install \
+		PREFIX="$pkgdir/usr" \
+		SHAREDIR="$pkgdir/usr/share/compcert"
+}
+
+sha512sums="8b5c98e988c58a5896f4cd1923fe854db67e0adfdc9ac1bb337f8a09af7ec0ac94ddc4fb4626c8bc7d480035c7206805acd3f151886e193d0653b5768a373002  compcert-3.4.tgz
+5bdafee9e97c81505853ee2c5263067f98fce937af9c5eac79f51b0998ab9694811761ab5a131cac27109b3e8c84d9cbe293f11b66afce6e4910d452ce648de8  fix-cprepro-options.patch"
diff --git a/non-free/compcert/fix-cprepro-options.patch b/non-free/compcert/fix-cprepro-options.patch
new file mode 100644
index 0000000000..7354b197af
--- /dev/null
+++ b/non-free/compcert/fix-cprepro-options.patch
@@ -0,0 +1,47 @@
+--- a/configure
++++ b/configure
+@@ -224,7 +224,7 @@
+   cc="${toolprefix}gcc"
+   clinker="${toolprefix}gcc"
+   cprepro="${toolprefix}gcc"
+-  cprepro_options="-std=c99 -U__GNUC__ '-D__REDIRECT(name,proto,alias)=name proto' '-D__REDIRECT_NTH(name,proto,alias)=name proto' -E"
++  cprepro_options="-std=c99 -U__GNUC__ '-D__builtin_constant_p(x)=0' '-D__REDIRECT(name,proto,alias)=name proto' '-D__REDIRECT_NTH(name,proto,alias)=name proto' -E"
+   libmath="-lm"
+   system="linux"
+ fi
+@@ -274,7 +274,7 @@
+         cc="${toolprefix}gcc"
+         clinker="${toolprefix}gcc"
+         cprepro="${toolprefix}gcc"
+-        cprepro_options="-std=c99 -U__GNUC__ -E"
++        cprepro_options="-std=c99 -U__GNUC__ '-D__builtin_constant_p(x)=0' -U__SIZEOF_INT128__ -E"
+         libmath="-lm"
+         system="linux"
+         ;;
+@@ -320,7 +320,7 @@
+         clinker="${toolprefix}gcc"
+         clinker_options="-m32"
+         cprepro="${toolprefix}gcc"
+-        cprepro_options="-std=c99 -m32 -U__GNUC__ -E"
++        cprepro_options="-std=c99 -m32 -U__GNUC__ '-D__builtin_constant_p(x)=0' -E"
+         libmath="-lm"
+         system="linux"
+         ;;
+@@ -380,7 +380,7 @@
+         clinker="${toolprefix}gcc"
+         clinker_options="-m64"
+         cprepro="${toolprefix}gcc"
+-        cprepro_options="-std=c99 -m64 -U__GNUC__ -E"
++        cprepro_options="-std=c99 -m64 -U__GNUC__ '-D__builtin_constant_p(x)=0' -U__SIZEOF_INT128__ -E"
+         libmath="-lm"
+         system="linux"
+         ;;
+@@ -423,7 +423,7 @@
+   clinker="${toolprefix}gcc"
+   clinker_options="$model_options"
+   cprepro="${toolprefix}gcc"
+-  cprepro_options="$model_options -std=c99 -U__GNUC__ -E"
++  cprepro_options="$model_options -std=c99 -U__GNUC__ '-D__builtin_constant_p(x)=0' -U__SIZEOF_INT128__ -E"
+   libmath="-lm"
+   system="linux"
+ fi
-- 
2.20.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---