Skip to content

Commit

Permalink
reorganize ZZIP_OPTIONFLAGS and make install-man ON by default if UNIX
Browse files Browse the repository at this point in the history
  • Loading branch information
gdraheim committed Apr 17, 2020
1 parent df66693 commit 5583ccc
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 31 deletions.
10 changes: 8 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
21 changes: 18 additions & 3 deletions SDL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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}")
add_custom_command(OUTPUT SDL_rwops_zzip.pc
Expand All @@ -63,5 +72,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}")

49 changes: 39 additions & 10 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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}")
Expand Down Expand Up @@ -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}" )
2 changes: 1 addition & 1 deletion testbuilds/centos7-build.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
38 changes: 27 additions & 11 deletions zzip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,24 @@ 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")
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()

Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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()
Expand All @@ -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)
Expand All @@ -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})
Expand Down Expand Up @@ -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}")
20 changes: 16 additions & 4 deletions zzipwrap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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})
Expand All @@ -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}")

0 comments on commit 5583ccc

Please sign in to comment.