Skip to content

Commit

Permalink
Prevent python3 build failure (#9014)
Browse files Browse the repository at this point in the history
* Prevent python3 build failure

If VCPKG_BUILD_TYPE release is set inside a
triplet, then the build will fail because
the port file attempts to deal with debug
files which will never exist. The changes
in this patch allow the build to succeed
if VCPKG_BUILD_TYPE release is stipulated
using a triplet before a build of the
python3 port is initiated.

* python3 version bump

Port clean up and version number
bump.

* libxslt release triplet build fix

This patch fixes a condition where
if a debug build is disabled via
triplet, the build fails and an
empty directory error message
is sent to the console.
  • Loading branch information
heydojo authored and grdowns committed Nov 18, 2019
1 parent df4773c commit d02bfe0
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 20 deletions.
2 changes: 1 addition & 1 deletion ports/libxslt/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: libxslt
Version: 1.1.33-4
Version: 1.1.33-5
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
8 changes: 6 additions & 2 deletions ports/libxslt/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ vcpkg_from_github(
if (VCPKG_TARGET_IS_WINDOWS)
# Create some directories ourselves, because the makefile doesn't
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
set(CONFIGURE_COMMAND_TEMPLATE
cruntime=@CRUNTIME@
debug=@DEBUGMODE@
Expand Down Expand Up @@ -147,7 +149,9 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/tools)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)

vcpkg_copy_pdbs()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_copy_pdbs()
endif()

file(INSTALL ${SOURCE_PATH}/Copyright DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

2 changes: 1 addition & 1 deletion ports/python3/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: python3
Version: 3.7.3
Version: 3.7.4
Homepage: https://github.com/python/cpython
Description: The Python programming language as an embeddable library
Build-Depends: libffi, openssl
46 changes: 30 additions & 16 deletions ports/python3/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,33 +42,45 @@ if (VCPKG_TARGET_IS_WINDOWS)

file(GLOB HEADERS ${SOURCE_PATH}/Include/*.h)
file(COPY ${HEADERS} ${SOURCE_PATH}/PC/pyconfig.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})

file(COPY ${SOURCE_PATH}/Lib DESTINATION ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR})

file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_d.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_d.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
endif()

if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_d.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_d.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()

endif()

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_copy_pdbs()
endif()

vcpkg_copy_pdbs()

# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR})
file(RENAME ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}/LICENSE ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}/copyright)

elseif (VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX)
set(SOURCE_PATH_DEBUG "${TEMP_SOURCE_PATH}-${TARGET_TRIPLET}-debug")

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
set(SOURCE_PATH_DEBUG "${TEMP_SOURCE_PATH}-${TARGET_TRIPLET}-debug")
endif()

set(SOURCE_PATH_RELEASE "${TEMP_SOURCE_PATH}-${TARGET_TRIPLET}-release")

file(REMOVE_RECURSE ${SOURCE_PATH_RELEASE})
file(GLOB FILES ${TEMP_SOURCE_PATH}/*)
file(COPY ${FILES} DESTINATION ${SOURCE_PATH_RELEASE})

file(REMOVE_RECURSE ${SOURCE_PATH_DEBUG})
file(RENAME "${TEMP_SOURCE_PATH}" ${SOURCE_PATH_DEBUG})


if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(REMOVE_RECURSE ${SOURCE_PATH_DEBUG})
file(RENAME "${TEMP_SOURCE_PATH}" ${SOURCE_PATH_DEBUG})
endif()

find_program(MAKE make)
if (NOT MAKE)
message(FATAL_ERROR "MAKE not found")
Expand Down Expand Up @@ -97,6 +109,7 @@ elseif (VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX)
endif()

message(STATUS "Building ${TARGET_TRIPLET}-rel")

vcpkg_execute_build_process(
COMMAND make -j ${VCPKG_CONCURRENCY}
NO_PARALLEL_COMMAND make
Expand All @@ -113,14 +126,13 @@ elseif (VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX)

file(GLOB HEADERS ${OUT_PATH_RELEASE}/include/*)
file(COPY ${HEADERS} DESTINATION ${CURRENT_PACKAGES_DIR}/include)

file(GLOB LIBS ${OUT_PATH_RELEASE}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/*)
file(COPY ${LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}/Lib)

file(GLOB LIBS ${OUT_PATH_RELEASE}/lib/pkgconfig/*)
file(COPY ${LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR})
file(COPY ${OUT_PATH_RELEASE}/lib/libpython${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}m.a DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
message(STATUS "Installing ${TARGET_TRIPLET}-rel done")

endif()

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
Expand All @@ -130,6 +142,7 @@ elseif (VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX)
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
set(OUT_PATH_DEBUG ${SOURCE_PATH_DEBUG}/../../make-build-${TARGET_TRIPLET}-debug)
file(MAKE_DIRECTORY ${OUT_PATH_DEBUG})

if(VCPKG_TARGET_IS_OSX)
vcpkg_execute_build_process(
COMMAND "${SOURCE_PATH_DEBUG}/configure" --with-pydebug --prefix=${OUT_PATH_DEBUG} --with-openssl=${CURRENT_INSTALLED_DIR}/debug "CPPFLAGS=-I${CURRENT_INSTALLED_DIR}/include -framework CoreFoundation" "LDFLAGS=-L${CURRENT_INSTALLED_DIR}/debug/lib" "LIBS=-liconv"
Expand Down Expand Up @@ -161,9 +174,10 @@ elseif (VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX)

file(COPY ${OUT_PATH_DEBUG}/lib/libpython${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}dm.a DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
message(STATUS "Installing ${TARGET_TRIPLET}-dbg done")

endif()

# Handle copyright
file(COPY ${SOURCE_PATH_RELEASE}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR})
file(RENAME ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}/LICENSE ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}/copyright)

endif()

0 comments on commit d02bfe0

Please sign in to comment.