From d737aed714af9e8711b080f6cad5bf98fa93a3d4 Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Sun, 4 Jul 2021 11:09:52 +0530 Subject: [PATCH] libmysofa: Fix dllexport attribute for exported functions This fixes clang build --- .../004-fix-dllexport-attribute.patch | 137 ++++++++++++++++++ mingw-w64-libmysofa/PKGBUILD | 9 +- 2 files changed, 143 insertions(+), 3 deletions(-) create mode 100644 mingw-w64-libmysofa/004-fix-dllexport-attribute.patch diff --git a/mingw-w64-libmysofa/004-fix-dllexport-attribute.patch b/mingw-w64-libmysofa/004-fix-dllexport-attribute.patch new file mode 100644 index 0000000000..d1a93f3774 --- /dev/null +++ b/mingw-w64-libmysofa/004-fix-dllexport-attribute.patch @@ -0,0 +1,137 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -88,6 +88,7 @@ + if(BUILD_SHARED_LIBS) + add_library(mysofa-shared SHARED ${libsrc}) + target_link_libraries(mysofa-shared PRIVATE ${MATH} ${ZLIB_LIBRARIES}) ++ target_compile_definitions(mysofa-shared PRIVATE mysofa_shared_EXPORTS) + set_target_properties(mysofa-shared + PROPERTIES OUTPUT_NAME mysofa CLEAN_DIRECT_OUTPUT 1) + set_property( +@@ -124,7 +125,7 @@ + ${PROJECT_SOURCE_DIR}/src/hrtf/mysofa_export.h) + endif() + +-install(FILES hrtf/mysofa.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ++install(FILES hrtf/mysofa.h;hrtf/mysofa_export.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + + if(BUILD_TESTS) + add_executable(mysofa2json tests/sofa2json.c tests/json.c) +--- a/src/hrtf/mysofa.h ++++ b/src/hrtf/mysofa.h +@@ -12,6 +12,7 @@ + + #include + #include ++#include "mysofa_export.h" + + #define MYSOFA_DEFAULT_NEIGH_STEP_ANGLE 0.5f + #define MYSOFA_DEFAULT_NEIGH_STEP_RADIUS 0.01f +@@ -126,43 +127,43 @@ + MYSOFA_ONLY_SOURCES_WITH_MC_SUPPORTED + }; + +-struct MYSOFA_HRTF *mysofa_load(const char *filename, int *err); ++MYSOFA_EXPORT struct MYSOFA_HRTF *mysofa_load(const char *filename, int *err); + +-int mysofa_check(struct MYSOFA_HRTF *hrtf); +-char *mysofa_getAttribute(struct MYSOFA_ATTRIBUTE *attr, char *name); +-void mysofa_tospherical(struct MYSOFA_HRTF *hrtf); +-void mysofa_tocartesian(struct MYSOFA_HRTF *hrtf); +-void mysofa_free(struct MYSOFA_HRTF *hrtf); +- +-struct MYSOFA_LOOKUP *mysofa_lookup_init(struct MYSOFA_HRTF *hrtf); +-int mysofa_lookup(struct MYSOFA_LOOKUP *lookup, float *coordinate); +-void mysofa_lookup_free(struct MYSOFA_LOOKUP *lookup); ++MYSOFA_EXPORT int mysofa_check(struct MYSOFA_HRTF *hrtf); ++MYSOFA_EXPORT char *mysofa_getAttribute(struct MYSOFA_ATTRIBUTE *attr, char *name); ++MYSOFA_EXPORT void mysofa_tospherical(struct MYSOFA_HRTF *hrtf); ++MYSOFA_EXPORT void mysofa_tocartesian(struct MYSOFA_HRTF *hrtf); ++MYSOFA_EXPORT void mysofa_free(struct MYSOFA_HRTF *hrtf); ++ ++MYSOFA_EXPORT struct MYSOFA_LOOKUP *mysofa_lookup_init(struct MYSOFA_HRTF *hrtf); ++MYSOFA_EXPORT int mysofa_lookup(struct MYSOFA_LOOKUP *lookup, float *coordinate); ++MYSOFA_EXPORT void mysofa_lookup_free(struct MYSOFA_LOOKUP *lookup); + +-struct MYSOFA_NEIGHBORHOOD * ++MYSOFA_EXPORT struct MYSOFA_NEIGHBORHOOD * + mysofa_neighborhood_init(struct MYSOFA_HRTF *hrtf, + struct MYSOFA_LOOKUP *lookup); +-struct MYSOFA_NEIGHBORHOOD *mysofa_neighborhood_init_withstepdefine( ++MYSOFA_EXPORT struct MYSOFA_NEIGHBORHOOD *mysofa_neighborhood_init_withstepdefine( + struct MYSOFA_HRTF *hrtf, struct MYSOFA_LOOKUP *lookup, + float neighbor_angle_step, float neighbor_radius_step); +-int *mysofa_neighborhood(struct MYSOFA_NEIGHBORHOOD *neighborhood, int pos); +-void mysofa_neighborhood_free(struct MYSOFA_NEIGHBORHOOD *neighborhood); ++MYSOFA_EXPORT int *mysofa_neighborhood(struct MYSOFA_NEIGHBORHOOD *neighborhood, int pos); ++MYSOFA_EXPORT void mysofa_neighborhood_free(struct MYSOFA_NEIGHBORHOOD *neighborhood); + +-float *mysofa_interpolate(struct MYSOFA_HRTF *hrtf, float *cordinate, ++MYSOFA_EXPORT float *mysofa_interpolate(struct MYSOFA_HRTF *hrtf, float *cordinate, + int nearest, int *neighborhood, float *fir, + float *delays); + +-int mysofa_resample(struct MYSOFA_HRTF *hrtf, float samplerate); +-float mysofa_loudness(struct MYSOFA_HRTF *hrtf); +-int mysofa_minphase(struct MYSOFA_HRTF *hrtf, float threshold); ++MYSOFA_EXPORT int mysofa_resample(struct MYSOFA_HRTF *hrtf, float samplerate); ++MYSOFA_EXPORT float mysofa_loudness(struct MYSOFA_HRTF *hrtf); ++MYSOFA_EXPORT int mysofa_minphase(struct MYSOFA_HRTF *hrtf, float threshold); + +-struct MYSOFA_EASY *mysofa_cache_lookup(const char *filename, float samplerate); +-struct MYSOFA_EASY *mysofa_cache_store(struct MYSOFA_EASY *, ++MYSOFA_EXPORT struct MYSOFA_EASY *mysofa_cache_lookup(const char *filename, float samplerate); ++MYSOFA_EXPORT struct MYSOFA_EASY *mysofa_cache_store(struct MYSOFA_EASY *, + const char *filename, float samplerate); +-void mysofa_cache_release(struct MYSOFA_EASY *); +-void mysofa_cache_release_all(void); ++MYSOFA_EXPORT void mysofa_cache_release(struct MYSOFA_EASY *); ++MYSOFA_EXPORT void mysofa_cache_release_all(void); + +-void mysofa_c2s(float *values); +-void mysofa_s2c(float *values); ++MYSOFA_EXPORT void mysofa_c2s(float *values); ++MYSOFA_EXPORT void mysofa_s2c(float *values); + + struct MYSOFA_EASY { + struct MYSOFA_HRTF *hrtf; +@@ -171,29 +172,29 @@ + float *fir; + }; + +-struct MYSOFA_EASY *mysofa_open(const char *filename, float samplerate, ++MYSOFA_EXPORT struct MYSOFA_EASY *mysofa_open(const char *filename, float samplerate, + int *filterlength, int *err); +-struct MYSOFA_EASY *mysofa_open_no_norm(const char *filename, float samplerate, ++MYSOFA_EXPORT struct MYSOFA_EASY *mysofa_open_no_norm(const char *filename, float samplerate, + int *filterlength, int *err); +-struct MYSOFA_EASY *mysofa_open_advanced(const char *filename, float samplerate, ++MYSOFA_EXPORT struct MYSOFA_EASY *mysofa_open_advanced(const char *filename, float samplerate, + int *filterlength, int *err, bool norm, + float neighbor_angle_step, + float neighbor_radius_step); +-struct MYSOFA_EASY *mysofa_open_cached(const char *filename, float samplerate, ++MYSOFA_EXPORT struct MYSOFA_EASY *mysofa_open_cached(const char *filename, float samplerate, + int *filterlength, int *err); +-void mysofa_getfilter_short(struct MYSOFA_EASY *easy, float x, float y, float z, ++MYSOFA_EXPORT void mysofa_getfilter_short(struct MYSOFA_EASY *easy, float x, float y, float z, + short *IRleft, short *IRright, int *delayLeft, + int *delayRight); +-void mysofa_getfilter_float(struct MYSOFA_EASY *easy, float x, float y, float z, ++MYSOFA_EXPORT void mysofa_getfilter_float(struct MYSOFA_EASY *easy, float x, float y, float z, + float *IRleft, float *IRright, float *delayLeft, + float *delayRight); +-void mysofa_getfilter_float_nointerp(struct MYSOFA_EASY *easy, float x, float y, ++MYSOFA_EXPORT void mysofa_getfilter_float_nointerp(struct MYSOFA_EASY *easy, float x, float y, + float z, float *IRleft, float *IRright, + float *delayLeft, float *delayRight); +-void mysofa_close(struct MYSOFA_EASY *easy); +-void mysofa_close_cached(struct MYSOFA_EASY *easy); ++MYSOFA_EXPORT void mysofa_close(struct MYSOFA_EASY *easy); ++MYSOFA_EXPORT void mysofa_close_cached(struct MYSOFA_EASY *easy); + +-void mysofa_getversion(int *major, int *minor, int *patch); ++MYSOFA_EXPORT void mysofa_getversion(int *major, int *minor, int *patch); + + #ifdef __cplusplus + } diff --git a/mingw-w64-libmysofa/PKGBUILD b/mingw-w64-libmysofa/PKGBUILD index 6507cb7e50..e71c003fa3 100644 --- a/mingw-w64-libmysofa/PKGBUILD +++ b/mingw-w64-libmysofa/PKGBUILD @@ -7,7 +7,7 @@ pkgver=1.2 pkgrel=1 pkgdesc="Reader for AES SOFA files to get better HRTFs (mingw-w64)" arch=('any') -mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64') +mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32') url="https://github.com/hoene/libmysofa/" depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs" "${MINGW_PACKAGE_PREFIX}-zlib") @@ -19,17 +19,20 @@ 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) + 003-install-import-library.patch + 004-fix-dllexport-attribute.patch) sha256sums=('7638dec8ba2b5408cf32ab41d37cb29460095c4b2161a860480c122e71806ba9' 'f7c1f72dac366fd11502cf7176aa5133075f39b0e375522d00fc1cb827189378' '5cac782837366aa0fabe5e87c0f27ef9ed7a476aed7649781994cfe108eb0894' - 'ba7a00f9cac4d9175480dcbe3d62ae661d9d876acad0e2b4ca56d0c104f8111f') + 'ba7a00f9cac4d9175480dcbe3d62ae661d9d876acad0e2b4ca56d0c104f8111f' + '4b9b469cca4b5f22a1005eddb6db6124b6e3932eaa2638a54e09d8ab005dc084') 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-fix-dllexport-attribute.patch } build() {