From cde97be4f53860ff00e57744d83a1f98968f12cf Mon Sep 17 00:00:00 2001 From: Alexey Pavlov Date: Fri, 2 Feb 2018 12:15:53 +0300 Subject: [PATCH] libmysofa: New package --- .../001-mingw-dont-use-nuget.patch | 31 ++++++++++ mingw-w64-libmysofa/002-fix-exports.patch | 19 ++++++ .../003-install-import-library.patch | 10 ++++ .../004-pkg-config-support.patch | 58 +++++++++++++++++++ mingw-w64-libmysofa/PKGBUILD | 57 ++++++++++++++++++ 5 files changed, 175 insertions(+) create mode 100644 mingw-w64-libmysofa/001-mingw-dont-use-nuget.patch create mode 100644 mingw-w64-libmysofa/002-fix-exports.patch create mode 100644 mingw-w64-libmysofa/003-install-import-library.patch create mode 100644 mingw-w64-libmysofa/004-pkg-config-support.patch create mode 100644 mingw-w64-libmysofa/PKGBUILD diff --git a/mingw-w64-libmysofa/001-mingw-dont-use-nuget.patch b/mingw-w64-libmysofa/001-mingw-dont-use-nuget.patch new file mode 100644 index 0000000000..a30e5afef7 --- /dev/null +++ b/mingw-w64-libmysofa/001-mingw-dont-use-nuget.patch @@ -0,0 +1,31 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -12,24 +12,10 @@ + + configure_file (config.h.in ${CMAKE_SOURCE_DIR}/src/config.h) + +-if(NOT WIN32) +- find_library(MATH m) +- include(FindZLIB) +-else() +- set(MATH "") +- find_program(NUGET nuget) +- if (NUGET) +- execute_process(COMMAND ${NUGET} install zlib) +- endif() +- include_directories(${CMAKE_SOURCE_DIR}/windows/third-party/zlib-1.2.11/include/) +-endif() +- +-# include(FindZLIB) +-# include_directories(${ZLIB_INCLUDE_DIRS}) +-# MESSAGE(STATUS "ZLIB libs" ${ZLIB_LIBRARIES}) +- +-if(NOT WIN32) +- find_library(MATH m) ++if(NOT MSVC) ++ if (NOT MINGW) ++ find_library(MATH m) ++ endif() + include(FindZLIB) + else() + set(MATH "") diff --git a/mingw-w64-libmysofa/002-fix-exports.patch b/mingw-w64-libmysofa/002-fix-exports.patch new file mode 100644 index 0000000000..260f3385d8 --- /dev/null +++ b/mingw-w64-libmysofa/002-fix-exports.patch @@ -0,0 +1,19 @@ +--- libmysofa-0.6/src/CMakeLists.txt.orig 2018-02-02 11:43:26.245124100 +0300 ++++ libmysofa-0.6/src/CMakeLists.txt 2018-02-02 11:44:38.413003700 +0300 +@@ -35,6 +35,7 @@ + add_library(mysofa-static STATIC ${libsrc}) + target_link_libraries (mysofa-static ${MATH} ${ZLIB_LIBRARIES}) + SET_TARGET_PROPERTIES(mysofa-static PROPERTIES OUTPUT_NAME mysofa CLEAN_DIRECT_OUTPUT 1 POSITION_INDEPENDENT_CODE ON) ++target_compile_definitions(mysofa-static PUBLIC MYSOFA_STATIC_DEFINE) + install(TARGETS mysofa-static + ARCHIVE DESTINATION lib) + +@@ -66,7 +66,7 @@ + add_test(NAME external WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND external) + + add_executable(internal tests/internal.c tests/tools.c hrtf/tools.c) +- target_link_libraries (internal m ${CUNIT_LIBRARIES}) ++ target_link_libraries (internal mysofa-static m ${CUNIT_LIBRARIES}) + add_test(NAME internal WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND internal) + + diff --git a/mingw-w64-libmysofa/003-install-import-library.patch b/mingw-w64-libmysofa/003-install-import-library.patch new file mode 100644 index 0000000000..f20288051b --- /dev/null +++ b/mingw-w64-libmysofa/003-install-import-library.patch @@ -0,0 +1,10 @@ +--- libmysofa-0.6/src/CMakeLists.txt.orig 2018-02-02 11:43:26.245124100 +0300 ++++ libmysofa-0.6/src/CMakeLists.txt 2018-02-02 11:44:38.413003700 +0300 +@@ -49,6 +49,7 @@ + GENERATE_EXPORT_HEADER(mysofa-shared BASE_NAME mysofa EXPORT_FILE_NAME ${CMAKE_SOURCE_DIR}/src/hrtf/mysofa_export.h) + install(TARGETS mysofa-shared + RUNTIME DESTINATION bin ++ ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) + else() + GENERATE_EXPORT_HEADER(mysofa-static BASE_NAME mysofa EXPORT_FILE_NAME ${CMAKE_SOURCE_DIR}/src/hrtf/mysofa_export.h) diff --git a/mingw-w64-libmysofa/004-pkg-config-support.patch b/mingw-w64-libmysofa/004-pkg-config-support.patch new file mode 100644 index 0000000000..67dc35f9f3 --- /dev/null +++ b/mingw-w64-libmysofa/004-pkg-config-support.patch @@ -0,0 +1,58 @@ +From 0571940a31ad4e1bec944dbef834ee14b9f0c39a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= + +Date: Mon, 20 Nov 2017 16:38:47 +0100 +Subject: [PATCH] Initial pkg-config support + +Closes: https://github.com/hoene/libmysofa/issues/38 +--- + CMakeLists.txt | 12 ++++++++++++ + libmysofa.pc.cmake | 12 ++++++++++++ + 2 files changed, 24 insertions(+) + create mode 100644 libmysofa.pc.cmake + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ff83449..656539e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -18,6 +18,8 @@ SET(CPACK_PACKAGE_VERSION_MINOR "5") + SET(CPACK_PACKAGE_VERSION_PATCH "1") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "zlib1g") + ++SET(PROJECT_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") ++ + CHECK_C_COMPILER_FLAG(-Wall C_HAS_WALL) + IF(C_HAS_WALL) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") +@@ -51,3 +53,13 @@ endif(BUILD_TESTS) + add_subdirectory(src) + + INCLUDE(CPack) ++ ++CONFIGURE_FILE( ++ "${CMAKE_CURRENT_SOURCE_DIR}/libmysofa.pc.cmake" ++ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc" ++ @ONLY ++) ++install(FILES ++ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc" ++ DESTINATION "lib/pkgconfig" ++) +diff --git a/libmysofa.pc.cmake b/libmysofa.pc.cmake +new file mode 100644 +index 0000000..f5413a9 +--- /dev/null ++++ b/libmysofa.pc.cmake +@@ -0,0 +1,12 @@ ++Name: @PROJECT_NAME@ ++Description: @CPACK_PACKAGE_DESCRIPTION@ ++Version: @PROJECT_VERSION@ ++Requires: @PKG_CONFIG_REQUIRES@ ++prefix=@CMAKE_INSTALL_PREFIX@ ++includedir=${prefix}/include ++libdir=${prefix}/lib ++Libs: -L${libdir} -lmysofa ++Cflags: -I${includedir} ++ ++#Libs.private: ++#Requires.private: diff --git a/mingw-w64-libmysofa/PKGBUILD b/mingw-w64-libmysofa/PKGBUILD new file mode 100644 index 0000000000..0b0e2d28d3 --- /dev/null +++ b/mingw-w64-libmysofa/PKGBUILD @@ -0,0 +1,57 @@ +# Maintainer: Alexey Pavlov + +_realname=libmysofa +pkgbase=mingw-w64-${_realname} +pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") +pkgver=0.6 +pkgrel=1 +pkgdesc="Reader for AES SOFA files to get better HRTFs (mingw-w64)" +arch=('any') +url="https://github.com/hoene/libmysofa/" +depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs" + "${MINGW_PACKAGE_PREFIX}-zlib") +makedepends=("${MINGW_PACKAGE_PREFIX}-cmake" + "${MINGW_PACKAGE_PREFIX}-cunit" + "${MINGW_PACKAGE_PREFIX}-gcc" + "${MINGW_PACKAGE_PREFIX}-pkg-config") +license=('BSD') +source=("${_realname}-${pkgver}.tar.gz::https://github.com/hoene/libmysofa/archive/v${pkgver}.tar.gz" + 001-mingw-dont-use-nuget.patch + 002-fix-exports.patch + 003-install-import-library.patch + 004-pkg-config-support.patch) +sha256sums=('e39c34bd40d17aecdb962ba6ae533a3fa9d291da4db6972d0d6e023974a1c169' + 'c7b654d09cdae4ac284aa94057218c87cfe9248d59baf5b16d7e4860f1e8df0b' + '9dfa17c52abb87f3c4847ece316a35226b6aeb4e70e772225e22f609f7496bd1' + 'fdcae0ff9a8eeca9169dd530764945ecd0a872224453e4703bf40c705415216a' + '3cf61a0cb0df3ff2dc098f13e3318143f8812a85d554cbad21d0722719c42f62') + +prepare() { + cd "${srcdir}"/${_realname}-${pkgver} + patch -p1 -i ${srcdir}/001-mingw-dont-use-nuget.patch + patch -p1 -i ${srcdir}/002-fix-exports.patch + patch -p1 -i ${srcdir}/003-install-import-library.patch + patch -p1 -i ${srcdir}/004-pkg-config-support.patch +} + +build() { + [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH} + mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH} + + MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ + ${MINGW_PREFIX}/bin/cmake.exe \ + -G"MSYS Makefiles" \ + -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \ + -DBUILD_SHARED_LIBS=ON \ + "../${_realname}-${pkgver}" + + make +} + +package() { + cd "${srcdir}"/build-${CARCH} + make DESTDIR="${pkgdir}" install + + mkdir -p ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname} + cp ${srcdir}/${_realname}-${pkgver}/LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/ +}