[nss] Add new ports nspr and nss (#21281)

* [nspr] Add new port 4.33

* [nss] Add new port 3.73.1

* [nss] Add new port 3.73.1

* Improve code

* Add supports field

* improve code

* version

* Update doc

* [nss] Switch to gyp-nss fork to fix msvc 17 build

* [nss] Improve code

* [nss] Bump version to 3.74

* [nspr] Add new port 4.33

* [nss] Add new port 3.73.1

* improve code

* Update doc

* [nss] Switch to gyp-nss fork to fix msvc 17 build

* [nss] Improve code

* [nss] Bump to 3.74

* [nss] Bump to 3.75

* [nss] Fix mpi.h confusion

When GYP generates rules for ninja, it puts nspr include dirs before nss's
own include dirs. When the msmpi package is installed, this causes
mpi.h from msmpi to be found, instead of multi-precision integer library
that comes bundled with nss.

This patch uses nspr headers from include/nspr subdirectory which sidesteps
the mpi.h from the include root

* [nss] add quotes around paths

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* [nss] remove debug versions of tools

* [nspr] Remove redundant environment variable assignments

* Add dependencies vcpkg-tool-mozbuild and vcpkg-tool-gyp-nss

* clean doc

* version

* Remove unnecessary vcpkg_crosscompiling block on vcpkg-tool-gyp-nss.

Guard for VCPKG_BUILD_TYPE
Improve error reporting for unsupported VCPKG_TARGET_ARCHITECTURE
Declare support for x64 rather than !x86 (given that the URI in question only has x64 binaries)
Fix version numbers to use 'version'.

Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
This commit is contained in:
Burak Arslan 2022-03-21 17:49:12 -07:00 committed by GitHub
parent bea991d2c6
commit b3c7e74cd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 477 additions and 0 deletions

94
ports/nspr/portfile.cmake Normal file
View File

@ -0,0 +1,94 @@
set(NSPR_VERSION "4.33")
vcpkg_download_distfile(ARCHIVE
URLS "https://releases.mozilla.org/pub/nspr/releases/v${NSPR_VERSION}/src/nspr-${NSPR_VERSION}.tar.gz"
FILENAME "nspr-${NSPR_VERSION}.tar.gz"
SHA512 8064f826c977f1302a341ca7a7aaf7977b5d10102062c030b1d42b856638e3408ab262447e8c7cfd5a98879b9b1043d17ceae66fbb1e5ed86d6bc3531f26667e
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF "${NSPR_VERSION}"
)
set(MOZBUILD_ROOT "${CURRENT_HOST_INSTALLED_DIR}/tools/mozbuild")
set(MOZBUILD_BINDIR "${MOZBUILD_ROOT}/bin")
vcpkg_add_to_path("${MOZBUILD_BINDIR}")
set(MOZBUILD_MSYS_ROOT "${MOZBUILD_ROOT}/msys")
vcpkg_add_to_path(PREPEND "${MOZBUILD_MSYS_ROOT}")
set(OPTIONS "")
if (VCPKG_CRT_LINKAGE STREQUAL "dynamic")
list(APPEND OPTIONS "--disable-static-rtl")
else()
list(APPEND OPTIONS "--enable-static-rtl")
endif()
list(APPEND OPTIONS "--enable-win32-target=win95")
if (VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
list(APPEND OPTIONS "--enable-64bit")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
list(APPEND OPTIONS "--disable-64bit")
else()
message(FATAL_ERROR "Unsupported arch: ${VCPKG_TARGET_ARCHITECTURE}")
endif()
set(OPTIONS_DEBUG
"--enable-debug-rtl"
)
set(OPTIONS_RELEASE
"--disable-debug-rtl"
)
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
CONFIGURE_ENVIRONMENT_VARIABLES CC CXX LD
PROJECT_SUBPATH "nspr"
OPTIONS ${OPTIONS}
OPTIONS_DEBUG ${OPTIONS_DEBUG}
OPTIONS_RELEASE ${OPTIONS_RELEASE}
DISABLE_VERBOSE_FLAGS true
)
vcpkg_install_make()
vcpkg_copy_pdbs()
#
# VCPKG FHS adjustments
#
# Release
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(GLOB BIN_RELEASE "${CURRENT_PACKAGES_DIR}/lib/*.dll" "${CURRENT_PACKAGES_DIR}/lib/*.pdb")
list(LENGTH BIN_RELEASE BIN_RELEASE_SIZE)
if (BIN_RELEASE_SIZE GREATER 0)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin")
foreach(path ${BIN_RELEASE})
get_filename_component(name "${path}" NAME)
file(RENAME "${CURRENT_PACKAGES_DIR}/lib/${name}" "${CURRENT_PACKAGES_DIR}/bin/${name}")
endforeach()
endif()
endif()
# Debug
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(GLOB BIN_DEBUG "${CURRENT_PACKAGES_DIR}/debug/lib/*.dll" "${CURRENT_PACKAGES_DIR}/debug/lib/*.pdb")
list(LENGTH BIN_DEBUG BIN_DEBUG_SIZE)
if (BIN_DEBUG_SIZE GREATER 0)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin")
foreach(path IN LISTS BIN_DEBUG)
get_filename_component(name "${path}" NAME)
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/${name}" "${CURRENT_PACKAGES_DIR}/debug/bin/${name}")
endforeach()
endif()
endif()
# Copy license
file(INSTALL "${SOURCE_PATH}/nspr/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/nspr" RENAME copyright)

14
ports/nspr/vcpkg.json Normal file
View File

@ -0,0 +1,14 @@
{
"name": "nspr",
"version": "4.33",
"description": "Netscape portable runtime",
"homepage": "https://releases.mozilla.org/pub/nspr/",
"license": "MPL-2.0",
"supports": "windows & !(arm | uwp | static)",
"dependencies": [
{
"name": "vcpkg-tool-mozbuild",
"host": true
}
]
}

View File

@ -0,0 +1,12 @@
diff -ur x64-windows-rel/nss/coreconf/config.gypi src/3.66-485ec2a7fc.clean/nss/coreconf/config.gypi
--- a/nss/coreconf/config.gypi 2021-05-28 02:50:43.000000000 -0700
+++ b/nss/coreconf/config.gypi 2021-11-09 07:51:35.884650900 -0800
@@ -44,7 +44,7 @@
}],
['OS=="win"', {
'use_system_zlib%': 0,
- 'nspr_libs%': ['libnspr4.lib', 'libplc4.lib', 'libplds4.lib'],
+ 'nspr_libs%': ['nspr4.lib', 'plc4.lib', 'plds4.lib'],
'zlib_libs%': [],
#TODO
'moz_debug_flags%': '',

View File

@ -0,0 +1,15 @@
diff -ur
--- a/nss/coreconf/config.gypi 2021-11-09 22:46:52.555246500 -0800
+++ b/nss/coreconf/config.gypi 2021-11-10 00:49:48.044560100 -0800
@@ -638,9 +638,11 @@
'VCCLCompilerTool': {
'Optimization': '<(release_optimization_level)',
'RuntimeLibrary': '2', # /MD
+ 'DebugInformationFormat': '3',
},
'VCLinkerTool': {
'LinkIncremental': '1',
+ 'GenerateDebugInformation' : 'true',
},
},
},

208
ports/nss/portfile.cmake Normal file
View File

@ -0,0 +1,208 @@
set(NSS_VERSION "3.75")
string(REPLACE "." "_" V_URL ${NSS_VERSION})
vcpkg_download_distfile(ARCHIVE
URLS "https://ftp.mozilla.org/pub/security/nss/releases/NSS_${V_URL}_RTM/src/nss-${NSS_VERSION}.tar.gz"
FILENAME "nss-${NSS_VERSION}.tar.gz"
SHA512 0ad42f663b48649d7d16dc8b8956d2971a9566c0f7f655dd0609b94877f400977e5ad693f2eb44e1e277e55d1669294f07b3ba7a32573d3d72837b3944adf86d
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF "${NSS_VERSION}"
PATCHES "01-nspr-no-lib-prefix.patch"
)
# setup ninja
vcpkg_find_acquire_program(NINJA)
get_filename_component(NINJA_ROOT "${NINJA}" DIRECTORY)
list(APPEND CMAKE_PROGRAM_PATH "${NINJA_ROOT}")
vcpkg_add_to_path(APPEND "${NINJA_ROOT}")
# setup mozbuild for windows
if (VCPKG_TARGET_IS_WINDOWS)
set(MOZBUILD_ROOT "${CURRENT_HOST_INSTALLED_DIR}/tools/mozbuild")
set(MOZBUILD_BINDIR "${MOZBUILD_ROOT}/bin")
vcpkg_add_to_path(PREPEND "${MOZBUILD_BINDIR}")
set(MOZBUILD_MSYS_ROOT "${MOZBUILD_ROOT}/msys")
vcpkg_add_to_path(PREPEND "${MOZBUILD_MSYS_ROOT}/bin")
find_program(MOZBUILD_MAKE_COMMAND make PATHS "${MOZBUILD_MSYS_ROOT}/bin" NO_DEFAULT_PATH REQUIRED)
message(STATUS "Found make: ${MOZBUILD_MAKE_COMMAND}")
find_program(MOZBUILD_BASH bash PATHS "${MOZBUILD_MSYS_ROOT}/bin" NO_DEFAULT_PATH REQUIRED)
message(STATUS "Found bash: ${MOZBUILD_BASH}")
set(MOZBUILD_PYTHON_ROOT "${MOZBUILD_ROOT}/python")
find_program(MOZBUILD_PYTHON python PATHS "${MOZBUILD_ROOT}/python" NO_DEFAULT_PATH REQUIRED)
message(STATUS "Found python: ${MOZBUILD_PYTHON}")
vcpkg_add_to_path(PREPEND "${MOZBUILD_PYTHON_ROOT}")
else()
# TODO: setup non-windows build environment
endif()
set(GYP_NSS_ROOT "${CURRENT_HOST_INSTALLED_DIR}/tools/gyp-nss")
if (VCPKG_HOST_IS_WINDOWS)
find_file(GYP_NSS NAMES gyp.bat PATHS "${GYP_NSS_ROOT}" NO_DEFAULT_PATH REQUIRED)
else()
find_program(GYP_NSS NAMES gyp PATHS "${GYP_NSS_ROOT}" NO_DEFAULT_PATH REQUIRED)
endif()
vcpkg_add_to_path(PREPEND "${GYP_NSS_ROOT}")
message(STATUS "Found gyp: ${GYP_NSS}")
# setup paths
execute_process(
COMMAND ${MOZBUILD_BASH} -c pwd
WORKING_DIRECTORY ${CURRENT_INSTALLED_DIR}/include
OUTPUT_VARIABLE VCPKG_INCLUDEDIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "Using headers from: ${VCPKG_INCLUDEDIR} arch: ${VCPKG_TARGET_ARCHITECTURE}")
execute_process(
COMMAND ${MOZBUILD_BASH} -c pwd
WORKING_DIRECTORY ${CURRENT_INSTALLED_DIR}/lib
OUTPUT_VARIABLE VCPKG_LIBDIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "Using libraries from: ${VCPKG_LIBDIR} arch: ${VCPKG_TARGET_ARCHITECTURE}")
#
# get to work
#
# see help.txt in nss root
set(OPTIONS
"-v" "-g"
"--disable-tests"
"--with-nspr=${VCPKG_INCLUDEDIR}/nspr:${VCPKG_LIBDIR}"
"--system-sqlite"
"-Dsign_libs=0"
)
if (VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
list(APPEND OPTIONS "--target=x64")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
list(APPEND OPTIONS "--target=ia32")
else()
message(FATAL_ERROR "Unsupported arch: ${VCPKG_TARGET_ARCHITECTURE}")
endif()
if (VCPKG_TARGET_IS_WINDOWS)
list(APPEND OPTIONS
"--msvc"
)
endif()
set(VCPKG_BINARY_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}")
# build debug
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
message(STATUS "Copying sources to debug build dir ...")
file(COPY "${SOURCE_PATH}/nss" DESTINATION "${VCPKG_BINARY_DIR}-dbg")
message(STATUS "Building debug ...")
vcpkg_execute_required_process(
COMMAND ${MOZBUILD_BASH} ./build.sh ${OPTIONS}
WORKING_DIRECTORY ${VCPKG_BINARY_DIR}-dbg/nss
LOGNAME build-${TARGET_TRIPLET}${short_buildtype}
)
endif()
# build release
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
message(STATUS "Copying sources to release build dir ...")
file(COPY "${SOURCE_PATH}/nss" DESTINATION "${VCPKG_BINARY_DIR}-rel")
message(STATUS "Building release ...")
vcpkg_execute_required_process(
COMMAND ${MOZBUILD_BASH} ./build.sh ${OPTIONS} "--opt"
WORKING_DIRECTORY ${VCPKG_BINARY_DIR}-rel/nss
LOGNAME build-${TARGET_TRIPLET}${short_buildtype}
)
endif()
#
# VCPKG FHS adjustments
#
# Headers
file(
COPY "${VCPKG_BINARY_DIR}-rel/dist/public/nss"
DESTINATION "${CURRENT_PACKAGES_DIR}/include"
)
file(
COPY "${VCPKG_BINARY_DIR}-rel/dist/private/nss/"
DESTINATION "${CURRENT_PACKAGES_DIR}/include/nss/private"
)
# Release libraries
file(GLOB LIB_RELEASE
"${VCPKG_BINARY_DIR}-rel/dist/Release/lib/*.dll"
"${VCPKG_BINARY_DIR}-rel/dist/Release/lib/*.pdb"
)
list(LENGTH LIB_RELEASE LIB_RELEASE_SIZE)
if (LIB_RELEASE_SIZE GREATER 0)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin")
foreach(path ${LIB_RELEASE})
get_filename_component(name "${path}" NAME)
file(RENAME "${path}" "${CURRENT_PACKAGES_DIR}/bin/${name}")
endforeach()
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib")
file(COPY "${VCPKG_BINARY_DIR}-rel/dist/Release/lib" DESTINATION "${CURRENT_PACKAGES_DIR}")
endif()
# Release tools
vcpkg_copy_tools(
TOOL_NAMES
"certutil"
"cmsutil"
"crlutil"
"hw-support"
"modutil"
"nss"
"pk12util"
"pwdecrypt"
"shlibsign"
"signtool"
"signver"
"ssltap"
"symkeyutil"
"validation"
SEARCH_DIR "${VCPKG_BINARY_DIR}-rel/dist/Release/bin/"
DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}"
)
# Debug libraries
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(GLOB LIB_DEBUG
"${VCPKG_BINARY_DIR}-dbg/dist/Debug/lib/*.dll"
"${VCPKG_BINARY_DIR}-dbg/dist/Debug/lib/*.pdb"
)
list(LENGTH LIB_DEBUG LIB_DEBUG_SIZE)
if (LIB_DEBUG_SIZE GREATER 0)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin")
foreach(path ${LIB_DEBUG})
get_filename_component(name "${path}" NAME)
file(RENAME "${path}" "${CURRENT_PACKAGES_DIR}/debug/bin/${name}")
endforeach()
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib")
file(COPY "${VCPKG_BINARY_DIR}-dbg/dist/Debug/lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug")
endif()
endif()
# Copy license
file(INSTALL "${SOURCE_PATH}/nss/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/nss" RENAME copyright)

20
ports/nss/vcpkg.json Normal file
View File

@ -0,0 +1,20 @@
{
"name": "nss",
"version": "3.75",
"description": "Network Security Services from Mozilla",
"homepage": "https://ftp.mozilla.org/pub/security/nss/releases/",
"license": "MPL-2.0",
"supports": "windows & !arm",
"dependencies": [
"nspr",
"sqlite3",
{
"name": "vcpkg-tool-gyp-nss",
"host": true
},
{
"name": "vcpkg-tool-mozbuild",
"host": true
}
]
}

View File

@ -0,0 +1,21 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
set(PROGNAME gyp-nss)
set(PROG_VERSION b3177c3f6c2c45a8ca098ae0f0ebb4536c624762)
set(ARCHIVE gyp-nss-${PROG_VERSION})
vcpkg_download_distfile(ARCHIVE_PATH
URLS "https://github.com/plq/gyp-nss/archive/${PROG_VERSION}.zip"
SHA512 7cd05e1bdcdb579e8226ecae2e925285e164349927f60350b87703afe9cbdc308f044bc9f6455318f99778b7b49304003aab47f6c587a13e6fbdaaa1533c558d
FILENAME "${ARCHIVE}.zip"
)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools")
vcpkg_execute_in_download_mode(
COMMAND "${CMAKE_COMMAND}" -E tar xzf "${ARCHIVE_PATH}"
WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools"
)
file(GLOB_RECURSE folders "${CURRENT_PACKAGES_DIR}/tools/*" LIST_DIRECTORIES true)
file(RENAME "${CURRENT_PACKAGES_DIR}/tools/${ARCHIVE}" "${CURRENT_PACKAGES_DIR}/tools/gyp-nss")

View File

@ -0,0 +1,6 @@
{
"name": "vcpkg-tool-gyp-nss",
"version-date": "2022-03-04",
"description": "https://github.com/plq/gyp-nss",
"supports": "native"
}

View File

@ -0,0 +1,28 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
set(PROGNAME mozbuild)
set(EXE_NAME mozmake)
set(PROG_VERSION 3.3)
set(ARCHIVE MozillaBuildSetup-${PROG_VERSION})
set(BASE_URL "https://ftp.mozilla.org/pub/mozilla/libraries/win32/MozillaBuildSetup-")
set(URL "${BASE_URL}${PROG_VERSION}.exe")
set(HASH ac33d15dd9c974ef8ad581f9b414520a9d5e3b9816ab2bbf3e305d0a33356cc22c356cd9761e64a19588d17b6c13f124e837cfb462a36b8da898899e7db22ded)
if(VCPKG_CROSSCOMPILING)
message(FATAL_ERROR "This is a host only port!")
endif()
vcpkg_download_distfile(ARCHIVE_PATH
URLS "${URL}"
SHA512 ${HASH}
FILENAME "${ARCHIVE}.7z.exe"
)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/mozbuild")
vcpkg_find_acquire_program(7Z)
vcpkg_execute_in_download_mode(
COMMAND "${7Z}" x "${ARCHIVE_PATH}" -aoa
WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/mozbuild"
)

View File

@ -0,0 +1,7 @@
{
"name": "vcpkg-tool-mozbuild",
"version": "3.3",
"description": "mozbuild is a Python package providing functionality used by Mozillas build system",
"homepage": "https://firefox-source-docs.mozilla.org/build/buildsystem/mozbuild/index.html",
"supports": "native & x64 & windows"
}

View File

@ -4848,6 +4848,14 @@
"baseline": "4.1.2",
"port-version": 1
},
"nspr": {
"baseline": "4.33",
"port-version": 0
},
"nss": {
"baseline": "3.75",
"port-version": 0
},
"nsync": {
"baseline": "1.24.0",
"port-version": 0
@ -7272,6 +7280,10 @@
"baseline": "2021-10-23",
"port-version": 0
},
"vcpkg-tool-gyp-nss": {
"baseline": "2022-03-04",
"port-version": 0
},
"vcpkg-tool-lessmsi": {
"baseline": "1.10.0",
"port-version": 0
@ -7280,6 +7292,10 @@
"baseline": "0.60.2",
"port-version": 2
},
"vcpkg-tool-mozbuild": {
"baseline": "3.3",
"port-version": 0
},
"vcpkg-tool-nodejs": {
"baseline": "14.17.4",
"port-version": 0

9
versions/n-/nspr.json Normal file
View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "ec6fe24b3b4db98f624391627f113a7bd93397eb",
"version": "4.33",
"port-version": 0
}
]
}

9
versions/n-/nss.json Normal file
View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "96cd78f1c74951c2e623deff9549d776bf4968b5",
"version": "3.75",
"port-version": 0
}
]
}

View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "724d29c42ace865fdba94d8c32bdbe987072eaaa",
"version-date": "2022-03-04",
"port-version": 0
}
]
}

View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "9ec0167eafba536f0f5d8a83807f6b3b0dbb50be",
"version": "3.3",
"port-version": 0
}
]
}