From ff0b55e6823deb161c9a574ea48d45ca21f48738 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Sun, 19 Dec 2021 07:04:00 +0100 Subject: [PATCH 1/4] Use vcpkg_build_nmake --- ports/pdcurses/nmake-install.patch | 21 +++++++ ports/pdcurses/portfile.cmake | 98 +++++++++++------------------- ports/pdcurses/vcpkg.json | 5 +- scripts/ci.baseline.txt | 6 -- 4 files changed, 59 insertions(+), 71 deletions(-) create mode 100644 ports/pdcurses/nmake-install.patch diff --git a/ports/pdcurses/nmake-install.patch b/ports/pdcurses/nmake-install.patch new file mode 100644 index 00000000000000..145057d1d7c5f3 --- /dev/null +++ b/ports/pdcurses/nmake-install.patch @@ -0,0 +1,21 @@ +diff --git a/wincon/Makefile.vc b/wincon/Makefile.vc +index 80c4689..1bae388 100644 +--- a/wincon/Makefile.vc ++++ b/wincon/Makefile.vc +@@ -118,3 +118,16 @@ tui.obj: $(demodir)\tui.c $(demodir)\tui.h + + tuidemo.obj: $(demodir)\tuidemo.c + $(BUILD) -I$(demodir) $(demodir)\tuidemo.c ++ ++install: all ++ -mkdir $(INSTDIR)\lib ++ copy pdcurses.lib $(INSTDIR)\lib ++!ifdef DLL ++ -mkdir $(INSTDIR)\bin ++ copy pdcurses.dll $(INSTDIR)\bin ++!endif ++!ifndef SKIP_HEADERS ++ -mkdir $(INSTDIR)\include ++ copy $(PDCURSES_SRCDIR)\curses.h $(INSTDIR)\include ++ copy $(PDCURSES_SRCDIR)\panel.h $(INSTDIR)\include ++!endif diff --git a/ports/pdcurses/portfile.cmake b/ports/pdcurses/portfile.cmake index 81b201c1b61b17..3474fea2b05365 100644 --- a/ports/pdcurses/portfile.cmake +++ b/ports/pdcurses/portfile.cmake @@ -1,73 +1,45 @@ -vcpkg_check_linkage(ONLY_DYNAMIC_CRT) - -find_program(NMAKE nmake) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO wmcbrine/PDCurses REF 6c1f95c4fa9f9f105879c2d99dd72a5bf335c046 # 3.9 SHA512 2d682a3516baaa58a97854aca64d985768b7af76d998240b54afc57ddf2a44894835a1748888f8dd7c1cc8045ede77488284f8adf1b73878879b4b4d3391218d HEAD_REF master + PATCHES + nmake-install.patch ) - -set(PDC_NMAKE_CMD ${NMAKE} /A -f ${SOURCE_PATH}/wincon/Makefile.vc WIDE=Y UTF8=Y) - -set(PDC_NMAKE_CWD ${SOURCE_PATH}/wincon) -set(PDC_PDCLIB ${SOURCE_PATH}/wincon/pdcurses) - -if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - set(PDC_NMAKE_CMD ${PDC_NMAKE_CMD} DLL=Y) -endif() - -message(STATUS "Build ${TARGET_TRIPLET}-rel") -vcpkg_execute_required_process( - COMMAND ${PDC_NMAKE_CMD} - WORKING_DIRECTORY ${PDC_NMAKE_CWD} - LOGNAME build-${TARGET_TRIPLET}-rel -) -message(STATUS "Build ${TARGET_TRIPLET}-rel done") - -file ( - COPY ${PDC_PDCLIB}.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/lib -) -if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - file ( - COPY ${PDC_PDCLIB}.dll - DESTINATION ${CURRENT_PACKAGES_DIR}/bin + +if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + cmake_path(NATIVE_PATH SOURCE_PATH PDCURSES_SRCDIR) + cmake_path(NATIVE_PATH CURRENT_PACKAGES_DIR INSTDIR) + set(DLL_OPTION "") + if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(DLL_OPTION DLL=Y) + endif() + vcpkg_build_nmake( + SOURCE_PATH "${SOURCE_PATH}/wincon" + PROJECT_NAME Makefile.vc + ENABLE_INSTALL + OPTIONS + /A + "PDCURSES_SRCDIR=${PDCURSES_SRCDIR}" + WIDE=Y + UTF8=Y + ${DLL_OPTION} + OPTIONS_RELEASE + "INSTDIR=${INSTDIR}" + "CFLAGS=-D_CRT_SECURE_NO_WARNINGS" + "LDFLAGS=" + OPTIONS_DEBUG + "INSTDIR=${INSTDIR}\\debug" + "CFLAGS=-D_CRT_SECURE_NO_WARNINGS -DPDCDEBUG" + "LDFLAGS=-debug" + DEBUG=Y + SKIP_HEADERS=Y ) + vcpkg_copy_pdbs() + if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/curses.h" "#ifdef PDC_DLL_BUILD" "#if 1") + endif() endif() -message(STATUS "Build ${TARGET_TRIPLET}-dbg") -vcpkg_execute_required_process( - COMMAND ${PDC_NMAKE_CMD} DEBUG=Y - WORKING_DIRECTORY ${PDC_NMAKE_CWD} - LOGNAME build-${TARGET_TRIPLET}-dbg -) -message(STATUS "Build ${TARGET_TRIPLET}-dbg done") - -file ( - INSTALL ${PDC_PDCLIB}.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib -) -if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - file ( - INSTALL ${PDC_PDCLIB}.dll - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin - ) -endif() - -file( - INSTALL ${SOURCE_PATH}/curses.h ${SOURCE_PATH}/panel.h - DESTINATION ${CURRENT_PACKAGES_DIR}/include -) - -if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - file(READ ${CURRENT_PACKAGES_DIR}/include/curses.h _contents) - string(REPLACE "#ifdef PDC_DLL_BUILD" "#if 1" _contents "${_contents}") - file(WRITE ${CURRENT_PACKAGES_DIR}/include/curses.h "${_contents}") -endif() - -file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/pdcurses RENAME copyright) - -vcpkg_copy_pdbs() \ No newline at end of file +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/pdcurses/vcpkg.json b/ports/pdcurses/vcpkg.json index 59398f2fe49937..fa26f9b12d3599 100644 --- a/ports/pdcurses/vcpkg.json +++ b/ports/pdcurses/vcpkg.json @@ -1,7 +1,8 @@ { "name": "pdcurses", "version-string": "3.9", - "port-version": 2, + "port-version": 3, "description": "Public Domain Curses - a curses library for environments that don't fit the termcap/terminfo model.", - "homepage": "https://pdcurses.org/" + "homepage": "https://pdcurses.org/", + "supports": "windows & !uwp & !mingw" } diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 88689adb9c38ea..d868f286f10c7f 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1120,12 +1120,6 @@ pdal:x64-linux=fail pdal:x64-osx=fail pdal-c:x64-windows-static=fail pdal-c:x64-windows-static-md=fail -pdcurses:arm-uwp=fail -pdcurses:x64-linux=fail -pdcurses:x64-osx=fail -pdcurses:x64-uwp=fail -pdcurses:x64-windows-static=fail -pdcurses:x64-windows-static-md=fail pfring:arm64-windows=fail pfring:arm-uwp=fail pfring:x64-uwp=fail From 9509a9740509a43506750850db4dfc953c529222 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Sun, 19 Dec 2021 07:37:13 +0100 Subject: [PATCH 2/4] Update versions --- versions/baseline.json | 2 +- versions/p-/pdcurses.json | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/versions/baseline.json b/versions/baseline.json index 8f110801d4c84c..d0ed287e79ddc8 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5210,7 +5210,7 @@ }, "pdcurses": { "baseline": "3.9", - "port-version": 2 + "port-version": 3 }, "pdqsort": { "baseline": "2019-07-30", diff --git a/versions/p-/pdcurses.json b/versions/p-/pdcurses.json index 28588339065bf0..22b1d54b0cd227 100644 --- a/versions/p-/pdcurses.json +++ b/versions/p-/pdcurses.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "209926d000b4cc48ccbaab7717969d3b1671693b", + "version-string": "3.9", + "port-version": 3 + }, { "git-tree": "190eafb5554bf1f484edff1aa94598bac3ff9830", "version-string": "3.9", From 575abd523bb2f81fc054447fc3405592f5c88cdd Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Mon, 20 Dec 2021 19:22:56 +0100 Subject: [PATCH 3/4] Use INSTALLDIR --- ports/pdcurses/nmake-install.patch | 14 +++++++------- ports/pdcurses/portfile.cmake | 3 --- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/ports/pdcurses/nmake-install.patch b/ports/pdcurses/nmake-install.patch index 145057d1d7c5f3..892550352f4e3d 100644 --- a/ports/pdcurses/nmake-install.patch +++ b/ports/pdcurses/nmake-install.patch @@ -8,14 +8,14 @@ index 80c4689..1bae388 100644 $(BUILD) -I$(demodir) $(demodir)\tuidemo.c + +install: all -+ -mkdir $(INSTDIR)\lib -+ copy pdcurses.lib $(INSTDIR)\lib ++ -mkdir $(INSTALLDIR)\lib ++ copy pdcurses.lib $(INSTALLDIR)\lib +!ifdef DLL -+ -mkdir $(INSTDIR)\bin -+ copy pdcurses.dll $(INSTDIR)\bin ++ -mkdir $(INSTALLDIR)\bin ++ copy pdcurses.dll $(INSTALLDIR)\bin +!endif +!ifndef SKIP_HEADERS -+ -mkdir $(INSTDIR)\include -+ copy $(PDCURSES_SRCDIR)\curses.h $(INSTDIR)\include -+ copy $(PDCURSES_SRCDIR)\panel.h $(INSTDIR)\include ++ -mkdir $(INSTALLDIR)\include ++ copy $(PDCURSES_SRCDIR)\curses.h $(INSTALLDIR)\include ++ copy $(PDCURSES_SRCDIR)\panel.h $(INSTALLDIR)\include +!endif diff --git a/ports/pdcurses/portfile.cmake b/ports/pdcurses/portfile.cmake index 3474fea2b05365..7869f2185a6e18 100644 --- a/ports/pdcurses/portfile.cmake +++ b/ports/pdcurses/portfile.cmake @@ -10,7 +10,6 @@ vcpkg_from_github( if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) cmake_path(NATIVE_PATH SOURCE_PATH PDCURSES_SRCDIR) - cmake_path(NATIVE_PATH CURRENT_PACKAGES_DIR INSTDIR) set(DLL_OPTION "") if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") set(DLL_OPTION DLL=Y) @@ -26,11 +25,9 @@ if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) UTF8=Y ${DLL_OPTION} OPTIONS_RELEASE - "INSTDIR=${INSTDIR}" "CFLAGS=-D_CRT_SECURE_NO_WARNINGS" "LDFLAGS=" OPTIONS_DEBUG - "INSTDIR=${INSTDIR}\\debug" "CFLAGS=-D_CRT_SECURE_NO_WARNINGS -DPDCDEBUG" "LDFLAGS=-debug" DEBUG=Y From c5f73c09def96a460a6001df413ef9767952e5fb Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Mon, 20 Dec 2021 19:23:38 +0100 Subject: [PATCH 4/4] Update versions --- versions/p-/pdcurses.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/p-/pdcurses.json b/versions/p-/pdcurses.json index 22b1d54b0cd227..68869abfcd4d59 100644 --- a/versions/p-/pdcurses.json +++ b/versions/p-/pdcurses.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "209926d000b4cc48ccbaab7717969d3b1671693b", + "git-tree": "e09ec910aff6b25bd1e1554b15dce08656b3f3d5", "version-string": "3.9", "port-version": 3 },