Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New recipe: catchaMouse16-v0.1.0 #9151

Merged
merged 23 commits into from
Aug 13, 2024
Merged
Changes from 13 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
af764e2
New recipe: catchaMouse16-v0.1.0
brendanjohnharris Jul 26, 2024
0f2f6a2
Exclude windows
brendanjohnharris Jul 26, 2024
881a1a5
Change compiler to generic 'cc'
brendanjohnharris Jul 26, 2024
a781228
Change to command substitutions
brendanjohnharris Jul 26, 2024
f450b21
Set make job count
brendanjohnharris Jul 26, 2024
08a2fd0
Specify GSL_jll version (~2.7.2)
brendanjohnharris Jul 26, 2024
7a4e01b
Use install instead of cp
brendanjohnharris Jul 26, 2024
de4a56e
Use make install target and lower Julia compat to LTS
brendanjohnharris Jul 26, 2024
46efde0
Standardize output name
brendanjohnharris Jul 26, 2024
e580151
Use command substitutions
brendanjohnharris Jul 26, 2024
b7b7bfc
Use c11 to avoid warnings
brendanjohnharris Jul 26, 2024
36bf85d
Use gcc for apple (?)
brendanjohnharris Jul 26, 2024
c8250ee
Remove windows again
brendanjohnharris Jul 26, 2024
3446673
Hopeful fix for macos and windows
brendanjohnharris Jul 26, 2024
2179afd
Enable all platforms
brendanjohnharris Jul 27, 2024
41b1456
Extra flags for macos fix
brendanjohnharris Jul 27, 2024
f2d9cbb
Add extra flags in right place
brendanjohnharris Jul 27, 2024
7897772
Clean up makefile
brendanjohnharris Jul 30, 2024
069f8c3
Add headerpad flag
brendanjohnharris Jul 30, 2024
b3b5abd
Headerpad flag for all machines
brendanjohnharris Jul 30, 2024
4deeb30
Fix src file finding
brendanjohnharris Jul 31, 2024
9fc6681
Update C/catchaMouse16/build_tarballs.jl
brendanjohnharris Aug 13, 2024
14ff2cc
Merge branch 'master' into catchaMouse16
brendanjohnharris Aug 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions C/catchaMouse16/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# 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 = "catchaMouse16"
version = v"0.1.0"

# Collection of sources required to complete build
sources = [
GitSource("https://github.com/DynamicsAndNeuralSystems/catchaMouse16.git",
"2a952451acf6114de562da6007e37ff6e013b157")
]

# Bash recipe for building across all platforms
makefile = raw"""
CC = gcc
giordano marked this conversation as resolved.
Show resolved Hide resolved
CFLAGS = -std=c11 -fPIC -Wall -Wextra -g -O2 -lm -lgsl -lgslcblas
LDFLAGS = -shared -lm -lgsl -lgslcblas
RM = rm -f
TARGET_LIB = "lib$(SRC_NAME).$(dlext)"

SRCS = main.c fft.c stats.c helper_functions.c histcounts.c CO_AddNoise.c CO_AutoCorr.c CO_HistogramAMI.c CO_NonlinearAutocorr.c CO_TranslateShape.c DN_RemovePoints.c FC_LoopLocalSimple.c IN_AutoMutualInfoStats.c PH_Walker.c SC_FluctAnal.c ST_LocalExtrema.c SY_DriftingMean.c SY_SlidingWindow.c
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe do https://github.com/DynamicsAndNeuralSystems/catchaMouse16/blob/56ad41b669a750df3be60d008010c8a84a5cf4bd/C/Makefile#L18 instead of listing the files manually? This isn't very sustainable if the source code upstream changes.


OBJS = $(SRCS:.c=.o)
.PHONY: all;
all: ${TARGET_LIB}
$(TARGET_LIB): $(OBJS)
$(CC) ${LDFLAGS} -o $@ $^
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linking order is important, see for example https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed#Importance_of_linking_order (this may fix the issue on Windows):

Suggested change
$(CC) ${LDFLAGS} -o $@ $^
$(CC) -o $@ $^ $(LDFLAGS)

$(SRCS:.c=.d):%.d:%.c
$(CC) $(CFLAGS) -MM $< >$@\ninclude $(SRCS:.c=.d)
.PHONY: clean
clean:-${RM} ${TARGET_LIB} ${OBJS} $(SRCS:.c=.d)
.PHONY: install
install:
install -Dvm 755 "./lib${SRC_NAME}.$(dlext)" "$(libdir)/lib$(SRC_NAME).$(dlext)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
clean:-${RM} ${TARGET_LIB} ${OBJS} $(SRCS:.c=.d)
.PHONY: install
install:
install -Dvm 755 "./lib${SRC_NAME}.$(dlext)" "$(libdir)/lib$(SRC_NAME).$(dlext)"
clean:-$(RM) $(TARGET_LIB) $(OBJS) $(SRCS:.c=.d)
.PHONY: install
install:
install -Dvm 755 "./lib$(SRC_NAME).$(dlext)" "$(libdir)/lib$(SRC_NAME).$(dlext)"

"""
script = raw"""
cd $WORKSPACE/srcdir
cd catchaMouse16/C/src/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cd $WORKSPACE/srcdir
cd catchaMouse16/C/src/
cd ${WORKSPACE}/srcdir/catchaMouse16/C/src/

echo -e '""" * makefile * raw"""' >> Makefile
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 = supported_platforms(; exclude=Sys.iswindows)

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

# Dependencies that must be installed before this package can be built
dependencies = [Dependency("GSL_jll"; compat="~2.7.2")]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;
preferred_gcc_version = v"9.1.0", julia_compat = "1.6")