diff options
author | David Seifert <soap@gentoo.org> | 2022-05-14 23:30:24 +0200 |
---|---|---|
committer | David Seifert <soap@gentoo.org> | 2022-05-14 23:30:24 +0200 |
commit | 3413ca5341ea5ea6e4a39c228f684ee351534a56 (patch) | |
tree | 1bc04eeb18f260a2ad5e059db59ad4b8dce48cbc /sci-libs | |
parent | sci-libs/hypre: [QA] tc-has-openmp → tc-check-openmp (diff) | |
download | gentoo-3413ca5341ea5ea6e4a39c228f684ee351534a56.tar.gz gentoo-3413ca5341ea5ea6e4a39c228f684ee351534a56.tar.bz2 gentoo-3413ca5341ea5ea6e4a39c228f684ee351534a56.zip |
sci-libs/libsvm: [QA] tc-has-openmp → tc-check-openmp
Signed-off-by: David Seifert <soap@gentoo.org>
Diffstat (limited to 'sci-libs')
-rw-r--r-- | sci-libs/libsvm/files/libsvm-3.25-makefile.patch (renamed from sci-libs/libsvm/files/3.14-makefile.patch) | 38 | ||||
-rw-r--r-- | sci-libs/libsvm/files/libsvm-3.25-openmp.patch (renamed from sci-libs/libsvm/files/3.11-openmp.patch) | 12 | ||||
-rw-r--r-- | sci-libs/libsvm/libsvm-3.25-r1.ebuild (renamed from sci-libs/libsvm/libsvm-3.25.ebuild) | 33 |
3 files changed, 39 insertions, 44 deletions
diff --git a/sci-libs/libsvm/files/3.14-makefile.patch b/sci-libs/libsvm/files/libsvm-3.25-makefile.patch index e38dafc10b20..ea48368b27a5 100644 --- a/sci-libs/libsvm/files/3.14-makefile.patch +++ b/sci-libs/libsvm/files/libsvm-3.25-makefile.patch @@ -3,15 +3,13 @@ * propagate and respect user's LDFLAGS * PIC only used for the library * link the shared version library -nov 2012 - bicatali@gentoo.org ---- a/Makefile.orig 2012-11-29 10:39:07.149421728 -0800 -+++ b/Makefile 2012-11-29 10:57:19.727766521 -0800 -@@ -1,9 +1,12 @@ - CXX ?= g++ +--- a/Makefile ++++ b/Makefile +@@ -1,9 +1,10 @@ +-CXX ?= g++ -CFLAGS = -Wall -Wconversion -O3 -fPIC -+CC ?= gcc -+CFLAGS ?= -Wall -Wconversion -O3 ++CFLAGS ?= -Wall -Wconversion +CXXFLAGS ?= $(CFLAGS) SHVER = 2 OS = $(shell uname) @@ -22,30 +20,30 @@ nov 2012 - bicatali@gentoo.org lib: svm.o if [ "$(OS)" = "Darwin" ]; then \ -@@ -11,15 +14,20 @@ +@@ -11,15 +12,17 @@ else \ SHARED_LIB_FLAG="-shared -Wl,-soname,libsvm.so.$(SHVER)"; \ fi; \ - $(CXX) $${SHARED_LIB_FLAG} svm.o -o libsvm.so.$(SHVER) -+ $(CXX) $(LDFLAGS) $${SHARED_LIB_FLAG} svm.o -o libsvm.so.$(SHVER) ; \ ++ $(CXX) $(LDFLAGS) $${SHARED_LIB_FLAG} svm.o -o libsvm.so.$(SHVER) $(OPENMP_LIBS) ; \ + ln -s libsvm.so.$(SHVER) libsvm.so ++ ++svm-predict: svm-predict.o lib ++ $(CXX) $(LDFLAGS) $< -o $@ $(LIBS) -L. -lsvm -lm ++svm-train: svm-train.o lib ++ $(CXX) $(LDFLAGS) $< -o $@ $(LIBS) -L. -lsvm -lm ++svm-scale: svm-scale.o ++ $(CXX) $(LDFLAGS) $< -o $@ $(LIBS) - svm-predict: svm-predict.c svm.o +-svm-predict: svm-predict.c svm.o - $(CXX) $(CFLAGS) svm-predict.c svm.o -o svm-predict -lm -+ $(CC) $(CFLAGS) -c $@.c -o $@.o -+ $(CXX) $(LDFLAGS) $@.o svm.o -lm -o $@ - svm-train: svm-train.c svm.o +-svm-train: svm-train.c svm.o - $(CXX) $(CFLAGS) svm-train.c svm.o -o svm-train -lm -+ $(CC) $(CFLAGS) -c $@.c -o $@.o -+ $(CXX) $(LDFLAGS) $@.o svm.o -lm -o $@ - svm-scale: svm-scale.c +-svm-scale: svm-scale.c - $(CXX) $(CFLAGS) svm-scale.c -o svm-scale -+ $(CC) $(CFLAGS) -c $@.c -o $@.o -+ $(CXX) $(LDFLAGS) $@.o -o $@ -+ svm.o: svm.cpp svm.h - $(CXX) $(CFLAGS) -c svm.cpp -+ $(CXX) $(CXXFLAGS) $(PICFLAGS) -c svm.cpp -o $@ ++ $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(PICFLAGS) $(OPENMP_CFLAGS) -c svm.cpp -o $@ clean: - rm -f *~ svm.o svm-train svm-predict svm-scale libsvm.so.$(SHVER) + rm -f *~ svm.o svm-train svm-predict svm-scale libsvm.so.$(SHVER) libsvm.so diff --git a/sci-libs/libsvm/files/3.11-openmp.patch b/sci-libs/libsvm/files/libsvm-3.25-openmp.patch index e07b03e57380..1d12e198648e 100644 --- a/sci-libs/libsvm/files/3.11-openmp.patch +++ b/sci-libs/libsvm/files/libsvm-3.25-openmp.patch @@ -1,6 +1,6 @@ ---- a/svm.cpp.orig 2011-05-27 04:32:19.000000000 +0100 -+++ b/svm.cpp 2011-12-29 19:17:07.000000000 +0000 -@@ -1281,6 +1281,9 @@ +--- a/svm.cpp ++++ b/svm.cpp +@@ -1282,6 +1282,9 @@ int start, j; if((start = cache->get_data(i,&data,len)) < len) { @@ -10,7 +10,7 @@ for(j=start;j<len;j++) data[j] = (Qfloat)(y[i]*y[j]*(this->*kernel_function)(i,j)); } -@@ -2463,7 +2466,10 @@ +@@ -2506,7 +2509,10 @@ model->param.svm_type == NU_SVR) { double *sv_coef = model->sv_coef[0]; @@ -22,9 +22,9 @@ for(i=0;i<model->l;i++) sum += sv_coef[i] * Kernel::k_function(x,model->SV[i],model->param); sum -= model->rho[0]; -@@ -2480,6 +2486,9 @@ +@@ -2523,6 +2529,9 @@ int l = model->l; - + double *kvalue = Malloc(double,l); +#ifdef OPENMP +#pragma omp parallel for private(i) diff --git a/sci-libs/libsvm/libsvm-3.25.ebuild b/sci-libs/libsvm/libsvm-3.25-r1.ebuild index fb3107631476..78e21cefa8d4 100644 --- a/sci-libs/libsvm/libsvm-3.25.ebuild +++ b/sci-libs/libsvm/libsvm-3.25-r1.ebuild @@ -27,27 +27,16 @@ RDEPEND=" " PATCHES=( - "${FILESDIR}/3.11-openmp.patch" - "${FILESDIR}/3.14-makefile.patch" + "${FILESDIR}"/${PN}-3.25-openmp.patch + "${FILESDIR}"/${PN}-3.25-makefile.patch ) -pkg_setup() { - if use openmp; then - if ! tc-has-openmp; then - ewarn "OpenMP is not supported by your currently selected compiler" - - if tc-is-clang; then - ewarn "OpenMP support in sys-devel/clang is provided by sys-libs/libomp," - ewarn "which you will need to build ${CATEGORY}/${PN} for USE=\"openmp\"" - fi - - die "need openmp capable compiler" - fi +pkg_pretend() { + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp +} - append-cflags -fopenmp - append-cxxflags -fopenmp - append-cppflags -DOPENMP - fi +pkg_setup() { + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp } src_prepare() { @@ -66,6 +55,14 @@ src_prepare() { -e "s/JAVAC_FLAGS =/JAVAC_FLAGS=${JAVAC_FLAGS}/g" \ java/Makefile || die "Failed to fix java makefile" fi +} + +src_configure() { + if use openmp; then + export OPENMP_CFLAGS="-fopenmp -DOPENMP" + export OPENMP_LIBS="-fopenmp" + fi + tc-export CXX CC } |