Przeglądaj źródła

Ports: Update the CMake platform module from upstream

While we're at it, remove the `/bin/sh` patch that is no longer needed,
as we now build the port fully on the host.
Tim Schumacher 3 lat temu
rodzic
commit
a39a341e26

+ 119 - 0
Ports/cmake/patches/0002-SerenityOS-Add-Platform-module.patch

@@ -0,0 +1,119 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Andrew Kaster <akaster@serenityos.org>
+Date: Sun, 2 Jan 2022 23:19:40 -0700
+Subject: [PATCH] SerenityOS: Add Platform module
+---
+ Modules/Platform/SerenityOS-Clang-ASM.cmake |  2 ++
+ Modules/Platform/SerenityOS-Clang-C.cmake   |  2 ++
+ Modules/Platform/SerenityOS-Clang-CXX.cmake |  2 ++
+ Modules/Platform/SerenityOS-GNU-ASM.cmake   |  2 ++
+ Modules/Platform/SerenityOS-GNU-C.cmake     |  2 ++
+ Modules/Platform/SerenityOS-GNU-CXX.cmake   |  2 ++
+ Modules/Platform/SerenityOS-GNU.cmake       | 24 +++++++++++++++++++++
+ Modules/Platform/SerenityOS.cmake           | 12 +++++++++++
+ 8 files changed, 48 insertions(+)
+ create mode 100644 Modules/Platform/SerenityOS-Clang-ASM.cmake
+ create mode 100644 Modules/Platform/SerenityOS-Clang-C.cmake
+ create mode 100644 Modules/Platform/SerenityOS-Clang-CXX.cmake
+ create mode 100644 Modules/Platform/SerenityOS-GNU-ASM.cmake
+ create mode 100644 Modules/Platform/SerenityOS-GNU-C.cmake
+ create mode 100644 Modules/Platform/SerenityOS-GNU-CXX.cmake
+ create mode 100644 Modules/Platform/SerenityOS-GNU.cmake
+ create mode 100644 Modules/Platform/SerenityOS.cmake
+
+diff --git a/Modules/Platform/SerenityOS-Clang-ASM.cmake b/Modules/Platform/SerenityOS-Clang-ASM.cmake
+new file mode 100644
+index 00000000..ba1e18cf
+--- /dev/null
++++ b/Modules/Platform/SerenityOS-Clang-ASM.cmake
+@@ -0,0 +1,2 @@
++include(Platform/SerenityOS-GNU)
++__serenity_compiler_gnu(ASM)
+diff --git a/Modules/Platform/SerenityOS-Clang-C.cmake b/Modules/Platform/SerenityOS-Clang-C.cmake
+new file mode 100644
+index 00000000..791a1978
+--- /dev/null
++++ b/Modules/Platform/SerenityOS-Clang-C.cmake
+@@ -0,0 +1,2 @@
++include(Platform/SerenityOS-GNU)
++__serenity_compiler_gnu(C)
+diff --git a/Modules/Platform/SerenityOS-Clang-CXX.cmake b/Modules/Platform/SerenityOS-Clang-CXX.cmake
+new file mode 100644
+index 00000000..084e319f
+--- /dev/null
++++ b/Modules/Platform/SerenityOS-Clang-CXX.cmake
+@@ -0,0 +1,2 @@
++include(Platform/SerenityOS-GNU)
++__serenity_compiler_gnu(CXX)
+diff --git a/Modules/Platform/SerenityOS-GNU-ASM.cmake b/Modules/Platform/SerenityOS-GNU-ASM.cmake
+new file mode 100644
+index 00000000..ba1e18cf
+--- /dev/null
++++ b/Modules/Platform/SerenityOS-GNU-ASM.cmake
+@@ -0,0 +1,2 @@
++include(Platform/SerenityOS-GNU)
++__serenity_compiler_gnu(ASM)
+diff --git a/Modules/Platform/SerenityOS-GNU-C.cmake b/Modules/Platform/SerenityOS-GNU-C.cmake
+new file mode 100644
+index 00000000..791a1978
+--- /dev/null
++++ b/Modules/Platform/SerenityOS-GNU-C.cmake
+@@ -0,0 +1,2 @@
++include(Platform/SerenityOS-GNU)
++__serenity_compiler_gnu(C)
+diff --git a/Modules/Platform/SerenityOS-GNU-CXX.cmake b/Modules/Platform/SerenityOS-GNU-CXX.cmake
+new file mode 100644
+index 00000000..084e319f
+--- /dev/null
++++ b/Modules/Platform/SerenityOS-GNU-CXX.cmake
+@@ -0,0 +1,2 @@
++include(Platform/SerenityOS-GNU)
++__serenity_compiler_gnu(CXX)
+diff --git a/Modules/Platform/SerenityOS-GNU.cmake b/Modules/Platform/SerenityOS-GNU.cmake
+new file mode 100644
+index 00000000..ed39477a
+--- /dev/null
++++ b/Modules/Platform/SerenityOS-GNU.cmake
+@@ -0,0 +1,24 @@
++# This module is shared by multiple languages; use include blocker.
++include_guard()
++
++set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--hash-style=gnu,-z,relro,-z,now,-z,noexecstack,-z,separate-code,-z,max-page-size=0x1000")
++
++macro(__serenity_compiler_gnu lang)
++  set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-rpath,")
++  set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
++  set(CMAKE_SHARED_LIBRARY_RPATH_LINK_${lang}_FLAG "-Wl,-rpath-link,")
++  set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,-soname,")
++  set(CMAKE_EXE_EXPORTS_${lang}_FLAG "-Wl,--export-dynamic")
++
++  set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared -Wl,--hash-style=gnu,-z,relro,-z,now,-z,noexecstack,-z,separate-code")
++
++  # Initialize link type selection flags.  These flags are used when
++  # building a shared library, shared module, or executable that links
++  # to other libraries to select whether to use the static or shared
++  # versions of the libraries.
++  foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
++    set(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-Bstatic")
++    set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic")
++  endforeach()
++
++endmacro()
+diff --git a/Modules/Platform/SerenityOS.cmake b/Modules/Platform/SerenityOS.cmake
+new file mode 100644
+index 00000000..541620c2
+--- /dev/null
++++ b/Modules/Platform/SerenityOS.cmake
+@@ -0,0 +1,12 @@
++
++set(SERENITYOS 1)
++
++set(CMAKE_DL_LIBS "-ldl")
++set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN")
++set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
++
++# Shared libraries with no builtin soname may not be linked safely by
++# specifying the file path.
++set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)
++
++include(Platform/UnixPaths)

+ 0 - 35
Ports/cmake/patches/0002-bin-bash.patch

@@ -1,35 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Ali Mohammad Pur <ali.mpfard@gmail.com>
-Date: Wed, 12 Jan 2022 22:15:37 +0330
-Subject: [PATCH] /bin/bash
-
-This patch swaps out /bin/sh for /bin/bash in two scripts that need it.
-
-- [X] Local?
-- [ ] Should be merged to upstream?
-- [ ] Resolves issue(s) with our side of things
-- [ ] Hack
----
- bootstrap | 2 +-
- configure | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/bootstrap b/bootstrap
-index e0791d58..bde01283 100755
---- a/bootstrap
-+++ b/bootstrap
-@@ -1,4 +1,4 @@
--#!/bin/sh
-+#!/bin/bash
- # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
- # file Copyright.txt or https://cmake.org/licensing for details.
- 
-diff --git a/configure b/configure
-index 11622160..0e6fc25d 100755
---- a/configure
-+++ b/configure
-@@ -1,3 +1,3 @@
--#!/bin/sh
-+#!/bin/bash
- cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd`
- exec "${cmake_source_dir}/bootstrap" "$@"

+ 0 - 47
Ports/cmake/patches/0003-Platform-SerenityOS.patch

@@ -1,47 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Ali Mohammad Pur <ali.mpfard@gmail.com>
-Date: Wed, 12 Jan 2022 22:17:47 +0330
-Subject: [PATCH] Platform/SerenityOS
-
-This patch adds the SerenityOS platform config file to CMake.
-
-- [ ] Local?
-- [X] Should be merged to upstream? If we want to have cmake support serenity out of the box.
-- [ ] Resolves issue(s) with our side of things
-- [ ] Hack
----
- Modules/Platform/SerenityOS.cmake | 25 +++++++++++++++++++++++++
- 1 file changed, 25 insertions(+)
- create mode 100644 Modules/Platform/SerenityOS.cmake
-
-diff --git a/Modules/Platform/SerenityOS.cmake b/Modules/Platform/SerenityOS.cmake
-new file mode 100644
-index 00000000..952ff61a
---- /dev/null
-+++ b/Modules/Platform/SerenityOS.cmake
-@@ -0,0 +1,25 @@
-+set(CMAKE_DL_LIBS "-ldl")
-+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
-+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
-+set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN")
-+set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
-+set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
-+set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
-+
-+# Shared libraries with no builtin soname may not be linked safely by
-+# specifying the file path.
-+set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)
-+
-+# Initialize C link type selection flags.  These flags are used when
-+# building a shared library, shared module, or executable that links
-+# to other libraries to select whether to use the static or shared
-+# versions of the libraries.
-+foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
-+  set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
-+  set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
-+endforeach()
-+
-+# No multi-arch here (yet?)
-+unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
-+
-+include(Platform/UnixPaths)

+ 0 - 0
Ports/cmake/patches/0004-cmcurl-Include-unistd.patch → Ports/cmake/patches/0003-cmcurl-Include-unistd.patch


+ 0 - 0
Ports/cmake/patches/0005-cmcurl-Use-struct-stat-and-include-sys-stat.h.patch → Ports/cmake/patches/0004-cmcurl-Use-struct-stat-and-include-sys-stat.h.patch


+ 0 - 0
Ports/cmake/patches/0006-CMake-Disable-tests.patch → Ports/cmake/patches/0005-CMake-Disable-tests.patch


+ 5 - 23
Ports/cmake/patches/ReadMe.md

@@ -11,29 +11,11 @@ We don't support SIGINFO. This patch removes uses of SIGINFO.
 - [X] Resolves issue(s) with our side of things
 - [ ] Hack
 
-## `0002-bin-bash.patch`
+## `0002-SerenityOS-Add-Platform-module.patch`
 
-/bin/bash
+SerenityOS: Add Platform module
 
-This patch swaps out /bin/sh for /bin/bash in two scripts that need it.
-
-- [X] Local?
-- [ ] Should be merged to upstream?
-- [ ] Resolves issue(s) with our side of things
-- [ ] Hack
-
-## `0003-Platform-SerenityOS.patch`
-
-Platform/SerenityOS
-
-This patch adds the SerenityOS platform config file to CMake.
-
-- [ ] Local?
-- [X] Should be merged to upstream? If we want to have cmake support serenity out of the box.
-- [ ] Resolves issue(s) with our side of things
-- [ ] Hack
-
-## `0004-cmcurl-Include-unistd.patch`
+## `0003-cmcurl-Include-unistd.patch`
 
 cmcurl: Include unistd
 
@@ -44,7 +26,7 @@ Everyone gets this wrong. Most platforms are very lax with these includes, but w
 - [ ] Resolves issue(s) with our side of things
 - [ ] Hack
 
-## `0005-cmcurl-Use-struct-stat-and-include-sys-stat.h.patch`
+## `0004-cmcurl-Use-struct-stat-and-include-sys-stat.h.patch`
 
 cmcurl: Use struct stat and include sys/stat.h
 
@@ -55,7 +37,7 @@ For unknown reasons, curl_setup_once.h does not include sys/stat.h. This patch i
 - [X] Resolves issue(s) with our side of things
 - [X] Hack
 
-## `0006-CMake-Disable-tests.patch`
+## `0005-CMake-Disable-tests.patch`
 
 CMake: Disable tests