From 27c6c9420277c533cc4333bdd880f9862012cb72 Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Thu, 21 May 2020 19:46:07 +0200 Subject: [PATCH] [vcpkg] Improve make builds (#10402) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update all 16 configure_make ports * add make wrappers for msvc * improve make builds * fix relativ path errors on linux (and osx?) * revisit all 16 portfiles again * remove trace from install * fix relative build path issues. * bump control of the 16 configure ports * never forget .... real linux is case sensitive .... * Revert "bump control of the 16 configure ports" This reverts commit 40d6d81c01d2709c4acbdbec503b4787c3fd8282. * Revert "Revert "bump control of the 16 configure ports"" This reverts commit 9c9851ddfcd01bfad604ab9c9aed7379238d619a. * bump control again for real ci rebuild * add copy_source * remove message * pass parameters to vcpkg_build_make * fix healpix build. * fix libmagic regression * fix libwandio regression * pfring changes regression fix? (cannot test in wsl) * ws change to retrigger CI * fix libpq regression * fix libudns regression * add share/pkgconfig to PKG_CONFIG_PATH * cleanup of deprecated options * cleanup docs * Revert "bump control again for real ci rebuild" This reverts commit b4bc18edc2376eba6c3aa3dda52bd82286f23616. * shared binaries on linux should stay in lib. Only dlls are mvoed to bin * move pkgconfig check and add message about missing system packages * added autopoint as a build requirement * fix prerun shell working dir. * a few fixes from the x windows pr - add libpath setting - fixed pkgconfig search on windows platforms - fixed autopoint msys package on windows * fix release prefix * minimal cleanup and ws changes to trigger true CI rebuild * fix tcl by upgrading * remove unnecessary rename * fix pfring? can't test in WSL. Linux kernel headers required. * fix lowercase in patch * fix libwandio * remove x264 from fail list * replace wrappers with wrappers from automake * update make ports * remove unnecessary message * refactor vcpkg_configure_make * [tcl] remove stray ? * [farmhash] fix build * [freexl] ws change to retrigger ci build * [x264] add pthread as a dependency * [vcpkg/scripts] add ignore flag correctly * [sdl] fix vcpkg_fixup_pkgconfig call * [farmhash/freexl] delete configure and recreate it. * [libudns] remove trailing ? * [freexl] use empty build target * [freexl] add system library; remove previous change * Update ports/x264/portfile.cmake Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> * [libwandio] remove unncessary comment Co-authored-by: dan-shaw <51385773+dan-shaw@users.noreply.github.com> Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> --- ports/farmhash/CONTROL | 3 +- ports/farmhash/portfile.cmake | 12 +- ports/freexl/CONTROL | 2 +- ports/freexl/portfile.cmake | 7 +- ports/healpix/CONTROL | 2 +- ports/healpix/portfile.cmake | 24 +- ports/libb2/CONTROL | 2 +- ports/libb2/portfile.cmake | 12 +- ports/libcrafter/CONTROL | 2 +- ports/libcrafter/portfile.cmake | 5 +- ports/libmagic/CONTROL | 2 +- ports/libmagic/portfile.cmake | 7 +- ports/libmesh/CONTROL | 2 +- ports/libmesh/portfile.cmake | 13 +- ports/libosip2/CONTROL | 5 +- ports/libosip2/portfile.cmake | 20 +- ports/libpq/portfile.cmake | 9 +- ports/libudns/CONTROL | 2 +- ports/libudns/ignore_unknown_options.patch | 26 + ports/libudns/portfile.cmake | 7 +- ports/libwandio/CONTROL | 5 +- ports/libwandio/configure.lib.patch | 140 +++++ ports/libwandio/portfile.cmake | 6 +- ports/libxslt/CONTROL | 2 +- ports/libxslt/portfile.cmake | 3 +- ports/pfring/CONTROL | 2 +- ports/pfring/makefile.patch | 59 ++ ports/pfring/portfile.cmake | 20 +- ports/sdl1/CONTROL | 2 +- ports/sdl1/portfile.cmake | 20 +- ports/tcl/CONTROL | 2 +- ports/tcl/portfile.cmake | 7 +- ports/x264/CONTROL | 5 +- ports/x264/portfile.cmake | 10 +- scripts/ci.baseline.txt | 1 - scripts/cmake/vcpkg_build_make.cmake | 254 +++++--- scripts/cmake/vcpkg_configure_make.cmake | 660 ++++++++++++--------- scripts/cmake/vcpkg_fixup_pkgconfig.cmake | 3 +- scripts/cmake/vcpkg_install_make.cmake | 2 +- 39 files changed, 893 insertions(+), 474 deletions(-) create mode 100644 ports/libudns/ignore_unknown_options.patch create mode 100644 ports/libwandio/configure.lib.patch create mode 100644 ports/pfring/makefile.patch diff --git a/ports/farmhash/CONTROL b/ports/farmhash/CONTROL index 79cb6849a3..f27140fbd0 100644 --- a/ports/farmhash/CONTROL +++ b/ports/farmhash/CONTROL @@ -1,4 +1,5 @@ Source: farmhash -Version: 1.1 +Version: 1.1-1 Homepage: https://github.com/google/farmhash Description: FarmHash, a family of hash functions. +Supports: !arm diff --git a/ports/farmhash/portfile.cmake b/ports/farmhash/portfile.cmake index 42aa80ceb1..d9bcc92406 100644 --- a/ports/farmhash/portfile.cmake +++ b/ports/farmhash/portfile.cmake @@ -1,5 +1,5 @@ -vcpkg_fail_port_install(ON_ARCH "arm" "arm64" ON_TARGET "UWP" "Windows") -vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +#Requires a compiler which understands '__builtin_unreachable': +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH @@ -9,12 +9,12 @@ vcpkg_from_github( HEAD_REF master ) -set(FLAGS "-g -mavx -maes -O3") +if((VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX) AND NOT ENV{CXX_FLAGS}) # This should be a compiler check + set(ENV{CXXFLAGS} "-maes -msse4.2") +endif() +file(REMOVE_RECURSE "${SOURCE_PATH}/configure") vcpkg_configure_make( SOURCE_PATH ${SOURCE_PATH} - AUTOCONFIG - OPTIONS - CXXFLAGS=${FLAGS} ) vcpkg_install_make() diff --git a/ports/freexl/CONTROL b/ports/freexl/CONTROL index 23f6b34681..68d0d291fc 100644 --- a/ports/freexl/CONTROL +++ b/ports/freexl/CONTROL @@ -1,5 +1,5 @@ Source: freexl -Version: 1.0.4-8 +Version: 1.0.4-9 Homepage: https://www.gaia-gis.it/gaia-sins/freexl-sources Description: FreeXL is an open source library to extract valid data from within an Excel (.xls) spreadsheet Build-Depends: libiconv diff --git a/ports/freexl/portfile.cmake b/ports/freexl/portfile.cmake index 8253788371..3c4629dce5 100644 --- a/ports/freexl/portfile.cmake +++ b/ports/freexl/portfile.cmake @@ -1,4 +1,3 @@ -include(vcpkg_common_functions) set(FREEXL_VERSION_STR "1.0.4") vcpkg_download_distfile(ARCHIVE @@ -36,8 +35,7 @@ if (VCPKG_TARGET_IS_WINDOWS) INSTALLED_ROOT="${CURRENT_INSTALLED_DIR}" INST_DIR="${CURRENT_PACKAGES_DIR}" "LINK_FLAGS=" - "LIBS_ALL=${LIBS_ALL_REL}" - + "LIBS_ALL=${LIBS_ALL_REL}" ) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/freexl RENAME copyright) @@ -64,7 +62,7 @@ elseif (CMAKE_HOST_UNIX OR CMAKE_HOST_APPLE) # Build in UNIX ARCHIVE ${ARCHIVE} OUT_SOURCE_PATH SOURCE_PATH ) - + file(REMOVE_RECURSE "${SOURCE_PATH}/configure") vcpkg_configure_make( SOURCE_PATH ${SOURCE_PATH} OPTIONS_DEBUG @@ -80,6 +78,7 @@ elseif (CMAKE_HOST_UNIX OR CMAKE_HOST_APPLE) # Build in UNIX ) vcpkg_install_make() + vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES m) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/freexl RENAME copyright) diff --git a/ports/healpix/CONTROL b/ports/healpix/CONTROL index f290513050..1fa217b77b 100644 --- a/ports/healpix/CONTROL +++ b/ports/healpix/CONTROL @@ -1,5 +1,5 @@ Source: healpix -Version: 1.12.10 +Version: 1.12.10-1 Homepage: http://healpix.sourceforge.net/ Description: HEALPix is an acronym for Hierarchical Equal Area isoLatitude Pixelation of a sphere. Build-Depends: cfitsio diff --git a/ports/healpix/portfile.cmake b/ports/healpix/portfile.cmake index 5dbd9c3c29..2ecacc939a 100644 --- a/ports/healpix/portfile.cmake +++ b/ports/healpix/portfile.cmake @@ -1,5 +1,3 @@ -vcpkg_fail_port_install(ON_TARGET "Windows" "OSX") - set(HEALPIX_VER 3.50) set(HEALPIX_PACK_NAME ${HEALPIX_VER}_2018Dec10) @@ -17,25 +15,31 @@ vcpkg_extract_source_archive_ex( vcpkg_configure_make( SOURCE_PATH ${SOURCE_PATH} PROJECT_SUBPATH src/cxx - AUTOCONFIG - NO_DEBUG + COPY_SOURCE OPTIONS --with-libcfitsio-include=${CURRENT_INSTALLED_DIR}/include/cfitsio --with-libcfitsio-lib=${CURRENT_INSTALLED_DIR}/lib ) -vcpkg_build_make() +vcpkg_build_make(BUILD_TARGET compile_all) +#vcpkg_fixup_pkgconfig() -# Install manually -set(OBJ_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/src/cxx/auto) +# Install manually because healpix has no install target +set(OBJ_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/auto") file(GLOB_RECURSE HEALPIX_LIBS ${OBJ_DIR}/lib/*) -file(INSTALL ${HEALPIX_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib) +file(INSTALL ${HEALPIX_LIBS} DESTINATION "${CURRENT_PACKAGES_DIR}/lib") file(GLOB_RECURSE HEALPIX_INCLUDES ${OBJ_DIR}/include/*) -file(INSTALL ${HEALPIX_INCLUDES} DESTINATION ${CURRENT_PACKAGES_DIR}/include) +file(INSTALL ${HEALPIX_INCLUDES} DESTINATION "${CURRENT_PACKAGES_DIR}/include") file(GLOB_RECURSE HEALPIX_TOOLS ${OBJ_DIR}/bin/*) -file(INSTALL ${HEALPIX_TOOLS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools) +file(INSTALL ${HEALPIX_TOOLS} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}") + +if(EXISTS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/") + set(OBJ_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/auto") + file(GLOB_RECURSE HEALPIX_LIBS ${OBJ_DIR}/lib/*) + file(INSTALL ${HEALPIX_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) +endif() # Handle copyright file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/libb2/CONTROL b/ports/libb2/CONTROL index 0523b60d5d..41fb105aa8 100644 --- a/ports/libb2/CONTROL +++ b/ports/libb2/CONTROL @@ -1,4 +1,4 @@ Source: libb2 -Version: 0.98.1 +Version: 0.98.1-1 Homepage: https://github.com/BLAKE2/libb2 Description: C library providing BLAKE2b, BLAKE2s, BLAKE2bp, BLAKE2sp \ No newline at end of file diff --git a/ports/libb2/portfile.cmake b/ports/libb2/portfile.cmake index 88007bdf0d..2a342f9dca 100644 --- a/ports/libb2/portfile.cmake +++ b/ports/libb2/portfile.cmake @@ -1,5 +1,3 @@ -vcpkg_fail_port_install(MESSAGE "${PORT} currently only supports Linux platform" ON_TARGET "Windows" "OSX") - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO BLAKE2/libb2 @@ -8,12 +6,18 @@ vcpkg_from_github( HEAD_REF master ) +set(OPTIONS) +if(CMAKE_HOST_WIN32) + set(OPTIONS --disable-native) # requires cpuid +endif() + vcpkg_configure_make( SOURCE_PATH ${SOURCE_PATH} - AUTOCONFIG + OPTIONS ${OPTIONS} ) - vcpkg_install_make() +vcpkg_fixup_pkgconfig() + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) diff --git a/ports/libcrafter/CONTROL b/ports/libcrafter/CONTROL index 76c3c1bc28..b8ebac0bf7 100644 --- a/ports/libcrafter/CONTROL +++ b/ports/libcrafter/CONTROL @@ -1,5 +1,5 @@ Source: libcrafter -Version: 0.3 +Version: 0.3-1 Homepage: https://github.com/pellegre/libcrafter Description: Libcrafter is a high level library for C++ designed to create and decode network packets. Build-Depends: libpcap \ No newline at end of file diff --git a/ports/libcrafter/portfile.cmake b/ports/libcrafter/portfile.cmake index 57427906b1..9965b7d3c9 100644 --- a/ports/libcrafter/portfile.cmake +++ b/ports/libcrafter/portfile.cmake @@ -1,5 +1,3 @@ -vcpkg_fail_port_install(MESSAGE "${PORT} currently only supports Linux platforms" ON_TARGET "Windows" "OSX") - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO pellegre/libcrafter @@ -11,10 +9,9 @@ vcpkg_from_github( vcpkg_configure_make( SOURCE_PATH ${SOURCE_PATH} - AUTOCONFIG PROJECT_SUBPATH libcrafter OPTIONS - --with-libpcap=${CURRENT_INSTALLED_DIR} + "--with-libpcap=${CURRENT_INSTALLED_DIR}" ) vcpkg_install_make() diff --git a/ports/libmagic/CONTROL b/ports/libmagic/CONTROL index 3f0b777eb8..07fce2a682 100644 --- a/ports/libmagic/CONTROL +++ b/ports/libmagic/CONTROL @@ -1,4 +1,4 @@ Source: libmagic -Version: 5.37 +Version: 5.37-1 Homepage: https://github.com/file/file Description: This library can be used to classify files according to magic number tests. \ No newline at end of file diff --git a/ports/libmagic/portfile.cmake b/ports/libmagic/portfile.cmake index 8eabf13b7a..65fe8d8ab6 100644 --- a/ports/libmagic/portfile.cmake +++ b/ports/libmagic/portfile.cmake @@ -1,5 +1,3 @@ -vcpkg_fail_port_install(MESSAGE "${PORT} currently only supports Linux and Mac platform" ON_TARGET "Windows") - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO file/file @@ -10,11 +8,8 @@ vcpkg_from_github( vcpkg_configure_make( SOURCE_PATH ${SOURCE_PATH} - AUTOCONFIG ) - vcpkg_install_make() - vcpkg_copy_pdbs() if(VCPKG_LIBRARY_LINKAGE STREQUAL static) @@ -23,7 +18,7 @@ endif() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/man/man5) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/man5) # Handle copyright file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/libmesh/CONTROL b/ports/libmesh/CONTROL index f0efea8fcf..0350119c28 100644 --- a/ports/libmesh/CONTROL +++ b/ports/libmesh/CONTROL @@ -1,4 +1,4 @@ Source: libmesh -Version: 1.5.0 +Version: 1.5.0-1 Homepage: https://github.com/libMesh/libmesh Description: The libMesh library provides a framework for the numerical simulation of partial differential equations using arbitrary unstructured discretizations on serial and parallel platforms. A major goal of the library is to provide support for adaptive mesh refinement (AMR) computations in parallel while allowing a research scientist to focus on the physics they are modeling. diff --git a/ports/libmesh/portfile.cmake b/ports/libmesh/portfile.cmake index 97a86436d0..9a16dbf98b 100644 --- a/ports/libmesh/portfile.cmake +++ b/ports/libmesh/portfile.cmake @@ -1,5 +1,3 @@ -vcpkg_fail_port_install(MESSAGE "${PORT} currently only supports Linux platform" ON_TARGET "Windows") - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO libMesh/libmesh @@ -8,9 +6,18 @@ vcpkg_from_github( HEAD_REF master ) +if(VCPKG_TARGET_IS_WINDOWS) + set(OPTIONS --disable-qhull ) +endif() +# There a lot of configure options in this port which are not yet correctly handled by VCPKG +# To only mention two: +# --enable-vtk-required Error if VTK is not detected by configure +# --enable-capnp-required Error if Cap'n Proto support is not detected by +# but there are a lot more which need to be checked/fixed +# So this port can only be considered a Work In Progress vcpkg_configure_make( SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA + OPTIONS ${OPTIONS} ) vcpkg_install_make() diff --git a/ports/libosip2/CONTROL b/ports/libosip2/CONTROL index 2fe1f8b169..5d172511e3 100644 --- a/ports/libosip2/CONTROL +++ b/ports/libosip2/CONTROL @@ -1,5 +1,6 @@ Source: libosip2 -Version: 5.1.0-3 +Version: 5.1.0-4 Homepage: https://www.gnu.org/software/osip/ Description: oSIP is an LGPL implementation of SIP. It's stable, portable, flexible and compliant! -may be more-! It is used mostly with eXosip2 stack (GPL) which provides simpler API for User-Agent implementation. -Supports: !(windows|uwp) \ No newline at end of file +Build-Depends: pthread +Supports: !(windows|uwp) diff --git a/ports/libosip2/portfile.cmake b/ports/libosip2/portfile.cmake index 60b5c4558f..28321ff454 100644 --- a/ports/libosip2/portfile.cmake +++ b/ports/libosip2/portfile.cmake @@ -1,5 +1,3 @@ -vcpkg_fail_port_install(MESSAGE "${PORT} only supports Unix currently." ON_TARGET "Windows") - set(LIBOSIP2_VER "5.1.0") vcpkg_download_distfile(ARCHIVE @@ -13,24 +11,18 @@ vcpkg_extract_source_archive_ex( OUT_SOURCE_PATH SOURCE_PATH ) +if(VCPKG_TARGET_IS_WINDOWS) + set(OPTIONS --enable-mt=no) +endif() vcpkg_configure_make( SOURCE_PATH ${SOURCE_PATH} - NO_DEBUG - AUTO_HOST - AUTO_DST - PRERUN_SHELL autogen.sh + OPTIONS ${OPTIONS} ) vcpkg_install_make() - +vcpkg_fixup_pkgconfig() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -file(GLOB_RECURSE LIBOSIP2_BINARIES ${CURRENT_PACKAGES_DIR}/lib *.so) -foreach(LIBOSIP2_BINARY LIBOSIP2_BINARIES) - if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - file(COPY ${LIBOSIP2_BINARY} DESTINATION ${CURRENT_PACKAGES_DIR}/bin) - endif() - file(REMOVE ${LIBOSIP2_BINARY}) -endforeach() +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) # Handle copyright file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file diff --git a/ports/libpq/portfile.cmake b/ports/libpq/portfile.cmake index 2f0e1345d4..84cd6c8a22 100644 --- a/ports/libpq/portfile.cmake +++ b/ports/libpq/portfile.cmake @@ -247,8 +247,7 @@ if(VCPKG_TARGET_IS_WINDOWS) else() vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT}) endif() - #file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/${PORT}/) - #vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT}) + message(STATUS "Cleanup libpq ${TARGET_TRIPLET}... - done") else() if("${FEATURES}" MATCHES "openssl") @@ -262,21 +261,19 @@ else() endif() vcpkg_configure_make( SOURCE_PATH ${SOURCE_PATH} + COPY_SOURCE OPTIONS ${BUILD_OPTS} --with-includes=${CURRENT_INSTALLED_DIR}/include OPTIONS_RELEASE - --exec-prefix=${CURRENT_PACKAGES_DIR}/tools/${PORT} - --datarootdir=${CURRENT_PACKAGES_DIR}/share/${PORT} --with-libraries=${CURRENT_INSTALLED_DIR}/lib OPTIONS_DEBUG - --exec-prefix=${CURRENT_PACKAGES_DIR}/debug/tools/${PORT} - --datarootdir=${CURRENT_PACKAGES_DIR}/debug/share/${PORT} --with-libraries=${CURRENT_INSTALLED_DIR}/debug/lib --enable-debug ) vcpkg_install_make() + # instead? # make -C src/include install # make -C src/interfaces install diff --git a/ports/libudns/CONTROL b/ports/libudns/CONTROL index a78adfdf36..d9bb84f9e9 100644 --- a/ports/libudns/CONTROL +++ b/ports/libudns/CONTROL @@ -1,4 +1,4 @@ Source: libudns -Version: 0.4-1 +Version: 0.4-2 Homepage: https://github.com/ortclib/udns Description: The DNS library, udns, implements thread-safe stub DNS resolver functionality, which may be used both traditional, syncronous way and asyncronously, with application-supplied event loop. diff --git a/ports/libudns/ignore_unknown_options.patch b/ports/libudns/ignore_unknown_options.patch new file mode 100644 index 0000000000..4adbcf28cc --- /dev/null +++ b/ports/libudns/ignore_unknown_options.patch @@ -0,0 +1,26 @@ +diff --git a/configure b/configure +index dda98b3ab..6f5f8a3c8 100644 +--- a/configure ++++ b/configure +@@ -25,10 +25,9 @@ fi + enable() { + opt=`echo "$1" | sed 's/^--[^-]*-//'` + case "$opt" in +- ipv6) ;; +- *) echo "configure: unrecognized option \`$1'" >&2; exit 1;; ++ ipv6) eval enable_$opt=$2 ;; ++ *) echo "configure: unrecognized option \`$1'" >&2;; + esac +- eval enable_$opt=$2 + } + + while [ $# -gt 0 ]; do +@@ -50,7 +49,7 @@ Optional features (all enabled by default if system supports a feature): + EOF + exit 0 + ;; +- *) echo "configure: unknown option \`$1'" >&2; exit 1 ;; ++ *) echo "configure: unknown option \`$1'" >&2;; + esac + shift + done diff --git a/ports/libudns/portfile.cmake b/ports/libudns/portfile.cmake index 142dc32949..826c4c6c3c 100644 --- a/ports/libudns/portfile.cmake +++ b/ports/libudns/portfile.cmake @@ -1,4 +1,4 @@ -vcpkg_fail_port_install(MESSAGE "${PORT} currently only supports Linux platform" ON_TARGET "Windows" "OSX") +vcpkg_fail_port_install(MESSAGE "${PORT} currently only supports Linux platform" ON_TARGET "Windows" "OSX") vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH @@ -6,15 +6,16 @@ vcpkg_from_github( REF udns_0_4 SHA512 4df8def718c75872536d42a757237d6c8e0afce8a53aedd7fea73814dc5cf8b5d6c9ae8f01a8cfc76864aa8293c172f08953a6750a66749ba19a3721bb4cf2ec HEAD_REF master + PATCHES ignore_unknown_options.patch ) vcpkg_configure_make( SOURCE_PATH ${SOURCE_PATH} - DISABLE_AUTO_DST + COPY_SOURCE ) vcpkg_build_make() - +vcpkg_fixup_pkgconfig() # Install if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug) file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/libudns.a DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) diff --git a/ports/libwandio/CONTROL b/ports/libwandio/CONTROL index f41bf35ff7..5fc36ba357 100644 --- a/ports/libwandio/CONTROL +++ b/ports/libwandio/CONTROL @@ -1,4 +1,5 @@ Source: libwandio -Version: 4.2.1 +Version: 4.2.1-2 Homepage: https://github.com/wanduow/wandio -Description: C library for simple and efficient file IO. \ No newline at end of file +Description: C library for simple and efficient file IO. +Build-Depends: zlib, zstd, liblzma, lz4, curl, pthread, bzip2 \ No newline at end of file diff --git a/ports/libwandio/configure.lib.patch b/ports/libwandio/configure.lib.patch new file mode 100644 index 0000000000..57719581ea --- /dev/null +++ b/ports/libwandio/configure.lib.patch @@ -0,0 +1,140 @@ +diff --git a/configure.ac b/configure.ac +index 4579fbb3d..f6be008c8 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -112,10 +112,11 @@ AC_HEADER_STDC + AC_CHECK_HEADERS(stddef.h inttypes.h sys/prctl.h) + + # Checks for various "optional" libraries +-AC_CHECK_LIB(pthread, pthread_create, have_pthread=1, have_pthread=0) ++# AC_CHECK_LIB(pthread, pthread_create, have_pthread=1, have_pthread=0) ++AC_SEARCH_LIBS(pthread_create, [pthreadGC pthreadVC pthread], have_pthread=1, have_pthread=0) + + if test "$have_pthread" = 1; then +- LIBWANDIO_LIBS="$LIBWANDIO_LIBS -lpthread" ++ LIBWANDIO_LIBS="$LIBWANDIO_LIBS $ac_cv_search_pthread_create" + AC_DEFINE(HAVE_LIBPTHREAD, 1, [Set to 1 if pthreads are supported]) + fi + +@@ -128,12 +129,13 @@ AC_ARG_WITH([bzip2], + + AS_IF([test "x$with_bzip2" != "xno"], + [ +- AC_CHECK_LIB(bz2, BZ2_bzDecompressInit, have_bzip=yes, have_bzip=no) ++ AC_SEARCH_LIBS(BZ2_bzDecompressInit, [bz2 bz2d bzip2 bzip2d], have_bzip=yes, have_bzip=no) ++ # AC_CHECK_LIB(bz2, BZ2_bzDecompressInit, have_bzip=yes, have_bzip=no) + ], [have_bzip=no]) + + AS_IF([test "x$have_bzip" = "xyes"], [ +- if test "$ac_cv_lib_bz2_BZ2_bzDecompressInit" != "none required"; then +- LIBWANDIO_LIBS="$LIBWANDIO_LIBS -lbz2" ++ if test "$ac_cv_search_BZ2_bzDecompressInit" != "none required"; then ++ LIBWANDIO_LIBS="$LIBWANDIO_LIBS $ac_cv_search_BZ2_bzDecompressInit" + fi + with_bzip2=yes + AC_DEFINE(HAVE_LIBBZ2, 1, "Compiled with bzip2 support")], +@@ -149,12 +151,13 @@ AC_ARG_WITH([zlib], + + AS_IF([test "x$with_zlib" != "xno"], + [ +- AC_CHECK_LIB(z, deflate, have_zlib=yes, have_zlib=no) ++ AC_SEARCH_LIBS(deflate, [z zlib zlibd zd], have_zlib=yes, have_zlib=no) ++ # AC_CHECK_LIB(z, deflate, have_zlib=yes, have_zlib=no) + ], [have_zlib=no]) + + AS_IF([test "x$have_zlib" = "xyes"], [ +- if test "$ac_cv_lib_z_deflate" != "none required"; then +- LIBWANDIO_LIBS="$LIBWANDIO_LIBS -lz" ++ if test "$ac_cv_search_deflate" != "none required"; then ++ LIBWANDIO_LIBS="$LIBWANDIO_LIBS $ac_cv_search_deflate" + fi + AC_DEFINE(HAVE_LIBZ, 1, "Compiled with zlib support") + with_zlib=yes], +@@ -193,12 +196,13 @@ AC_ARG_WITH([lzma], + + AS_IF([test "x$with_lzma" != "xno"], + [ +- AC_CHECK_HEADER(lzma.h, have_lzma=yes, have_lzma=no) ++ # AC_CHECK_HEADER(lzma.h, have_lzma=yes, have_lzma=no) ++ AC_SEARCH_LIBS(lzma_free, [lzma lzmad], have_lzma=yes, have_lzma=no) + ], [have_lzma=no]) + + AS_IF([test "x$have_lzma" = "xyes"], [ +- if test "$ac_cv_lib_lzma_code" != "none required"; then +- LIBWANDIO_LIBS="$LIBWANDIO_LIBS -llzma" ++ if test "$ac_cv_search_lzma_free" != "none required"; then ++ LIBWANDIO_LIBS="$LIBWANDIO_LIBS $ac_cv_search_lzma_free" + fi + AC_DEFINE(HAVE_LIBLZMA, 1, "Compiled with lzma support") + with_lzma=yes], +@@ -215,12 +219,13 @@ AC_ARG_WITH([zstd], + + AS_IF([test "x$with_zstd" != "xno"], + [ +- AC_CHECK_LIB(zstd, ZSTD_createDStream, have_zstd=yes, have_zstd=no) ++ AC_SEARCH_LIBS(ZSTD_createDStream, [zstd zstdd], have_zstd=yes, have_zstd=no) ++ # AC_CHECK_LIB(zstd, ZSTD_createDStream, have_zstd=yes, have_zstd=no) + ], [have_zstd=no]) + + AS_IF([test "x$have_zstd" = "xyes"], [ +- if test "$ac_cv_lib_zstd_code" != "none required"; then +- LIBWANDIO_LIBS="$LIBWANDIO_LIBS -lzstd" ++ if test "$ac_cv_search_ZSTD_createDStream" != "none required"; then ++ LIBWANDIO_LIBS="$LIBWANDIO_LIBS $ac_cv_search_ZSTD_createDStream" + fi + AC_DEFINE(HAVE_LIBZSTD, 1, "Compiled with zstd support") + with_zstd=yes], +@@ -259,25 +264,28 @@ AC_ARG_WITH([lz4], + + AS_IF([test "x$with_lz4" != "xno"], + [ +- AC_CHECK_LIB(lz4, LZ4F_createDecompressionContext, have_lz4f=yes, have_lz4f=no) ++ AC_SEARCH_LIBS(LZ4F_createDecompressionContext, [lz4 lz4d], have_lz4f=yes, have_lz4f=no) ++ # AC_CHECK_LIB(lz4, LZ4F_createDecompressionContext, have_lz4f=yes, have_lz4f=no) + ], [have_zstd=no]) + + AS_IF([test "x$have_lz4f" = "xyes"], [ +- if test "$ac_cv_lib_lz4_code" != "none required"; then +- LIBWANDIO_LIBS="$LIBWANDIO_LIBS -llz4" ++ if test "$ac_cv_search_LZ4F_createDecompressionContext" != "none required"; then ++ LIBWANDIO_LIBS="$LIBWANDIO_LIBS $ac_cv_search_LZ4F_createDecompressionContext" + fi + AC_DEFINE(HAVE_LIBLZ4F, 1, "Compiled with lz4 frame support") +- AC_CHECK_LIB(lz4, LZ4F_getVersion, have_lz4_173=yes, have_lz4_173=no) ++ AC_SEARCH_LIBS(LZ4F_getVersion, [lz4 lz4d], have_lz4_173=yes, have_lz4_173=no) ++ # AC_CHECK_LIB(lz4, LZ4F_getVersion, have_lz4_173=yes, have_lz4_173=no) + if test "x$have_lz4_173" = "xyes"; then + AC_DEFINE(HAVE_LIBLZ4_MOVABLE, 1, "If defined then liblz4 does NOT have the ERROR_srcPtr_wrong bug") + fi + with_lz4=frameapi], + [ + AC_DEFINE(HAVE_LIBLZ4F, 0, "Compiled with lz4 frame support") +- AC_CHECK_LIB(lz4, LZ4_decompress_safe_continue, have_lz4s=yes, have_lz4s=no) ++ AC_SEARCH_LIBS(LZ4_decompress_safe_continue, [lz4 lz4d], have_lz4s=yes, have_lz4s=no) ++ # AC_CHECK_LIB(lz4, LZ4_decompress_safe_continue, have_lz4s=yes, have_lz4s=no) + AS_IF([test "x$have_lz4s" = "xyes"], [ +- if test "$ac_cv_lib_lz4_code" != "none required"; then +- LIBWANDIO_LIBS="$LIBWANDIO_LIBS -llz4" ++ if test "$ac_cv_search_LZ4_decompress_safe_continue" != "none required"; then ++ LIBWANDIO_LIBS="$LIBWANDIO_LIBS $ac_cv_search_LZ4_decompress_safe_continue" + fi + AC_DEFINE(HAVE_LIBLZ4S, 1, "Compiled with lz4 stream support") + with_lz4=streamapi +@@ -296,12 +304,14 @@ AC_ARG_WITH([http], + AS_IF([test "x$with_http" != "xno"], + [ + # we need curl_easy_pause which was added in 7.18.0 +- AC_CHECK_LIB(curl, curl_easy_pause, have_curl=yes, have_curl=no) ++ AC_SEARCH_LIBS(curl_easy_pause, [curl curl-d], have_curl=yes, have_curl=no, [-lssl -lcrypto $ac_cv_search_pthread_create -ldl]) ++ # AC_CHECK_LIB(curl, curl_easy_pause, have_curl=yes, have_curl=no) + ], [have_curl=no]) + + AS_IF([test "x$have_curl" = "xyes"], [ +- if test "$ac_cv_lib_curl_curl_easy_pause" != "none required"; then +- LIBWANDIO_LIBS="$LIBWANDIO_LIBS -lcurl" ++ if test "$ac_cv_search_curl_easy_pause" != "none required"; then ++ LIBWANDIO_LIBS="$LIBWANDIO_LIBS $ac_cv_search_curl_easy_pause -lssl -lcrypto $ac_cv_search_pthread_create -ldl" ++ LIBS="$LIBS -lssl -lcrypto $ac_cv_search_pthread_create -ldl" + fi + AC_DEFINE(HAVE_HTTP, 1, "Compiled with http support") + with_http=yes], diff --git a/ports/libwandio/portfile.cmake b/ports/libwandio/portfile.cmake index 20ccce13db..c9be34be64 100644 --- a/ports/libwandio/portfile.cmake +++ b/ports/libwandio/portfile.cmake @@ -1,18 +1,16 @@ -vcpkg_fail_port_install(MESSAGE "${PORT} currently only supports Linux and Mac platform" ON_TARGET "Windows") - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO wanduow/wandio REF 012b646e7ba7ab191a5a2206488adfac493fcdc6 SHA512 e94a82038902c34933c4256f8bd4d7ef3f2cf32fea46f8e31a25df34cc90d3a275ff56d3bc9892aca0c85e6d875e696f96a836cc1444fe165db8364331e6e77d HEAD_REF master + PATCHES configure.lib.patch # This is how configure.ac files with dependencies get fixed. ) vcpkg_configure_make( SOURCE_PATH ${SOURCE_PATH} - AUTOCONFIG + COPY_SOURCE ) - vcpkg_install_make() if(VCPKG_LIBRARY_LINKAGE STREQUAL static) diff --git a/ports/libxslt/CONTROL b/ports/libxslt/CONTROL index 1320ee2cde..38eea5f1a7 100644 --- a/ports/libxslt/CONTROL +++ b/ports/libxslt/CONTROL @@ -1,5 +1,5 @@ Source: libxslt -Version: 1.1.33-6 +Version: 1.1.33-7 Homepage: https://github.com/GNOME/libxslt Description: Libxslt is a XSLT library implemented in C for XSLT 1.0 and most of EXSLT Build-Depends: libxml2, liblzma diff --git a/ports/libxslt/portfile.cmake b/ports/libxslt/portfile.cmake index 5ab963bff9..c3296f0fe6 100644 --- a/ports/libxslt/portfile.cmake +++ b/ports/libxslt/portfile.cmake @@ -1,5 +1,3 @@ -include(vcpkg_common_functions) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO GNOME/libxslt @@ -105,6 +103,7 @@ else() ) vcpkg_install_make() + #vcpkg_fixup_pkgconfig()? if (EXISTS ${CURRENT_PACKAGES_DIR}/bin/xslt-config) file(COPY ${CURRENT_PACKAGES_DIR}/bin/xslt-config DESTINATION ${CURRENT_PACKAGES_DIR}/tools) diff --git a/ports/pfring/CONTROL b/ports/pfring/CONTROL index 157c9879f3..edddaa9a5d 100644 --- a/ports/pfring/CONTROL +++ b/ports/pfring/CONTROL @@ -1,5 +1,5 @@ Source: pfring -Version: 2019-10-17-1 +Version: 2019-10-17-2 Homepage: https://github.com/ntop/PF_RING Description: PF_RING™ is a Linux kernel module and user-space framework that allows you to process packets at high-rates while providing you a consistent API for packet processing applications. Build-Depends: libpcap diff --git a/ports/pfring/makefile.patch b/ports/pfring/makefile.patch new file mode 100644 index 0000000000..cc17fb1f7f --- /dev/null +++ b/ports/pfring/makefile.patch @@ -0,0 +1,59 @@ +diff --git a/Makefile b/Makefile +index 4b377c628..39cbf5cb4 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,10 +1,12 @@ + all: +- cd kernel; make +- cd userland; ./configure; make +- cd drivers; make ++ $(MAKE) -C kernel; ++ #cd kernel; make ++ cd userland; ./configure; ++ $(MAKE) -C userland; ++ $(MAKE) -C drivers; + + install: +- cd userland; make install ++ $(MAKE) install -C userland; + + clean: + -cd kernel; make clean +diff --git a/userland/Makefile b/userland/Makefile +index 959470c0f..e35ca8de7 100644 +--- a/userland/Makefile ++++ b/userland/Makefile +@@ -9,22 +9,22 @@ lib/Makefile: + config: lib/Makefile + + libpfring: config +- cd lib; make ++ $(MAKE) -C lib + + build_nbpf: config +- cd nbpf; make ++ $(MAKE) -C nbpf + + build_c++: libpfring +- cd c++; make ++ $(MAKE) -C c++ + + tcpdump/Makefile: + cd tcpdump; ./configure --with_system_libpcap=yes + + build_tcpdump: libpfring tcpdump/Makefile +- cd tcpdump; make ++ $(MAKE) -C tcpdump + + build_extcap: libpfring +- cd wireshark/extcap; make ++ $(MAKE) -C wireshark/extcap + + ################### + +@@ -46,4 +46,4 @@ extcap_clean: + cd wireshark/extcap; make clean + + install: libpfring +- cd lib; make install ++ $(MAKE) -C lib install diff --git a/ports/pfring/portfile.cmake b/ports/pfring/portfile.cmake index 0df34b4753..967bdc5eeb 100644 --- a/ports/pfring/portfile.cmake +++ b/ports/pfring/portfile.cmake @@ -1,4 +1,4 @@ -vcpkg_fail_port_install(MESSAGE "${PORT} currently only supports Linux and Mac platforms" ON_TARGET "Windows") +vcpkg_fail_port_install(MESSAGE "${PORT} currently only supports Linux and Mac platforms" ON_TARGET "Windows") vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH @@ -8,16 +8,20 @@ vcpkg_from_github( HEAD_REF dev PATCHES use-vcpkg-libpcap.patch + makefile.patch ) - -vcpkg_configure_make( - SOURCE_PATH ${SOURCE_PATH} - SKIP_CONFIGURE -) - + +file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(COPY "${SOURCE_PATH}/" DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") +endif() +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(COPY "${SOURCE_PATH}/" DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") +endif() set(ENV{VCPKG_LIBPCAP_DIR} "${CURRENT_INSTALLED_DIR}") - vcpkg_build_make() +vcpkg_fixup_pkgconfig() + vcpkg_copy_pdbs() # Install manually because pfring cannot set prefix diff --git a/ports/sdl1/CONTROL b/ports/sdl1/CONTROL index a313ab982f..d34e89ad00 100644 --- a/ports/sdl1/CONTROL +++ b/ports/sdl1/CONTROL @@ -1,4 +1,4 @@ Source: sdl1 -Version: 1.2.15-10 +Version: 1.2.15-11 Homepage: https://www.libsdl.org Description: Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. diff --git a/ports/sdl1/portfile.cmake b/ports/sdl1/portfile.cmake index 999b616e69..e84582bf0a 100644 --- a/ports/sdl1/portfile.cmake +++ b/ports/sdl1/portfile.cmake @@ -52,28 +52,13 @@ if (VCPKG_TARGET_IS_WINDOWS) endif() else() message("libgles2-mesa-dev must be installed before sdl1 can build. Install it with \"apt install libgles2-mesa-dev\".") - - if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - set(BUILD_SHARED yes) - set(BUILD_STATIC no) - else() - set(BUILD_SHARED no) - set(BUILD_STATIC yes) - endif() - file(REMOVE_RECURSE ${SOURCE_PATH}/m4) - file(MAKE_DIRECTORY ${SOURCE_PATH}/m4) - vcpkg_configure_make( - SOURCE_PATH ${SOURCE_PATH} - NO_DEBUG - PRERUN_SHELL autogen.sh - OPTIONS - --enable-shared=${BUILD_SHARED} - --enable-static=${BUILD_STATIC} + SOURCE_PATH ${SOURCE_PATH} ) vcpkg_install_make() + vcpkg_fixup_pkgconfig(IGNORE_FLAGS -Wl,-rpath,\${libdir} SYSTEM_LIBRARIES -lm -ldl -lpthread) file(GLOB SDL1_TOOLS "${CURRENT_PACKAGES_DIR}/bin/*") foreach (SDL1_TOOL ${SDL1_TOOLS}) @@ -83,4 +68,5 @@ else() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") endif() \ No newline at end of file diff --git a/ports/tcl/CONTROL b/ports/tcl/CONTROL index 7bf3da0700..7a74eafaf3 100644 --- a/ports/tcl/CONTROL +++ b/ports/tcl/CONTROL @@ -1,5 +1,5 @@ Source: tcl -Version: 8.6.10-3 +Version: core-9-0-a1 Homepage: https://github.com/tcltk/tcl Description: Tcl provides a powerful platform for creating integration applications that tie together diverse applications, protocols, devices, and frameworks. When paired with the Tk toolkit, Tcl provides the fastest and most powerful way to create GUI applications that run on PCs, Unix, and Mac OS X. Tcl can also be used for a variety of web-related tasks and for creating powerful command languages for applications. diff --git a/ports/tcl/portfile.cmake b/ports/tcl/portfile.cmake index 9109ffd34a..6e2757f339 100644 --- a/ports/tcl/portfile.cmake +++ b/ports/tcl/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO tcltk/tcl - REF 2abfa2c03ddc0419e6525f86c2c0323b2ba1932e - SHA512 d9bc83c389cf3b95ab64b75c57eb9a2b23b957503d2dadc2d3f6854e9e784d87d9b2059a82f35accb419693bfe675b523c4751af91efac700644e118ff689fd7) + REF 0fa6a4e5aad821a5c34fdfa070c37c3f1ffc8c8e + SHA512 9d7f35309fe8b1a7c116639aaea50cc01699787c7afb432389bee2b9ad56a67034c45d90c9585ef1ccf15bdabf0951cbef86257c0c6aedbd2591bbfae3e93b76) if (VCPKG_TARGET_IS_WINDOWS) if(VCPKG_TARGET_ARCHITECTURE MATCHES "x64") @@ -92,13 +92,14 @@ if (VCPKG_TARGET_IS_WINDOWS) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) else() + file(REMOVE "${SOURCE_PATH}/unix/configure") vcpkg_configure_make( SOURCE_PATH ${SOURCE_PATH} - NO_DEBUG PROJECT_SUBPATH unix ) vcpkg_install_make() + vcpkg_fixup_pkgconfig() if(VCPKG_LIBRARY_LINKAGE STREQUAL static) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) diff --git a/ports/x264/CONTROL b/ports/x264/CONTROL index 58dab0c35d..b49bf0a772 100644 --- a/ports/x264/CONTROL +++ b/ports/x264/CONTROL @@ -1,4 +1,5 @@ Source: x264 -Version: 157-303c484ec828ed0-7 +Version: 157-303c484ec828ed0-8 Homepage: https://github.com/mirror/x264 -Description: x264 is a free software library and application for encoding video streams into the H.264/MPEG-4 AVC compression format \ No newline at end of file +Description: x264 is a free software library and application for encoding video streams into the H.264/MPEG-4 AVC compression format +Build-Depends: pthread (linux&osx) \ No newline at end of file diff --git a/ports/x264/portfile.cmake b/ports/x264/portfile.cmake index d1ed982a5e..d7aff89d7b 100644 --- a/ports/x264/portfile.cmake +++ b/ports/x264/portfile.cmake @@ -1,6 +1,6 @@ set(X264_VERSION 157) -vcpkg_fail_port_install(ON_TARGET "Linux" "OSX") +vcpkg_fail_port_install(ON_TARGET "OSX") vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH @@ -27,11 +27,7 @@ vcpkg_configure_make( ) vcpkg_install_make() - -if(NOT VCPKG_TARGET_IS_UWP) - file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/x264) - file(RENAME ${CURRENT_PACKAGES_DIR}/bin/x264.exe ${CURRENT_PACKAGES_DIR}/tools/x264/x264.exe) -endif() +vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES -lpthread -lm -ldl) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig @@ -57,4 +53,4 @@ endif() vcpkg_copy_pdbs() -file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 644a7e897c..aed1567bc3 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1955,7 +1955,6 @@ wxwidgets:x64-linux=fail x264:arm64-windows=fail x264:arm-uwp=fail x264:x64-uwp=ignore -x264:x64-linux=fail x264:x64-osx=fail x264:x86-windows=ignore x264:x64-windows=ignore diff --git a/scripts/cmake/vcpkg_build_make.cmake b/scripts/cmake/vcpkg_build_make.cmake index 202ef33f41..5d1b8d6365 100644 --- a/scripts/cmake/vcpkg_build_make.cmake +++ b/scripts/cmake/vcpkg_build_make.cmake @@ -4,16 +4,26 @@ ## ## ## Usage: ## ```cmake -## vcpkg_build_make([TARGET ]) +## vcpkg_build_make([BUILD_TARGET ] +## [ADD_BIN_TO_PATH] +## [ENABLE_INSTALL]) +## [LOGFILE_ROOT ]) ## ``` ## -## ### TARGET -## The target passed to the configure/make build command (`./configure/make/make install`). If not specified, no target will +## ### BUILD_TARGET +## The target passed to the make build command (`./make `). If not specified, the 'all' target will ## be passed. ## ## ### ADD_BIN_TO_PATH ## Adds the appropriate Release and Debug `bin\` directories to the path during the build such that executables can run against the in-tree DLLs. ## +## ### ENABLE_INSTALL +## IF the port supports the install target use vcpkg_install_make() instead of vcpkg_build_make() +## +## ### BUILD_TARGET +## The target passed to the make build command (`./make `). If not specified, the 'all' target will +## be passed. +## ## ## Notes: ## This command should be preceeded by a call to [`vcpkg_configure_make()`](vcpkg_configure_make.md). ## You can use the alias [`vcpkg_install_make()`](vcpkg_configure_make.md) function if your CMake script supports the @@ -26,60 +36,93 @@ ## * [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake) ## * [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake) function(vcpkg_build_make) - cmake_parse_arguments(_bc "ADD_BIN_TO_PATH;ENABLE_INSTALL" "LOGFILE_ROOT" "" ${ARGN}) + cmake_parse_arguments(_bc "ADD_BIN_TO_PATH;ENABLE_INSTALL" "LOGFILE_ROOT;BUILD_TARGET" "" ${ARGN}) if(NOT _bc_LOGFILE_ROOT) set(_bc_LOGFILE_ROOT "build") endif() - - if (_VCPKG_PROJECT_SUBPATH) - set(_VCPKG_PROJECT_SUBPATH /${_VCPKG_PROJECT_SUBPATH}/) + + if(NOT _bc_BUILD_TARGET) + set(_bc_BUILD_TARGET "all") endif() - + + if(WIN32) + set(_VCPKG_PREFIX ${CURRENT_PACKAGES_DIR}) + set(_VCPKG_INSTALLED ${CURRENT_INSTALLED_DIR}) + else() + string(REPLACE " " "\ " _VCPKG_PREFIX "${CURRENT_PACKAGES_DIR}") + string(REPLACE " " "\ " _VCPKG_INSTALLED "${CURRENT_INSTALLED_DIR}") + endif() + set(MAKE ) set(MAKE_OPTS ) set(INSTALL_OPTS ) - if (_VCPKG_MAKE_GENERATOR STREQUAL "make") - if (CMAKE_HOST_WIN32) - # Compiler requriements - vcpkg_find_acquire_program(YASM) - vcpkg_find_acquire_program(PERL) - vcpkg_acquire_msys(MSYS_ROOT PACKAGES make) - get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) - get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) - - set(PATH_GLOBAL "$ENV{PATH}") - set(ENV{PATH} "$ENV{PATH};${YASM_EXE_PATH};${MSYS_ROOT}/usr/bin;${PERL_EXE_PATH}") - set(BASH ${MSYS_ROOT}/usr/bin/bash.exe) - # Set make command and install command - set(MAKE ${BASH} --noprofile --norc -c "${_VCPKG_PROJECT_SUBPATH}make") - # Must use absolute path to call make in windows - set(MAKE_OPTS -j ${VCPKG_CONCURRENCY}) - set(INSTALL_OPTS install -j ${VCPKG_CONCURRENCY}) - else() - # Compiler requriements - find_program(MAKE make REQUIRED) - set(MAKE make;) - # Set make command and install command - set(MAKE_OPTS -j;${VCPKG_CONCURRENCY}) - set(INSTALL_OPTS install;-j;${VCPKG_CONCURRENCY}) - endif() - elseif (_VCPKG_MAKE_GENERATOR STREQUAL "nmake") - find_program(NMAKE nmake REQUIRED) - get_filename_component(NMAKE_EXE_PATH ${NMAKE} DIRECTORY) + if (CMAKE_HOST_WIN32) set(PATH_GLOBAL "$ENV{PATH}") - set(ENV{PATH} "$ENV{PATH};${NMAKE_EXE_PATH}") - set(ENV{CL} "$ENV{CL} /MP") - # Set make command and install command - set(MAKE ${NMAKE} /NOLOGO /G /U) - set(MAKE_OPTS -f makefile all) - set(INSTALL_OPTS install) + # These should be moved into the portfile! + # vcpkg_find_acquire_program(YASM) + # get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) + # vcpkg_add_to_path("${YASM_EXE_PATH}") + # vcpkg_find_acquire_program(PERL) + # get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) + # vcpkg_add_to_path("${PERL_EXE_PATH}") + + vcpkg_add_to_path(PREPEND "${SCRIPTS}/buildsystems/make_wrapper") + vcpkg_acquire_msys(MSYS_ROOT) + find_program(MAKE make REQUIRED) #mingw32-make + set(MAKE_COMMAND "${MAKE}") + set(MAKE_OPTS ${_bc_MAKE_OPTIONS} -j ${VCPKG_CONCURRENCY} --trace -f Makefile ${_bc_BUILD_TARGET}) + + string(REPLACE " " "\\\ " _VCPKG_PACKAGE_PREFIX ${CURRENT_PACKAGES_DIR}) + string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_PACKAGE_PREFIX "${_VCPKG_PACKAGE_PREFIX}") + set(INSTALL_OPTS -j ${VCPKG_CONCURRENCY} --trace -f Makefile install DESTDIR=${_VCPKG_PACKAGE_PREFIX}) + #TODO: optimize for install-data (release) and install-exec (release/debug) else() - message(FATAL_ERROR "${_VCPKG_MAKE_GENERATOR} not supported.") + # Compiler requriements + # set(MAKE_BASH) + find_program(MAKE make REQUIRED) + set(MAKE_COMMAND "${MAKE}") + # Set make command and install command + set(MAKE_OPTS ${_bc_MAKE_OPTIONS} V=1 -j ${VCPKG_CONCURRENCY} -f Makefile ${_bc_BUILD_TARGET}) + set(INSTALL_OPTS -j ${VCPKG_CONCURRENCY} install DESTDIR=${CURRENT_PACKAGES_DIR}) endif() - set(ENV{INCLUDE} "${CURRENT_INSTALLED_DIR}/include;$ENV{INCLUDE}") + # Backup enviromnent variables + set(C_FLAGS_BACKUP "$ENV{CFLAGS}") + set(CXX_FLAGS_BACKUP "$ENV{CXXFLAGS}") + set(LD_FLAGS_BACKUP "$ENV{LDFLAGS}") + set(INCLUDE_PATH_BACKUP "$ENV{INCLUDE_PATH}") + set(INCLUDE_BACKUP "$ENV{INCLUDE}") + set(C_INCLUDE_PATH_BACKUP "$ENV{C_INCLUDE_PATH}") + set(CPLUS_INCLUDE_PATH_BACKUP "$ENV{CPLUS_INCLUDE_PATH}") + _vcpkg_backup_env_variable(LD_LIBRARY_PATH) + _vcpkg_backup_env_variable(LIBRARY_PATH) + set(LIBPATH_BACKUP "$ENV{LIBPATH}") + # Setup include enviromnent + set(ENV{INCLUDE} "${_VCPKG_INSTALLED}/include${VCPKG_HOST_PATH_SEPARATOR}${INCLUDE_BACKUP}") + set(ENV{INCLUDE_PATH} "${_VCPKG_INSTALLED}/include${VCPKG_HOST_PATH_SEPARATOR}${INCLUDE_PATH_BACKUP}") + set(ENV{C_INCLUDE_PATH} "${_VCPKG_INSTALLED}/include${VCPKG_HOST_PATH_SEPARATOR}${C_INCLUDE_PATH_BACKUP}") + set(ENV{CPLUS_INCLUDE_PATH} "${_VCPKG_INSTALLED}/include${VCPKG_HOST_PATH_SEPARATOR}${CPLUS_INCLUDE_PATH_BACKUP}") + + # Setup global flags + set(C_FLAGS_GLOBAL "$ENV{CFLAGS} ${VCPKG_C_FLAGS}") + set(CXX_FLAGS_GLOBAL "$ENV{CXXFLAGS} ${VCPKG_CXX_FLAGS}") + set(LD_FLAGS_GLOBAL "$ENV{LDFLAGS} ${VCPKG_LINKER_FLAGS}") + if(NOT VCPKG_TARGET_IS_WINDOWS) + string(APPEND C_FLAGS_GLOBAL " -fPIC") + string(APPEND CXX_FLAGS_GLOBAL " -fPIC") + else() + string(APPEND C_FLAGS_GLOBAL " /D_WIN32_WINNT=0x0601 /DWIN32_LEAN_AND_MEAN /DWIN32 /D_WINDOWS") + string(APPEND CXX_FLAGS_GLOBAL " /D_WIN32_WINNT=0x0601 /DWIN32_LEAN_AND_MEAN /DWIN32 /D_WINDOWS") + string(APPEND LD_FLAGS_GLOBAL " /VERBOSE -no-undefined") + if(VCPKG_TARGET_ARCHITECTURE STREQUAL x64) + string(APPEND LD_FLAGS_GLOBAL " /machine:x64") + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x86) + string(APPEND LD_FLAGS_GLOBAL " /machine:x86") + endif() + endif() + foreach(BUILDTYPE "debug" "release") if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL BUILDTYPE) if(BUILDTYPE STREQUAL "debug") @@ -88,6 +131,7 @@ function(vcpkg_build_make) continue() endif() set(SHORT_BUILDTYPE "-dbg") + set(CMAKE_BUILDTYPE "DEBUG") else() # In NO_DEBUG mode, we only use ${TARGET_TRIPLET} directory. if (_VCPKG_NO_DEBUG) @@ -95,51 +139,76 @@ function(vcpkg_build_make) else() set(SHORT_BUILDTYPE "-rel") endif() + set(CMAKE_BUILDTYPE "RELEASE") endif() - if (CMAKE_HOST_WIN32) - # In windows we can remotely call make - set(WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${SHORT_BUILDTYPE}) - else() - set(WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${SHORT_BUILDTYPE}${_VCPKG_PROJECT_SUBPATH}) - endif() - + set(WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${SHORT_BUILDTYPE}") + message(STATUS "Building ${TARGET_TRIPLET}${SHORT_BUILDTYPE}") if(_bc_ADD_BIN_TO_PATH) set(_BACKUP_ENV_PATH "$ENV{PATH}") - if(CMAKE_HOST_WIN32) - set(_PATHSEP ";") - else() - set(_PATHSEP ":") - endif() if(BUILDTYPE STREQUAL "debug") - set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin${_PATHSEP}$ENV{PATH}") + vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin") else() - set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin${_PATHSEP}$ENV{PATH}") + vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin") endif() endif() if (CMAKE_HOST_WIN32) - vcpkg_execute_build_process( - COMMAND "${MAKE} ${MAKE_OPTS}" - WORKING_DIRECTORY ${WORKING_DIRECTORY} - LOGNAME "${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}${SHORT_BUILDTYPE}" - ) + set(TMP_CFLAGS "${C_FLAGS_GLOBAL} ${VCPKG_C_FLAGS_${CMAKE_BUILDTYPE}}") + string(REGEX REPLACE "[ \t]+/" " -" TMP_CFLAGS "${TMP_CFLAGS}") + set(ENV{CFLAGS} ${TMP_CFLAGS}) + + set(TMP_CXXFLAGS "${CXX_FLAGS_GLOBAL} ${VCPKG_CXX_FLAGS_${CMAKE_BUILDTYPE}}") + string(REGEX REPLACE "[ \t]+/" " -" TMP_CXXFLAGS "${TMP_CXXFLAGS}") + set(ENV{CXXFLAGS} ${TMP_CXXFLAGS}) + + set(TMP_LDFLAGS "${LD_FLAGS_GLOBAL} ${VCPKG_LINKER_FLAGS_${CMAKE_BUILDTYPE}}") + string(REGEX REPLACE "[ \t]+/" " -" TMP_LDFLAGS "${TMP_LDFLAGS}") + set(ENV{LDFLAGS} ${TMP_LDFLAGS}) + + string(REPLACE " " "\ " _VCPKG_INSTALLED_PKGCONF "${CURRENT_INSTALLED_DIR}") + string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_INSTALLED_PKGCONF "${_VCPKG_INSTALLED_PKGCONF}") + string(REPLACE "\\" "/" _VCPKG_INSTALLED_PKGCONF "${_VCPKG_INSTALLED_PKGCONF}") + if(BUILDTYPE STREQUAL "debug") + set(ENV{VCPKG_PKG_PREFIX} ${_VCPKG_INSTALLED_PKGCONF}/debug) + else() + set(ENV{VCPKG_PKG_PREFIX} ${_VCPKG_INSTALLED_PKGCONF}) + endif() + else() - vcpkg_execute_build_process( - COMMAND "${MAKE};${MAKE_OPTS}" - WORKING_DIRECTORY ${WORKING_DIRECTORY} + set(ENV{CFLAGS} "${C_FLAGS_GLOBAL} ${VCPKG_C_FLAGS_${CMAKE_BUILDTYPE}}") + set(ENV{CXXFLAGS} "${CXX_FLAGS_GLOBAL} ${VCPKG_CXX_FLAGS_${CMAKE_BUILDTYPE}}") + + if(BUILDTYPE STREQUAL "debug") + set(ENV{LDFLAGS} "-L${_VCPKG_INSTALLED}/debug/lib/ -L${_VCPKG_INSTALLED}/debug/lib/manual-link/ ${LD_FLAGS_GLOBAL} ${VCPKG_LINKER_FLAGS_${CMAKE_BUILDTYPE}}") + set(ENV{LIBRARY_PATH} "${_VCPKG_INSTALLED}/debug/lib/${VCPKG_HOST_PATH_SEPARATOR}${_VCPKG_INSTALLED}/debug/lib/manual-link/${LIBRARY_PATH_PATHLIKE_CONCAT}") + set(ENV{LD_LIBRARY_PATH} "${_VCPKG_INSTALLED}/debug/lib/${VCPKG_HOST_PATH_SEPARATOR}${_VCPKG_INSTALLED}/debug/lib/manual-link/${LD_LIBRARY_PATH_PATHLIKE_CONCAT}") + else() + set(ENV{LDFLAGS} "-L${_VCPKG_INSTALLED}/lib/ -L${_VCPKG_INSTALLED}/lib/manual-link/ ${LD_FLAGS_GLOBAL} ${VCPKG_LINKER_FLAGS_${CMAKE_BUILDTYPE}}") + set(ENV{LIBRARY_PATH} "${_VCPKG_INSTALLED}/lib/${VCPKG_HOST_PATH_SEPARATOR}${_VCPKG_INSTALLED}/lib/manual-link/${LIBRARY_PATH_PATHLIKE_CONCAT}") + set(ENV{LD_LIBRARY_PATH} "${_VCPKG_INSTALLED}/lib/${VCPKG_HOST_PATH_SEPARATOR}${_VCPKG_INSTALLED}/lib/manual-link/${LD_LIBRARY_PATH_PATHLIKE_CONCAT}") + endif() + endif() + + if(MAKE_BASH) + set(MAKE_CMD_LINE "${MAKE_COMMAND} ${MAKE_OPTS}") + else() + set(MAKE_CMD_LINE ${MAKE_COMMAND} ${MAKE_OPTS}) + endif() + vcpkg_execute_build_process( + COMMAND ${MAKE_BASH} ${MAKE_CMD_LINE} + WORKING_DIRECTORY "${WORKING_DIRECTORY}" LOGNAME "${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}${SHORT_BUILDTYPE}" ) - endif() - + if(_bc_ADD_BIN_TO_PATH) set(ENV{PATH} "${_BACKUP_ENV_PATH}") endif() endif() endforeach() - + if (_bc_ENABLE_INSTALL) foreach(BUILDTYPE "debug" "release") if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL BUILDTYPE) @@ -159,27 +228,44 @@ function(vcpkg_build_make) endif() message(STATUS "Installing ${TARGET_TRIPLET}${SHORT_BUILDTYPE}") - if (CMAKE_HOST_WIN32) - # In windows we can remotely call make - set(WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${SHORT_BUILDTYPE}) - vcpkg_execute_build_process( - COMMAND "${MAKE} ${INSTALL_OPTS}" - WORKING_DIRECTORY ${WORKING_DIRECTORY} - LOGNAME "install-${TARGET_TRIPLET}${SHORT_BUILDTYPE}" - ) + + if(MAKE_BASH) + set(MAKE_CMD_LINE "${MAKE_COMMAND} ${INSTALL_OPTS}") else() - set(WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${SHORT_BUILDTYPE}${_VCPKG_PROJECT_SUBPATH}) - vcpkg_execute_build_process( - COMMAND "${MAKE};${INSTALL_OPTS}" - WORKING_DIRECTORY ${WORKING_DIRECTORY} - LOGNAME "install-${TARGET_TRIPLET}${SHORT_BUILDTYPE}" - ) + set(MAKE_CMD_LINE ${MAKE_COMMAND} ${INSTALL_OPTS}) endif() + + set(WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${SHORT_BUILDTYPE}") + vcpkg_execute_build_process( + COMMAND ${MAKE_BASH} ${MAKE_CMD_LINE} + WORKING_DIRECTORY "${WORKING_DIRECTORY}" + LOGNAME "install-${TARGET_TRIPLET}${SHORT_BUILDTYPE}" + ) + endif() endforeach() + string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_INSTALL_PREFIX "${CURRENT_INSTALLED_DIR}") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}_tmp") + file(RENAME "${CURRENT_PACKAGES_DIR}" "${CURRENT_PACKAGES_DIR}_tmp") + file(RENAME "${CURRENT_PACKAGES_DIR}_tmp${_VCPKG_INSTALL_PREFIX}/" "${CURRENT_PACKAGES_DIR}") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}_tmp") endif() - + + # Restore enviromnent + set(ENV{CFLAGS} "${C_FLAGS_BACKUP}") + set(ENV{CXXFLAGS} "${CXX_FLAGS_BACKUP}") + set(ENV{LDFLAGS} "${LD_FLAGS_BACKUP}") + + set(ENV{INCLUDE} "${INCLUDE_BACKUP}") + set(ENV{INCLUDE_PATH} "${INCLUDE_PATH_BACKUP}") + set(ENV{C_INCLUDE_PATH} "${C_INCLUDE_PATH_BACKUP}") + set(ENV{CPLUS_INCLUDE_PATH} "${CPLUS_INCLUDE_PATH_BACKUP}") + _vcpkg_restore_env_variable(LIBRARY_PATH) + _vcpkg_restore_env_variable(LD_LIBRARY_PATH) + if (CMAKE_HOST_WIN32) set(ENV{PATH} "${PATH_GLOBAL}") endif() + + endfunction() diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index 1a691a9458..9f31bebbc5 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -7,9 +7,6 @@ ## vcpkg_configure_make( ## SOURCE_PATH <${SOURCE_PATH}> ## [AUTOCONFIG] -## [DISABLE_AUTO_HOST] -## [DISABLE_AUTO_DST] -## [GENERATOR] ## [NO_DEBUG] ## [SKIP_CONFIGURE] ## [PROJECT_SUBPATH <${PROJ_SUBPATH}>] @@ -28,10 +25,6 @@ ## ### PROJECT_SUBPATH ## Specifies the directory containing the ``configure`/`configure.ac`. ## By convention, this is usually set in the portfile as the variable `SOURCE_PATH`. -## Should use `GENERATOR NMake` first. -## -## ### NO_DEBUG -## This port doesn't support debug mode. ## ## ### SKIP_CONFIGURE ## Skip configure process @@ -39,21 +32,8 @@ ## ### AUTOCONFIG ## Need to use autoconfig to generate configure file. ## -## ### DISABLE_AUTO_HOST -## Don't set host automatically, the default value is `i686`. -## If use this option, you will need to set host manually. -## -## ### DISABLE_AUTO_DST -## Don't set installation path automatically, the default value is `${CURRENT_PACKAGES_DIR}` and `${CURRENT_PACKAGES_DIR}/debug` -## If use this option, you will need to set dst path manually. -## -## ### GENERATOR -## Specifies the precise generator to use. -## NMake: nmake(windows) make(unix) -## MAKE: make(windows) make(unix) -## ## ### PRERUN_SHELL -## Script that needs to be called before configuration +## Script that needs to be called before configuration (do not use for batch files which simply call autoconf or configure) ## ## ### OPTIONS ## Additional options passed to configure during the configuration. @@ -73,300 +53,444 @@ ## * [tcl](https://github.com/Microsoft/vcpkg/blob/master/ports/tcl/portfile.cmake) ## * [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake) ## * [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake) +macro(_vcpkg_determine_host) + # --build: the machine you are building on + # --host: the machine you are building for + # --target: the machine that GCC will produce binary for + set(HOST_ARCH $ENV{PROCESSOR_ARCHITECTURE}) + set(MINGW_W w64) + set(MINGW_PACKAGES) + #message(STATUS "${HOST_ARCH}") + if(HOST_ARCH MATCHES "(amd|AMD)64") + set(MSYS_HOST x86_64) + set(HOST_ARCH x64) + set(BITS 64) + #list(APPEND MINGW_PACKAGES mingw-w64-x86_64-cccl) + elseif(HOST_ARCH MATCHES "(x|X)86") + set(MSYS_HOST i686) + set(HOST_ARCH x86) + set(BITS 32) + #list(APPEND MINGW_PACKAGES mingw-w64-i686-cccl) + elseif(HOST_ARCH MATCHES "^(ARM|arm)64$") + set(MSYS_HOST arm) + set(HOST_ARCH arm) + set(BITS 32) + #list(APPEND MINGW_PACKAGES mingw-w64-i686-cccl) + elseif(HOST_ARCH MATCHES "^(ARM|arm)$") + set(MSYS_HOST arm) + set(HOST_ARCH arm) + set(BITS 32) + #list(APPEND MINGW_PACKAGES mingw-w64-i686-cccl) + message(FATAL_ERROR "Unsupported host architecture ${HOST_ARCH} in _vcpkg_get_msys_toolchain!" ) + else() + message(FATAL_ERROR "Unsupported host architecture ${HOST_ARCH} in _vcpkg_get_msys_toolchain!" ) + endif() + set(TARGET_ARCH ${VCPKG_TARGET_ARCHITECTURE}) +endmacro() + +macro(_vcpkg_backup_env_variable envvar) + if(ENV{${envvar}}) + set(${envvar}_BACKUP "$ENV{${envvar}}") + set(${envvar}_PATHLIKE_CONCAT "${VCPKG_HOST_PATH_SEPARATOR}$ENV{${envvar}}") + else() + set(${envvar}_PATHLIKE_CONCAT) + endif() +endmacro() + +macro(_vcpkg_restore_env_variable envvar) + if(${envvar}_BACKUP) + set(ENV{${envvar}} ${${envvar}_BACKUP}) + else() + unset(ENV{${envvar}}) + endif() +endmacro() + + function(vcpkg_configure_make) cmake_parse_arguments(_csc - "AUTOCONFIG;DISABLE_AUTO_HOST;DISABLE_AUTO_DST;NO_DEBUG;SKIP_CONFIGURE" - "SOURCE_PATH;PROJECT_SUBPATH;GENERATOR;PRERUN_SHELL" + "AUTOCONFIG;SKIP_CONFIGURE;COPY_SOURCE" + "SOURCE_PATH;PROJECT_SUBPATH;PRERUN_SHELL" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN} ) - - if(NOT VCPKG_PLATFORM_TOOLSET) - message(FATAL_ERROR "Vcpkg has been updated with VS2017 support; " - "however, vcpkg.exe must be rebuilt by re-running bootstrap-vcpkg.bat\n") - endif() - - if (_csc_OPTIONS_DEBUG STREQUAL _csc_OPTIONS_RELEASE OR NMAKE_OPTION_RELEASE STREQUAL NMAKE_OPTION_DEBUG) - message(FATAL_ERROR "Detected debug configuration is equal to release configuration, please use NO_DEBUG for vcpkg_configure_make") - endif() - # Select compiler - if(_csc_GENERATOR MATCHES "NMake") - message(FATAL_ERROR "Sorry, NMake does not supported currently.") - if (CMAKE_HOST_WIN32) - set(GENERATOR "nmake") - else() - set(GENERATOR "make") - endif() - elseif(NOT _csc_GENERATOR OR _csc_GENERATOR MATCHES "MAKE") - if (CMAKE_HOST_WIN32) - set(GENERATOR "make") - else() - set(GENERATOR "make") - endif() - else() - message(FATAL_ERROR "${_csc_GENERATOR} not supported.") + # Backup enviromnent variables + set(C_FLAGS_BACKUP "$ENV{CFLAGS}") + set(CXX_FLAGS_BACKUP "$ENV{CXXFLAGS}") + set(LD_FLAGS_BACKUP "$ENV{LDFLAGS}") + set(INCLUDE_PATH_BACKUP "$ENV{INCLUDE_PATH}") + set(INCLUDE_BACKUP "$ENV{INCLUDE}") + set(C_INCLUDE_PATH_BACKUP "$ENV{C_INCLUDE_PATH}") + set(CPLUS_INCLUDE_PATH_BACKUP "$ENV{CPLUS_INCLUDE_PATH}") + #set(LD_LIBRARY_PATH_BACKUP "$ENV{LD_LIBRARY_PATH}") + _vcpkg_backup_env_variable(LD_LIBRARY_PATH) + #set(LIBRARY_PATH_BACKUP "$ENV{LIBRARY_PATH}") + _vcpkg_backup_env_variable(LIBRARY_PATH) + set(LIBPATH_BACKUP "$ENV{LIBPATH}") + + if(${CURRENT_PACKAGES_DIR} MATCHES " " OR ${CURRENT_INSTALLED_DIR} MATCHES " ") + # Don't bother with whitespace. The tools will probably fail and I tried very hard trying to make it work (no success so far)! + message(WARNING "Detected whitespace in root directory. Please move the path to one without whitespaces! The required tools do not handle whitespaces correctly and the build will most likely fail") endif() - set(WIN_TARGET_ARCH ) - set(WIN_TARGET_COMPILER ) - # Detect compiler - if (GENERATOR STREQUAL "nmake") - message(STATUS "Using generator NMAKE") - find_program(NMAKE nmake REQUIRED) - elseif (GENERATOR STREQUAL "make") - message(STATUS "Using generator make") - find_program(MAKE make REQUIRED) - else() - message(FATAL_ERROR "${GENERATOR} not supported.") - endif() # Pre-processing windows configure requirements if (CMAKE_HOST_WIN32) - vcpkg_find_acquire_program(YASM) - vcpkg_find_acquire_program(PERL) - set(MSYS_REQUIRE_PACKAGES diffutils) + # YASM and PERL are not strictly required by all ports. + # So this should probably be moved into the portfile + # vcpkg_find_acquire_program(YASM) + # get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) + # vcpkg_add_to_path("${YASM_EXE_PATH}") + + # vcpkg_find_acquire_program(PERL) + # get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) + # vcpkg_add_to_path("${PERL_EXE_PATH}") + + list(APPEND MSYS_REQUIRE_PACKAGES diffutils + pkg-config + binutils + libtool + gettext + gettext-devel + make) if (_csc_AUTOCONFIG) - set(MSYS_REQUIRE_PACKAGES ${MSYS_REQUIRE_PACKAGES} autoconf automake m4 libtool perl) + list(APPEND MSYS_REQUIRE_PACKAGES autoconf + autoconf-archive + automake + m4 + ) endif() vcpkg_acquire_msys(MSYS_ROOT PACKAGES ${MSYS_REQUIRE_PACKAGES}) - get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) - get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) - - if (NOT _csc_DISABLE_AUTO_HOST) - if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86) - set(WIN_TARGET_ARCH --host=i686-pc-mingw32) - elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x64) - set(WIN_TARGET_ARCH --host=i686-pc-mingw64) - elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm) - set(WIN_TARGET_ARCH --host=arm-pc-mingw32) - endif() + vcpkg_add_to_path("${MSYS_ROOT}/usr/bin") + set(BASH "${MSYS_ROOT}/usr/bin/bash.exe") + + # This is required because PATH contains sort and find from Windows but the MSYS versions are needed + # ${MSYS_ROOT}/urs/bin cannot be prepended to PATH due to other conflicts + file(CREATE_LINK "${MSYS_ROOT}/usr/bin/sort.exe" "${SCRIPTS}/buildsystems/make_wrapper/sort.exe" COPY_ON_ERROR) + file(CREATE_LINK "${MSYS_ROOT}/usr/bin/find.exe" "${SCRIPTS}/buildsystems/make_wrapper/find.exe" COPY_ON_ERROR) + vcpkg_add_to_path(PREPEND "${SCRIPTS}/buildsystems/make_wrapper") # Other required wrappers are also located there + + # --build: the machine you are building on + # --host: the machine you are building for + # --target: the machine that CC will produce binaries for + _vcpkg_determine_host() # VCPKG_HOST => machine you are building on => --build= + if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86) + set(BUILD_TARGET "--build=${MSYS_HOST}-pc-mingw32 --target=i686-pc-mingw32 --host=i686-pc-mingw32") + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x64) + set(BUILD_TARGET "--build=${MSYS_HOST}-pc-mingw32 --target=x86_64-pc-mingw32 --host=x86_64-pc-mingw32") + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm) + set(BUILD_TARGET "--build=${MSYS_HOST}-pc-mingw32 --target=arm-pc-mingw32 --host=i686-pc-mingw32") endif() - set(WIN_TARGET_COMPILER CC=cl) - set(ENV{PATH} "$ENV{PATH};${YASM_EXE_PATH};${MSYS_ROOT}/usr/bin;${PERL_EXE_PATH}") - set(BASH ${MSYS_ROOT}/usr/bin/bash.exe) - elseif (_csc_AUTOCONFIG) - find_program(autoreconf autoreconf REQUIRED) - endif() + + macro(_vcpkg_append_to_configure_enviromnent inoutstring var defaultval) + # Allows to overwrite settings in custom triplets via the enviromnent + if(ENV{${var}}) + string(APPEND ${inoutstring} " ${var}='$ENV{${var}}'") + else() + string(APPEND ${inoutstring} " ${var}='${defaultval}'") + endif() + endmacro() + + set(CONFIGURE_ENV "") + _vcpkg_append_to_configure_enviromnent(CONFIGURE_ENV CC "${MSYS_ROOT}/usr/share/automake-1.16/compile cl.exe -nologo") + _vcpkg_append_to_configure_enviromnent(CONFIGURE_ENV CXX "${MSYS_ROOT}/usr/share/automake-1.16/compile cl.exe -nologo") + _vcpkg_append_to_configure_enviromnent(CONFIGURE_ENV LD "link.exe -verbose") + _vcpkg_append_to_configure_enviromnent(CONFIGURE_ENV AR "${MSYS_ROOT}/usr/share/automake-1.16/ar-lib lib.exe -verbose") + _vcpkg_append_to_configure_enviromnent(CONFIGURE_ENV RANLIB ":") # Trick to ignore the RANLIB call + _vcpkg_append_to_configure_enviromnent(CONFIGURE_ENV CCAS ":") # If required set the ENV variable CCAS in the portfile correctly + _vcpkg_append_to_configure_enviromnent(CONFIGURE_ENV NM "dumpbin.exe -symbols -headers -all") + # Would be better to have a true nm here! Some symbols (mainly exported variables) get not properly imported with dumpbin as nm + # and require __declspec(dllimport) for some reason (same problem CMake has with WINDOWS_EXPORT_ALL_SYMBOLS) + _vcpkg_append_to_configure_enviromnent(CONFIGURE_ENV DLLTOOL "link.exe -verbose -dll") + + # Other maybe interesting variables to control + # COMPILE This is the command used to actually compile a C source file. The file name is appended to form the complete command line. + # LINK This is the command used to actually link a C program. + # CXXCOMPILE The command used to actually compile a C++ source file. The file name is appended to form the complete command line. + # CXXLINK The command used to actually link a C++ program. - if (NOT _csc_NO_DEBUG) - file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") + #Some PATH handling for dealing with spaces....some tools will still fail with that! + string(REPLACE " " "\\\ " _VCPKG_PREFIX ${CURRENT_INSTALLED_DIR}) + string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_PREFIX "${_VCPKG_PREFIX}") + set(_VCPKG_INSTALLED ${CURRENT_INSTALLED_DIR}) + string(REPLACE " " "\ " _VCPKG_INSTALLED_PKGCONF ${CURRENT_INSTALLED_DIR}) + string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_INSTALLED_PKGCONF ${_VCPKG_INSTALLED_PKGCONF}) + string(REPLACE "\\" "/" _VCPKG_INSTALLED_PKGCONF ${_VCPKG_INSTALLED_PKGCONF}) + set(prefix_var "'\${prefix}'") # Windows needs extra quotes or else the variable gets expanded in the makefile! else() - file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}") + string(REPLACE " " "\ " _VCPKG_PREFIX ${CURRENT_INSTALLED_DIR}) + string(REPLACE " " "\ " _VCPKG_INSTALLED ${CURRENT_INSTALLED_DIR}) + set(_VCPKG_INSTALLED_PKGCONF ${CURRENT_INSTALLED_DIR}) + set(EXTRA_QUOTES) + set(prefix_var "\${prefix}") endif() - if (NOT _csc_DISABLE_AUTO_DST) - set(_csc_OPTIONS_RELEASE ${_csc_OPTIONS_RELEASE} - --prefix=${CURRENT_PACKAGES_DIR} - --bindir=${CURRENT_PACKAGES_DIR}/bin - --sbindir=${CURRENT_PACKAGES_DIR}/bin - --libdir=${CURRENT_PACKAGES_DIR}/lib - --includedir=${CURRENT_PACKAGES_DIR}/include) + # Cleanup previous build dirs + file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}") + + set(ENV{V} "1") #Enabel Verbose MODE + + # Set configure paths + set(_csc_OPTIONS_RELEASE ${_csc_OPTIONS_RELEASE} + "--prefix=${EXTRA_QUOTES}${_VCPKG_PREFIX}${EXTRA_QUOTES}" + # Important: These should all be relative to prefix! + "--bindir=${prefix_var}/tools/${PORT}/bin" + "--sbindir=${prefix_var}/tools/${PORT}/sbin" + #"--libdir='\${prefix}'/lib" # already the default! + #"--includedir='\${prefix}'/include" # already the default! + "--mandir=${prefix_var}/share/${PORT}" + "--docdir=${prefix_var}/share/${PORT}" + "--datarootdir=${prefix_var}/share/${PORT}") + set(_csc_OPTIONS_DEBUG ${_csc_OPTIONS_DEBUG} + "--prefix=${EXTRA_QUOTES}${_VCPKG_PREFIX}/debug${EXTRA_QUOTES}" + # Important: These should all be relative to prefix! + "--bindir=${prefix_var}/../tools/${PORT}/debug/bin" + "--sbindir=${prefix_var}/../tools/${PORT}/debug/sbin" + #"--libdir='\${prefix}'/lib" # already the default! + "--includedir=${prefix_var}/../include" + "--datarootdir=${prefix_var}/share/${PORT}") - set(_csc_OPTIONS_DEBUG ${_csc_OPTIONS_DEBUG} - --prefix=${CURRENT_PACKAGES_DIR}/debug - --bindir=${CURRENT_PACKAGES_DIR}/debug/bin - --sbindir=${CURRENT_PACKAGES_DIR}/debug/bin - --libdir=${CURRENT_PACKAGES_DIR}/debug/lib - --includedir=${CURRENT_PACKAGES_DIR}/debug/include) + # Setup common options + if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + list(APPEND _csc_OPTIONS --disable-silent-rules --verbose --enable-shared --disable-static) + if (VCPKG_TARGET_IS_UWP) + list(APPEND _csc_OPTIONS --extra-ldflags=-APPCONTAINER --extra-ldflags=WindowsApp.lib) + endif() + else() + list(APPEND _csc_OPTIONS --disable-silent-rules --verbose --enable-static --disable-shared) endif() - set(base_cmd ) + file(RELATIVE_PATH RELATIVE_BUILD_PATH "${CURRENT_BUILDTREES_DIR}" "${_csc_SOURCE_PATH}/${_csc_PROJECT_SUBPATH}") + + set(base_cmd) if(CMAKE_HOST_WIN32) - set(base_cmd ${BASH} --noprofile --norc -c) - - if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - set(_csc_OPTIONS ${_csc_OPTIONS} --enable-shared) - if (VCPKG_TARGET_IS_UWP) - set(_csc_OPTIONS ${_csc_OPTIONS} --extra-ldflags=-APPCONTAINER --extra-ldflags=WindowsApp.lib) - endif() - else() - set(_csc_OPTIONS ${_csc_OPTIONS} --enable-static) - endif() + set(base_cmd ${BASH} --noprofile --norc --debug) # Load toolchains if(NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE) set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/windows.cmake") endif() include("${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}") - - set(C_FLAGS_GLOBAL "$ENV{CFLAGS} ${VCPKG_C_FLAGS}") - set(CXX_FLAGS_GLOBAL "$ENV{CXXFLAGS} ${VCPKG_CXX_FLAGS}") - set(LD_FLAGS_GLOBAL "$ENV{LDFLAGS}") - if(VCPKG_TARGET_IS_UWP) + # Flags should be set in the toolchain instead set(ENV{LIBPATH} "$ENV{LIBPATH};$ENV{_WKITS10}references\\windows.foundation.foundationcontract\\2.0.0.0\\;$ENV{_WKITS10}references\\windows.foundation.universalapicontract\\3.0.0.0\\") set(_csc_OPTIONS ${_csc_OPTIONS} --extra-cflags=-DWINAPI_FAMILY=WINAPI_FAMILY_APP --extra-cflags=-D_WIN32_WINNT=0x0A00) endif() - + #Join the options list as a string with spaces between options list(JOIN _csc_OPTIONS " " _csc_OPTIONS) list(JOIN _csc_OPTIONS_RELEASE " " _csc_OPTIONS_RELEASE) list(JOIN _csc_OPTIONS_DEBUG " " _csc_OPTIONS_DEBUG) - - set(rel_command - ${base_cmd} "${WIN_TARGET_COMPILER} ${_csc_SOURCE_PATH}/configure ${WIN_TARGET_ARCH} ${_csc_OPTIONS} ${_csc_OPTIONS_RELEASE}" - ) - set(dbg_command - ${base_cmd} "${WIN_TARGET_COMPILER} ${_csc_SOURCE_PATH}/configure ${WIN_TARGET_ARCH} ${_csc_OPTIONS} ${_csc_OPTIONS_DEBUG}" - ) + endif() + + # Setup include enviromnent + set(ENV{INCLUDE} "${_VCPKG_INSTALLED}/include${VCPKG_HOST_PATH_SEPARATOR}${INCLUDE_BACKUP}") + set(ENV{INCLUDE_PATH} "${_VCPKG_INSTALLED}/include${VCPKG_HOST_PATH_SEPARATOR}${INCLUDE_PATH_BACKUP}") + set(ENV{C_INCLUDE_PATH} "${_VCPKG_INSTALLED}/include${VCPKG_HOST_PATH_SEPARATOR}${C_INCLUDE_PATH_BACKUP}") + set(ENV{CPLUS_INCLUDE_PATH} "${_VCPKG_INSTALLED}/include${VCPKG_HOST_PATH_SEPARATOR}${CPLUS_INCLUDE_PATH_BACKUP}") + + # Setup global flags -> TODO: Further improve with toolchain file in mind! + set(C_FLAGS_GLOBAL "$ENV{CFLAGS} ${VCPKG_C_FLAGS}") + set(CXX_FLAGS_GLOBAL "$ENV{CXXFLAGS} ${VCPKG_CXX_FLAGS}") + set(LD_FLAGS_GLOBAL "$ENV{LDFLAGS} ${VCPKG_LINKER_FLAGS}") + # Flags should be set in the toolchain instead + if(NOT VCPKG_TARGET_IS_WINDOWS) + string(APPEND C_FLAGS_GLOBAL " -fPIC") + string(APPEND CXX_FLAGS_GLOBAL " -fPIC") else() - set(base_cmd ./) - set(rel_command - ${base_cmd}configure "${_csc_OPTIONS}" "${_csc_OPTIONS_RELEASE}" - ) - set(dbg_command - ${base_cmd}configure "${_csc_OPTIONS}" "${_csc_OPTIONS_DEBUG}" - ) + string(APPEND C_FLAGS_GLOBAL " /D_WIN32_WINNT=0x0601 /DWIN32_LEAN_AND_MEAN /DWIN32 /D_WINDOWS") + string(APPEND CXX_FLAGS_GLOBAL " /D_WIN32_WINNT=0x0601 /DWIN32_LEAN_AND_MEAN /DWIN32 /D_WINDOWS") + string(APPEND LD_FLAGS_GLOBAL " /VERBOSE -no-undefined") + if(VCPKG_TARGET_ARCHITECTURE STREQUAL x64) + string(APPEND LD_FLAGS_GLOBAL " /machine:x64") + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x86) + string(APPEND LD_FLAGS_GLOBAL " /machine:x86") + endif() endif() - # Configure debug - if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug" AND NOT _csc_NO_DEBUG) - if (CMAKE_HOST_WIN32) - unset(ENV{CFLAGS}) - unset(ENV{CXXFLAGS}) - unset(ENV{LDFLAGS}) - set(TMP_CFLAGS "${C_FLAGS_GLOBAL} ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}") - string(REPLACE "/" "-" TMP_CFLAGS "${TMP_CFLAGS}") - set(ENV{CFLAGS} ${TMP_CFLAGS}) - set(TMP_CXXFLAGS "${CXX_FLAGS_GLOBAL} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}") - string(REPLACE "/" "-" TMP_CXXFLAGS "${TMP_CXXFLAGS}") - set(ENV{CXXFLAGS} ${TMP_CXXFLAGS}) - set(TMP_LDFLAGS "${LD_FLAGS_GLOBAL}") - string(REPLACE "/" "-" TMP_LDFLAGS "${TMP_LDFLAGS}") - set(ENV{LDFLAGS} ${TMP_LDFLAGS}) - endif() - - set(OBJ_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) - set(PRJ_DIR ${OBJ_DIR}/${_csc_PROJECT_SUBPATH}) - - file(MAKE_DIRECTORY ${OBJ_DIR}) - - if (NOT CMAKE_HOST_WIN32) - file(GLOB_RECURSE SOURCE_FILES ${_csc_SOURCE_PATH}/*) - foreach(ONE_SOUCRCE_FILE ${SOURCE_FILES}) - get_filename_component(DST_DIR ${ONE_SOUCRCE_FILE} PATH) - string(REPLACE "${_csc_SOURCE_PATH}" "${OBJ_DIR}" DST_DIR "${DST_DIR}") - file(COPY ${ONE_SOUCRCE_FILE} DESTINATION ${DST_DIR}) - endforeach() - endif() - - if (_csc_PRERUN_SHELL) - message(STATUS "Prerun shell with ${TARGET_TRIPLET}-dbg") - vcpkg_execute_required_process( - COMMAND ${base_cmd}${_csc_PRERUN_SHELL} - WORKING_DIRECTORY ${PRJ_DIR} - LOGNAME prerun-${TARGET_TRIPLET}-dbg - ) - endif() - - if (_csc_AUTOCONFIG) - message(STATUS "Generating configure with ${TARGET_TRIPLET}-dbg") - if (CMAKE_HOST_WIN32) - vcpkg_execute_required_process( - COMMAND ${base_cmd} autoreconf -vfi - WORKING_DIRECTORY ${_csc_SOURCE_PATH}/${_csc_PROJECT_SUBPATH} - LOGNAME prerun-${TAR_TRIPLET_DIR} - ) - else() - vcpkg_execute_required_process( - COMMAND autoreconf -vfi - WORKING_DIRECTORY ${PRJ_DIR} - LOGNAME prerun-${TAR_TRIPLET_DIR} - ) - endif() - endif() - - if (NOT _csc_SKIP_CONFIGURE) - message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") - vcpkg_execute_required_process( - COMMAND ${dbg_command} - WORKING_DIRECTORY ${PRJ_DIR} - LOGNAME config-${TARGET_TRIPLET}-dbg - ) + if(NOT ENV{PKG_CONFIG}) + find_program(PKGCONFIG pkg-config PATHS "${MSYS_ROOT}/usr/bin" REQUIRED) + debug_message("Using pkg-config from: ${PKGCONFIG}") + if(NOT PKGCONFIG) + message(STATUS "${PORT} requires pkg-config from the system package manager (example: \"sudo apt-get install pkg-config\")") endif() + else() + debug_message("ENV{PKG_CONFIG} found! Using: $ENV{PKG_CONFIG}") + set(PKGCONFIG $ENV{PKG_CONFIG}) endif() + + set(SRC_DIR "${_csc_SOURCE_PATH}/${_csc_PROJECT_SUBPATH}") - # Configure release - if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") - if (CMAKE_HOST_WIN32) - unset(ENV{CFLAGS}) - unset(ENV{CXXFLAGS}) - unset(ENV{LDFLAGS}) - set(TMP_CFLAGS "${C_FLAGS_GLOBAL} ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}") - string(REPLACE "/" "-" TMP_CFLAGS "${TMP_CFLAGS}") - set(ENV{CFLAGS} ${TMP_CFLAGS}) - - set(TMP_CXXFLAGS "${CXX_FLAGS_GLOBAL} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}") - string(REPLACE "/" "-" TMP_CXXFLAGS "${TMP_CXXFLAGS}") - set(ENV{CXXFLAGS} ${TMP_CXXFLAGS}) - - set(TMP_LDFLAGS "${LD_FLAGS_GLOBAL} ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") - string(REPLACE "/" "-" TMP_LDFLAGS "${TMP_LDFLAGS}") - set(ENV{LDFLAGS} ${TMP_LDFLAGS}) + # Run autoconf if necessary + if(EXISTS "${SRC_DIR}/configure" AND NOT _csc_SKIP_CONFIGURE) + set(REQUIRES_AUTOCONFIG FALSE) # use autotools and configure.ac + set(REQUIRES_AUTOGEN FALSE) # use autogen.sh + elseif(EXISTS "${SRC_DIR}/configure.ac") + set(REQUIRES_AUTOCONFIG TRUE) + set(REQUIRES_AUTOGEN FALSE) + elseif(EXISTS "${SRC_DIR}/autogen.sh") + set(REQUIRES_AUTOGEN TRUE) + set(REQUIRES_AUTOCONFIG FALSE) + endif() + set(_GENERATED_CONFIGURE FALSE) + if (_csc_AUTOCONFIG OR REQUIRES_AUTOCONFIG) + find_program(AUTORECONF autoreconf REQUIRED) + if(NOT AUTORECONF) + message(STATUS "${PORT} requires autoconf from the system package manager (example: \"sudo apt-get install autoconf\")") endif() - - if (_csc_NO_DEBUG) - set(TAR_TRIPLET_DIR ${TARGET_TRIPLET}) - set(OBJ_DIR ${CURRENT_BUILDTREES_DIR}/${TAR_TRIPLET_DIR}) + find_program(LIBTOOL libtool REQUIRED) + if(NOT LIBTOOL) + message(STATUS "${PORT} requires libtool from the system package manager (example: \"sudo apt-get install libtool libtool-bin\")") + endif() + find_program(AUTOPOINT autopoint REQUIRED) + if(NOT AUTOPOINT) + message(STATUS "${PORT} requires autopoint from the system package manager (example: \"sudo apt-get install autopoint\")") + endif() + message(STATUS "Generating configure for ${TARGET_TRIPLET}") + if (CMAKE_HOST_WIN32) + vcpkg_execute_required_process( + COMMAND ${base_cmd} -c "autoreconf -vfi" + WORKING_DIRECTORY "${SRC_DIR}" + LOGNAME autoconf-${TARGET_TRIPLET} + ) else() - set(TAR_TRIPLET_DIR ${TARGET_TRIPLET}-rel) - set(OBJ_DIR ${CURRENT_BUILDTREES_DIR}/${TAR_TRIPLET_DIR}) - endif() - set(PRJ_DIR ${OBJ_DIR}/${_csc_PROJECT_SUBPATH}) - - file(MAKE_DIRECTORY ${OBJ_DIR}) - - if (NOT CMAKE_HOST_WIN32) - file(GLOB_RECURSE SOURCE_FILES ${_csc_SOURCE_PATH}/*) - foreach(ONE_SOUCRCE_FILE ${SOURCE_FILES}) - get_filename_component(DST_DIR ${ONE_SOUCRCE_FILE} PATH) - string(REPLACE "${_csc_SOURCE_PATH}" "${OBJ_DIR}" DST_DIR "${DST_DIR}") - file(COPY ${ONE_SOUCRCE_FILE} DESTINATION ${DST_DIR}) - endforeach() - endif() - - if (_csc_PRERUN_SHELL) - message(STATUS "Prerun shell with ${TAR_TRIPLET_DIR}") vcpkg_execute_required_process( - COMMAND ${base_cmd}${_csc_PRERUN_SHELL} - WORKING_DIRECTORY ${PRJ_DIR} - LOGNAME prerun-${TAR_TRIPLET_DIR} + COMMAND autoreconf -vfi + WORKING_DIRECTORY "${SRC_DIR}" + LOGNAME autoconf-${TARGET_TRIPLET} ) endif() - - if (_csc_AUTOCONFIG) - message(STATUS "Generating configure with ${TAR_TRIPLET_DIR}") - if (CMAKE_HOST_WIN32) - vcpkg_execute_required_process( - COMMAND ${base_cmd} autoreconf -vfi - WORKING_DIRECTORY ${_csc_SOURCE_PATH}/${_csc_PROJECT_SUBPATH} - LOGNAME prerun-${TAR_TRIPLET_DIR} - ) - else() - vcpkg_execute_required_process( - COMMAND autoreconf -vfi - WORKING_DIRECTORY ${PRJ_DIR} - LOGNAME prerun-${TAR_TRIPLET_DIR} - ) + message(STATUS "Finished generating configure for ${TARGET_TRIPLET}") + endif() + if(REQUIRES_AUTOGEN) + message(STATUS "Generating configure for ${TARGET_TRIPLET} via autogen.sh") + if (CMAKE_HOST_WIN32) + vcpkg_execute_required_process( + COMMAND ${base_cmd} -c "./autogen.sh" + WORKING_DIRECTORY "${SRC_DIR}" + LOGNAME autoconf-${TARGET_TRIPLET} + ) + else() + vcpkg_execute_required_process( + COMMAND "./autogen.sh" + WORKING_DIRECTORY "${SRC_DIR}" + LOGNAME autoconf-${TARGET_TRIPLET} + ) + endif() + message(STATUS "Finished generating configure for ${TARGET_TRIPLET}") + endif() + + if (_csc_PRERUN_SHELL) + message(STATUS "Prerun shell with ${TARGET_TRIPLET}") + vcpkg_execute_required_process( + COMMAND ${base_cmd} -c "${_csc_PRERUN_SHELL}" + WORKING_DIRECTORY "${SRC_DIR}" + LOGNAME prerun-${TARGET_TRIPLET} + ) + endif() + + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug" AND NOT _csc_NO_DEBUG) + set(_VAR_SUFFIX DEBUG) + set(PATH_SUFFIX_${_VAR_SUFFIX} "/debug") + set(SHORT_NAME_${_VAR_SUFFIX} "dbg") + list(APPEND _buildtypes ${_VAR_SUFFIX}) + if (CMAKE_HOST_WIN32) # Flags should be set in the toolchain instead + string(REGEX REPLACE "[ \t]+/" " -" CFLAGS_${_VAR_SUFFIX} "${C_FLAGS_GLOBAL} ${VCPKG_CRT_LINK_FLAG_PREFIX}d /D_DEBUG /Ob0 /Od ${VCPKG_C_FLAGS_${_VAR_SUFFIX}}") + string(REGEX REPLACE "[ \t]+/" " -" CXXFLAGS_${_VAR_SUFFIX} "${CXX_FLAGS_GLOBAL} ${VCPKG_CRT_LINK_FLAG_PREFIX}d /D_DEBUG /Ob0 /Od ${VCPKG_CXX_FLAGS_${_VAR_SUFFIX}}") + string(REGEX REPLACE "[ \t]+/" " -" LDFLAGS_${_VAR_SUFFIX} "-L${_VCPKG_INSTALLED}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib ${LD_FLAGS_GLOBAL} ${VCPKG_LINKER_FLAGS_${_VAR_SUFFIX}}") + else() + set(CFLAGS_${_VAR_SUFFIX} "${C_FLAGS_GLOBAL} ${VCPKG_C_FLAGS_DEBUG}") + set(CXXFLAGS_${_VAR_SUFFIX} "${CXX_FLAGS_GLOBAL} ${VCPKG_CXX_FLAGS_DEBUG}") + set(LDFLAGS_${_VAR_SUFFIX} "-L${_VCPKG_INSTALLED}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib/ -L${_VCPKG_INSTALLED}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib/manual-link/ ${LD_FLAGS_GLOBAL} ${VCPKG_LINKER_FLAGS_${_VAR_SUFFIX}}") + endif() + unset(_VAR_SUFFIX) + endif() + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + set(_VAR_SUFFIX RELEASE) + set(PATH_SUFFIX_${_VAR_SUFFIX} "") + set(SHORT_NAME_${_VAR_SUFFIX} "rel") + list(APPEND _buildtypes ${_VAR_SUFFIX}) + if (CMAKE_HOST_WIN32) # Flags should be set in the toolchain instead + string(REGEX REPLACE "[ \t]+/" " -" CFLAGS_${_VAR_SUFFIX} "${C_FLAGS_GLOBAL} ${VCPKG_CRT_LINK_FLAG_PREFIX} /O2 /Oi /Gy /DNDEBUG ${VCPKG_C_FLAGS_${_VAR_SUFFIX}}") + string(REGEX REPLACE "[ \t]+/" " -" CXXFLAGS_${_VAR_SUFFIX} "${CXX_FLAGS_GLOBAL} ${VCPKG_CRT_LINK_FLAG_PREFIX} /O2 /Oi /Gy /DNDEBUG ${VCPKG_CXX_FLAGS_${_VAR_SUFFIX}}") + string(REGEX REPLACE "[ \t]+/" " -" LDFLAGS_${_VAR_SUFFIX} "-L${_VCPKG_INSTALLED}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib ${LD_FLAGS_GLOBAL} ${VCPKG_LINKER_FLAGS_${_VAR_SUFFIX}}") + else() + set(CFLAGS_${_VAR_SUFFIX} "${C_FLAGS_GLOBAL} ${VCPKG_C_FLAGS_DEBUG}") + set(CXXFLAGS_${_VAR_SUFFIX} "${CXX_FLAGS_GLOBAL} ${VCPKG_CXX_FLAGS_DEBUG}") + set(LDFLAGS_${_VAR_SUFFIX} "-L${_VCPKG_INSTALLED}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib/ -L${_VCPKG_INSTALLED}${PATH_SUFFIX_${_VAR_SUFFIX}}/lib/manual-link/ ${LD_FLAGS_GLOBAL} ${VCPKG_LINKER_FLAGS_${_VAR_SUFFIX}}") + endif() + unset(_VAR_SUFFIX) + endif() + + foreach(_buildtype IN LISTS _buildtypes) + set(TAR_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_NAME_${_buildtype}}") + file(MAKE_DIRECTORY "${TAR_DIR}") + file(RELATIVE_PATH RELATIVE_BUILD_PATH "${TAR_DIR}" "${SRC_DIR}") + + if(_csc_COPY_SOURCE) + file(COPY "${SRC_DIR}/" DESTINATION "${TAR_DIR}") + set(RELATIVE_BUILD_PATH .) + endif() + + set(PKGCONFIG_INSTALLED_DIR "${_VCPKG_INSTALLED_PKGCONF}${PATH_SUFFIX_${_buildtype}}/lib/pkgconfig") + set(PKGCONFIG_INSTALLED_SHARE_DIR "${_VCPKG_INSTALLED_PKGCONF}/share/pkgconfig") + + if(ENV{PKG_CONFIG_PATH}) + set(BACKUP_ENV_PKG_CONFIG_PATH_${_buildtype} $ENV{PKG_CONFIG_PATH}) + set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}:${PKGCONFIG_INSTALLED_SHARE_DIR}:$ENV{PKG_CONFIG_PATH}") + else() + set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}:${PKGCONFIG_INSTALLED_SHARE_DIR}") + endif() + + # Setup enviromnent + set(ENV{CFLAGS} ${CFLAGS_${_buildtype}}) + set(ENV{CXXFLAGS} ${CXXFLAGS_${_buildtype}}) + set(ENV{LDFLAGS} ${LDFLAGS_${_buildtype}}) + set(ENV{PKG_CONFIG} "${PKGCONFIG} --define-variable=prefix=${_VCPKG_INSTALLED}${PATH_SUFFIX_${_buildtype}}") + set(ENV{LIBPATH} "${_VCPKG_INSTALLED}${PATH_SUFFIX_${_buildtype}}/lib${VCPKG_HOST_PATH_SEPARATOR}${LIBPATH_BACKUP}") + + set(ENV{LIBRARY_PATH} "${_VCPKG_INSTALLED}${PATH_SUFFIX_${_buildtype}}/lib/${VCPKG_HOST_PATH_SEPARATOR}${_VCPKG_INSTALLED}${PATH_SUFFIX_${_buildtype}}/lib/manual-link/${LD_LIBRARY_PATH_PATHLIKE_CONCAT}") + set(ENV{LD_LIBRARY_PATH} "${_VCPKG_INSTALLED}${PATH_SUFFIX_${_buildtype}}/lib/${VCPKG_HOST_PATH_SEPARATOR}${_VCPKG_INSTALLED}${PATH_SUFFIX_${_buildtype}}/lib/manual-link/${LD_LIBRARY_PATH_PATHLIKE_CONCAT}") + + if (CMAKE_HOST_WIN32) + set(command ${base_cmd} -c "${CONFIGURE_ENV} ./${RELATIVE_BUILD_PATH}/configure ${BUILD_TARGET} ${HOST_TYPE}${_csc_OPTIONS} ${_csc_OPTIONS_${_buildtype}}") + else() + set(command /bin/bash "./${RELATIVE_BUILD_PATH}/configure" ${_csc_OPTIONS} ${_csc_OPTIONS_${_buildtype}}) + endif() + + if (NOT _csc_SKIP_CONFIGURE) + message(STATUS "Configuring ${TARGET_TRIPLET}-${SHORT_NAME_${_buildtype}}") + vcpkg_execute_required_process( + COMMAND ${command} + WORKING_DIRECTORY "${TAR_DIR}" + LOGNAME config-${TARGET_TRIPLET}-${SHORT_NAME_${_buildtype}} + ) + if(EXISTS "${TAR_DIR}/libtool" AND VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set(_file "${TAR_DIR}/libtool") + file(READ "${_file}" _contents) + string(REPLACE ".dll.lib" ".lib" _contents "${_contents}") + file(WRITE "${_file}" "${_contents}") endif() endif() - - if (NOT _csc_SKIP_CONFIGURE) - message(STATUS "Configuring ${TAR_TRIPLET_DIR}") - vcpkg_execute_required_process( - COMMAND ${rel_command} - WORKING_DIRECTORY ${PRJ_DIR} - LOGNAME config-${TAR_TRIPLET_DIR} - ) + + if(BACKUP_ENV_PKG_CONFIG_PATH_${_buildtype}) + set(ENV{PKG_CONFIG_PATH} "${BACKUP_ENV_PKG_CONFIG_PATH_${_buildtype}}") + else() + unset(ENV{PKG_CONFIG_PATH}) endif() - endif() - - # Restore envs - if (CMAKE_HOST_WIN32) - set(ENV{CFLAGS} "${C_FLAGS_GLOBAL}") - set(ENV{CXXFLAGS} "${CXX_FLAGS_GLOBAL}") - set(ENV{LDFLAGS} "${LD_FLAGS_GLOBAL}") - endif() - - set(_VCPKG_MAKE_GENERATOR "${GENERATOR}" PARENT_SCOPE) - set(_VCPKG_NO_DEBUG ${_csc_NO_DEBUG} PARENT_SCOPE) + unset(BACKUP_ENV_PKG_CONFIG_PATH_${_buildtype}) + endforeach() + + # Restore enviromnent + set(ENV{CFLAGS} "${C_FLAGS_BACKUP}") + set(ENV{CXXFLAGS} "${CXX_FLAGS_BACKUP}") + set(ENV{LDFLAGS} "${LD_FLAGS_BACKUP}") + + set(ENV{INCLUDE} "${INCLUDE_BACKUP}") + set(ENV{INCLUDE_PATH} "${INCLUDE_PATH_BACKUP}") + set(ENV{C_INCLUDE_PATH} "${C_INCLUDE_PATH_BACKUP}") + set(ENV{CPLUS_INCLUDE_PATH} "${CPLUS_INCLUDE_PATH_BACKUP}") + _vcpkg_restore_env_variable(LIBRARY_PATH) + _vcpkg_restore_env_variable(LD_LIBRARY_PATH) + set(ENV{LIBPATH} "${LIBPATH_BACKUP}") SET(_VCPKG_PROJECT_SOURCE_PATH ${_csc_SOURCE_PATH} PARENT_SCOPE) set(_VCPKG_PROJECT_SUBPATH ${_csc_PROJECT_SUBPATH} PARENT_SCOPE) endfunction() diff --git a/scripts/cmake/vcpkg_fixup_pkgconfig.cmake b/scripts/cmake/vcpkg_fixup_pkgconfig.cmake index c5ba57a20e..1256bef4a1 100644 --- a/scripts/cmake/vcpkg_fixup_pkgconfig.cmake +++ b/scripts/cmake/vcpkg_fixup_pkgconfig.cmake @@ -144,6 +144,8 @@ function(vcpkg_fixup_pkgconfig_check_libraries _config _contents_var _system_lib # endif() # get_filename_component(PTHREAD_LIB "${PTHREAD_LIB}" NAME_WE) # string(REPLACE "Libs: -pthread" "Libs: -L\${libdir} -l${PTHREAD_LIB}" _contents ${_contents}) + elseif(_lib STREQUAL _ignore_flags) + message(STATUS "${_lib} found in *.pc file and ignored!") else() message(FATAL_ERROR "Found ${_lib} and no rule to analyse the flag! Please check the *.pc file") endif() @@ -240,7 +242,6 @@ function(vcpkg_fixup_pkgconfig) message(STATUS "Checking file: ${_file}") get_filename_component(PKG_LIB_SEARCH_PATH "${_file}" DIRECTORY) file(RELATIVE_PATH RELATIVE_PC_PATH "${PKG_LIB_SEARCH_PATH}" "${CURRENT_PACKAGES_DIR}/debug/") - message(STATUS "REL PATH: ${RELATIVE_PC_PATH}") string(REGEX REPLACE "/$" "" RELATIVE_PC_PATH "${RELATIVE_PC_PATH}") string(REGEX REPLACE "/pkgconfig/?" "" PKG_LIB_SEARCH_PATH "${PKG_LIB_SEARCH_PATH}") file(READ "${_file}" _contents) diff --git a/scripts/cmake/vcpkg_install_make.cmake b/scripts/cmake/vcpkg_install_make.cmake index 1672d7c5a5..4246894686 100644 --- a/scripts/cmake/vcpkg_install_make.cmake +++ b/scripts/cmake/vcpkg_install_make.cmake @@ -21,5 +21,5 @@ ## * [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake) function(vcpkg_install_make) - vcpkg_build_make(LOGFILE_ROOT ENABLE_INSTALL) + vcpkg_build_make(${ARGN} LOGFILE_ROOT ENABLE_INSTALL) endfunction()