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

add patch for LIBSVM 3.30 to pass $CFLAGS + $LDFLAGS and run tests #18454

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions easybuild/easyconfigs/l/LIBSVM/LIBSVM-3.30-GCCcore-11.3.0.eb
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,28 @@ description = """LIBSVM is an integrated software for support vector classificat
(epsilon-SVR, nu-SVR) and distribution estimation (one-class SVM). It supports multi-class classification."""

toolchain = {'name': 'GCCcore', 'version': '11.3.0'}
toolchainopts = {'openmp': True, 'pic': True}

github_account = 'cjlin1'
source_urls = [GITHUB_LOWER_SOURCE]
sources = ['v%s.tar.gz' % version.replace('.', '')]
patches = [
'LIBSVM-3.23_shared_lib.patch',
'LIBSVM-3.30_add_namespace_for_benefit_of_Xmipp.patch',
'LIBSVM-3.30_makefile_flags_test.patch'
]
checksums = [
{'v330.tar.gz': 'e4fe41308c87cc210aec73e4f5f0fb4da14234d90e7a131763fbad3788ca2d80'},
{'LIBSVM-3.23_shared_lib.patch': 'c0ede89365949644f5d7f11382a3f176fd76317c7f5ae5769226ff7c3a801fe6'},
{'LIBSVM-3.30_add_namespace_for_benefit_of_Xmipp.patch':
'f51e4d0b6899041799f43a09aad1e3711a93615a8cc453243042ed8357cabb28'},
{'LIBSVM-3.30_makefile_flags_test.patch': 'cec86f35714a2bf131d83eaaf4d4bbc53dd93e92d0d5a7b6751774d6d237daba'},
]

dependencies = [('binutils', '2.38')]

runtest = 'test'

local_bins = ['svm-%s' % x for x in ['predict', 'scale', 'train']]

files_to_copy = [
Expand All @@ -35,6 +40,12 @@ files_to_copy = [
'tools'
]

sanity_check_commands = [
'cd %%(builddir)s/libsvm-%s/ && svm-scale heart_scale' % version.replace('.', ''),
'cd %%(builddir)s/libsvm-%s/ && svm-train heart_scale' % version.replace('.', ''),
'cd %%(builddir)s/libsvm-%s/ && echo "1">t && svm-predict t heart_scale.model out' % version.replace('.', '')
]

sanity_check_paths = {
'files': ['bin/%s' % x for x in local_bins] + ['lib/libsvm.%s' % SHLIB_EXT],
'dirs': [],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Thomas Hoffmann, EMBL Heidelberg, structures-it@embl.de, 2023/08
# pass CFLAGS and LDFLAGS to make
# add target test
diff -ru libsvm-330/Makefile libsvm-330_flags/Makefile
--- libsvm-330/Makefile 2022-08-10 15:06:45.000000000 +0200
+++ libsvm-330_flags/Makefile 2023-08-03 10:57:04.906648202 +0200
@@ -1,5 +1,5 @@
CXX ?= g++
-CFLAGS = -Wall -Wconversion -O3 -fPIC
+CFLAGS ?= -Wall -Wconversion -O3 -fPIC
SHVER = 3
OS = $(shell uname)

@@ -9,7 +9,7 @@
if [ "$(OS)" = "Darwin" ]; then \
SHARED_LIB_FLAG="-dynamiclib -Wl,-install_name,libsvm.so.$(SHVER)"; \
else \
- SHARED_LIB_FLAG="-shared -Wl,-soname,libsvm.so.$(SHVER)"; \
+ SHARED_LIB_FLAG="-shared -Wl,-soname,libsvm.so.$(SHVER) $(LDFLAGS)"; \
fi; \
$(CXX) $${SHARED_LIB_FLAG} svm.o -o libsvm.so.$(SHVER)

@@ -23,3 +23,11 @@
$(CXX) $(CFLAGS) -c svm.cpp
clean:
rm -f *~ svm.o svm-train svm-predict svm-scale libsvm.so.$(SHVER)
+
+
+test:
+ ./svm-scale heart_scale
+ ./svm-train heart_scale
+ echo 1 > t
+ ./svm-predict t heart_scale.model out
+