mirror of
https://github.com/lopsided98/nix-ros-overlay.git
synced 2025-06-12 02:34:50 +03:00
rolling: rviz-ogre-vendor: correctly patch vendor URLs
This package requires complex patching. It uses ament_vendor(), which is picky about what kinds of sources it requires. Additionally, ogre contains its own vendoring of imgui that needs to be patched.
This commit is contained in:
parent
d5f6bfe409
commit
5f9268646a
3 changed files with 72 additions and 17 deletions
|
@ -315,15 +315,6 @@ let
|
||||||
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
|
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
|
||||||
});
|
});
|
||||||
|
|
||||||
rviz-ogre-vendor = rosSuper.rviz-ogre-vendor.overrideAttrs ({
|
|
||||||
preFixup ? "", ...
|
|
||||||
}: {
|
|
||||||
preFixup = ''
|
|
||||||
# Prevent /build RPATH references
|
|
||||||
rm -r ogre_install
|
|
||||||
'' + preFixup;
|
|
||||||
});
|
|
||||||
|
|
||||||
rxcpp-vendor = patchVendorUrl rosSuper.rxcpp-vendor {
|
rxcpp-vendor = patchVendorUrl rosSuper.rxcpp-vendor {
|
||||||
url = "https://github.com/ReactiveX/RxCpp/archive/v4.1.0.tar.gz";
|
url = "https://github.com/ReactiveX/RxCpp/archive/v4.1.0.tar.gz";
|
||||||
sha256 = "1smxrcm0s6bz05185dx1i2xjgn47rq7m247pblil6p3bmk3lkfyk";
|
sha256 = "1smxrcm0s6bz05185dx1i2xjgn47rq7m247pblil6p3bmk3lkfyk";
|
||||||
|
|
|
@ -73,9 +73,24 @@ rosSelf: rosSuper: with rosSelf.lib; {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
rviz-ogre-vendor = patchVendorUrl rosSuper.rviz-ogre-vendor {
|
rviz-ogre-vendor = patchAmentVendorGit rosSuper.rviz-ogre-vendor {
|
||||||
url = "https://github.com/OGRECave/ogre/archive/v1.12.10.zip";
|
url = "https://github.com/OGRECave/ogre.git";
|
||||||
sha256 = "sha256-lZDLywgShlWeWah7oTnyKBTqzN505LJKbQbgXRfJXlk=";
|
rev = "v1.12.10";
|
||||||
|
fetchgitArgs.hash = "sha256-Z0ixdSmkV93coBBVZ5R3lPLfVMXRfWsFz/RsSyqPWFY=";
|
||||||
|
tarSourceArgs.hook = let
|
||||||
|
version = "1.79";
|
||||||
|
imgui = (self.fetchFromGitHub rec {
|
||||||
|
name = "${repo}-${version}";
|
||||||
|
owner = "ocornut";
|
||||||
|
repo = "imgui";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-GIVhZ8Q7WebfHeKeJdVABXrTT26FOS7updncbv2LRnQ=";
|
||||||
|
});
|
||||||
|
imguiTar = tarSource { } imgui;
|
||||||
|
in ''
|
||||||
|
substituteInPlace Components/Overlay/CMakeLists.txt \
|
||||||
|
--replace ${escapeShellArg imgui.url} file://${escapeShellArg imguiTar}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
urdfdom = rosSuper.urdfdom.overrideAttrs ({
|
urdfdom = rosSuper.urdfdom.overrideAttrs ({
|
||||||
|
|
|
@ -7,30 +7,79 @@ with lib;
|
||||||
s = composeManyExtensions overlays s {};
|
s = composeManyExtensions overlays s {};
|
||||||
in s;
|
in s;
|
||||||
|
|
||||||
|
# Create a tarball of a package source. If the source is already an archive,
|
||||||
|
# it will be unpacked and repacked as a tarball.
|
||||||
|
tarSource = {
|
||||||
|
compress ? false,
|
||||||
|
hook ? ""
|
||||||
|
}: src: self.runCommand ("${src.name}.tar" + lib.optionalString compress ".gz") { inherit src; } ''
|
||||||
|
unpackPhase
|
||||||
|
pushd "$sourceRoot"
|
||||||
|
${hook}
|
||||||
|
popd
|
||||||
|
tar --sort=name \
|
||||||
|
--format=gnu \
|
||||||
|
--owner=0 --group=0 --numeric-owner \
|
||||||
|
${lib.optionalString compress "-z"} \
|
||||||
|
-cf "$out" "$sourceRoot"
|
||||||
|
'';
|
||||||
|
|
||||||
patchVendorUrl = pkg: {
|
patchVendorUrl = pkg: {
|
||||||
url, sha256,
|
url, hash ? "", sha256 ? "",
|
||||||
originalUrl ? url,
|
originalUrl ? url,
|
||||||
file ? "CMakeLists.txt"
|
file ? "CMakeLists.txt"
|
||||||
}: pkg.overrideAttrs ({
|
}: pkg.overrideAttrs ({
|
||||||
postPatch ? "", ...
|
postPatch ? "", ...
|
||||||
}: {
|
}: {
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace '${file}' \
|
substituteInPlace ${escapeShellArg file} \
|
||||||
--replace '${originalUrl}' '${self.fetchurl { inherit url sha256; }}'
|
--replace ${escapeShellArg originalUrl} ${escapeShellArg (self.fetchurl { inherit url hash sha256; })}
|
||||||
'' + postPatch;
|
'' + postPatch;
|
||||||
});
|
});
|
||||||
|
|
||||||
patchVendorGit = pkg: {
|
patchVendorGit = pkg: {
|
||||||
url,
|
url,
|
||||||
|
originalUrl ? url,
|
||||||
file ? "CMakeLists.txt",
|
file ? "CMakeLists.txt",
|
||||||
fetchgitArgs ? {}
|
fetchgitArgs ? {}
|
||||||
}: pkg.overrideAttrs ({
|
}: pkg.overrideAttrs ({
|
||||||
postPatch ? "", ...
|
postPatch ? "", ...
|
||||||
}: {
|
}: {
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
sed -i '\|GIT_REPOSITORY\s.*${escapeShellArg url}|c\
|
sed -i '\|GIT_REPOSITORY\s.*${originalUrl}|c\
|
||||||
URL "${self.fetchgit ({ inherit url; } // fetchgitArgs)}"' \
|
URL "${self.fetchgit ({ inherit url; } // fetchgitArgs)}"' \
|
||||||
'${file}'
|
${escapeShellArg file}
|
||||||
|
'' + postPatch;
|
||||||
|
});
|
||||||
|
|
||||||
|
# Patch a vendored download that uses ament_vendor() with a Git repo as the
|
||||||
|
# source.
|
||||||
|
patchAmentVendorGit = pkg: {
|
||||||
|
url,
|
||||||
|
originalUrl ? url,
|
||||||
|
rev, # Must correspond to the VCS_VERSION argument
|
||||||
|
file ? "CMakeLists.txt",
|
||||||
|
fetchgitArgs ? {},
|
||||||
|
tarSourceArgs ? {}
|
||||||
|
}: pkg.overrideAttrs ({
|
||||||
|
nativeBuildInputs ? [],
|
||||||
|
postPatch ? "", ...
|
||||||
|
}: let
|
||||||
|
# ament_vendor doesn't allow patches for path inputs, so we have to pack it
|
||||||
|
# into a tar first. Additionally, vcstool only accepts tarballs with the
|
||||||
|
# version number as the root directory name.
|
||||||
|
vendor = lib.tarSource tarSourceArgs (self.fetchgit (fetchgitArgs // {
|
||||||
|
name = rev;
|
||||||
|
inherit url rev;
|
||||||
|
}));
|
||||||
|
in {
|
||||||
|
# CMake ExternalProject patches are applied with git apply
|
||||||
|
nativeBuildInputs = nativeBuildInputs ++ [ self.git ];
|
||||||
|
postPatch = ''
|
||||||
|
sed -i '\|VCS_URL\s*${originalUrl}|c\
|
||||||
|
VCS_URL "file://${vendor}"\
|
||||||
|
VCS_TYPE tar' \
|
||||||
|
${lib.escapeShellArg file}
|
||||||
'' + postPatch;
|
'' + postPatch;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue