[arch-commits] Commit in (7 files)

Daniel Bermond dbermond at archlinux.org
Thu Oct 3 11:51:12 UTC 2019


    Date: Thursday, October 3, 2019 @ 11:51:11
  Author: dbermond
Revision: 512489

Initial commit of libsvm

Added:
  libsvm/
  libsvm/repos/
  libsvm/trunk/
  libsvm/trunk/010-libsvm-fix-qt-headers-path.patch
  libsvm/trunk/020-libsvm-use-archlinux-flags.patch
  libsvm/trunk/030-libsvm-fix-tools-path.patch
  libsvm/trunk/PKGBUILD

--------------------------------------+
 010-libsvm-fix-qt-headers-path.patch |   12 ++++
 020-libsvm-use-archlinux-flags.patch |   47 +++++++++++++++++
 030-libsvm-fix-tools-path.patch      |   30 +++++++++++
 PKGBUILD                             |   87 +++++++++++++++++++++++++++++++++
 4 files changed, 176 insertions(+)

Added: libsvm/trunk/010-libsvm-fix-qt-headers-path.patch
===================================================================
--- libsvm/trunk/010-libsvm-fix-qt-headers-path.patch	                        (rev 0)
+++ libsvm/trunk/010-libsvm-fix-qt-headers-path.patch	2019-10-03 11:51:11 UTC (rev 512489)
@@ -0,0 +1,12 @@
+diff -Naurp a/svm-toy/qt/Makefile b/svm-toy/qt/Makefile
+--- a/svm-toy/qt/Makefile	2018-12-04 18:34:40.715220500 +0000
++++ b/svm-toy/qt/Makefile	2018-12-04 18:45:00.689709128 +0000
+@@ -1,7 +1,7 @@
+ # use  ``export QT_SELECT=qt5'' in a command window for using qt5
+ # may need to adjust the path of header files
+ CXX? = g++
+-INCLUDE = /usr/include/x86_64-linux-gnu/qt5
++INCLUDE = /usr/include/qt
+ CFLAGS = -Wall -O3 -I$(INCLUDE) -I$(INCLUDE)/QtWidgets -I$(INCLUDE)/QtGui -I$(INCLUDE)/QtCore -fPIC -std=c++11
+ LIB = -lQt5Widgets -lQt5Gui -lQt5Core
+ MOC = /usr/bin/moc

Added: libsvm/trunk/020-libsvm-use-archlinux-flags.patch
===================================================================
--- libsvm/trunk/020-libsvm-use-archlinux-flags.patch	                        (rev 0)
+++ libsvm/trunk/020-libsvm-use-archlinux-flags.patch	2019-10-03 11:51:11 UTC (rev 512489)
@@ -0,0 +1,47 @@
+diff -Naurp a/Makefile b/Makefile
+--- a/Makefile	2018-07-15 14:15:32.000000000 +0000
++++ b/Makefile	2018-12-04 18:32:24.627133671 +0000
+@@ -1,5 +1,5 @@
+ CXX ?= g++
+-CFLAGS = -Wall -Wconversion -O3 -fPIC
++CFLAGS += -Wall -Wconversion -fPIC
+ SHVER = 2
+ OS = $(shell uname)
+ 
+@@ -11,14 +11,14 @@ lib: svm.o
+ 	else \
+ 		SHARED_LIB_FLAG="-shared -Wl,-soname,libsvm.so.$(SHVER)"; \
+ 	fi; \
+-	$(CXX) $${SHARED_LIB_FLAG} svm.o -o libsvm.so.$(SHVER)
++	$(CXX) $${SHARED_LIB_FLAG} svm.o -o libsvm.so.$(SHVER) $(LDFLAGS)
+ 
+ svm-predict: svm-predict.c svm.o
+-	$(CXX) $(CFLAGS) svm-predict.c svm.o -o svm-predict -lm
++	$(CXX) $(CFLAGS) svm-predict.c svm.o -o svm-predict -lm $(LDFLAGS)
+ svm-train: svm-train.c svm.o
+-	$(CXX) $(CFLAGS) svm-train.c svm.o -o svm-train -lm
++	$(CXX) $(CFLAGS) svm-train.c svm.o -o svm-train -lm $(LDFLAGS)
+ svm-scale: svm-scale.c
+-	$(CXX) $(CFLAGS) svm-scale.c -o svm-scale
++	$(CXX) $(CFLAGS) svm-scale.c -o svm-scale $(LDFLAGS)
+ svm.o: svm.cpp svm.h
+ 	$(CXX) $(CFLAGS) -c svm.cpp
+ clean:
+diff -Naurp a/svm-toy/qt/Makefile b/svm-toy/qt/Makefile
+--- a/svm-toy/qt/Makefile	2018-12-04 18:34:40.715220500 +0000
++++ b/svm-toy/qt/Makefile	2018-12-04 18:40:33.446873531 +0000
+@@ -2,12 +2,12 @@
+ # may need to adjust the path of header files
+ CXX? = g++
+ INCLUDE = /usr/include/qt
+-CFLAGS = -Wall -O3 -I$(INCLUDE) -I$(INCLUDE)/QtWidgets -I$(INCLUDE)/QtGui -I$(INCLUDE)/QtCore -fPIC -std=c++11
++CFLAGS += -Wall -I$(INCLUDE) -I$(INCLUDE)/QtWidgets -I$(INCLUDE)/QtGui -I$(INCLUDE)/QtCore -fPIC -std=c++11
+ LIB = -lQt5Widgets -lQt5Gui -lQt5Core
+ MOC = /usr/bin/moc
+ 
+ svm-toy: svm-toy.cpp svm-toy.moc ../../svm.o
+-	$(CXX) $(CFLAGS) svm-toy.cpp ../../svm.o -o svm-toy $(LIB)
++	$(CXX) $(CFLAGS) svm-toy.cpp ../../svm.o -o svm-toy $(LIB) $(LDFLAGS)
+ 
+ svm-toy.moc: svm-toy.cpp
+ 	$(MOC) svm-toy.cpp -o svm-toy.moc

Added: libsvm/trunk/030-libsvm-fix-tools-path.patch
===================================================================
--- libsvm/trunk/030-libsvm-fix-tools-path.patch	                        (rev 0)
+++ libsvm/trunk/030-libsvm-fix-tools-path.patch	2019-10-03 11:51:11 UTC (rev 512489)
@@ -0,0 +1,30 @@
+diff -up ./tools/easy.py.toolsDir ./tools/easy.py
+--- ./tools/easy.py.toolsDir	2013-03-31 17:06:49.000000000 +1000
++++ ./tools/easy.py	2013-04-13 23:17:53.399526910 +1000
+@@ -12,10 +12,10 @@ if len(sys.argv) <= 1:
+
+ is_win32 = (sys.platform == 'win32')
+ if not is_win32:
+-	svmscale_exe = "../svm-scale"
+-	svmtrain_exe = "../svm-train"
+-	svmpredict_exe = "../svm-predict"
+-	grid_py = "./grid.py"
++	svmscale_exe = "/usr/bin/svm-scale"
++	svmtrain_exe = "/usr/bin/svm-train"
++	svmpredict_exe = "/usr/bin/svm-predict"
++	grid_py = "/usr/bin/svm-grid.py"
+ 	gnuplot_exe = "/usr/bin/gnuplot"
+ else:
+         # example for windows
+diff -up ./tools/grid.py.toolsDir ./tools/grid.py
+--- ./tools/grid.py.toolsDir	2013-03-31 17:06:50.000000000 +1000
++++ ./tools/grid.py	2013-04-13 23:18:53.964522769 +1000
+@@ -18,7 +18,7 @@ class GridOption:
+ 	def __init__(self, dataset_pathname, options):
+ 		dirname = os.path.dirname(__file__)
+ 		if sys.platform != 'win32':
+-			self.svmtrain_pathname = os.path.join(dirname, '../svm-train')
++			self.svmtrain_pathname = '/usr/bin/svm-train'
+ 			self.gnuplot_pathname = '/usr/bin/gnuplot'
+ 		else:
+ 			# example for windows

Added: libsvm/trunk/PKGBUILD
===================================================================
--- libsvm/trunk/PKGBUILD	                        (rev 0)
+++ libsvm/trunk/PKGBUILD	2019-10-03 11:51:11 UTC (rev 512489)
@@ -0,0 +1,87 @@
+# Maintainer : Daniel Bermond <dbermond at archlinux.org>
+# Contributor: saxonbeta <saxonbeta at gmail>
+# Contributor: Pierre Gueth <pierre.gueth at gmail>
+# Contributor: Daniel YC Lin <dlin.tw at gmail>
+# Contributor: Tim Huetz <tim at huetz biz>
+
+pkgname=libsvm
+pkgver=3.24
+_srcver="${pkgver/./}"
+pkgrel=1
+pkgdesc='A library for Support Vector Machines classification (includes binaries and bindings for python and java)'
+arch=('x86_64')
+url='https://www.csie.ntu.edu.tw/~cjlin/libsvm/'
+license=('BSD')
+depends=('gcc-libs')
+makedepends=('qt5-base' 'python')
+optdepends=('qt5-base: for Qt5 interface with svm-toy'
+            'python: for python modules and python CLI tools'
+            'gnuplot: for using svm-easy.py'
+            'java-runtime: for java bindings')
+source=("${pkgname}-${pkgver}.tar.gz"::"https://github.com/cjlin1/libsvm/archive/v${_srcver}.tar.gz"
+        '010-libsvm-fix-qt-headers-path.patch'
+        '020-libsvm-use-archlinux-flags.patch'
+        '030-libsvm-fix-tools-path.patch')
+sha256sums=('3ba1ac74ee08c4dd57d3a9e4a861ffb57dab88c6a33fd53eac472fc84fbb2a8f'
+            '01d28d48ca955921cff3ee39e6235fbcbe6f13587c056b05797388afc0c45432'
+            'ba986c03199445ec0a9d1d113f54753e61f691ad4c66cad80b1f7d6ccf0c2d17'
+            '58338a8eac252459c665eb6f1f03f4b86cd541b2c6942357329be022f3bb6fce')
+
+prepare() {
+    patch -d "${pkgname}-${_srcver}" -Np1 -i "${srcdir}/010-libsvm-fix-qt-headers-path.patch"
+    patch -d "${pkgname}-${_srcver}" -Np1 -i "${srcdir}/020-libsvm-use-archlinux-flags.patch"
+    patch -d "${pkgname}-${_srcver}" -Np1 -i "${srcdir}/030-libsvm-fix-tools-path.patch"
+}
+
+build() {
+    cd "${pkgname}-${_srcver}"
+    
+    printf '%s\n' '  -> Building library and CLI binaries...'
+    make lib all
+    
+    printf '%s\n' '  -> Building Qt5 interface...'
+    make -C svm-toy/qt
+}
+
+package() {
+    cd "${pkgname}-${_srcver}"
+    
+    local _pyver
+    local _sover
+    _pyver="$(python -c 'import sys; print("%s.%s" %sys.version_info[0:2])')"
+    _sover="$(find . -maxdepth 1 -type f -regextype posix-basic -regex '.*/libsvm.so.[0-9]*$' | awk -F'.' '{ print $NF }')"
+    
+    # binaries
+    install -D -m755 svm-predict        -t "${pkgdir}/usr/bin"
+    install -D -m755 svm-scale          -t "${pkgdir}/usr/bin"
+    install -D -m755 svm-train          -t "${pkgdir}/usr/bin"
+    install -D -m755 svm-toy/qt/svm-toy -t "${pkgdir}/usr/bin"
+    
+    # library
+    install -D -m755 "libsvm.so.${_sover}" -t "${pkgdir}/usr/lib"
+    ln -s "libsvm.so.${_sover}" "${pkgdir}/usr/lib/libsvm.so"
+    
+    # header
+    install -D -m644 svm.h -t "${pkgdir}/usr/include/libsvm"
+    
+    # python modules
+    ## NOTE: 'grid.py' can be used either as a python module or a CLI/tool
+    ## https://github.com/cjlin1/libsvm/blob/v324/tools/README#L163-L164
+    install -D -m644 python/commonutil.py -t "${pkgdir}/usr/lib/python${_pyver}/site-packages/libsvm"
+    install -D -m644 python/svm.py        -t "${pkgdir}/usr/lib/python${_pyver}/site-packages/libsvm"
+    install -D -m644 python/svmutil.py    -t "${pkgdir}/usr/lib/python${_pyver}/site-packages/libsvm"
+    ln -s ../../../../bin/svm-grid.py        "${pkgdir}/usr/lib/python${_pyver}/site-packages/libsvm/grid.py"
+    printf '' | install -D -m644 /dev/stdin  "${pkgdir}/usr/lib/python${_pyver}/site-packages/libsvm/__init__.py"
+    
+    # python CLI/tools
+    install -D -m755 tools/checkdata.py "${pkgdir}/usr/bin/svm-checkdata.py"
+    install -D -m755 tools/easy.py      "${pkgdir}/usr/bin/svm-easy.py"
+    install -D -m755 tools/grid.py      "${pkgdir}/usr/bin/svm-grid.py"
+    install -D -m755 tools/subset.py    "${pkgdir}/usr/bin/svm-subset.py"
+    
+    # java
+    install -D -m644 java/libsvm.jar -t "${pkgdir}/usr/share/java"
+    
+    # license
+    install -D -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+}


Property changes on: libsvm/trunk/PKGBUILD
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property



More information about the arch-commits mailing list