From acccad4dbb6f2eaaf17953e74495bb4b3c5b2076 Mon Sep 17 00:00:00 2001 From: Amir Mohammadi <183.amir@gmail.com> Date: Wed, 13 Apr 2016 21:29:31 +0200 Subject: [PATCH 1/6] Add libsvm --- recipes/libsvm/bld.bat | 12 ++++++++++++ recipes/libsvm/build.sh | 10 ++++++++++ recipes/libsvm/meta.yaml | 30 ++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 recipes/libsvm/bld.bat create mode 100644 recipes/libsvm/build.sh create mode 100644 recipes/libsvm/meta.yaml diff --git a/recipes/libsvm/bld.bat b/recipes/libsvm/bld.bat new file mode 100644 index 0000000000000..d2d5259501980 --- /dev/null +++ b/recipes/libsvm/bld.bat @@ -0,0 +1,12 @@ +REM Clean First +nmake /f Makefile.win clean all + +REM Build step +nmake /f Makefile.win lib +if errorlevel 1 exit 1 + +REM Install step +copy libsvm.dll %LIBRARY_LIB%\ +if errorlevel 1 exit 1 +copy svm.h %LIBRARY_INC%\ +if errorlevel 1 exit 1 diff --git a/recipes/libsvm/build.sh b/recipes/libsvm/build.sh new file mode 100644 index 0000000000000..d5124c3268aa6 --- /dev/null +++ b/recipes/libsvm/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +make lib +# there is no make check or something similar and no make install + +mkdir -p $PREFIX/share/licenses/libsvm $PREFIX/lib $PREFIX/include +install -m644 libsvm.so.* $PREFIX/lib/ +install -m644 svm.h $PREFIX/include/svm.h +install -m644 COPYRIGHT $PREFIX/share/licenses/libsvm/LICENSE +ln -s libsvm.so.* $PREFIX/lib/libsvm.so diff --git a/recipes/libsvm/meta.yaml b/recipes/libsvm/meta.yaml new file mode 100644 index 0000000000000..2a90da4a25298 --- /dev/null +++ b/recipes/libsvm/meta.yaml @@ -0,0 +1,30 @@ +{% set version = "3.21" %} +{% set flatversion = "%s" % version.replace(".", "") %} + +package: + name: libsvm + version: {{ version }} + +source: + fn: libsvm-{{ flatversion }}.tar.gz + url: https://github.com/cjlin1/libsvm/archive/v{{ flatversion }}.tar.gz + md5: acff2c058b7cb38a135fa5d0b4f39e43 + +build: + number: 0 + +test: + commands: + - test -e $PREFIX/include/svm.h # [unix] + - test -e $PREFIX/lib/libsvm.so # [unix] + - test -e $PREFIX/lib/libsvm.so.2 # [unix] + - if not exist %PREFIX%\\Library\\lib\\libsvm.dll exit 1 # [win] + +about: + home: https://github.com/cjlin1/libsvm + license: Modified BSD License (3-clause) + summary: A simple, easy-to-use, and efficient software for SVM classification and regression. + +extra: + recipe-maintainers: + - 183amir From 378ea5ca46fbc30d9e1ac3ca2f648c9a2198aa0b Mon Sep 17 00:00:00 2001 From: Patrick Snape Date: Thu, 14 Apr 2016 11:51:18 +0200 Subject: [PATCH 2/6] Fixes Windows Add Windows builds + testing. --- recipes/libsvm/bld.bat | 21 +++++++++------------ recipes/libsvm/build.sh | 6 +++++- recipes/libsvm/meta.yaml | 26 ++++++++++++++++++++++---- recipes/libsvm/win32.patch | 7 +++++++ 4 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 recipes/libsvm/win32.patch diff --git a/recipes/libsvm/bld.bat b/recipes/libsvm/bld.bat index d2d5259501980..e25c049aa8ad0 100644 --- a/recipes/libsvm/bld.bat +++ b/recipes/libsvm/bld.bat @@ -1,12 +1,9 @@ -REM Clean First -nmake /f Makefile.win clean all - -REM Build step -nmake /f Makefile.win lib -if errorlevel 1 exit 1 - -REM Install step -copy libsvm.dll %LIBRARY_LIB%\ -if errorlevel 1 exit 1 -copy svm.h %LIBRARY_INC%\ -if errorlevel 1 exit 1 +nmake /f Makefile.win all +if errorlevel 1 exit 1 + +REM Install step +copy windows\libsvm.dll %LIBRARY_LIB%\libsvm.dll +xcopy windows\*.exe %LIBRARY_BIN%\ +if errorlevel 1 exit 1 +copy svm.h %LIBRARY_INC%\svm.h +if errorlevel 1 exit 1 diff --git a/recipes/libsvm/build.sh b/recipes/libsvm/build.sh index d5124c3268aa6..71acfbbceb79d 100644 --- a/recipes/libsvm/build.sh +++ b/recipes/libsvm/build.sh @@ -1,10 +1,14 @@ #!/bin/bash +make all make lib # there is no make check or something similar and no make install -mkdir -p $PREFIX/share/licenses/libsvm $PREFIX/lib $PREFIX/include +mkdir -p $PREFIX/share/licenses/libsvm $PREFIX/lib $PREFIX/include $PREFIX/bin install -m644 libsvm.so.* $PREFIX/lib/ install -m644 svm.h $PREFIX/include/svm.h install -m644 COPYRIGHT $PREFIX/share/licenses/libsvm/LICENSE +install -m755 svm-train $PREFIX/bin/ +install -m755 svm-scale $PREFIX/bin/ +install -m755 svm-predict $PREFIX/bin/ ln -s libsvm.so.* $PREFIX/lib/libsvm.so diff --git a/recipes/libsvm/meta.yaml b/recipes/libsvm/meta.yaml index 2a90da4a25298..b5294743b64a7 100644 --- a/recipes/libsvm/meta.yaml +++ b/recipes/libsvm/meta.yaml @@ -1,5 +1,5 @@ {% set version = "3.21" %} -{% set flatversion = "%s" % version.replace(".", "") %} +{% set flatversion = version.replace(".", "") %} package: name: libsvm @@ -10,14 +10,31 @@ source: url: https://github.com/cjlin1/libsvm/archive/v{{ flatversion }}.tar.gz md5: acff2c058b7cb38a135fa5d0b4f39e43 + patches: + - win32.patch # [win32] + build: number: 0 + features: + - vc9 # [win and py27] + - vc10 # [win and py34] + - vc14 # [win and py35] + +test: + requires: + - python {{ environ['PY_VER'] + '*' }} # [win] test: commands: - - test -e $PREFIX/include/svm.h # [unix] - - test -e $PREFIX/lib/libsvm.so # [unix] - - test -e $PREFIX/lib/libsvm.so.2 # [unix] + - test -e $PREFIX/include/svm.h # [unix] + - test -e $PREFIX/lib/libsvm.so # [unix] + - test -e $PREFIX/lib/libsvm.so.2 # [unix] + - svm-train | grep 'Usage' # [unix] + - svm-scale | grep 'Usage' # [unix] + - svm-predict | grep 'Usage' # [unix] + - svm-train | find "Usage" # [win] + - svm-scale | find "Usage" # [win] + - svm-predict | find "Usage" # [win] - if not exist %PREFIX%\\Library\\lib\\libsvm.dll exit 1 # [win] about: @@ -28,3 +45,4 @@ about: extra: recipe-maintainers: - 183amir + - patricksnape diff --git a/recipes/libsvm/win32.patch b/recipes/libsvm/win32.patch new file mode 100644 index 0000000000000..64da2e72c1302 --- /dev/null +++ b/recipes/libsvm/win32.patch @@ -0,0 +1,7 @@ +--- Makefile.win ++++ Makefile.win +@@ -7,3 +7,3 @@ + CXX = cl.exe +-CFLAGS = /nologo /O2 /EHsc /I. /D _WIN64 /D _CRT_SECURE_NO_DEPRECATE ++CFLAGS = /nologo /O2 /EHsc /I. /D _WIN32 /D _CRT_SECURE_NO_DEPRECATE + TARGET = windows From 4b3175df190a9c7ef660155de0b5e22d0cbbb499 Mon Sep 17 00:00:00 2001 From: Patrick Snape Date: Thu, 14 Apr 2016 12:59:55 +0100 Subject: [PATCH 3/6] Merge Error Fix There were two test sections which was obviously a mistake. --- recipes/libsvm/meta.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/libsvm/meta.yaml b/recipes/libsvm/meta.yaml index b5294743b64a7..413d38b5b5c84 100644 --- a/recipes/libsvm/meta.yaml +++ b/recipes/libsvm/meta.yaml @@ -22,9 +22,8 @@ build: test: requires: - - python {{ environ['PY_VER'] + '*' }} # [win] + - python {{ environ['PY_VER'] + '*' }} # [win] -test: commands: - test -e $PREFIX/include/svm.h # [unix] - test -e $PREFIX/lib/libsvm.so # [unix] From 5e2f3d952651b7977369462053d8f4eff80fe7c7 Mon Sep 17 00:00:00 2001 From: Patrick Snape Date: Thu, 14 Apr 2016 18:22:27 +0100 Subject: [PATCH 4/6] Add clean and error check Clean was removed before because otherwise it throws an error because some of the directories it tries to delete don't exist. But it does seem to correctly delete the shipped exe and dlls. --- recipes/libsvm/bld.bat | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/libsvm/bld.bat b/recipes/libsvm/bld.bat index e25c049aa8ad0..af987e54a7456 100644 --- a/recipes/libsvm/bld.bat +++ b/recipes/libsvm/bld.bat @@ -1,8 +1,9 @@ -nmake /f Makefile.win all +nmake /f Makefile.win clean all if errorlevel 1 exit 1 REM Install step copy windows\libsvm.dll %LIBRARY_LIB%\libsvm.dll +if errorlevel 1 exit 1 xcopy windows\*.exe %LIBRARY_BIN%\ if errorlevel 1 exit 1 copy svm.h %LIBRARY_INC%\svm.h From d1f720b43f33ec29155637ba4eed5f33acd72c3a Mon Sep 17 00:00:00 2001 From: Patrick Snape Date: Thu, 14 Apr 2016 18:32:41 +0100 Subject: [PATCH 5/6] Python build and test But no selector. --- recipes/libsvm/meta.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/recipes/libsvm/meta.yaml b/recipes/libsvm/meta.yaml index 413d38b5b5c84..48700c38a3bb0 100644 --- a/recipes/libsvm/meta.yaml +++ b/recipes/libsvm/meta.yaml @@ -20,9 +20,13 @@ build: - vc10 # [win and py34] - vc14 # [win and py35] +requirements: + build: + - python # [win] + test: requires: - - python {{ environ['PY_VER'] + '*' }} # [win] + - python # [win] commands: - test -e $PREFIX/include/svm.h # [unix] From c8cd2fe52ee9c0f8ebb04e39c18c0415d14df5ac Mon Sep 17 00:00:00 2001 From: Patrick Snape Date: Thu, 14 Apr 2016 22:15:46 +0200 Subject: [PATCH 6/6] Re-add PY_VER Jinja --- recipes/libsvm/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/libsvm/meta.yaml b/recipes/libsvm/meta.yaml index 48700c38a3bb0..86ef421ae5b8f 100644 --- a/recipes/libsvm/meta.yaml +++ b/recipes/libsvm/meta.yaml @@ -26,7 +26,7 @@ requirements: test: requires: - - python # [win] + - python {{ environ['PY_VER'] + '*' }} # [win] commands: - test -e $PREFIX/include/svm.h # [unix]