diff -Nru innoextract-1.3/CHANGELOG innoextract-1.4/CHANGELOG --- innoextract-1.3/CHANGELOG 2012-10-25 21:00:06.000000000 +0000 +++ innoextract-1.4/CHANGELOG 2013-03-11 16:24:33.000000000 +0000 @@ -1,18 +1,38 @@ -Inno Extract 1.3 (2012-07-03) - - Respect --quiet and --silent for multi-file installers - - Compile in C++11 mode if supported - - Warn about unsupported setup data versions - - Add support for Inno Setup 5.5.0 installers +innoextract 1.4 (2013-03-11) + - Fixed build on non-Linux platforms with a separate libiconv (Windows™, Mac OS X) + - Fixed build on systems with non-standard iconv function prototypes (FreeBSD) + - Fixed MSVC build + - Fixed build with older glibc versions + - Fixed issues with the progress bar in sandbox environments + - Fixed string conversion on systems where libiconv defaults to big-endian variants + - Fixed extracting very large installers with 32-bit innoextract builds + - Improved handling of invalid encoded strings + - Improved error messages when input or output files could not be opened + - The --list command-line option can now combined with --test or --extract + - The --version command-line option can now be modified with --quiet or --silent + - Added color output and progress bar support for Windows™ + - Added support for Unicode filenames under Windows™ + - Added support for preserving timestamps of extracted files (enabled by default) + - Added a --timestamps (-T) command-line options to control or disable file timestamps + - Added an --output-dir (-d) command-line option to control where files are extracted + - Added various CMake options to fine-tune the build process + - Various bug fixes and tweaks -Inno Extract 1.2 (2012-04-01) - - Fix compile errors with older versions of Boost or GCC. - - Don't link against libraries that aren't actually needed. +innoextract 1.3 (2012-07-03) + - Fixed --quiet and --silent flags being ignored for some multi-file installers output + - Now compiles in C++11 mode if supported + - Added a warning when extracting unsupported setup data versions + - Added support for Inno Setup 5.5.0 installers -Inno Extract 1.1 (2012-03-19) - - Support extracting files for a specific language. - - Fix a bug in the setup header parsing code. +innoextract 1.2 (2012-04-01) + - Fixed compile errors with older versions of Boost or GCC. + - Prevented linking against libraries that aren't actually needed. -Inno Extract 1.0 (2012-03-01) +innoextract 1.1 (2012-03-19) + - Added support to extract files for a specific language. + - Fixed a bug in the setup header parsing code. + +innoextract 1.0 (2012-03-01) - Initial release. - Can list and extract files but not much more. diff -Nru innoextract-1.3/CMakeLists.txt innoextract-1.4/CMakeLists.txt --- innoextract-1.3/CMakeLists.txt 2012-10-25 21:00:06.000000000 +0000 +++ innoextract-1.4/CMakeLists.txt 2013-03-11 16:24:33.000000000 +0000 @@ -1,32 +1,94 @@ -project(InnoExtract) +project(innoextract) cmake_minimum_required(VERSION 2.8) -# For custom cmake modules. -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") + +# Define configuration options option(USE_LZMA "Build lzma decompression support." ON) option(DEBUG_EXTRA "Expensive debug options" OFF) +option(SET_WARNING_FLAGS "Adjust compiler warning flags" ON) +option(SET_OPTIMIZATION_FLAGS "Adjust compiler optimization flags" ON) +option(USE_CXX11 "Try to use C++11 if available" ON) + +set(default_USE_STATIC_LIBS OFF) +if(WIN32) + set(default_USE_STATIC_LIBS ON) +endif() +option(USE_STATIC_LIBS "Statically link libraries" ${default_USE_STATIC_LIBS}) +option(LZMA_USE_STATIC_LIBS "Statically link liblzma" ${USE_STATIC_LIBS}) +option(ZLIB_USE_STATIC_LIBS "Statically link libz" ${USE_STATIC_LIBS}) +option(BZip2_USE_STATIC_LIBS "Statically link libbz2" ${USE_STATIC_LIBS}) +option(Boost_USE_STATIC_LIBS "Statically link Boost" ${USE_STATIC_LIBS}) +option(iconv_USE_STATIC_LIBS "Statically link libiconv" ${USE_STATIC_LIBS}) + + +# Install destinations +if(CMAKE_VERSION VERSION_LESS 2.8.5) + set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE + STRING "read-only architecture-independent data root (share) (relative to prefix).") + set(CMAKE_INSTALL_BINDIR "bin" CACHE + STRING "user executables (bin) (relative to prefix).") + set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man" CACHE + STRING "man documentation (DATAROOTDIR/man) (relative to prefix).") + mark_as_advanced( + CMAKE_INSTALL_DATAROOTDIR + CMAKE_INSTALL_BINDIR + CMAKE_INSTALL_MANDIR + ) +else() + include(GNUInstallDirs) +endif() -set(MAN_DIR "share/man" CACHE STRING "Install location for man pages (relative to prefix).") -mark_as_advanced(MAN_DIR) -include(CompileCheck) -include(VersionString) +# Helper scrips + include(CheckSymbolExists) + +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") # For custom cmake modules include(BuildType) -include(StyleCheck) +include(CompileCheck) +include(CXX11Check) include(Doxygen) -include(TestBigEndian) +include(PrintConfiguration) +include(StyleCheck) +include(UseStaticLibs) +include(VersionString) + -# Force re-checking libraries if the compiler or compiler flags change. +# Find required libraries + +# Win32 API +if(WIN32) + # Ensure we aren't using functionalities not found under Window XP SP1 + add_definitions(-D_WIN32_WINNT=0x0502) + add_definitions(-DNOMINMAX) + add_definitions(-DWIN32_LEAN_AND_MEAN) + if(NOT MSVC) + # required for _gmtime64_s on MinGW + add_definitions(-DMINGW_HAS_SECURE_API) + list(APPEND CMAKE_REQUIRED_DEFINITIONS -DMINGW_HAS_SECURE_API) + endif() +endif() + +if(USE_STATIC_LIBS AND NOT MSVC) + add_ldflag("-static-libstdc++") + add_ldflag("-static-libgcc") +endif() + +# Force re-checking libraries if the compiler or compiler flags change if((NOT LAST_CMAKE_CXX_FLAGS STREQUAL CMAKE_CXX_FLAGS) OR (NOT LAST_CMAKE_CXX_COMPILER STREQUAL CMAKE_CXX_COMPILER)) force_recheck_library(LZMA) force_recheck_library(Boost) + force_recheck_library(ZLIB) + force_recheck_library(BZip2) + force_recheck_library(iconv) unset(Boost_INCLUDE_DIR CACHE) - set(LAST_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE INTERNAL "The last C++ compiler flags.") - set(LAST_CMAKE_CXX_COMPILER "${CMAKE_CXX_COMPILER}" CACHE INTERNAL "The last C++ compiler.") + set(LAST_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE INTERNAL + "The last C++ compiler flags") + set(LAST_CMAKE_CXX_COMPILER "${CMAKE_CXX_COMPILER}" CACHE INTERNAL + "The last C++ compiler") endif() unset(LIBRARIES) @@ -34,13 +96,14 @@ if(USE_LZMA) find_package(LZMA REQUIRED) check_link_library(LZMA LZMA_LIBRARIES) - list(APPEND LIBRARIES "${LZMA_LIBRARIES}") - include_directories(SYSTEM "${LZMA_INCLUDE_DIR}") - set(HAVE_LZMA 1) + list(APPEND LIBRARIES ${LZMA_LIBRARIES}) + include_directories(SYSTEM ${LZMA_INCLUDE_DIR}) + add_definitions(${LZMA_DEFINITIONS}) + set(INNOEXTRACT_HAVE_LZMA 1) else() message(WARNING "\nDisabling LZMA decompression support.\n" "You won't be able to extract most newer Inno Setup installers.") - set(HAVE_LZMA 0) + set(INNOEXTRACT_HAVE_LZMA 0) endif() find_package(Boost REQUIRED COMPONENTS @@ -51,50 +114,102 @@ program_options ) check_link_library(Boost Boost_LIBRARIES) -list(APPEND LIBRARIES "${Boost_LIBRARIES}") -link_directories("${Boost_LIBRARY_DIRS}") -include_directories(SYSTEM "${Boost_INCLUDE_DIR}") - -add_cxxflag("-std=c++11") - -add_cxxflag("-Wall") -add_cxxflag("-Wextra") -add_cxxflag("-Wformat=2") -add_cxxflag("-Wundef") -add_cxxflag("-Wpointer-arith") -add_cxxflag("-Wcast-qual") -add_cxxflag("-Woverloaded-virtual") -add_cxxflag("-Wlogical-op") -add_cxxflag("-Wliteral-conversion") -add_cxxflag("-Wshift-overflow") -add_cxxflag("-Woverflow") -add_cxxflag("-Wbool-conversions") -add_cxxflag("-Wconversion") -add_cxxflag("-Wsign-conversion") -add_cxxflag("-Wmissing-declarations") -add_cxxflag("-Wredundant-decls") - -if(DEBUG_EXTRA) - add_cxxflag("-ftrapv") # to add checks for (undefined) signed integer overflow - add_cxxflag("-fbounds-checking") - add_cxxflag("-fcatch-undefined-behavior") - add_cxxflag("-Wstrict-aliasing=1") -else() - # -Wuninitialized causes too many false positives - thanks very much, gcc - add_cxxflag("-Wno-uninitialized") - # (clang only) Conflicts with using const variables for configuration. - add_cxxflag("-Wno-constant-logical-operand") - add_cxxflag("-Wno-unneeded-internal-declaration") - add_cxxflag("-Wno-unused-function") +list(APPEND LIBRARIES ${Boost_LIBRARIES}) +link_directories(${Boost_LIBRARY_DIRS}) +include_directories(SYSTEM ${Boost_INCLUDE_DIR}) + +if(Boost_USE_STATIC_LIBS) + + use_static_libs(ZLIB) + find_package(ZLIB REQUIRED) + use_static_libs_restore() + check_link_library(ZLIB ZLIB_LIBRARIES) + list(APPEND LIBRARIES ${ZLIB_LIBRARIES}) + + use_static_libs(BZip2) + find_package(BZip2 REQUIRED) + use_static_libs_restore() + check_link_library(BZip2 BZIP2_LIBRARIES) + list(APPEND LIBRARIES ${BZIP2_LIBRARIES}) + endif() -# Because i'm lazy -add_ldflag("-Wl,--as-needed") +find_package(iconv REQUIRED) +check_link_library(iconv iconv_LIBRARIES) +list(APPEND LIBRARIES ${iconv_LIBRARIES}) +include_directories(SYSTEM ${iconv_INCLUDE_DIR}) +add_definitions(${iconv_DEFINITIONS}) + + +# Set compiler flags + +if(${Boost_VERSION} LESS 104800) + # Older Boost versions don't work with C++11 +elseif(USE_CXX11) + enable_cxx11() + check_cxx11("alignof" INNOEXTRACT_HAVE_ALIGNOF) + if(WIN32) + check_cxx11("std::codecvt_utf8_utf16" INNOEXTRACT_HAVE_STD_CODECVT_UTF8_UTF16) + endif() + check_cxx11("std::unique_ptr" INNOEXTRACT_HAVE_STD_UNIQUE_PTR) +endif() -check_symbol_exists(isatty "unistd.h" HAVE_ISATTY) -check_symbol_exists(ioctl "sys/ioctl.h" HAVE_IOCTL) +# Don't expose internal symbols to the outside world by default +if(NOT MSVC) + add_cxxflag("-fvisibility=hidden") + add_cxxflag("-fvisibility-inlines-hidden") +endif() -test_big_endian(IS_BIG_ENDIAN) +# Older glibc versions won't provide some useful symbols by default - request them +# This flag is currently also set by gcc when compiling C++, but not for plain C +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE=1") + add_definitions(-D_GNU_SOURCE=1) +endif() + +if(WIN32) + # Define this so that we don't accitenally use ANSI functions + add_definitions(-D_UNICODE) +endif() + + +# Check for optional functionality and system configuration + +check_symbol_exists(isatty "unistd.h" INNOEXTRACT_HAVE_ISATTY) +if(NOT INNOEXTRACT_HAVE_ISATTY) + check_symbol_exists(_isatty "io.h" INNOEXTRACT_HAVE_MS_ISATTY) +endif() +check_symbol_exists(ioctl "sys/ioctl.h" INNOEXTRACT_HAVE_IOCTL) +check_symbol_exists(_mkgmtime64 "time.h" INNOEXTRACT_HAVE_MKGMTIME64) +if(NOT INNOEXTRACT_HAVE_MKGMTIME64) + check_symbol_exists(timegm "time.h" INNOEXTRACT_HAVE_TIMEGM) + if(NOT INNOEXTRACT_HAVE_TIMEGM) + check_symbol_exists(_mkgmtime "time.h" INNOEXTRACT_HAVE_MKGMTIME) + endif() +endif() +check_symbol_exists(_gmtime64_s "time.h" INNOEXTRACT_HAVE_GMTIME64_S) +if(NOT INNOEXTRACT_HAVE_GMTIME64_S) + check_symbol_exists(gmtime_r "time.h" INNOEXTRACT_HAVE_GMTIME_R) + if(NOT INNOEXTRACT_HAVE_GMTIME_R) + check_symbol_exists(gmtime_s "time.h" INNOEXTRACT_HAVE_GMTIME_S) + endif() +endif() +if(NOT WIN32) + check_symbol_exists(utimensat "sys/stat.h" INNOEXTRACT_HAVE_UTIMENSAT) + check_symbol_exists(AT_FDCWD "fcntl.h" INNOEXTRACT_HAVE_AT_FDCWD) + if(INNOEXTRACT_HAVE_UTIMENSAT AND INNOEXTRACT_HAVE_AT_FDCWD) + set(INNOEXTRACT_HAVE_UTIMENSAT_d 1) + else() + check_symbol_exists(utimes "sys/time.h" INNOEXTRACT_HAVE_UTIMES) + endif() +endif() + +check_symbol_exists(bswap_16 "byteswap.h" INNOEXTRACT_HAVE_BSWAP_16) +check_symbol_exists(bswap_32 "byteswap.h" INNOEXTRACT_HAVE_BSWAP_32) +check_symbol_exists(bswap_64 "byteswap.h" INNOEXTRACT_HAVE_BSWAP_64) + + +# All sources: set(INNOEXTRACT_SOURCES @@ -140,6 +255,7 @@ src/util/console.cpp src/util/load.cpp src/util/log.cpp + src/util/time.cpp ) @@ -151,29 +267,60 @@ list(APPEND INNOEXTRACT_SOURCES src/stream/lzma.cpp) endif() +if(WIN32) + list(APPEND INNOEXTRACT_SOURCES src/util/windows.cpp) +endif() + file(GLOB_RECURSE ALL_INCLUDES "${CMAKE_SOURCE_DIR}/src/*.hpp") list(SORT INNOEXTRACT_SOURCES) list(SORT ALL_INCLUDES) +list(APPEND CHECKED_SOURCES ${INNOEXTRACT_SOURCES}) + + +# Prepare generated files + include_directories(src ${CMAKE_CURRENT_BINARY_DIR}) configure_file("src/configure.hpp.in" "configure.hpp") -file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/cli") -set(VERSION_FILE "${CMAKE_BINARY_DIR}/cli/version.cpp") -version_file("src/cli/version.cpp.in" "${VERSION_FILE}" "VERSION" ".git") +set(VERSION_FILE "${CMAKE_BINARY_DIR}/release.cpp") +set(VERSION_SOURCES VERSION "VERSION" LICENSE "LICENSE") +version_file("src/release.cpp.in" "${VERSION_FILE}" "${VERSION_SOURCES}" ".git") list(APPEND INNOEXTRACT_SOURCES "${VERSION_FILE}") + +# Main targets + add_executable(innoextract ${INNOEXTRACT_SOURCES} ${ALL_INCLUDES}) target_link_libraries(innoextract ${LIBRARIES}) -install(TARGETS innoextract RUNTIME DESTINATION bin) +install(TARGETS innoextract RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + +install(FILES doc/innoextract.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 OPTIONAL) -install(FILES doc/innoextract.1 DESTINATION ${MAN_DIR}/man1 OPTIONAL) # Additional targets. -add_style_check_target(style "${INNOEXTRACT_SOURCES}" "${ALL_INCLUDES}") +add_style_check_target(style "${CHECKED_SOURCES}" "${ALL_INCLUDES}") add_doxygen_target(doc "doc/Doxyfile.in" "VERSION" ".git" "${CMAKE_BINARY_DIR}/doc") + + +# Print a configuration summary + +message("") +message("Configuration:") +message(" - Build type: ${CMAKE_BUILD_TYPE}") +print_configuration("LZMA decompression" FIRST + INNOEXTRACT_HAVE_LZMA "enabled" + 1 "disabled" +) +print_configuration("File time precision" FIRST + INNOEXTRACT_HAVE_UTIMENSAT_d "nanoseconds" + WIN32 "100-nanoseconds" + INNOEXTRACT_HAVE_UTIMES "microseconds" + 1 "seconds" +) +message("") diff -Nru innoextract-1.3/LICENSE innoextract-1.4/LICENSE --- innoextract-1.3/LICENSE 2012-10-25 21:00:06.000000000 +0000 +++ innoextract-1.4/LICENSE 2013-03-11 16:24:33.000000000 +0000 @@ -1,5 +1,5 @@ -Copyright (C) 2011-2012 Daniel Scharrer +Copyright (C) 2011-2013 Daniel Scharrer This software is provided 'as-is', without any express or implied warranty. In no event will the author(s) be held liable for any damages diff -Nru innoextract-1.3/README.md innoextract-1.4/README.md --- innoextract-1.3/README.md 2012-10-25 21:00:06.000000000 +0000 +++ innoextract-1.4/README.md 2013-03-11 16:24:33.000000000 +0000 @@ -1,9 +1,9 @@ -# Inno Extract - A tool to unpack installers created by Inno Setup +# innoextract - A tool to unpack installers created by Inno Setup -[Inno Setup](http://www.jrsoftware.org/isinfo.php) is a tool to create installers for Microsoft Windows applications. Inno Extracts allows to extract such installers under non-windows systems without running the actual installer using wine. Inno Extract currently supports installers created by Inno Setup 1.2.10 to 5.5.0. +[Inno Setup](http://www.jrsoftware.org/isinfo.php) is a tool to create installers for Microsoft Windows applications. innoextract allows to extract such installers under non-Windows systems without running the actual installer using wine. innoextract currently supports installers created by Inno Setup 1.2.10 to 5.5.3. -Inno Extract is available under the ZLIB license - see the LICENSE file. +innoextract is available under the ZLIB license - see the LICENSE file. See the website for [Linux packages](http://constexpr.org/innoextract/#packages). @@ -15,20 +15,21 @@ ## Dependencies -* **Boost 1.37** or newer +* **[Boost](http://www.boost.org/) 1.37** or newer * **liblzma** from [xz-utils](http://tukaani.org/xz/) *(optional)* +* **iconv** (either as part of the system libc, as is the case with [glibc](http://www.gnu.org/software/libc/) and [uClibc](http://www.uclibc.org/), or as a separate [libiconv](http://www.gnu.org/software/libiconv/)) For Boost you will need the headers as well as the `iostreams`, `filesystem`, `date_time`, `system` and `program_options` libraries. Older Boost version may work but are not actively supported. The boost `iostreams` library needs to be build with zlib and bzip2 support. While the liblzma dependency is optional, it is highly recommended and you won't be able to extract most installers created by newer Inno Setup versions without it. -To build Inno Extract you will also need **CMake 2.8** and a working C++ compiler, as well as the development headers for liblzma and boost. +To build innoextract you will also need **[CMake](http://cmake.org/) 2.8** and a working C++ compiler, as well as the development headers for liblzma and boost. -The website might have more [specific instructions for your linux distribution](http://constexpr.org/innoextract/install). +The website might have more [specific instructions for your Linux distribution](http://constexpr.org/innoextract/install). ## Compile and install -To compile Inno Extract, run: +To compile innoextract, run: $ mkdir -p build && cd build && cmake .. $ make @@ -39,11 +40,31 @@ Build options: -* `USE_LZMA` (default: `ON`): Use *liblzma* if available. -* `CMAKE_BUILD_TYPE` (default: `Release`): Set to `Debug` to enable debug output. -* `CMAKE_INSTALL_PREFIX` (default: `/usr/local` on UNIX): Where to install Inno Extract. -* `DEBUG_EXTRA` (default: `OFF`): Expensive debug options -* `MAN_DIR` (default: `share/man`): Install location for man pages (relative to prefix). +| Option | Default | Description | +|:------------------------ |:---------:|:----------- | +| `USE_LZMA` | `ON` | Use `liblzma` if available. +| `CMAKE_BUILD_TYPE` | `Release` | Set to `Debug` to enable debug output. +| `SET_WARNING_FLAGS` | `ON` | Adjust compiler warning flags. This should not affect the produced binaries but is useful to catch potential problems. +| `SET_OPTIMIZATION_FLAGS` | `ON` | Adjust compiler optimization flags. For non-debug builds the only thing this does is instruct the linker to only link against libraries that are actually needed. +| `USE_CXX11` | `ON` | Try to compile in C++11 mode if available. +| `DEBUG_EXTRA` | `OFF` | Expensive debug options. +| `USE_STATIC_LIBS` | `OFF`^1 | Turns on static linking for all libraries, including `-static-libgcc` and `-static-libstdc++`. You can also use the individual options below: +| `LZMA_USE_STATIC_LIBS` | `OFF`^2 | Statically link `liblzma`. +| `Boost_USE_STATIC_LIBS` | `OFF`^2 | Statically link Boost. See also `FindBoost.cmake` +| `ZLIB_USE_STATIC_LIBS` | `OFF`^2 | Statically link `libz`. (used via Boost) +| `BZip2_USE_STATIC_LIBS` | `OFF`^2 | Statically link `libbz2`. (used via Boost) +| `iconv_USE_STATIC_LIBS` | `OFF`^2 | Statically link `libiconv`. +1. Under Windows, the default is `ON`. +2. Default is `ON` if `USE_STATIC_LIBS` is enabled. + +Install options: + +| Option | Default | Description | +|:--------------------------- |:--------------------:|:----------- | +| `CMAKE_INSTALL_PREFIX` | `/usr/local` | Where to install innoextract. +| `CMAKE_INSTALL_BINDIR` | `bin` | Location for binaries (relative to prefix). +| `CMAKE_INSTALL_DATAROOTDIR` | `share` | Location for data files (relative to prefix). +| `CMAKE_INSTALL_MANDIR` | `${DATAROOTDIR}/man` | Location for man pages (relative to prefix). Set options by passing `-D