diff --git a/README.md b/README.md index 5ebff96..f9acfc1 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,8 @@ # liblinear +liblinear is a simple package for solving large-scale regularized linear classification and regression. +It currently supports: + - L2-regularized logistic regression/L2-loss support vector classification/L1-loss support vector classification + - L1-regularized L2-loss support vector classification/L1-regularized logistic regression + - L2-regularized L2-loss support vector regression/L1-loss support vector regression. + diff --git a/liblinear-1.96.makefile.patch b/liblinear-1.96.makefile.patch new file mode 100644 index 0000000..9e4079d --- /dev/null +++ b/liblinear-1.96.makefile.patch @@ -0,0 +1,53 @@ +--- liblinear-1.96/Makefile 2015-03-22 00:49:07.000000000 +0100 ++++ liblinear-1.96/Makefile.linux 2015-03-22 09:29:55.001697676 +0100 +@@ -1,37 +1,26 @@ + CXX ?= g++ +-CC ?= gcc +-CFLAGS = -Wall -Wconversion -O3 -fPIC +-LIBS = blas/blas.a ++CFLAGS_ADD = -Wall -Wconversion -O3 -fPIC ++LIBS = -lblas + SHVER = 2 +-OS = $(shell uname) +-#LIBS = -lblas ++SHARED_LIB_FLAGS= -shared -Wl,-soname,liblinear.so.$(SHVER) + + all: train predict + +-lib: linear.o tron.o blas/blas.a +- if [ "$(OS)" = "Darwin" ]; then \ +- SHARED_LIB_FLAG="-dynamiclib -Wl,-install_name,liblinear.so.$(SHVER)"; \ +- else \ +- SHARED_LIB_FLAG="-shared -Wl,-soname,liblinear.so.$(SHVER)"; \ +- fi; \ +- $(CXX) $${SHARED_LIB_FLAG} linear.o tron.o blas/blas.a -o liblinear.so.$(SHVER) ++lib: linear.o tron.o ++ $(CXX) $(SHARED_LIB_FLAGS) $(LDFLAGS) $(LIBS) linear.o tron.o -o liblinear.so.$(SHVER) ++ ln -fs liblinear.so.$(SHVER) liblinear.so + +-train: tron.o linear.o train.c blas/blas.a +- $(CXX) $(CFLAGS) -o train train.c tron.o linear.o $(LIBS) ++train: lib train.c ++ $(CXX) $(CFLAGS_ADD) $(CFLAGS) -o train train.c -L. -llinear + +-predict: tron.o linear.o predict.c blas/blas.a +- $(CXX) $(CFLAGS) -o predict predict.c tron.o linear.o $(LIBS) ++predict: lib predict.c ++ $(CXX) $(CFLAGS_ADD) $(CFLAGS) -o predict predict.c -L. -llinear + + tron.o: tron.cpp tron.h +- $(CXX) $(CFLAGS) -c -o tron.o tron.cpp ++ $(CXX) $(CFLAGS_ADD) $(CFLAGS) -c -o tron.o tron.cpp + + linear.o: linear.cpp linear.h +- $(CXX) $(CFLAGS) -c -o linear.o linear.cpp +- +-blas/blas.a: blas/*.c blas/*.h +- make -C blas OPTFLAGS='$(CFLAGS)' CC='$(CC)'; ++ $(CXX) $(CFLAGS_ADD) $(CFLAGS) -c -o linear.o linear.cpp + + clean: +- make -C blas clean +- make -C matlab clean +- rm -f *~ tron.o linear.o train predict liblinear.so.$(SHVER) ++ rm -f *~ tron.o linear.o train predict liblinear.so* diff --git a/liblinear.spec b/liblinear.spec new file mode 100644 index 0000000..52b6fa1 --- /dev/null +++ b/liblinear.spec @@ -0,0 +1,135 @@ +Name: liblinear +Version: 2.42 +Release: 1mamba +Summary: Development/Libraries +Group: System/Libraries +Vendor: openmamba +Distribution: openmamba +Packager: Davide Madrisan +URL: https://www.csie.ntu.edu.tw/~cjlin/liblinear +## GITSOURCE https://github.com/cjlin1/liblinear.git v196 +Source: https://github.com/cjlin1/liblinear.git/v196/liblinear-%{version}.tar.bz2 +Patch0: liblinear-1.96.makefile.patch +License: BSD +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: libblas-devel +BuildRequires: libgcc +#BuildRequires: libpython-devel +BuildRequires: libstdc++6-devel +## AUTOBUILDREQ-END +BuildRequires: gcc-c++ +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +liblinear is a simple package for solving large-scale regularized linear classification and regression. +It currently supports: + - L2-regularized logistic regression/L2-loss support vector classification/L1-loss support vector classification + - L1-regularized L2-loss support vector classification/L1-regularized logistic regression + - L2-regularized L2-loss support vector regression/L1-loss support vector regression. + +%package devel +Group: Development/Libraries +Summary: Development files for %{name} +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} +Requires: pkg-config + +%description devel +This package contains libraries and header files for developing applications that use %{name}. + +%package tools +Group: Applications/Mathematics +Summary: Utility applications for %{name} +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} + +%description tools +This package contains utility applications for %{name}. + +%package -n python-%{name} +Group: Development/Libraries/Python +Summary: Python bindings for %{name} +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} +Requires: python + +%description -n python-%{name} +%{summary}. + +%prep +%setup -q +%patch0 -p1 + +rm -rf blas/ windows/ + +# add pkg-config file +cat << _EOF >> %{name}.pc +Name: %{name} +Description: Library for Large Linear Classification +URL: %{url} +Version: 2.42 + +prefix=%{_prefix} +includedir=%{_includedir} + +Cflags: -I\${includedir}/liblinear +Libs: -llinear +_EOF + +%build +CFLAGS="%optflags -O3"; export CFLAGS +%make all lib + +python -m compileall -l python + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +mkdir -p %{buildroot}%{_bindir} +install -m 0755 predict %{buildroot}%{_bindir}/%{name}-predict +install -m 0755 train %{buildroot}%{_bindir}/%{name}-train + +mkdir -p %{buildroot}%{_libdir} +install liblinear.so* %{buildroot}%{_libdir}/ +mkdir -p %{buildroot}%{_libdir}/pkgconfig +install -m 0644 %{name}.pc %{buildroot}%{_libdir}/pkgconfig/ + +mkdir -p %{buildroot}%{_includedir}/%{name} +install -m 0644 {linear,tron}.h %{buildroot}%{_includedir}/%{name}/ + +mkdir -p %{buildroot}%{python_sitearch} +install -m 0644 python/*.py* %{buildroot}%{python_sitearch}/ + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%{_libdir}/*.so.* + +%files devel +%defattr(-,root,root) +%{_includedir}/%{name} +%{_libdir}/%{name}.so +%{_libdir}/pkgconfig/%{name}.pc +%doc README + +%files tools +%defattr(-,root,root) +%{_bindir}/%{name}-predict +%{_bindir}/%{name}-train + +%files -n python-%{name} +%defattr(-,root,root) +%{python_sitearch}/* + +%changelog +* Sun Feb 07 2021 Automatic Build System 2.42-1mamba +- automatic version update by autodist + +* Sun Mar 22 2015 Davide Madrisan 1.96-2mamba +- python-%{name}: provide the .pyc files + +* Sun Mar 22 2015 Davide Madrisan 1.96-1mamba +- package created by autospec