mirror of
https://github.com/autc04/Retro68.git
synced 2025-02-26 13:29:28 +00:00
setup hook supplying a cmake toolchain file
This commit is contained in:
parent
347a21596d
commit
90b7a3332d
31
flake.nix
31
flake.nix
@ -2,7 +2,7 @@
|
|||||||
description = "Cross compilation toolchain for classic Macs";
|
description = "Cross compilation toolchain for classic Macs";
|
||||||
|
|
||||||
# Nixpkgs / NixOS version to use.
|
# Nixpkgs / NixOS version to use.
|
||||||
inputs.nixpkgs.url = "nixpkgs/nixos-21.05";
|
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
inputs.multiversal_src.url = "github:autc04/multiversal";
|
inputs.multiversal_src.url = "github:autc04/multiversal";
|
||||||
inputs.multiversal_src.flake = false;
|
inputs.multiversal_src.flake = false;
|
||||||
@ -46,6 +46,7 @@
|
|||||||
|
|
||||||
retro68GccConfig = [ "--with-arch=m68k" "--with-cpu=m68000" ];
|
retro68GccConfig = [ "--with-arch=m68k" "--with-cpu=m68000" ];
|
||||||
retro68 = true;
|
retro68 = true;
|
||||||
|
cmakeSystemName = "Retro68";
|
||||||
};
|
};
|
||||||
powerpc = {
|
powerpc = {
|
||||||
system = "powerpc-macos";
|
system = "powerpc-macos";
|
||||||
@ -68,6 +69,7 @@
|
|||||||
retro68BinutilsConfig = [ "--disable-plugins" ];
|
retro68BinutilsConfig = [ "--disable-plugins" ];
|
||||||
retro68GccConfig = [ "--disable-lto" ];
|
retro68GccConfig = [ "--disable-lto" ];
|
||||||
retro68 = true;
|
retro68 = true;
|
||||||
|
cmakeSystemName = "RetroPPC";
|
||||||
};
|
};
|
||||||
carbon = {
|
carbon = {
|
||||||
system = "powerpc-carbon";
|
system = "powerpc-carbon";
|
||||||
@ -85,6 +87,7 @@
|
|||||||
execFormat = { name = "unknown"; };
|
execFormat = { name = "unknown"; };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
cmakeSystemName = "RetroCarbon";
|
||||||
};
|
};
|
||||||
|
|
||||||
isStatic = true;
|
isStatic = true;
|
||||||
@ -213,7 +216,7 @@
|
|||||||
pkgs.wrapCCWith {
|
pkgs.wrapCCWith {
|
||||||
cc = pkgs.retro68_gcc;
|
cc = pkgs.retro68_gcc;
|
||||||
|
|
||||||
# don't allow nix to add options for hardening
|
# don't allow nix to add options for hardening
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
echo "" > $out/nix-support/add-hardening.sh
|
echo "" > $out/nix-support/add-hardening.sh
|
||||||
'';
|
'';
|
||||||
@ -221,6 +224,7 @@
|
|||||||
extraPackages = with pkgs.targetPackages; [
|
extraPackages = with pkgs.targetPackages; [
|
||||||
multiversal
|
multiversal
|
||||||
libretro
|
libretro
|
||||||
|
retro68_setup_hook
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -230,6 +234,27 @@
|
|||||||
libcCrossChooser = name:
|
libcCrossChooser = name:
|
||||||
if name == "retro68" then null else prev.libcCrossChooser name;
|
if name == "retro68" then null else prev.libcCrossChooser name;
|
||||||
|
|
||||||
|
retro68_setup_hook = let
|
||||||
|
systemName = pkgs.targetPlatform.cmakeSystemName;
|
||||||
|
toolchain = pkgs.writeTextFile {
|
||||||
|
name = "retro68-cmake-toolchain";
|
||||||
|
text = ''
|
||||||
|
set(CMAKE_SYSTEM_NAME ${systemName})
|
||||||
|
set(CMAKE_SYSTEM_VERSION 1)
|
||||||
|
set(CMAKE_CROSSCOMPILING TRUE)
|
||||||
|
|
||||||
|
set( REZ "${pkgs.buildPackages.retro68_tools}/bin/Rez" )
|
||||||
|
set( REZ_INCLUDE_PATH "${pkgs.multiversal}/RIncludes" )
|
||||||
|
|
||||||
|
include(${self + "/cmake/add_application.cmake"})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
hook = pkgs.writeTextFile {
|
||||||
|
name = "retro68_setup_hook";
|
||||||
|
text = "export CMAKE_TOOLCHAIN_FILE=${toolchain}";
|
||||||
|
};
|
||||||
|
in pkgs.makeSetupHook { } hook;
|
||||||
|
|
||||||
# ----------- Retro68 core libraries -------------
|
# ----------- Retro68 core libraries -------------
|
||||||
|
|
||||||
# multiversal -- multiversal interfaces
|
# multiversal -- multiversal interfaces
|
||||||
@ -264,7 +289,7 @@
|
|||||||
src = filterSrc (self + /libretro);
|
src = filterSrc (self + /libretro);
|
||||||
|
|
||||||
nativeBuildInputs = [ buildPackages.cmake ];
|
nativeBuildInputs = [ buildPackages.cmake ];
|
||||||
buildInputs = [ multiversal ];
|
buildInputs = [ multiversal retro68_setup_hook ];
|
||||||
|
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
echo "Build command."
|
echo "Build command."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user