Skip to content

Commit

Permalink
msolve: more platforms, enable OpenMP
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Oct 22, 2021
1 parent 9c7b8e5 commit 2ab5941
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 14 deletions.
38 changes: 24 additions & 14 deletions M/msolve/build_tarballs.jl
Expand Up @@ -9,41 +9,51 @@ version = v"0.1.4"
sources = [
GitSource("https://gitlab.lip6.fr/safey/msolve.git", "be5a34d338d6ba66a5be2e67e93871b184789e87"),
#= ArchiveSource("https://www.mathematik.uni-kl.de/~ederc/msolve-0.1.2.tar.gz", "ce6454b28477cb3b5670042faf7b3282e234fe1e0ee5a62c184d0512ef4126e1") =#
DirectorySource("./bundled"),
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir
cd msolve/
./autogen.sh
ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes ./configure --with-gnu-ld --prefix=${prefix} --build=${MACHTYPE} --host=${target} --disable-openmp
atomic_patch -p1 ${WORKSPACE}/srcdir/patches/sort_r.patch
export CPPFLAGS="-I${includedir}"
#CONFIGFLAGS="--disable-openmp"
if [[ "${target}" == *-linux* ]]; then
CONFIGFLAGS=""
elif [[ "${target}" == *-apple* ]]; then
CONFIGFLAGS=""
else
CONFIGFLAGS=""
fi
ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes ./configure --with-gnu-ld --prefix=${prefix} --build=${MACHTYPE} --host=${target} ${CONFIGFLAGS}
make -j${nprocs}
make install
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = [
Platform("i686", "linux"; libc = "glibc"),
Platform("x86_64", "linux"; libc = "glibc"),
Platform("aarch64", "linux"; libc = "glibc"),
Platform("armv7l", "linux"; call_abi = "eabihf", libc = "glibc"),
Platform("powerpc64le", "linux"; libc = "glibc"),
Platform("x86_64", "macos"; )
]

platforms = supported_platforms(; experimental=true)
#filter!(p -> libc(p) != "musl", platforms)
#filter!(!Sys.isfreebsd, platforms)
filter!(!Sys.iswindows, platforms) # no FLINT_jll available

# The products that we will ensure are always built
products = [
LibraryProduct("libmsolve", :libmsolve),
LibraryProduct("libneogb", :libneogb)
LibraryProduct("libneogb", :libneogb),
]

# Dependencies that must be installed before this package can be built
dependencies = [
Dependency(PackageSpec(name="GMP_jll", uuid="781609d7-10c4-51f6-84f2-b8444358ff6d"), v"6.1.2"; compat="6.1.2")
Dependency(PackageSpec(name="FLINT_jll"), compat = "~200.800")
Dependency(PackageSpec(name="MPFR_jll", uuid="3a97d323-0669-5f0c-9066-3539efd106a3"))
Dependency("GMP_jll", v"6.2.0"),
Dependency("FLINT_jll", compat = "~200.800"),
Dependency("MPFR_jll", v"4.1.1"),
Dependency("CompilerSupportLibraries_jll"),
]

# Build the tarballs, and possibly a `build.jl` as well.
Expand Down
27 changes: 27 additions & 0 deletions M/msolve/bundled/patches/sort_r.patch
@@ -0,0 +1,27 @@
From 9c21db960fa677970d1cdd1d82d9e77b350fcb4f Mon Sep 17 00:00:00 2001
From: Max Horn <max@quendi.de>
Date: Fri, 22 Oct 2021 23:30:31 +0200
Subject: [PATCH] Fix sort_r.h on muslc

qsort_r is glibc specific, not Linux specific
---
src/neogb/sort_r.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/neogb/sort_r.h b/src/neogb/sort_r.h
index 7db3b64..b31435b 100644
--- a/src/neogb/sort_r.h
+++ b/src/neogb/sort_r.h
@@ -47,8 +47,7 @@ void sort_r(void *base, size_t nel, size_t width,
#if (defined __APPLE__ || defined __MACH__ || defined __DARWIN__ || \
defined __FreeBSD__ || defined __DragonFly__)
# define _SORT_R_BSD
-#elif (defined _GNU_SOURCE || defined __gnu_hurd__ || defined __GNU__ || \
- defined __linux__ || defined __MINGW32__ || defined __GLIBC__)
+#elif (defined __MINGW32__ || defined __GLIBC__)
# define _SORT_R_LINUX
#elif (defined _WIN32 || defined _WIN64 || defined __WINDOWS__)
# define _SORT_R_WINDOWS
--
2.33.1

0 comments on commit 2ab5941

Please sign in to comment.