From 71f5a6f9fe3fc9fbd0a10604d50dea4d49fc6825 Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Fri, 21 May 2021 09:50:11 +0200 Subject: [getopt-win32] fix static builds (#17942) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * vcpkg_fixup_pkgconfig for allgero5 * version stuff * Small MSbuild fixes for static builds. * version stuff * update baseline * commit vcpkg.json * version stuff * remove blocking line * version stuff * fix missing preprocessor definition * version stuff * Update ports/getopt-win32/portfile.cmake Apply CR changes Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> * version stuff Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> --- ports/getopt-win32/CONTROL | 5 ----- ports/getopt-win32/portfile.cmake | 29 ++++++++++++++++++++++++++--- ports/getopt-win32/vcpkg.json | 8 ++++++++ scripts/ci.baseline.txt | 1 - versions/baseline.json | 2 +- versions/g-/getopt-win32.json | 5 +++++ 6 files changed, 40 insertions(+), 10 deletions(-) delete mode 100644 ports/getopt-win32/CONTROL create mode 100644 ports/getopt-win32/vcpkg.json diff --git a/ports/getopt-win32/CONTROL b/ports/getopt-win32/CONTROL deleted file mode 100644 index 5de151a79..000000000 --- a/ports/getopt-win32/CONTROL +++ /dev/null @@ -1,5 +0,0 @@ -Source: getopt-win32 -Version: 0.1 -Description: An implementation of getopt. -Homepage: https://github.com/libimobiledevice-win32 -Supports: windows \ No newline at end of file diff --git a/ports/getopt-win32/portfile.cmake b/ports/getopt-win32/portfile.cmake index 780cb1c5f..2e80cf943 100644 --- a/ports/getopt-win32/portfile.cmake +++ b/ports/getopt-win32/portfile.cmake @@ -2,8 +2,6 @@ if(VCPKG_CMAKE_SYSTEM_NAME) message(FATAL_ERROR "getopt-win32 only supports building on Windows Desktop") endif() -vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO libimobiledevice-win32/getopt @@ -12,13 +10,38 @@ vcpkg_from_github( HEAD_REF master ) +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + list(APPEND OPTIONS "/p:ConfigurationType=StaticLibrary") +else() + list(APPEND OPTIONS "/p:ConfigurationType=DynamicLibrary") +endif() + +set(_file "${SOURCE_PATH}/getopt.vcxproj") +file(READ "${_file}" _contents) +if(VCPKG_CRT_LINKAGE STREQUAL static) + string(REPLACE "MultiThreadedDLL" "MultiThreaded" _contents "${_contents}") + string(REPLACE "MultiThreadedDebugDLL" "MultiThreadedDebug" _contents "${_contents}") +else() + string(REPLACE "MultiThreaded" "MultiThreadedDLL" _contents "${_contents}") + string(REPLACE "MultiThreadedDebug" "MultiThreadedDebugDLL" _contents "${_contents}") +endif() +file(WRITE "${_file}" "${_contents}") + + + vcpkg_install_msbuild( SOURCE_PATH ${SOURCE_PATH} PROJECT_SUBPATH getopt.vcxproj LICENSE_SUBPATH LICENSE + OPTIONS ${OPTIONS} ) # Copy header -file(COPY ${SOURCE_PATH}/getopt.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/) +file(COPY "${SOURCE_PATH}/getopt.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/") +if (VCPKG_LIBRARY_LINKAGE STREQUAL static) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/getopt.h" + " #define __GETOPT_H_" " #define __GETOPT_H_\n #define STATIC_GETOPT" + ) +endif() set(VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS enabled) diff --git a/ports/getopt-win32/vcpkg.json b/ports/getopt-win32/vcpkg.json new file mode 100644 index 000000000..8f68d57f2 --- /dev/null +++ b/ports/getopt-win32/vcpkg.json @@ -0,0 +1,8 @@ +{ + "name": "getopt-win32", + "version-string": "0.1", + "port-version": 1, + "description": "An implementation of getopt.", + "homepage": "https://github.com/libimobiledevice-win32", + "supports": "windows" +} diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 330aa3835..27000bc03 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -385,7 +385,6 @@ getopt-win32:arm-uwp=fail getopt-win32:x64-linux=fail getopt-win32:x64-osx=fail getopt-win32:x64-uwp=fail -getopt-win32:x64-windows-static=fail gflags:arm-uwp=fail gflags:x64-uwp=fail diff --git a/versions/baseline.json b/versions/baseline.json index 01cdff6c7..a7faa613c 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2226,7 +2226,7 @@ }, "getopt-win32": { "baseline": "0.1", - "port-version": 0 + "port-version": 1 }, "gettext": { "baseline": "0.21", diff --git a/versions/g-/getopt-win32.json b/versions/g-/getopt-win32.json index 91f3a4c7d..890684207 100644 --- a/versions/g-/getopt-win32.json +++ b/versions/g-/getopt-win32.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "d4b235f13a89dbec23f09caa05c7b71c176cfab8", + "version-string": "0.1", + "port-version": 1 + }, { "git-tree": "f54e92c884b42be2395cb2c5929785cb2db8ad9b", "version-string": "0.1", -- cgit v1.2.3