Skip to content

Commit

Permalink
add cif_api (#3375)
Browse files Browse the repository at this point in the history
* initial commit cif_api

* add c++ CFLAGS, add configure option to not build docs

* switch to LibraryProduct instead of ExecutableProduct

* add CPPFLAGS to help musl builds find sqlite3.h

* apply review changes

* move CPPFLAGS back to configure statement, add minimum of gcc v5

* switch CPPFLAGS back to export environment variable but with missing $ sign for exansion

* bump gcc version to 7 to make i686 work

* add patch for mingw install issues
  • Loading branch information
Crghilardi authored Jul 27, 2021
1 parent 3308d3c commit 3b85c4a
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
58 changes: 58 additions & 0 deletions C/cif_api/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg

name = "cif_api"
version = v"0.4.2"

# Collection of sources required to complete build
sources = [
ArchiveSource("https://github.com/COMCIFS/cif_api/archive/refs/tags/v0.4.2.tar.gz", "803fa1d0525bb51407754fa63b9439ba350178f45372103e84773ed4871b3924"),
DirectorySource("./bundled")
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/cif_api-*
update_configure_scripts
if [[ ${target} == *mingw* ]]; then
#remove win32 if branch to prevent file not found errors on make install?
atomic_patch -p1 ${WORKSPACE}/srcdir/patches/mingw-remove-install-hook.patch
autoreconf -vi
fi
#CPP flags needed to help *-musl-* builds configure scripts find sqlite3.h, unsure exactly why?
export CPPFLAGS="-I${includedir}"
./configure \
--prefix=${prefix} \
--libdir=${libdir} \
--includedir=${includedir} \
--build=${MACHTYPE} \
--host=${target} \
--with-docs=no \
make -j${nproc}
make install
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = expand_cxxstring_abis(supported_platforms())


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

# Dependencies that must be installed before this package can be built
dependencies = [
Dependency("ICU_jll"; compat="69.1")
Dependency(PackageSpec(name="SQLite_jll", uuid="76ed43ae-9a5d-5a62-8c75-30186b810ce8"))
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;preferred_gcc_version=v"7", julia_compat="1.6")
26 changes: 26 additions & 0 deletions C/cif_api/bundled/patches/mingw-remove-install-hook.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/src/Makefile.am b/src/Makefile.am
index 3f9794b..9ffde74 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -57,17 +57,10 @@ LIB_CURRENT = 2
LIB_REVISION = 0
LIB_AGE = 1

-if win32
- LIB_VERSION_FLAGS = -avoid-version
- INSTALL_HOOKS = install_import_lib
- UNINSTALL_HOOKS = uninstall_import_lib
- CLEANFILES = libcif.def
-else
- LIB_VERSION_FLAGS = -version-info $(LIB_CURRENT):$(LIB_REVISION):$(LIB_AGE)
- INSTALL_HOOKS =
- UNINSTALL_HOOKS =
- CLEANFILES =
-endif
+LIB_VERSION_FLAGS = -version-info $(LIB_CURRENT):$(LIB_REVISION):$(LIB_AGE)
+INSTALL_HOOKS =
+UNINSTALL_HOOKS =
+CLEANFILES =

BUILT_SOURCES = internal/schema.h internal/version.h
EXTRA_DIST = notes.txt style.txt

0 comments on commit 3b85c4a

Please sign in to comment.