From af0b0a952d24678a758b9662e4979129dcd4a276 Mon Sep 17 00:00:00 2001 From: Luigi Scarso Date: Fri, 24 Apr 2020 18:47:01 +0000 Subject: zziplib 0.13.71 git-svn-id: svn://tug.org/texlive/trunk@54860 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/libs/zziplib/ChangeLog | 5 + Build/source/libs/zziplib/TLpatches/ChangeLog | 5 + Build/source/libs/zziplib/TLpatches/TL-Changes | 4 +- Build/source/libs/zziplib/configure | 20 +- Build/source/libs/zziplib/version.ac | 2 +- .../source/libs/zziplib/zziplib-src/CMakeLists.txt | 47 + .../zziplib-src/CMakeScripts/JoinPaths.cmake | 23 + Build/source/libs/zziplib/zziplib-src/ChangeLog | 16 + Build/source/libs/zziplib/zziplib-src/GNUmakefile | 45 + Build/source/libs/zziplib/zziplib-src/Makefile.am | 2 + Build/source/libs/zziplib/zziplib-src/Makefile.in | 7 +- Build/source/libs/zziplib/zziplib-src/Makefile.mk | 34 - Build/source/libs/zziplib/zziplib-src/README.MD | 49 + .../libs/zziplib/zziplib-src/SDL/CMakeLists.txt | 67 + .../libs/zziplib/zziplib-src/SDL/Makefile.am | 8 +- .../libs/zziplib/zziplib-src/SDL/Makefile.in | 13 +- .../zziplib/zziplib-src/SDL/zzip-sdl-config.pc | 10 - .../libs/zziplib/zziplib-src/SDL/zzip-sdl-rwops.pc | 8 - .../libs/zziplib/zziplib-src/azure-pipelines.yml | 42 + .../libs/zziplib/zziplib-src/azure-test-results.md | 7 + .../libs/zziplib/zziplib-src/bins/CMakeLists.txt | 71 + .../libs/zziplib/zziplib-src/bins/Makefile.in | 5 +- .../libs/zziplib/zziplib-src/bins/unzip-mem.c | 7 +- .../source/libs/zziplib/zziplib-src/bins/unzzip.c | 115 +- .../libs/zziplib/zziplib-src/bins/unzzipcat-big.c | 36 +- .../libs/zziplib/zziplib-src/bins/unzzipcat-mem.c | 38 +- .../libs/zziplib/zziplib-src/bins/unzzipcat-mix.c | 63 +- .../libs/zziplib/zziplib-src/bins/unzzipcat-zip.c | 63 +- .../libs/zziplib/zziplib-src/bins/unzzipdir-mem.c | 2 +- .../libs/zziplib/zziplib-src/bins/unzzipdir-mix.c | 2 +- .../libs/zziplib/zziplib-src/bins/unzzipdir-zip.c | 2 +- .../libs/zziplib/zziplib-src/bins/unzzipshow.c | 2 +- Build/source/libs/zziplib/zziplib-src/bins/zzcat.c | 2 +- Build/source/libs/zziplib/zziplib-src/bins/zzdir.c | 2 +- Build/source/libs/zziplib/zziplib-src/bins/zzip.c | 4 +- .../libs/zziplib/zziplib-src/bins/zziptest.c | 2 +- .../libs/zziplib/zziplib-src/bins/zzobfuscated.c | 2 +- .../libs/zziplib/zziplib-src/bins/zzxorcat.c | 2 +- .../libs/zziplib/zziplib-src/bins/zzxorcopy.c | 4 +- .../libs/zziplib/zziplib-src/bins/zzxordir.c | 2 +- Build/source/libs/zziplib/zziplib-src/configure | 395 ++--- Build/source/libs/zziplib/zziplib-src/configure.ac | 22 +- .../libs/zziplib/zziplib-src/docs/CMakeLists.txt | 180 +++ .../libs/zziplib/zziplib-src/docs/Makefile.am | 40 +- .../libs/zziplib/zziplib-src/docs/Makefile.in | 45 +- .../zziplib/zziplib-src/docs/cpp2markdown-1.py | 7 +- .../libs/zziplib/zziplib-src/docs/cpp2markdown.py | 6 +- .../libs/zziplib/zziplib-src/docs/dbk2man.py | 462 ++++-- .../libs/zziplib/zziplib-src/docs/dir2index.py | 119 ++ .../libs/zziplib/zziplib-src/docs/make-doc.py | 50 +- .../libs/zziplib/zziplib-src/docs/makedocs.py | 26 +- .../zziplib-src/docs/zzipdoc/commentmarkup.py | 4 +- .../zziplib/zziplib-src/docs/zzipdoc/dbk2htm.py | 5 +- .../zziplib-src/docs/zzipdoc/docbookdocument.py | 35 +- .../zziplib-src/docs/zzipdoc/functionheader.py | 2 +- .../docs/zzipdoc/functionlisthtmlpage.py | 37 +- .../docs/zzipdoc/functionlistreference.py | 8 +- .../zziplib-src/docs/zzipdoc/functionprototype.py | 2 +- .../zziplib/zziplib-src/docs/zzipdoc/htm2dbk.py | 23 +- .../zziplib-src/docs/zzipdoc/htmldocument.py | 35 +- .../libs/zziplib/zziplib-src/docs/zzipdoc/match.py | 22 +- .../zziplib/zziplib-src/docs/zzipdoc/options.py | 4 +- .../zziplib/zziplib-src/docs/zzipdoc/textfile.py | 2 +- .../zziplib-src/docs/zzipdoc/textfileheader.py | 6 +- .../libs/zziplib/zziplib-src/docs/zziplib.html | 464 ------ .../libs/zziplib/zziplib-src/test/CMakeLists.txt | 82 + .../libs/zziplib/zziplib-src/test/Makefile.in | 5 +- .../source/libs/zziplib/zziplib-src/test/test.zip | Bin 1361 -> 1361 bytes .../libs/zziplib/zziplib-src/test/zziptests.py | 240 ++- .../source/libs/zziplib/zziplib-src/testbuilds.py | 1640 ++++++++++++++++++++ .../testbuilds/centos7-am-build.dockerfile | 26 + .../testbuilds/centos7-am-docs.dockerfile | 25 + .../testbuilds/centos7-am-sdl2.dockerfile | 26 + .../testbuilds/centos7-build.dockerfile | 22 + .../testbuilds/centos7-destdir-sdl2.dockerfile | 22 + .../zziplib-src/testbuilds/centos7-docs.dockerfile | 21 + .../zziplib-src/testbuilds/centos7-sdl2.dockerfile | 22 + .../testbuilds/centos8-am-build.dockerfile | 26 + .../testbuilds/centos8-am-sdl2.dockerfile | 31 + .../testbuilds/centos8-build.dockerfile | 22 + .../testbuilds/centos8-destdir-sdl2.dockerfile | 26 + .../zziplib-src/testbuilds/centos8-sdl2.dockerfile | 26 + .../testbuilds/opensuse15-build.dockerfile | 22 + .../testbuilds/opensuse15-sdl2.dockerfile | 24 + .../testbuilds/ubuntu16-32bit.dockerfile | 23 + .../testbuilds/ubuntu16-azure.dockerfile | 28 + .../testbuilds/ubuntu16-build.dockerfile | 23 + .../testbuilds/ubuntu16-sdl2.dockerfile | 24 + .../testbuilds/ubuntu18-build.dockerfile | 23 + .../testbuilds/windows-shared-x64.dockerfile | 29 + .../testbuilds/windows-static-x64.dockerfile | 29 + .../libs/zziplib/zziplib-src/zzip/CMakeLists.txt | 343 ++++ .../libs/zziplib/zziplib-src/zzip/Makefile.am | 1 + .../libs/zziplib/zziplib-src/zzip/Makefile.in | 7 +- .../libs/zziplib/zziplib-src/zzip/__string.h | 7 +- .../libs/zziplib/zziplib-src/zzip/_config.h.cmake | 165 ++ Build/source/libs/zziplib/zziplib-src/zzip/dir.c | 1 + Build/source/libs/zziplib/zziplib-src/zzip/file.c | 1 + .../source/libs/zziplib/zziplib-src/zzip/format.h | 12 +- .../source/libs/zziplib/zziplib-src/zzip/fseeko.c | 12 +- Build/source/libs/zziplib/zziplib-src/zzip/info.c | 2 +- .../source/libs/zziplib/zziplib-src/zzip/memdisk.c | 28 +- Build/source/libs/zziplib/zziplib-src/zzip/zip.c | 30 +- Build/source/libs/zziplib/zziplib-src/zziplib.spec | 4 +- .../zziplib/zziplib-src/zzipwrap/CMakeLists.txt | 97 ++ .../libs/zziplib/zziplib-src/zzipwrap/Makefile.in | 5 +- .../libs/zziplib/zziplib-src/zzipwrap/zzipwrap.pc | 10 - 107 files changed, 4644 insertions(+), 1409 deletions(-) create mode 100644 Build/source/libs/zziplib/zziplib-src/CMakeLists.txt create mode 100644 Build/source/libs/zziplib/zziplib-src/CMakeScripts/JoinPaths.cmake create mode 100644 Build/source/libs/zziplib/zziplib-src/GNUmakefile delete mode 100644 Build/source/libs/zziplib/zziplib-src/Makefile.mk create mode 100644 Build/source/libs/zziplib/zziplib-src/README.MD create mode 100644 Build/source/libs/zziplib/zziplib-src/SDL/CMakeLists.txt delete mode 100644 Build/source/libs/zziplib/zziplib-src/SDL/zzip-sdl-config.pc delete mode 100644 Build/source/libs/zziplib/zziplib-src/SDL/zzip-sdl-rwops.pc create mode 100644 Build/source/libs/zziplib/zziplib-src/azure-pipelines.yml create mode 100644 Build/source/libs/zziplib/zziplib-src/azure-test-results.md create mode 100644 Build/source/libs/zziplib/zziplib-src/bins/CMakeLists.txt create mode 100644 Build/source/libs/zziplib/zziplib-src/docs/CMakeLists.txt create mode 100755 Build/source/libs/zziplib/zziplib-src/docs/dir2index.py delete mode 100644 Build/source/libs/zziplib/zziplib-src/docs/zziplib.html create mode 100644 Build/source/libs/zziplib/zziplib-src/test/CMakeLists.txt create mode 100755 Build/source/libs/zziplib/zziplib-src/testbuilds.py create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-am-build.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-am-docs.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-am-sdl2.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-build.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-destdir-sdl2.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-docs.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-sdl2.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-am-build.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-am-sdl2.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-build.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-destdir-sdl2.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-sdl2.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/opensuse15-build.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/opensuse15-sdl2.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu16-32bit.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu16-azure.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu16-build.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu16-sdl2.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu18-build.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/windows-shared-x64.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/testbuilds/windows-static-x64.dockerfile create mode 100644 Build/source/libs/zziplib/zziplib-src/zzip/CMakeLists.txt create mode 100644 Build/source/libs/zziplib/zziplib-src/zzip/_config.h.cmake create mode 100644 Build/source/libs/zziplib/zziplib-src/zzipwrap/CMakeLists.txt delete mode 100644 Build/source/libs/zziplib/zziplib-src/zzipwrap/zzipwrap.pc diff --git a/Build/source/libs/zziplib/ChangeLog b/Build/source/libs/zziplib/ChangeLog index cf76ca223dc..ec749cc2e50 100644 --- a/Build/source/libs/zziplib/ChangeLog +++ b/Build/source/libs/zziplib/ChangeLog @@ -1,3 +1,8 @@ +2020-04-23 Luigi Scarso + + * Import zziplib 0.13.71 . + version.ac: Adapted. + 2018-03-18 Akira Kakuto * Import zziplib 0.13.69. diff --git a/Build/source/libs/zziplib/TLpatches/ChangeLog b/Build/source/libs/zziplib/TLpatches/ChangeLog index 8810129388c..89d74e5a6b7 100644 --- a/Build/source/libs/zziplib/TLpatches/ChangeLog +++ b/Build/source/libs/zziplib/TLpatches/ChangeLog @@ -1,3 +1,8 @@ +2020-04-23 Luigi Scarso + + * Import zziplib-0.13.71. + Patches nad TL-Changes unchanged. + 2018-03-18 Akira Kakuto * Import zziplib-0.13.69. diff --git a/Build/source/libs/zziplib/TLpatches/TL-Changes b/Build/source/libs/zziplib/TLpatches/TL-Changes index 54e06ec3c75..5fdb9316447 100644 --- a/Build/source/libs/zziplib/TLpatches/TL-Changes +++ b/Build/source/libs/zziplib/TLpatches/TL-Changes @@ -1,5 +1,5 @@ -Changes applied to the zziplib-0.13.69 tree as obtained from: -https://github.com/gdraheim/zziplib/archive/v0.13.69.tar.gz +Changes applied to the zziplib-0.13.71 tree as obtained from: +https://github.com/gdraheim/zziplib/archive/v0.13.71.tar.gz Copied: m4/ax_prefix_config_h.m4 -> ../m4/ (without AC_BEFORE) diff --git a/Build/source/libs/zziplib/configure b/Build/source/libs/zziplib/configure index c87b6c00729..f6428e673f7 100755 --- a/Build/source/libs/zziplib/configure +++ b/Build/source/libs/zziplib/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for zziplib (TeX Live) 0.13.69. +# Generated by GNU Autoconf 2.69 for zziplib (TeX Live) 0.13.71. # # Report bugs to . # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='zziplib (TeX Live)' PACKAGE_TARNAME='zziplib--tex-live-' -PACKAGE_VERSION='0.13.69' -PACKAGE_STRING='zziplib (TeX Live) 0.13.69' +PACKAGE_VERSION='0.13.71' +PACKAGE_STRING='zziplib (TeX Live) 0.13.71' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1295,7 +1295,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures zziplib (TeX Live) 0.13.69 to adapt to many kinds of systems. +\`configure' configures zziplib (TeX Live) 0.13.71 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1366,7 +1366,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of zziplib (TeX Live) 0.13.69:";; + short | recursive ) echo "Configuration of zziplib (TeX Live) 0.13.71:";; esac cat <<\_ACEOF @@ -1472,7 +1472,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -zziplib (TeX Live) configure 0.13.69 +zziplib (TeX Live) configure 0.13.71 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2078,7 +2078,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by zziplib (TeX Live) $as_me 0.13.69, which was +It was created by zziplib (TeX Live) $as_me 0.13.71, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -4002,7 +4002,7 @@ fi # Define the identity of the package. PACKAGE='zziplib--tex-live-' - VERSION='0.13.69' + VERSION='0.13.71' cat >>confdefs.h <<_ACEOF @@ -7370,7 +7370,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by zziplib (TeX Live) $as_me 0.13.69, which was +This file was extended by zziplib (TeX Live) $as_me 0.13.71, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7436,7 +7436,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -zziplib (TeX Live) config.status 0.13.69 +zziplib (TeX Live) config.status 0.13.71 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/zziplib/version.ac b/Build/source/libs/zziplib/version.ac index daf577138a6..cad8ee1c5d4 100644 --- a/Build/source/libs/zziplib/version.ac +++ b/Build/source/libs/zziplib/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current zziplib version -m4_define([zziplib_version], [0.13.69]) +m4_define([zziplib_version], [0.13.71]) diff --git a/Build/source/libs/zziplib/zziplib-src/CMakeLists.txt b/Build/source/libs/zziplib/zziplib-src/CMakeLists.txt new file mode 100644 index 00000000000..83b39d68b1f --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/CMakeLists.txt @@ -0,0 +1,47 @@ +cmake_minimum_required (VERSION 3.1) +project(zziplib VERSION "0.13.71" LANGUAGES C) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif(NOT CMAKE_BUILD_TYPE) + +### Path to additional CMake modules +# set(CMAKE_MODULE_PATH +# ${CMAKE_SOURCE_DIR}/cmake +# ${CMAKE_MODULE_PATH}) + +include ( GNUInstallDirs ) + +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(ZZIPMMAPPED "Build libzzipmmapped (not fully portable)" ON) +option(ZZIPFSEEKO "Build libzzipfseeko (based on posix.1 api)" ON) +option(ZZIPWRAP "Build libzzipwrap (non-installed example)" ON) +option(ZZIPSDL "Build zzcatsdl (includable example code)" ON) +option(ZZIPBINS "Build bins/unzzip (unzip-like executables)" ON) +option(ZZIPTEST "Build test/zzipself (self-extract example)" ON) +option(ZZIPDOCS "Build docs/manpages (and website content)" ON) + +add_subdirectory(zzip) + +if(ZZIPWRAP) +add_subdirectory(zzipwrap) +endif() + +if(ZZIPSDL) +add_subdirectory(SDL) +endif() + +if(ZZIPBINS) +add_subdirectory(bins) +endif() + +if(ZZIPTEST) +add_subdirectory(test) +endif() + +if(ZZIPDOCS) +add_subdirectory(docs) +endif() diff --git a/Build/source/libs/zziplib/zziplib-src/CMakeScripts/JoinPaths.cmake b/Build/source/libs/zziplib/zziplib-src/CMakeScripts/JoinPaths.cmake new file mode 100644 index 00000000000..10d5ba680e6 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/CMakeScripts/JoinPaths.cmake @@ -0,0 +1,23 @@ +# This module provides function for joining paths +# known from from most languages +# +# SPDX-License-Identifier: (MIT OR CC0-1.0) +# Copyright 2020 Jan Tojnar +# https://github.com/jtojnar/cmake-snips +# +# Modelled after Python’s os.path.join +# https://docs.python.org/3.7/library/os.path.html#os.path.join +# Windows not supported +function(join_paths joined_path first_path_segment) + set(temp_path "${first_path_segment}") + foreach(current_segment IN LISTS ARGN) + if(NOT ("${current_segment}" STREQUAL "")) + if(IS_ABSOLUTE "${current_segment}") + set(temp_path "${current_segment}") + else() + set(temp_path "${temp_path}/${current_segment}") + endif() + endif() + endforeach() + set(${joined_path} "${temp_path}" PARENT_SCOPE) +endfunction() diff --git a/Build/source/libs/zziplib/zziplib-src/ChangeLog b/Build/source/libs/zziplib/zziplib-src/ChangeLog index 079f74166dc..61e75e1a239 100644 --- a/Build/source/libs/zziplib/zziplib-src/ChangeLog +++ b/Build/source/libs/zziplib/zziplib-src/ChangeLog @@ -1,3 +1,19 @@ +2020-04-14 gdraheim@github + * The testbuilds allow to compile and test for different os via docker + * The testbuilds allow to compare new cmake to automake install results + * Found fixes to bring base, sdl, manpages and site docs to same level + * release 0.13.71 + +2020-04-14 gdraheim@github + * there have been tons of bugfixes over the last two years ... + * Thanks go to Patrick Steinhardt (then at Aservo) for python3 updates + * Thanks go to Josef Moellers (working at SUSE Labs) for many CVE fixes + * and of course all the other patches that came in via github issues. + * I have cleaned up sources to only uses Python3 (as needed by 2020). + * !!! The old automake/autconf/libtool system will be dumped soon!!! + * The build system was ported to 'cmake' .. (last tested cmake 3.10.2) + * release 0.13.70 + 2018-03-15 guidod * fix a number of CVEs reported with special *.zip PoC files * man-pages are generated with new dbk2man.py - docbook xmlto is optional now diff --git a/Build/source/libs/zziplib/zziplib-src/GNUmakefile b/Build/source/libs/zziplib/zziplib-src/GNUmakefile new file mode 100644 index 00000000000..860adcbef1b --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/GNUmakefile @@ -0,0 +1,45 @@ +#! /usr/bin/gmake -f + +# the 'all' target is included from the 'configure'd Makefile + +default: + @ test -f Makefile || test -d build || (set -x ; mkdir build ; cd build && sh ../configure --prefix=$$HOME) + @ test -f Makefile || test ! -f build/Makefile || (set -x ; cd build && $(MAKE) all) + @ test -f Makefile || test ! -f build/Makefile || echo 'DONE (cd build && make all) - please run (cd build && make check) now' + @ test ! -f Makefile || test -f build/Makefile || $(MAKE) all + @ test ! -f Makefile || test -f build/Makefile || echo 'DONE make all - please run make check (before make install)' + +cm cmake: ; rm -rf build; mkdir build; cd build && cmake .. -DCMAKE_INSTALL_PREFIX:PATH=$$HOME/local +am autom: ; rm -rf build2; mkdir build2; cd build2 && sh ../configure --prefix=$$HOME/local --enable-sdl +2: ; cd build2 && $(MAKE) all + +new: ; rm -rf build; $(MAKE) default + +auto: + aclocal -I m4 && autoconf -I m4 && autoheader && automake + +boottrap: + rm -rf .deps .libs + rm -f config.guess config.sub stamp-h.in + rm -f install-sh ltconfig ltmain.sh depcomp mkinstalldirs + rm -f config.h config.h.in config.log config.cache configure + rm -f aclocal.m4 Makefile Makefile.in + aclocal + autoconf + autoheader + automake -a -c + +-include Makefile + +test_%: ; python3 testbuilds.py $@ -vv +tests: ; python3 testbuilds.py -vv + +version: + oldv=`sed -e '/zziplib.VERSION/!d' -e 's:.*zziplib.VERSION."::' -e 's:".*::' CMakeLists.txt` \ + ; oldr=`echo $$oldv | sed -e 's:.*[.]::'` ; newr=`expr $$oldr + 1` \ + ; newv=`echo $$oldv | sed -e "s:[.]$$oldr\$$:.$$newr:"` \ + ; echo "$$oldv -> $$newv" \ + ; sed -i -e "s:$$oldv:$$newv:" zziplib.spec testbuilds.py \ + ; sed -i -e "s:$$oldv:$$newv:" */CMakeLists.txt \ + ; sed -i -e "s:$$oldv:$$newv:" CMakeLists.txt \ + ; git diff -U0 diff --git a/Build/source/libs/zziplib/zziplib-src/Makefile.am b/Build/source/libs/zziplib/zziplib-src/Makefile.am index c54b2ccb462..84edb090d65 100644 --- a/Build/source/libs/zziplib/zziplib-src/Makefile.am +++ b/Build/source/libs/zziplib/zziplib-src/Makefile.am @@ -6,6 +6,8 @@ WANT_AUTOCONF = 2.57 DIST_SUBDIRS = zzip zzipwrap bins test docs SDL SUBDIRS = zzip zzipwrap bins test docs @SDL@ +DISTCLEANFILES = _configs.sed + rpm: dist-bzip2 $(PACKAGE).spec rpmbuild -ta $(PACKAGE)-$(VERSION).tar.bz2 test -d ../pub && cp $(PACKAGE)-$(VERSION).tar.bz2 ../pub/ diff --git a/Build/source/libs/zziplib/zziplib-src/Makefile.in b/Build/source/libs/zziplib/zziplib-src/Makefile.in index f8b38ff381a..f810e4f0e53 100644 --- a/Build/source/libs/zziplib/zziplib-src/Makefile.in +++ b/Build/source/libs/zziplib/zziplib-src/Makefile.in @@ -100,9 +100,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_compile_check_sizeof.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_aligned_access_required.m4 \ $(top_srcdir)/m4/ax_check_enable_debug.m4 \ - $(top_srcdir)/m4/ax_configure_args.m4 \ $(top_srcdir)/m4/ax_create_pkgconfig_info.m4 \ - $(top_srcdir)/m4/ax_enable_builddir.m4 \ $(top_srcdir)/m4/ax_expand_prefix.m4 \ $(top_srcdir)/m4/ax_maintainer_mode_auto_silent.m4 \ $(top_srcdir)/m4/ax_not_enable_frame_pointer.m4 \ @@ -307,6 +305,8 @@ PAX_TAR_CREATE = @PAX_TAR_CREATE@ PAX_TAR_EXTRACT = @PAX_TAR_EXTRACT@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RELEASE_INFO = @RELEASE_INFO@ @@ -340,7 +340,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -394,6 +393,7 @@ WANT_AUTOMAKE = 1.7 WANT_AUTOCONF = 2.57 DIST_SUBDIRS = zzip zzipwrap bins test docs SDL SUBDIRS = zzip zzipwrap bins test docs @SDL@ +DISTCLEANFILES = _configs.sed OSC_ROOT = /my/own/osc OSC_SRCDIR = $(OSC_ROOT) OSC_PROJECT = home:guidod:zziplib-13 @@ -824,6 +824,7 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/Build/source/libs/zziplib/zziplib-src/Makefile.mk b/Build/source/libs/zziplib/zziplib-src/Makefile.mk deleted file mode 100644 index 2fad269481a..00000000000 --- a/Build/source/libs/zziplib/zziplib-src/Makefile.mk +++ /dev/null @@ -1,34 +0,0 @@ -PUB=pub/ - -auto: - aclocal -I m4 && autoconf -I m4 && autoheader && automake - -boottrap: - rm -rf .deps .libs - rm -f config.guess config.sub stamp-h.in - rm -f install-sh ltconfig ltmain.sh depcomp mkinstalldirs - rm -f config.h config.h.in config.log config.cache configure - rm -f aclocal.m4 Makefile Makefile.in - aclocal - autoconf - autoheader - automake -a -c - -rpm2: dist-bzip $(PACKAGE).spec - rpmbuild -ta pub/$(PACKAGE)-$(VERSION).tar.bz2 - -dist-bzip : dist-bzip2 - $(MAKE) dist-bzip2-done -dist-bzip2-done dist-done : - test -d $(PUB) || mkdir $(PUB) - @ echo cp $(BUILD)/$(PACKAGE)-$(VERSION).tar.bz2 $(PUB). \ - ; cp $(BUILD)/$(PACKAGE)-$(VERSION).tar.bz2 $(PUB). -snapshot: - $(MAKE) dist-bzip2 VERSION=`date +%Y.%m%d` -distclean-done: - - rm -r *.d - -configsub : - cp ../savannah.config/config.guess uses/config.guess - cp ../savannah.config/config.sub uses/config.sub - diff --git a/Build/source/libs/zziplib/zziplib-src/README.MD b/Build/source/libs/zziplib/zziplib-src/README.MD new file mode 100644 index 00000000000..a3c64d79948 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/README.MD @@ -0,0 +1,49 @@ +... **please switch to 'cmake' based builds** ... + +The zziplib provides read access to zipped files in a zip-archive, +using compression based solely on free algorithms provided by zlib. +It also provides a functionality to overlay the archive filesystem +with the filesystem of the operating system environment. + +The origins of the project go back to the 1999 when Tomi Ollila +did explore the details of the zip format. It was adopted by +Guido Draheim in 2000 making the source code portable to many +platforms. Originally maintained on Sourceforge it moved to +GitHub in 2017 for easier collobaration with other projects. + +> also check out the original [README](README) file + +... test status [(master)](https://github.com/gdraheim/zziplib/tree/master): [![Build Status](https://dev.azure.com/gdraheim/gdraheim/_apis/build/status/gdraheim.zziplib%20(1)?branchName=master)](https://dev.azure.com/gdraheim/gdraheim/_build/latest?definitionId=4&branchName=master) ... ([develop/tests/zziptests.py](https://github.com/gdraheim/zziplib/blob/develop/test/zziptests.py)) + +**DOCUMENTATION** + +* for more details, see http://zziplib.sourceforge.net/ +* [copying](docs/copying.htm) + [developer](docs/developer.htm) + [functions](docs/functions.htm) + [php](docs/zip-php.htm) + [referitals](docs/referentials.htm) + [future](docs/future.htm) + [notes](docs/notes.htm) + [64on32](docs/64on32.htm) + [download](docs/download.htm) + [history](docs/history.htm) +* [zzip:](docs/zzip-index.htm) + [basics](docs/zzip-basics.htm) + [api](docs/zzip-api.htm) + [crypt](docs/zzip-crypt.htm) + [cryptoid](docs/zzip-cryptoid.htm) + [extio](docs/zzip-extio.htm) + [extras](docs/zzip-extras.htm) + [file](docs/zzip-file.htm) + [parse](docs/zzip-parse.htm) + [sdl-rwops](docs/zzip-rwops.htm) + [xor](docs/zzip-xor.htm) + [zip](docs/zzip-zip.htm) + [sfx-make](docs/sfx-make.htm) +* [zziplib](docs/zziplib.html) + [mmapped](docs/mmapped.htm) + [fseeko](docs/fseeko.htm) + [download](docs/download.htm) + [faq](docs/faq.htm) + (outdated in the source tree) diff --git a/Build/source/libs/zziplib/zziplib-src/SDL/CMakeLists.txt b/Build/source/libs/zziplib/zziplib-src/SDL/CMakeLists.txt new file mode 100644 index 00000000000..7ceba4acdaa --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/SDL/CMakeLists.txt @@ -0,0 +1,67 @@ +cmake_minimum_required (VERSION 3.1) +project(zzipsdl VERSION "0.13.71" LANGUAGES C) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif(NOT CMAKE_BUILD_TYPE) + +include ( GNUInstallDirs ) +include ( FindPkgConfig ) + +# options ######################################################## +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) + +# Zlib library needed +find_package ( ZLIB REQUIRED ) +# pkg_search_module ( ZZIP zzip ) +pkg_search_module ( SDL sdl2) + +# targets ######################################################## +set(ZZIPSDL_SRCS + SDL_rwops_zzip.c) + +set(ZZIPSDL_HDRS + SDL_rwops_zzip.h) + +set(ZZCATSDL_SRCS + ${ZZIPSDL_SRCS} + SDL_rwops_zzcat.c) + +if(SDL_FOUND) +add_executable(zzcatsdl ${ZZCATSDL_SRCS} ) +target_link_libraries(zzcatsdl libzzip "${SDL_LIBRARIES}" ZLIB::ZLIB) +target_include_directories(zzcatsdl PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}" "${SDL_INCLUDE_DIRS}") +endif() + +# install ######################################################## +if(SDL_FOUND) +set(zzipsdldir "${CMAKE_INSTALL_INCLUDEDIR}/SDL_rwops_zzip") +install(FILES ${ZZIPSDL_SRCS} ${ZZIPSDL_HDRS} + DESTINATION ${zzipsdldir}) +endif() + +# pkgconfig ###################################################### + +if(SDL_FOUND) +if(UNIX) +join_paths(libdir "\${prefix}" "${CMAKE_INSTALL_LIBDIR}") +join_paths(includedir "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}") +add_custom_command(OUTPUT SDL_rwops_zzip.pc + COMMAND ${BASH} -c "echo 'prefix=${CMAKE_INSTALL_PREFIX}' > SDL_rwops_zzip.pc" + COMMAND ${BASH} -c "echo 'zzipsdldir=\${prefix}/${zzipsdldir}' >> SDL_rwops_zzip.pc" + COMMAND ${BASH} -c "echo '' >> SDL_rwops_zzip.pc" + COMMAND ${BASH} -c "echo 'Name: SDL_rwops_zzip' >> SDL_rwops_zzip.pc" + COMMAND ${BASH} -c "echo 'Version: ${PROJECT_VERSION}' >> SDL_rwops_zzip.pc" + COMMAND ${BASH} -c "echo 'Description: SDL_rwops for ZZipLib' >> SDL_rwops_zzip.pc" + COMMAND ${BASH} -c "echo 'Requires: sdl, zziplib' >> SDL_rwops_zzip.pc" + COMMAND ${BASH} -c "echo 'Cflags: -I\${zzipsdldir}' >> SDL_rwops_zzip.pc" + VERBATIM) +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() diff --git a/Build/source/libs/zziplib/zziplib-src/SDL/Makefile.am b/Build/source/libs/zziplib/zziplib-src/SDL/Makefile.am index 99dd540180f..c66d443a567 100644 --- a/Build/source/libs/zziplib/zziplib-src/SDL/Makefile.am +++ b/Build/source/libs/zziplib/zziplib-src/SDL/Makefile.am @@ -8,10 +8,10 @@ EXTRA_DIST = $(sdl_DATA) check_PROGRAMS = zzcatsdl zzcatsdl_SOURCES = SDL_rwops_zzcat.c SDL_rwops_zzip.c -ZZIP_CFLAGS= `export PKG_CONFIG_PATH=../zzip; pkg-config zziplib --cflags` -ZZIP_LIBS= `export PKG_CONFIG_PATH=../zzip; pkg-config zziplib --libs` -SDL_CFLAGS= `export PKG_CONFIG_PATH=.; pkg-config sdl --cflags` -SDL_LIBS= `export PKG_CONFIG_PATH=.; pkg-config sdl --libs` +ZZIP_CFLAGS= `export PKG_CONFIG_PATH=../zzip; $(PKG_CONFIG) zziplib --cflags` +ZZIP_LIBS= `export PKG_CONFIG_PATH=../zzip; $(PKG_CONFIG) zziplib --libs` +SDL_CFLAGS= `export PKG_CONFIG_PATH=.; $(PKG_CONFIG) sdl --cflags` +SDL_LIBS= `export PKG_CONFIG_PATH=.; $(PKG_CONFIG) sdl --libs` CFLAGS= -I$(srcdir) $(ZZIP_CFLAGS) $(SDL_CFLAGS) LIBS= $(ZZIP_LIBS) $(SDL_LIBS) diff --git a/Build/source/libs/zziplib/zziplib-src/SDL/Makefile.in b/Build/source/libs/zziplib/zziplib-src/SDL/Makefile.in index 4230a66bbba..1eff3eaf5ca 100644 --- a/Build/source/libs/zziplib/zziplib-src/SDL/Makefile.in +++ b/Build/source/libs/zziplib/zziplib-src/SDL/Makefile.in @@ -103,9 +103,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_compile_check_sizeof.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_aligned_access_required.m4 \ $(top_srcdir)/m4/ax_check_enable_debug.m4 \ - $(top_srcdir)/m4/ax_configure_args.m4 \ $(top_srcdir)/m4/ax_create_pkgconfig_info.m4 \ - $(top_srcdir)/m4/ax_enable_builddir.m4 \ $(top_srcdir)/m4/ax_expand_prefix.m4 \ $(top_srcdir)/m4/ax_maintainer_mode_auto_silent.m4 \ $(top_srcdir)/m4/ax_not_enable_frame_pointer.m4 \ @@ -304,6 +302,8 @@ PAX_TAR_CREATE = @PAX_TAR_CREATE@ PAX_TAR_EXTRACT = @PAX_TAR_EXTRACT@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RELEASE_INFO = @RELEASE_INFO@ @@ -337,7 +337,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -393,10 +392,10 @@ zzipsdldir = ${includedir}/SDL_rwops_zzip zzipsdl_DATA = SDL_rwops_zzip.c SDL_rwops_zzip.h EXTRA_DIST = $(sdl_DATA) zzcatsdl_SOURCES = SDL_rwops_zzcat.c SDL_rwops_zzip.c -ZZIP_CFLAGS = `export PKG_CONFIG_PATH=../zzip; pkg-config zziplib --cflags` -ZZIP_LIBS = `export PKG_CONFIG_PATH=../zzip; pkg-config zziplib --libs` -SDL_CFLAGS = `export PKG_CONFIG_PATH=.; pkg-config sdl --cflags` -SDL_LIBS = `export PKG_CONFIG_PATH=.; pkg-config sdl --libs` +ZZIP_CFLAGS = `export PKG_CONFIG_PATH=../zzip; $(PKG_CONFIG) zziplib --cflags` +ZZIP_LIBS = `export PKG_CONFIG_PATH=../zzip; $(PKG_CONFIG) zziplib --libs` +SDL_CFLAGS = `export PKG_CONFIG_PATH=.; $(PKG_CONFIG) sdl --cflags` +SDL_LIBS = `export PKG_CONFIG_PATH=.; $(PKG_CONFIG) sdl --libs` CLEANFILES = *.pc *.omf pkgconfig_HEADERS = SDL_rwops_zzip.pc ERRNULL = 2>/dev/null diff --git a/Build/source/libs/zziplib/zziplib-src/SDL/zzip-sdl-config.pc b/Build/source/libs/zziplib/zziplib-src/SDL/zzip-sdl-config.pc deleted file mode 100644 index 46a06a97c58..00000000000 --- a/Build/source/libs/zziplib/zziplib-src/SDL/zzip-sdl-config.pc +++ /dev/null @@ -1,10 +0,0 @@ -prefix=/usr -sdl_static_libs=-L/usr/lib -lSDL -lpthread -lm -ldl -lasound -laudio -lXt -L/usr/X11R6/lib -lX11 -lXext -sdl_libs=-L/usr/lib -lSDL -lpthread -sdl_cflags=-I/usr/include/SDL -D_REENTRANT - -Name: zzip-sdl-config -Version: 1.2.5 -Description: SDL Config (for ZZipLib) -Libs: ${sdl_libs} -Cflags: ${sdl_cflags} diff --git a/Build/source/libs/zziplib/zziplib-src/SDL/zzip-sdl-rwops.pc b/Build/source/libs/zziplib/zziplib-src/SDL/zzip-sdl-rwops.pc deleted file mode 100644 index 6a4b1d04377..00000000000 --- a/Build/source/libs/zziplib/zziplib-src/SDL/zzip-sdl-rwops.pc +++ /dev/null @@ -1,8 +0,0 @@ -zzipdatadir=/usr/local/share/zziplib -zzipsdlrwops=${zzipdatadir}/SDL - -Name: zzip-sdl-rwops -Version: 0.13.24 -Description: SDL_rwops for ZZipLib -Requires: zzip-sdl-config, zziplib -Cflags: -I${zzipsdlrwops} diff --git a/Build/source/libs/zziplib/zziplib-src/azure-pipelines.yml b/Build/source/libs/zziplib/zziplib-src/azure-pipelines.yml new file mode 100644 index 00000000000..7416c366265 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/azure-pipelines.yml @@ -0,0 +1,42 @@ +# C/C++ with GCC +# Build your C/C++ project with GCC using make. +# Add steps that publish test results, save build artifacts, deploy, and more: +# https://docs.microsoft.com/azure/devops/pipelines/apps/c-cpp/gcc + +trigger: +- master +- develop + +pool: + vmImage: 'ubuntu-latest' + +steps: +- script: | + sudo apt-get update --fix-missing + displayName: 'install refresh' +- script: | + sudo apt-get install --fix-broken --ignore-missing libsdl2-dev + displayName: 'install libsdl2-dev' +- script: | + sudo apt-get install --fix-broken --ignore-missing python3-pip + displayName: 'install python3-pip' +- script: | + pip3 install unittest-xml-reporting + displayName: 'install unittest-xml-reporting' +- script: | + rm -rf build + mkdir build + displayName: 'build dir' +- script: | + cd build && cmake -DTESTFLAGS=--xmlresults=TEST-zziplibs.xml .. + displayName: 'configure' +- script: | + cd build && make all VERBOSE=1 + displayName: 'make all' +- script: | + cd build && make check VERBOSE=1 || true + displayName: 'make check VERBOSE=1' +- script: | + find . -name '*.xml' + displayName: 'find xml' +- task: PublishTestResults@2 diff --git a/Build/source/libs/zziplib/zziplib-src/azure-test-results.md b/Build/source/libs/zziplib/zziplib-src/azure-test-results.md new file mode 100644 index 00000000000..2813b5a2d45 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/azure-test-results.md @@ -0,0 +1,7 @@ +# master branch tests for zziplib on Azure Pipelines + +[(master)](https://github.com/gdraheim/zziplib/tree/master): [![Build Status](https://dev.azure.com/gdraheim/gdraheim/_apis/build/status/gdraheim.zziplib%20(1)?branchName=master)](https://dev.azure.com/gdraheim/gdraheim/_build/latest?definitionId=4&branchName=master) + +[develop](https://github.com/gdraheim/zziplib/tree/develop): [![Build Status](https://dev.azure.com/gdraheim/gdraheim/_apis/build/status/gdraheim.zziplib%20(1)?branchName=develop)](https://dev.azure.com/gdraheim/gdraheim/_build/latest?definitionId=4&branchName=develop) + + diff --git a/Build/source/libs/zziplib/zziplib-src/bins/CMakeLists.txt b/Build/source/libs/zziplib/zziplib-src/bins/CMakeLists.txt new file mode 100644 index 00000000000..d9466e30db9 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/bins/CMakeLists.txt @@ -0,0 +1,71 @@ +cmake_minimum_required (VERSION 3.1) +project(zzipbins VERSION "0.13.71" LANGUAGES C) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif(NOT CMAKE_BUILD_TYPE) + +include ( GNUInstallDirs ) +include ( FindPkgConfig ) + +# options ######################################################## +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) + +# Zlib library needed +find_package ( ZLIB REQUIRED ) +# pkg_search_module ( ZZIP zzip ) +# pkg_search_module ( ZZIPMAPPED zzipmmapped ) +# pkg_search_module ( ZZIPFSEEKO zzipfseeko ) + +# targets ######################################################## +add_executable(zzcat zzcat.c) +add_executable(zzdir zzdir.c) +add_executable(zzxorcat zzxorcat.c) +add_executable(zzxordir zzxordir.c) +add_executable(zzxorcopy zzxorcopy.c) +add_executable(zzobfuscated zzobfuscated.c) +add_executable(zziptest zziptest.c) +add_executable(zzip zzip.c zzipmake-zip.c) +add_executable(unzzip unzzip.c unzzipcat-zip.c unzzipdir-zip.c) +add_executable(unzzip-mix unzzip.c unzzipcat-mix.c unzzipdir-mix.c) +add_executable(unzzip-big unzzip.c unzzipcat-big.c unzzipdir-big.c) +add_executable(unzzip-mem unzzip.c unzzipcat-mem.c unzzipdir-mem.c) +add_executable(unzip-mem unzip-mem.c) + +target_link_libraries(zzcat libzzip ZLIB::ZLIB) +target_link_libraries(zzdir libzzip ZLIB::ZLIB) +target_link_libraries(zzxorcat libzzip ZLIB::ZLIB) +target_link_libraries(zzxordir libzzip ZLIB::ZLIB) +target_link_libraries(zzxorcopy libzzip ZLIB::ZLIB) +target_link_libraries(zzobfuscated libzzip ZLIB::ZLIB) +target_link_libraries(zziptest libzzip ZLIB::ZLIB) +target_link_libraries(zzip libzzip ZLIB::ZLIB) +target_link_libraries(unzzip libzzip ZLIB::ZLIB) +target_link_libraries(unzzip-mix libzzip ZLIB::ZLIB) +target_link_libraries(unzzip-big libzzipfseeko ZLIB::ZLIB) +target_link_libraries(unzzip-mem libzzipmmapped ZLIB::ZLIB) +target_link_libraries(unzip-mem libzzipmmapped ZLIB::ZLIB) + +target_include_directories(zzcat PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") +target_include_directories(zzdir PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") +target_include_directories(zzxorcat PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") +target_include_directories(zzxordir PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") +target_include_directories(zzxorcopy PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") +target_include_directories(zzobfuscated PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") +target_include_directories(zziptest PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") +target_include_directories(zzip PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") +target_include_directories(unzzip PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") +target_include_directories(unzzip-mix PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") +target_include_directories(unzzip-big PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") +target_include_directories(unzzip-mem PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") +target_include_directories(unzip-mem PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") + +# install ######################################################## +install(TARGETS zzcat zzdir zzxorcat zzxordir zzxorcopy + unzzip unzzip-mix unzzip-big unzzip-mem unzip-mem + DESTINATION "${CMAKE_INSTALL_BINDIR}") +install(FILES zziplib.m4 + DESTINATION "${CMAKE_INSTALL_DATADIR}/aclocal") diff --git a/Build/source/libs/zziplib/zziplib-src/bins/Makefile.in b/Build/source/libs/zziplib/zziplib-src/bins/Makefile.in index 3a9b806ca24..7c3b9f776da 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/Makefile.in +++ b/Build/source/libs/zziplib/zziplib-src/bins/Makefile.in @@ -109,9 +109,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_compile_check_sizeof.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_aligned_access_required.m4 \ $(top_srcdir)/m4/ax_check_enable_debug.m4 \ - $(top_srcdir)/m4/ax_configure_args.m4 \ $(top_srcdir)/m4/ax_create_pkgconfig_info.m4 \ - $(top_srcdir)/m4/ax_enable_builddir.m4 \ $(top_srcdir)/m4/ax_expand_prefix.m4 \ $(top_srcdir)/m4/ax_maintainer_mode_auto_silent.m4 \ $(top_srcdir)/m4/ax_not_enable_frame_pointer.m4 \ @@ -354,6 +352,8 @@ PAX_TAR_CREATE = @PAX_TAR_CREATE@ PAX_TAR_EXTRACT = @PAX_TAR_EXTRACT@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RELEASE_INFO = @RELEASE_INFO@ @@ -388,7 +388,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzip-mem.c b/Build/source/libs/zziplib/zziplib-src/bins/unzip-mem.c index c45cb72b835..cc009f89932 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzip-mem.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzip-mem.c @@ -231,9 +231,12 @@ static void zzip_mem_entry_direntry(ZZIP_MEM_ENTRY* entry) if (*name == '\n') name++; if (option_verbose) { + long percentage; + + percentage = usize ? (L (100 - (csize*100/usize))) : 0; /* 0% if file size is 0 */ printf("%8li%c %s %8li%c%3li%% %s %8lx %s %s\n", L usize, exp, comprlevel[compr], L csize, exp, - L (100 - (csize*100/usize)), + percentage, _zzip_ctime(&mtime), crc32, name, comment); } else { printf(" %8li%c %s %s %s\n", @@ -317,7 +320,7 @@ main (int argc, char ** argv) } if (! strcmp (argv[1], "--version")) { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION "\n"); return 0; } diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzip.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzip.c index f91c5ebad86..0c0b5e58bde 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzip.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzip.c @@ -5,8 +5,14 @@ * This file is used as an example to clarify zzip api usage. */ +#include #include +#include +#include +#include +#include #include +#include #include #include "unzzipcat-zip.h" #include "unzzipdir-zip.h" @@ -22,7 +28,7 @@ static const char usage[] = static int unzzip_version(void) { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION "\n"); return 0; } @@ -32,6 +38,113 @@ static int unzzip_help(void) return 0; } +/* Functions used by unzzipcat-*.c: */ +int exitcode(int e) +{ + switch (e) + { + case ZZIP_NO_ERROR: + return EXIT_OK; + case ZZIP_OUTOFMEM: /* out of memory */ + return EXIT_ENOMEM; + case ZZIP_DIR_OPEN: /* failed to open zipfile, see errno for details */ + return EXIT_ZIP_NOT_FOUND; + case ZZIP_DIR_STAT: /* failed to fstat zipfile, see errno for details */ + case ZZIP_DIR_SEEK: /* failed to lseek zipfile, see errno for details */ + case ZZIP_DIR_READ: /* failed to read zipfile, see errno for details */ + case ZZIP_DIR_TOO_SHORT: + case ZZIP_DIR_EDH_MISSING: + return EXIT_FILEFORMAT; + case ZZIP_DIRSIZE: + return EXIT_EARLY_END_OF_FILE; + case ZZIP_ENOENT: + return EXIT_FILE_NOT_FOUND; + case ZZIP_UNSUPP_COMPR: + return EXIT_UNSUPPORTED_COMPRESSION; + case ZZIP_CORRUPTED: + case ZZIP_UNDEF: + case ZZIP_DIR_LARGEFILE: + return EXIT_FILEFORMAT; + } + return EXIT_ERRORS; +} + +/* + * NAME: remove_dotdotslash + * PURPOSE: To remove any "../" components from the given pathname + * ARGUMENTS: path: path name with maybe "../" components + * RETURNS: Nothing, "path" is modified in-place + * NOTE: removing "../" from the path ALWAYS shortens the path, never adds to it! + * Also, "path" is not used after creating it. + * So modifying "path" in-place is safe to do. + */ +static inline void +remove_dotdotslash(char *path) +{ + /* Note: removing "../" from the path ALWAYS shortens the path, never adds to it! */ + char *dotdotslash; + int warned = 0; + + dotdotslash = path; + while ((dotdotslash = strstr(dotdotslash, "../")) != NULL) + { + /* + * Remove only if at the beginning of the pathname ("../path/name") + * or when preceded by a slash ("path/../name"), + * otherwise not ("path../name..")! + */ + if (dotdotslash == path || dotdotslash[-1] == '/') + { + char *src, *dst; + if (!warned) + { + /* Note: the first time through the pathname is still intact */ + fprintf(stderr, "Removing \"../\" path component(s) in %s\n", path); + warned = 1; + } + /* We cannot use strcpy(), as there "The strings may not overlap" */ + for (src = dotdotslash+3, dst=dotdotslash; (*dst = *src) != '\0'; src++, dst++) + ; + } + else + dotdotslash +=3; /* skip this instance to prevent infinite loop */ + } +} + +static void makedirs(const char* name) +{ + char* p = strrchr(name, '/'); + if (p) { + char* dir_name = _zzip_strndup(name, p-name); + makedirs(dir_name); + free (dir_name); + } + if (_zzip_mkdir(name, 0775) == -1 && errno != EEXIST) + { + DBG3("while mkdir %s : %s", name, strerror(errno)); + } + errno = 0; +} + +FILE* create_fopen(char* name, char* mode, int subdirs) +{ + char name_stripped[PATH_MAX]; + + strncpy(name_stripped, name, PATH_MAX); + remove_dotdotslash(name_stripped); + + if (subdirs) + { + char* p = strrchr(name_stripped, '/'); + if (p) { + char* dir_name = _zzip_strndup(name_stripped, p-name); + makedirs(dir_name); + free (dir_name); + } + } + return fopen(name_stripped, mode); +} + int main (int argc, char ** argv) { diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-big.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-big.c index 982d262dbe8..111ef47f36a 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-big.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-big.c @@ -16,10 +16,9 @@ #include "unzzipcat-zip.h" #include "unzzip-states.h" -static int exitcode(int e) -{ - return EXIT_ERRORS; -} +/* Functions in unzzip.c: */ +extern int exitcode(int); +extern FILE* create_fopen(char*, char*, int); static void unzzip_big_entry_fprint(ZZIP_ENTRY* entry, FILE* out) { @@ -53,35 +52,6 @@ static void unzzip_cat_file(FILE* disk, char* name, FILE* out) } } -static void makedirs(const char* name) -{ - char* p = strrchr(name, '/'); - if (p) { - char* dir_name = _zzip_strndup(name, p-name); - makedirs(dir_name); - free (dir_name); - } - if (_zzip_mkdir(name, 0775) == -1 && errno != EEXIST) - { - DBG3("while mkdir %s : %s", name, strerror(errno)); - } - errno = 0; -} - -static FILE* create_fopen(char* name, char* mode, int subdirs) -{ - if (subdirs) - { - char* p = strrchr(name, '/'); - if (p) { - char* dir_name = _zzip_strndup(name, p-name); - makedirs(dir_name); - free (dir_name); - } - } - return fopen(name, mode); -} - static int unzzip_cat (int argc, char ** argv, int extract) { diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mem.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mem.c index 9bc966b90db..6bd79b70b8d 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mem.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mem.c @@ -24,10 +24,9 @@ #include #endif -static int exitcode(int e) -{ - return EXIT_ERRORS; -} +/* Functions in unzzip.c: */ +extern int exitcode(int); +extern FILE* create_fopen(char*, char*, int); static void unzzip_mem_entry_fprint(ZZIP_MEM_DISK* disk, ZZIP_MEM_ENTRY* entry, FILE* out) @@ -58,35 +57,6 @@ static void unzzip_mem_disk_cat_file(ZZIP_MEM_DISK* disk, char* name, FILE* out) } } -static void makedirs(const char* name) -{ - char* p = strrchr(name, '/'); - if (p) { - char* dir_name = _zzip_strndup(name, p-name); - makedirs(dir_name); - free (dir_name); - } - if (_zzip_mkdir(name, 0775) == -1 && errno != EEXIST) - { - DBG3("while mkdir %s : %s", name, strerror(errno)); - } - errno = 0; -} - -static FILE* create_fopen(char* name, char* mode, int subdirs) -{ - if (subdirs) - { - char* p = strrchr(name, '/'); - if (p) { - char* dir_name = _zzip_strndup(name, p-name); - makedirs(dir_name); - free (dir_name); - } - } - return fopen(name, mode); -} - static int unzzip_cat (int argc, char ** argv, int extract) { int done = 0; @@ -95,7 +65,7 @@ static int unzzip_cat (int argc, char ** argv, int extract) if (argc == 1) { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION "\n"); return EXIT_OK; /* better provide an archive argument */ } diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mix.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mix.c index 91c2f009c0f..e18987ddd2c 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mix.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mix.c @@ -24,35 +24,9 @@ #include #endif -static int exitcode(int e) -{ - switch (e) - { - case ZZIP_NO_ERROR: - return EXIT_OK; - case ZZIP_OUTOFMEM: /* out of memory */ - return EXIT_ENOMEM; - case ZZIP_DIR_OPEN: /* failed to open zipfile, see errno for details */ - return EXIT_ZIP_NOT_FOUND; - case ZZIP_DIR_STAT: /* failed to fstat zipfile, see errno for details */ - case ZZIP_DIR_SEEK: /* failed to lseek zipfile, see errno for details */ - case ZZIP_DIR_READ: /* failed to read zipfile, see errno for details */ - case ZZIP_DIR_TOO_SHORT: - case ZZIP_DIR_EDH_MISSING: - return EXIT_FILEFORMAT; - case ZZIP_DIRSIZE: - return EXIT_EARLY_END_OF_FILE; - case ZZIP_ENOENT: - return EXIT_FILE_NOT_FOUND; - case ZZIP_UNSUPP_COMPR: - return EXIT_UNSUPPORTED_COMPRESSION; - case ZZIP_CORRUPTED: - case ZZIP_UNDEF: - case ZZIP_DIR_LARGEFILE: - return EXIT_FILEFORMAT; - } - return EXIT_ERRORS; -} +/* Functions in unzzip.c: */ +extern int exitcode(int); +extern FILE* create_fopen(char*, char*, int); static void unzzip_cat_file(ZZIP_DIR* disk, char* name, FILE* out) { @@ -69,35 +43,6 @@ static void unzzip_cat_file(ZZIP_DIR* disk, char* name, FILE* out) } } -static void makedirs(const char* name) -{ - char* p = strrchr(name, '/'); - if (p) { - char* dir_name = _zzip_strndup(name, p-name); - makedirs(dir_name); - free (dir_name); - } - if (_zzip_mkdir(name, 0775) == -1 && errno != EEXIST) - { - DBG3("while mkdir %s : %s", name, strerror(errno)); - } - errno = 0; -} - -static FILE* create_fopen(char* name, char* mode, int subdirs) -{ - if (subdirs) - { - char* p = strrchr(name, '/'); - if (p) { - char* dir_name = _zzip_strndup(name, p-name); - makedirs(dir_name); - free (dir_name); - } - } - return fopen(name, mode); -} - static int unzzip_cat (int argc, char ** argv, int extract) { int done = 0; @@ -106,7 +51,7 @@ static int unzzip_cat (int argc, char ** argv, int extract) if (argc == 1) { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION "\n"); return EXIT_OK; /* better provide an archive argument */ } diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-zip.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-zip.c index 2810f85a42b..dd78c2be641 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-zip.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-zip.c @@ -24,35 +24,9 @@ #include #endif -static int exitcode(int e) -{ - switch (e) - { - case ZZIP_NO_ERROR: - return EXIT_OK; - case ZZIP_OUTOFMEM: /* out of memory */ - return EXIT_ENOMEM; - case ZZIP_DIR_OPEN: /* failed to open zipfile, see errno for details */ - return EXIT_ZIP_NOT_FOUND; - case ZZIP_DIR_STAT: /* failed to fstat zipfile, see errno for details */ - case ZZIP_DIR_SEEK: /* failed to lseek zipfile, see errno for details */ - case ZZIP_DIR_READ: /* failed to read zipfile, see errno for details */ - case ZZIP_DIR_TOO_SHORT: - case ZZIP_DIR_EDH_MISSING: - return EXIT_FILEFORMAT; - case ZZIP_DIRSIZE: - return EXIT_EARLY_END_OF_FILE; - case ZZIP_ENOENT: - return EXIT_FILE_NOT_FOUND; - case ZZIP_UNSUPP_COMPR: - return EXIT_UNSUPPORTED_COMPRESSION; - case ZZIP_CORRUPTED: - case ZZIP_UNDEF: - case ZZIP_DIR_LARGEFILE: - return EXIT_FILEFORMAT; - } - return EXIT_ERRORS; -} +/* Functions in unzzip.c: */ +extern int exitcode(int); +extern FILE* create_fopen(char*, char*, int); static void unzzip_cat_file(ZZIP_DIR* disk, char* name, FILE* out) { @@ -69,35 +43,6 @@ static void unzzip_cat_file(ZZIP_DIR* disk, char* name, FILE* out) } } -static void makedirs(const char* name) -{ - char* p = strrchr(name, '/'); - if (p) { - char* dir_name = _zzip_strndup(name, p-name); - makedirs(dir_name); - free (dir_name); - } - if (_zzip_mkdir(name, 0775) == -1 && errno != EEXIST) - { - DBG3("while mkdir %s : %s", name, strerror(errno)); - } - errno = 0; -} - -static FILE* create_fopen(char* name, char* mode, int subdirs) -{ - if (subdirs) - { - char* p = strrchr(name, '/'); - if (p) { - char* dir_name = _zzip_strndup(name, p-name); - makedirs(dir_name); - free (dir_name); - } - } - return fopen(name, mode); -} - static int unzzip_cat (int argc, char ** argv, int extract) { int done = 0; @@ -107,7 +52,7 @@ static int unzzip_cat (int argc, char ** argv, int extract) if (argc == 1) { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION "\n"); return EXIT_OK; /* better provide an archive argument */ } diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mem.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mem.c index beca7887c9b..191c4de7208 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mem.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mem.c @@ -38,7 +38,7 @@ unzzip_list (int argc, char ** argv, int verbose) if (argc == 1) { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION "\n"); return EXIT_OK; /* better provide an archive argument */ } diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mix.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mix.c index 891f77b3450..a8d2dbaa564 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mix.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mix.c @@ -63,7 +63,7 @@ unzzip_list (int argc, char ** argv, int verbose) if (argc == 1) { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION "\n"); return EXIT_OK; /* better provide an archive argument */ } diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-zip.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-zip.c index b66ae689a10..55801d83367 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-zip.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-zip.c @@ -63,7 +63,7 @@ unzzip_list (int argc, char ** argv, int verbose) if (argc == 1) { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION "\n"); return EXIT_OK; /* better provide an archive argument */ } diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipshow.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipshow.c index ca215a110d0..9d8c2edc7fb 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipshow.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipshow.c @@ -55,7 +55,7 @@ main (int argc, char ** argv) } if (! strcmp (argv[1], "--version")) { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION "\n"); return 0; } diff --git a/Build/source/libs/zziplib/zziplib-src/bins/zzcat.c b/Build/source/libs/zziplib/zziplib-src/bins/zzcat.c index 27225820784..63026e048c7 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/zzcat.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/zzcat.c @@ -32,7 +32,7 @@ main (int argc, char ** argv) } if (! strcmp (argv[1], "--version")) { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION "\n"); return 0; } diff --git a/Build/source/libs/zziplib/zziplib-src/bins/zzdir.c b/Build/source/libs/zziplib/zziplib-src/bins/zzdir.c index 39652a97248..acbcac44d2b 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/zzdir.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/zzdir.c @@ -29,7 +29,7 @@ main (int argc, char ** argv) } if (! strcmp (argv[1], "--version")) { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION "\n"); return 0; } diff --git a/Build/source/libs/zziplib/zziplib-src/bins/zzip.c b/Build/source/libs/zziplib/zziplib-src/bins/zzip.c index 965f60d6957..4ec0e1296b0 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/zzip.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/zzip.c @@ -41,9 +41,9 @@ main (int argc, char ** argv) if (! strcmp (argv[1], "--version")) { # if defined _ZZIP_ENABLE_WRITE - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION" - W/ -D_ZZIP_ENABLE_WRITE\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION " - W/ -D_ZZIP_ENABLE_WRITE\n"); # else - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION" - NO -D_ZZIP_ENABLE_WRITE\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION " - NO -D_ZZIP_ENABLE_WRITE\n"); # endif return 0; } diff --git a/Build/source/libs/zziplib/zziplib-src/bins/zziptest.c b/Build/source/libs/zziplib/zziplib-src/bins/zziptest.c index e9ee3f23b9d..417e46405e6 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/zziptest.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/zziptest.c @@ -54,7 +54,7 @@ int main(int argc, char ** argv) printf ("zziptest [testfile]\n - selftest defaults to 'test.zip'"); return 0; }else if (! strcmp (argv[1], "--version")) { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION "\n"); return 0; }else if (! strcmp (argv[1], "--quick")) { quick = 1; diff --git a/Build/source/libs/zziplib/zziplib-src/bins/zzobfuscated.c b/Build/source/libs/zziplib/zziplib-src/bins/zzobfuscated.c index 352afc29a13..dd63b8a6618 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/zzobfuscated.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/zzobfuscated.c @@ -73,7 +73,7 @@ main (int argc, char* argv[]) } if (! strcmp (argv[1], "--version")) { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION "\n"); return 0; } diff --git a/Build/source/libs/zziplib/zziplib-src/bins/zzxorcat.c b/Build/source/libs/zziplib/zziplib-src/bins/zzxorcat.c index 97fcd51fd32..3bf2d37dc96 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/zzxorcat.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/zzxorcat.c @@ -60,7 +60,7 @@ main (int argc, char ** argv) } if (! strcmp (argv[1], "--version")) { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION "\n"); return 0; } diff --git a/Build/source/libs/zziplib/zziplib-src/bins/zzxorcopy.c b/Build/source/libs/zziplib/zziplib-src/bins/zzxorcopy.c index 269b8fd76a7..7962efc1168 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/zzxorcopy.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/zzxorcopy.c @@ -13,7 +13,7 @@ #include #include -#include /* for ZZIP_VERSION */ +#include /* for ZZIP_PACKAGE_VERSION */ #if __STDC_VERSION__+0 < 199901 #define _ssize_t int @@ -54,7 +54,7 @@ main (int argc, char ** argv) } if (! strcmp (argv[1], "--version")) { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION "\n"); return 0; } diff --git a/Build/source/libs/zziplib/zziplib-src/bins/zzxordir.c b/Build/source/libs/zziplib/zziplib-src/bins/zzxordir.c index 4c1f4ad6534..8a3781462b0 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/zzxordir.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/zzxordir.c @@ -60,7 +60,7 @@ main (int argc, char ** argv) } if (! strcmp (argv[1], "--version")) { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); + printf (__FILE__ " version " ZZIP_PACKAGE_NAME " " ZZIP_PACKAGE_VERSION "\n"); return 0; } diff --git a/Build/source/libs/zziplib/zziplib-src/configure b/Build/source/libs/zziplib/zziplib-src/configure index f1306deb67b..e04b95e74fa 100755 --- a/Build/source/libs/zziplib/zziplib-src/configure +++ b/Build/source/libs/zziplib/zziplib-src/configure @@ -639,7 +639,6 @@ LIBOBJS CONFIG_FILES aclocaldir pkgconfigdir -PKG_CONFIG RESOLVES ZZIPLIB_LDFLAGS ZIPTESTS @@ -647,6 +646,9 @@ ASAN_CFLAGS ASAN_LIBS SDL_GENERATE SDL +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG ZLIB_VERSION LARGEFILE_CFLAGS XMLTO @@ -737,7 +739,6 @@ INSTALL_PROGRAM ZLIB_LDIR ZLIB_INCL THREAD_SAFE -ax_enable_builddir_sed target_os target_vendor target_cpu @@ -791,7 +792,6 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking -enable_builddir enable_thread_safe with_zlib enable_silent_rules @@ -828,7 +828,10 @@ LDFLAGS LIBS CPPFLAGS LT_SYS_LIBRARY_PATH -CPP' +CPP +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR' # Initialize some variables set by options. @@ -1446,8 +1449,6 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-builddir disable automatic build in subdir of sources - --disable-thread-safe disable thread-safe libtool option --enable-silent-rules less verbose build output (undo: "make V=1") @@ -1511,6 +1512,11 @@ Some influential environment variables: LT_SYS_LIBRARY_PATH User-defined run-time library search path. CPP C preprocessor + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -2492,108 +2498,6 @@ test -n "$target_alias" && NONENONEs,x,x, && program_prefix=${target_alias}- - - # [$]@ is unsable in 2.60+ but earlier autoconf had no ac_configure_args - if test "${ac_configure_args+set}" != "set" ; then - ac_configure_args= - for ac_arg in ${1+"$@"}; do - ac_configure_args="$ac_configure_args '$ac_arg'" - done - fi - - -ax_enable_builddir="." -# Check whether --enable-builddir was given. -if test "${enable_builddir+set}" = set; then : - enableval=$enable_builddir; ax_enable_builddir="$enableval" -else - ax_enable_builddir="yes" -fi - -if test ".$ac_srcdir_defaulted" != ".no" ; then -if test ".$srcdir" = ".." ; then - if test -f config.status ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: toplevel srcdir already configured... skipping subdir build" >&5 -$as_echo "$as_me: toplevel srcdir already configured... skipping subdir build" >&6;} - else - test ".$ax_enable_builddir" = "." && ax_enable_builddir="." - test ".$ax_enable_builddir" = ".no" && ax_enable_builddir="." - test ".$TARGET" = "." && TARGET="$target" - test ".$ax_enable_builddir" = ".yes" && ax_enable_builddir="$TARGET" - if test ".$ax_enable_builddir" != ".." ; then # we know where to go and - as_dir=$ax_enable_builddir; as_fn_mkdir_p - echo __.$ax_enable_builddir.__ > $ax_enable_builddir/conftest.tmp - cd $ax_enable_builddir - if grep __.$ax_enable_builddir.__ conftest.tmp >/dev/null 2>/dev/null ; then - rm conftest.tmp - { $as_echo "$as_me:${as_lineno-$LINENO}: result: continue configure in default builddir \"./$ax_enable_builddir\"" >&5 -$as_echo "continue configure in default builddir \"./$ax_enable_builddir\"" >&6; } - else - as_fn_error $? "could not change to default builddir \"./$ax_enable_builddir\"" "$LINENO" 5 - fi - srcdir=`echo "$ax_enable_builddir" | - sed -e 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g;s,[/]$,,;'` - # going to restart from subdirectory location - test -f $srcdir/config.log && mv $srcdir/config.log . - test -f $srcdir/confdefs.h && mv $srcdir/confdefs.h . - test -f $srcdir/conftest.log && mv $srcdir/conftest.log . - test -f $srcdir/$cache_file && mv $srcdir/$cache_file . - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ....exec $SHELL $srcdir/$0 \"--srcdir=$srcdir\" \"--enable-builddir=$ax_enable_builddir\" ${1+\"$@\"}" >&5 -$as_echo "....exec $SHELL $srcdir/$0 \"--srcdir=$srcdir\" \"--enable-builddir=$ax_enable_builddir\" ${1+\"$@\"}" >&6; } - case "$0" in # restart - /\\*) eval $SHELL "'$0'" "'--srcdir=$srcdir'" "'--enable-builddir=$ax_enable_builddir'" $ac_configure_args ;; - *) eval $SHELL "'$srcdir/$0'" "'--srcdir=$srcdir'" "'--enable-builddir=$ax_enable_builddir'" $ac_configure_args ;; - esac ; exit $? - fi - fi -fi fi -# Extract the first word of "gsed sed", so it can be a program name with args. -set dummy gsed sed; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ax_enable_builddir_sed+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ax_enable_builddir_sed in - [\\/]* | ?:[\\/]*) - ac_cv_path_ax_enable_builddir_sed="$ax_enable_builddir_sed" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ax_enable_builddir_sed="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_ax_enable_builddir_sed" && ac_cv_path_ax_enable_builddir_sed="sed" - ;; -esac -fi -ax_enable_builddir_sed=$ac_cv_path_ax_enable_builddir_sed -if test -n "$ax_enable_builddir_sed"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_enable_builddir_sed" >&5 -$as_echo "$ax_enable_builddir_sed" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -ax_enable_builddir_auxdir="$ac_aux_dir" -ax_enable_builddir_auxdir=`echo "$ax_enable_builddir_auxdir" | $ax_enable_builddir_sed -e "s|$ac_top_srcdir|.|"` -test ".$ax_enable_builddir_auxdir" = "." && ax_enable_builddir_auxdir="$ac_aux_dir" -test ".$ax_enable_builddir_auxdir" = "." && ax_enable_builddir_auxdir="." -ac_config_commands="$ac_config_commands buildir" - # -------------------------------------------- case "$prefix:$ac_default_prefix" in NONE:/usr/local) @@ -13801,7 +13705,7 @@ fi done test -n "$PERL" || PERL="echo no perl found for" -for ac_prog in python +for ac_prog in python3 do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -15334,6 +15238,126 @@ $as_echo "$enable_mmap" >&6; } ;; $as_echo "no (just a bit slower)" >&6; } ;; esac # --------------------------------------------------------------- + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether making SDL parts" >&5 $as_echo_n "checking whether making SDL parts... " >&6; } SDL="" @@ -15349,13 +15373,18 @@ if test "$enable_sdl" = "no" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, disabled" >&5 $as_echo "no, disabled" >&6; } else - enable_sdl=`pkg-config --modversion sdl 2>/dev/null` - if test -z "$enable_sdl"; then - enable_sdl=`sdl-config --version 2>/dev/null` - SDL_GENERATE="sdl-uninstalled.pc" - enable_sdl="$enable_sdl (sdl-config)" + enable_sdl1=`$PKG_CONFIG --modversion sdl 2>/dev/null` + if test -z "$enable_sdl1"; then + enable_sdl2=`$PKG_CONFIG --modversion sdl2 2>/dev/null` + if test -z "$enable_sdl2"; then + enable_sdl3=`sdl-config --version 2>/dev/null` + SDL_GENERATE="sdl-uninstalled.pc" + enable_sdl="$enable_sdl3 (sdl-config)" + else + enable_sdl="$enable_sdl2 (pkgconfig sdl2)" + fi else - enable_sdl="$enable_sdl (pkgconfig)" + enable_sdl="$enable_sdl1 (pkgconfig sdl)" fi enable_sdl="$enable_sdl." case ".$enable_sdl" in @@ -17341,14 +17370,6 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # -ax_enable_builddir_srcdir="$srcdir" # $srcdir -ax_enable_builddir_host="$HOST" # $HOST / $host -ax_enable_builddir_version="$VERSION" # $VERSION -ax_enable_builddir_package="$PACKAGE" # $PACKAGE -ax_enable_builddir_auxdir="$ax_enable_builddir_auxdir" # $AUX -ax_enable_builddir_sed="$ax_enable_builddir_sed" # $SED -ax_enable_builddir="$ax_enable_builddir" # $SUB - AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" @@ -17668,7 +17689,6 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 for ac_config_target in $ac_config_targets do case $ac_config_target in - "buildir") CONFIG_COMMANDS="$CONFIG_COMMANDS buildir" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; @@ -18277,133 +18297,6 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} case $ac_file$ac_mode in - "buildir":C) ac_top_srcdir="$ax_enable_builddir_srcdir" - if test ".$ax_enable_builddir" = "." ; then - if test -f "$top_srcdir/Makefile" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: skipping top_srcdir/Makefile - left untouched" >&5 -$as_echo "$as_me: skipping top_srcdir/Makefile - left untouched" >&6;} - else - { $as_echo "$as_me:${as_lineno-$LINENO}: skipping top_srcdir/Makefile - not created" >&5 -$as_echo "$as_me: skipping top_srcdir/Makefile - not created" >&6;} - fi - else - if test -f "$ac_top_srcdir/Makefile" ; then - a=`grep "^VERSION " "$ac_top_srcdir/Makefile"` ; b=`grep "^VERSION " Makefile` - test "$a" != "$b" && rm "$ac_top_srcdir/Makefile" - fi - if test -f "$ac_top_srcdir/Makefile" ; then - echo "$ac_top_srcdir/Makefile : $ac_top_srcdir/Makefile.in" > $tmp/conftemp.mk - echo " @ echo 'REMOVED,,,' >\$@" >> $tmp/conftemp.mk - eval "${MAKE-make} -f $tmp/conftemp.mk 2>/dev/null >/dev/null" - if grep '^REMOVED,,,' "$ac_top_srcdir/Makefile" >/dev/null - then rm $ac_top_srcdir/Makefile ; fi - cp $tmp/conftemp.mk $ac_top_srcdir/makefiles.mk~ ## DEBUGGING - fi - if test ! -f "$ac_top_srcdir/Makefile" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: create top_srcdir/Makefile guessed from local Makefile" >&5 -$as_echo "$as_me: create top_srcdir/Makefile guessed from local Makefile" >&6;} - x='`' ; cat >$tmp/conftemp.sed <<_EOF -/^\$/n -x -/^\$/bS -x -/\\\\\$/{H;d;} -{H;s/.*//;x;} -bM -:S -x -/\\\\\$/{h;d;} -{h;s/.*//;x;} -:M -s/\\(\\n\\) /\\1 /g -/^ /d -/^[ ]*[\\#]/d -/^VPATH *=/d -s/^srcdir *=.*/srcdir = ./ -s/^top_srcdir *=.*/top_srcdir = ./ -/[:=]/!d -/^\\./d -s/:.*/:/ -/:\$/s/ / /g -/:\$/s/ \\([a-z][a-z-]*[a-z]\\) / \\1 \\1-all /g -/:\$/s/^\\([a-z][a-z-]*[a-z]\\)\\([ :]\\)/\\1 \\1-all\\2/ -/:\$/s/ / /g -/^all all-all[ :]/i\\ -all-configured : all-all -/-all-all/d -/^.*[=]/!a\\ - @ HOST="\$(HOST)\" \\\\\\ - ; test ".\$\$HOST" = "." && HOST=$x sh $ax_enable_builddir_auxdir/config.guess $x \\\\\\ - ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ - ; use=$x basename "\$\@" -all $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\ - ; echo "MAKE \$\$HOST : \$\$n * \$\@"; if test "\$\$n" = "0" ; then : \\\\\\ - ; BUILD=$x grep "^####.*|" Makefile |tail -1| sed -e 's/.*|//' $x ; fi \\\\\\ - ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\ - ; test "\$\$use" = "\$\@" && BUILD=$x echo "\$\$BUILD" | tail -1 $x \\\\\\ - ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ - ; (cd "\$\$i" && test ! -f configure && \$(MAKE) \$\$use) || exit; done -/dist-all *:/a\\ - @ HOST="\$(HOST)\" \\\\\\ - ; test ".\$\$HOST" = "." && HOST=$x sh $ax_enable_builddir_auxdir/config.guess $x \\\\\\ - ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ - ; found=$x echo \$\$BUILD | wc -w $x \\\\\\ - ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).tar.*" \\\\\\ - ; if test "\$\$found" = "0" ; then : \\\\\\ - ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\ - ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ - ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).tar.* \\\\\\ - ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done -/distclean-all *:/a\\ - @ HOST="\$(HOST)\" \\\\\\ - ; test ".\$\$HOST" = "." && HOST=$x sh $ax_enable_builddir_auxdir/config.guess $x \\\\\\ - ; BUILD=$x grep "^#### .*| *\\./" Makefile | sed -e 's/.*|//' $x \\\\\\ - ; use=$x basename "\$\@" -all $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\ - ; echo "MAKE \$\$HOST : \$\$n * \$\@ (all local builds)" \\\\\\ - ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\ - ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ - ; echo "# rm -r \$\$i"; done ; echo "# (sleep 3)" ; sleep 3 \\\\\\ - ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ - ; echo "rm -r \$\$i"; (rm -r "\$\$i") ; done ; rm Makefile -_EOF - cp "$tmp/conftemp.sed" "$ac_top_srcdir/makefile.sed~" ## DEBUGGING - $ax_enable_builddir_sed -f $tmp/conftemp.sed Makefile >$ac_top_srcdir/Makefile - if test -f "$ac_top_srcdir/Makefile.mk" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: extend top_srcdir/Makefile with top_srcdir/Makefile.mk" >&5 -$as_echo "$as_me: extend top_srcdir/Makefile with top_srcdir/Makefile.mk" >&6;} - cat $ac_top_srcdir/Makefile.mk >>$ac_top_srcdir/Makefile - fi ; xxxx="####" - echo "$xxxx CONFIGURATIONS FOR TOPLEVEL MAKEFILE: " >>$ac_top_srcdir/Makefile - # sanity check - if grep '^; echo "MAKE ' $ac_top_srcdir/Makefile >/dev/null ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: buggy sed found - it deletes tab in \"a\" text parts" >&5 -$as_echo "$as_me: buggy sed found - it deletes tab in \"a\" text parts" >&6;} - $ax_enable_builddir_sed -e '/^@ HOST=/s/^/ /' -e '/^; /s/^/ /' $ac_top_srcdir/Makefile \ - >$ac_top_srcdir/Makefile~ - (test -s $ac_top_srcdir/Makefile~ && mv $ac_top_srcdir/Makefile~ $ac_top_srcdir/Makefile) 2>/dev/null - fi - else - xxxx="\\#\\#\\#\\#" - # echo "/^$xxxx *$ax_enable_builddir_host /d" >$tmp/conftemp.sed - echo "s!^$xxxx [^|]* | *$ax_enable_builddir *\$!$xxxx ...... $ax_enable_builddir!" >$tmp/conftemp.sed - $ax_enable_builddir_sed -f "$tmp/conftemp.sed" "$ac_top_srcdir/Makefile" >$tmp/mkfile.tmp - cp "$tmp/conftemp.sed" "$ac_top_srcdir/makefiles.sed~" ## DEBUGGING - cp "$tmp/mkfile.tmp" "$ac_top_srcdir/makefiles.out~" ## DEBUGGING - if cmp -s "$ac_top_srcdir/Makefile" "$tmp/mkfile.tmp" 2>/dev/null ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: keeping top_srcdir/Makefile from earlier configure" >&5 -$as_echo "$as_me: keeping top_srcdir/Makefile from earlier configure" >&6;} - rm "$tmp/mkfile.tmp" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: reusing top_srcdir/Makefile from earlier configure" >&5 -$as_echo "$as_me: reusing top_srcdir/Makefile from earlier configure" >&6;} - mv "$tmp/mkfile.tmp" "$ac_top_srcdir/Makefile" - fi - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: build in $ax_enable_builddir (HOST=$ax_enable_builddir_host)" >&5 -$as_echo "$as_me: build in $ax_enable_builddir (HOST=$ax_enable_builddir_host)" >&6;} - xxxx="####" - echo "$xxxx" "$ax_enable_builddir_host" "|$ax_enable_builddir" >>$ac_top_srcdir/Makefile - fi - ;; "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval diff --git a/Build/source/libs/zziplib/zziplib-src/configure.ac b/Build/source/libs/zziplib/zziplib-src/configure.ac index 9d45f34b7dc..ff8ae0e2a74 100644 --- a/Build/source/libs/zziplib/zziplib-src/configure.ac +++ b/Build/source/libs/zziplib/zziplib-src/configure.ac @@ -7,7 +7,7 @@ AC_CONFIG_MACRO_DIR([m4]) # ======================================================================= AC_CANONICAL_SYSTEM dnl AM_ENABLE_MULTILIB([Makefile],[$host]) -AX_ENABLE_BUILDDIR +dnl AX_ENABLE_BUILDDIR AC_SET_DEFAULT_PATHS_SYSTEM # ----------------------------------------------------------------------- AC_ARG_ENABLE([thread-safe], @@ -88,7 +88,7 @@ AX_CREATE_PKGCONFIG_INFO(dnl AX_PAX_TAR_CREATE AX_PAX_TAR_EXTRACT AC_PATH_PROGS(PERL, perl5 perl, echo no perl found for) -AC_PATH_PROGS(PYTHON, python, echo no python found for) +AC_PATH_PROGS(PYTHON, python3, echo no python found for) AC_PATH_PROGS(MKZIP, zip pkzip, :) AC_PATH_PROGS(XMLTO, xmlto, :) @@ -252,6 +252,7 @@ case "$enable_mmap" in AC_MSG_RESULT(no (just a bit slower)) ;; esac # --------------------------------------------------------------- +PKG_PROG_PKG_CONFIG AC_MSG_CHECKING(whether making SDL parts) SDL="" SDL_GENERATE="" @@ -261,13 +262,18 @@ AC_ARG_ENABLE(sdl, AC_HELP_STRING( if test "$enable_sdl" = "no" ; then AC_MSG_RESULT([no, disabled]) else - enable_sdl=`pkg-config --modversion sdl 2>/dev/null` - if test -z "$enable_sdl"; then - enable_sdl=`sdl-config --version 2>/dev/null` - SDL_GENERATE="sdl-uninstalled.pc" - enable_sdl="$enable_sdl (sdl-config)" + enable_sdl1=`$PKG_CONFIG --modversion sdl 2>/dev/null` + if test -z "$enable_sdl1"; then + enable_sdl2=`$PKG_CONFIG --modversion sdl2 2>/dev/null` + if test -z "$enable_sdl2"; then + enable_sdl3=`sdl-config --version 2>/dev/null` + SDL_GENERATE="sdl-uninstalled.pc" + enable_sdl="$enable_sdl3 (sdl-config)" + else + enable_sdl="$enable_sdl2 (pkgconfig sdl2)" + fi else - enable_sdl="$enable_sdl (pkgconfig)" + enable_sdl="$enable_sdl1 (pkgconfig sdl)" fi enable_sdl="$enable_sdl." case ".$enable_sdl" in diff --git a/Build/source/libs/zziplib/zziplib-src/docs/CMakeLists.txt b/Build/source/libs/zziplib/zziplib-src/docs/CMakeLists.txt new file mode 100644 index 00000000000..442e877f14b --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/docs/CMakeLists.txt @@ -0,0 +1,180 @@ +cmake_minimum_required (VERSION 3.1) +project(zzipbins VERSION "0.13.71" LANGUAGES C) + +include ( GNUInstallDirs ) +include ( FindPkgConfig ) + +# options ######################################################## +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) + +# Zlib library needed +find_package ( ZLIB REQUIRED ) +# pkg_search_module ( ZZIP zzip ) +find_package(PythonInterp 3.5 REQUIRED) +find_package(UnixCommands REQUIRED) # bash cp mv rm gzip tar +find_program(XMLTO xmlto) + +set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX}) +set(README ${CMAKE_SOURCE_DIR}/README) + +set(topdir ${CMAKE_SOURCE_DIR}) +set(srcdir ${CMAKE_CURRENT_SOURCE_DIR}) +set(outdir ${CMAKE_CURRENT_BINARY_DIR}) +set(PY ${PYTHON_EXECUTABLE}) + +set(mandir ${CMAKE_INSTALL_FULL_MANDIR}) +set(docdir ${CMAKE_INSTALL_FULL_DOCDIR}) + +set(bins ${CMAKE_SOURCE_DIR}/bins) +set(SDLs ${CMAKE_SOURCE_DIR}/SDL) + +# targets ######################################################## +set(doc_FILES README.MSVC6 README.SDL COPYING.MPL COPYING.LIB COPYING.ZLIB + zziplib.html zzipmmapped.html zzipfseeko.html) +set(htm_FILES zzip-index.htm zzip-zip.htm zzip-file.htm zzip-sdl-rwops.htm + zzip-extio.htm zzip-xor.htm zzip-crypt.htm zzip-cryptoid.htm + zzip-api.htm zzip-basics.htm zzip-extras.htm zzip-parse.htm + 64on32.htm future.htm fseeko.htm mmapped.htm memdisk.htm + configs.htm sfx-make.htm developer.htm download.htm + history.htm referentials.htm faq.htm copying.htm notes.htm + functions.htm zip-php.htm) +set(bins_FILES ${bins}/zzdir.c ${bins}/zzcat.c ${bins}/zzobfuscated.c ${bins}/zziptest.c ${bins}/zzxordir.c ${bins}/zzxorcat.c ${bins}/zzxorcopy.c ) +set(SDLs_FILES ${SDLs}/SDL_rwops_zzcat.c ${SDLs}/SDL_rwops_zzip.c ${SDLs}/SDL_rwops_zzip.h ) +set(zzipdoc_FILES makedocs.py zzipdoc/__init__.py + zzipdoc/commentmarkup.py zzipdoc/match.py + zzipdoc/dbk2htm.py zzipdoc/htm2dbk.py + zzipdoc/functionheader.py zzipdoc/options.py + zzipdoc/functionlisthtmlpage.py zzipdoc/textfileheader.py + zzipdoc/functionlistreference.py zzipdoc/textfile.py + zzipdoc/functionprototype.py zzipdoc/htmldocument.py + zzipdoc/docbookdocument.py) + +add_custom_command(OUTPUT changes.htm + COMMAND ${BASH} -c "E=changes.htm \ + ; echo '
' > $E ; cat ${topdir}/ChangeLog \
+    | sed -e 's,\\&,\\&\\;,g' \
+    -e 's,<,\\<\\;,g' -e 's,>,\\>\\;,g' \
+    -e '/^[A-Z].*[12][09][09][09]/s,\\(.*\\),&,' \
+    -e '/^[0-9]/s,\\(.*\\),&,' >> $E ; echo '
' >>$E" + DEPENDS ${topdir}/ChangeLog + VERBATIM) + +set(mksite_sh_args --VERSION=${PROJECT_VERSION} --xml --src-dir=${srcdir} --print) +add_custom_command(OUTPUT site.html + COMMAND ${CP} ${srcdir}/body.htm site.htm + COMMAND ${BASH} ${srcdir}/mksite.sh ${mksite_sh_args} site.htm + COMMAND ${BASH} -c "for i in *.html; do sed -i -e s:${srcdir}:../../docs: $i; done; true" + DEPENDS ${htm_FILES} changes.htm + VERBATIM) +add_custom_target(site DEPENDS site.html) + +add_custom_command(OUTPUT zzip.xml + COMMAND ${PY} ${srcdir}/zzipdoc/htm2dbk.py ${htm_FILES} zziplib.xml -o ${outdir}/zzip.xml + DEPENDS zziplib.xml ${htm_FILES} + WORKING_DIRECTORY ${srcdir} + VERBATIM) +add_custom_target(dbk DEPENDS zzip.xml) + +if(XMLTO) +add_custom_command(OUTPUT zzip.html + COMMAND ${XMLTO} html-nochunks zzip.xml + DEPENDS zzip.xml + VERBATIM) +add_custom_command(OUTPUT zzip.pdf + COMMAND ${XMLTO} pdf zzip.xml + DEPENDS zzip.xml + VERBATIM) +add_custom_target(pdf DEPENDS zzip.pdf) +endif() + +set(docinfo --package=zziplib --version=${PROJECT_VERSION}) +file(GLOB zzip_sources "${topdir}/zzip/*.c") +add_custom_command(OUTPUT zziplib.xml + COMMAND ${PY} ${srcdir}/makedocs.py ${zzip_sources} ${docinfo} --onlymainheader=zzip/lib.h --output=zziplib + COMMAND ${MV} zziplib.docbook zziplib.xml + DEPENDS libzzip + BYPRODUCTS zziplib.html + VERBATIM) +add_custom_command(OUTPUT zzipmmapped.xml + COMMAND ${PY} ${srcdir}/makedocs.py ${zzip_sources} ${docinfo} --onlymainheader=zzip/mmapped.h --output=zzipmmapped + COMMAND ${MV} zzipmmapped.docbook zzipmmapped.xml + DEPENDS libzzipmmapped + BYPRODUCTS zzipmmapped.html + VERBATIM) +add_custom_command(OUTPUT zzipfseeko.xml + COMMAND ${PY} ${srcdir}/makedocs.py ${zzip_sources} ${docinfo} --onlymainheader=zzip/fseeko.h --output=zzipfseeko + COMMAND ${MV} zzipfseeko.docbook zzipfseeko.xml + DEPENDS libzzipfseeko + BYPRODUCTS zzipfseeko.html + VERBATIM) +add_custom_command(OUTPUT manpages.tar + COMMAND ${BASH} -c "test -d man3 && rm -rf man3; mkdir man3" + COMMAND ${PY} ${srcdir}/dbk2man.py -o man3 man zziplib.xml + COMMAND ${PY} ${srcdir}/dbk2man.py -o man3 man zzipmmapped.xml + COMMAND ${PY} ${srcdir}/dbk2man.py -o man3 man zzipfseeko.xml + COMMAND ${BASH} -c "test -d man3/man3 && mv man3 man3_; test -d man3_/man3 && mv man3_/man3 .; rm -rf man3_" + COMMAND ${BASH} -c "chmod 664 man3/*.3" + COMMAND ${BASH} -c "tar cf manpages.tar man3" + COMMAND ${BASH} -c "ls -l `pwd`/manpages.tar `pwd`/htmpages.tar >&2 || true" + DEPENDS zziplib.xml zzipmmapped.xml zzipfseeko.xml + VERBATIM) +add_custom_command(OUTPUT htmpages.tar + COMMAND ${BASH} -c "test -d html && rm -rf html; mkdir html" + COMMAND ${PY} ${srcdir}/dbk2man.py -o html html zziplib.xml + COMMAND ${PY} ${srcdir}/dbk2man.py -o html html zzipmmapped.xml + COMMAND ${PY} ${srcdir}/dbk2man.py -o html html zzipfseeko.xml + COMMAND ${PY} ${srcdir}/dir2index.py -o html html + COMMAND ${BASH} -c "tar cf htmpages.tar html/*.*" + COMMAND ${BASH} -c "ls -l `pwd`/htmpages.tar `pwd`/manpages.tar >&2 || true" + 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) + + +string(REPLACE ";" " " all_bins_FILES "${bins_FILES}") +string(REPLACE ";" " " all_SDLs_FILES "${SDLs_FILES}") +add_custom_target(install-site + COMMAND ${BASH} -c "ls -l ${CMAKE_CURRENT_BINARY_DIR}/site.html" + COMMAND ${BASH} -c "mkdir -vp $(DESTDIR)${docdir} >&2 || ls -ld $(DESTDIR)${docdir} >&2" + COMMAND ${BASH} -c "cd ${outdir} && cp zziplib.html zzipmmapped.html zzipfseeko.html $(DESTDIR)${docdir}/" + COMMAND ${BASH} -c "cd ${srcdir} && cp README.* COPYING.* $(DESTDIR)${docdir}/" + COMMAND ${BASH} -c "cd ${topdir} && cp ChangeLog $(DESTDIR)${docdir}/" + COMMAND ${BASH} -c "cd ${topdir} && cp ${all_bins_FILES} $(DESTDIR)${docdir}/" + COMMAND ${BASH} -c "cd ${topdir} && cp ${all_SDLs_FILES} $(DESTDIR)${docdir}/" + COMMAND ${BASH} -c "cd $(DESTDIR)${docdir} && cp ${outdir}/*.html ." + COMMAND ${BASH} -c "cd $(DESTDIR)${docdir} && ln -s zzip-index.html index.html" + DEPENDS site.html zziplib.html zzipmmapped.html zzipfseeko.html + VERBATIM) +add_custom_target(install-htmpages + COMMAND ${BASH} -c "ls -l ${CMAKE_CURRENT_BINARY_DIR}/*pages.tar" + COMMAND ${BASH} -c "mkdir -vp $(DESTDIR)${docdir} >&2 || ls -ld $(DESTDIR)${docdir} >&2" + COMMAND ${BASH} -c "cd $(DESTDIR)${docdir} && tar x -f ${outdir}/htmpages.tar" + COMMAND ${BASH} -c "cd $(DESTDIR)${docdir} && mv html man" + DEPENDS htmpages.tar + VERBATIM) +add_custom_target(install-manpages + COMMAND ${BASH} -c "ls -l ${CMAKE_CURRENT_BINARY_DIR}/*pages.tar" + COMMAND ${BASH} -c "mkdir -vp $(DESTDIR)${mandir} >&2 || ls -ld $(DESTDIR)${mandir} >&2" + 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 + \")") diff --git a/Build/source/libs/zziplib/zziplib-src/docs/Makefile.am b/Build/source/libs/zziplib/zziplib-src/docs/Makefile.am index 1e00f0fb188..7e009a13ef7 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/Makefile.am +++ b/Build/source/libs/zziplib/zziplib-src/docs/Makefile.am @@ -22,10 +22,11 @@ changelog = @top_srcdir@/ChangeLog EXTRA_DIST = make-doc.py $(doc_FILES) $(htm_FILES) $(SDL_RWOPS) \ make-doc.pl make-dbk.pl mksite.sh mksite.pl body.htm \ + dbk2man.py dir2index.py \ $(zzipdoc_FILES) sdocbook.css \ zziplib-manpages.dbk zziplib-master.dbk \ zziplib-manpages.tar -CLEANFILES = *.pc *.omf *.tar *.html *.xml +CLEANFILES = *.pc *.omf *.tar *.html *.xml changes.htm DISTCLEANFILES = zziplib.spec zzipdoc_FILES = makedocs.py zzipdoc/__init__.py \ @@ -149,27 +150,23 @@ manpages.tar : zziplib.xml zzipmmapped.xml zzipfseeko.xml ; chmod 664 man3/*.3 \ ; echo '$(PAX_TAR_CREATE) "$@" man3/' \ ; $(PAX_TAR_CREATE) "$@" man3/ \ - ; echo '$(DELETE); rm man3/*.3 ; rmdir man3' \ - ; $(DELETE); rm man3/*.3 ; rmdir man3 \ ; fi ; true @ if test "$(XMLTO)" = ":" \ ; then echo going to regenerate "$@" in subdir "'"man"'" \ ; echo 'test ! -d man3 || rm man3/* ; test -d man3 || mkdir man3' \ ; test ! -d man3 || rm man3/* ; test -d man3 || mkdir man3 \ - ; echo '$(srcdir)/dbk2man.py -d man3 zziplib.xml' \ - ; $(PYTHON) $(srcdir)/dbk2man.py -d man3 zziplib.xml \ - ; echo '$(srcdir)/dbk2man.py -d man3 zzipmmapped.xml' \ - ; $(PYTHON) $(srcdir)/dbk2man.py -d man3 zzipmmapped.xml \ - ; echo '$(srcdir)/dbk2man.py -d man3 zzipfseeko.xml' \ - ; $(PYTHON) $(srcdir)/dbk2man.py -d man3 zzipfseeko.xml \ + ; echo '$(srcdir)/dbk2man.py -o man3 man zziplib.xml' \ + ; $(PYTHON) $(srcdir)/dbk2man.py -o man3 man zziplib.xml \ + ; echo '$(srcdir)/dbk2man.py -o man3 man zzipmmapped.xml' \ + ; $(PYTHON) $(srcdir)/dbk2man.py -o man3 man zzipmmapped.xml \ + ; echo '$(srcdir)/dbk2man.py -o man3 man zzipfseeko.xml' \ + ; $(PYTHON) $(srcdir)/dbk2man.py -o man3 man zzipfseeko.xml \ ; if test -d man3/man3; then mv man3 man3_ \ ; mv man3_/man3 man3; rm -r man3_; fi \ ; echo 'chmod 664 man3/*.3' \ ; chmod 664 man3/*.3 \ ; echo '$(PAX_TAR_CREATE) "$@" man3/' \ ; $(PAX_TAR_CREATE) "$@" man3/ \ - ; echo '$(DELETE); rm man3/*.3 ; rmdir man3' \ - ; $(DELETE); rm man3/*.3 ; rmdir man3 \ ; fi ; true @ if test -s $@ \ ; then echo cp $@ zziplib-$@ "(saved)"; cp $@ zziplib-$@ \ @@ -182,7 +179,7 @@ htmpages.tar : zziplib.xml zzipmmapped.xml zzipfseeko.xml zziplib-manpages.dbk : "html format of the manpages - put into zziplib/htdocs/man/*" @ if test "$(XMLTO)" != ":" \ ; then echo going to regenerate "$@" in subdir "'"html"'" \ - ; echo 'test ! -d html || rm /* ; test -d html || mkdir html' \ + ; echo 'test ! -d html || rm html/* ; test -d html || mkdir html' \ ; test ! -d html || rm html/* ; test -d html || mkdir html \ ; echo 'cp $(srcdir)/zziplib-manpages.dbk zziplib-manpages.xml' \ ; cp $(srcdir)/zziplib-manpages.dbk zziplib-manpages.xml \ @@ -190,8 +187,23 @@ htmpages.tar : zziplib.xml zzipmmapped.xml zzipfseeko.xml zziplib-manpages.dbk ; $(XMLTO) -o html html zziplib-manpages.xml | tee written.lst \ ; echo '$(PAX_TAR_CREATE) $@ html/*.*' \ ; $(PAX_TAR_CREATE) $@ html/*.* \ - ; echo '$(DELETE); rm html/*.* ; rmdir html' \ - ; $(DELETE); rm html/*.* ; rmdir html \ + ; fi ; true + @ if test "$(XMLTO)" = ":" \ + ; then echo going to regenerate "$@" in subdir "'"html"'" \ + ; echo 'test ! -d html || rm html/* ; test -d html || mkdir html' \ + ; test ! -d html || rm html/* ; test -d html || mkdir html \ + ; echo 'cp $(srcdir)/zziplib-manpages.dbk zziplib-manpages.xml' \ + ; cp $(srcdir)/zziplib-manpages.dbk zziplib-manpages.xml \ + ; echo '$(srcdir)/dbk2man.py -o html html zziplib.xml' \ + ; $(PYTHON) $(srcdir)/dbk2man.py -o html html zziplib.xml \ + ; echo '$(srcdir)/dbk2man.py -o html html zzipmmapped.xml' \ + ; $(PYTHON) $(srcdir)/dbk2man.py -o html html zzipmmapped.xml \ + ; echo '$(srcdir)/dbk2man.py -o html html zzipfseeko.xml' \ + ; $(PYTHON) $(srcdir)/dbk2man.py -o html html zzipfseeko.xml \ + ; echo '$(srcdir)/dir2index.py -o html html ' \ + ; $(PYTHON) $(srcdir)/dir2index.py -o html html \ + ; echo '$(PAX_TAR_CREATE) $@ html/*.*' \ + ; $(PAX_TAR_CREATE) $@ html/*.* \ ; fi ; true @ if test -s $@ \ ; then echo cp $@ zziplib-$@ "(saved)"; cp $@ zziplib-$@ \ diff --git a/Build/source/libs/zziplib/zziplib-src/docs/Makefile.in b/Build/source/libs/zziplib/zziplib-src/docs/Makefile.in index 50d1e76b5dc..6dfef6454b9 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/Makefile.in +++ b/Build/source/libs/zziplib/zziplib-src/docs/Makefile.in @@ -100,9 +100,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_compile_check_sizeof.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_aligned_access_required.m4 \ $(top_srcdir)/m4/ax_check_enable_debug.m4 \ - $(top_srcdir)/m4/ax_configure_args.m4 \ $(top_srcdir)/m4/ax_create_pkgconfig_info.m4 \ - $(top_srcdir)/m4/ax_enable_builddir.m4 \ $(top_srcdir)/m4/ax_expand_prefix.m4 \ $(top_srcdir)/m4/ax_maintainer_mode_auto_silent.m4 \ $(top_srcdir)/m4/ax_not_enable_frame_pointer.m4 \ @@ -221,6 +219,8 @@ PAX_TAR_CREATE = @PAX_TAR_CREATE@ PAX_TAR_EXTRACT = @PAX_TAR_EXTRACT@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RELEASE_INFO = @RELEASE_INFO@ @@ -254,7 +254,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -325,11 +324,12 @@ SDL_RWOPS = $(SDL)/SDL_rwops_zzcat.c \ changelog = @top_srcdir@/ChangeLog EXTRA_DIST = make-doc.py $(doc_FILES) $(htm_FILES) $(SDL_RWOPS) \ make-doc.pl make-dbk.pl mksite.sh mksite.pl body.htm \ + dbk2man.py dir2index.py \ $(zzipdoc_FILES) sdocbook.css \ zziplib-manpages.dbk zziplib-master.dbk \ zziplib-manpages.tar -CLEANFILES = *.pc *.omf *.tar *.html *.xml +CLEANFILES = *.pc *.omf *.tar *.html *.xml changes.htm DISTCLEANFILES = zziplib.spec zzipdoc_FILES = makedocs.py zzipdoc/__init__.py \ zzipdoc/commentmarkup.py zzipdoc/match.py \ @@ -655,27 +655,23 @@ manpages.tar : zziplib.xml zzipmmapped.xml zzipfseeko.xml ; chmod 664 man3/*.3 \ ; echo '$(PAX_TAR_CREATE) "$@" man3/' \ ; $(PAX_TAR_CREATE) "$@" man3/ \ - ; echo '$(DELETE); rm man3/*.3 ; rmdir man3' \ - ; $(DELETE); rm man3/*.3 ; rmdir man3 \ ; fi ; true @ if test "$(XMLTO)" = ":" \ ; then echo going to regenerate "$@" in subdir "'"man"'" \ ; echo 'test ! -d man3 || rm man3/* ; test -d man3 || mkdir man3' \ ; test ! -d man3 || rm man3/* ; test -d man3 || mkdir man3 \ - ; echo '$(srcdir)/dbk2man.py -d man3 zziplib.xml' \ - ; $(PYTHON) $(srcdir)/dbk2man.py -d man3 zziplib.xml \ - ; echo '$(srcdir)/dbk2man.py -d man3 zzipmmapped.xml' \ - ; $(PYTHON) $(srcdir)/dbk2man.py -d man3 zzipmmapped.xml \ - ; echo '$(srcdir)/dbk2man.py -d man3 zzipfseeko.xml' \ - ; $(PYTHON) $(srcdir)/dbk2man.py -d man3 zzipfseeko.xml \ + ; echo '$(srcdir)/dbk2man.py -o man3 man zziplib.xml' \ + ; $(PYTHON) $(srcdir)/dbk2man.py -o man3 man zziplib.xml \ + ; echo '$(srcdir)/dbk2man.py -o man3 man zzipmmapped.xml' \ + ; $(PYTHON) $(srcdir)/dbk2man.py -o man3 man zzipmmapped.xml \ + ; echo '$(srcdir)/dbk2man.py -o man3 man zzipfseeko.xml' \ + ; $(PYTHON) $(srcdir)/dbk2man.py -o man3 man zzipfseeko.xml \ ; if test -d man3/man3; then mv man3 man3_ \ ; mv man3_/man3 man3; rm -r man3_; fi \ ; echo 'chmod 664 man3/*.3' \ ; chmod 664 man3/*.3 \ ; echo '$(PAX_TAR_CREATE) "$@" man3/' \ ; $(PAX_TAR_CREATE) "$@" man3/ \ - ; echo '$(DELETE); rm man3/*.3 ; rmdir man3' \ - ; $(DELETE); rm man3/*.3 ; rmdir man3 \ ; fi ; true @ if test -s $@ \ ; then echo cp $@ zziplib-$@ "(saved)"; cp $@ zziplib-$@ \ @@ -688,7 +684,7 @@ htmpages.tar : zziplib.xml zzipmmapped.xml zzipfseeko.xml zziplib-manpages.dbk : "html format of the manpages - put into zziplib/htdocs/man/*" @ if test "$(XMLTO)" != ":" \ ; then echo going to regenerate "$@" in subdir "'"html"'" \ - ; echo 'test ! -d html || rm /* ; test -d html || mkdir html' \ + ; echo 'test ! -d html || rm html/* ; test -d html || mkdir html' \ ; test ! -d html || rm html/* ; test -d html || mkdir html \ ; echo 'cp $(srcdir)/zziplib-manpages.dbk zziplib-manpages.xml' \ ; cp $(srcdir)/zziplib-manpages.dbk zziplib-manpages.xml \ @@ -696,8 +692,23 @@ htmpages.tar : zziplib.xml zzipmmapped.xml zzipfseeko.xml zziplib-manpages.dbk ; $(XMLTO) -o html html zziplib-manpages.xml | tee written.lst \ ; echo '$(PAX_TAR_CREATE) $@ html/*.*' \ ; $(PAX_TAR_CREATE) $@ html/*.* \ - ; echo '$(DELETE); rm html/*.* ; rmdir html' \ - ; $(DELETE); rm html/*.* ; rmdir html \ + ; fi ; true + @ if test "$(XMLTO)" = ":" \ + ; then echo going to regenerate "$@" in subdir "'"html"'" \ + ; echo 'test ! -d html || rm html/* ; test -d html || mkdir html' \ + ; test ! -d html || rm html/* ; test -d html || mkdir html \ + ; echo 'cp $(srcdir)/zziplib-manpages.dbk zziplib-manpages.xml' \ + ; cp $(srcdir)/zziplib-manpages.dbk zziplib-manpages.xml \ + ; echo '$(srcdir)/dbk2man.py -o html html zziplib.xml' \ + ; $(PYTHON) $(srcdir)/dbk2man.py -o html html zziplib.xml \ + ; echo '$(srcdir)/dbk2man.py -o html html zzipmmapped.xml' \ + ; $(PYTHON) $(srcdir)/dbk2man.py -o html html zzipmmapped.xml \ + ; echo '$(srcdir)/dbk2man.py -o html html zzipfseeko.xml' \ + ; $(PYTHON) $(srcdir)/dbk2man.py -o html html zzipfseeko.xml \ + ; echo '$(srcdir)/dir2index.py -o html html ' \ + ; $(PYTHON) $(srcdir)/dir2index.py -o html html \ + ; echo '$(PAX_TAR_CREATE) $@ html/*.*' \ + ; $(PAX_TAR_CREATE) $@ html/*.* \ ; fi ; true @ if test -s $@ \ ; then echo cp $@ zziplib-$@ "(saved)"; cp $@ zziplib-$@ \ diff --git a/Build/source/libs/zziplib/zziplib-src/docs/cpp2markdown-1.py b/Build/source/libs/zziplib/zziplib-src/docs/cpp2markdown-1.py index 60d28c4a0f4..aaaf39038a5 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/cpp2markdown-1.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/cpp2markdown-1.py @@ -1,4 +1,5 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 + import pygments.lexers.compiled as lexer import optparse import re @@ -108,7 +109,7 @@ class CppToMarkdown: def run(self, filename): filetext = open(filename).read() for line in self.process(filetext, filename): - print line + print(line) def process(self, filetext, filename=""): section_ruler = "-----------------------------------------" copyright = "" @@ -136,7 +137,7 @@ class CppToMarkdown: else: if text: yield "#### NOTES" - print token, text.replace("\n", "\n ") + print(token + " " + text.replace("\n", "\n ")) if copyright: yield section_ruler yield "### COPYRIGHT" diff --git a/Build/source/libs/zziplib/zziplib-src/docs/cpp2markdown.py b/Build/source/libs/zziplib/zziplib-src/docs/cpp2markdown.py index 710bbdc2437..749de359cc7 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/cpp2markdown.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/cpp2markdown.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import pygments.lexers.compiled as lexer import optparse import re @@ -62,7 +64,7 @@ class CppToMarkdown: def run(self, filename): filetext = open(filename).read() for line in self.process(filetext, filename): - print line + print(line) def process(self, filetext, filename=""): for token, text in self.parse(filetext): if token == FileInclude: @@ -86,7 +88,7 @@ class CppToMarkdown: else: if text: yield "#### NOTES" - print token, text.replace("\n", "\n ") + print(token + " " + text.replace("\n", "\n ")) def isexported_function(self): function = self.function_text.strip().replace("\n"," ") logg.debug("@ --------------------------------------") diff --git a/Build/source/libs/zziplib/zziplib-src/docs/dbk2man.py b/Build/source/libs/zziplib/zziplib-src/docs/dbk2man.py index 04fe57ae9a3..49cac4e0ff3 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/dbk2man.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/dbk2man.py @@ -1,4 +1,5 @@ -#! /usr/bin/python +#! /usr/bin/python3 + """ Converts an xml-file with docbook elements into troff manual pages. The conversion uses etree expecting elements in the input. The output goes to a multiple files in manX/* subdirectories. @@ -9,22 +10,52 @@ __author__ = "Guido U. Draheim" import logging import os.path import re +import collections import xml.etree.ElementTree as ET logg = logging.getLogger("dbk2man") +def esc(text): + text = str(text) + text = text.replace(".", "\\&.") + text = text.replace("-", "\\-") + return text +def unescape(text): + text = str(text) + text = text.replace('<', '<') + text = text.replace('>', '>') + text = text.replace('"', '"') + text = text.replace('&', '&') + return text +def htm(text): + text = str(text) + text = text.replace('&', '&') + text = text.replace('<', '<') + text = text.replace('>', '>') + text = text.replace('"', '"') + return text +def mailhref(text): + return re.sub("<([^<>]*@[^<>]*)>", + lambda x: '<%s>' % (x.group(1), x.group(1)), + text) + +OverviewEntry = collections.namedtuple("OverviewEntry", ["manpage", "manvolnum", "refpurpose"]) + def parse_docbook(filename): tree = ET.parse(filename) return tree.getroot() -def dbk2man(filename, subdirectory = "."): - root = parse_docbook(filename) - return docbook2man(root, subdirectory) +def dbk2(man, filenames, subdirectory = "."): + for filename in filenames: + root = parse_docbook(filename) + overview = docbook2(man, root, subdirectory) + overview2(man, overview, subdirectory, filename) -def docbook2man(root, subdirectory = "."): +def docbook2(man, root, subdirectory = "."): if root.tag != "reference": logg.warning("no found, not a docbook file?") logg.warning("found <%s> instead", root.tag) + overview = {} title = "" for refentry in root: if refentry.tag == 'title': @@ -34,21 +65,12 @@ def docbook2man(root, subdirectory = "."): logg.warning("no list found, not a docbook file?") logg.warning("found <%s> instead", refentry.tag) continue - refentry2man(refentry, subdirectory, title) - -def esc(text): - text = text.replace(".", "\\&.") - text = text.replace("-", "\\-") - return text -def unescape(text): - text = text.replace('<', '<') - text = text.replace('>', '>') - text = text.replace('"', '"') - text = text.replace('&', '&') - return text + overviewref = refentry2(man, refentry, subdirectory, title) + for filename, overviewentry in overviewref.items(): + overview[filename] = overviewentry + return overview - -def refentryinfo2(refentry, title): +def refentryinfo2(man, refentry, title): date, productname, manvolnum, refentrytitle = "", "", "", "" section = refentry.find("refentryinfo") if section is not None: @@ -62,24 +84,38 @@ def refentryinfo2(refentry, title): if found is not None: refentrytitle = found.text found = section.find("manvolnum") if found is not None: manvolnum = found.text - header = [] - if refentrytitle: - header += [ refentrytitle ] - if manvolnum: - header += [ manvolnum ] - if date: - header += [ date ] - if productname: - header += [ productname ] - if title: - header += [ title ] - if header: + if man: + header = [] + if refentrytitle: + header += [ refentrytitle ] + if manvolnum: + header += [ manvolnum ] + if date: + header += [ date ] + if productname: + header += [ productname ] + if title: + header += [ title ] + if not header: + logg.warning("no found") + return "" text = '.TH ' + " ".join([ '"%s"' % esc(part) for part in header]) return text + "\n" - logg.warning("no found") - return "" + else: + text = "" + if productname or title: + text += "%s: " % htm(productname or title) + text += htm(refentrytitle) + if manvolnum: + text += "(%s)" % htm(manvolnum) + text += "" + text += "\n" + '' % htm(productname or title) + text += "\n" + '' % htm(refentrytitle) + text += "\n" + '' % htm(manvolnum) + text += "\n" + '' % htm(date) + return text + "\n\n" -def refentrytitle2(refentry, title = ""): +def refentrytitle2(man, refentry, title = ""): refentrytitle = "" section = refentry.find("refmeta") if section is not None: @@ -95,89 +131,170 @@ def refentrytitle2(refentry, title = ""): refname = found.text if refname not in refentries: refentries.append(refname) - if refentrytitle: + if not refentrytitle: + logg.warning("no found") + return "" + elif man: text = '.SH "NAME"' + "\n" text += "" + esc(", ".join(refentries)) text += " " + esc("-") text += " " + esc(refpurpose) return text + "\n" - logg.warning("no found") - return "" + else: + text = '

Name

' + "\n" + text += "

" + htm(", ".join(refentries)) + text += " " + htm("-") + text += " " + htm(refpurpose) + text += "

" + return text + "\n" +def refsynopsisdiv2(man, refentry, title = ""): + refsynopsisdiv = refentry.find("refsynopsisdiv") + if refsynopsisdiv is None: + logg.warning("no found") + return "" + if man: + return refsynopsisdiv2man(refsynopsisdiv, title) + else: + return refsynopsisdiv2htm(refsynopsisdiv, title) -def refsynopsisdiv2(refentry, title = ""): - section = refentry.find("refsynopsisdiv") - if section is not None: - text = '.SH "SYNOPSIS"' + "\n" - text += ".sp\n" - text += ".nf\n" - for funcsynopsis in section.findall("funcsynopsis"): - funcsynopsisinfo = "" - found = funcsynopsis.find("funcsynopsisinfo") - if found is not None: funcsynopsisinfo = found.text - if funcsynopsisinfo: - for info in funcsynopsisinfo.split("\n"): - text += '.B "%s"' % esc(info) - text += "\n" - text += ".sp" + "\n" - else: - logg.debug("no found") - logg.debug("\n%s", ET.tostring(funcsynopsis)) - funcs = 0 - for funcprototype in funcsynopsis.findall("funcprototype"): - item = ET.tostring(funcprototype) - item = item.replace("","") - item = item.replace("","") - if False: - item = item.replace("\n", " ") - item = item.replace("","") - item = item.replace("","") - item = item.replace("",'') - item = item.replace("",'') - items = item.split("") - text += '.BI %s' % " ".join(['"%s"' % part for part in items if part]) - else: - item = item.replace("","") - item = re.sub(r"([_\w]+)", lambda x: "\\fI%s\\fR" % x.group(1), item) - item = item.replace("",'') - item = item.replace("",'') - text += item +def refsynopsisdiv2man(refsynopsisdiv, title = ""): + text = '.SH "SYNOPSIS"' + "\n" + text += ".sp\n" + text += ".nf\n" + for funcsynopsis in refsynopsisdiv.findall("funcsynopsis"): + funcsynopsisinfo = "" + found = funcsynopsis.find("funcsynopsisinfo") + if found is not None: funcsynopsisinfo = found.text + if funcsynopsisinfo: + for info in funcsynopsisinfo.split("\n"): + text += '.B "%s"' % esc(info) text += "\n" - funcs += 1 - if not funcs: - logg.warning("no found") - logg.warning("\n%s", ET.tostring(funcsynopsis)) - text += ".fi" + "\n" text += ".sp" + "\n" - return text - logg.warning("no found") - return "" + else: + logg.debug("no found") + logg.debug("\n%s", ET.tostring(funcsynopsis)) + funcs = 0 + for funcprototype in funcsynopsis.findall("funcprototype"): + item = ET.tostring(funcprototype) + item = str(item) + item = item.replace("","") + item = item.replace("","") + if False: + item = item.replace("\n", " ") + item = item.replace("","") + item = item.replace("","") + item = item.replace("",'') + item = item.replace("",'') + items = item.split("") + text += '.BI %s' % " ".join(['"%s"' % part for part in items if part]) + else: + item = item.replace("","") + item = re.sub(r"([_\w]+)", lambda x: "\\fI%s\\fR" % x.group(1), item) + item = item.replace("",'') + item = item.replace("",'') + text += item + text += "\n" + funcs += 1 + if not funcs: + logg.warning("no found") + logg.warning("\n%s", ET.tostring(funcsynopsis)) + text += ".fi" + "\n" + text += ".sp" + "\n" + return text + +def refsynopsisdiv2htm(refsynopsisdiv, title = ""): + text = '

Synopsis

' + "\n" + text += '
' + "\n"
+    for funcsynopsis in refsynopsisdiv.findall("funcsynopsis"):
+        funcsynopsisinfo = ""
+        found = funcsynopsis.find("funcsynopsisinfo")
+        if found is not None: funcsynopsisinfo = found.text
+        if funcsynopsisinfo:
+            for info in funcsynopsisinfo.split("\n"):
+                text += '%s' % htm(info)
+                text += "\n"
+            text += "\n"
+        else:
+            logg.debug("no  found")
+            logg.debug("\n%s", ET.tostring(funcsynopsis))
+        funcs = 0
+        for funcprototype in funcsynopsis.findall("funcprototype"):
+            item = ET.tostring(funcprototype)
+            item = str(item)
+            item = item.replace("","")
+            item = item.replace("","")
+            item = item.replace("","")
+            item = re.sub(r"([_\w]+)", lambda x: "%s" % x.group(1), item)
+            item = item.replace("",'')
+            item = item.replace("",'')
+            text += item 
+            text += "\n"
+            funcs += 1
+        if not funcs:
+            logg.warning("no  found")
+            logg.warning("\n%s", ET.tostring(funcsynopsis))
+        text += "
" + "\n" + return text -def refsections2(refentry, title = ""): +def refsections2(man, refentry, title = ""): text = "" for refsect in refentry.findall("refsect1"): - head = refsect.find("title") - if head is not None: - text += '.SH "%s"' % (esc(head.text.upper())) - text += "\n" - for para in list(refsect): - if para.tag == 'title': - continue - if para.tag == 'para': - text += cleanpara(para) + "\n" + if man: + text += refsect2man(refsect, title) + text += ".sp\n" + else: + text += refsect2htm(refsect, title) + return text + + +def refsect2man(refsect, title = ""): + text = "" + head = refsect.find("title") + if head is not None: + text += '.SH "%s"' % (esc(head.text.upper())) + text += "\n" + for para in list(refsect): + if para.tag == 'title': + continue + if para.tag == 'para': + text += para2man(para) + "\n" + text += ".sp\n" + continue + if para.tag == 'itemizedlist': + for item in list(para): + text += para2man(item) + "\n" text += ".sp\n" - continue - if para.tag == 'itemizedlist': - for item in list(para): - text += cleanpara(item) + "\n" - text += ".sp\n" - continue - logg.warning("unknown para <%s>", para.tag) - text += ".sp\n" + continue + logg.warning("unknown para <%s>", para.tag) + return text + +def refsect2htm(refsect, title = ""): + text = "" + head = refsect.find("title") + if head is not None: + text += '

%s

' % htm(head.text) + text += "\n" + for para in list(refsect): + if para.tag == 'title': + continue + if para.tag == 'para': + text += "

" + para2htm(para) + text += "

" + "\n" + continue + if para.tag == 'itemizedlist': + text += "
    " + "\n" + for item in list(para): + text += "
  • " + para2htm(item) + text += "

  • " + "\n" + text += "
" + "\n" + continue + logg.warning("unknown para <%s>", para.tag) return text -def cleanpara(para): +def para2man(para): item = unescape(ET.tostring(para)) + item = str(item) item = item.replace("\n", " ") item = item.replace(" ", " ") item = item.replace(" ", " ") @@ -193,24 +310,53 @@ def cleanpara(para): item = item.replace("", "\\fP") return item -def styleinfo(): - styles = [] - styles += [ ".ie \\n(.g .ds Aq \\(aq" ] - styles += [ ".el .ds Aq " ] # http://bugs.debian.org/507673 - styles += [ ".nh" ] # disable hyphenation - styles += [ ".ad l" ] # align left, no justification - return "".join([ "%s\n" % part for part in styles ]) +def para2htm(para): + item = unescape(ET.tostring(para)) + item = str(item) + item = item.replace("\n", " ") + item = item.replace(" ", " ") + item = item.replace(" ", " ") + item = item.replace(" ", " ") + item = item.replace(" ", " ") + item = item.replace("", "") + item = item.replace("", "") + item = item.replace("", "") + item = item.replace("", "") + item = item.replace("", "") + item = item.replace("", "") + item = item.replace("", "") + item = item.replace("", "") + item = mailhref(item) + return item + +def styleinfo2(man): + if man: + styles = [] + styles += [ ".ie \\n(.g .ds Aq \\(aq" ] + styles += [ ".el .ds Aq " ] # http://bugs.debian.org/507673 + styles += [ ".nh" ] # disable hyphenation + styles += [ ".ad l" ] # align left, no justification + return "".join([ "%s\n" % part for part in styles ]) + else: + return "" + +def refends2(man): + if man: + return "" + else: + return "" + "\n" -def refentry2man(refentry, subdirectory = ".", title = ""): +def refentry2(man, refentry, subdirectory = ".", title = ""): if refentry.tag != "refentry": logg.warning("no found, not a docbook file?") logg.warning("found <%s> instead", refentry.tag) text = "" - text += refentryinfo2(refentry, title) - text += styleinfo() - text += refentrytitle2(refentry, title) - text += refsynopsisdiv2(refentry) - text += refsections2(refentry) + text += refentryinfo2(man, refentry, title) + text += styleinfo2(man) + text += refentrytitle2(man, refentry, title) + text += refsynopsisdiv2(man, refentry) + text += refsections2(man, refentry) + text += refends2(man) ### write the files refentrytitle = "" @@ -221,24 +367,70 @@ def refentry2man(refentry, subdirectory = ".", title = ""): if found is not None: refentrytitle = found.text found = section.find("manvolnum") if found is not None: manvolnum = found.text - written = 0 + # + refpurpose = "" section = refentry.find("refnamediv") - for refname in section.findall("refname"): - if not refentrytitle: - refentrytitle = refname.text - manpage = refname.text - filename = "%s/man%s/%s.%s" % (subdirectory, manvolnum, manpage, manvolnum) - if manpage != refentrytitle: - manpagetext = ".so %s.%s\n" % (refentrytitle, manvolnum) - writefile(filename, manpagetext) - else: - manpagetext = text + if section is None: + logg.warning("no found in for '%s', bad docbook?", refentrytitle) + if not refentrytitle: raise Exception("not even a refentrytitle") + manpages = [ refentrytitle ] + else: + manpages = [ refname.text for refname in section.findall("refname") ] + found = section.find("refpurpose") + if found is not None: refpurpose = found.text + # + overview = {} + if man: + written = 0 + for manpage in manpages: + if not refentrytitle: + refentrytitle = manpage + filename = "%s/man%s/%s.%s" % (subdirectory, manvolnum, manpage, manvolnum) + if manpage != refentrytitle: + manpagetext = ".so %s.%s\n" % (refentrytitle, manvolnum) + writefile(filename, manpagetext) + else: + manpagetext = text + writefile(filename, manpagetext) + written += 1 + overview[filename] = OverviewEntry(manpage, manvolnum, refpurpose) + if not written: + manpage = refentrytitle + filename = "%s/man%s/%s.%s" % (subdirectory, manvolnum, manpage, manvolnum) writefile(filename, manpagetext) - written += 1 - if not written: + overview[filename] = OverviewEntry(manpage, manvolnum, refpurpose) + else: manpage = refentrytitle - filename = "%s/man%s/%s.%s" % (subdirectory, manvolnum, manpage, manvolnum) - writefile(filename, manpagetext) + filename = "%s/%s.%s.%s" % (subdirectory, manpage, manvolnum, "html") + writefile(filename, text) + overview[filename] = OverviewEntry(manpage, manvolnum, refpurpose) + # + return overview + +def splitname(filename): + base = os.path.basename(filename) + name, ext = os.path.splitext(base) + return name + +def overview2(man, overview, subdirectory, docbook_filename): + if not man: + overview2htm(overview, subdirectory, docbook_filename) + +def overview2htm(overview, subdirectory, docbook_filename): + basename = splitname(docbook_filename) + text = "%s %s\n" % (htm(basename), htm("overview")) + text += "\n" + text += "

%s %s

\n" % (htm(basename), htm("overview")) + text += "
    \n" + for filename in sorted(overview): + entry = overview[filename] + subdir_filename = os.path.basename(filename) + text += '
  • %s - %s
  • ' % (subdir_filename, entry.manpage, htm(entry.refpurpose)) + text += "\n" + text += "
\n" + text += "\n" + filename = "%s/%s.%s" % (subdirectory, basename, "html") + writefile(filename, text) def writefile(filename, manpagetext): dirname = os.path.dirname(filename) @@ -252,11 +444,17 @@ def writefile(filename, manpagetext): if __name__ == "__main__": from optparse import OptionParser _o = OptionParser("%prog [options] docbookfiles...") - _o.add_option("-d","--into", metavar="DIR", default=".", + _o.add_option("-o","--into", metavar="DIR", default=".", help="specify base directory for output [%default]") + _o.add_option("-t","--make", metavar="DIR", default="man", + help="make 'man'/'html' output pages [%default]") _o.add_option("-v","--verbose", action="count", default=0, help="increase logging level [%default]") opt, args = _o.parse_args() logging.basicConfig(level = max(0, logging.WARNING - 10 * opt.verbose)) - for arg in args: - dbk2man(arg, opt.into) + # ensure commandline is compatible with "xmlto -o DIR TYPE INPUTFILE" + make = opt.make + if args and args[0] in ("man", "html"): + make = args[0] + args = args[1:] + dbk2(make == 'man', args, opt.into) diff --git a/Build/source/libs/zziplib/zziplib-src/docs/dir2index.py b/Build/source/libs/zziplib/zziplib-src/docs/dir2index.py new file mode 100755 index 00000000000..4453802276d --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/docs/dir2index.py @@ -0,0 +1,119 @@ +#! /usr/bin/python3 + +""" Searches through a directory and creates an index page for it +""" + +__author__ = "Guido U. Draheim" + +import logging +import os.path +import re +import xml.etree.ElementTree as ET + +logg = logging.getLogger("dir2index") + +def esc(text): + text = text.replace(".", "\\&.") + text = text.replace("-", "\\-") + return text +def unescape(text): + text = text.replace('<', '<') + text = text.replace('>', '>') + text = text.replace('"', '"') + text = text.replace('&', '&') + return text +def htm(text): + text = text.replace('&', '&') + text = text.replace('<', '<') + text = text.replace('>', '>') + text = text.replace('"', '"') + return text +def splitname(filename): + base = os.path.basename(filename) + name, ext = os.path.splitext(base) + if name.endswith(".3"): name = name[:-2] + return name + +def parse_html(filename): + tree = ET.parse(filename) + return tree.getroot() + +def zzip_sorted(filenames): + for name in filenames: + if "zziplib" in name: + yield name + for name in filenames: + if "zziplib" not in name: + yield name + +def dir2(man, dirs, into): + text = "" + "\n" + file2name = {} + file2text = {} + for dirname in dirs: + for filename in os.listdir(dirname): + filepath = os.path.join(dirname, filename) + file2name[filename] = splitname(filename) + file2text[filename] = open(filepath).read() + # find the overview filenames and generate the pages order + overviews = [] + for filename in file2text: + if " overview" in file2text[filename]: + overviews.append(filename) + logg.warning("overviews = %s", overviews) + logg.warning("overviews = %s", [file2name[f] for f in overviews]) + file2item = {} + pages = [] + for overview in zzip_sorted(overviews): + if overview not in pages: + pages.append(overview) + for line in file2text[overview].split("\n"): + m = re.match('
  • ', line) + if m: + filename = m.group(1) + if filename not in file2item: + file2item[filename] = line + if filename not in pages: + pages.append(filename) + for filename in sorted(file2name): + if filename not in pages: + pages.append(filename) + text += "" + text += "" + "\n" + writefile("%s/index.html" % into, text) + +def writefile(filename, manpagetext): + dirname = os.path.dirname(filename) + if not os.path.isdir(dirname): + logg.debug("mkdir %s", dirname) + os.makedirs(dirname) + with open(filename, "w") as f: + f.write(manpagetext) + logg.debug("written %s [%s]", filename, manpagetext.split("\n", 1)[0]) + +if __name__ == "__main__": + from optparse import OptionParser + _o = OptionParser("%prog [options] directories...") + _o.add_option("-o","--into", metavar="DIR", default=".", + help="specify base directory for output [%default]") + _o.add_option("-t","--make", metavar="DIR", default="man", + help="make 'man'/'html' output pages [%default]") + _o.add_option("-v","--verbose", action="count", default=0, + help="increase logging level [%default]") + opt, args = _o.parse_args() + logging.basicConfig(level = max(0, logging.WARNING - 10 * opt.verbose)) + # ensure commandline is compatible with "xmlto -o DIR TYPE INPUTFILE" + make = opt.make + dir2(make == 'man', args, opt.into) diff --git a/Build/source/libs/zziplib/zziplib-src/docs/make-doc.py b/Build/source/libs/zziplib/zziplib-src/docs/make-doc.py index f12553fa32e..0bf82321ebe 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/make-doc.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/make-doc.py @@ -1,8 +1,8 @@ -#! /usr/bin/python +#! /usr/bin/python3 # -*- coding: UTF-8 -*- + import sys import re -import string import commands import warnings @@ -58,19 +58,20 @@ def section2html(text): mapping = { "" : "
    ", "" : "
    ", "" : "

    ", "" : "

    " , "" : "", "" : "" } - for str in mapping: - text = string.replace(text, str, mapping[str]) + for m in mapping: + text = text.replace(m, mapping[m]) return text def html(text): return section2html(paramdef2html(text)) def cdata1(text): - return string.replace(text, "&", "&") + return text.replace("&", "&") def cdata31(text): - return string.replace(string.replace(text, "<","<"), ">",">") + text = text.replace("<","<") + return text.replace(">",">") def cdata3(text): return cdata31(cdata1(text)) def cdata43(text): - return string.replace(text,"\"", """) + return text.replace("\"", """) def cdata41(text): return cdata43(cdata31(text)) def cdata4(text): @@ -126,7 +127,7 @@ def this_function_link(text, name): class Options: var = {} def __getattr__(self, name): - if not self.var.has_key(name): return None + if not name in self.var: return None return self.var[name] def __setattr__(self, name, value): self.var[name] = value @@ -158,7 +159,7 @@ class File: self.copyright = "" def __getattr__(self, name): """ defend against program to break on uninited members """ - if self.__dict__.has_key(name): return self.__dict__[name] + if name in self.__dict__: return self.__dict__[name] warn("no such member: "+name); return None def set_author(self, text): if self.authors: @@ -215,7 +216,7 @@ def scan_options (options, list): #else try: input = open(name, "r") - except IOError, error: + except IOError as error: warn(#...... (scan_options) ............... "can not open input file: "+name, error) continue @@ -294,7 +295,7 @@ class Function: # return "" def __getattr__(self, name): """ defend against program exit on members being not inited """ - if self.__dict__.has_key(name): return self.__dict__[name] + if name in self.__dict__: return self.__dict__[name] warn("no such member: "+name); return None def dict(self): return self.__dict__ @@ -376,7 +377,7 @@ def examine_head_anchors(func_list): function.head = s(function.head, r"(.*)also:(.*)", lambda x : set_seealso(function, x.group(2)) and x.group(1)) if function.seealso and None: - print "function[",function.name,"].seealso=",function.seealso + print("function[" + function.name + "].seealso=" + function.seealso) examine_head_anchors(function_list) # =============================================================== HTML ===== @@ -524,11 +525,11 @@ html.add_page_list(html_pages) # and finally print the html-formatted output try: F = open(o.libhtmlfile, "w") -except IOError, error: +except IOError as error: warn(# ............. open(o.libhtmlfile, "w") .............. "can not open html output file: "+o.libhtmlfile, error) else: - print >> F, html.page_text() + print(html.page_text(), file=F) F.close() #fi @@ -987,40 +988,37 @@ doctype += '"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">'+"\n" try: F = open(o.docbookfile,"w") -except IOError, error: +except IOError as error: warn("can not open docbook output file: "+o.docbookfile, error) else: - print >> F, doctype, 'Manual Pages' + print(doctype + 'Manual Pages', file=F) for page in combined_pages: - print >> F, page.refentry_text() + print(page.refentry_text(), file=F) #od for page in header_refpages.values(): if not page.refentry: continue - print >> F, "\n", - print >> F, page.refentry_text() + print("\n" + page.refentry_text(), file=F) #od - print >> F, "\n",'',"\n" + print("\n\n", file=F) F.close() #fi # _____________________________________________________________________ try: F = open( o.dumpdocfile, "w") -except IOError, error: +except IOError as error: warn ("can not open"+o.dumpdocfile,error) else: for func in function_list: name = func.name - print >> F, ""+"\n" + print(""+"\n", file=F) for H in sorted_keys(func.dict()): - print >> F, "<"+H+" name=\""+name+"\">", - print >> F, str(func.dict()[H]), - print >> F, "" + print("<"+H+" name=\""+name+"\">" + str(func.dict()[H]) + "", file=F) #od - print >> F, "\n\n"; + print("\n\n", file=F) #od F.close(); #fi diff --git a/Build/source/libs/zziplib/zziplib-src/docs/makedocs.py b/Build/source/libs/zziplib/zziplib-src/docs/makedocs.py index 1bc8f885e79..ad6bf724b36 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/makedocs.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/makedocs.py @@ -1,3 +1,5 @@ +#! /usr/bin/python3 + import sys from zzipdoc.match import * from zzipdoc.options import * @@ -37,7 +39,7 @@ class PerFile: return None def print_list_mainheader(self): for t_fileheader in self.headers: - print t_fileheader.get_filename(), t_fileheader.src_mainheader() + print(t_fileheader.get_filename(), t_fileheader.src_mainheader()) class PerFunctionEntry: def __init__(self, header, comment, prototype): @@ -66,10 +68,10 @@ class PerFunction: functionprototype) ] def print_list_titleline(self): for funcheader in self.headers: - print funcheader.get_filename(), "[=>]", funcheader.get_titleline() + print(funcheader.get_filename(), "[=>]", funcheader.get_titleline()) def print_list_name(self): for funcheader in self.prototypes: - print funcheader.get_filename(), "[>>]", funcheader.get_name() + print(funcheader.get_filename(), "[>>]", funcheader.get_name()) class PerFunctionFamilyEntry: def __init__(self, leader): @@ -122,12 +124,12 @@ class PerFunctionFamily: for name in self.retarget: into = self.retarget[name] if into not in name_list: - print ("function '"+name+"' retarget into '"+into+ - "' does not exist - keep alone") + print("function '"+name+"' retarget into '"+into+ + "' does not exist - keep alone") if into in self.retarget: other = self.retarget[into] - print ("function '"+name+"' retarget into '"+into+ - "' which is itself a retarget into '"+other+"'") + print("function '"+name+"' retarget into '"+into+ + "' which is itself a retarget into '"+other+"'") if into not in lead_list: lead_list += [ into ] for func in self.functions: @@ -141,7 +143,7 @@ class PerFunctionFamily: entry.add(func) # the first self.entries += [ entry ] else: - print "head function '"+name+" has no entry" + print("head function '"+name+" has no entry") for func in self.functions: name = func.get_name() if name in self.retarget: @@ -150,14 +152,14 @@ class PerFunctionFamily: if entry is not None: entry.add(func) # will not add duplicates else: - print "into function '"+name+" has no entry" + print("into function '"+name+" has no entry") def print_list_name(self): for family in self.entries: name = family.get_name() - print name, ":", + print(name, ":", end = " ") for item in family.functions: - print item.get_name(), ",", - print "" + print(item.get_name(), ",", end = " ") + print("") class HtmlManualPageAdapter: def __init__(self, entry): """ usually takes a PerFunctionEntry """ diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/commentmarkup.py b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/commentmarkup.py index 3f605a72d6c..21c1621a2c7 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/commentmarkup.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/commentmarkup.py @@ -1,4 +1,4 @@ -from match import Match +from zzipdoc.match import Match def markup_link_syntax(text): """ markup the link-syntax ` => somewhere ` in the text block """ @@ -31,7 +31,7 @@ class CommentMarkup: comment = self.header.comment try: comment = self.header.get_otherlines() - except Exception, e: + except Exception as e: pass mode = "" text = "" diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/dbk2htm.py b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/dbk2htm.py index f8593e697b0..b2d362fbc24 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/dbk2htm.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/dbk2htm.py @@ -1,5 +1,4 @@ -from match import Match -import string +from zzipdoc.match import Match class dbk2htm_conversion: mapping = { "" : "
    ", "" : "
    ", @@ -9,7 +8,7 @@ class dbk2htm_conversion: pass def section2html(self, text): for str in self.mapping: - text = string.replace(text, str, self.mapping[str]) + text = text.replace(str, self.mapping[str]) return text def paramdef2html(self, text): s = Match() diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/docbookdocument.py b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/docbookdocument.py index c4602ad64d3..f23790a9b4f 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/docbookdocument.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/docbookdocument.py @@ -1,6 +1,7 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 # -*- coding: UTF-8 -*- -from match import Match + +from zzipdoc.match import Match class DocbookDocument: """ binds some xml content page with additional markup - in this @@ -23,14 +24,14 @@ class DocbookDocument: def get_title(self): if self.title: return title try: return self.text[0].get_title() - except Exception, e: pass + except Exception as e: pass return self.title def _xml_doctype(self, rootnode): return "" def _xml_text(self, xml): """ accepts adapter objects with .xml_text() """ try: return xml.xml_text() - except Exception, e: print "DocbookDocument/text", e; pass + except Exception as e: print("DocbookDocument/text " + e); pass return str(xml) def _fetch_rootnode(self, text): fetch = Match(r"^[^<>]*<(\w+)\b") @@ -47,7 +48,7 @@ class DocbookDocument: return filename def save(self, filename = None): filename = self._filename(filename) - print "writing '"+filename+"'" + print("writing '"+filename+"'") if len(self.text) > 1: self.save_all(filename) else: @@ -58,12 +59,12 @@ class DocbookDocument: xml_text = self._xml_text(text) rootnode = self._fetch_rootnode(xml_text) doctype = self._xml_doctype(rootnode) - print >>fd, doctype - print >>fd, xml_text + print(doctype, file=fd) + print(xml_text, file=fd) fd.close() return True - except IOError, e: - print "could not open '"+filename+"'file", e + except IOError as e: + print("could not open '"+filename+"'file" + str(e)) return False def save_all(self, filename): assert len(self.text) > 1 @@ -76,20 +77,20 @@ class DocbookDocument: else: rootnode = self.rootnode doctype = self._xml_doctype(rootnode) - print >>fd, doctype + print(doctype, file=fd) title = self.get_title() if title and self.rootnode in self.has_title_child: - print >>fd, "<"+self.rootnode+'>'+title+'' + print("<"+self.rootnode+'>'+title+'', file=fd) elif title: - print >>fd, "<"+self.rootnode+' id="'+title+'">' + print("<"+self.rootnode+' id="'+title+'">', file=fd) else: - print >>fd, "<"+self.rootnode+'>' + print("<"+self.rootnode+'>', file=fd) for text in self.text: text = self._xml_text(text) - print >>fd, text - print >>fd, "" + print(text) + print("", file=fd) fd.close() return True - except IOError, e: - print "could not open '"+filename+"'file", e + except IOError as e: + print("could not open '"+filename+"'file" + str(e)) return False diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionheader.py b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionheader.py index 81bb385c408..7020b281c99 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionheader.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionheader.py @@ -1,4 +1,4 @@ -from match import Match +from zzipdoc.match import Match class FunctionHeader: """ parsing the comment block that is usually presented before diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionlisthtmlpage.py b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionlisthtmlpage.py index 4ec9178ca10..47dce7626cc 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionlisthtmlpage.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionlisthtmlpage.py @@ -1,5 +1,18 @@ -from options import * -from match import Match +from __future__ import print_function + +from zzipdoc.options import * +from zzipdoc.match import Match + +import os +import os.path + +def short(filename): + while filename.startswith("../"): + filename = filename[3:] + if filename.startswith(os.sep): + parts = ["",""] + filename.split(os.sep) + return os.path.join(parts[-2], parts[-1]) + return filename class FunctionListHtmlPage: """ The main part here is to create a TOC (table of contents) at the @@ -11,9 +24,9 @@ class FunctionListHtmlPage: _null_table100 = '' _ul_start = '
    ' - _ul_end = '
    ' + _ul_end = '' + "\n" _li_start = '' - _li_end = '' + _li_end = '' + "\n" http_opengroup = "http://www.opengroup.org/onlinepubs/000095399/functions/" http_zlib = "http://www.zlib.net/manual.html" def __init__(self, o = None): @@ -26,8 +39,8 @@ class FunctionListHtmlPage: if self.o is None: self.o = Options() self.not_found_in_anchors = [] def cut(self): - self.text += ("
    "+self._ul_start+self.head+self._ul_end+"
    "+ - "
    "+self._ul_start+self.body+self._ul_end+"
    ") + self.text += ("
    "+self._ul_start+self.head+self._ul_end+"
    "+"\n"+ + "
    "+self._ul_start+self.body+self._ul_end+"
    "+"\n") self.head = "" self.body = "" def add(self, entry): @@ -35,7 +48,7 @@ class FunctionListHtmlPage: head_text = entry.head_xml_text() body_text = entry.body_xml_text(name) if not head_text: - print "no head_text for", name + print("no head_text for " + name) return try: prespec = entry.head_get_prespec() @@ -43,20 +56,20 @@ class FunctionListHtmlPage: callspec = entry.head_get_callspec() head_text = (""+namespec+"" +callspec+" : "+prespec+"") - except Exception, e: + except Exception as e: pass try: extraline = "" title = entry.get_title() - filename = entry.get_filename().replace("../","") + filename = short(entry.get_filename()) if title: subtitle = ' '+title+'' extraline = (self._null_table100+' '+subtitle+' '+ ' '+ ''+filename+''+ - '') + '' + "\n") body_text = extraline + body_text - except Exception, e: + except Exception as e: pass def link(text): return (text & Match("(\w*)") @@ -102,7 +115,7 @@ class FunctionListHtmlPage: text &= (Match("(?s)(\w+)") >> (lambda x: self.resolve_internal(x.group(1)))) if len(self.not_found_in_anchors): - print "not found in anchors: ", self.not_found_in_anchors + print("not found in anchors: {}".format(self.not_found_in_anchors)) return (text & Match("(?s)([^<>]*)") >> "\\1") def resolve_external(self, func, sect): diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionlistreference.py b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionlistreference.py index c38ff0a3d80..7b7560395c4 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionlistreference.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionlistreference.py @@ -1,7 +1,9 @@ #! /usr/bin/env python # -*- coding: UTF-8 -*- -from match import Match -from htm2dbk import * +from __future__ import print_function + +from zzipdoc.match import Match +from zzipdoc.htm2dbk import * class FunctionListReference: """ Creating a docbook-style list of parts @@ -19,7 +21,7 @@ class FunctionListReference: description = entry.body_xml_text(name) funcsynopsis = entry.head_xml_text() if not funcsynopsis: - print "no funcsynopsis for", name + print("no funcsynopsis for " + name) return if self.entry is None: self.entry = FunctionListRefEntry(entry, self.o) diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionprototype.py b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionprototype.py index fda85bb3117..23a107680cf 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionprototype.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionprototype.py @@ -1,4 +1,4 @@ -from match import Match +from zzipdoc.match import Match class FunctionPrototype: """ takes a single function prototype line (cut from some source file) diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/htm2dbk.py b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/htm2dbk.py index ec9685bfd3e..d0f17cc3d23 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/htm2dbk.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/htm2dbk.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 """ this file converts simple html text into a docbook xml variant. @@ -7,10 +7,10 @@ want is the docbook-to-pdf converter and similar technology being present in the world of docbook-to-anything converters. """ from datetime import date -import match +from zzipdoc.match import Match import sys -m = match.Match +m = Match class htm2dbk_conversion_base: regexlist = [ @@ -146,8 +146,8 @@ def htm2dbk_files(args): doc.filename = filename doc.add(f.read()) f.close() - except IOError, e: - print >> sys.stderr, "can not open "+filename + except IOError: + print("can not open "+filename, file=sys.stderr) return doc.value() def html2docbook(text): @@ -155,4 +155,15 @@ def html2docbook(text): return htm2dbk_conversion().convert2(text) if __name__ == "__main__": - print htm2dbk_files(sys.argv[1:]) + from optparse import OptionParser + cmdline = OptionParser("%prog [options] files...") + cmdline.add_option("-o", "--into", metavar="FILE", default="") + opt, args = cmdline.parse_args() + result = htm2dbk_files(args) + if not opt.into: + print(result) + else: + f = open(opt.into, "w") + f.write(result) + f.close() + diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/htmldocument.py b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/htmldocument.py index 47d58dc6ad2..4f771d87cc9 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/htmldocument.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/htmldocument.py @@ -1,6 +1,7 @@ -#! /usr/bin/env python # -*- coding: UTF-8 -*- -from match import Match +from __future__ import print_function + +from zzipdoc.match import Match class HtmlDocument: """ binds some html content page with additional markup - in this @@ -29,31 +30,31 @@ class HtmlDocument: def get_title(self): if self.title: return self.title try: return self.text[0].get_title() - except Exception, e: pass + except Exception as e: pass return self.title def _html_meta(self, meta): """ accepts adapter objects with .html_meta() """ try: return meta.html_meta() - except Exception, e: pass + except Exception as e: pass return str(meta) def _html_style(self, style): """ accepts adapter objects with .html_style() and .xml_style() """ ee = None try: return style.html_style() - except Exception, e: ee = e; pass + except Exception as e: ee = e; pass try: return style.xml_style() - except Exception, e: print "HtmlDocument/style", ee, e; pass + except Exception as e: print("HtmlDocument/style {} {}".format(ee, e)); pass try: return str(style) - except Exception, e: print "HtmlDocument/style", e; return "" + except Exception as e: print("HtmlDocument/style {}".format(e)); return "" def _html_text(self, html): """ accepts adapter objects with .html_text() and .xml_text() """ ee = None try: return html.html_text() - except Exception, e: ee = e; pass + except Exception as e: ee = e; pass try: return html.xml_text() - except Exception, e: print "HtmlDocument/text", ee, e; pass + except Exception as e: print("HtmlDocument/text {} {}".format(ee, e)); pass try: return str(html) - except Exception, e: print "HtmlDocument/text", e; return " " + except Exception as e: print("HtmlDocument/text {}".format(e)); return " " def navigation(self): if self.navi: return self.navi @@ -63,7 +64,7 @@ class HtmlDocument: self.navi = fd.read() fd.close() return self.navi - except Exception, e: + except Exception as e: pass return None def html_header(self): @@ -103,15 +104,15 @@ class HtmlDocument: return filename def save(self, filename = None): filename = self._filename(filename) - print "writing '"+filename+"'" + print("writing '"+filename+"'") try: fd = open(filename, "w") - print >>fd, self.html_header() + print(self.html_header(), file=fd) for text in self.text: - print >>fd, self._html_text(text) - print >>fd, self.html_footer() + print(self._html_text(text), file=fd) + print(self.html_footer(), file=fd) fd.close() return True - except IOError, e: - print "could not open '"+filename+"'file", e + except IOError as e: + print("could not open '"+filename+"'file {}".format(e)) return False diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/match.py b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/match.py index a089ec399c9..a8bbd1f5933 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/match.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/match.py @@ -3,8 +3,15 @@ # @creator (C) 2003 Guido U. Draheim # @license http://creativecommons.org/licenses/by-nc-sa/2.0/de/ +from __future__ import print_function + import re +try: + basestring +except NameError: + basestring = str + # ---------------------------------------------------------- Regex Match() # beware, stupid python interprets backslashes in replace-parts only partially! class MatchReplace: @@ -48,7 +55,7 @@ class MatchReplace: def __rlshift__(self, count): self.count = count ; return self -class Match(str): +class Match: """ A Match is actually a mix of a Python Pattern and MatchObject """ def __init__(self, pattern = None, flags = None): """ flags is a string: 'i' for case-insensitive etc.; it is just @@ -57,7 +64,6 @@ class Match(str): def __call__(self, pattern, flags = None): assert isinstance(pattern, str) or pattern is None assert isinstance(flags, str) or flags is None - str.__init__(self, pattern) self.replaced = 0 # set by subn() inside MatchReplace self.found = None # set by search() to a MatchObject self.pattern = pattern @@ -67,6 +73,8 @@ class Match(str): else: self.regex = re.compile(self.pattern) return self + def __repr__(self): + return self.pattern def __truth__(self): return self.found is not None def __and__(self, string): @@ -90,14 +98,14 @@ class Match(str): if __name__ == "__main__": # matching: if "foo" & Match("oo"): - print "oo" + print("oo") x = Match() if "foo" & x("(o+)"): - print x[1] + print(x[1]) # replacing: y = "fooboo" & Match("oo") >> "ee" - print y + print(y) r = Match("oo") >> "ee" - print "fooboo" & r + print("fooboo" & r) s = MatchReplace("oo", "ee") - print "fooboo" & s + print("fooboo" & s) diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/options.py b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/options.py index c6758d5fabf..fb3b455f113 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/options.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/options.py @@ -3,13 +3,13 @@ # @creator (C) 2003 Guido U. Draheim # @license http://creativecommons.org/licenses/by-nc-sa/2.0/de/ -from match import Match +from zzipdoc.match import Match # use as o.optionname to check for commandline options. class Options: var = {} def __getattr__(self, name): - if not self.var.has_key(name): return None + if not name in self.var: return None return self.var[name] def __setattr__(self, name, value): self.var[name] = value diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/textfile.py b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/textfile.py index bfaff8dbdfa..1c8b935db58 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/textfile.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/textfile.py @@ -17,7 +17,7 @@ class TextFile: self.src_text = fd.read() fd.close() return True - except IOError, e: + except IOError as e: pass return False def assert_src_text(self): diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/textfileheader.py b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/textfileheader.py index ceaa28e9908..c38c4be06ec 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/textfileheader.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/textfileheader.py @@ -1,4 +1,6 @@ -from match import Match +from __future__ import print_function + +from zzipdoc.match import Match class TextFileHeader: """ scan for a comment block at the source file start and fill the @@ -17,7 +19,7 @@ class TextFileHeader: x = Match() text = self.textfile.get_src_text() if not text: - print "nonexistent file:", self.textfile.get_filename() + print("nonexistent file: " + self.textfile.get_filename()) return False if text & x(r"(?s)[/][*]+(\s(?:.(?!\*\/))*.)\*\/" r"(?:\s*\#(?:define|ifdef|endif)[ ]*\S*[ ]*\S*)*" diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zziplib.html b/Build/source/libs/zziplib/zziplib-src/docs/zziplib.html deleted file mode 100644 index a67583520d6..00000000000 --- a/Build/source/libs/zziplib/zziplib-src/docs/zziplib.html +++ /dev/null @@ -1,464 +0,0 @@ -zziplib Library Functions - -

    zziplib Library Functions

    Version 0.13.68

    #include <zzip/lib.h>

    zzip_error(ZZIP_DIR * dir) - : int -
    zzip_seterror(ZZIP_DIR * dir, int errcode) : void -
    zzip_open(zzip_char_t * filename, int o_flags) - : ZZIP_FILE * -
    zzip_open_ext_io(zzip_char_t * filename, int o_flags, int o_modes, - zzip_strings_t * ext, zzip_plugin_io_t io) - : ZZIP_FILE * -
    zzip_open_shared_io(ZZIP_FILE * stream, - zzip_char_t * filename, int o_flags, int o_modes, - zzip_strings_t * ext, zzip_plugin_io_t io) - : ZZIP_FILE * -
    zzip_opendir(zzip_char_t * filename) - : ZZIP_DIR * -
    zzip_opendir_ext_io(zzip_char_t * filename, int o_modes, - zzip_strings_t * ext, zzip_plugin_io_t io) - : ZZIP_DIR * -
    zzip_file_real(ZZIP_FILE * fp) - : int -
    zzip_dir_real(ZZIP_DIR * dir) - : int -
    zzip_realdir(ZZIP_DIR * dir) - : void * -
    zzip_realfd(ZZIP_FILE * fp) - : int -
    zzip_tell(ZZIP_FILE * fp) - : zzip_off_t -
    zzip_tell32(ZZIP_FILE * fp) - : long -
    zzip_dir_stat(ZZIP_DIR * dir, zzip_char_t * name, ZZIP_STAT * zs, int flags) - : int -
    zzip_file_stat(ZZIP_FILE * file, ZZIP_STAT * zs) - : int -
    zzip_fstat(ZZIP_FILE * file, ZZIP_STAT * zs) - : int -
    zzip_strerror(int errcode) - : zzip_char_t * -
    zzip_strerror_of(ZZIP_DIR * dir) - : zzip_char_t * -
    zzip_dir_open(zzip_char_t * filename, zzip_error_t * e) - : ZZIP_DIR * -
    zzip_dir_open_ext_io(zzip_char_t * filename, zzip_error_t * e, - zzip_strings_t * ext, zzip_plugin_io_t io) - : ZZIP_DIR * -
    zzip_dir_read(ZZIP_DIR * dir, ZZIP_DIRENT * d) - : int -
    zzip_init_io(zzip_plugin_io_handlers_t io, int flags) - : int -
    zzip_get_default_io(void) - : zzip_plugin_io_t -
    zzip_rewinddir(ZZIP_DIR * dir) - : void -
    zzip_telldir(ZZIP_DIR * dir) - : zzip_off_t -
    zzip_seekdir(ZZIP_DIR * dir, zzip_off_t offset) - : void -
    zzip_telldir32(ZZIP_DIR * dir) - : long -
    zzip_seekdir32(ZZIP_DIR * dir, long offset) - : void -
    zzip_fopen(zzip_char_t * filename, zzip_char_t * mode) - : ZZIP_FILE * -
    zzip_freopen(zzip_char_t * filename, zzip_char_t * mode, ZZIP_FILE * stream) - : ZZIP_FILE * -
    zzip_dirhandle(ZZIP_FILE * fp) - : ZZIP_DIR * -
    zzip_dirfd(ZZIP_DIR * dir) - : int -
    zzip_seek(ZZIP_FILE * fp, zzip_off_t offset, int whence) - : zzip_off_t -
    zzip_seek32(ZZIP_FILE * fp, long offset, int whence) - : long -
    zzip_read(ZZIP_FILE * fp, void *buf, zzip_size_t len) - : zzip_ssize_t -
    zzip_fread(void *ptr, zzip_size_t size, zzip_size_t nmemb, ZZIP_FILE * file) - : zzip_size_t -
    zzip_dir_free(ZZIP_DIR * dir) - : int -
    zzip_dir_close(ZZIP_DIR * dir) - : int -
    zzip_fclose(ZZIP_FILE * fp) - : int -
    zzip_close(ZZIP_FILE * fp) - : int -
    zzip_dir_fdopen(int fd, zzip_error_t * errcode_p) - : ZZIP_DIR * -
    zzip_dir_fdopen_ext_io(int fd, zzip_error_t * errcode_p, - zzip_strings_t * ext, const zzip_plugin_io_t io) - : ZZIP_DIR * -
    zzip_dir_alloc_ext_io(zzip_strings_t * ext, const zzip_plugin_io_t io) - : ZZIP_DIR * -
    zzip_dir_alloc(zzip_strings_t * fileext) - : ZZIP_DIR * -
    zzip_readdir(ZZIP_DIR * dir) - : ZZIP_DIRENT * -
    zzip_closedir(ZZIP_DIR * dir) - : int -
    zzip_errno(int errcode) - : int -
    zzip_file_close(ZZIP_FILE * fp) - : int -
    zzip_file_open(ZZIP_DIR * dir, zzip_char_t * name, int o_mode) - : ZZIP_FILE * -
    zzip_inflate_init(ZZIP_FILE * fp, struct zzip_dir_hdr *hdr) - : static int -
    zzip_file_read(ZZIP_FILE * fp, void *buf, zzip_size_t len) - : zzip_ssize_t -
    zzip_rewind(ZZIP_FILE * fp) - : int -
    zzip_compr_str(int compr) - : zzip_char_t * -
    __zzip_fetch_disk_trailer(int fd, zzip_off_t filesize, - struct _disk_trailer *_zzip_restrict trailer, - zzip_plugin_io_t io) - : int -
    __zzip_parse_root_directory(int fd, - struct _disk_trailer *trailer, - struct zzip_dir_hdr **hdr_return, - zzip_plugin_io_t io) - : int -
    __zzip_try_open(zzip_char_t * filename, int filemode, - zzip_strings_t * ext, zzip_plugin_io_t io) - : int -

    Documentation

    zzip_error(ZZIP_DIR * dir) - : int -
    zzip_seterror(ZZIP_DIR * dir, int errcode) : void -
     ... zzip/info.c
    -

    The zzip_seterror function just does dir->errcode = errcode -

    -
    zzip_open(zzip_char_t * filename, int o_flags) - : ZZIP_FILE * -
    zzip_open_ext_io(zzip_char_t * filename, int o_flags, int o_modes, - zzip_strings_t * ext, zzip_plugin_io_t io) - : ZZIP_FILE * -
    zzip_open_shared_io(ZZIP_FILE * stream, - zzip_char_t * filename, int o_flags, int o_modes, - zzip_strings_t * ext, zzip_plugin_io_t io) - : ZZIP_FILE * -
     ... zzip/file.c
    -

    - The zzip_open_ext_io function uses explicit ext and io instead of the internal - defaults, setting them to zero is equivalent to zzip_open -

    - note that the two flag types have been split into an o_flags - (for fcntl-like openflags) and o_modes where the latter shall - carry the zzip_flags and possibly accessmodes for unix filesystems. - Since this version of zziplib can not write zipfiles, it is not - yet used for anything else than zzip-specific modeflags. -

    - The zzip_open_ext_io function returns a new zzip-handle (use zzip_close to return - it). On error the zzip_open_ext_io function will return null setting errno(3). -

    - If any ext_io handlers were used then the referenced structure - should be static as the allocated ZZIP_FILE does not copy them. -

    -

    - The zzip_open_shared_io function takes an extra stream argument - if a handle has been - then ext/io can be left null and the new stream handle will pick up - the ext/io. This should be used only in specific environment however - since zzip_file_real does not store any ext-sequence. -

    - The benefit for the zzip_open_shared_io function comes in when the old file handle - was openened from a file within a zip archive. When the new file - is in the same zip archive then the internal zzip_dir structures - will be shared. It is even quicker, as no check needs to be done - anymore trying to guess the zip archive place in the filesystem, - here we just check whether the zip archive's filepath is a prefix - part of the filename to be opened. -

    - Note that the zzip_open_shared_io function is also used by zzip_freopen that - will unshare the old handle, thereby possibly closing the handle. -

    - The zzip_open_shared_io function returns a new zzip-handle (use zzip_close to return - it). On error the zzip_open_shared_io function will return null setting errno(3). -

    -
    zzip_opendir(zzip_char_t * filename) - : ZZIP_DIR * -
    zzip_opendir_ext_io(zzip_char_t * filename, int o_modes, - zzip_strings_t * ext, zzip_plugin_io_t io) - : ZZIP_DIR * -
     ... zzip/dir.c
    -

    The zzip_opendir_ext_io function uses explicit ext and io instead of the internal - defaults, setting them to zero is equivalent to zzip_opendir -

    -
    zzip_file_real(ZZIP_FILE * fp) - : int -
    zzip_dir_real(ZZIP_DIR * dir) - : int -
    zzip_realdir(ZZIP_DIR * dir) - : void * -
    zzip_realfd(ZZIP_FILE * fp) - : int -
     ... zzip/info.c
    -

    The zzip_dir_real function checks if the ZZIP_DIR-handle is wrapping - a real directory or a zip-archive. - Returns 1 for a stat'able directory, and 0 for a handle to zip-archive. -

    -

    The zzip_realdir function returns the posix DIR* handle (if one exists). - Check before with zzip_dir_real if the - the ZZIP_DIR points to a real directory. -

    -

    The zzip_realfd function returns the posix file descriptor (if one exists). - Check before with zzip_file_real if the - the ZZIP_FILE points to a real file. -

    -
    zzip_tell(ZZIP_FILE * fp) - : zzip_off_t -
    zzip_tell32(ZZIP_FILE * fp) - : long -
     ... zzip/file.c
    -

    The zzip_tell32 function is provided for users who can not use any largefile-mode. -

    -
    zzip_dir_stat(ZZIP_DIR * dir, zzip_char_t * name, ZZIP_STAT * zs, int flags) - : int -
    zzip_file_stat(ZZIP_FILE * file, ZZIP_STAT * zs) - : int -
    zzip_fstat(ZZIP_FILE * file, ZZIP_STAT * zs) - : int -
     ... zzip/stat.c
    -

    The zzip_file_stat function will obtain information about a opened file _within_ a - zip-archive. The file is supposed to be open (otherwise -1 is returned). - The st_size stat-member contains the uncompressed size. The optional - d_name is never set here. -

    -

    The zzip_fstat function will obtain information about a opened file which may be - either real/zipped. The file is supposed to be open (otherwise -1 is - returned). The st_size stat-member contains the uncompressed size. - The optional d_name is never set here. For a real file, we do set the - d_csize := st_size and d_compr := 0 for meaningful defaults. -

    -
    zzip_strerror(int errcode) - : zzip_char_t * -
    zzip_strerror_of(ZZIP_DIR * dir) - : zzip_char_t * -
     ... zzip/err.c
    -

    The zzip_strerror_of function fetches the errorcode from the DIR-handle and - runs it through zzip_strerror to obtain the static string - describing the error. -

    -
    zzip_dir_open(zzip_char_t * filename, zzip_error_t * e) - : ZZIP_DIR * -
    zzip_dir_open_ext_io(zzip_char_t * filename, zzip_error_t * e, - zzip_strings_t * ext, zzip_plugin_io_t io) - : ZZIP_DIR * -
    zzip_dir_read(ZZIP_DIR * dir, ZZIP_DIRENT * d) - : int -
     ... zzip/zip.c
    -

    the zzip_dir_open_ext_io function uses explicit ext and io instead of the internal - defaults. Setting these to zero is equivalent to zzip_dir_open - Note that the referenced ext_io plugin handlers structure must be - static as it is not copied to the returned ZZIP_DIR structure. -

    -

    fills the dirent-argument with the values and - increments the read-pointer of the dir-argument. -

    - returns 0 if there no entry (anymore). -

    -
    zzip_init_io(zzip_plugin_io_handlers_t io, int flags) - : int -
    zzip_get_default_io(void) - : zzip_plugin_io_t -
     ... zzip/plugin.c
    -

    The zzip_get_default_io function returns a zzip_plugin_io_t handle to static defaults - wrapping the posix io file functions for actual file access. The - returned structure is shared by all threads in the system. -

    -
    zzip_rewinddir(ZZIP_DIR * dir) - : void -
    zzip_telldir(ZZIP_DIR * dir) - : zzip_off_t -
    zzip_seekdir(ZZIP_DIR * dir, zzip_off_t offset) - : void -
    zzip_telldir32(ZZIP_DIR * dir) - : long -
    zzip_seekdir32(ZZIP_DIR * dir, long offset) - : void -
      zzip/dir.c

    The zzip_rewinddir function is the equivalent of a rewinddir(2) for a realdir or - the zipfile in place of a directory. The ZZIP_DIR handle returned from - zzip_opendir has a flag saying realdir or zipfile. As for a zipfile, - the filenames will include the filesubpath, so take care. -

    -

    The zzip_telldir function is the equivalent of telldir(2) for a realdir or zipfile. -

    -

    The zzip_seekdir function is the equivalent of seekdir(2) for a realdir or zipfile. -

    -

    The zzip_telldir32 function is provided for users who can not use any largefile-mode. -

    -

    The zzip_seekdir32 function is provided for users who can not use any largefile-mode. -

    -
    zzip_fopen(zzip_char_t * filename, zzip_char_t * mode) - : ZZIP_FILE * -
    zzip_freopen(zzip_char_t * filename, zzip_char_t * mode, ZZIP_FILE * stream) - : ZZIP_FILE * -
      zzip/file.c

    The zzip_fopen function will fopen(3) a real/zipped file. -

    - It has some magic functionality builtin - it will first try to open - the given filename as a normal file. If it does not - exist, the given path to the filename (if any) is split into - its directory-part and the file-part. A ".zip" extension is - then added to the directory-part to create the name of a - zip-archive. That zip-archive (if it exists) is being searched - for the file-part, and if found a zzip-handle is returned. -

    - Note that if the file is found in the normal fs-directory the - returned structure is mostly empty and the zzip_read call will - use the libc read(2) to obtain data. Otherwise a zzip_file_open - is performed and any error mapped to errno(3). -

    - unlike the posix-wrapper zzip_open the mode-argument is - a string which allows for more freedom to support the extra - zzip modes called ZZIP_CASEINSENSITIVE and ZZIP_IGNOREPATH. - Currently, this zzip_fopen call will convert the following - characters in the mode-string into their corrsponding mode-bits: -

    • "r" : O_RDONLY : read-only

    • -
    • "b" : O_BINARY : binary (win32 specific)

    • -
    • "f" : O_NOCTTY : no char device (unix)

    • -
    • "i" : ZZIP_CASELESS : inside zip file

    • -
    • "*" : ZZIP_NOPATHS : inside zip file only

    • -

    all other modes will be ignored for zip-contained entries - but they are transferred for compatibility and portability, - including these extra sugar bits: -

    • "x" : O_EXCL : fail if file did exist

    • -
    • "s" : O_SYNC : synchronized access

    • -
    • "n" : O_NONBLOCK : nonblocking access

    • -
    • "z#" : compression level : for zlib

    • -
    • "g#" : group access : unix access bits

    • -
    • "u#" : owner access : unix access bits

    • -
    • "o#" : world access : unix access bits

    • -

    ... the access bits are in traditional unix bit format - with 7 = read/write/execute, 6 = read/write, 4 = read-only. -

    - The default access mode is 0664, and the compression level - is ignored since the lib can not yet write zip files, otherwise - it would be the initialisation value for the zlib deflateInit - where 0 = no-compression, 1 = best-speed, 9 = best-compression. -

    - The zzip_fopen function returns a new zzip-handle (use zzip_close to return - it). On error the zzip_fopen function will return null setting errno(3). -

    -

    - The zzip_freopen function receives an additional argument pointing to - a ZZIP_FILE* being already in use. If this extra argument is - null then the zzip_freopen function is identical with calling zzip_fopen -

    - Per default, the old file stream is closed and only the internal - structures associated with it are kept. These internal structures - may be reused for the return value, and this is a lot quicker when - the filename matches a zipped file that is incidentally in the very - same zip arch as the old filename wrapped in the stream struct. -

    - That's simply because the zip arch's central directory does not - need to be read again. As an extension for the zzip_freopen function, if the - mode-string contains a "q" then the old stream is not closed but - left untouched, instead it is only given as a hint that a new - file handle may share/copy the zip arch structures of the old file - handle if that is possible, i.e when they are in the same zip arch. -

    - The zzip_freopen function returns a new zzip-handle (use zzip_close to return - it). On error the zzip_freopen function will return null setting errno(3). -

    -
    zzip_dirhandle(ZZIP_FILE * fp) - : ZZIP_DIR * -
    zzip_dirfd(ZZIP_DIR * dir) - : int -
     ... zzip/info.c
    -

    The zzip_dirfd function will just return dir->fd -

    - If a ZZIP_DIR does point to a zipfile then the file-descriptor of that - zipfile is returned, otherwise a NULL is returned and the ZZIP_DIR wraps - a real directory DIR (if you have dirent on your system). -

    -
    zzip_seek(ZZIP_FILE * fp, zzip_off_t offset, int whence) - : zzip_off_t -
    zzip_seek32(ZZIP_FILE * fp, long offset, int whence) - : long -
     ... zzip/file.c
    -

    The zzip_seek32 function is provided for users who can not use any largefile-mode. -

    -
    zzip_read(ZZIP_FILE * fp, void *buf, zzip_size_t len) - : zzip_ssize_t -
    zzip_fread(void *ptr, zzip_size_t size, zzip_size_t nmemb, ZZIP_FILE * file) - : zzip_size_t -
     ... zzip/file.c
    -
    -
    zzip_dir_free(ZZIP_DIR * dir) - : int -
    zzip_dir_close(ZZIP_DIR * dir) - : int -
     ... zzip/zip.c
    -

    It will also free(2) the ZZIP_DIR-handle given. - the counterpart for zzip_dir_open - see also zzip_dir_free -

    -
    zzip_fclose(ZZIP_FILE * fp) - : int -
    zzip_close(ZZIP_FILE * fp) - : int -
     ... zzip/file.c
    -
    -
    zzip_dir_fdopen(int fd, zzip_error_t * errcode_p) - : ZZIP_DIR * -
    zzip_dir_fdopen_ext_io(int fd, zzip_error_t * errcode_p, - zzip_strings_t * ext, const zzip_plugin_io_t io) - : ZZIP_DIR * -
     ... zzip/zip.c
    -

    the zzip_dir_fdopen_ext_io function uses explicit ext and io instead of the internal - defaults, setting these to zero is equivalent to zzip_dir_fdopen -

    -
    zzip_dir_alloc_ext_io(zzip_strings_t * ext, const zzip_plugin_io_t io) - : ZZIP_DIR * -
    zzip_dir_alloc(zzip_strings_t * fileext) - : ZZIP_DIR * -
     ... zzip/zip.c
    -

    the zzip_dir_alloc function is obsolete - it was generally used for implementation - and exported to let other code build on it. It is now advised to - use zzip_dir_alloc_ext_io now on explicitly, just set that second - argument to zero to achieve the same functionality as the old style. -

    -
    zzip_readdir(ZZIP_DIR * dir) - : ZZIP_DIRENT * -
     ... zzip/dir.c
    -
    zzip_closedir(ZZIP_DIR * dir) - : int -
     ... zzip/dir.c
    -
    zzip_errno(int errcode) - : int -
     ... zzip/err.c
    -
    zzip_file_close(ZZIP_FILE * fp) - : int -
     ... zzip/file.c
    -
    zzip_file_open(ZZIP_DIR * dir, zzip_char_t * name, int o_mode) - : ZZIP_FILE * -
     ... zzip/file.c
    -
    zzip_inflate_init(ZZIP_FILE * fp, struct zzip_dir_hdr *hdr) - : static int -
     ... zzip/file.c
    -
    zzip_file_read(ZZIP_FILE * fp, void *buf, zzip_size_t len) - : zzip_ssize_t -
     ... zzip/file.c
    -
    zzip_rewind(ZZIP_FILE * fp) - : int -
     ... zzip/file.c
    -
    zzip_compr_str(int compr) - : zzip_char_t * -
     ... zzip/info.c
    -
    __zzip_fetch_disk_trailer(int fd, zzip_off_t filesize, - struct _disk_trailer *_zzip_restrict trailer, - zzip_plugin_io_t io) - : int -
     ... zzip/zip.c
    -
    __zzip_parse_root_directory(int fd, - struct _disk_trailer *trailer, - struct zzip_dir_hdr **hdr_return, - zzip_plugin_io_t io) - : int -
     ... zzip/zip.c
    -
    __zzip_try_open(zzip_char_t * filename, int filemode, - zzip_strings_t * ext, zzip_plugin_io_t io) - : int -
     ... zzip/zip.c
    -
    - diff --git a/Build/source/libs/zziplib/zziplib-src/test/CMakeLists.txt b/Build/source/libs/zziplib/zziplib-src/test/CMakeLists.txt new file mode 100644 index 00000000000..f0f7a953281 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/test/CMakeLists.txt @@ -0,0 +1,82 @@ +cmake_minimum_required (VERSION 3.1) +project(zziptest VERSION "0.13.71" LANGUAGES C) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif(NOT CMAKE_BUILD_TYPE) + +include ( GNUInstallDirs ) +include ( FindPkgConfig ) + +# options ######################################################## +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) + +# Zlib library needed +find_package ( ZLIB REQUIRED ) +# pkg_search_module ( ZZIP zzip ) +find_package ( PythonInterp 3.5 REQUIRED ) +find_package ( UnixCommands REQUIRED ) # bash cp mv rm gzip tar +find_program ( MKZIP zip) + +set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX}) +set(README ${CMAKE_SOURCE_DIR}/README) +set(PY ${PYTHON_EXECUTABLE}) +set(srcdir ${CMAKE_CURRENT_SOURCE_DIR}) +set(topdir ${CMAKE_SOURCE_DIR}) + +# targets ######################################################## +add_executable(zzipself zzipself.c) +add_executable(zzipsetstub zzipsetstub.c) + +target_link_libraries(zzipself libzzip ZLIB::ZLIB) +target_link_libraries(zzipsetstub libzzip ZLIB::ZLIB) + +target_include_directories(zzipself PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") +target_include_directories(zzipsetstub PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") + +if(CMAKE_GENERATOR MATCHES "Makefiles") +add_custom_command(OUTPUT zzipshowme${EXEEXT} + COMMAND rm -f test + COMMAND ln -s . test + COMMAND ${MKZIP} -0 -j $@ zzipself${EXEEXT} + COMMAND ${MKZIP} -9 -j $@ ${README} + COMMAND test -s $@ || cp test2.zip $@ || true + COMMAND test ! -f $@.zip || mv $@.zip $@ + COMMAND ./zzipsetstub${EXEEXT} $@ zzipself${EXEEXT} + COMMAND chmod +x $@ + DEPENDS zzipself zzipsetstub) +add_custom_target(sfx ALL DEPENDS zzipshowme${EXEEXT}) +endif() + +add_custom_target(tests + COMMAND ${PY} ${srcdir}/zziptests.py --exeext=${EXEEXT} --topsrcdir=${topdir} -v ${TESTFLAGS} + DEPENDS ../bins/zzcat ../bins/zzdir ../bins/zziptest ../bins/zzxorcat ../bins/zzxorcopy) +add_custom_command(OUTPUT ../bins/zzcat COMMMAND cd ../bins && $(MAKE) zzcat) +add_custom_command(OUTPUT ../bins/zzdir COMMMAND cd ../bins && $(MAKE) zzdir) +add_custom_command(OUTPUT ../bins/zziptest COMMMAND cd ../bins && $(MAKE) zziptest) +add_custom_command(OUTPUT ../bins/zzxorcat COMMMAND cd ../bins && $(MAKE) zzxorcat) +add_custom_command(OUTPUT ../bins/zzxorcopy COMMMAND cd ../bins && $(MAKE) zzxorcopy) + +add_custom_command(OUTPUT test0.zip + COMMAND ${BASH} -c "test -d tmp || mkdir tmp" + COMMAND ${CP} ${README} tmp/README + COMMAND ${BASH} -c "cd tmp && ${MKZIP} ../test0.zip README" + COMMAND ${CP} test0.zip test.zip + BYPRODUCTS test.zip + VERBATIM) +add_custom_target(testzips ALL DEPENDS test0.zip) + +add_custom_target(checks + COMMAND ${BASH} -c "../bins/zzcat test/README > test.out" + COMMAND ${BASH} -c "if diff test.out ${README} >/dev/null \ + ; then rm test.out ; echo check OK; true \ + ; else rm test.out ; echo check FAIL ; false; fi" + DEPENDS ../bins/zzcat test0.zip + VERBATIM) +add_custom_target(check DEPENDS checks tests) + +# install ######################################################## +# - nothing - diff --git a/Build/source/libs/zziplib/zziplib-src/test/Makefile.in b/Build/source/libs/zziplib/zziplib-src/test/Makefile.in index 4b181c2ddcf..9d7298789ee 100644 --- a/Build/source/libs/zziplib/zziplib-src/test/Makefile.in +++ b/Build/source/libs/zziplib/zziplib-src/test/Makefile.in @@ -102,9 +102,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_compile_check_sizeof.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_aligned_access_required.m4 \ $(top_srcdir)/m4/ax_check_enable_debug.m4 \ - $(top_srcdir)/m4/ax_configure_args.m4 \ $(top_srcdir)/m4/ax_create_pkgconfig_info.m4 \ - $(top_srcdir)/m4/ax_enable_builddir.m4 \ $(top_srcdir)/m4/ax_expand_prefix.m4 \ $(top_srcdir)/m4/ax_maintainer_mode_auto_silent.m4 \ $(top_srcdir)/m4/ax_not_enable_frame_pointer.m4 \ @@ -276,6 +274,8 @@ PAX_TAR_CREATE = @PAX_TAR_CREATE@ PAX_TAR_EXTRACT = @PAX_TAR_EXTRACT@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RELEASE_INFO = @RELEASE_INFO@ @@ -309,7 +309,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ diff --git a/Build/source/libs/zziplib/zziplib-src/test/test.zip b/Build/source/libs/zziplib/zziplib-src/test/test.zip index 2c992ea7059..c0ee4a4a3a4 100644 Binary files a/Build/source/libs/zziplib/zziplib-src/test/test.zip and b/Build/source/libs/zziplib/zziplib-src/test/test.zip differ diff --git a/Build/source/libs/zziplib/zziplib-src/test/zziptests.py b/Build/source/libs/zziplib/zziplib-src/test/zziptests.py index ea113883502..03a8b6a234d 100644 --- a/Build/source/libs/zziplib/zziplib-src/test/zziptests.py +++ b/Build/source/libs/zziplib/zziplib-src/test/zziptests.py @@ -2,14 +2,28 @@ import unittest import subprocess import logging import inspect +import sys import os import collections -import urllib import shutil import random import re +import errno from fnmatch import fnmatchcase as matches -from cStringIO import StringIO + +try: + from cStringIO import StringIO +except ImportError: + from io import StringIO + +try: + from urllib import quote_plus, urlretrieve +except ImportError: + from urllib.parse import quote_plus + from urllib.request import urlretrieve + +if sys.version[0] == '3': + basestring = str logg = logging.getLogger("test") @@ -65,7 +79,9 @@ def shell(command, shell=True, calls=False, cwd=None, env=None, lang=None, retur stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=None, env=env) if run.returncode: logg.warning("EXIT %s: %s", run.returncode, command) - output, errors = run.communicate() # run.wait() + output, errors = run.communicate() + output = output.decode('utf-8') + errors = errors.decode('utf-8') except: logg.error("*E*: %s", sh_command) for line in output.split("\n"): @@ -106,7 +122,7 @@ def download(base_url, filename, into, style = ""): data = "tmp.download" if not os.path.isdir(data): os.makedirs(data) - subname = urllib.quote_plus(base_url) + subname = quote_plus(base_url) subdir = os.path.join(data, subname) if not os.path.isdir(subdir): os.makedirs(subdir) @@ -118,10 +134,13 @@ def download(base_url, filename, into, style = ""): shutil.copy(srcfile, subfile) if not os.path.exists(subfile): logg.info("need %s", subfile) - d = urllib.urlopen(base_url + "/" + filename + style) - f = open(subfile, "w") - f.write(d.read()) - f.close() + try: + urlretrieve(base_url + "/" + filename + style, subfile) + except: + # Ensure zero-length file exists in case we couldn't + # download the file so that we won't try to + # re-download it. + open(subfile, 'a').close() # if not os.path.isdir(into): os.makedirs(into) @@ -133,7 +152,7 @@ def download(base_url, filename, into, style = ""): def output(cmd, shell=True): run = subprocess.Popen(cmd, shell=shell, stdout=subprocess.PIPE) out, err = run.communicate() - return out + return out.decode('utf-8') def grep(pattern, lines): if isinstance(lines, basestring): lines = lines.split("\n") @@ -167,6 +186,8 @@ class ZZipTest(unittest.TestCase): return topsrcdir def src(self, name): return os.path.join(self.s, name) + def assertErrorMessage(self, errors, errno): + self.assertIn(': ' + os.strerror(errno), errors) def readme(self): f = open(self.src(readme)) text = f.read() @@ -196,7 +217,7 @@ class ZZipTest(unittest.TestCase): result = StringIO() old1 = '' old2 = '' - for i in xrange(size): + for i in range(size): while True: x = random.choice(" abcdefghijklmnopqrstuvwxyz\n") if x == old1 or x == old2: continue @@ -278,7 +299,7 @@ class ZZipTest(unittest.TestCase): zipfile="test2.zip" tmpdir="test2.tmp" exe=self.bins("mkzip") - for i in xrange(100): + for i in range(100): filename = os.path.join(tmpdir,"file.%02i" % i) filetext = "file-%02i\n" % i self.mkfile(filename, filetext) @@ -294,7 +315,7 @@ class ZZipTest(unittest.TestCase): zipfile="test3.zip" tmpdir="test3.tmp" exe=self.bins("mkzip") - for i in xrange(1000): + for i in range(1000): filename = os.path.join(tmpdir,"file.%03i" % i) filetext = "file-%03i\n" % i self.mkfile(filename, filetext) @@ -311,7 +332,7 @@ class ZZipTest(unittest.TestCase): zipfile="test4.zip" tmpdir="test4.tmp" exe=self.bins("mkzip") - for i in xrange(10000): + for i in range(10000): filename = os.path.join(tmpdir,"file%04i.txt" % i) filetext = "file-%04i\n" % i self.mkfile(filename, filetext) @@ -328,12 +349,12 @@ class ZZipTest(unittest.TestCase): zipfile="test5.zip" tmpdir="test5.tmp" exe=self.bins("mkzip") - for depth in xrange(20): + for depth in range(20): dirpath = "" - for i in xrange(depth): + for i in range(depth): if i: dirpath += "subdir%i/" % i - for size in xrange(18): + for size in range(18): size = 2 ** size filetext = self.gentext(size) filepart = "file%i-%i.txt" % (depth, size) @@ -1315,10 +1336,9 @@ class ZZipTest(unittest.TestCase): # run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), returncodes = [2]) - self.assertLess(len(run.output), 90) + self.assertLess(len(run.output), 101) self.assertLess(len(errors(run.errors)), 900) self.assertIn('test: mismatching "local" filename', run.errors) - self.assertIn('test: unknown compression method', run.errors) self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) self.rm_testdir() def test_59771_zzipdir_big_CVE_2017_5977(self): @@ -1483,13 +1503,13 @@ class ZZipTest(unittest.TestCase): returncodes = [0,2]) self.assertLess(len(run.output), 1) self.assertLess(len(errors(run.errors)), 180) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,2]) self.assertLess(len(run.output), 30) self.assertLess(len(errors(run.errors)), 300) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) self.assertFalse(os.path.exists(tmpdir+"/test")) # self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) self.rm_testdir() @@ -1817,13 +1837,13 @@ class ZZipTest(unittest.TestCase): returncodes = [0,2]) self.assertLess(len(run.output), 1) self.assertLess(len(errors(run.errors)), 180) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,2]) self.assertLess(len(run.output), 30) self.assertLess(len(errors(run.errors)), 200) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) self.assertFalse(os.path.exists(tmpdir+"/test")) self.rm_testdir() def test_59754_zzipdir_zap_CVE_2017_5975(self): @@ -1837,7 +1857,7 @@ class ZZipTest(unittest.TestCase): returncodes = [0,3]) self.assertLess(len(run.output), 1) self.assertLess(len(errors(run.errors)), 180) - self.assertIn(": Success", run.errors) + self.assertErrorMessage(run.errors, 0) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,3]) @@ -2046,7 +2066,7 @@ class ZZipTest(unittest.TestCase): returncodes = [2]) self.assertLess(len(run.output), 1) self.assertLess(len(errors(run.errors)), 180) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [2]) @@ -2066,7 +2086,7 @@ class ZZipTest(unittest.TestCase): returncodes = [3]) self.assertLess(len(run.output), 1) self.assertLess(len(errors(run.errors)), 180) - self.assertIn(": Success", run.errors) + self.assertErrorMessage(run.errors, 0) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [3]) # TODO @@ -2158,7 +2178,7 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), returncodes = [0,2]) self.assertLess(len(run.output), 1) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,2]) @@ -2178,7 +2198,7 @@ class ZZipTest(unittest.TestCase): returncodes = [0,3]) self.assertLess(len(run.output), 1) self.assertLess(len(errors(run.errors)), 80) - self.assertIn(": Success", run.errors) + self.assertErrorMessage(run.errors, 0) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,3]) @@ -2268,7 +2288,7 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), returncodes = [0,2]) self.assertLess(len(run.output), 1) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,2]) @@ -2288,7 +2308,7 @@ class ZZipTest(unittest.TestCase): returncodes = [0,3]) self.assertLess(len(run.output), 1) self.assertLess(len(errors(run.errors)), 80) - self.assertIn(": Success", run.errors) + self.assertErrorMessage(run.errors, 0) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,3]) @@ -2308,7 +2328,7 @@ class ZZipTest(unittest.TestCase): returncodes = [1]) self.assertLess(len(run.output), 1) self.assertLess(len(errors(run.errors)), 80) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) def test_63019(self): """ check $(CVE).zip """ tmpdir = self.testdir() @@ -2390,7 +2410,7 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), returncodes = [0,2]) self.assertLess(len(run.output), 1) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,2]) @@ -2410,7 +2430,7 @@ class ZZipTest(unittest.TestCase): returncodes = [0,3]) self.assertLess(len(run.output), 1) self.assertLess(len(errors(run.errors)), 90) - self.assertIn(": Success", run.errors) + self.assertErrorMessage(run.errors, 0) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,3]) @@ -2524,7 +2544,7 @@ class ZZipTest(unittest.TestCase): returncodes = [0,3]) self.assertLess(len(run.output), 1) self.assertLess(len(errors(run.errors)), 200) - self.assertIn(": Success", run.errors) + self.assertErrorMessage(run.errors, 0) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,3]) @@ -2614,7 +2634,7 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), returncodes = [0, 2]) self.assertLess(len(run.output), 1) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,2]) @@ -2634,7 +2654,7 @@ class ZZipTest(unittest.TestCase): returncodes = [0, 3]) self.assertLess(len(run.output), 1) self.assertLess(len(errors(run.errors)), 200) - self.assertIn(": Success", run.errors) + self.assertErrorMessage(run.errors, 0) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,3]) @@ -2654,7 +2674,7 @@ class ZZipTest(unittest.TestCase): returncodes = [1]) self.assertLess(len(run.output), 1) self.assertLess(len(errors(run.errors)), 200) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) self.rm_testdir() def test_64849(self): """ check $(CVE).zip """ @@ -2737,7 +2757,7 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), returncodes = [0,2]) self.assertLess(len(run.output), 1) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,2]) @@ -2757,7 +2777,7 @@ class ZZipTest(unittest.TestCase): returncodes = [0, 3]) self.assertLess(len(run.output), 1) self.assertLess(len(errors(run.errors)), 200) - self.assertIn(": Success", run.errors) + self.assertErrorMessage(run.errors, 0) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,3]) @@ -2847,7 +2867,7 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), returncodes = [0,2]) self.assertLess(len(run.output), 1) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,2]) @@ -2867,7 +2887,7 @@ class ZZipTest(unittest.TestCase): returncodes = [0, 3]) self.assertLess(len(run.output), 1) self.assertLess(len(errors(run.errors)), 200) - self.assertIn(": Success", run.errors) + self.assertErrorMessage(run.errors, 0) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,3]) @@ -2964,12 +2984,12 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), returncodes = [0,2]) self.assertLess(len(run.output), 1) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,2]) self.assertLess(len(run.output), 30) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) self.assertFalse(os.path.exists(tmpdir+"/test")) self.rm_testdir() @@ -2984,7 +3004,7 @@ class ZZipTest(unittest.TestCase): returncodes = [0, 3]) self.assertLess(len(run.output), 1) self.assertLess(len(errors(run.errors)), 200) - self.assertIn(": Success", run.errors) + self.assertErrorMessage(run.errors, 0) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,3]) @@ -3014,7 +3034,7 @@ class ZZipTest(unittest.TestCase): download_raw(file_url, filename, tmpdir) exe = self.bins("unzip") run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), - returncodes = [0, 80]) + returncodes = [3]) self.assertIn("missing 18 bytes in zipfile", run.errors) self.assertLess(len(run.output), 200) self.assertLess(len(errors(run.errors)), 800) @@ -3052,14 +3072,18 @@ class ZZipTest(unittest.TestCase): download_raw(file_url, filename, tmpdir) exe = self.bins("unzip") run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), - returncodes = [0, 80]) + returncodes = [3]) self.assertIn("missing 18 bytes in zipfile", run.errors) - self.assertLess(len(run.output), 200) + self.assertGreater(len(run.output), 30) + self.assertGreater(len(errors(run.errors)), 1) + self.assertLess(len(run.output), 500) self.assertLess(len(errors(run.errors)), 800) # run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), returncodes = [3]) - self.assertLess(len(run.output), 200) + self.assertGreater(len(run.output), 30) + self.assertGreater(len(errors(run.errors)), 1) + self.assertLess(len(run.output), 400) self.assertLess(len(errors(run.errors)), 800) self.assertIn("missing 18 bytes in zipfile", run.errors) self.assertIn('expected central file header signature not found', run.errors) @@ -3082,13 +3106,16 @@ class ZZipTest(unittest.TestCase): url_CVE_2018_27 = "https://github.com/ret2libc/---provided-by-email---" zip_CVE_2018_27 = "poc_bypass_fix2.zip" + zip_CVE_2018_27_size = 56 def test_65450(self): """ info unzip -l $(CVE).zip """ tmpdir = self.testdir() filename = self.zip_CVE_2018_27 file_url = self.url_CVE_2018_27 + filesize = self.zip_CVE_2018_27_size download_raw(file_url, filename, tmpdir) if not os.path.isfile(os.path.join(tmpdir, filename)): self.skipTest("missing " + filename) + if ((os.path.getsize(os.path.join(tmpdir, filename)) != filesize)): self.skipTest("missing " + filename) exe = self.bins("unzip") run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), returncodes = [0, 9]) @@ -3109,8 +3136,10 @@ class ZZipTest(unittest.TestCase): tmpdir = self.testdir() filename = self.zip_CVE_2018_27 file_url = self.url_CVE_2018_27 + filesize = self.zip_CVE_2018_27_size download_raw(file_url, filename, tmpdir) if not os.path.isfile(os.path.join(tmpdir, filename)): self.skipTest("missing " + filename) + if ((os.path.getsize(os.path.join(tmpdir, filename)) != filesize)): self.skipTest("missing " + filename) exe = self.bins("unzzip-big") run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), returncodes = [0]) @@ -3128,8 +3157,10 @@ class ZZipTest(unittest.TestCase): tmpdir = self.testdir() filename = self.zip_CVE_2018_27 file_url = self.url_CVE_2018_27 + filesize = self.zip_CVE_2018_27_size download_raw(file_url, filename, tmpdir) if not os.path.isfile(os.path.join(tmpdir, filename)): self.skipTest("missing " + filename) + if ((os.path.getsize(os.path.join(tmpdir, filename)) != filesize)): self.skipTest("missing " + filename) exe = self.bins("unzzip-mem") run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), returncodes = [0]) @@ -3151,18 +3182,20 @@ class ZZipTest(unittest.TestCase): tmpdir = self.testdir() filename = self.zip_CVE_2018_27 file_url = self.url_CVE_2018_27 + filesize = self.zip_CVE_2018_27_size download_raw(file_url, filename, tmpdir) if not os.path.isfile(os.path.join(tmpdir, filename)): self.skipTest("missing " + filename) + if ((os.path.getsize(os.path.join(tmpdir, filename)) != filesize)): self.skipTest("missing " + filename) exe = self.bins("unzzip-mix") run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), returncodes = [0,2]) self.assertLess(len(run.output), 1) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,2]) self.assertLess(len(run.output), 30) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) self.assertFalse(os.path.exists(tmpdir+"/test")) self.rm_testdir() @@ -3171,14 +3204,16 @@ class ZZipTest(unittest.TestCase): tmpdir = self.testdir() filename = self.zip_CVE_2018_27 file_url = self.url_CVE_2018_27 + filesize = self.zip_CVE_2018_27_size download_raw(file_url, filename, tmpdir) if not os.path.isfile(os.path.join(tmpdir, filename)): self.skipTest("missing " + filename) + if ((os.path.getsize(os.path.join(tmpdir, filename)) != filesize)): self.skipTest("missing " + filename) exe = self.bins("unzzip") run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), returncodes = [0, 3]) self.assertLess(len(run.output), 1) self.assertLess(len(errors(run.errors)), 200) - self.assertIn(": Success", run.errors) + self.assertErrorMessage(run.errors, 0) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,3]) @@ -3192,11 +3227,13 @@ class ZZipTest(unittest.TestCase): tmpdir = self.testdir() filename = self.zip_CVE_2018_27 file_url = self.url_CVE_2018_27 + filesize = self.zip_CVE_2018_27_size download_raw(file_url, filename, tmpdir) if not os.path.isfile(os.path.join(tmpdir, filename)): self.skipTest("missing " + filename) + if ((os.path.getsize(os.path.join(tmpdir, filename)) != filesize)): self.skipTest("missing " + filename) shell("ls -l {tmpdir}/{filename}".format(**locals())) size = os.path.getsize(os.path.join(tmpdir, filename)) - self.assertEqual(size, 56) + self.assertEqual(size, filesize) # 56 url_CVE_2018_41 = "https://github.com/fantasy7082/image_test/blob/master" zip_CVE_2018_41 = "c005-bus-zzip_parse_root_directory" # CVE-2018-7726. @@ -3315,12 +3352,12 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), returncodes = [0,2]) self.assertLess(len(run.output), 1) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,2]) self.assertLess(len(run.output), 30) - self.assertTrue(greps(run.errors, "Invalid or")) + self.assertErrorMessage(run.errors, errno.EILSEQ) # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) self.assertFalse(os.path.exists(tmpdir+"/test")) self.rm_testdir() @@ -3336,7 +3373,7 @@ class ZZipTest(unittest.TestCase): returncodes = [0, 3]) self.assertLess(len(run.output), 1) self.assertLess(len(errors(run.errors)), 200) - self.assertIn(": Success", run.errors) + self.assertErrorMessage(run.errors, 0) # run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), returncodes = [0,3]) @@ -3366,14 +3403,18 @@ class ZZipTest(unittest.TestCase): download_raw(file_url, filename, tmpdir) exe = self.bins("unzip") run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), - returncodes = [0, 80]) + returncodes = [3]) self.assertIn("missing 21 bytes in zipfile", run.errors) - self.assertLess(len(run.output), 500) + self.assertGreater(len(run.output), 20) + self.assertGreater(len(errors(run.errors)), 1) + self.assertLess(len(run.output), 2500) self.assertLess(len(errors(run.errors)), 800) # run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), returncodes = [3]) - self.assertLess(len(run.output), 500) + self.assertGreater(len(run.output), 20) + self.assertGreater(len(errors(run.errors)), 1) + self.assertLess(len(run.output), 2500) self.assertLess(len(errors(run.errors)), 800) self.assertIn("missing 21 bytes in zipfile", run.errors) self.assertIn('expected central file header signature not found', run.errors) @@ -3404,25 +3445,76 @@ class ZZipTest(unittest.TestCase): returncodes = [0]) self.rm_testdir() + url_CVE_2018_17828 = "https://github.com/gdraheim/zziplib/files/2415382" + zip_CVE_2018_17828 = "evil.zip" + def test_65484(self): + """ extract file with "../" in the pathname [CVE-2018-17828] """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_17828 + file_url = self.url_CVE_2018_17828 + download_raw(file_url, filename, tmpdir) + if not os.path.isfile(os.path.join(tmpdir, filename)): self.skipTest("missing " + filename) + exe = self.bins("unzzip-mem") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 80]) + self.assertLess(len(run.output), 500) + self.assertLess(len(errors(run.errors)), 1) + # + workdir = tmpdir + "/d1/d2" + os.makedirs(workdir) + run = shell("cd {workdir} && ../../../{exe} ../../{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 500) + self.assertEqual(len(errors(run.errors)), 1) + self.assertFalse(os.path.exists(tmpdir+"/test/evil.conf")) + self.assertTrue(os.path.exists(workdir+"/test/evil.conf")) + self.rm_testdir() + + def test_65485_list_verbose_compressed_with_directory(self): + """ verbously list a zipfile containing directories """ + chdir = "chdir" + if not exeext: chdir = "cd" + tmpdir = self.testdir() + workdir = tmpdir + "/d" + zipname = "ZIPfile" + os.makedirs(workdir) + f= open(tmpdir + "/d/file","w+") + for i in range(10): + f.write("This is line %d\r\n" % (i+1)) + f.close() + # create the ZIPfile + mkzip=self.bins("mkzip") + run = shell("{chdir} {tmpdir} && {mkzip} -9 {zipname}.zip d".format(**locals())) + self.assertFalse(run.returncode) + # list the ZIPfile + exe=self.bins("unzip-mem"); + run = shell("{chdir} {tmpdir} && ../{exe} -v {zipname}.zip".format(**locals()), returncodes = [0,-8]) + logg.error("FIXME: unzip-mem test_65485 is not solved") + self.skipTest("FIXME: not solved") + self.assertFalse(run.returncode) + self.rm_testdir() + def test_91000_zzshowme_check_sfx(self): """ create an *.exe that can extract its own zip content """ - exe=self.bins("mkzip") + mkzip=self.bins("mkzip") exefile = "tmp.zzshowme" + exeext - libstub = ".libs/zzipself" + exeext + libstub1 = ".libs/zzipself" + exeext + libstub2 = "zzipself" + exeext + libstub = os.path.exists(libstub1) and libstub1 or libstub2 txtfile_name = readme txtfile = self.src(readme) # add the extract-stub so we have reserved the size - run = shell("{exe} -0 -j {exefile}.zip {libstub}".format(**locals())) + run = shell("{mkzip} -0 -j {exefile}.zip {libstub}".format(**locals())) self.assertFalse(run.returncode) # add the actual content which may now be compressed - run = shell("{exe} -9 -j {exefile}.zip {txtfile}".format(**locals())) + run = shell("{mkzip} -9 -j {exefile}.zip {txtfile}".format(**locals())) self.assertFalse(run.returncode) # rename .zip to .exe and put the extract-stub at the start shutil.copy(exefile+".zip", exefile) setstub="./zzipsetstub" + exeext run = shell("{setstub} {exefile} {libstub}".format(**locals())) self.assertFalse(run.returncode) - os.chmod(exefile, 0755) + os.chmod(exefile, 0o755) # now ask the new .exe to show some of its own content run = shell("./{exefile} {txtfile_name}".format(**locals())) self.assertFalse(run.returncode) @@ -3468,13 +3560,14 @@ if __name__ == "__main__": help="name or path to unzip.exe to unpack *.zip [%default]") _o.add_option("-E", "--exeext", metavar="EXT", default=exeext, help="the executable extension (automake $(EXEEXT)) [%default]") - _o.add_option("--xmlresults", action="store_true", default=False, - help="print output in junit xml testresult format [%default]") + _o.add_option("--xmlresults", metavar="FILE", default=None, + help="capture results as a junit xml file [%default]") _o.add_option("-v", "--verbose", action="count", default=0, help="increase logging output [%default]") opt, args = _o.parse_args() logging.basicConfig(level = logging.WARNING - 10 * opt.verbose) topsrcdir = opt.topsrcdir + bindir = opt.bindir testdatdir = opt.testdatadir mkzip = opt.mkzip unzip = opt.unzip @@ -3491,12 +3584,19 @@ if __name__ == "__main__": if arg.startswith("_"): arg = arg[1:] if matches(method, arg): suite.addTest(testclass(method)) - # TextTestRunner(verbosity=opt.verbose).run(suite) - if opt.xmlresults: - import xmlrunner + + xmlresults = opt.xmlresults + if xmlresults: + try: import xmlrunner + except: xmlresults=None + if xmlresults: + if os.path.exists(opt.xmlresults): + os.remove(opt.xmlresults) + logg.info("xml results into %s", opt.xmlresults) Runner = xmlrunner.XMLTestRunner - Runner(xmlresults).run(suite) + result = Runner(output=opt.xmlresults).run(suite) else: Runner = unittest.TextTestRunner - Runner(verbosity=opt.verbose).run(suite) - + result = Runner(verbosity=opt.verbose).run(suite) + if not result.wasSuccessful(): + sys.exit(1) diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds.py b/Build/source/libs/zziplib/zziplib-src/testbuilds.py new file mode 100755 index 00000000000..756e77e5fc9 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds.py @@ -0,0 +1,1640 @@ +#! /usr/bin/env python3 +""" Testcases for zziplib build system """ + +__copyright__ = "(C) Guido Draheim, all rights reserved""" +__version__ = "0.13.71" + +import subprocess +import os.path +import time +import datetime +import unittest +import shutil +import inspect +import types +import logging +import re +from fnmatch import fnmatchcase as fnmatch +from glob import glob +import json +import sys + +if sys.version[0] == '3': + basestring = str + xrange = range + +logg = logging.getLogger("TESTING") +_python = "/usr/bin/python" + +SAVETO = "localhost:5000/zziplib" +IMAGES = "localhost:5000/zziplib/image" +CENTOS = "centos:7.7.1908" +UBUNTU = "ubuntu:16.04" +OPENSUSE = "opensuse/leap:15.1" + +DOCKER_SOCKET = "/var/run/docker.sock" + +def decodes(text): + if text is None: return None + if isinstance(text, bytes): + encoded = sys.getdefaultencoding() + if encoded in ["ascii"]: + encoded = "utf-8" + try: + return text.decode(encoded) + except: + return text.decode("latin-1") + return text +def sh____(cmd, shell=True): + if isinstance(cmd, basestring): + logg.info(": %s", cmd) + else: + logg.info(": %s", " ".join(["'%s'" % item for item in cmd])) + return subprocess.check_call(cmd, shell=shell) +def sx____(cmd, shell=True): + if isinstance(cmd, basestring): + logg.info(": %s", cmd) + else: + logg.info(": %s", " ".join(["'%s'" % item for item in cmd])) + return subprocess.call(cmd, shell=shell) +def output(cmd, shell=True): + if isinstance(cmd, basestring): + logg.info(": %s", cmd) + else: + logg.info(": %s", " ".join(["'%s'" % item for item in cmd])) + run = subprocess.Popen(cmd, shell=shell, stdout=subprocess.PIPE) + out, err = run.communicate() + return decodes(out) +def output2(cmd, shell=True): + if isinstance(cmd, basestring): + logg.info(": %s", cmd) + else: + logg.info(": %s", " ".join(["'%s'" % item for item in cmd])) + run = subprocess.Popen(cmd, shell=shell, stdout=subprocess.PIPE) + out, err = run.communicate() + return decodes(out), run.returncode +def output3(cmd, shell=True): + if isinstance(cmd, basestring): + logg.info(": %s", cmd) + else: + logg.info(": %s", " ".join(["'%s'" % item for item in cmd])) + run = subprocess.Popen(cmd, shell=shell, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = run.communicate() + return decodes(out), decodes(err), run.returncode +def background(cmd, shell=True): + BackgroundProcess = collections.namedtuple("BackgroundProcess", ["pid", "run", "log" ]) + log = open(os.devnull, "wb") + run = subprocess.Popen(cmd, shell=shell, stdout=log, stderr=log) + pid = run.pid + logg.info("PID %s = %s", pid, cmd) + return BackgroundProcess(pid, run, log) + + + +def _lines(lines): + if isinstance(lines, basestring): + lines = lines.split("\n") + if len(lines) and lines[-1] == "": + lines = lines[:-1] + return lines +def lines(text): + lines = [] + for line in _lines(text): + lines.append(line.rstrip()) + return lines +def grep(pattern, lines): + for line in _lines(lines): + if re.search(pattern, line.rstrip()): + yield line.rstrip() +def greps(lines, pattern): + return list(grep(pattern, lines)) + +def download(base_url, filename, into): + if not os.path.isdir(into): + os.makedirs(into) + if not os.path.exists(os.path.join(into, filename)): + sh____("cd {into} && wget {base_url}/{filename}".format(**locals())) +def text_file(filename, content): + filedir = os.path.dirname(filename) + if not os.path.isdir(filedir): + os.makedirs(filedir) + f = open(filename, "w") + if content.startswith("\n"): + x = re.match("(?s)\n( *)", content) + indent = x.group(1) + for line in content[1:].split("\n"): + if line.startswith(indent): + line = line[len(indent):] + f.write(line+"\n") + else: + f.write(content) + f.close() +def shell_file(filename, content): + text_file(filename, content) + os.chmod(filename, 0o770) +def copy_file(filename, target): + targetdir = os.path.dirname(target) + if not os.path.isdir(targetdir): + os.makedirs(targetdir) + shutil.copyfile(filename, target) +def copy_tool(filename, target): + copy_file(filename, target) + os.chmod(target, 0o750) + +def get_caller_name(): + frame = inspect.currentframe().f_back.f_back + return frame.f_code.co_name +def get_caller_caller_name(): + frame = inspect.currentframe().f_back.f_back.f_back + return frame.f_code.co_name +def os_path(root, path): + if not root: + return path + if not path: + return path + while path.startswith(os.path.sep): + path = path[1:] + return os.path.join(root, path) +def docname(path): + return os.path.splitext(os.path.basename(path))[0] + +class ZZiplibBuildTest(unittest.TestCase): + def caller_testname(self): + name = get_caller_caller_name() + x1 = name.find("_") + if x1 < 0: return name + x2 = name.find("_", x1+1) + if x2 < 0: return name + return name[:x2] + def testname(self, suffix = None): + name = self.caller_testname() + if suffix: + return name + "_" + suffix + return name + def testdir(self, testname = None): + testname = testname or self.caller_testname() + newdir = "tmp/tmp."+testname + if os.path.isdir(newdir): + shutil.rmtree(newdir) + os.makedirs(newdir) + return newdir + def rm_testdir(self, testname = None): + testname = testname or self.caller_testname() + newdir = "tmp/tmp."+testname + if os.path.isdir(newdir): + shutil.rmtree(newdir) + return newdir + def makedirs(self, path): + if not os.path.isdir(path): + os.makedirs(path) + def user(self): + import getpass + getpass.getuser() + def ip_container(self, name): + values = output("docker inspect "+name) + values = json.loads(values) + if not values or "NetworkSettings" not in values[0]: + logg.critical(" docker inspect %s => %s ", name, values) + return values[0]["NetworkSettings"]["IPAddress"] + def local_system(self): + distro, version = "", "" + if os.path.exists("/etc/os-release"): + # rhel:7.4 # VERSION="7.4 (Maipo)" ID="rhel" VERSION_ID="7.4" + # centos:7.3 # VERSION="7 (Core)" ID="centos" VERSION_ID="7" + # centos:7.4 # VERSION="7 (Core)" ID="centos" VERSION_ID="7" + # centos:7.7.1908 # VERSION="7 (Core)" ID="centos" VERSION_ID="7" + # opensuse:42.3 # VERSION="42.3" ID=opensuse VERSION_ID="42.3" + # opensuse/leap:15.0 # VERSION="15.0" ID="opensuse-leap" VERSION_ID="15.0" + # ubuntu:16.04 # VERSION="16.04.3 LTS (Xenial Xerus)" ID=ubuntu VERSION_ID="16.04" + # ubuntu:18.04 # VERSION="18.04.1 LTS (Bionic Beaver)" ID=ubuntu VERSION_ID="18.04" + for line in open("/etc/os-release"): + key, value = "", "" + m = re.match('^([_\\w]+)=([^"].*).*', line.strip()) + if m: + key, value = m.group(1), m.group(2) + m = re.match('^([_\\w]+)="([^"]*)".*', line.strip()) + if m: + key, value = m.group(1), m.group(2) + # logg.debug("%s => '%s' '%s'", line.strip(), key, value) + if key in ["ID"]: + distro = value.replace("-","/") + if key in ["VERSION_ID"]: + version = value + if os.path.exists("/etc/redhat-release"): + for line in open("/etc/redhat-release"): + m = re.search("release (\\d+[.]\\d+).*", line) + if m: + distro = "rhel" + version = m.group(1) + if os.path.exists("/etc/centos-release"): + # CentOS Linux release 7.5.1804 (Core) + for line in open("/etc/centos-release"): + m = re.search("release (\\d+[.]\\d+).*", line) + if m: + distro = "centos" + version = m.group(1) + logg.info(":: local_system %s:%s", distro, version) + if distro and version: + return "%s:%s" % (distro, version) + return "" + def with_local_ubuntu_mirror(self, ver = None): + """ detects a local ubuntu mirror or starts a local + docker container with a ubunut repo mirror. It + will return the extra_hosts setting to start + other docker containers""" + rmi = "localhost:5000/mirror-packages" + rep = "ubuntu-repo" + ver = ver or UBUNTU.split(":")[1] + universe = "ubuntu-repo/universe" + ok = self.with_local(rmi, universe, ver, "archive.ubuntu.com", "security.ubuntu.com") + if ok: return ok + return self.with_local(rmi, rep, ver, "archive.ubuntu.com", "security.ubuntu.com") + def with_local_centos_mirror(self, ver = None): + """ detects a local centos mirror or starts a local + docker container with a centos repo mirror. It + will return the setting for extrahosts""" + rmi = "localhost:5000/mirror-packages" + rep = "centos-repo" + ver = ver or CENTOS.split(":")[1] + return self.with_local(rmi, rep, ver, "mirrorlist.centos.org") + def with_local_opensuse_mirror(self, ver = None): + """ detects a local opensuse mirror or starts a local + docker container with a centos repo mirror. It + will return the extra_hosts setting to start + other docker containers""" + rmi = "localhost:5000/mirror-packages" + rep = "opensuse-repo" + ver = ver or OPENSUSE.split(":")[1] + return self.with_local(rmi, rep, ver, "download.opensuse.org") + def with_local(self, rmi, rep, ver, *hosts): + image = "{rmi}/{rep}:{ver}".format(**locals()) + container = "{rep}-{ver}".format(**locals()).replace("/","-") + out, err, ok = output3("docker inspect {image}".format(**locals())) + image_found = json.loads(out) + if not image_found: + return {} + out, err, ok = output3("docker inspect {container}".format(**locals())) + container_found = json.loads(out) + if container_found: + container_status = container_found[0]["State"]["Status"] + logg.info("::: %s -> %s", container, container_status) + latest_image_id = image_found[0]["Id"] + container_image_id = container_found[0]["Image"] + if latest_image_id != container_image_id or container_status not in ["running"]: + cmd = "docker rm --force {container}" + sx____(cmd.format(**locals())) + container_found = [] + if not container_found: + cmd = "docker run --rm=true --detach --name {container} {image}" + sh____(cmd.format(**locals())) + ip_a = self.ip_container(container) + logg.info("::: %s => %s", container, ip_a) + return dict(zip(hosts, [ ip_a ] * len(hosts))) + def with_local_mirror(self, image): + """ attach local centos-repo / opensuse-repo to docker-start enviroment. + Effectivly when it is required to 'docker start centos:x.y' then do + 'docker start centos-repo:x.y' before and extend the original to + 'docker start --add-host mirror...:centos-repo centos:x.y'. """ + hosts = {} + if image.startswith("centos:"): + version = image[len("centos:"):] + hosts = self.with_local_centos_mirror(version) + if image.startswith("opensuse/leap:"): + version = image[len("opensuse/leap:"):] + hosts = self.with_local_opensuse_mirror(version) + if image.startswith("opensuse:"): + version = image[len("opensuse:"):] + hosts = self.with_local_opensuse_mirror(version) + if image.startswith("ubuntu:"): + version = image[len("ubuntu:"):] + hosts = self.with_local_ubuntu_mirror(version) + return hosts + def add_hosts(self, hosts): + return " ".join(["--add-host %s:%s" % (host, ip_a) for host, ip_a in hosts.items() ]) + # for host, ip_a in mapping.items(): + # yield "--add-host {host}:{ip_a}" + def local_image(self, image): + """ attach local centos-repo / opensuse-repo to docker-start enviroment. + Effectivly when it is required to 'docker start centos:x.y' then do + 'docker start centos-repo:x.y' before and extend the original to + 'docker start --add-host mirror...:centos-repo centos:x.y'. """ + if os.environ.get("NONLOCAL",""): + return image + hosts = self.with_local_mirror(image) + if hosts: + add_hosts = self.add_hosts(hosts) + logg.debug("%s %s", add_hosts, image) + return "{add_hosts} {image}".format(**locals()) + return image + def local_addhosts(self, dockerfile): + image = "" + for line in open(dockerfile): + m = re.match('[Ff][Rr][Oo][Mm] *"([^"]*)"', line) + if m: + image = m.group(1) + break + m = re.match("[Ff][Rr][Oo][Mm] *(\w[^ ]*)", line) + if m: + image = m.group(1).strip() + break + logg.debug("--\n-- '%s' FROM '%s'", dockerfile, image) + if image: + hosts = self.with_local_mirror(image) + return self.add_hosts(hosts) + return "" + def drop_container(self, name): + cmd = "docker rm --force {name}" + sx____(cmd.format(**locals())) + def drop_centos(self): + self.drop_container("centos") + def drop_ubuntu(self): + self.drop_container("ubuntu") + def drop_opensuse(self): + self.drop_container("opensuse") + def make_opensuse(self): + self.make_container("opensuse", OPENSUSE) + def make_ubuntu(self): + self.make_container("ubuntu", UBUNTU) + def make_centos(self): + self.make_container("centos", CENTOS) + def make_container(self, name, image): + self.drop_container(name) + local_image = self.local_image(image) + cmd = "docker run --detach --name {name} {local_image} sleep 1000" + sh____(cmd.format(**locals())) + print(" # " + local_image) + print(" docker exec -it "+name+" bash") + # + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + # + def test_100(self): + logg.info("\n CENTOS = '%s'", CENTOS) + self.with_local_centos_mirror() + def test_201_centos7_automake_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/centos7-am-build.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 60" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /usr/local/include -type f" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'ls -l /usr/local/lib64/libzz*'" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test ! -d /usr/local/include/SDL_rwops_zzip'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} rpm -q --whatprovides /usr/lib64/pkgconfig/zlib.pc" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} pkg-config --libs zlib" + zlib = output(cmd.format(**locals())) + self.assertEqual(zlib.strip(), "-lz") + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_202_centos8_automake_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/centos8-am-build.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 60" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /usr/local/include -type f" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'ls -l /usr/local/lib64/libzz*'" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test ! -d /usr/local/include/SDL_rwops_zzip'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} rpm -q --whatprovides /usr/lib64/pkgconfig/zlib.pc" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} pkg-config --libs zlib" + zlib = output(cmd.format(**locals())) + self.assertEqual(zlib.strip(), "-lz") + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_211_centos7_build_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/centos7-build.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 60" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /usr/local/include -type f" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'ls -l /usr/local/lib64/libzz*'" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test ! -d /usr/local/include/SDL_rwops_zzip'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} rpm -q --whatprovides /usr/lib64/pkgconfig/zlib.pc" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} pkg-config --libs zlib" + zlib = output(cmd.format(**locals())) + self.assertEqual(zlib.strip(), "-lz") + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_212_centos8_build_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/centos8-build.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 60" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /usr/local/include -type f" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'ls -l /usr/local/lib64/libzz*'" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test ! -d /usr/local/include/SDL_rwops_zzip'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} rpm -q --whatprovides /usr/lib64/pkgconfig/zlib.pc" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} pkg-config --libs zlib" + zlib = output(cmd.format(**locals())) + self.assertEqual(zlib.strip(), "-lz") + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_221_ubuntu16_build_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/ubuntu16-build.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 600" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /usr/local/include -type f" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'ls -l /usr/local/lib/libzz*'" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test ! -d /usr/local/include/SDL_rwops_zzip'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} dpkg -S /usr/lib/x86_64-linux-gnu/pkgconfig/zlib.pc" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} pkg-config --libs zlib" + zlib = output(cmd.format(**locals())) + self.assertEqual(zlib.strip(), "-lz") + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_222_ubuntu18_build_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/ubuntu18-build.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 600" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /usr/local/include -type f" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'ls -l /usr/local/lib/libzz*'" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test ! -d /usr/local/include/SDL_rwops_zzip'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} dpkg -S /usr/lib/x86_64-linux-gnu/pkgconfig/zlib.pc" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} pkg-config --libs zlib" + zlib = output(cmd.format(**locals())) + self.assertEqual(zlib.strip(), "-lz") + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_225_ubuntu16_32bit_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/ubuntu16-32bit.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 600" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /usr/local/include -type f" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'ls -l /usr/local/lib/libzz*'" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test ! -d /usr/local/include/SDL_rwops_zzip'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} dpkg -S /usr/lib/i386-linux-gnu/pkgconfig/zlib.pc" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} pkg-config --libs zlib" + zlib = output(cmd.format(**locals())) + self.assertEqual(zlib.strip(), "-lz") + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_231_opensuse15_build_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/opensuse15-build.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 60" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /usr/local/include -type f" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'ls -l /usr/local/lib64/libzz*'" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test ! -d /usr/local/include/SDL_rwops_zzip'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} rpm -q --whatprovides /usr/lib64/pkgconfig/zlib.pc" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} pkg-config --libs zlib" + zlib = output(cmd.format(**locals())) + self.assertEqual(zlib.strip(), "-lz") + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + @unittest.expectedFailure + def test_251_windows_static_x64_dockerfile(self): + logg.warning(" windows-static-x64 compiles fine but segfaults on linking an .exe") + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/windows-static-x64.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 600" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + # + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + @unittest.expectedFailure + def test_252_windows_shared_x64_dockerfile(self): + logg.warning(" windows-shared-x64 compiles fine but segfaults on linking an .exe") + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/windows-shared-x64.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 600" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + # + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_301_centos7_automake_sdl2_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/centos7-am-sdl2.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 60" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /usr/local/include -type f" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'ls -l /usr/local/lib64/libzz*'" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test -d /usr/local/include/SDL_rwops_zzip'" + sh____(cmd.format(**locals())) + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_302_centos8_automake_sdl2_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/centos8-am-sdl2.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 60" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /usr/local/include -type f" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'ls -l /usr/local/lib64/libzz*'" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test -d /usr/local/include/SDL_rwops_zzip'" + sh____(cmd.format(**locals())) + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_311_centos7_sdl2_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/centos7-sdl2.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 60" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /usr/local/include -type f" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'ls -l /usr/local/lib64/libzz*'" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test -d /usr/local/include/SDL_rwops_zzip'" + sh____(cmd.format(**locals())) + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_312_centos8_sdl2_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/centos8-sdl2.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 60" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /usr/local/include -type f" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'ls -l /usr/local/lib64/libzz*'" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test -d /usr/local/include/SDL_rwops_zzip'" + sh____(cmd.format(**locals())) + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_321_ubuntu18_sdl2_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/ubuntu16-sdl2.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 600" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /usr/local/include -type f" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'ls -l /usr/local/lib/libzz*'" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test -d /usr/local/include/SDL_rwops_zzip'" + sh____(cmd.format(**locals())) + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_331_opensuse15_sdl2_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/opensuse15-sdl2.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 60" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /usr/local/include -type f" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'ls -l /usr/local/lib64/libzz*'" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test -d /usr/local/include/SDL_rwops_zzip'" + sh____(cmd.format(**locals())) + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_411_centos7_sdl2_destdir_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/centos7-destdir-sdl2.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 60" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /new/usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /new/usr/local/include -type f" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'ls -l /new/usr/local/lib64/libzz*'" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test -d /new/usr/local/include/SDL_rwops_zzip'" + sh____(cmd.format(**locals())) + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_412_centos8_sdl2_destdir_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/centos8-destdir-sdl2.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_check=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 60" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /new/usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /new/usr/local/include -type f" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'ls -l /new/usr/local/lib64/libzz*'" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test -d /new/usr/local/include/SDL_rwops_zzip'" + sh____(cmd.format(**locals())) + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_421_ubuntu16_azure_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/ubuntu16-azure.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_install=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 600" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + # + cmd = "docker exec {testname} find src -name *.xml" + sh____(cmd.format(**locals())) + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_701_centos7_am_docs_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/centos7-am-docs.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build --build-arg=no_build=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 60" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /usr/local/include -type f" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test ! -d /usr/local/include/zzip/types.h'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'test -d /usr/local/share/doc/zziplib'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'test -f /usr/local/share/man/man3/zzip_opendir.3'" + sh____(cmd.format(**locals())) + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_711_centos7_docs_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname=self.testname() + testdir = self.testdir() + dockerfile="testbuilds/centos7-docs.dockerfile" + addhosts = self.local_addhosts(dockerfile) + savename = docname(dockerfile) + saveto = SAVETO + images = IMAGES + build = "build" # "build --build-arg=no_build=true" + cmd = "docker {build} . -f {dockerfile} {addhosts} --tag {images}:{testname}" + sh____(cmd.format(**locals())) + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname} {images}:{testname} sleep 600" + sh____(cmd.format(**locals())) + #:# container = self.ip_container(testname) + cmd = "docker exec {testname} ls -l /usr/local/bin" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} find /usr/local/include -type f" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname} bash -c 'test ! -d /usr/local/include/zzip/types.h'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'test -d /usr/local/share/doc/zziplib'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname} bash -c 'test -f /usr/local/share/man/man3/zzip_opendir.3'" + sh____(cmd.format(**locals())) + # + cmd = "docker rm --force {testname}" + sx____(cmd.format(**locals())) + cmd = "docker rmi {saveto}/{savename}:latest" + sx____(cmd.format(**locals())) + cmd = "docker tag {images}:{testname} {saveto}/{savename}:latest" + sh____(cmd.format(**locals())) + cmd = "docker rmi {images}:{testname}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_9211_centos7_automake_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname1=self.testname() + "_1" + testname2=self.testname() + "_2" + testdir = self.testdir() + dockerfile1="testbuilds/centos7-am-build.dockerfile" + dockerfile2="testbuilds/centos7-build.dockerfile" + addhosts = self.local_addhosts(dockerfile1) + savename1 = docname(dockerfile1) + savename2 = docname(dockerfile2) + saveto = SAVETO + images = IMAGES + cmd = "docker rm --force {testname1}" + sx____(cmd.format(**locals())) + cmd = "docker rm --force {testname2}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname1} {addhosts} {saveto}/{savename1} sleep 600" + sh____(cmd.format(**locals())) + cmd = "docker run -d --name {testname2} {addhosts} {saveto}/{savename2} sleep 600" + # + sh____(cmd.format(**locals())) + cmd = "docker exec {testname2} bash -c 'cd /usr/local && tar czvf /local.tgz .'" + sh____(cmd.format(**locals())) + cmd = "docker cp {testname2}:/local.tgz tmp.local.tgz" + sh____(cmd.format(**locals())) + cmd = "docker cp tmp.local.tgz {testname1}:/local.tgz" + sh____(cmd.format(**locals())) + cmd = "rm tmp.local.tgz" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} mkdir -p /new/local" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'cd /new/local && tar xzvf /local.tgz'" + sh____(cmd.format(**locals())) + # + item="{}" + end="\\;" + A='"s:zzip-zlib-config:zlib:"' + B='"s:=/usr/local/:=\\${prefix}/:"' + C1='"/^exec_prefix=/d"' + C2='"/^datarootdir=/d"' + C3='"/^datadir=/d"' + C4='"/^sysconfdir=/d"' + C5='"/^bindir=/d"' + G='"/ generated by configure /d"' + cmd = "docker exec {testname1} bash -c 'find /usr/local -name *.pc -exec sed -i -e {A} -e {B} -e {C1} -e {C2} -e {C3} -e {C4} -e {C5} -e {G} {item} {end}'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'find /usr/local -name zzip-zlib-config.pc -exec rm -v {item} {end}'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'find /usr/local -name *.la -exec rm -v {item} {end}'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'find /new/local -name *-0.so -exec rm -v {item} {end}'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} diff -uw /usr/local/include/zzip/_config.h /new/local/include/zzip/_config.h" + sx____(cmd.format(**locals())) + cmd = "docker exec {testname1} diff -urw --no-dereference /usr/local /new/local --exclude _config.h" + sx____(cmd.format(**locals())) + out = output(cmd.format(**locals())) + self.assertFalse(greps(out, "---")) + self.assertFalse(greps(out, "Only")) + # + cmd = "docker rm --force {testname1}" + sx____(cmd.format(**locals())) + cmd = "docker rm --force {testname2}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_9212_centos7_automake_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname1=self.testname() + "_1" + testname2=self.testname() + "_2" + testdir = self.testdir() + dockerfile1="testbuilds/centos8-am-build.dockerfile" + dockerfile2="testbuilds/centos8-build.dockerfile" + addhosts = self.local_addhosts(dockerfile1) + savename1 = docname(dockerfile1) + savename2 = docname(dockerfile2) + saveto = SAVETO + images = IMAGES + cmd = "docker rm --force {testname1}" + sx____(cmd.format(**locals())) + cmd = "docker rm --force {testname2}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname1} {addhosts} {saveto}/{savename1} sleep 600" + sh____(cmd.format(**locals())) + cmd = "docker run -d --name {testname2} {addhosts} {saveto}/{savename2} sleep 600" + # + sh____(cmd.format(**locals())) + cmd = "docker exec {testname2} bash -c 'cd /usr/local && tar czvf /local.tgz .'" + sh____(cmd.format(**locals())) + cmd = "docker cp {testname2}:/local.tgz tmp.local.tgz" + sh____(cmd.format(**locals())) + cmd = "docker cp tmp.local.tgz {testname1}:/local.tgz" + sh____(cmd.format(**locals())) + cmd = "rm tmp.local.tgz" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} mkdir -p /new/local" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'cd /new/local && tar xzvf /local.tgz'" + sh____(cmd.format(**locals())) + # + item="{}" + end="\\;" + A='"s:zzip-zlib-config:zlib:"' + B='"s:=/usr/local/:=\\${prefix}/:"' + C1='"/^exec_prefix=/d"' + C2='"/^datarootdir=/d"' + C3='"/^datadir=/d"' + C4='"/^sysconfdir=/d"' + C5='"/^bindir=/d"' + G='"/ generated by configure /d"' + cmd = "docker exec {testname1} bash -c 'find /usr/local -name *.pc -exec sed -i -e {A} -e {B} -e {C1} -e {C2} -e {C3} -e {C4} -e {C5} -e {G} {item} {end}'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'find /usr/local -name zzip-zlib-config.pc -exec rm -v {item} {end}'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'find /usr/local -name *.la -exec rm -v {item} {end}'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'find /new/local -name *-0.so -exec rm -v {item} {end}'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} diff -uw /usr/local/include/zzip/_config.h /new/local/include/zzip/_config.h" + sx____(cmd.format(**locals())) + cmd = "docker exec {testname1} diff -urw --no-dereference /usr/local /new/local --exclude _config.h" + sx____(cmd.format(**locals())) + out = output(cmd.format(**locals())) + self.assertFalse(greps(out, "---")) + self.assertFalse(greps(out, "Only")) + # + cmd = "docker rm --force {testname1}" + sx____(cmd.format(**locals())) + cmd = "docker rm --force {testname2}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_9311_centos7_automake_sdl2_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname1=self.testname() + "_1" + testname2=self.testname() + "_2" + testdir = self.testdir() + dockerfile1="testbuilds/centos7-am-sdl2.dockerfile" + dockerfile2="testbuilds/centos7-sdl2.dockerfile" + addhosts = self.local_addhosts(dockerfile1) + savename1 = docname(dockerfile1) + savename2 = docname(dockerfile2) + saveto = SAVETO + images = IMAGES + cmd = "docker rm --force {testname1}" + sx____(cmd.format(**locals())) + cmd = "docker rm --force {testname2}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname1} {addhosts} {saveto}/{savename1} sleep 600" + sh____(cmd.format(**locals())) + cmd = "docker run -d --name {testname2} {addhosts} {saveto}/{savename2} sleep 600" + # + sh____(cmd.format(**locals())) + cmd = "docker exec {testname2} bash -c 'cd /usr/local && tar czvf /local.tgz .'" + sh____(cmd.format(**locals())) + cmd = "docker cp {testname2}:/local.tgz tmp.local.tgz" + sh____(cmd.format(**locals())) + cmd = "docker cp tmp.local.tgz {testname1}:/local.tgz" + sh____(cmd.format(**locals())) + cmd = "rm tmp.local.tgz" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} mkdir -p /new/local" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'cd /new/local && tar xzvf /local.tgz'" + sh____(cmd.format(**locals())) + # + item="{}" + end="\\;" + A='"s:zzip-zlib-config:zlib:"' + B='"s:=/usr/local/:=\\${prefix}/:"' + C1='"/^exec_prefix=/d"' + C2='"/^datarootdir=/d"' + C3='"/^datadir=/d"' + C4='"/^sysconfdir=/d"' + C5='"/^bindir=/d"' + G='"/ generated by configure /d"' + cmd = "docker exec {testname1} bash -c 'find /usr/local -name *.pc -exec sed -i -e {A} -e {B} -e {C1} -e {C2} -e {C3} -e {C4} -e {C5} -e {G} {item} {end}'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'find /usr/local -name zzip-zlib-config.pc -exec rm -v {item} {end}'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'find /usr/local -name *.la -exec rm -v {item} {end}'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'find /new/local -name *-0.so -exec rm -v {item} {end}'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} diff -uw /usr/local/include/zzip/_config.h /new/local/include/zzip/_config.h" + sx____(cmd.format(**locals())) + cmd = "docker exec {testname1} diff -urw --no-dereference /usr/local /new/local --exclude _config.h" + sx____(cmd.format(**locals())) + out = output(cmd.format(**locals())) + self.assertFalse(greps(out, "---")) + self.assertFalse(greps(out, "Only")) + # + cmd = "docker rm --force {testname1}" + sx____(cmd.format(**locals())) + cmd = "docker rm --force {testname2}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_9312_centos7_automake_sdl2_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname1=self.testname() + "_1" + testname2=self.testname() + "_2" + testdir = self.testdir() + dockerfile1="testbuilds/centos8-am-sdl2.dockerfile" + dockerfile2="testbuilds/centos8-sdl2.dockerfile" + addhosts = self.local_addhosts(dockerfile1) + savename1 = docname(dockerfile1) + savename2 = docname(dockerfile2) + saveto = SAVETO + images = IMAGES + cmd = "docker rm --force {testname1}" + sx____(cmd.format(**locals())) + cmd = "docker rm --force {testname2}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname1} {addhosts} {saveto}/{savename1} sleep 600" + sh____(cmd.format(**locals())) + cmd = "docker run -d --name {testname2} {addhosts} {saveto}/{savename2} sleep 600" + # + sh____(cmd.format(**locals())) + cmd = "docker exec {testname2} bash -c 'cd /usr/local && tar czvf /local.tgz .'" + sh____(cmd.format(**locals())) + cmd = "docker cp {testname2}:/local.tgz tmp.local.tgz" + sh____(cmd.format(**locals())) + cmd = "docker cp tmp.local.tgz {testname1}:/local.tgz" + sh____(cmd.format(**locals())) + cmd = "rm tmp.local.tgz" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} mkdir -p /new/local" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'cd /new/local && tar xzvf /local.tgz'" + sh____(cmd.format(**locals())) + # + item="{}" + end="\\;" + A='"s:zzip-zlib-config:zlib:"' + B='"s:=/usr/local/:=\\${prefix}/:"' + C1='"/^exec_prefix=/d"' + C2='"/^datarootdir=/d"' + C3='"/^datadir=/d"' + C4='"/^sysconfdir=/d"' + C5='"/^bindir=/d"' + G='"/ generated by configure /d"' + cmd = "docker exec {testname1} bash -c 'find /usr/local -name *.pc -exec sed -i -e {A} -e {B} -e {C1} -e {C2} -e {C3} -e {C4} -e {C5} -e {G} {item} {end}'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'find /usr/local -name zzip-zlib-config.pc -exec rm -v {item} {end}'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'find /usr/local -name *.la -exec rm -v {item} {end}'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'find /new/local -name *-0.so -exec rm -v {item} {end}'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} diff -uw /usr/local/include/zzip/_config.h /new/local/include/zzip/_config.h" + sx____(cmd.format(**locals())) + cmd = "docker exec {testname1} diff -urw --no-dereference /usr/local /new/local --exclude _config.h" + sx____(cmd.format(**locals())) + out = output(cmd.format(**locals())) + self.assertFalse(greps(out, "---")) + self.assertFalse(greps(out, "Only")) + # + cmd = "docker rm --force {testname1}" + sx____(cmd.format(**locals())) + cmd = "docker rm --force {testname2}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_9411_centos7_automake_sdl2_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname1=self.testname() + "_1" + testname2=self.testname() + "_2" + testdir = self.testdir() + dockerfile1="testbuilds/centos7-sdl2.dockerfile" + dockerfile2="testbuilds/centos7-destdir-sdl2.dockerfile" + addhosts = self.local_addhosts(dockerfile1) + savename1 = docname(dockerfile1) + savename2 = docname(dockerfile2) + saveto = SAVETO + images = IMAGES + cmd = "docker rm --force {testname1}" + sx____(cmd.format(**locals())) + cmd = "docker rm --force {testname2}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname1} {addhosts} {saveto}/{savename1} sleep 600" + sh____(cmd.format(**locals())) + cmd = "docker run -d --name {testname2} {addhosts} {saveto}/{savename2} sleep 600" + # + sh____(cmd.format(**locals())) + cmd = "docker exec {testname2} bash -c 'cd /new/usr/local && tar czvf /local.tgz .'" + sh____(cmd.format(**locals())) + cmd = "docker cp {testname2}:/local.tgz tmp.local.tgz" + sh____(cmd.format(**locals())) + cmd = "docker cp tmp.local.tgz {testname1}:/local.tgz" + sh____(cmd.format(**locals())) + cmd = "rm tmp.local.tgz" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} mkdir -p /new/local" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'cd /new/local && tar xzvf /local.tgz'" + sh____(cmd.format(**locals())) + # + DIRS="etc lib libexec sbin games src share/info share/applications share/man/mann" + for i in xrange(1,10): + DIRS+=" share/man/man%i share/man/man%ix" % (i,i) + cmd = "docker exec {testname1} bash -c 'cd /new/local && (for u in {DIRS}; do mkdir -pv $u; done)'" + sh____(cmd.format(**locals())) + item="{}" + end="\\;" + cmd = "docker exec {testname1} diff -urw --no-dereference /usr/local /new/local" + sx____(cmd.format(**locals())) + out = output(cmd.format(**locals())) + self.assertFalse(greps(out, "---")) + self.assertFalse(greps(out, "Only")) + # + cmd = "docker rm --force {testname1}" + sx____(cmd.format(**locals())) + cmd = "docker rm --force {testname2}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_9412_centos7_automake_sdl2_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname1=self.testname() + "_1" + testname2=self.testname() + "_2" + testdir = self.testdir() + dockerfile1="testbuilds/centos8-sdl2.dockerfile" + dockerfile2="testbuilds/centos8-destdir-sdl2.dockerfile" + addhosts = self.local_addhosts(dockerfile1) + savename1 = docname(dockerfile1) + savename2 = docname(dockerfile2) + saveto = SAVETO + images = IMAGES + cmd = "docker rm --force {testname1}" + sx____(cmd.format(**locals())) + cmd = "docker rm --force {testname2}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname1} {addhosts} {saveto}/{savename1} sleep 600" + sh____(cmd.format(**locals())) + cmd = "docker run -d --name {testname2} {addhosts} {saveto}/{savename2} sleep 600" + # + sh____(cmd.format(**locals())) + cmd = "docker exec {testname2} bash -c 'cd /new/usr/local && tar czvf /local.tgz .'" + sh____(cmd.format(**locals())) + cmd = "docker cp {testname2}:/local.tgz tmp.local.tgz" + sh____(cmd.format(**locals())) + cmd = "docker cp tmp.local.tgz {testname1}:/local.tgz" + sh____(cmd.format(**locals())) + cmd = "rm tmp.local.tgz" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} mkdir -p /new/local" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'cd /new/local && tar xzvf /local.tgz'" + sh____(cmd.format(**locals())) + # + DIRS="etc lib libexec sbin games src share/info share/applications share/man/mann" + for i in xrange(1,10): + DIRS+=" share/man/man%i share/man/man%ix" % (i,i) + cmd = "docker exec {testname1} bash -c 'cd /new/local && (for u in {DIRS}; do mkdir -pv $u; done)'" + sh____(cmd.format(**locals())) + item="{}" + end="\\;" + cmd = "docker exec {testname1} diff -urw --no-dereference /usr/local /new/local" + sx____(cmd.format(**locals())) + out = output(cmd.format(**locals())) + self.assertFalse(greps(out, "---")) + self.assertFalse(greps(out, "Only")) + # + cmd = "docker rm --force {testname1}" + sx____(cmd.format(**locals())) + cmd = "docker rm --force {testname2}" + sx____(cmd.format(**locals())) + self.rm_testdir() + def test_9711_centos7_docs_dockerfile(self): + if not os.path.exists(DOCKER_SOCKET): self.skipTest("docker-based test") + testname1=self.testname() + "_1" + testname2=self.testname() + "_2" + testdir = self.testdir() + dockerfile1="testbuilds/centos7-am-docs.dockerfile" + dockerfile2="testbuilds/centos7-docs.dockerfile" + addhosts = self.local_addhosts(dockerfile1) + savename1 = docname(dockerfile1) + savename2 = docname(dockerfile2) + saveto = SAVETO + images = IMAGES + cmd = "docker rm --force {testname1}" + sx____(cmd.format(**locals())) + cmd = "docker rm --force {testname2}" + sx____(cmd.format(**locals())) + cmd = "docker run -d --name {testname1} {addhosts} {saveto}/{savename1} sleep 600" + sh____(cmd.format(**locals())) + cmd = "docker run -d --name {testname2} {addhosts} {saveto}/{savename2} sleep 600" + # + sh____(cmd.format(**locals())) + cmd = "docker exec {testname2} bash -c 'cd /usr/local && tar czvf /local.tgz .'" + sh____(cmd.format(**locals())) + cmd = "docker cp {testname2}:/local.tgz tmp.local.tgz" + sh____(cmd.format(**locals())) + cmd = "docker cp tmp.local.tgz {testname1}:/local.tgz" + sh____(cmd.format(**locals())) + cmd = "rm tmp.local.tgz" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} mkdir -p /new/local" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'cd /new/local && tar xzvf /local.tgz'" + sh____(cmd.format(**locals())) + # + cmd = "docker exec {testname1} bash -c 'cd /usr/local/share/doc/zziplib && mv man/html .'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'cd /usr/local/share/doc/zziplib && rm -rf man'" + sh____(cmd.format(**locals())) + cmd = "docker exec {testname1} bash -c 'cd /usr/local/share/doc/zziplib && mv html man'" + sh____(cmd.format(**locals())) + item="{}" + end="\\;" + cmd = "docker exec {testname1} diff -urw --no-dereference --brief /usr/local /new/local" + sx____(cmd.format(**locals())) + out = output(cmd.format(**locals())) + self.assertFalse(greps(out, "---")) + self.assertFalse(greps(out, "Only")) + # + cmd = "docker exec {testname1} diff -urw --no-dereference /usr/local /new/local" + sx____(cmd.format(**locals())) + # + cmd = "docker rm --force {testname1}" + sx____(cmd.format(**locals())) + cmd = "docker rm --force {testname2}" + sx____(cmd.format(**locals())) + self.rm_testdir() + + +if __name__ == "__main__": + from optparse import OptionParser + _o = OptionParser("%prog [options] test*", + epilog=__doc__.strip().split("\n")[0]) + _o.add_option("-v","--verbose", action="count", default=0, + help="increase logging level [%default]") + _o.add_option("-p","--python", metavar="EXE", default=_python, + help="use another python execution engine [%default]") + _o.add_option("-l","--logfile", metavar="FILE", default="", + help="additionally save the output log to a file [%default]") + _o.add_option("--xmlresults", metavar="FILE", default=None, + help="capture results as a junit xml file [%default]") + opt, args = _o.parse_args() + logging.basicConfig(level = logging.WARNING - opt.verbose * 5) + # + _python = opt.python + # + logfile = None + if opt.logfile: + if os.path.exists(opt.logfile): + os.remove(opt.logfile) + logfile = logging.FileHandler(opt.logfile) + logfile.setFormatter(logging.Formatter("%(levelname)s:%(relativeCreated)d:%(message)s")) + logging.getLogger().addHandler(logfile) + logg.info("log diverted to %s", opt.logfile) + xmlresults = None + if opt.xmlresults: + if os.path.exists(opt.xmlresults): + os.remove(opt.xmlresults) + xmlresults = open(opt.xmlresults, "w") + logg.info("xml results into %s", opt.xmlresults) + # + # unittest.main() + suite = unittest.TestSuite() + if not args: args = [ "test_*" ] + for arg in args: + for classname in sorted(globals()): + if not classname.endswith("Test"): + continue + testclass = globals()[classname] + for method in sorted(dir(testclass)): + if "*" not in arg: arg += "*" + if arg.startswith("_"): arg = arg[1:] + if fnmatch(method, arg): + suite.addTest(testclass(method)) + # select runner + if not logfile: + if xmlresults: + import xmlrunner + Runner = xmlrunner.XMLTestRunner + Runner(xmlresults).run(suite) + else: + Runner = unittest.TextTestRunner + Runner(verbosity=opt.verbose).run(suite) + else: + Runner = unittest.TextTestRunner + if xmlresults: + import xmlrunner + Runner = xmlrunner.XMLTestRunner + Runner(logfile.stream, verbosity=opt.verbose).run(suite) diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-am-build.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-am-build.dockerfile new file mode 100644 index 00000000000..32f18526a67 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-am-build.dockerfile @@ -0,0 +1,26 @@ +FROM centos:7.7.1908 +ARG no_check=false +ARG no_install=false + +ARG _libdir=/usr/local/lib64 +ARG _docdir=/usr/share/doc + +RUN yum install -y epel-release +RUN yum install -y gcc zlib-devel python3 make unzip zip gzip tar + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY Makefile.am Makefile.in configure.ac configure config.h.in zziplib.spec src/ +COPY uses src/uses +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN mkdir src/build +RUN cd src/build && sh ../configure --libdir=$_libdir --with-docdir=$_docdir --disable-static +RUN cd src/build && make +RUN $no_check || (cd src/build && make check) +RUN $no_install || (cd src/build && make install) diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-am-docs.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-am-docs.dockerfile new file mode 100644 index 00000000000..ab4b39fc82d --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-am-docs.dockerfile @@ -0,0 +1,25 @@ +FROM centos:7.7.1908 +ARG no_build=false + +ARG _libdir=/usr/local/lib64 +ARG _docdir=/usr/share/doc + +RUN yum install -y epel-release +RUN yum install -y gcc zlib-devel python3 make unzip zip gzip tar + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY Makefile.am Makefile.in configure.ac configure config.h.in zziplib.spec src/ +COPY uses src/uses +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN mkdir src/build +RUN cd src/build && sh ../configure --libdir=$_libdir --with-docdir=$_docdir --disable-static +RUN $no_build || (cd src/build && make) +RUN cd src/build && make docs +RUN cd src/build && make install-docs install-mans diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-am-sdl2.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-am-sdl2.dockerfile new file mode 100644 index 00000000000..240da3f546f --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-am-sdl2.dockerfile @@ -0,0 +1,26 @@ +FROM centos:7.7.1908 +ARG no_check=false +ARG no_install=false + +ARG _libdir=/usr/local/lib64 +ARG _docdir=/usr/share/doc + +RUN yum install -y epel-release +RUN yum install -y gcc zlib-devel python3 make unzip zip gzip tar SDL2-devel + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY Makefile.am Makefile.in configure.ac configure config.h.in zziplib.spec src/ +COPY uses src/uses +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN mkdir src/build +RUN cd src/build && sh ../configure --libdir=$_libdir --with-docdir=$_docdir --disable-static --enable-sdl +RUN cd src/build && make +RUN $no_check || (cd src/build && make check) +RUN $no_install || (cd src/build && make install) diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-build.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-build.dockerfile new file mode 100644 index 00000000000..4509b68d9ff --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-build.dockerfile @@ -0,0 +1,22 @@ +FROM centos:7.7.1908 +ARG no_check=false +ARG no_install=false + +RUN yum install -y epel-release +RUN yum install -y gcc zlib-devel python3 cmake3 make unzip zip gzip tar + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY CMakeScripts src/CMakeScripts +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +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) diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-destdir-sdl2.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-destdir-sdl2.dockerfile new file mode 100644 index 00000000000..722b2c075d8 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-destdir-sdl2.dockerfile @@ -0,0 +1,22 @@ +FROM centos:7.7.1908 +ARG no_check=false +ARG no_install=false + +RUN yum install -y epel-release +RUN yum install -y gcc zlib-devel python3 cmake3 make unzip zip gzip tar SDL2-devel + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY CMakeScripts src/CMakeScripts +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +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 DESTDIR=/new) diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-docs.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-docs.dockerfile new file mode 100644 index 00000000000..2d8c9926409 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-docs.dockerfile @@ -0,0 +1,21 @@ +FROM centos:7.7.1908 +ARG no_build=false + +RUN yum install -y epel-release +RUN yum install -y gcc zlib-devel python3 cmake3 make unzip zip gzip tar + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY CMakeScripts src/CMakeScripts +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN mkdir src/build +RUN cd src/build && cmake3 .. +RUN $no_build || (cd src/build && make) +RUN cd src/build && make docs VERBOSE=1 +RUN cd src/build && make install-docs VERBOSE=1 diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-sdl2.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-sdl2.dockerfile new file mode 100644 index 00000000000..cad66acf798 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos7-sdl2.dockerfile @@ -0,0 +1,22 @@ +FROM centos:7.7.1908 +ARG no_check=false +ARG no_install=false + +RUN yum install -y epel-release +RUN yum install -y gcc zlib-devel python3 cmake3 make unzip zip gzip tar SDL2-devel + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY CMakeScripts src/CMakeScripts +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +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) diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-am-build.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-am-build.dockerfile new file mode 100644 index 00000000000..e9dbe4e5dc2 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-am-build.dockerfile @@ -0,0 +1,26 @@ +FROM centos:8.1.1911 +ARG no_check=false +ARG no_install=false + +ARG _libdir=/usr/local/lib64 +ARG _docdir=/usr/share/doc + +RUN yum install -y gcc zlib-devel python3 cmake make unzip zip gzip tar diffutils + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY Makefile.am Makefile.in configure.ac configure config.h.in zziplib.spec src/ +COPY uses src/uses +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN mkdir src/build +RUN cd src/build && sh ../configure --libdir=$_libdir --with-docdir=$_docdir --disable-static +RUN cd src/build && make +RUN $no_check || (cd src/build && make check) +RUN $no_install || (cd src/build && make install) + diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-am-sdl2.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-am-sdl2.dockerfile new file mode 100644 index 00000000000..bfcb16f2f5e --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-am-sdl2.dockerfile @@ -0,0 +1,31 @@ +FROM centos:8.1.1911 +ARG no_check=false +ARG no_install=false + +ARG _libdir=/usr/local/lib64 +ARG _docdir=/usr/share/doc + +RUN yum install -y yum-utils +RUN yum-config-manager --set-enabled PowerTools +RUN ls -l /etc/yum.repos.d +RUN cat /etc/yum.repos.d/CentOS-PowerTools.repo +RUN yum search sdl +RUN yum install -y gcc zlib-devel python3 cmake make unzip zip gzip tar diffutils SDL2-devel + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY Makefile.am Makefile.in configure.ac configure config.h.in zziplib.spec src/ +COPY uses src/uses +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN mkdir src/build +RUN cd src/build && sh ../configure --libdir=$_libdir --with-docdir=$_docdir --disable-static --enable-sdl +RUN cd src/build && make +RUN $no_check || (cd src/build && make check) +RUN $no_install || (cd src/build && make install) + diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-build.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-build.dockerfile new file mode 100644 index 00000000000..7679491571e --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-build.dockerfile @@ -0,0 +1,22 @@ +FROM centos:8.1.1911 +ARG no_check=false +ARG no_install=false + +RUN yum install -y gcc zlib-devel python3 cmake make unzip zip gzip tar diffutils + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY CMakeScripts src/CMakeScripts +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN mkdir src/build +RUN cd src/build && cmake .. +RUN cd src/build && make +RUN $no_check || (cd src/build && make check) +RUN $no_install || (cd src/build && make install) + diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-destdir-sdl2.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-destdir-sdl2.dockerfile new file mode 100644 index 00000000000..b472beb7fa4 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-destdir-sdl2.dockerfile @@ -0,0 +1,26 @@ +FROM centos:8.1.1911 +ARG no_check=false +ARG no_install=false + +RUN yum install -y yum-utils +RUN yum-config-manager --set-enabled PowerTools +RUN ls -l /etc/yum.repos.d +RUN cat /etc/yum.repos.d/CentOS-PowerTools.repo +RUN yum search sdl +RUN yum install -y gcc zlib-devel python3 cmake make unzip zip gzip tar diffutils SDL2-devel + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY CMakeScripts src/CMakeScripts +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN mkdir src/build +RUN cd src/build && cmake .. +RUN cd src/build && make +RUN $no_check || (cd src/build && make check) +RUN $no_install || (cd src/build && make install DESTDIR=/new) diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-sdl2.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-sdl2.dockerfile new file mode 100644 index 00000000000..af35fb9a95a --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/centos8-sdl2.dockerfile @@ -0,0 +1,26 @@ +FROM centos:8.1.1911 +ARG no_check=false +ARG no_install=false + +RUN yum install -y yum-utils +RUN yum-config-manager --set-enabled PowerTools +RUN ls -l /etc/yum.repos.d +RUN cat /etc/yum.repos.d/CentOS-PowerTools.repo +RUN yum search sdl +RUN yum install -y gcc zlib-devel python3 cmake make unzip zip gzip tar diffutils SDL2-devel + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY CMakeScripts src/CMakeScripts +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN mkdir src/build +RUN cd src/build && cmake .. +RUN cd src/build && make +RUN $no_check || (cd src/build && make check) +RUN $no_install || (cd src/build && make install) diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/opensuse15-build.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/opensuse15-build.dockerfile new file mode 100644 index 00000000000..b118a0edba7 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/opensuse15-build.dockerfile @@ -0,0 +1,22 @@ +FROM opensuse/leap:15.1 +ARG no_check=false +ARG no_install=false + +RUN zypper refresh repo-oss +RUN zypper install -r repo-oss -y gcc zlib-devel python3 cmake unzip zip gzip tar + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY CMakeScripts src/CMakeScripts +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN mkdir src/build +RUN cd src/build && cmake .. +RUN cd src/build && make +RUN $no_check || (cd src/build && make check) +RUN $no_install || (cd src/build && make install) diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/opensuse15-sdl2.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/opensuse15-sdl2.dockerfile new file mode 100644 index 00000000000..8da9cfdae73 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/opensuse15-sdl2.dockerfile @@ -0,0 +1,24 @@ +FROM opensuse/leap:15.1 +ARG no_check=false +ARG no_install=false +# -DMAKE_INSTALL_PREFIX:PATH=/usr + +RUN zypper refresh repo-oss +RUN zypper install -r repo-oss -y gcc zlib-devel python3 cmake unzip zip gzip tar libSDL2-devel + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY CMakeScripts src/CMakeScripts +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN mkdir src/build +RUN cd src/build && cmake .. +RUN cd src/build && make +RUN $no_check || (cd src/build && make check VERBOSE=1) +RUN $no_install || (cd src/build && make install) + diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu16-32bit.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu16-32bit.dockerfile new file mode 100644 index 00000000000..60fc669ef28 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu16-32bit.dockerfile @@ -0,0 +1,23 @@ +FROM 32bit/ubuntu:16.04 +ARG no_check=false +ARG no_install=false + +RUN apt-get update +RUN apt-get install -y gcc zlib1g-dev python3 cmake unzip zip gzip tar pkg-config + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY CMakeScripts src/CMakeScripts +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN mkdir src/build +RUN cd src/build && cmake .. +RUN cd src/build && make +RUN $no_check || (cd src/build && make check) +RUN $no_install || (cd src/build && make install) + diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu16-azure.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu16-azure.dockerfile new file mode 100644 index 00000000000..9f92be60415 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu16-azure.dockerfile @@ -0,0 +1,28 @@ +FROM ubuntu:16.04 +ARG no_check=false +ARG no_install=false + +RUN apt-get update +RUN apt-get install -y gcc zlib1g-dev python3 cmake zip gzip tar pkg-config +RUN apt-get install -y unzip +# RUN apt-get install -y libsdl2-dev +RUN apt-get install -y --fix-broken --ignore-missing python3-wheel || true +RUN apt-get install -y --fix-broken --ignore-missing python3-pip || true +RUN pip3 install unittest-xml-reporting + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY CMakeScripts src/CMakeScripts +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN mkdir src/build +RUN cd src/build && cmake .. -DTESTFLAGS=--xmlresults=zziptests.tmp +RUN cd src/build && make all +RUN $no_check || (cd src/build && make check VERBOSE=1) || true +RUN $no_install || (cd src/build && make install) + diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu16-build.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu16-build.dockerfile new file mode 100644 index 00000000000..a5b337c0713 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu16-build.dockerfile @@ -0,0 +1,23 @@ +FROM ubuntu:16.04 +ARG no_check=false +ARG no_install=false + +RUN apt-get update +RUN apt-get install -y gcc zlib1g-dev python3 cmake unzip zip gzip tar pkg-config + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY CMakeScripts src/CMakeScripts +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN mkdir src/build +RUN cd src/build && cmake .. +RUN cd src/build && make +RUN $no_check || (cd src/build && make check) +RUN $no_install || (cd src/build && make install) + diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu16-sdl2.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu16-sdl2.dockerfile new file mode 100644 index 00000000000..48d2fc7f7c1 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu16-sdl2.dockerfile @@ -0,0 +1,24 @@ +FROM ubuntu:16.04 +ARG no_check=false +ARG no_install=false + +RUN apt-get update +RUN apt-get install -y gcc zlib1g-dev python3 cmake unzip zip gzip tar pkg-config libsdl2-dev +## libsdl2-dev is on "universe" + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY CMakeScripts src/CMakeScripts +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN mkdir src/build +RUN cd src/build && cmake .. +RUN cd src/build && make +RUN $no_check || (cd src/build && make check) +RUN $no_install || (cd src/build && make install) + diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu18-build.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu18-build.dockerfile new file mode 100644 index 00000000000..257886c6cda --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/ubuntu18-build.dockerfile @@ -0,0 +1,23 @@ +FROM ubuntu:18.04 +ARG no_check=false +ARG no_install=false + +RUN apt-get update +RUN apt-get install -y gcc zlib1g-dev python3 cmake unzip zip gzip tar pkg-config + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY CMakeScripts src/CMakeScripts +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN mkdir src/build +RUN cd src/build && cmake .. +RUN cd src/build && make +RUN $no_check || (cd src/build && make check) +RUN $no_install || (cd src/build && make install) + diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/windows-shared-x64.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/windows-shared-x64.dockerfile new file mode 100644 index 00000000000..8689b5db1b5 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/windows-shared-x64.dockerfile @@ -0,0 +1,29 @@ +FROM dockcross/windows-shared-x64:latest +ARG no_check=false +ARG no_install=false + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY CMakeScripts src/CMakeScripts +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN { echo "[requires]" \ + ; echo "zlib/1.2.11" \ + ; echo "" \ + ; echo "[generators]" \ + ; echo "cmake_paths" \ + ; } > src/conanfile.txt + +RUN mkdir src/build +RUN cd src/build && conan install .. +RUN cd src/build && cmake .. -DCMAKE_TOOLCHAIN_FILE=./conan_paths.cmake -DBUILD_STATIC_LIBS=OFF -DCMAKE_SYSTEM_NAME=Windows +RUN cd src/build && cmake --build . +# RUN $no_check || (cd src/build && make check) +# RUN $no_install || (cd src/build && make install) +RUN cd src/build && cmake --build . --target install + diff --git a/Build/source/libs/zziplib/zziplib-src/testbuilds/windows-static-x64.dockerfile b/Build/source/libs/zziplib/zziplib-src/testbuilds/windows-static-x64.dockerfile new file mode 100644 index 00000000000..183e853c8ef --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/testbuilds/windows-static-x64.dockerfile @@ -0,0 +1,29 @@ +FROM dockcross/windows-static-x64:latest +ARG no_check=false +ARG no_install=false + +RUN mkdir src +COPY CMakeLists.txt README COPYING.LIB ChangeLog src/ +COPY CMakeScripts src/CMakeScripts +COPY bins src/bins +COPY docs src/docs +COPY test src/test +COPY SDL src/SDL +COPY zzipwrap src/zzipwrap +COPY zzip src/zzip + +RUN { echo "[requires]" \ + ; echo "zlib/1.2.11" \ + ; echo "" \ + ; echo "[generators]" \ + ; echo "cmake_paths" \ + ; } > src/conanfile.txt + +RUN mkdir src/build +RUN cd src/build && conan install .. +RUN cd src/build && cmake .. -DCMAKE_TOOLCHAIN_FILE=./conan_paths.cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_SYSTEM_NAME=Windows +RUN cd src/build && cmake --build . +# RUN $no_check || (cd src/build && make check) +# RUN $no_install || (cd src/build && make install) +RUN cd src/build && cmake --build . --target install + diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/CMakeLists.txt b/Build/source/libs/zziplib/zziplib-src/zzip/CMakeLists.txt new file mode 100644 index 00000000000..a9f6e3ae2fc --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/zzip/CMakeLists.txt @@ -0,0 +1,343 @@ +cmake_minimum_required (VERSION 3.1) +project(zzip VERSION "0.13.71" LANGUAGES C) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeScripts") + +# generate _config.h +include ( CheckIncludeFiles ) +include ( CheckFunctionExists ) +include ( CheckSymbolExists ) +include ( CheckTypeSize ) +include ( TestBigEndian ) +include ( GNUInstallDirs ) +include ( JoinPaths ) + +# options ########################################################### +option(BUILD_SHARED_LIBS "Build a shared library" ON) +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) + +# 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) +find_package ( UnixCommands REQUIRED ) # bash cp mv rm gzip tar +endif() + +check_include_files ( byteswap.h ZZIP_HAVE_BYTESWAP_H ) +check_include_files ( direct.h ZZIP_HAVE_DIRECT_H ) + +if(NOT ANDROID) + check_include_files ( dirent.h ZZIP_HAVE_DIRENT_H ) +endif() + +check_include_files ( dlfcn.h ZZIP_HAVE_DLFCN_H ) +check_include_files ( fnmatch.h ZZIP_HAVE_FNMATCH_H ) +check_include_files ( inttypes.h ZZIP_HAVE_INTTYPES_H ) +check_include_files ( io.h ZZIP_HAVE_IO_H ) +check_include_files ( memory.h ZZIP_HAVE_MEMORY_H ) +check_include_files ( ndir.h ZZIP_HAVE_NDIR_H ) +check_include_files ( stdint.h ZZIP_HAVE_STDINT_H ) +check_include_files ( stdlib.h ZZIP_HAVE_STDLIB_H ) +check_function_exists ( strcasecmp ZZIP_HAVE_STRCASECMP ) +check_include_files ( strings.h ZZIP_HAVE_STRINGS_H ) +check_include_files ( string.h ZZIP_HAVE_STRING_H ) +check_function_exists ( strndup ZZIP_HAVE_STRNDUP ) +check_include_files ( "sys/dir.h" ZZIP_HAVE_SYS_DIR_H ) +check_include_files ( "sys/int_types.h" ZZIP_HAVE_SYS_INT_TYPES_H ) +check_include_files ( "sys/mman.h" ZZIP_HAVE_SYS_MMAN_H ) +check_include_files ( "sys/ndir.h" ZZIP_HAVE_SYS_NDIR_H ) +check_include_files ( "sys/param.h" ZZIP_HAVE_SYS_PARAM_H ) +check_include_files ( "sys/stat.h" ZZIP_HAVE_SYS_STAT_H ) +check_include_files ( "sys/types.h" ZZIP_HAVE_SYS_TYPES_H ) +check_include_files ( unistd.h ZZIP_HAVE_UNISTD_H ) +check_include_files ( winbase.h ZZIP_HAVE_WINBASE_H ) +check_include_files ( windows.h ZZIP_HAVE_WINDOWS_H ) +check_include_files ( winnt.h ZZIP_HAVE_WINNT_H ) +set ( ZZIP_HAVE_ZLIB_H 1 ) + +check_type_size ( int ZZIP_SIZEOF_INT ) +check_type_size ( long ZZIP_SIZEOF_LONG ) +check_type_size ( short ZZIP_SIZEOF_SHORT ) +check_include_files ( "stdlib.h;stdarg.h;string.h;float.h" ZZIP_STDC_HEADERS ) +test_big_endian ( ZZIP_WORDS_BIGENDIAN ) + +# simplified largefile support detection for unix +set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE_SOURCE -Doff_t_32=off_t) +check_type_size( off_t_32 ZZIP_SIZEOF_OFF_T_32 ) +set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE_SOURCE -Doff_t_64=off_t -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES) +check_type_size( off_t_64 ZZIP_SIZEOF_OFF_T_64 ) +set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE) +check_type_size( off64_t ZZIP_SIZEOF_OFF64_T ) + +if(ZZIP_SIZEOF_OFF_T_32) + message(STATUS "found sizeof(off_t/32)=${ZZIP_SIZEOF_OFF_T_32} and sizeof(off_t/64)=${ZZIP_SIZEOF_OFF_T_64}") + if(NOT ZZIP_SIZEOF_OFF_T_32 EQUAL ZZIP_SIZEOF_OFF_T_64) + set(ZZIP_LARGEFILE_SENSITIVE 1) + # this will turn into ZZIP_LARGEFILE_RENAME so that zzip_opendir becomes zzip_opendir64 in the lib + # which is needed on Linux/Solaris where the default zzip_opendir is expected to use a 32bit off_t + message(STATUS "system is large file sensitive - do rename symbols to xx64") + set(largefiles -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES) + endif() +endif() + +configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/_config.h ) + +# Zlib library needed +find_package ( ZLIB REQUIRED ) + +if(UNIX) + add_definitions( + -Wpointer-arith + -Wsign-compare + -Wmissing-declarations + # -Wdeclaration-after-statement + -Werror-implicit-function-declaration + -Wstrict-aliasing + -Warray-bounds + ) +endif() + +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +add_definitions ( -DHAVE_CONFIG_H ) + +set(RELNUM "${PROJECT_VERSION_MAJOR}") +set(VERNUM "${PROJECT_VERSION_MINOR}") +set(FIXNUM "0.${PROJECT_VERSION_PATCH}") +# the "0." on FIXNUM is just for compatibility with automake's libtool. + +set(srcdir ${CMAKE_CURRENT_SOURCE_DIR}) +set(outdir ${CMAKE_CURRENT_BINARY_DIR}) + +# targets ############################################################ + +# libzlib library +set(libzzip_SRCS + dir.c + err.c + file.c + info.c + plugin.c + stat.c + write.c + zip.c + fetch.c) + +set(libzzip_HDRS + lib.h + zzip.h + format.h + types.h + conf.h + _msvc.h + file.h + info.h + plugin.h + write.h + fetch.h + stdint.h + zzip32.h + autoconf.h + ${outdir}/_config.h) + +set(libzzip_INCS + __debug.h + __dirent.h + __errno.h + __fnmatch.h + __hints.h + __mkdir.h + __mmap.h + __string.h) + +set(libzzipfseeko_SRCS fseeko.c fetch.c) +set(libzzipfseeko_HDRS fseeko.h) + +set(libzzipmmapped_SRCS mmapped.c memdisk.c fetch.c) +set(libzzipmmapped_HDRS mmapped.h memdisk.h) + + +add_library(libzzip ${libzzip_SRCS} ) +target_link_libraries(libzzip ZLIB::ZLIB ) +target_include_directories (libzzip PRIVATE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) + +if(ZZIPFSEEKO) +add_library(libzzipfseeko ${libzzipfseeko_SRCS} ) +target_link_libraries(libzzipfseeko ZLIB::ZLIB ) +target_include_directories (libzzipfseeko PRIVATE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) +endif() + +if(ZZIPMMAPPED) +add_library(libzzipmmapped ${libzzipmmapped_SRCS} ) +target_link_libraries(libzzipmmapped ZLIB::ZLIB ) +target_include_directories (libzzipmmapped PRIVATE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) +endif() + +set_target_properties(libzzip PROPERTIES OUTPUT_NAME "zzip" RELEASE_POSTFIX "-${RELNUM}") +SET_TARGET_PROPERTIES(libzzip PROPERTIES VERSION ${VERNUM}.${FIXNUM} SOVERSION ${VERNUM}) + +if(ZZIPFSEEKO) +set_target_properties(libzzipfseeko PROPERTIES OUTPUT_NAME "zzipfseeko" RELEASE_POSTFIX "-${RELNUM}") +SET_TARGET_PROPERTIES(libzzipfseeko PROPERTIES VERSION ${VERNUM}.${FIXNUM} SOVERSION ${VERNUM}) +endif() + +if(ZZIPMMAPPED) +set_target_properties(libzzipmmapped PROPERTIES OUTPUT_NAME "zzipmmapped" RELEASE_POSTFIX "-${RELNUM}") +SET_TARGET_PROPERTIES(libzzipmmapped PROPERTIES VERSION ${VERNUM}.${FIXNUM} SOVERSION ${VERNUM}) +endif() + +if(ZZIPCOMPAT) +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" + COMMAND ${BASH} -c "echo '#define ZZIP_WARNING 1' >>compat/zzip.h" + COMMAND ${BASH} -c "echo '#ifdef __GNUC__' >>compat/zzip.h" + COMMAND ${BASH} -c "echo '#warning do no not use , update to include ' >>compat/zzip.h" + COMMAND ${BASH} -c "echo '#else' >>compat/zzip.h" + COMMAND ${BASH} -c "echo '#error do no not use , update to include ' >>compat/zzip.h" + COMMAND ${BASH} -c "echo '#endif' >>compat/zzip.h" + COMMAND ${BASH} -c "echo '#endif' >>compat/zzip.h" + COMMAND ${BASH} -c "echo '#include \"zzip/lib.h\"' >>compat/zzip.h" + COMMAND ${BASH} -c "sed -e 's|zzip.h|zziplib.h|' -e 's|zzip/lib.h|zzip/zzip.h|' \ + compat/zzip.h >compat/zziplib.h" + COMMAND ${BASH} -c "sed -e 's|zzip.h|zzip-io.h|' -e 's|zzip/lib.h|zzip/plugin.h|' \ + compat/zzip.h >compat/zzip-io.h" + BYPRODUCTS compat/zziplib.h compat/zzip-io.h + VERBATIM) +add_custom_target(compat ALL DEPENDS compat/zzip.h) +endif() + +if(UNIX) +join_paths(libdir "\${prefix}" "${CMAKE_INSTALL_LIBDIR}") +join_paths(includedir "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}") +add_custom_command(OUTPUT zziplib.pc + COMMAND ${BASH} -c "echo 'prefix=${CMAKE_INSTALL_PREFIX}' > zziplib.pc" + COMMAND ${BASH} -c "echo 'libdir=${libdir}' >> zziplib.pc" + COMMAND ${BASH} -c "echo 'includedir=${includedir}' >> zziplib.pc" + COMMAND ${BASH} -c "echo 'package=zziplib' >> zziplib.pc" + COMMAND ${BASH} -c "echo 'suffix=${CMAKE_EXECUTABLE_SUFFIX}' >> zziplib.pc" + COMMAND ${BASH} -c "echo '' >> zziplib.pc" + COMMAND ${BASH} -c "echo 'Name: ${PROJECT_NAME}lib' >> zziplib.pc" + COMMAND ${BASH} -c "echo 'Description: ZZipLib - libZ-based ZIP-access Library with an Easy-to-Use API' >> zziplib.pc" + COMMAND ${BASH} -c "echo 'Version: ${PROJECT_VERSION}' >> zziplib.pc" + COMMAND ${BASH} -c "echo 'Requires: zlib' >> zziplib.pc" + COMMAND ${BASH} -c "echo 'Libs: -L\${libdir} -lzzip' >> zziplib.pc" + COMMAND ${BASH} -c "echo 'Cflags: -I\${includedir}' >> zziplib.pc" + COMMAND ${BASH} -c "sed -e 's/-lzzip/-lzzipmmapped/' -e 's/zziplib/zzipmmapped/' zziplib.pc > zzipmmapped.pc" + COMMAND ${BASH} -c "sed -e 's/-lzzip/-lzzipfseeko/' -e 's/zziplib/zzipfseeko/' zziplib.pc > zzipfseeko.pc" + BYPRODUCTS zzipmmapped.pc zzipfseeko.pc + VERBATIM) +add_custom_target(pkgconfig ALL DEPENDS zziplib.pc) +endif() + +# install ######################################################## +set(outdir ${CMAKE_CURRENT_BINARY_DIR}) + +if(UNIX) +install(FILES ${outdir}/zziplib.pc ${outdir}/zzipmmapped.pc ${outdir}/zzipfseeko.pc + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" ) +endif() + +install(FILES ${libzzip_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/zzip ) +install(TARGETS libzzip + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +if(ZZIPFSEEKO) +install(FILES ${libzzipfseeko_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/zzip ) +install(TARGETS libzzipfseeko + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +endif() + +if(ZZIPMMAPPED) +install(FILES ${libzzipmmapped_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/zzip ) +install(TARGETS libzzipmmapped + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +endif() + +if(ZZIPCOMPAT) + 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) + set(lib ${CMAKE_SHARED_LIBRARY_PREFIX}) + set(dll ${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(libdir ${CMAKE_INSTALL_FULL_LIBDIR}) + get_target_property(libname libzzip OUTPUT_NAME) + get_target_property(librelease libzzip RELEASE_POSTFIX) + get_target_property(libversion libzzip VERSION) + install(CODE "execute_process(COMMAND bash -c \"set -e + cd $DESTDIR/${libdir} + [ -f ${lib}${libname}${librelease}${dll}.${libversion} ] || exit 0 + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${librelease}${dll} + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${librelease}${dll}.10 + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${librelease}${dll}.11 + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${librelease}${dll}.12 + \")") + endif() +endif() + +if(ZZIPLIBTOOL) + if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG) + set(lib ${CMAKE_SHARED_LIBRARY_PREFIX}) + set(dll ${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(libdir ${CMAKE_INSTALL_FULL_LIBDIR}) + get_target_property(libname libzzip OUTPUT_NAME) + get_target_property(librelease libzzip RELEASE_POSTFIX) + get_target_property(libversion libzzip VERSION) + install(CODE "execute_process(COMMAND bash -c \"set -e + cd $DESTDIR/${libdir} + [ -f ${lib}${libname}${librelease}${dll}.${libversion} ] || exit 0 + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${dll} + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${librelease}${dll}.10 + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${librelease}${dll}.11 + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${librelease}${dll}.12 + \")") + get_target_property(libname libzzipfseeko OUTPUT_NAME) + get_target_property(librelease libzzipfseeko RELEASE_POSTFIX) + get_target_property(libversion libzzipfseeko VERSION) + install(CODE "execute_process(COMMAND bash -c \"set -e + cd $DESTDIR/${libdir} + [ -f ${lib}${libname}${librelease}${dll}.${libversion} ] || exit 0 + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${dll} + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${librelease}${dll}.10 + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${librelease}${dll}.11 + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${librelease}${dll}.12 + \")") + get_target_property(libname libzzipmmapped OUTPUT_NAME) + get_target_property(librelease libzzipmmapped RELEASE_POSTFIX) + get_target_property(libversion libzzipmmapped VERSION) + install(CODE "execute_process(COMMAND bash -c \"set -e + cd $DESTDIR/${libdir} + [ -f ${lib}${libname}${librelease}${dll}.${libversion} ] || exit 0 + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${dll} + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${librelease}${dll}.10 + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${librelease}${dll}.11 + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${librelease}${dll}.12 + \")") + endif() +endif() diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/Makefile.am b/Build/source/libs/zziplib/zziplib-src/zzip/Makefile.am index 5f333fbea61..0d7ed34678f 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/Makefile.am +++ b/Build/source/libs/zziplib/zziplib-src/zzip/Makefile.am @@ -66,6 +66,7 @@ EXTRA_DIST = $(WCC10_DIST) _msvc.sed CONFIG_CLEAN_FILES = _config.h MAINTAINERCLEANFILES = _msvc.h CLEANFILES = $(WCC10_CLEAN) *.pc *.omf *~ *.tmp *.tmp.* +DISTCLEANFILES = *-uninstalled.sh _msvc.in zziplib.pc.in # here is some backward compatibility with version 0.10.* of zziplib install-data-hook : install-zzipHEADERS diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/Makefile.in b/Build/source/libs/zziplib/zziplib-src/zzip/Makefile.in index 1861ffecc70..9e199a12776 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/Makefile.in +++ b/Build/source/libs/zziplib/zziplib-src/zzip/Makefile.in @@ -102,9 +102,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_compile_check_sizeof.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_aligned_access_required.m4 \ $(top_srcdir)/m4/ax_check_enable_debug.m4 \ - $(top_srcdir)/m4/ax_configure_args.m4 \ $(top_srcdir)/m4/ax_create_pkgconfig_info.m4 \ - $(top_srcdir)/m4/ax_enable_builddir.m4 \ $(top_srcdir)/m4/ax_expand_prefix.m4 \ $(top_srcdir)/m4/ax_maintainer_mode_auto_silent.m4 \ $(top_srcdir)/m4/ax_not_enable_frame_pointer.m4 \ @@ -320,6 +318,8 @@ PAX_TAR_CREATE = @PAX_TAR_CREATE@ PAX_TAR_EXTRACT = @PAX_TAR_EXTRACT@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RELEASE_INFO = @RELEASE_INFO@ @@ -354,7 +354,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -467,6 +466,7 @@ EXTRA_DIST = $(WCC10_DIST) _msvc.sed CONFIG_CLEAN_FILES = _config.h MAINTAINERCLEANFILES = _msvc.h CLEANFILES = $(WCC10_CLEAN) *.pc *.omf *~ *.tmp *.tmp.* +DISTCLEANFILES = *-uninstalled.sh _msvc.in zziplib.pc.in INDENT = indent INDENTFLAGS = \ --blank-lines-after-procedures \ @@ -789,6 +789,7 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/__string.h b/Build/source/libs/zziplib/zziplib-src/zzip/__string.h index cd567142fc5..e62fb06564c 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/__string.h +++ b/Build/source/libs/zziplib/zziplib-src/zzip/__string.h @@ -19,11 +19,11 @@ #include /* if your system does not have strnlen: */ -zzip__new__ static size_t +static size_t _zzip_strnlen(const char *p, size_t maxlen) { const char * stop = (char *)memchr(p, '\0', maxlen); - return stop ? stop - p : maxlen; + return stop ? (size_t)(stop - p) : maxlen; } #endif @@ -31,6 +31,7 @@ _zzip_strnlen(const char *p, size_t maxlen) #if defined ZZIP_HAVE_STRNDUP || defined strndup #define _zzip_strndup strndup #else +#include /* if your system does not have strndup: */ zzip__new__ static char * @@ -42,7 +43,7 @@ _zzip_strndup(char const *p, size_t maxlen) } else { size_t len = _zzip_strnlen(p, maxlen); - char* r = malloc(len + 1); + char* r = (char *)malloc(len + 1); if (r == NULL) return NULL; /* errno = ENOMEM */ r[len] = '\0'; diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/_config.h.cmake b/Build/source/libs/zziplib/zziplib-src/zzip/_config.h.cmake new file mode 100644 index 00000000000..b48b39ac98b --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/zzip/_config.h.cmake @@ -0,0 +1,165 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if pointers to integers require aligned access */ +#cmakedefine ZZIP_HAVE_ALIGNED_ACCESS_REQUIRED ${ZZIP_HAVE_ALIGNED_ACCESS_REQUIRED} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_BYTESWAP_H ${ZZIP_HAVE_BYTESWAP_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_DIRECT_H ${ZZIP_HAVE_DIRECT_H} + +/* Define to 1 if you have the header file, and it defines `DIR'.*/ +#cmakedefine ZZIP_HAVE_DIRENT_H ${ZZIP_HAVE_DIRENT_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_DLFCN_H ${ZZIP_HAVE_DLFCN_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_FNMATCH_H ${ZZIP_HAVE_FNMATCH_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_INTTYPES_H ${ZZIP_HAVE_INTTYPES_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_IO_H ${ZZIP_HAVE_IO_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_MEMORY_H ${ZZIP_HAVE_MEMORY_H} + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#cmakedefine ZZIP_HAVE_NDIR_H ${ZZIP_HAVE_NDIR_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_STDINT_H ${ZZIP_HAVE_STDINT_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_STDLIB_H ${ZZIP_HAVE_STDLIB_H} + +/* Define to 1 if you have the `strcasecmp' function. */ +#cmakedefine ZZIP_HAVE_STRCASECMP ${ZZIP_HAVE_STRCASECMP} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_STRINGS_H ${ZZIP_HAVE_STRINGS_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_STRING_H ${ZZIP_HAVE_STRING_H} + +/* Define to 1 if you have the `strndup' function. */ +#cmakedefine ZZIP_HAVE_STRNDUP ${ZZIP_HAVE_STRNDUP} + +/* Define to 1 if you have the header file, and it defines `DIR'.*/ +#cmakedefine ZZIP_HAVE_SYS_DIR_H ${ZZIP_HAVE_SYS_DIR_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_SYS_INT_TYPES_H ${ZZIP_HAVE_SYS_INT_TYPES_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_SYS_MMAN_H ${ZZIP_HAVE_SYS_MMAN_H} + +/* Define to 1 if you have the header file, and it defines `DIR'.*/ +#cmakedefine ZZIP_HAVE_SYS_NDIR_H ${ZZIP_HAVE_SYS_NDIR_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_SYS_PARAM_H ${ZZIP_HAVE_SYS_PARAM_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_SYS_STAT_H ${ZZIP_HAVE_SYS_STAT_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_SYS_TYPES_H ${ZZIP_HAVE_SYS_TYPES_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_UNISTD_H ${ZZIP_HAVE_UNISTD_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_WINBASE_H ${ZZIP_HAVE_WINBASE_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_WINDOWS_H ${ZZIP_HAVE_WINDOWS_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_WINNT_H ${ZZIP_HAVE_WINNT_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine ZZIP_HAVE_ZLIB_H ${ZZIP_HAVE_ZLIB_H} + +/* whether the system defaults to 32bit off_t but can do 64bit when requested */ +#cmakedefine ZZIP_LARGEFILE_SENSITIVE ${ZZIP_LARGEFILE_SENSITIVE} + +/* Name of package */ +#cmakedefine ZZIP_PACKAGE "${ZZIP_PACKAGE}" + +/* Define to the address where bug reports for this package should be sent. */ +#cmakedefine ZZIP_PACKAGE_BUGREPORT "${ZZIP_PACKAGE_BUGREPORT}" + +/* Define to the full name of this package. */ +#cmakedefine ZZIP_PACKAGE_NAME "${ZZIP_PACKAGE_NAME}" + +/* Define to the full name and version of this package. */ +#cmakedefine ZZIP_PACKAGE_STRING "${ZZIP_PACKAGE_STRING}" + +/* Define to the one symbol short name of this package. */ +#cmakedefine ZZIP_PACKAGE_TARNAME "${ZZIP_PACKAGE_TARNAME}" + +/* Define to the version of this package. */ +#cmakedefine ZZIP_PACKAGE_VERSION "${ZZIP_PACKAGE_VERSION}" + +/* The number of bytes in type int */ +#cmakedefine ZZIP_SIZEOF_INT ${ZZIP_SIZEOF_INT} + +/* The number of bytes in type long */ +#cmakedefine ZZIP_SIZEOF_LONG ${ZZIP_SIZEOF_LONG} + +/* The number of bytes in type short */ +#cmakedefine ZZIP_SIZEOF_SHORT ${ZZIP_SIZEOF_SHORT} + +/* Define to 1 if you have the ANSI C header files. */ +#cmakedefine ZZIP_STDC_HEADERS ${ZZIP_STDC_HEADERS} + +/* Version number of package */ +#cmakedefine ZZIP_VERSION ${ZZIP_VERSION} + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#cmakedefine ZZIP_WORDS_BIGENDIAN ${ZZIP_WORDS_BIGENDIAN} + +/* Number of bits in a file offset, on hosts where this is settable. */ +#cmakedefine _FILE_OFFSET_BITS ${_FILE_OFFSET_BITS} + +/* Define for large files, on AIX-style hosts. */ +#cmakedefine _LARGE_FILES ${_LARGE_FILES} + +/* Define to `long long' if does not define. */ +#cmakedefine __int64 ${__INT64} + +/* Define to empty if `const' does not conform to ANSI C. */ +#cmakedefine const ${const} + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#ifndef _zzip_inline +#define _zzip_inline __inline +#endif +#endif + + +/* Define to `_zzip_off_t' if does not define. */ +#define _zzip_off64_t _zzip_off_t + +/* Define to `long int' if does not define. */ +#cmakedefine _zzip_off_t ${OFF_T} + +/* Define to equivalent of C99 restrict keyword, or to nothing if this is not + supported. Do not define if restrict is supported directly. */ +#ifndef _zzip_restrict +#define _zzip_restrict +#endif + + +/* Define to `unsigned int' if does not define. */ +#cmakedefine _zzip_size_t ${SIZE_T} + +/* Define to `int' if does not define. */ +#cmakedefine _zzip_ssize_t ${SSIZE_T} diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/dir.c b/Build/source/libs/zziplib/zziplib-src/zzip/dir.c index 7ae95ddb5c3..439165c3a19 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/dir.c +++ b/Build/source/libs/zziplib/zziplib-src/zzip/dir.c @@ -19,6 +19,7 @@ #include #endif +#include #include #ifndef offsetof diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/file.c b/Build/source/libs/zziplib/zziplib-src/zzip/file.c index ae161a74f4f..d4a75425185 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/file.c +++ b/Build/source/libs/zziplib/zziplib-src/zzip/file.c @@ -18,6 +18,7 @@ #include #include +#include #include #if 0 diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/format.h b/Build/source/libs/zziplib/zziplib-src/zzip/format.h index e30c576b66b..99c74942acd 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/format.h +++ b/Build/source/libs/zziplib/zziplib-src/zzip/format.h @@ -71,7 +71,7 @@ struct zzip_file_header /* followed by filename (of variable size) */ /* followed by extra field (of variable size) */ } ZZIP_GNUC_PACKED; -#define zzip_file_header_headerlength (4+2+2+2+4+4+4+4+2+2) +#define zzip_file_header_headerlength (4U+2U+2U+2U+4U+4U+4U+4U+2U+2U) /* B. data descriptor * the data descriptor exists only if bit 3 of z_flags is set. It is byte aligned @@ -87,7 +87,7 @@ struct zzip_file_trailer zzip_byte_t z_csize[4]; /* compressed size */ zzip_byte_t z_usize[4]; /* uncompressed size */ } ZZIP_GNUC_PACKED; -#define zzip_file_trailer_headerlength (4+4+4+4) +#define zzip_file_trailer_headerlength (4U+4U+4U+4U) /* C. central directory structure: [file header] . . . end of central dir record @@ -121,7 +121,7 @@ struct zzip_disk_entry /* followed by extra field (of variable size) */ /* followed by file comment (of variable size) */ } ZZIP_GNUC_PACKED; -#define zzip_disk_entry_headerlength (4+2+2+2+2+4+4+4+4+2+2+2+2+2+4+4) +#define zzip_disk_entry_headerlength (4U+2U+2U+2U+2U+4U+4U+4U+4U+2U+2U+2U+2U+2U+4U+4U) struct zzip_root_dirent @@ -163,7 +163,7 @@ struct zzip_disk_trailer zzip_byte_t z_comment[2]; /* zipfile comment length */ /* followed by zipfile comment (of variable size) */ } ZZIP_GNUC_PACKED; -#define zzip_disk_trailer_headerlength (4+2+2+2+2+4+4+2) +#define zzip_disk_trailer_headerlength (4U+2U+2U+2U+2U+4U+4U+2U) /* extra field should be type + size + data + type + size + data ... */ struct zzip_extra_block @@ -171,7 +171,7 @@ struct zzip_extra_block zzip_byte_t z_datatype[2]; /* as input type - a mere is okay */ zzip_byte_t z_datasize[2]; /* being returned by xx_to_extras usually */ } ZZIP_GNUC_PACKED; -#define zzip_extra_block_headerlength (2+2) +#define zzip_extra_block_headerlength (2U+2U) /* Zip64 end of central dir record */ struct zzip_disk64_trailer @@ -191,7 +191,7 @@ struct zzip_disk64_trailer * the starting disk number */ /* followed by zip64 extensible data sector (of variable size) */ } ZZIP_GNUC_PACKED; -#define zzip_disk64_trailer_headerlength (4+8+2+2+4+4+8+8+8+8) +#define zzip_disk64_trailer_headerlength (4U+8U+2U+2U+4U+4U+8U+8U+8U+8U) /* z_flags */ #define ZZIP_IS_ENCRYPTED(p) ((*(zzip_byte_t*)p)&1) diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/fseeko.c b/Build/source/libs/zziplib/zziplib-src/zzip/fseeko.c index 33794927606..3b3145ea6d3 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/fseeko.c +++ b/Build/source/libs/zziplib/zziplib-src/zzip/fseeko.c @@ -76,7 +76,9 @@ /* we try to round all seeks to the pagesize - since we do not use * the sys/mmap interface we have to guess a good value here: */ -#define PAGESIZE 8192 +#ifndef PAGESIZE +# define PAGESIZE 8192 +#endif #ifdef DEBUG #define debug1(msg) do { fprintf(stderr, "DEBUG: %s : " msg "\n", __func__); } while(0) @@ -387,7 +389,7 @@ zzip_entry_findfirst(FILE * disk) errno = EFBIG; goto error2; } - if ((void*)(trailer + 1) > (buffer + mapsize)) + if ((p + sizeof(*trailer)) > (buffer + mapsize)) { debug1("disk64 trailer is not complete"); errno = EBADMSG; @@ -418,6 +420,7 @@ zzip_entry_findfirst(FILE * disk) if (zzip_disk_entry_check_magic(entry)) { free(buffer); + buffer = NULL; entry->headseek = root; entry->diskfile = disk; entry->disksize = disksize; @@ -448,7 +451,8 @@ zzip_entry_findfirst(FILE * disk) } errno = ENOENT; /* not found */ error2: - free(buffer); + if (buffer != NULL) + free(buffer); error1: free(entry); ____; @@ -712,7 +716,7 @@ zzip_entry_fopen(ZZIP_ENTRY * entry, int takeover) file->zlib.zalloc = Z_NULL; file->zlib.zfree = Z_NULL; - ___ zzip_off_t size = file->avail; + ___ zzip_size_t size = file->avail; if (size > sizeof(file->buffer)) size = sizeof(file->buffer); if (fseeko(file->entry->diskfile, file->data + file->dataoff, SEEK_SET) == -1) diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/info.c b/Build/source/libs/zziplib/zziplib-src/zzip/info.c index 24825762775..4b7e941b8e7 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/info.c +++ b/Build/source/libs/zziplib/zziplib-src/zzip/info.c @@ -70,7 +70,7 @@ static const char* comprlevel[] = { zzip_char_t * zzip_compr_str(int compr) { - if (0 <= compr && compr < LENGTH(comprlevel)) + if (0 <= compr && (unsigned) compr < LENGTH(comprlevel)) { return comprlevel[compr]; } else if (0 < compr && compr < 256) diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/memdisk.c b/Build/source/libs/zziplib/zziplib-src/zzip/memdisk.c index 8d5743d7972..6be52cb5a16 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/memdisk.c +++ b/Build/source/libs/zziplib/zziplib-src/zzip/memdisk.c @@ -114,7 +114,7 @@ zzip_mem_disk_fdopen(int fd) ___ ZZIP_MEM_DISK *dir = zzip_mem_disk_new(); if (zzip_mem_disk_load(dir, disk) == -1) { - debug2("unable to load disk fd %s", fd); + debug2("unable to load disk fd %i", fd); } return dir; ____; @@ -222,6 +222,14 @@ zzip_mem_entry_new(ZZIP_DISK * disk, ZZIP_DISK_ENTRY * entry) item->zz_filetype = zzip_disk_entry_get_filetype(entry); /* + * If zz_data+zz_csize exceeds the size of the file, bail out + */ + if ((item->zz_data + item->zz_csize) < disk->buffer || + (item->zz_data + item->zz_csize) >= disk->endbuf) + { + goto error; + } + /* * If the file is uncompressed, zz_csize and zz_usize should be the same * If they are not, we cannot guarantee that either is correct, so ... */ @@ -236,10 +244,10 @@ zzip_mem_entry_new(ZZIP_DISK * disk, ZZIP_DISK_ENTRY * entry) } { /* copy the extra blocks to memory as well (maximum 64K each) */ - zzip_size_t /* */ ext1_len = zzip_disk_entry_get_extras(entry); - char *_zzip_restrict ext1_ptr = zzip_disk_entry_to_extras(entry); - zzip_size_t /* */ ext2_len = zzip_file_header_get_extras(header); - char *_zzip_restrict ext2_ptr = zzip_file_header_to_extras(header); + zzip_size_t /* */ ext1_len = zzip_disk_entry_get_extras(entry); + zzip_byte_t *_zzip_restrict ext1_ptr = zzip_disk_entry_to_extras(entry); + zzip_size_t /* */ ext2_len = zzip_file_header_get_extras(header); + zzip_byte_t *_zzip_restrict ext2_ptr = zzip_file_header_to_extras(header); if (ext1_len > 0 && ext1_len <= 65535) { @@ -305,7 +313,7 @@ zzip_mem_entry_extra_block(ZZIP_MEM_ENTRY * entry, short datatype) return zzip_mem_entry_find_extra_block(entry, datatype, 16); } -/* get extra block. +/** get extra block. * This function finds an extra block for the given datatype code. * The returned EXTRA_BLOCK is still in disk-encoding but * already a pointer into an allocated heap space block. @@ -352,7 +360,7 @@ zzip_mem_entry_find_extra_block(ZZIP_MEM_ENTRY * entry, short datatype, zzip_siz } } -/** => zzip_mem_disk_unload +/** => zzip_mem_disk_close * This function ends usage of a file entry in a disk. */ void @@ -371,7 +379,7 @@ zzip_mem_entry_free(ZZIP_MEM_ENTRY * _zzip_restrict item) } } -/* => zzip_mem_disk_close +/** => zzip_mem_disk_close * This function will trigger an underlying disk_close */ void @@ -389,7 +397,7 @@ zzip_mem_disk_unload(ZZIP_MEM_DISK * dir) dir->disk = 0; } -/* end usage. +/** end usage. * This function closes the dir and disk handles. */ void @@ -537,7 +545,7 @@ error: return NULL; } -/** => zzip_mem_entry_open +/** => zzip_mem_disk_open * This function opens a file by name from an openend disk. */ zzip__new__ ZZIP_MEM_DISK_FILE * diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/zip.c b/Build/source/libs/zziplib/zziplib-src/zzip/zip.c index 14e2e06615c..66a6e5058f8 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/zip.c +++ b/Build/source/libs/zziplib/zziplib-src/zzip/zip.c @@ -82,7 +82,8 @@ int __zzip_fetch_disk_trailer(int fd, zzip_off_t filesize, int __zzip_parse_root_directory(int fd, struct _disk_trailer *trailer, struct zzip_dir_hdr **hdr_return, - zzip_plugin_io_t io); + zzip_plugin_io_t io, + zzip_off_t filesize); _zzip_inline static char *__zzip_aligned4(char *p); @@ -406,7 +407,8 @@ int __zzip_parse_root_directory(int fd, struct _disk_trailer *trailer, struct zzip_dir_hdr **hdr_return, - zzip_plugin_io_t io) + zzip_plugin_io_t io, + zzip_off_t filesize) { auto struct zzip_disk_entry dirent; struct zzip_dir_hdr *hdr; @@ -421,7 +423,8 @@ __zzip_parse_root_directory(int fd, zzip_off64_t zz_rootseek = _disk_trailer_rootseek(trailer); __correct_rootseek(zz_rootseek, zz_rootsize, trailer); - if (zz_entries < 0 || zz_rootseek < 0 || zz_rootsize < 0) + if (zz_entries <= 0 || zz_rootsize < 0 || + zz_rootseek < 0 || zz_rootseek >= filesize) return ZZIP_CORRUPTED; hdr0 = (struct zzip_dir_hdr *) malloc(zz_rootsize); @@ -472,9 +475,15 @@ __zzip_parse_root_directory(int fd, } else { if (io->fd.seeks(fd, zz_rootseek + zz_offset, SEEK_SET) < 0) + { + free(hdr0); return ZZIP_DIR_SEEK; + } if (io->fd.read(fd, &dirent, sizeof(dirent)) < __sizeof(dirent)) + { + free(hdr0); return ZZIP_DIR_READ; + } d = &dirent; } @@ -574,11 +583,18 @@ __zzip_parse_root_directory(int fd, if (hdr_return) *hdr_return = hdr0; + else + { + /* If it is not assigned to *hdr_return, it will never be free()'d */ + free(hdr0); + } } /* else zero (sane) entries */ + else + free(hdr0); # ifndef ZZIP_ALLOW_MODULO_ENTRIES - return (entries != zz_entries ? ZZIP_CORRUPTED : 0); + return (entries != zz_entries) ? ZZIP_CORRUPTED : 0; # else - return ((entries & (unsigned)0xFFFF) != zz_entries ? ZZIP_CORRUPTED : 0); + return ((entries & (unsigned)0xFFFF) != zz_entries) ? ZZIP_CORRUPTED : 0; # endif } @@ -638,7 +654,7 @@ zzip_dir_alloc(zzip_strings_t * fileext) return zzip_dir_alloc_ext_io(fileext, 0); } -/** => zzip_dir_alloc_ext_io +/** also: zzip_dir_alloc_ext_io * This function will free the zzip_dir handle unless there are still * zzip_files attached (that may use its cache buffer). * This is the inverse of => zzip_dir_alloc , and both @@ -755,7 +771,7 @@ __zzip_dir_parse(ZZIP_DIR * dir) (long) _disk_trailer_rootseek(&trailer)); if ((rv = __zzip_parse_root_directory(dir->fd, &trailer, &dir->hdr0, - dir->io)) != 0) + dir->io, filesize)) != 0) { goto error; } error: return rv; diff --git a/Build/source/libs/zziplib/zziplib-src/zziplib.spec b/Build/source/libs/zziplib/zziplib-src/zziplib.spec index 1aef7e9c0dc..04b831c36d6 100644 --- a/Build/source/libs/zziplib/zziplib-src/zziplib.spec +++ b/Build/source/libs/zziplib/zziplib-src/zziplib.spec @@ -1,7 +1,7 @@ # norootforbuild Summary: ZZipLib - libZ-based ZIP-access Library with an Easy-to-Use API Name: zziplib -Version: 0.13.69 +Version: 0.13.71 Release: 1 License: LGPLv2.1+ Group: System/Libraries @@ -35,7 +35,7 @@ Provides: zziplib-lib010 = %version Summary: ZZipLib - Documentation Files Group: Development/Languages/C and C++ BuildRequires: python -BuildRequires: xmlto +# BuildRequires: xmlto PreReq: scrollkeeper %package devel diff --git a/Build/source/libs/zziplib/zziplib-src/zzipwrap/CMakeLists.txt b/Build/source/libs/zziplib/zziplib-src/zzipwrap/CMakeLists.txt new file mode 100644 index 00000000000..220d93b1211 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/zzipwrap/CMakeLists.txt @@ -0,0 +1,97 @@ +cmake_minimum_required (VERSION 3.1) +project(zzipwrap VERSION "0.13.71" LANGUAGES C) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeScripts") + +include ( CheckIncludeFiles ) +include ( GNUInstallDirs ) +include ( FindPkgConfig ) +include ( JoinPaths ) + +# options ######################################################## +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) + +check_include_files ( unistd.h ZZIP_HAVE_UNISTD_H ) +# set ( ZZIP_HAVE_ZLIB_H 1 ) + +# Zlib library needed +find_package ( ZLIB REQUIRED ) +pkg_search_module ( ZZIP zzip ) + +set(RELNUM "${PROJECT_VERSION_MAJOR}") +set(VERNUM "${PROJECT_VERSION_MINOR}") +set(FIXNUM "0.${PROJECT_VERSION_PATCH}") +# the "0." on FIXNUM is just for compatibility with automake's libtool. + +# targets ######################################################## +set(zzipwrap_SRCS + zzipwrap.c) + +set(libzzipwrap_SRCS + wrap.c) + +set(libzzipwrap_HDRS + wrap.h) + +add_library(libzzipwrap ${libzzipwrap_SRCS} ) +target_link_libraries(libzzipwrap libzzip ZLIB::ZLIB ) +target_include_directories(libzzipwrap PRIVATE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") + +set_target_properties(libzzipwrap PROPERTIES OUTPUT_NAME "zzipwrap" RELEASE_POSTFIX "-${RELNUM}") +SET_TARGET_PROPERTIES(libzzipwrap PROPERTIES VERSION ${VERNUM}.${FIXNUM} SOVERSION ${VERNUM}) + +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) +join_paths(libdir "\${prefix}" "${CMAKE_INSTALL_LIBDIR}") +join_paths(includedir "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}") +add_custom_command(OUTPUT zzipwrap.pc + COMMAND ${BASH} -c "echo 'prefix=${CMAKE_INSTALL_PREFIX}' > zzipwrap.pc" + COMMAND ${BASH} -c "echo 'libdir=${libdir}' >> zzipwrap.pc" + COMMAND ${BASH} -c "echo 'includedir=${includedir}' >> zzipwrap.pc" + COMMAND ${BASH} -c "echo '' >> zzipwrap.pc" + COMMAND ${BASH} -c "echo 'Name: ${PROJECT_NAME}' >> zzipwrap.pc" + COMMAND ${BASH} -c "echo 'Version: ${PROJECT_VERSION}' >> zzipwrap.pc" + COMMAND ${BASH} -c "echo 'Description: Callback Wrappers for ZZipLib' >> zzipwrap.pc" + COMMAND ${BASH} -c "echo 'Requires: zziplib' >> zzipwrap.pc" + COMMAND ${BASH} -c "echo 'Libs: -L\${libdir} -lzzipwrap' >> zzipwrap.pc" + COMMAND ${BASH} -c "echo 'Cflags: -I\${includedir}' >> zzipwrap.pc" + VERBATIM) +add_custom_target(pkgconfigs ALL DEPENDS zzipwrap.pc) +endif() + +# install ######################################################## +set(outdir ${CMAKE_CURRENT_BINARY_DIR}) + +if(UNIX) +install(FILES ${outdir}/zzipwrap.pc + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" ) +endif() + +install(FILES ${libzzipwrap_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/zzip ) +install(TARGETS libzzipwrap + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +if(ZZIPLIBTOOL) + if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG) + set(lib ${CMAKE_SHARED_LIBRARY_PREFIX}) + set(dll ${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(libdir ${CMAKE_INSTALL_FULL_LIBDIR}) + get_target_property(libname libzzipwrap OUTPUT_NAME) + get_target_property(librelease libzzipwrap RELEASE_POSTFIX) + get_target_property(libversion libzzipwrap VERSION) + install(CODE "execute_process(COMMAND bash -c \"set -e + cd $DESTDIR/${libdir} + [ -f ${lib}${libname}${librelease}${dll}.${libversion} ] || exit 0 + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${dll} + \")") + endif() +endif() diff --git a/Build/source/libs/zziplib/zziplib-src/zzipwrap/Makefile.in b/Build/source/libs/zziplib/zziplib-src/zzipwrap/Makefile.in index 9a2f0ec62e9..95f869f27e4 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzipwrap/Makefile.in +++ b/Build/source/libs/zziplib/zziplib-src/zzipwrap/Makefile.in @@ -104,9 +104,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_compile_check_sizeof.m4 \ $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_aligned_access_required.m4 \ $(top_srcdir)/m4/ax_check_enable_debug.m4 \ - $(top_srcdir)/m4/ax_configure_args.m4 \ $(top_srcdir)/m4/ax_create_pkgconfig_info.m4 \ - $(top_srcdir)/m4/ax_enable_builddir.m4 \ $(top_srcdir)/m4/ax_expand_prefix.m4 \ $(top_srcdir)/m4/ax_maintainer_mode_auto_silent.m4 \ $(top_srcdir)/m4/ax_not_enable_frame_pointer.m4 \ @@ -314,6 +312,8 @@ PAX_TAR_CREATE = @PAX_TAR_CREATE@ PAX_TAR_EXTRACT = @PAX_TAR_EXTRACT@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ RELEASE_INFO = @RELEASE_INFO@ @@ -348,7 +348,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -ax_enable_builddir_sed = @ax_enable_builddir_sed@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ diff --git a/Build/source/libs/zziplib/zziplib-src/zzipwrap/zzipwrap.pc b/Build/source/libs/zziplib/zziplib-src/zzipwrap/zzipwrap.pc deleted file mode 100644 index 281188693de..00000000000 --- a/Build/source/libs/zziplib/zziplib-src/zzipwrap/zzipwrap.pc +++ /dev/null @@ -1,10 +0,0 @@ -prefix=/usr/local -libdir=/usr/local/lib -includedir=/usr/local/include - -Name: zzipwrap -Version: 0.13.24 -Description: Callback Wrappers for ZZipLib -Requires: zziplib -Libs: -L${libdir} -lzzipwrap -Cflags: -I${includedir} -- cgit v1.2.3