From 025eebb54936c15980eebeb9ab504d6334254bfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20DOUIN?= Date: Mon, 25 Nov 2024 15:08:22 +0100 Subject: [PATCH] try to cross compile x86_64-apple from aarch64 --- .github/workflows/pre-release.yml | 46 +++++++++++++++---------------- default.nix | 19 ++++++------- package.nix | 1 - 3 files changed, 32 insertions(+), 34 deletions(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index afc35194..05ec51a2 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -12,31 +12,31 @@ jobs: include: - system: aarch64-macos target: aarch64-apple-darwin - os: macos-14 - - system: aarch64-linux - target: aarch64-unknown-linux-musl - os: ubuntu-latest - - system: armv6l-linux - target: armv6l-unknown-linux-musleabihf - os: ubuntu-latest - - system: armv7l-linux - target: armv7l-unknown-linux-musleabihf - os: ubuntu-latest - - system: i686-linux - target: i686-unknown-linux-musl - os: ubuntu-latest - - system: i686-windows - target: i686-w64-mingw32 - os: ubuntu-latest + os: macos-latest + # - system: aarch64-linux + # target: aarch64-unknown-linux-musl + # os: ubuntu-latest + # - system: armv6l-linux + # target: armv6l-unknown-linux-musleabihf + # os: ubuntu-latest + # - system: armv7l-linux + # target: armv7l-unknown-linux-musleabihf + # os: ubuntu-latest + # - system: i686-linux + # target: i686-unknown-linux-musl + # os: ubuntu-latest + # - system: i686-windows + # target: i686-w64-mingw32 + # os: ubuntu-latest - system: x86_64-macos target: x86_64-apple-darwin - os: macos-13 - - system: x86_64-linux - target: x86_64-unknown-linux-musl - os: ubuntu-latest - - system: x86_64-windows - target: x86_64-w64-mingw32 - os: ubuntu-latest + os: macos-latest + # - system: x86_64-linux + # target: x86_64-unknown-linux-musl + # os: ubuntu-latest + # - system: x86_64-windows + # target: x86_64-w64-mingw32 + # os: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/default.nix b/default.nix index 5e57b999..05dd3e85 100644 --- a/default.nix +++ b/default.nix @@ -8,6 +8,8 @@ let system = systems.${target}; buildPackages = import (fetchTarball "https://github.com/soywod/nixpkgs/archive/master.tar.gz") { }; + inherit (buildPackages) stdenv binutils mktemp gnutar zip; + pkgs = import (fetchTarball "https://github.com/soywod/nixpkgs/archive/master.tar.gz") { crossSystem = { isStatic = true; @@ -50,17 +52,14 @@ let buildFeatures = lib.strings.splitString "," features; }; - # HACK: work around https://github.com/NixOS/nixpkgs/issues/177129 - # Though this is an issue between Clang and GCC, - # so it may not get fixed anytime soon... - empty-libgcc_eh = buildPackages.stdenv.mkDerivation { + # HACK: https://github.com/NixOS/nixpkgs/issues/177129 + empty-libgcc_eh = stdenv.mkDerivation { pname = "empty-libgcc_eh"; version = "0"; dontUnpack = true; installPhase = '' mkdir -p "$out"/lib - ls "${buildPackages.binutils}"/bin/ -al - "${buildPackages.binutils}/bin/${buildPackages.binutils.targetPrefix}ar" r "$out"/lib/libgcc_eh.a + "${lib.getExe' binutils "ar"}" r "$out"/lib/libgcc_eh.a ''; }; @@ -73,8 +72,8 @@ himalaya.overrideAttrs (drv: { propagatedBuildInputs = (drv.propagatedBuildInputs or [ ]) ++ lib.optional hostPlatform.isWindows empty-libgcc_eh; - postInstall = drv.postInstall + lib.optionalString hostPlatform.isWindows '' - export WINEPREFIX="$(${lib.getExe' buildPackages.mktemp "mktemp"} -d)" + postInstall = (drv.postInstall or "") + lib.optionalString hostPlatform.isWindows '' + export WINEPREFIX="$(${lib.getExe' mktemp "mktemp"} -d)" '' + '' mkdir -p $out/bin/share/{applications,completions,man,services} cp assets/himalaya.desktop $out/bin/share/applications/ @@ -88,10 +87,10 @@ himalaya.overrideAttrs (drv: { ${himalayaExe} completion powershell > ./share/completions/himalaya.powershell ${himalayaExe} completion zsh > ./share/completions/himalaya.zsh - ${lib.getExe buildPackages.gnutar} -czf himalaya.tgz himalaya* share + ${lib.getExe gnutar} -czf himalaya.tgz himalaya* share mv himalaya.tgz ../ - ${lib.getExe buildPackages.zip} -r himalaya.zip himalaya* share + ${lib.getExe zip} -r himalaya.zip himalaya* share mv himalaya.zip ../ ''; diff --git a/package.nix b/package.nix index 619ed100..46630cbe 100644 --- a/package.nix +++ b/package.nix @@ -37,7 +37,6 @@ rustPlatform.buildRustPackage rec { ++ lib.optional (installManPages || installShellCompletions) installShellFiles; buildInputs = [ ] - ++ lib.optionals hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [ Security ]) ++ lib.optional (builtins.elem "notmuch" buildFeatures) notmuch ++ lib.optional (builtins.elem "pgp-gpg" buildFeatures) gpgme;