Skip to content

Commit

Permalink
[RLIBM_32] Add builder (#3560)
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano authored Aug 27, 2021
1 parent 5ed8675 commit 1c2b605
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
37 changes: 37 additions & 0 deletions R/RLIBM_32/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder

name = "RLIBM_32"
version = v"0.0.1"

# Collection of sources required to complete build
sources = [
GitSource("https://github.com/rutgers-apl/rlibm-32.git",
"44560acbd2ee22242989bdac259ad3665fa85d06"),
DirectorySource("./bundled")
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/rlibm-32*
make -f ../Makefile -j${nproc}
make -f ../Makefile install
install_license LICENSE
"""

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

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

# Dependencies that must be installed before this package can be built
dependencies = Dependency[
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6")
31 changes: 31 additions & 0 deletions R/RLIBM_32/bundled/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
CC := gcc
CFLAGS := -std=c11 -O3 -fPIC

floatFNames = log log2 log10 exp exp2 exp10 sinh cosh sinpi cospi log2_8 log10_8

floatSrcDir = source/float
floatObjDir = obj/float
libDir = lib

floatSrc = $(patsubst %, $(floatSrcDir)/%.c, $(floatFNames))
floatObj = $(patsubst %, $(floatObjDir)/%.o, $(floatFNames))

all: floatmlib

$(floatObjDir)/%.o: $(floatSrcDir)/%.c
@mkdir -p $(floatObjDir)
$(CC) $(CFLAGS) -c $^ -Iinclude/ -o $@

$(libDir)/floatMathLib.$(dlext): $(floatObj)
@mkdir -p $(libDir)
$(CC) -shared $^ -o $@

install: all
install -Dm755 $(libDir)/floatMathLib.$(dlext) $(libdir)/floatMathLib.$(dlext)

floatmlib: $(libDir)/floatMathLib.$(dlext)

clean:
rm -rf obj lib *.dSYM

.PHONY: all clean floatmlib install

0 comments on commit 1c2b605

Please sign in to comment.