From 9059f07e45c4ce77c23289880f282db22f15287d Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Wed, 8 Jul 2020 15:19:39 +0200 Subject: [PATCH 1/3] Initial import for libmysofa --- .gitignore | 1 + libmysofa.spec | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 95 insertions(+) create mode 100644 .gitignore create mode 100644 libmysofa.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40acb68 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +libmysofa-*.tar.gz diff --git a/libmysofa.spec b/libmysofa.spec new file mode 100644 index 0000000..cc9f203 --- /dev/null +++ b/libmysofa.spec @@ -0,0 +1,93 @@ +Name: libmysofa +Version: 1.1 +Release: 1%{?dist} +Summary: C functions for reading HRTFs + +License: BSD +URL: https://github.com/hoene/libmysofa +Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz +# See https://github.com/hoene/libmysofa/pull/127 +Patch0: libmysofa-no_static.patch + +BuildRequires: cmake3 +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: pkgconfig(cunit) +BuildRequires: pkgconfig(zlib) +# for tests +BuildRequires: nodejs + + +%description +This is a simple set of C functions to read AES SOFA files, if they +contain HRTFs stored according to the AES69-2015 standard. + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +The %{name}-devel package contains libraries and header files for +developing applications that use %{name}. + +%package -n mysofa +Summary: Tools for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description -n mysofa +Tools for %{name}. + + +%prep +%autosetup -p1 + + +%build +mkdir -p build +cd build +%cmake3 \ + -DBUILD_STATIC_LIBS=OFF \ + -DCODE_COVERAGE=OFF \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ + .. + +%make_build + + +%install +cd build +%make_install + + +%check +cd build +make test + + +%ldconfig_scriptlets + + +%files +%license LICENSE +%doc README.md +%{_libdir}/libmysofa.so.1* + +%files -n mysofa +%{_bindir}/mysofa2json +%dir %{_datadir}/libmysofa +%{_datadir}/libmysofa/default.sofa +%{_datadir}/libmysofa/MIT_KEMAR_normal_pinna.sofa + +%files devel +%doc CODE_OF_CONDUCT.md +%{_includedir}/mysofa.h +%{_libdir}/libmysofa.so +%{_libdir}/pkgconfig/libmysofa.pc + + +%changelog +* Mon Jun 29 2020 Nicolas Chauvet - 1.1-1 +- Update to 1.1 + +* Mon Apr 13 2020 Nicolas Chauvet - 1.0-1 +- Initial spec file diff --git a/sources b/sources new file mode 100644 index 0000000..3146b02 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (libmysofa-1.1.tar.gz) = 8feafbf447f21f3ef5a283f5f494a647dd5db47cc43af4cc26efeae9f8684c93f5aa1131d8c5570d1d7811c3e3b08763fabdfad2beff0858eeb3cb78dda22332 From bc0149a6029adbb3ba55a73fb41c0165d278ed0d Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Wed, 8 Jul 2020 15:21:56 +0200 Subject: [PATCH 2/3] Add patch --- libmysofa-no_static.patch | 87 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 libmysofa-no_static.patch diff --git a/libmysofa-no_static.patch b/libmysofa-no_static.patch new file mode 100644 index 0000000..a840252 --- /dev/null +++ b/libmysofa-no_static.patch @@ -0,0 +1,87 @@ +diff -up libmysofa-1.1/CMakeLists.txt.static libmysofa-1.1/CMakeLists.txt +--- libmysofa-1.1/CMakeLists.txt.static 2020-06-13 17:02:13.000000000 +0200 ++++ libmysofa-1.1/CMakeLists.txt 2020-07-08 10:13:45.639569055 +0200 +@@ -7,6 +7,7 @@ include(GNUInstallDirs) + + option(BUILD_TESTS "Build test programs" ON) + option(BUILD_SHARED_LIBS "Build shared library" ON) ++option(BUILD_STATIC_LIBS "Build static library" OFF) + option(CODE_COVERAGE "Enable coverage reporting" ON) + + set(CPACK_PACKAGE_DESCRIPTION "SOFA file reader for better HRTFs") +diff -up libmysofa-1.1/src/CMakeLists.txt.static libmysofa-1.1/src/CMakeLists.txt +--- libmysofa-1.1/src/CMakeLists.txt.static 2020-06-13 17:02:13.000000000 +0200 ++++ libmysofa-1.1/src/CMakeLists.txt 2020-07-08 10:18:22.885044829 +0200 +@@ -75,6 +75,7 @@ set(libsrc + hrtf/easy.c + hrtf/cache.c + resampler/speex_resampler.c) ++if(BUILD_STATIC_LIBS) + add_library(mysofa-static STATIC ${libsrc}) + target_link_libraries(mysofa-static LINK_PRIVATE ${MATH} ${ZLIB_LIBRARIES}) + set_target_properties( +@@ -83,15 +84,16 @@ set_target_properties( + ON) + install(TARGETS mysofa-static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +-if(UNIX +- AND CODE_COVERAGE +- AND CMAKE_CXX_COMPILER_ID MATCHES "GNU") +- target_compile_options(mysofa-static PUBLIC -g -O0 -Wall -fprofile-arcs +- -ftest-coverage) +- if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) +- target_link_options(mysofa-static PUBLIC --coverage) +- else() +- target_link_libraries(mysofa-static LINK_PUBLIC gcov --coverage) ++ if(UNIX ++ AND CODE_COVERAGE ++ AND CMAKE_CXX_COMPILER_ID MATCHES "GNU") ++ target_compile_options(mysofa-static PUBLIC -g -O0 -Wall -fprofile-arcs ++ -ftest-coverage) ++ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) ++ target_link_options(mysofa-static PUBLIC --coverage) ++ else() ++ target_link_libraries(mysofa-static LINK_PUBLIC gcov --coverage) ++ endif() + endif() + endif() + +@@ -137,7 +139,11 @@ install(FILES hrtf/mysofa.h DESTINATION + + if(BUILD_TESTS) + add_executable(mysofa2json tests/sofa2json.c tests/json.c) +- target_link_libraries(mysofa2json mysofa-static) ++ if(BUILD_STATIC_LIBS) ++ target_link_libraries(mysofa2json mysofa-static) ++ else() ++ target_link_libraries(mysofa2json mysofa-shared) ++ endif() + + add_executable( + external +@@ -159,7 +159,11 @@ if(BUILD_TESTS) + tests/cache.c + tests/json.c + tests/user_defined_variable.c) +- target_link_libraries(external mysofa-static ${CUNIT_LIBRARIES}) ++ if(BUILD_STATIC_LIBS) ++ target_link_libraries(external mysofa-static ${CUNIT_LIBRARIES}) ++ else() ++ target_link_libraries(external mysofa-shared ${CUNIT_LIBRARIES} m) ++ endif() + add_test( + NAME external + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} +@@ -173,7 +177,11 @@ if(BUILD_TESTS) + COMMAND internal) + + add_executable(multithread tests/multithread.c) +- target_link_libraries(multithread mysofa-static pthread) ++ if(BUILD_STATIC_LIBS) ++ target_link_libraries(multithread mysofa-static pthread) ++ else() ++ target_link_libraries(multithread mysofa-shared pthread m) ++ endif() + add_test( + NAME multithread + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} From d376c77356b23fc3d9091027238af079eb20d374 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Wed, 8 Jul 2020 22:19:57 +0200 Subject: [PATCH 3/3] Handle to disable tests --- libmysofa.spec | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/libmysofa.spec b/libmysofa.spec index cc9f203..a22429e 100644 --- a/libmysofa.spec +++ b/libmysofa.spec @@ -1,3 +1,14 @@ +# Some tests are failing: +# https://github.com/hoene/libmysofa/issues/129 +%ifarch s390x +%global _without_tests 1 +%endif +%if 0%{?el7:1} +%ifarch ppc64le +%global _without_tests 1 +%endif +%endif + Name: libmysofa Version: 1.1 Release: 1%{?dist} @@ -15,7 +26,7 @@ BuildRequires: gcc-c++ BuildRequires: pkgconfig(cunit) BuildRequires: pkgconfig(zlib) # for tests -BuildRequires: nodejs +%{?!_without_tests:BuildRequires: nodejs} %description @@ -59,9 +70,11 @@ cd build %make_install +%{?!_without_tests: %check cd build -make test +make test || (cat Testing/Temporary/LastTest.log && exit 1) +} %ldconfig_scriptlets