builder: add gccWrapper for openwrt < 19

This commit is contained in:
Astro 2022-05-09 15:43:59 +02:00
parent 34afaff593
commit 372494478d
1 changed files with 17 additions and 9 deletions

View File

@ -32,14 +32,25 @@ let
inherit (import ./files.nix {
inherit pkgs release target variant sha256 feedsSha256 packagesArch;
}) arch variantPackages variantFiles feedsPackages;
gccWrapper = pkgs.runCommand "gcc-wrapper" {} ''
mkdir -p $out/bin
for i in ${pkgs.gcc.cc}/bin/*-gnu-gcc*; do
ln -s ${pkgs.gcc}/bin/gcc $out/bin/$(basename "$i")
done
for i in ${pkgs.gcc.cc}/bin/*-gnu-{g++,c++}*; do
ln -s ${pkgs.gcc}/bin/g++ $out/bin/$(basename "$i")
done
'';
in
stdenv.mkDerivation {
name = lib.concatStringsSep "-" ([
"openwrt" release
] ++
lib.optional (extraImageName != null) extraImageName ++
[ target variant profile ]);
]
++ lib.optional (extraImageName != null) extraImageName
++ [ target variant profile ]);
src = variantFiles."openwrt-imagebuilder-${release}-${target}-${variant}.${hostPlatform.uname.system}-${hostPlatform.uname.processor}.tar.xz";
@ -65,14 +76,11 @@ stdenv.mkDerivation {
zlib unzip bzip2
ncurses which rsync git file getopt wget
bash perl python3
] ++
lib.optional (!lib.versionAtLeast release "21") python2;
]
++ lib.optional (!lib.versionAtLeast release "21") python2
++ lib.optional (!lib.versionAtLeast release "19") gccWrapper;
buildPhase = ''
${lib.optionalString (!lib.versionAtLeast release "19") ''
# Hack around broken check for gcc
touch staging_dir/host/.prereq-build
''}
make image SHELL=${runtimeShell} \
PROFILE="${profile}" \
PACKAGES="${lib.concatStringsSep " " packages}" \