[vcpkg] Improve create command to generate initial CONTROL file

This commit is contained in:
Robert Schumacher 2016-09-30 17:09:17 -07:00
parent cddc4f612e
commit 241ca8cd17
2 changed files with 13 additions and 4 deletions

View File

@ -39,16 +39,18 @@ macro(debug_message)
endmacro()
if(CMD MATCHES "^CREATE$")
file(TO_NATIVE_PATH ${VCPKG_ROOT_DIR} NATIVE_VCPKG_ROOT_DIR)
file(TO_NATIVE_PATH ${DOWNLOADS} NATIVE_DOWNLOADS)
if(EXISTS ports/${PORT}/portfile.cmake)
message(FATAL_ERROR "Portfile already exists: '${VCPKG_ROOT_DIR}/ports/${PORT}/portfile.cmake'")
message(FATAL_ERROR "Portfile already exists: '${NATIVE_VCPKG_ROOT_DIR}\\ports\\${PORT}\\portfile.cmake'")
endif()
if(NOT FILENAME)
get_filename_component(FILENAME "${URL}" NAME)
endif()
string(REGEX REPLACE "(\\.(zip|gz|tar|tgz|bz2))+\$" "" ROOT_NAME ${FILENAME})
if(EXISTS ${DOWNLOADS}/${FILENAME})
message(STATUS "Using pre-downloaded: ${DOWNLOADS}/${FILENAME}")
message(STATUS "If this is not desired, delete the file and ${VCPKG_ROOT_DIR}/ports/${PORT}/portfile.cmake")
message(STATUS "Using pre-downloaded: ${NATIVE_DOWNLOADS}\\${FILENAME}")
message(STATUS "If this is not desired, delete the file and ${NATIVE_VCPKG_ROOT_DIR}\\ports\\${PORT}")
else()
include(vcpkg_download_distfile)
file(DOWNLOAD ${URL} ${DOWNLOADS}/${FILENAME} STATUS error_code)
@ -60,8 +62,12 @@ if(CMD MATCHES "^CREATE$")
file(MAKE_DIRECTORY ports/${PORT})
configure_file(scripts/templates/portfile.in.cmake ports/${PORT}/portfile.cmake @ONLY)
configure_file(scripts/templates/CONTROL.in ports/${PORT}/CONTROL @ONLY)
message(STATUS "Generated portfile: ${VCPKG_ROOT_DIR}/ports/${PORT}/portfile.cmake")
message(STATUS "Generated portfile: ${NATIVE_VCPKG_ROOT_DIR}\\ports\\${PORT}\\portfile.cmake")
message(STATUS "Generated CONTROL: ${NATIVE_VCPKG_ROOT_DIR}\\ports\\${PORT}\\CONTROL")
message(STATUS "To launch an editor for these new files, run")
message(STATUS " vcpkg edit ${PORT}")
elseif(CMD MATCHES "^BUILD$")
if(NOT DEFINED CURRENT_PORT_DIR)
message(FATAL_ERROR "CURRENT_PORT_DIR was not defined")

View File

@ -0,0 +1,3 @@
Source: @PORT@
Version:
Description: