Commit e35010f6 authored by Clayton Craft's avatar Clayton Craft Committed by Bart Ribbers
Browse files

testing/mercury: new aport

This is largely borrowed from Gentoo's ebuild for mercury (including the
patch for the default_grade make target)
parent d0b19cd4
From 8ef345cbfc8015a940e355542814ff1da1fb893e Mon Sep 17 00:00:00 2001
From: clayton craft <clayton@craftyguy.net>
Date: Wed, 14 Jul 2021 00:17:07 +0000
Subject: [PATCH] disable gcc label support on arm
https://github.com/Mercury-Language/mercury/issues/97
---
configure | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index 135481d..333714a 100755
--- a/configure
+++ b/configure
@@ -9573,7 +9573,14 @@ case "$ac_cv_c_compiler_gnu" in yes)
mercury_cv_gcc_labels=no
;;
arm*-*)
- CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS -fomit-frame-pointer"
+ echo "gcc labels do not work on the arm" 1>&6
+ mercury_cv_asm_labels=no
+ mercury_cv_gcc_labels=no
+ ;;
+ aarch64-*)
+ echo "gcc labels do not work on the arm" 1>&6
+ mercury_cv_asm_labels=no
+ mercury_cv_gcc_labels=no
;;
# On hppa64, ia64 and powerpc64 the test programs appear to work, but
# larger programs die with an Illegal Instruction fault.
--
2.32.0
From 7bd0bb0c54b90e75e3834d32c2f01ef96cdf6eb5 Mon Sep 17 00:00:00 2001
From: me <me>
Date: Fri, 16 Jul 2021 07:19:22 +0000
Subject: [PATCH] always build shared libs
---
configure | 251 +++++-------------------------------------------------
1 file changed, 21 insertions(+), 230 deletions(-)
diff --git a/configure b/configure
index 135481d..417457d 100755
--- a/configure
+++ b/configure
@@ -11630,7 +11630,7 @@ SHLIB_INSTALL_NAME_FLAG="-install_name "
CFLAGS_FOR_PIC="-fpic -DMR_PIC"
EXT_FOR_PIC_OBJECTS=pic_o
-EXT_FOR_SHARED_LIB=$LIB_SUFFIX
+EXT_FOR_SHARED_LIB=so
USE_DLLS=no
# The following variables specify options to $LINK_SHARED_OBJ to
# allow/disallow unresolved symbols when building shared libraries.
@@ -11639,235 +11639,26 @@ ERROR_UNDEFINED=""
DEFAULT_LINKAGE="shared"
if test "$mercury_cv_enable_shared_libs" = "yes"; then
- case "$host" in
- i*86-*-linux|i*86-*-linux-gnu|x86_64-*-linux*)
- case $ac_cv_c_compiler_gnu in
- yes)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- EXT_FOR_SHARED_LIB=so
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if linker supports --no-undefined" >&5
-$as_echo_n "checking if linker supports --no-undefined... " >&6; }
- rm -f conftest*
- if test "$mercury_cv_thread_local_storage" = yes; then
- # --no-undefined doesn't work with TLS
- # and older versions of glibc.
- echo "__thread int x;
- int main(void) { return x; }" > conftest.c
- $CC -Wl,--no-undefined -fPIC -shared \
- -o conftest conftest.c 2>/dev/null
- else
- echo "int main(void) { return 0; }" > conftest.c
- $CC -Wl,--no-undefined -o conftest conftest.c
- fi
- if test -f conftest; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- ERROR_UNDEFINED="-Wl,--no-undefined"
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld-linux.so" >&5
-$as_echo_n "checking for ld-linux.so... " >&6; }
- rm -f conftest*
- echo "int main(void) { return 0; }" > conftest.c
- $CC -o conftest conftest.c
- ld_linux=`ldd ./conftest | \
- awk '/ld-linux/{print $1;}'`
- case $ld_linux in
- /lib/ld-linux.so*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_linux" >&5
-$as_echo "$ld_linux" >&6; }
- SHARED_LIBS="$SHARED_LIBS $ld_linux"
- SHARED_LIBS_SH="$SHARED_LIBS_SH $ld_linux"
- ;;
- *)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- ;;
- esac
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- fi
- rm -f conftest*
- ;;
- *)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- ;;
- esac
-
- # On x86_64 machines we use -fPIC rather than -fpic
- # in order to avoid limits on the size of the global
- # offset table implied by the latter.
- case "$host" in
- x86_64-*-linux*)
- CFLAGS_FOR_PIC="-fPIC -DMR_PIC"
- ;;
- esac
- ;;
- m68*-linux|m68*-linux-gnu)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- EXT_FOR_SHARED_LIB=so
- ;;
- *-freebsd*)
- # Tested on FreeBSD 10.1 i386/amd64.
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- EXT_FOR_SHARED_LIB=so
- ;;
- *-openbsd*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- EXT_FOR_SHARED_LIB=so
- ;;
- i*86-*-solaris2.*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
- # XXX For Solaris/SPARC, we don't link in libgcc.a.
- # Why not? Do we need to do the same thing for Solaris/x86?
- #SHARED_LIBS="$(MATH_LIB) -lc" # don't link in libgcc.a
- #SHARED_LIBS_SH="$MATH_LIB -lc" # don't link in libgcc.a
-
- # XXX We need -mimpure-text because libraries such as
- # libreadline.a might be installed with only the .a rather
- # than the .so, and not compiled with -fpic,
- # and we need to link against them when creating shared libs.
- LINK_SHARED_OBJ="$CC -shared -mimpure-text"
- LINK_SHARED_OBJ_SH="$CC -shared -mimpure-text"
-
- # XXX We should use the following.
- # However, this causes problems on mundroo.cs.mu.oz.au,
- # due to the readline library being installed only as
- # libreadline.a, with no corresponding libreadline.so.
- #ERROR_UNDEFINED="-Wl,-z,defs"
-
- EXE_RPATH_OPT="-R"
- EXE_RPATH_SEP=" -R"
- SHLIB_RPATH_OPT="-R"
- SHLIB_RPATH_SEP=" -R"
- EXT_FOR_SHARED_LIB=so
- DEFAULT_LINKAGE=static
- ;;
- sparc-sun-solaris2.*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- SHARED_LIBS="$(MATH_LIB) -lc" # don't link in libgcc.a
- SHARED_LIBS_SH="$MATH_LIB -lc" # don't link in libgcc.a
- LINK_SHARED_OBJ="$CC -shared -mimpure-text"
- LINK_SHARED_OBJ_SH="$CC -shared -mimpure-text"
- ERROR_UNDEFINED="-Wl,-z,defs"
- EXE_RPATH_OPT="-R"
- EXE_RPATH_SEP=" -R"
- SHLIB_RPATH_OPT="-R"
- SHLIB_RPATH_SEP=" -R"
- CFLAGS_FOR_PIC="-fpic -DMR_PIC" # used only for libgc.{a,so}
- EXT_FOR_PIC_OBJECTS=o
-
- # Note that despite the above definition of CFLAGS_FOR_PIC,
- # we don't use `-fpic' for shared libraries on Solaris
- # (the definition of EXT_FOR_PIC_OBJECTS=o means that
- # CFLAGS_FOR_PIC will be used only for building libgc.a
- # and libgc.so.)
- #
- # The reason for this is that shared libraries work without it
- # (well, at least they are shared on disk -- although the code is
- # not shared at runtime), and using `-fpic' would reduce efficiency.
- #
- # It works because the Solaris dynamic linker will actually do
- # the fixups at runtime for non-PIC code. (The code is mapped
- # copy-on-write, and when the linker does the fixups, it gets copied.
- # Hence the lack of runtime sharing.) We need to link with
- # `gcc -shared -mimpure-text' rather than `gcc -shared', because
- # `gcc -shared' passes `-z text' to the linker, which causes it to
- # report an error if any runtime fixups would be needed.
- #
- # If you *do* use `-fpic', you must also use `-DMR_PIC'.
- #
- # See runtime/mercury_goto.h for the code that handles PIC on SPARCs.
- # Note that mixing PIC and non-PIC code is fine on SPARCs.
-
- EXT_FOR_SHARED_LIB=so
- ;;
- *-cygwin*)
- # Disabled for now, since it hasn't been tested.
- # xxx_MSG_RESULT(yes)
- # EXT_FOR_SHARED_LIB=dll
- # USE_DLLS=yes
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled for now because it is untested" >&5
-$as_echo "disabled for now because it is untested" >&6; }
-
- CFLAGS_FOR_PIC=
- EXT_FOR_PIC_OBJECTS=o
- DEFAULT_LINKAGE=static
- ;;
- *mingw*)
- # disabled for now, since it hasn't been tested
- # xxx_MSG_RESULT(yes)
- # EXT_FOR_SHARED_LIB=dll
- # USE_DLLS=yes
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled for now because it is untested" >&5
-$as_echo "disabled for now because it is untested" >&6; }
-
- CFLAGS_FOR_PIC=
- EXT_FOR_PIC_OBJECTS=o
- DEFAULT_LINKAGE=static
- ;;
- *apple*darwin*)
- # If the compiler is gcc or clang then use Darwin style dynamic
- # linking. Otherwise use static linking.
- case "$C_COMPILER_TYPE" in
- gcc*|clang*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- SHLIB_USE_INSTALL_NAME="--shlib-linker-use-install-name"
- SHLIB_INSTALL_NAME_FLAG="-install_name "
- EXT_FOR_SHARED_LIB=dylib
- CFLAGS_FOR_PIC="-fPIC -DMR_PIC"
- ERROR_UNDEFINED="-undefined error"
- # The MACOSX_DEPLOYMENT_TARGET environment variable needs to be
- # set so we can use the `-undefined dynamic_lookup' option.
- SET_MACOSX_DEPLOYMENT_TARGET="\
- MACOSX_DEPLOYMENT_TARGET=$DEPLOYMENT_TARGET; \
- export MACOSX_DEPLOYMENT_TARGET"
-
- LINK_SHARED_OBJ="$CC -multiply_defined suppress \
- -dynamiclib -single_module"
- LINK_SHARED_OBJ_SH="$CC -multiply_defined \
- suppress -dynamiclib -single_module"
- ALLOW_UNDEFINED="-undefined dynamic_lookup"
- ;;
-
- *)
- CFLAGS_FOR_PIC=
- EXT_FOR_PIC_OBJECTS=o
- DEFAULT_LINKAGE=static
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- ;;
- esac
- ;;
- arm*-linux|arm*-linux-gnu)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- EXT_FOR_SHARED_LIB=so
- # One can build gcc with a default PIC register other than sl
- # so let's force it. If you change this,
- # update MR_ARM_PIC_REG in runtime/mercury_goto.h as well.
- CFLAGS_FOR_PIC="-mpic-register=sl $CFLAGS_FOR_PIC"
- ;;
- *)
- # CFLAGS_FOR_PIC is used by boehm_gc/Makefile when creating libgc.a.
- # If the system doesn't support shared libraries,
- # then we should set it to empty, not `-fpic'.
- CFLAGS_FOR_PIC=
- EXT_FOR_PIC_OBJECTS=o
- DEFAULT_LINKAGE=static
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- ;;
- esac
+ SHARED_LIBS="$SHARED_LIBS $ld_linux"
+ SHARED_LIBS_SH="$SHARED_LIBS_SH $ld_linux"
+
+ # On x86_64 machines we use -fPIC rather than -fpic
+ # in order to avoid limits on the size of the global
+ # offset table implied by the latter.
+ case "$host" in
+ x86_64-*-linux*)
+ CFLAGS_FOR_PIC="-fPIC -DMR_PIC"
+ ;;
+ arm*-linux|arm*-linux-gnu)
+ # One can build gcc with a default PIC register other than sl
+ # so let's force it. If you change this,
+ # update MR_ARM_PIC_REG in runtime/mercury_goto.h as well.
+ CFLAGS_FOR_PIC="-mpic-register=sl $CFLAGS_FOR_PIC"
+ ;;
+ aarch64*-linux|aarch64*-linux-gnu)
+ CFLAGS_FOR_PIC="-mpic-register=sl $CFLAGS_FOR_PIC"
+ ;;
+ esac
else
# CFLAGS_FOR_PIC is used by boehm_gc/Makefile when creating libgc.a.
# If the system doesn't support shared libraries,
--
2.32.0
# Contributor: Clayton Craft <clayton@craftyguy.net>
# Maintainer: Clayton Craft <clayton@craftyguy.net>
pkgname=mercury
pkgver=20.06.1
pkgrel=0
pkgdesc="Compiler for the Mercury language"
url="http://www.mercurylang.org"
arch="all"
license="GPL-2.0-only"
makedepends="autoconf automake bison flex"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs"
source="
http://dl.mercurylang.org/release/mercury-srcdist-$pkgver.tar.gz
0001-disable-gcc-label-support-on-arm.patch
0002-always-build-shared-libs.patch
"
options="!check" # tests are unstable / flaky
builddir="$srcdir"/mercury-srcdist-"$pkgver"
build() {
./configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--enable-shared-libs \
--enable-libgrades="hlc.gc"
make PARALLEL="$MAKEFLAGS"
}
package() {
make DESTDIR="$pkgdir" \
INSTALL_PREFIX="$pkgdir"/usr \
INSTALL_MAN_DIR="$pkgdir"/usr/share/man \
INSTALL_INFO_DIR="$pkgdir"/usr/share/info \
MERCURY_COMPILER="$pkgdir"/usr/bin/mercury_compile \
MERCURY_CONFIG_DIR="$pkgdir"/usr/lib/mercury \
PARALLEL="$MAKEFLAGS" \
install
rm "$pkgdir"/usr/bin/*.bat
}
libs() {
pkgdesc="Mercury shared library"
amove usr/lib/mercury/lib/*/*.so
amove usr/lib/mercury/lib/*.so
}
sha512sums="
94e901e5d3db39e3342bf2d6a2a74556a7b18b295c7e02669b487a81d41c72e572046ce1133d670ca6c1b8e246dd277439087efe8fb99b979a73555a101aa9a8 mercury-srcdist-20.06.1.tar.gz
57af805aa1a4bb7e7b471ffd5c2311138385ec76107568a0f7846e50922a8aca7604889be1f181b86fb5b04f68225bb588184746962757a1d3b59133d9280b0a 0001-disable-gcc-label-support-on-arm.patch
f4ac81930b305b8227c7ac6ae0d9fe94312e02b4b19792321414941a792cc770057b915f44bad8d48eb801604942c0d7bcad874558b1479c63485e16185ada4e 0002-always-build-shared-libs.patch
"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment