gdraheim / zziplib

The ZZIPlib provides read access on ZIP-archives and unpacked data. It features an additional simplified API following the standard Posix API for file access
Other
62 stars 50 forks source link

CMakeLists.txt: fix static library names #116

Closed ffontaine closed 3 years ago

ffontaine commented 3 years ago

Don't suffix static libraries with -${RELNUM} or static linking of mpd will fail because the pkg-config file contains -lzzip and not -lzzip-0:

/srv/storage/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/9.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: cannot find -lzzip

Fixes:

Signed-off-by: Fabrice Fontaine fontaine.fabrice@gmail.com

gdraheim commented 3 years ago

There are no symlinks installed for a static-linkage build? I am kinda missing that because distro makers do only need the dynamic-linkage builds.

If I read the patch correctly then it does put the current linkage rules into an if(BUILD_SHARED_LIBS) section. I am not particularly sure if that breaks other compile setups but then again, the highest priority is keeping distro makers happy which the patch seems to ensure. But I would need some more testing that the dynamic-linking scenario is really identical.

gdraheim commented 3 years ago

@Biswa96 - checking into the mingw discussions: the zziplib cmake build was tweaked in such a way that the binaries for the Linux distros have the exact same file names. That's what drives the version markers on the libs. May be it would be beneficial to provide a cmake option that disables it, so that the default dll files will get generated?

Biswa96 commented 3 years ago

As you wish. The only requirement is that the library names should be same in pkg-config file. That linked pull request was reverted due to that different name in pkg-config file.

Any yes. mingw follows Linux or unix-like names for libraries as it uses GNU tools.

gdraheim commented 3 years ago

After checking the current cmake setup, I think the real problem comes from having wrapped the "ln -s libzzip-0.so libzzip.so" code being restricted to shared-lib builds. Creating a symlink for any build type should help.

if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)
add_custom_target(libzzip_libtool_links ALL
    COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzip> ${lib}${libname}${dll}
    )
install(FILES
    ${outdir}/${lib}${libname}${dll}
    DESTINATION ${CMAKE_INSTALL_LIBDIR})
gdraheim commented 3 years ago

I am rejecting this patch in favour of #117 where I want to align pkgconfig and RELNUM build options.