qt6: drop cmake patch used for fixing cmake file generation

The "multiple-outputs.sh" setup hook moves "include", "lib/cmake" and
other folders into the "dev" output if it exists, thus breaking the
invariants expected by the qt build system and we used to patch cmake to
fixup the generated cmake files. In a series of changes to rework qt
packaging, we are now setting "moveToDev" to false to suppress that
behavior, and the cmake patch is no longer required.
This commit is contained in:
Nick Cao 2023-04-12 09:54:46 +08:00
parent bc8ebd6a12
commit 21a773c671
No known key found for this signature in database
2 changed files with 0 additions and 129 deletions

View file

@ -5,7 +5,6 @@
, fetchpatch
, makeSetupHook
, makeWrapper
, cmake
, gst_all_1
, libglvnd
, darwin
@ -27,11 +26,6 @@ let
callPackage = self.newScope ({
inherit qtModule srcs;
stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
cmake = cmake.overrideAttrs (attrs: {
patches = attrs.patches ++ [
./patches/cmake.patch
];
});
});
in
{

View file

@ -1,123 +0,0 @@
commit bd8f6ecea0663bdd150aa48941cbd47d25874396
Author: Nick Cao <nickcao@nichi.co>
Date: Tue Apr 19 13:49:59 2022 +0800
patch cmake file generation for nixpkgs packaging
As of qt 6.3.0, installing components into different prefixes is not
supported. To workaround that, we move files to their designated in the
postInstall hook. However the generated cmake files still have
references to the original prefix, and would cause issues when using
said components as the dependency of other packages. The purpose of this
patch is to closely match the output layout of qt, and rewrite the
generated cmake files to point to the corrected pathes.
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 5a33349b19..677a6084d6 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -7,6 +7,7 @@
#include <cstring>
#include <sstream>
#include <utility>
+#include <cstdlib>
#include <cm/memory>
@@ -330,9 +331,21 @@ static void prefixItems(std::string& exportDirs)
for (std::string const& e : entries) {
exportDirs += sep;
sep = ";";
- if (!cmSystemTools::FileIsFullPath(e) &&
- e.find("${_IMPORT_PREFIX}") == std::string::npos) {
- exportDirs += "${_IMPORT_PREFIX}/";
+ if (!cmSystemTools::FileIsFullPath(e)) {
+ if (std::getenv("dev")) {
+ if (cmHasLiteralPrefix(e, "include") || cmHasLiteralPrefix(e, "./include")) {
+ exportDirs += std::getenv("dev");
+ } else if (cmHasLiteralPrefix(e, "mkspecs") || cmHasLiteralPrefix(e, "./mkspecs")) {
+ exportDirs += std::getenv("dev");
+ } else if (cmHasLiteralPrefix(e, "libexec") || cmHasLiteralPrefix(e, "./libexec")) {
+ exportDirs += std::getenv("dev");
+ } else {
+ exportDirs += std::getenv("out");
+ }
+ } else {
+ exportDirs += std::getenv("out");
+ }
+ exportDirs += "/";
}
exportDirs += e;
}
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index adccdfeece..ba248305bd 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -6,6 +6,7 @@
#include <memory>
#include <sstream>
#include <utility>
+#include <cstdlib>
#include "cmExportSet.h"
#include "cmFileSet.h"
@@ -266,7 +267,7 @@ void cmExportInstallFileGenerator::LoadConfigFiles(std::ostream& os)
void cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string& input)
{
- cmGeneratorExpression::ReplaceInstallPrefix(input, "${_IMPORT_PREFIX}");
+ cmGeneratorExpression::ReplaceInstallPrefix(input, std::getenv("out"));
}
bool cmExportInstallFileGenerator::GenerateImportFileConfig(
@@ -382,9 +383,22 @@ void cmExportInstallFileGenerator::SetImportLocationProperty(
// Construct the installed location of the target.
std::string dest = itgen->GetDestination(config);
std::string value;
+
if (!cmSystemTools::FileIsFullPath(dest)) {
- // The target is installed relative to the installation prefix.
- value = "${_IMPORT_PREFIX}/";
+ if (std::getenv("dev")) {
+ if (cmHasLiteralPrefix(dest, "include") || cmHasLiteralPrefix(dest, "./include")) {
+ value = std::getenv("dev");
+ } else if (cmHasLiteralPrefix(dest, "mkspecs") || cmHasLiteralPrefix(dest, "./mkspecs")) {
+ value = std::getenv("dev");
+ } else if (cmHasLiteralPrefix(dest, "libexec") || cmHasLiteralPrefix(dest, "./libexec")) {
+ value = std::getenv("dev");
+ } else {
+ value = std::getenv("out");
+ }
+ } else {
+ value = std::getenv("out");
+ }
+ value += "/";
}
value += dest;
value += "/";
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index f988e54a19..cc5c7ac9fd 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -192,7 +192,20 @@ static void prefixItems(const std::string& content, std::string& result,
sep = ";";
if (!cmSystemTools::FileIsFullPath(e) &&
cmGeneratorExpression::Find(e) != 0) {
- result += prefix;
+ if (std::getenv("dev")) {
+ if (cmHasLiteralPrefix(e, "include") || cmHasLiteralPrefix(e, "./include")) {
+ result += std::getenv("dev");
+ } else if (cmHasLiteralPrefix(e, "mkspecs") || cmHasLiteralPrefix(e, "./mkspecs")) {
+ result += std::getenv("dev");
+ } else if (cmHasLiteralPrefix(e, "libexec") || cmHasLiteralPrefix(e, "./libexec")) {
+ result += std::getenv("dev");
+ } else {
+ result += std::getenv("out");
+ }
+ } else {
+ result += std::getenv("out");
+ }
+ result += "/";
}
result += e;
}