Add getopt port

This commit is contained in:
Frederik Carlier 2018-07-17 15:00:40 +02:00 committed by Alexander Karatarakis
parent 9da52f6e76
commit 19dfd5c96f
2 changed files with 67 additions and 0 deletions

3
ports/getopt/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: getopt
Version: 0.1
Description: The getopt and getopt_long functions automate some of the chore involved in parsing typical unix command line options.

View File

@ -0,0 +1,64 @@
# Common Ambient Variables:
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT}
# PORT = current port name (zlib, etc)
# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc)
# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic)
# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic)
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm)
#
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/getopt-0.1)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
set(MSBUILD_PLATFORM x64)
else()
set(MSBUILD_PLATFORM Win32)
endif()
set(DEBUG_CONFIG Debug)
set(RELEASE_CONFIG Release)
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/libimobiledevice-win32/getopt/archive/0.1.zip"
FILENAME "getopt-0.1.zip"
SHA512 7d9786222b6934b80ff2d03e20f211bf289e494ec388842b245f86a5c6bb3a403baba088ceb2e05a460c5523f63f4dd2dc6854a4cc50b1360f168b4f34573a3d
)
vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/getopt.vcxproj
DEBUG_CONFIGURATION ${DEBUG_CONFIG}
RELEASE_CONFIGURATION ${RELEASE_CONFIG}
)
# Copy headers
file(COPY ${SOURCE_PATH}/getopt.h
DESTINATION ${CURRENT_PACKAGES_DIR}/include/)
# Copy binary files
file (MAKE_DIRECTORY
${CURRENT_PACKAGES_DIR}/bin
${CURRENT_PACKAGES_DIR}/debug/bin)
file (MAKE_DIRECTORY
${CURRENT_PACKAGES_DIR}/lib
${CURRENT_PACKAGES_DIR}/debug/lib)
file(COPY ${SOURCE_PATH}/${MSBUILD_PLATFORM}/${DEBUG_CONFIG}/getopt.dll
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
file(COPY ${SOURCE_PATH}/${MSBUILD_PLATFORM}/${RELEASE_CONFIG}/getopt.dll
DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
file(COPY ${SOURCE_PATH}/${MSBUILD_PLATFORM}/${DEBUG_CONFIG}/getopt.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(COPY ${SOURCE_PATH}/${MSBUILD_PLATFORM}/${RELEASE_CONFIG}/getopt.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
file(COPY ${SOURCE_PATH}/${MSBUILD_PLATFORM}/${DEBUG_CONFIG}/getopt.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
file(COPY ${SOURCE_PATH}/${MSBUILD_PLATFORM}/${RELEASE_CONFIG}/getopt.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/getopt RENAME copyright)