diff --git a/armadillo-install-pkgconfig.patch b/armadillo-install-pkgconfig.patch new file mode 100644 index 0000000..3a56904 --- /dev/null +++ b/armadillo-install-pkgconfig.patch @@ -0,0 +1,66 @@ +Index: armadillo-7.500.0/misc/armadillo.pc.in +=================================================================== +--- /dev/null ++++ armadillo-7.500.0/misc/armadillo.pc.in +@@ -0,0 +1,11 @@ ++prefix=@CMAKE_INSTALL_PREFIX@ ++exec_prefix=${prefix} ++libdir=@INSTALL_LIB_DIR@ ++includedir=@INSTALL_INCLUDE_DIR@ ++ ++Name: armadillo ++Description: A fast and user-friendly C++ linear algebra library ++URL: http://arma.sourceforge.net ++Version: @ARMA_VERSION_MAJOR@.@ARMA_VERSION_MINOR@.@ARMA_VERSION_PATCH@ ++Cflags: -I${includedir} ++Libs: -L${libdir} -larmadillo +Index: armadillo-7.500.0/CMakeLists.txt +=================================================================== +--- armadillo-7.500.0.orig/CMakeLists.txt ++++ armadillo-7.500.0/CMakeLists.txt +@@ -270,6 +269,11 @@ if(DETECT_HDF5) + endif() + endif() + ++# Install pkgconfig file if pkg-config is found on system ++find_package(PkgConfig) ++if (PKG_CONFIG_FOUND) ++ set(ARMA_INSTALL_PKGCONFIG true) ++endif() + + include(ARMA_FindARPACK) + message(STATUS "ARPACK_FOUND = ${ARPACK_FOUND}") +@@ -403,6 +407,11 @@ if(NOT INSTALL_BIN_DIR) + set(INSTALL_BIN_DIR "bin") + endif() + ++# pkgconfig install dir ++if(ARMA_INSTALL_PKGCONFIG) ++ set(PKGCONFIG_DIR ${INSTALL_LIB_DIR}/pkgconfig) ++endif() ++ + # Make relative paths absolute so we can write them in Config.cmake files + foreach(p LIB INCLUDE DATA BIN) + set(var INSTALL_${p}_DIR) +@@ -452,6 +460,11 @@ message(STATUS "Generating '${PROJECT_BI + configure_file(${PROJECT_SOURCE_DIR}/cmake_aux/InstallFiles/ArmadilloConfigVersion.cmake.in + "${PROJECT_BINARY_DIR}/ArmadilloConfigVersion.cmake" @ONLY) + ++if(ARMA_INSTALL_PKGCONFIG) ++ message(STATUS "Generating '${PROJECT_BINARY_DIR}/misc/armadillo.pc'") ++ configure_file(${PROJECT_SOURCE_DIR}/misc/armadillo.pc.in ++ "${PROJECT_SOURCE_DIR}/misc/armadillo.pc" @ONLY) ++endif() + + # Install the export set for use with the install-tree + install(EXPORT ArmadilloLibraryDepends DESTINATION +@@ -481,3 +494,9 @@ install(FILES + "${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfig.cmake" + "${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfigVersion.cmake" + DESTINATION "${ARMADILLO_CMAKE_DIR}" COMPONENT dev) ++ ++# Install pkgconfig file if wanted ++if(ARMA_INSTALL_PKGCONFIG) ++ install(FILES "${PROJECT_SOURCE_DIR}/misc/armadillo.pc" ++ DESTINATION "${PKGCONFIG_DIR}") ++endif() diff --git a/armadillo-tests.patch b/armadillo-tests.patch new file mode 100644 index 0000000..5546c7a --- /dev/null +++ b/armadillo-tests.patch @@ -0,0 +1,87 @@ +Index: armadillo-7.500.0/tests/Makefile.in +=================================================================== +--- /dev/null ++++ armadillo-7.500.0/tests/Makefile.in +@@ -0,0 +1,38 @@ ++ ++LIB_FLAGS = -L@PROJECT_SOURCE_DIR@ -larmadillo ++ ++ifeq (${ARMA_USE_LAPACK},true) ++ LIB_FLAGS += -llapack ++endif ++ifeq (${ARMA_USE_BLAS},true) ++ LIB_FLAGS += -lblas ++endif ++ifeq (${ARMA_USE_SUPERLU},true) ++ LIB_FLAGS += -lsuperlu ++endif ++ifeq (${ARMA_USE_ARPACK},true) ++ LIB_FLAGS += -larpack ++endif ++ ++#LIB_FLAGS = -lblas -llapack ++#LIB_FLAGS = -lopenblas -llapack ++ ++CXX_FLAGS = -I@PROJECT_SOURCE_DIR@/include -std=c++11 -Wshadow -Wall -pedantic -O0 ++#CXX_FLAGS = -std=c++11 -Wshadow -Wall -pedantic -O0 -DARMA_DONT_USE_WRAPPER ++#CXX_FLAGS = -std=c++11 -Wshadow -Wall -pedantic -O2 ++ ++OBJECTS = $(patsubst %.cpp,%.o,$(wildcard *.cpp)) ++ ++%.o: %.cpp $(DEPS) ++ $(CXX) $(CXX_FLAGS) -o $@ -c $< ++ ++main: $(OBJECTS) ++ $(CXX) $(CXX_FLAGS) -o $@ $(OBJECTS) $(LIB_FLAGS) ++ ++ ++all: main ++ ++.PHONY: clean ++ ++clean: ++ rm -f main *.o +Index: armadillo-7.500.0/CMakeLists.txt +=================================================================== +--- armadillo-7.500.0.orig/CMakeLists.txt ++++ armadillo-7.500.0/CMakeLists.txt +@@ -453,6 +453,10 @@ set(ARMADILLO_LIB_DIR "${PROJECT_BI + set(ARMADILLO_CMAKE_DIR "${PROJECT_BINARY_DIR}") + + ++# Configure tests/Makefile.in for running tests without installing first ++message(STATUS "Configuring tests/Makefile") ++configure_file(${PROJECT_SOURCE_DIR}/tests/Makefile.in ${PROJECT_SOURCE_DIR}/tests/Makefile) ++ + message(STATUS "Generating '${PROJECT_BINARY_DIR}/ArmadilloConfig.cmake'") + # copy/change config and configVersion file (modify only the @xyz@ variables) + configure_file(${PROJECT_SOURCE_DIR}/cmake_aux/InstallFiles/ArmadilloConfig.cmake.in +Index: armadillo-7.500.0/tests/Makefile +=================================================================== +--- armadillo-7.500.0.orig/tests/Makefile ++++ /dev/null +@@ -1,24 +0,0 @@ +- +-LIB_FLAGS = -larmadillo +-#LIB_FLAGS = -lblas -llapack +-#LIB_FLAGS = -lopenblas -llapack +- +-CXX_FLAGS = -std=c++11 -Wshadow -Wall -pedantic -O0 +-#CXX_FLAGS = -std=c++11 -Wshadow -Wall -pedantic -O0 -DARMA_DONT_USE_WRAPPER +-#CXX_FLAGS = -std=c++11 -Wshadow -Wall -pedantic -O2 +- +-OBJECTS = $(patsubst %.cpp,%.o,$(wildcard *.cpp)) +- +-%.o: %.cpp $(DEPS) +- $(CXX) $(CXX_FLAGS) -o $@ -c $< $ +- +-main: $(OBJECTS) +- $(CXX) $(CXX_FLAGS) -o $@ $(OBJECTS) $(LIB_FLAGS) +- +- +-all: main +- +-.PHONY: clean +- +-clean: +- rm -f main *.o diff --git a/armadillo.changes b/armadillo.changes index 2e8b8be..fe731b2 100644 --- a/armadillo.changes +++ b/armadillo.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Sat Oct 29 10:05:40 UTC 2016 - badshah400@gmail.com + +- Add armadillo-install-pkgconfig.patch: Generate and install a + pkgconfig file (PATCH-FEATURE-OPENSUSE for now, but in + discussions with upstream to have this included). +- Add armadillo-tests.patch: Generate tests/Makefile by + configuring tests/Makefile.in using cmake so that the tests can + be run before actually installing the library. Then, use a + make check section to test the built library + (PATCH-FEATURE-OPENSUSE for now, but in discussions with + upstream to have this included). + ------------------------------------------------------------------- Mon Oct 24 13:16:30 UTC 2016 - badshah400@gmail.com diff --git a/armadillo.spec b/armadillo.spec index d3416fe..53e4f07 100644 --- a/armadillo.spec +++ b/armadillo.spec @@ -17,7 +17,6 @@ %define soname libarmadillo7 - Name: armadillo Version: 7.500.0 Release: 0 @@ -27,11 +26,16 @@ Group: Development/Libraries/C and C++ Url: http://arma.sourceforge.net/ Source: http://downloads.sourceforge.net/arma/%{name}-%{version}.tar.xz Source2: baselibs.conf +# PATCH-FEATURE-OPENSUSE armadillo-install-pkgconfig.patch badshah400@gmail.com -- Generate and install a pkgconfig file +Patch0: armadillo-install-pkgconfig.patch +# PATCH-FEATURE-OPENSUSE armadillo-tests.patch badshah400@gmail.com -- Generate tests/Makefile by configuring tests/Makefile.in using cmake so that the tests can be run before actually installing the library; patch sent upstream +Patch1: armadillo-tests.patch BuildRequires: arpack-ng-devel BuildRequires: blas-devel BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: lapack-devel +BuildRequires: pkgconfig BuildRequires: superlu-devel >= 5.2 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -127,6 +131,8 @@ and user documentation (reference guide). %prep %setup -q +%patch0 -p1 +%patch1 -p1 #Convert DOS end-of-line to UNIX end-of-line sed -i 's/\r//' README.txt sed -i 's/\r//' LICENSE.txt @@ -146,6 +152,12 @@ rm -rf examples/example1_win64.* rm -rf examples/example2_win64.* rm -rf examples/lib_win64 +%check +pushd tests +make %{?_smp_mflags} +./main +popd + %post -n %{soname} -p /sbin/ldconfig %postun -n %{soname} -p /sbin/ldconfig @@ -163,6 +175,7 @@ rm -rf examples/lib_win64 %files devel %defattr(-,root,root) %{_libdir}/*.so +%{_libdir}/pkgconfig/%{name}.pc %{_includedir}/armadillo %{_includedir}/armadillo_bits/ %{_datadir}/Armadillo/