pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/lang/clang



Module Name:    pkgsrc
Committed By:   jperkin
Date:           Thu May  9 14:15:52 UTC 2024

Modified Files:
        pkgsrc/lang/clang: Makefile.common distinfo
        pkgsrc/lang/clang/patches: patch-lib_Basic_Targets_OSTargets.h
            patch-lib_Driver_ToolChain.cpp
            patch-tools_clang-shlib_CMakeLists.txt
Added Files:
        pkgsrc/lang/clang/patches: patch-lib_Driver_ToolChains_Gnu.cpp
Removed Files:
        pkgsrc/lang/clang/patches: patch-lib_Driver_ToolChains_Solaris.cpp
            patch-lib_Driver_ToolChains_Solaris.h

Log Message:
clang: Switch SunOS back to using the GCC runtime.

Upstream LLVM have removed the SunOS code from libcxx et al, despite us
offering to support it and it working fine, and so we're left with no
choice but to go back to using the GCC libraries and headers, which is a
shame.

Tested to compile at least a few different C/C++ files, and is able to
complete the builds of lang/wasi-*.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 pkgsrc/lang/clang/Makefile.common
cvs rdiff -u -r1.82 -r1.83 pkgsrc/lang/clang/distinfo
cvs rdiff -u -r1.5 -r1.6 \
    pkgsrc/lang/clang/patches/patch-lib_Basic_Targets_OSTargets.h
cvs rdiff -u -r1.2 -r1.3 \
    pkgsrc/lang/clang/patches/patch-lib_Driver_ToolChain.cpp \
    pkgsrc/lang/clang/patches/patch-tools_clang-shlib_CMakeLists.txt
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/lang/clang/patches/patch-lib_Driver_ToolChains_Gnu.cpp
cvs rdiff -u -r1.12 -r0 \
    pkgsrc/lang/clang/patches/patch-lib_Driver_ToolChains_Solaris.cpp
cvs rdiff -u -r1.4 -r0 \
    pkgsrc/lang/clang/patches/patch-lib_Driver_ToolChains_Solaris.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/lang/clang/Makefile.common
diff -u pkgsrc/lang/clang/Makefile.common:1.56 pkgsrc/lang/clang/Makefile.common:1.57
--- pkgsrc/lang/clang/Makefile.common:1.56      Mon Apr 22 07:03:35 2024
+++ pkgsrc/lang/clang/Makefile.common   Thu May  9 14:15:51 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.common,v 1.56 2024/04/22 07:03:35 adam Exp $
+# $NetBSD: Makefile.common,v 1.57 2024/05/09 14:15:51 jperkin Exp $
 # used by lang/clang/Makefile
 # used by lang/clang-tools-extra/Makefile
 
@@ -115,15 +115,13 @@ LIBCPP_CHECK=     NO
 CMAKE_ARGS+=                   -DCLANG_DEFAULT_CXX_STDLIB:STRING="libstdc++"
 .endif
 
-# Enable full LLVM suite on SunOS
-.if ${OPSYS} == "SunOS"
-.include "../../lang/compiler-rt/buildlink3.mk"
-.include "../../lang/libcxx/buildlink3.mk"
-.include "../../lang/libcxxabi/buildlink3.mk"
-.include "../../lang/libunwind/buildlink3.mk"
-CMAKE_ARGS+=    -DCLANG_DEFAULT_RTLIB:STRING="compiler-rt"
-CMAKE_ARGS+=    -DCLANG_DEFAULT_CXX_STDLIB:STRING="libc++"
-.endif
+# On SunOS use the libraries from the GCC used to build clang rather than
+# aimlessly searching the file system for ones that might be incompatible.
+#
+SUBST_CLASSES.SunOS+=  sunos-gcc
+SUBST_STAGE.sunos-gcc= pre-configure
+SUBST_FILES.sunos-gcc= lib/Driver/ToolChains/Gnu.cpp
+SUBST_SED.sunos-gcc=   -e 's,@GCCBASEDIR@,${CCPATH:H:H},'
 
 # 3.8.0 -> 3.8
 LLVM_MAJOR=    ${PKGVERSION_NOREV:C/^([0-9]+\.[0-9]+)\..*$/\1/}

Index: pkgsrc/lang/clang/distinfo
diff -u pkgsrc/lang/clang/distinfo:1.82 pkgsrc/lang/clang/distinfo:1.83
--- pkgsrc/lang/clang/distinfo:1.82     Mon Apr 22 07:03:35 2024
+++ pkgsrc/lang/clang/distinfo  Thu May  9 14:15:51 2024
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.82 2024/04/22 07:03:35 adam Exp $
+$NetBSD: distinfo,v 1.83 2024/05/09 14:15:51 jperkin Exp $
 
 BLAKE2s (clang-17.0.6.src.tar.xz) = 888020252b920ca120cc022d13cf411d7dc024f4076ccaff5eccc38dc1e4b438
 SHA512 (clang-17.0.6.src.tar.xz) = da6f670a52d60c46bbe6bfa2870106f6a6714c9566fab293b8c624a555308104a1a05cd065643091d7006ef4533a9a722dff1fccaf26f348a0c0a5c7b9331439
@@ -9,11 +9,10 @@ Size (cmake-17.0.6.src.tar.xz) = 8712 by
 BLAKE2s (runtimes-17.0.6.src.tar.xz) = 73840072a471442d27a106bbd026ef334d4fe6be083f3e3f79f9ac69c8c9e1b9
 SHA512 (runtimes-17.0.6.src.tar.xz) = 3d73abf3c25eb319e12d9f4118158a05f26bb569534b1fe0dd2e99f948046e0bfa9511b61d65863506444ff330c065b9e3bb77310daf3c71dd658a01622fd812
 Size (runtimes-17.0.6.src.tar.xz) = 6240 bytes
-SHA1 (patch-lib_Basic_Targets_OSTargets.h) = 4b511871c8a38d57f3fddc4a6c0e921ff53194cb
-SHA1 (patch-lib_Driver_ToolChain.cpp) = 33a8e346a72893140fde42245e4b108f3a9b9e3e
-SHA1 (patch-lib_Driver_ToolChains_Solaris.cpp) = f1f11228408a8872a1d3d57b18b389db14d592e8
-SHA1 (patch-lib_Driver_ToolChains_Solaris.h) = 22d1ddef34b8df3cc29c4632108d45904797aff3
+SHA1 (patch-lib_Basic_Targets_OSTargets.h) = 0ec2aaecc77764afd46007239a98e9ea792eb03d
+SHA1 (patch-lib_Driver_ToolChain.cpp) = 06002fa45d16f9b9385f8a7a947aaf3970007938
+SHA1 (patch-lib_Driver_ToolChains_Gnu.cpp) = 2db0a13db660ad0b7cd87199da36653b1e8113b5
 SHA1 (patch-lib_Interpreter_IncrementalParser.cpp) = c5ace959ce566478316447b1621e9bfd9a537cc5
 SHA1 (patch-lib_Lex_InitHeaderSearch.cpp) = d37f5f2fff2fb358911875f73f5bf48446940436
-SHA1 (patch-tools_clang-shlib_CMakeLists.txt) = 2dce9cfc1e114a79fab457211eea1ee93c2198f4
+SHA1 (patch-tools_clang-shlib_CMakeLists.txt) = d6ce7370fca44b4ea4120c1e189931ca5e2bdd5b
 SHA1 (patch-tools_libclang_CMakeLists.txt) = 7e5655fc753ef20c8b08d1de438b26dcd3434525

Index: pkgsrc/lang/clang/patches/patch-lib_Basic_Targets_OSTargets.h
diff -u pkgsrc/lang/clang/patches/patch-lib_Basic_Targets_OSTargets.h:1.5 pkgsrc/lang/clang/patches/patch-lib_Basic_Targets_OSTargets.h:1.6
--- pkgsrc/lang/clang/patches/patch-lib_Basic_Targets_OSTargets.h:1.5   Mon Apr 22 07:03:35 2024
+++ pkgsrc/lang/clang/patches/patch-lib_Basic_Targets_OSTargets.h       Thu May  9 14:15:51 2024
@@ -1,12 +1,10 @@
-$NetBSD: patch-lib_Basic_Targets_OSTargets.h,v 1.5 2024/04/22 07:03:35 adam Exp $
+$NetBSD: patch-lib_Basic_Targets_OSTargets.h,v 1.6 2024/05/09 14:15:51 jperkin Exp $
 
-Sync SunOS default defines with a working reality.
-NetBSD __float128, needed to build anything with base libstdc++
-which assumes __float128.
+Sync SunOS default defines with what GCC uses.
 
---- lib/Basic/Targets/OSTargets.h.orig 2023-10-03 06:37:35.000000000 +0000
+--- lib/Basic/Targets/OSTargets.h.orig 2023-11-28 08:52:28.000000000 +0000
 +++ lib/Basic/Targets/OSTargets.h
-@@ -628,22 +638,15 @@ protected:
+@@ -642,22 +642,15 @@ protected:
      DefineStd(Builder, "unix", Opts);
      Builder.defineMacro("__svr4__");
      Builder.defineMacro("__SVR4");

Index: pkgsrc/lang/clang/patches/patch-lib_Driver_ToolChain.cpp
diff -u pkgsrc/lang/clang/patches/patch-lib_Driver_ToolChain.cpp:1.2 pkgsrc/lang/clang/patches/patch-lib_Driver_ToolChain.cpp:1.3
--- pkgsrc/lang/clang/patches/patch-lib_Driver_ToolChain.cpp:1.2        Mon Jul 12 18:42:06 2021
+++ pkgsrc/lang/clang/patches/patch-lib_Driver_ToolChain.cpp    Thu May  9 14:15:51 2024
@@ -1,11 +1,12 @@
-$NetBSD: patch-lib_Driver_ToolChain.cpp,v 1.2 2021/07/12 18:42:06 adam Exp $
+$NetBSD: patch-lib_Driver_ToolChain.cpp,v 1.3 2024/05/09 14:15:51 jperkin Exp $
 
 [LLD] Add NetBSD support as a new flavor of LLD (nb.lld)
 https://reviews.llvm.org/D70048
+Add -R for library paths on SunOS.
 
---- lib/Driver/ToolChain.cpp.orig      2019-07-11 19:06:38.000000000 +0000
+--- lib/Driver/ToolChain.cpp.orig      2023-11-28 08:52:28.000000000 +0000
 +++ lib/Driver/ToolChain.cpp
-@@ -506,6 +506,8 @@ std::string ToolChain::GetLinkerPath() c
+@@ -837,6 +837,8 @@ std::string ToolChain::GetLinkerPath(boo
      llvm::SmallString<8> LinkerName;
      if (Triple.isOSDarwin())
        LinkerName.append("ld64.");
@@ -14,3 +15,19 @@ https://reviews.llvm.org/D70048
      else
        LinkerName.append("ld.");
      LinkerName.append(UseLinker);
+@@ -1213,9 +1215,13 @@ void ToolChain::AddCXXStdlibLibArgs(cons
+ 
+ void ToolChain::AddFilePathLibArgs(const ArgList &Args,
+                                    ArgStringList &CmdArgs) const {
+-  for (const auto &LibPath : getFilePaths())
+-    if(LibPath.length() > 0)
++  for (const auto &LibPath : getFilePaths()) {
++    if(LibPath.length() > 0) {
+       CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
++      if (Triple.isOSSolaris())
++        CmdArgs.push_back(Args.MakeArgString(StringRef("-R") + LibPath));
++    }
++  }
+ }
+ 
+ void ToolChain::AddCCKextLibArgs(const ArgList &Args,
Index: pkgsrc/lang/clang/patches/patch-tools_clang-shlib_CMakeLists.txt
diff -u pkgsrc/lang/clang/patches/patch-tools_clang-shlib_CMakeLists.txt:1.2 pkgsrc/lang/clang/patches/patch-tools_clang-shlib_CMakeLists.txt:1.3
--- pkgsrc/lang/clang/patches/patch-tools_clang-shlib_CMakeLists.txt:1.2        Fri Jan 14 08:58:48 2022
+++ pkgsrc/lang/clang/patches/patch-tools_clang-shlib_CMakeLists.txt    Thu May  9 14:15:52 2024
@@ -1,10 +1,10 @@
-$NetBSD: patch-tools_clang-shlib_CMakeLists.txt,v 1.2 2022/01/14 08:58:48 tm Exp $
+$NetBSD: patch-tools_clang-shlib_CMakeLists.txt,v 1.3 2024/05/09 14:15:52 jperkin Exp $
 
 -B flag symbolic-functions is not supported on Solaris before 11.4
 
---- tools/clang-shlib/CMakeLists.txt.orig      2021-09-24 16:18:10.000000000 +0000
+--- tools/clang-shlib/CMakeLists.txt.orig      2023-11-28 08:52:28.000000000 +0000
 +++ tools/clang-shlib/CMakeLists.txt
-@@ -50,6 +50,6 @@ add_clang_library(clang-cpp
+@@ -50,7 +50,7 @@ add_clang_library(clang-cpp
                    ${_DEPS})
  # Optimize function calls for default visibility definitions to avoid PLT and
  # reduce dynamic relocations.
@@ -12,3 +12,4 @@ $NetBSD: patch-tools_clang-shlib_CMakeLi
 +if (NOT APPLE AND NOT MINGW AND NOT "SunOS" MATCHES ${CMAKE_SYSTEM_NAME})
    target_link_options(clang-cpp PRIVATE LINKER:-Bsymbolic-functions)
  endif()
+ if (MINGW OR CYGWIN)

Added files:

Index: pkgsrc/lang/clang/patches/patch-lib_Driver_ToolChains_Gnu.cpp
diff -u /dev/null pkgsrc/lang/clang/patches/patch-lib_Driver_ToolChains_Gnu.cpp:1.1
--- /dev/null   Thu May  9 14:15:52 2024
+++ pkgsrc/lang/clang/patches/patch-lib_Driver_ToolChains_Gnu.cpp       Thu May  9 14:15:51 2024
@@ -0,0 +1,27 @@
+$NetBSD: patch-lib_Driver_ToolChains_Gnu.cpp,v 1.1 2024/05/09 14:15:51 jperkin Exp $
+
+On SunOS always use the GCC that was used to build clang.
+Support x86_64-sun-solaris2.11 target.
+
+--- lib/Driver/ToolChains/Gnu.cpp.orig 2024-05-09 10:06:41.859223500 +0000
++++ lib/Driver/ToolChains/Gnu.cpp
+@@ -2228,6 +2228,11 @@ void Generic_GCC::GCCInstallationDetecto
+     // /usr/gcc/<version> as a prefix.
+ 
+     SmallVector<std::pair<GCCVersion, std::string>, 8> SolarisPrefixes;
++
++    // Only use compiler as configured by pkgsrc
++    Prefixes.push_back("@GCCBASEDIR@");
++    return;
++
+     std::string PrefixDir = concat(SysRoot, "/usr/gcc");
+     std::error_code EC;
+     for (llvm::vfs::directory_iterator LI = D.getVFS().dir_begin(PrefixDir, EC),
+@@ -2431,6 +2436,7 @@ void Generic_GCC::GCCInstallationDetecto
+     static const char *const SolarisX86Triples[] = {"i386-pc-solaris2.11",
+                                                     "i386-pc-solaris2.12"};
+     static const char *const SolarisX86_64Triples[] = {"x86_64-pc-solaris2.11",
++                                                       "x86_64-sun-solaris2.11",
+                                                        "x86_64-pc-solaris2.12"};
+     LibDirs.append(begin(SolarisLibDirs), end(SolarisLibDirs));
+     BiarchLibDirs.append(begin(SolarisLibDirs), end(SolarisLibDirs));



Home | Main Index | Thread Index | Old Index