Browse Source

boringssl: add version 2022.06.13 (#3817)

* boringssl: add version 2022.06.13

* Update xmake.lua

* add patch

* go: add version 1.22.2

* disable windows arm

---------

Co-authored-by: star9029 <[email protected]>
Ariaszzzhc 1 year ago
parent
commit
791cc162cf

+ 180 - 0
packages/b/boringssl/patches/2022.06.13/cmake.patch

@@ -0,0 +1,180 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index aadcb9b..e8e1f50 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -567,8 +567,6 @@ endif()
+ 
+ # Add minimal googletest targets. The provided one has many side-effects, and
+ # googletest has a very straightforward build.
+-add_library(boringssl_gtest third_party/googletest/src/gtest-all.cc)
+-target_include_directories(boringssl_gtest PRIVATE third_party/googletest)
+ 
+ include_directories(third_party/googletest/include)
+ 
+@@ -594,15 +592,14 @@ add_custom_command(
+   DEPENDS util/embed_test_data.go ${CRYPTO_TEST_DATA}
+   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+ 
+-add_library(crypto_test_data OBJECT crypto_test_data.cc)
+ 
+ add_subdirectory(crypto)
+ add_subdirectory(ssl)
+-add_subdirectory(ssl/test)
++# add_subdirectory(ssl/test)
+ add_subdirectory(tool)
+ add_subdirectory(util/fipstools)
+ add_subdirectory(util/fipstools/acvp/modulewrapper)
+-add_subdirectory(decrepit)
++# add_subdirectory(decrepit)
+ 
+ if(FUZZ)
+   if(LIBFUZZER_FROM_DEPS)
+@@ -653,16 +650,7 @@ else()
+   add_custom_target(fips_specific_tests_if_any)
+ endif()
+ 
+-add_custom_target(
+-    run_tests
+-    COMMAND ${GO_EXECUTABLE} run util/all_tests.go -build-dir
+-            ${CMAKE_BINARY_DIR}
+-    COMMAND cd ssl/test/runner &&
+-            ${GO_EXECUTABLE} test -shim-path $<TARGET_FILE:bssl_shim>
+-              ${HANDSHAKER_ARGS} ${RUNNER_ARGS}
+-    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+-    DEPENDS all_tests bssl_shim handshaker fips_specific_tests_if_any
+-    USES_TERMINAL)
++
+ 
+ install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ 
+diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt
+index cf7199c..73cdd70 100644
+--- a/crypto/CMakeLists.txt
++++ b/crypto/CMakeLists.txt
+@@ -91,7 +91,6 @@ function(perlasm dest src)
+ endfunction()
+ 
+ add_subdirectory(fipsmodule)
+-add_subdirectory(test)
+ 
+ if(FIPS_DELOCATE OR FIPS_SHARED)
+   SET_SOURCE_FILES_PROPERTIES(fipsmodule/bcm.o PROPERTIES EXTERNAL_OBJECT true)
+@@ -478,93 +477,3 @@ endif()
+ # urandom_test is a separate binary because it needs to be able to observe the
+ # PRNG initialisation, which means that it can't have other tests running before
+ # it does.
+-add_executable(
+-  urandom_test
+-
+-  fipsmodule/rand/urandom_test.cc
+-)
+-
+-target_link_libraries(urandom_test test_support_lib boringssl_gtest crypto)
+-
+-add_dependencies(urandom_test global_target)
+-add_dependencies(all_tests urandom_test)
+-
+-add_executable(
+-  crypto_test
+-
+-  abi_self_test.cc
+-  asn1/asn1_test.cc
+-  base64/base64_test.cc
+-  bio/bio_test.cc
+-  blake2/blake2_test.cc
+-  buf/buf_test.cc
+-  bytestring/bytestring_test.cc
+-  chacha/chacha_test.cc
+-  cipher_extra/aead_test.cc
+-  cipher_extra/cipher_test.cc
+-  compiler_test.cc
+-  conf/conf_test.cc
+-  constant_time_test.cc
+-  cpu_arm_linux_test.cc
+-  crypto_test.cc
+-  curve25519/ed25519_test.cc
+-  curve25519/spake25519_test.cc
+-  curve25519/x25519_test.cc
+-  ecdh_extra/ecdh_test.cc
+-  dh_extra/dh_test.cc
+-  digest_extra/digest_test.cc
+-  dsa/dsa_test.cc
+-  err/err_test.cc
+-  evp/evp_extra_test.cc
+-  evp/evp_test.cc
+-  evp/pbkdf_test.cc
+-  evp/scrypt_test.cc
+-  fipsmodule/aes/aes_test.cc
+-  fipsmodule/bn/bn_test.cc
+-  fipsmodule/cmac/cmac_test.cc
+-  fipsmodule/ec/ec_test.cc
+-  fipsmodule/ec/p256-nistz_test.cc
+-  fipsmodule/ecdsa/ecdsa_test.cc
+-  fipsmodule/md5/md5_test.cc
+-  fipsmodule/modes/gcm_test.cc
+-  fipsmodule/rand/ctrdrbg_test.cc
+-  fipsmodule/rand/fork_detect_test.cc
+-  fipsmodule/service_indicator/service_indicator_test.cc
+-  fipsmodule/sha/sha_test.cc
+-  hkdf/hkdf_test.cc
+-  hpke/hpke_test.cc
+-  hmac_extra/hmac_test.cc
+-  hrss/hrss_test.cc
+-  impl_dispatch_test.cc
+-  lhash/lhash_test.cc
+-  obj/obj_test.cc
+-  pem/pem_test.cc
+-  pkcs7/pkcs7_test.cc
+-  pkcs8/pkcs8_test.cc
+-  pkcs8/pkcs12_test.cc
+-  poly1305/poly1305_test.cc
+-  pool/pool_test.cc
+-  rand_extra/rand_test.cc
+-  refcount_test.cc
+-  rsa_extra/rsa_test.cc
+-  self_test.cc
+-  stack/stack_test.cc
+-  siphash/siphash_test.cc
+-  test/file_test_gtest.cc
+-  thread_test.cc
+-  trust_token/trust_token_test.cc
+-  x509/x509_test.cc
+-  x509/x509_time_test.cc
+-  x509v3/tab_test.cc
+-
+-  $<TARGET_OBJECTS:crypto_test_data>
+-  $<TARGET_OBJECTS:boringssl_gtest_main>
+-)
+-
+-add_dependencies(crypto_test global_target)
+-
+-target_link_libraries(crypto_test test_support_lib boringssl_gtest crypto)
+-if(WIN32)
+-  target_link_libraries(crypto_test ws2_32)
+-endif()
+-add_dependencies(all_tests crypto_test)
+diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt
+index 67a72ae..249f9e2 100644
+--- a/ssl/CMakeLists.txt
++++ b/ssl/CMakeLists.txt
+@@ -52,20 +52,3 @@ add_dependencies(ssl global_target)
+ 
+ target_link_libraries(ssl crypto)
+ 
+-add_executable(
+-  ssl_test
+-
+-  span_test.cc
+-  ssl_test.cc
+-  ssl_c_test.c
+-
+-  $<TARGET_OBJECTS:boringssl_gtest_main>
+-)
+-
+-add_dependencies(ssl_test global_target)
+-
+-target_link_libraries(ssl_test test_support_lib boringssl_gtest ssl crypto)
+-if(WIN32)
+-  target_link_libraries(ssl_test ws2_32)
+-endif()
+-add_dependencies(all_tests ssl_test)

+ 52 - 27
packages/b/boringssl/xmake.lua

@@ -1,24 +1,36 @@
 package("boringssl")
     set_homepage("https://boringssl.googlesource.com/boringssl")
-    set_description("A fork of OpenSSL that is designed to meet Google's needs.")
+    set_description("BoringSSL is a fork of OpenSSL that is designed to meet Google's needs.")
 
+    add_urls("https://github.com/google/boringssl/archive/refs/tags/$(version).tar.gz", {version = function (version) return "fips-" .. version:gsub("%.", "") end})
     add_urls("https://github.com/google/boringssl.git")
+
+    add_versions("2022.06.13", "a343962da2fbb10d8fa2cd9a2832839a23045a197c0ff306dc0fa0abb85759b3")
     add_versions("2021.12.29", "d80f17d5c94b21c4fb2e82ee527bfe001b3553f2")
 
+    add_patches("2022.06.13", path.join(os.scriptdir(), "patches", "2022.06.13", "cmake.patch"), "c44e5c2b4b4f010a6fab1c0bce22a50feb5d85f37a870cf9a71f8d58bdfbd169")
     add_patches("2021.12.29", path.join(os.scriptdir(), "patches", "2021.12.29", "cmake.patch"), "d8bb6312b87b8aad434ea3f9f4275f769af3cdbaab78adf400e8e3907443b505")
 
-    add_deps("cmake", "go")
-
     if is_plat("linux") then
         add_syslinks("pthread", "dl", "m")
     elseif is_plat("windows") then
         add_syslinks("advapi32")
         add_deps("nasm")
     end
+
     add_links("ssl", "crypto")
 
-    on_install("linux", "macosx", "windows", function (package)
+    add_deps("cmake", "go")
+
+    on_load("windows", function (package)
+        if package:is_plat("windows") and package:version():ge("2022.06.13") and (not package:is_precompiled()) then
+            package:add("deps", "strawberry-perl")
+        end
+    end)
+
+    on_install("linux", "macosx", "windows|!arm64", function (package)
         import("net.fasturl")
+
         local configs = {}
         local proxyurls = {"https://goproxy.cn", "https://proxy.golang.org"}
         fasturl.add(proxyurls)
@@ -26,35 +38,48 @@ package("boringssl")
         if #proxyurls > 0 then
             os.setenv("GOPROXY", proxyurls[1])
         end
-        -- we need suppress "hidden symbol ... is referenced by DSO"
-        local cxflags
-        if not package:config("shared") and package:is_plat("linux") then
-            cxflags = "-DBORINGSSL_SHARED_LIBRARY"
-        end
-        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
-        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+
         io.replace("CMakeLists.txt", "-WX", "", {plain = true})
-        import("package.tools.cmake").install(package, configs, {cxflags = cxflags, buildir = "build"})
-        os.cp("include", package:installdir())
-        if package:config("shared") then
+        io.replace("CMakeLists.txt", "-Werror", "", {plain = true})
+
+        if package:version():ge("2022.06.13") then
+            local configs = {}
+            table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
+            table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+            import("package.tools.cmake").install(package, configs)
             if package:is_plat("windows") then
-                os.cp("build/ssl/*/ssl.dll", package:installdir("bin"))
+                os.mv(package:installdir("lib/*.dll"), package:installdir("bin"))
+            end
+        else
+            -- we need suppress "hidden symbol ... is referenced by DSO"
+            local cxflags
+            if not package:config("shared") and package:is_plat("linux") then
+                cxflags = "-DBORINGSSL_SHARED_LIBRARY"
+            end
+            table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+            table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+            import("package.tools.cmake").install(package, configs, {cxflags = cxflags, buildir = "build"})
+            os.cp("include", package:installdir())
+            if package:config("shared") then
+                if package:is_plat("windows") then
+                    os.cp("build/ssl/*/ssl.dll", package:installdir("bin"))
+                    os.cp("build/ssl/*/ssl.lib", package:installdir("lib"))
+                    os.cp("build/crypto/*/crypto.dll", package:installdir("bin"))
+                    os.cp("build/crypto/*/crypto.lib", package:installdir("lib"))
+                elseif package:is_plat("macosx") then
+                    os.cp("build/ssl/libssl.dylib", package:installdir("lib"))
+                    os.cp("build/crypto/libcrypto.dylib", package:installdir("lib"))
+                else
+                    os.cp("build/ssl/libssl.so", package:installdir("lib"))
+                    os.cp("build/crypto/libcrypto.so", package:installdir("lib"))
+                end
+            elseif package:is_plat("windows") then
                 os.cp("build/ssl/*/ssl.lib", package:installdir("lib"))
-                os.cp("build/crypto/*/crypto.dll", package:installdir("bin"))
                 os.cp("build/crypto/*/crypto.lib", package:installdir("lib"))
-            elseif package:is_plat("macosx") then
-                os.cp("build/ssl/libssl.dylib", package:installdir("lib"))
-                os.cp("build/crypto/libcrypto.dylib", package:installdir("lib"))
             else
-                os.cp("build/ssl/libssl.so", package:installdir("lib"))
-                os.cp("build/crypto/libcrypto.so", package:installdir("lib"))
+                os.cp("build/ssl/libssl.a", package:installdir("lib"))
+                os.cp("build/crypto/libcrypto.a", package:installdir("lib"))
             end
-        elseif package:is_plat("windows") then
-            os.cp("build/ssl/*/ssl.lib", package:installdir("lib"))
-            os.cp("build/crypto/*/crypto.lib", package:installdir("lib"))
-        else
-            os.cp("build/ssl/libssl.a", package:installdir("lib"))
-            os.cp("build/crypto/libcrypto.a", package:installdir("lib"))
         end
     end)
 

+ 9 - 0
packages/g/go/xmake.lua

@@ -7,25 +7,34 @@ package("go")
         if os.arch() == "x64" then
             set_urls("https://go.dev/dl/go$(version).windows-amd64.zip")
             add_versions("1.17.6", "5bf8f87aec7edfc08e6bc845f1c30dba6de32b863f89ae46553ff4bbcc1d4954")
+            add_versions("1.22.2", "8e581cf330f49d3266e936521a2d8263679ef7e2fc2cbbceb85659122d883596")
         else
             set_urls("https://go.dev/dl/go$(version).windows-386.zip")
             add_versions("1.17.6", "3809c4e40482ff047200c8b1e22a43a2c9c79b53ef540668d2b00f7228f093aa")
+            add_versions("1.22.2", "651753c06df037020ef4d162c5b273452e9ba976ed17ae39e66ef7ee89d8147e")
         end
     elseif is_host("linux") then
         if os.arch() == "x86_64" then
             set_urls("https://go.dev/dl/go$(version).linux-amd64.tar.gz")
             add_versions("1.17.6", "231654bbf2dab3d86c1619ce799e77b03d96f9b50770297c8f4dff8836fc8ca2")
+            add_versions("1.22.2", "5901c52b7a78002aeff14a21f93e0f064f74ce1360fce51c6ee68cd471216a17")
         elseif os.arch() == "i386" then
             set_urls("https://go.dev/dl/go$(version).linux-386.tar.gz")
             add_versions("1.17.6", "06c50fb0d44bb03dd4ea8795f9448379c5825d2765307b51f66905084c3ba541")
+            add_versions("1.22.2", "586d9eb7fe0489ab297ad80dd06414997df487c5cf536c490ffeaa8d8f1807a7")
         elseif os.arch() == "arm64" then
             set_urls("https://go.dev/dl/go$(version).linux-arm64.tar.gz")
             add_versions("1.17.6", "82c1a033cce9bc1b47073fd6285233133040f0378439f3c4659fe77cc534622a")
+            add_versions("1.22.2", "36e720b2d564980c162a48c7e97da2e407dfcc4239e1e58d98082dfa2486a0c1")
         end
     elseif is_host("macosx") then
         if os.arch() == "x86_64" then
             set_urls("https://go.dev/dl/go$(version).darwin-amd64.tar.gz")
             add_versions("1.17.6", "874bc6f95e07697380069a394a21e05576a18d60f4ba178646e1ebed8f8b1f89")
+            add_versions("1.22.2", "33e7f63077b1c5bce4f1ecadd4d990cf229667c40bfb00686990c950911b7ab7")
+        elseif os.arch() == "arm64" then
+            set_urls("https://go.dev/dl/go$(version).darwin-arm64.tar.gz")
+            add_versions("1.22.2", "660298be38648723e783ba0398e90431de1cb288c637880cdb124f39bd977f0d")
         end
     end