Got armv6l compiling, but it's not yet tested

This commit is contained in:
Brian Picciano 2024-12-19 17:49:10 +01:00
parent 2bb7537602
commit 414219f066
16 changed files with 71 additions and 86 deletions

View File

@ -20,7 +20,6 @@
in rec {
version = let
revisionFile = if builtins.isNull revision
then pkgsNative.stdenv.mkDerivation {
name = "revision.txt";
@ -32,7 +31,8 @@ in rec {
'';
}
else pkgsNative.writeText "revision.txt" revision;
in pkgs.stdenv.mkDerivation {
version = pkgs.stdenv.mkDerivation {
name = "isle-version";
inherit buildSystem hostSystem revisionFile releaseName;
@ -88,11 +88,8 @@ in rec {
nebula = pkgs.callPackage ./nix/nebula.nix {};
garage = let
hostPlatform = pkgs.stdenv.hostPlatform.parsed;
in garageNix.package {
inherit pkgsNix buildSystem;
hostSystem = "${hostPlatform.cpu.name}-unknown-${hostPlatform.kernel.name}-musl";
garage = garageNix.package {
inherit pkgsNix buildSystem hostSystem;
};
appDirBase = pkgs.buildEnv {
@ -143,30 +140,26 @@ in rec {
];
};
appimagekit = pkgsNative.callPackage ./nix/appimagetool {
inherit hostSystem;
};
build = rec {
appImage = pkgs.stdenv.mkDerivation {
name = "isle-AppImage";
src = appDir;
inherit revisionFile;
nativeBuildInputs = [
(pkgsNative.callPackage ./nix/appimagetool.nix {})
];
ARCH = pkgs.stdenv.hostPlatform.parsed.cpu.name;
nativeBuildInputs = [ appimagekit ];
builder = builtins.toFile "build.sh" ''
source $stdenv/setup
cp -rL "$src" isle.AppDir
chmod +w isle.AppDir -R
export VERSION=debug
# https://github.com/probonopd/go-appimage/issues/155
unset SOURCE_DATE_EPOCH
appimagetool ./isle.AppDir
export VERSION=$(cat $revisionFile)
mkdir -p "$out"/bin
mv Isle-* "$out"/bin/isle
appimagetool ./isle.AppDir "$out"/bin/isle
'';
};

View File

@ -9,6 +9,7 @@ supported:
- `x86_64` (aka `amd64`)
- `aarch64` (aka `arm64`)
- `i686`
- `armv6l` (For older Raspberry Pis)
(`i686` has not been tested.)

View File

@ -1,40 +0,0 @@
{ stdenv, fetchurl }:
let
version = "765";
cpuArch = stdenv.buildPlatform.parsed.cpu.name;
srcDir = ./go-appimage;
# https://github.com/probonopd/go-appimage
# The author of go-appimage has set up some crazy continuous integration build
# system with github, which is really cool, except that it doesn't preserve
# any older builds of the project. And it's pretty difficult to build it
# ourselves. So fuck it, just embed the build artifacts directly in this
# project.
src = {
"x86_64" = "${srcDir}/appimagetool-${version}-x86_64.AppImage";
"aarch64" = "${srcDir}/go-appimage/appimagetool-${version}-aarch64.AppImage";
"armv7l" = "${srcDir}/go-appimage/appimagetool-${version}-armhf.AppImage";
"i686" = "${srcDir}/go-appimage/appimagetool-${version}-i686.AppImage";
}."${cpuArch}";
in stdenv.mkDerivation rec {
pname = "go-appimage";
inherit version src;
sourceRoot = "squashfs-root";
unpackPhase = ''
cp $src appimagetool
chmod u+wx appimagetool
./appimagetool --appimage-extract
'';
installPhase = ''
mkdir -p $out
cp -r usr/* $out
'';
}

View File

@ -0,0 +1,22 @@
{ appimagekit, hostSystem, writeScriptBin }: let
arch = builtins.getAttr hostSystem {
"x86_64-linux" = "x86_64";
"aarch64-linux" = "aarch64";
"armv6l-linux" = "armhf";
"i686-linux" = "i686";
};
# https://github.com/AppImage/type2-runtime
# The author has set up some crazy continuous integration build system with
# github, which is really cool, except that it doesn't preserve any older
# builds of the project. And it's pretty difficult to build it ourselves. So
# fuck it, just embed the build artifacts directly in this project.
runtimeFileVersion = "81de3e1";
runtimeFile = "${./.}/runtime-${arch}-${runtimeFileVersion}";
in writeScriptBin "appimagetool" ''
export PATH=$PATH:${appimagekit}/bin
export ARCH=${arch}
exec ${appimagekit}/bin/appimagetool --runtime-file ${runtimeFile} "$@"
''

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -8,6 +8,13 @@ rec {
hostSystem,
}: let
hostSystemTarget = builtins.getAttr hostSystem {
"x86_64-linux" = "x86_64-unknown-linux-musl";
"aarch64-linux" = "aarch64-unknown-linux-musl";
"i686-linux" = "i686-unknown-linux-musl";
"armv6l-linux" = "armv6l-unknown-linux-musleabihf";
};
pkgs = pkgsNix.default {
inherit buildSystem hostSystem;
};
@ -31,7 +38,7 @@ rec {
compile = (import "${src}/nix/compile.nix") {
system = buildSystem;
target = hostSystem;
target = hostSystemTarget;
pkgsSrc = pkgsNix.src;
cargo2nixOverlay = common.cargo2nixOverlay;

View File

@ -20,7 +20,7 @@
vendorHash = "sha256-GvMiOEC3Y/pGG++Z+XCgLVADKymUR9shDxjx3xIz8u0=";
subPackages = [ "cmd/nebula" "cmd/nebula-cert" ];
subPackages = [ "cmd/nebula" ];
ldflags = [ "-X main.Build=${version}" ];
}

View File

@ -9,6 +9,11 @@ rec {
CGO_ENABLED=0;
tags = [ "netgo" "timetzdata" ];
ldflags = [ "-w" "-extldflags=-static" ];
# Not sure why buildGoModule doesn't handle this correctly.
GOARM = if prev.stdenv.hostPlatform.parsed.cpu.name == "armv6l"
then "6,hardfloat"
else null;
};
in {
buildGoModule = args: prev.buildGoModule (buildArgs // args);
@ -35,11 +40,16 @@ rec {
sha256 = "sha256:1lr1h35prqkd1mkmzriwlpvxcb34kmhc9dnr48gkm8hh089hifmx";
};
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"i686-linux"
];
lib = import "${src}/lib";
crossSystems = {
"x86_64-linux" = {config = "x86_64-linux";};
"aarch64-linux" = lib.systems.examples.aarch64-multiplatform;
"i686-linux" = {config = "i686-linux";};
"armv6l-linux" = lib.systems.examples.raspberryPi;
};
supportedSystems = builtins.attrNames crossSystems;
default = {
buildSystem,
@ -55,7 +65,6 @@ rec {
# enabled, even if the target platform is actually the same as the build
# platform (and therefore it's not really cross-compiling). So we only set
# up the cross-compiling config if the target platform is different.
crossSystem.config = hostSystem;
crossSystem = builtins.getAttr hostSystem crossSystems;
}));
}

View File

@ -1,7 +0,0 @@
---
type: task
---
# Raspberry Pi Build
Get Isle build system to include rpi (armv7l-linux-musl)