commit 5583ccc7a247ee27556ede344e93d3ac1dc72e9b Author: Guido Draheim Date: Sat Apr 18 01:39:56 2020 +0200 reorganize ZZIP_OPTIONFLAGS and make install-man ON by default if UNIX # diff --git a/GNUmakefile b/GNUmakefile # index 3571fd1..53077b0 100644 # --- a/GNUmakefile # +++ b/GNUmakefile # @@ -10,10 +10,16 @@ default: # @ test ! -f Makefile || test -f build/Makefile || echo 'DONE make all - please run make check (before make install)' # # .PHONY: build-am build-cm # -build-cm: ; mkdir build-cm; cd build-cm && cmake .. -DCMAKE_INSTALL_PREFIX:PATH=$$HOME/local # build-am: ; mkdir build-am; cd build-am && sh ../configure --prefix=$$HOME/local --enable-sdl # -cm cmake: ; rm -rf build-cm; $(MAKE) build-cm && cd build-cm && $(MAKE) all # +build-cm: ; mkdir build-cm; cd build-cm && cmake .. -DCMAKE_INSTALL_PREFIX:PATH=$$HOME/local # +build-nj: ; mkdir build-nj; cd build-nj && cmake .. -DCMAKE_INSTALL_PREFIX:PATH=$$HOME/local -GNinja # +build-nm: ; mkdir build-nj; cd build-nj && cmake .. -DCMAKE_INSTALL_PREFIX:PATH=$$HOME/local -GNmake # am autom: ; rm -rf build-am; $(MAKE) build-am && cd build-am && $(MAKE) all # +cm cmake: ; rm -rf build-cm; $(MAKE) build-cm && cd build-cm && $(MAKE) all # +nj ninja: ; rm -rf build-nj; $(MAKE) build-nj && cd build-nj && ninja # + # +build-cm2: ; mkdir build-cm2; cd build-cm2 && cmake .. -DCMAKE_INSTALL_PREFIX:PATH=$$HOME/local -DZZIP_MANPAGES=OFF # +cm2: ; rm -rf build-cm2; $(MAKE) build-cm2 && cd build-cm2 && $(MAKE) all # # new: ; rm -rf build; $(MAKE) default # diff --git a/SDL/CMakeLists.txt b/SDL/CMakeLists.txt index 7ceba4a..c0d68d4 100644 --- a/SDL/CMakeLists.txt +++ b/SDL/CMakeLists.txt @@ -14,6 +14,15 @@ option(BUILD_STATIC_LIBS "Build the static library" OFF) option(BUILD_TESTS "Build test programs" OFF) option(MSVC_STATIC_RUNTIME "Build with static runtime libs (/MT)" ON) +if(UNIX) +option(ZZIP_LIBTOOL "Ensure binary compatibility with libtool" ON) +option(ZZIP_PKGCONFIG "Generate pkg-config files for linking" ON) +else() +option(ZZIP_LIBTOOL "Ensure binary compatibility with libtool" OFF) +option(ZZIP_PKGCONFIG "Generate pkg-config files for linking" OFF) +endif() + + # Zlib library needed find_package ( ZLIB REQUIRED ) # pkg_search_module ( ZZIP zzip ) @@ -46,7 +55,7 @@ endif() # pkgconfig ###################################################### if(SDL_FOUND) -if(UNIX) +if(ZZIP_PKGCONFIG) join_paths(libdir "\${prefix}" "${CMAKE_INSTALL_LIBDIR}") join_paths(includedir "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}") join_paths(pc_zzipsdldir "\${prefix}" "${zzipsdldir}") @@ -64,5 +73,11 @@ add_custom_target(pkgconfig-sdl ALL DEPENDS SDL_rwops_zzip.pc) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/SDL_rwops_zzip.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" ) -endif() -endif() +endif(ZZIP_PKGCONFIG) +endif(SDL_FOUND) + +# messages ################################################## + +message(STATUS "installing SDL_rwops_zzip example headers: ${SDL_FOUND}") +message(STATUS "installing SDL_rwops_zzip pkgconfig files: ${ZZIP_PKGCONFIG}") + diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index d1284e6..623da24 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -9,6 +9,14 @@ option(BUILD_SHARED_LIBS "Build a shared library" ON) option(BUILD_STATIC_LIBS "Build the static library" OFF) option(BUILD_TESTS "Build test programs" OFF) option(MSVC_STATIC_RUNTIME "Build with static runtime libs (/MT)" ON) +option(ZZIP_HTMLSITE "Generate site html pages from docs" OFF) +option(ZZIP_HTMPAGES "Generate html manpages from sources" OFF) + +if(UNIX) +option(ZZIP_MANPAGES "Generate man3 manpages from sources" ON) +else() +option(ZZIP_MANPAGES "Generate man3 manpages from sources" OFF) +endif() # Zlib library needed find_package ( ZLIB REQUIRED ) @@ -132,14 +140,24 @@ add_custom_command(OUTPUT htmpages.tar DEPENDS zziplib.xml zzipmmapped.xml zzipfseeko.xml VERBATIM) -add_custom_target(mans DEPENDS manpages) -add_custom_target(man DEPENDS manpages) -add_custom_target(htm DEPENDS htmpages) add_custom_target(manpages DEPENDS manpages.tar) add_custom_target(htmpages DEPENDS htmpages.tar) add_custom_target(doc DEPENDS zziplib.xml zzipmmapped.xml zzipfseeko.xml site.html) add_custom_target(docs DEPENDS doc manpages htmpages) +add_custom_target(mans DEPENDS manpages) + +if(ZZIP_MANPAGES) +add_custom_target(man ALL DEPENDS manpages) +else() +add_custom_target(man DEPENDS manpages) +endif() +if(ZZIP_HTMPAGES) +add_custom_target(htm ALL DEPENDS htmpages) +else() +add_custom_target(htm DEPENDS htmpages) +endif() +# install ######################################################## string(REPLACE ";" " " all_bins_FILES "${bins_FILES}") string(REPLACE ";" " " all_SDLs_FILES "${SDLs_FILES}") @@ -168,13 +186,24 @@ add_custom_target(install-manpages COMMAND ${BASH} -c "cd $DESTDIR${mandir} && tar xf ${outdir}/manpages.tar" DEPENDS manpages.tar VERBATIM) + add_custom_target(install-docs DEPENDS install-manpages install-htmpages install-site) add_custom_target(install-mans DEPENDS install-manpages) -add_custom_target(install-man DEPENDS install-manpages) -# install ######################################################## -set(mandir ${CMAKE_INSTALL_FULL_MANDIR}) -install(CODE "execute_process(COMMAND ${BASH} -c \"set -e - mkdir -vp $DESTDIR/${mandir} || ls -ld $DESTDIR/${mandir} - cd $DESTDIR/${mandir} && tar xf ${CMAKE_CURRENT_BINARY_DIR}/manpages.tar - \")") +if(ZZIP_MANPAGES) +add_custom_target(install-man ALL DEPENDS install-manpages) +else() +add_custom_target(install-man DEPENDS install-manpages) +endif() + +if(ZZIP_HTMPAGES) +add_custom_target(install-htm ALL DEPENDS install-htmpages) +else() +add_custom_target(install-htm DEPENDS install-htmpages) +endif() + +# messages ####################################################### + +message(STATUS "html site to be generated: ${ZZIP_HTMLSITE}" ) +message(STATUS "man pages to be generated: ${ZZIP_MANPAGES}" ) +message(STATUS "htm pages to be generated: ${ZZIP_HTMPAGES}" ) diff --git a/testbuilds/centos7-build.dockerfile b/testbuilds/centos7-build.dockerfile index 4509b68..0b7b656 100644 --- a/testbuilds/centos7-build.dockerfile +++ b/testbuilds/centos7-build.dockerfile @@ -19,4 +19,4 @@ RUN mkdir src/build RUN cd src/build && cmake3 .. RUN cd src/build && make RUN $no_check || (cd src/build && make check) -RUN $no_install || (cd src/build && make install) +RUN $no_install || (cd src/build && make install VERBOSE=1) diff --git a/zzip/CMakeLists.txt b/zzip/CMakeLists.txt index a9f6e3a..2f7eda5 100644 --- a/zzip/CMakeLists.txt +++ b/zzip/CMakeLists.txt @@ -18,8 +18,16 @@ option(BUILD_STATIC_LIBS "Build the static library" OFF) option(MSVC_STATIC_RUNTIME "Build with static runtime libs (/MT)" ON) option(ZZIPMMAPPED "Build libzzipmmapped (not fully portable)" ON) option(ZZIPFSEEKO "Build libzzipfseeko (based on posix.1 api)" ON) -option(ZZIPCOMPAT "Build compatibility with old libzzip releases" ON) -option(ZZIPLIBTOOL "Ensure binary compatibility with libtool" ON) + +if(UNIX) +option(ZZIP_COMPAT "Build compatibility with old libzzip releases" ON) +option(ZZIP_LIBTOOL "Ensure binary compatibility with libtool" ON) +option(ZZIP_PKGCONFIG "Generate pkg-config files for linking" ON) +else() +option(ZZIP_COMPAT "Build compatibility with old libzzip releases" OFF) +option(ZZIP_LIBTOOL "Ensure binary compatibility with libtool" OFF) +option(ZZIP_PKGCONFIG "Generate pkg-config files for linking" OFF) +endif() # used in zzip/_config.h set(ZZIP_PACKAGE "${PROJECT_NAME}lib") @@ -27,7 +35,7 @@ set(ZZIP_VERSION "${PROJECT_VERSION}") set(ZZIP_PACKAGE_NAME "${PROJECT_NAME}lib") set(ZZIP_PACKAGE_VERSION "${PROJECT_VERSION}") -if(ZZIPCOMPAT) +if(ZZIP_COMPAT) find_package ( UnixCommands REQUIRED ) # bash cp mv rm gzip tar endif() @@ -193,7 +201,7 @@ set_target_properties(libzzipmmapped PROPERTIES OUTPUT_NAME "zzipmmapped" RELEAS SET_TARGET_PROPERTIES(libzzipmmapped PROPERTIES VERSION ${VERNUM}.${FIXNUM} SOVERSION ${VERNUM}) endif() -if(ZZIPCOMPAT) +if(ZZIP_COMPAT) add_custom_command(OUTPUT compat/zzip.h COMMAND ${BASH} -c "rm -rf compat; mkdir compat" COMMAND ${BASH} -c "echo '#ifndef ZZIP_WARNING' > compat/zzip.h" @@ -212,9 +220,9 @@ add_custom_command(OUTPUT compat/zzip.h BYPRODUCTS compat/zziplib.h compat/zzip-io.h VERBATIM) add_custom_target(compat ALL DEPENDS compat/zzip.h) -endif() +endif(ZZIP_COMPAT) -if(UNIX) +if(ZZIP_PKGCONFIG) join_paths(libdir "\${prefix}" "${CMAKE_INSTALL_LIBDIR}") join_paths(includedir "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}") add_custom_command(OUTPUT zziplib.pc @@ -235,12 +243,12 @@ add_custom_command(OUTPUT zziplib.pc BYPRODUCTS zzipmmapped.pc zzipfseeko.pc VERBATIM) add_custom_target(pkgconfig ALL DEPENDS zziplib.pc) -endif() +endif(ZZIP_PKGCONFIG) # install ######################################################## set(outdir ${CMAKE_CURRENT_BINARY_DIR}) -if(UNIX) +if(ZZIP_PKGCONFIG) install(FILES ${outdir}/zziplib.pc ${outdir}/zzipmmapped.pc ${outdir}/zzipfseeko.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" ) endif() @@ -264,7 +272,7 @@ install(TARGETS libzzipmmapped ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -if(ZZIPCOMPAT) +if(ZZIP_COMPAT) install(FILES ${outdir}/compat/zzip.h ${outdir}/compat/zziplib.h ${outdir}/compat/zzip-io.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG) @@ -289,7 +297,7 @@ if(ZZIPCOMPAT) endif() endif() -if(ZZIPLIBTOOL) +if(ZZIP_LIBTOOL) if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG) set(lib ${CMAKE_SHARED_LIBRARY_PREFIX}) set(dll ${CMAKE_SHARED_LIBRARY_SUFFIX}) @@ -340,4 +348,12 @@ if(ZZIPLIBTOOL) ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${librelease}${dll}.12 \")") endif() -endif() +endif(ZZIP_LIBTOOL) + +## messages ############################################## + +message(STATUS "lib zzipfseeko to be compiled: ${ZZIPFSEEKO}") +message(STATUS "lib zzipmmapped to be compiled: ${ZZIPFSEEKO}") +message(STATUS "lib zzip symlinks as by libtool: ${ZZIP_LIBTOOL}") +message(STATUS "installing zzip compat headers: ${ZZIP_COMPAT}") +message(STATUS "installing zzip pkgconfig files: ${ZZIP_PKGCONFIG}") diff --git a/zzipwrap/CMakeLists.txt b/zzipwrap/CMakeLists.txt index 220d93b..8ae0587 100644 --- a/zzipwrap/CMakeLists.txt +++ b/zzipwrap/CMakeLists.txt @@ -13,7 +13,14 @@ option(BUILD_SHARED_LIBS "Build a shared library" ON) option(BUILD_STATIC_LIBS "Build the static library" OFF) option(BUILD_TESTS "Build test programs" OFF) option(MSVC_STATIC_RUNTIME "Build with static runtime libs (/MT)" ON) -option(ZZIPLIBTOOL "Ensure binary compatibility with libtool" ON) + +if(UNIX) +option(ZZIP_LIBTOOL "Ensure binary compatibility with libtool" ON) +option(ZZIP_PKGCONFIG "Generate pkg-config files for linking" ON) +else() +option(ZZIP_LIBTOOL "Ensure binary compatibility with libtool" OFF) +option(ZZIP_PKGCONFIG "Generate pkg-config files for linking" OFF) +endif() check_include_files ( unistd.h ZZIP_HAVE_UNISTD_H ) # set ( ZZIP_HAVE_ZLIB_H 1 ) @@ -48,7 +55,7 @@ add_executable(zzipwrap ${zzipwrap_SRCS} ) target_link_libraries(zzipwrap libzzipwrap ) target_include_directories(zzipwrap PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") -if(UNIX) +if(ZZIP_PKGCONFIG) join_paths(libdir "\${prefix}" "${CMAKE_INSTALL_LIBDIR}") join_paths(includedir "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}") add_custom_command(OUTPUT zzipwrap.pc @@ -69,7 +76,7 @@ endif() # install ######################################################## set(outdir ${CMAKE_CURRENT_BINARY_DIR}) -if(UNIX) +if(ZZIP_PKGCONFIG) install(FILES ${outdir}/zzipwrap.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" ) endif() @@ -79,7 +86,7 @@ install(TARGETS libzzipwrap LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -if(ZZIPLIBTOOL) +if(ZZIP_LIBTOOL) if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG) set(lib ${CMAKE_SHARED_LIBRARY_PREFIX}) set(dll ${CMAKE_SHARED_LIBRARY_SUFFIX}) @@ -95,3 +102,8 @@ if(ZZIPLIBTOOL) \")") endif() endif() + +# messages ####################################################### + +message(STATUS "lib zzipwrap symlinks as by libtool: ${ZZIP_LIBTOOL}") +message(STATUS "installing zzipwrap pkgconfig files: ${ZZIP_PKGCONFIG}")