mirror of
https://github.com/autc04/Retro68.git
synced 2024-12-01 11:52:47 +00:00
cross compilation!
This commit is contained in:
parent
6c81b0cc51
commit
9cdf56d4d5
89
flake.nix
89
flake.nix
@ -95,17 +95,28 @@
|
|||||||
configureFlags = [ "--target=m68k-apple-macos" "--disable-doc" ];
|
configureFlags = [ "--target=m68k-apple-macos" "--disable-doc" ];
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
};
|
};
|
||||||
retro68_binutils_m68k_wrapped = pkgs.wrapBintoolsWith { bintools = pkgs.retro68_binutils_m68k; noLibc = true; };
|
retro68_binutils_m68k_wrapped = pkgs.wrapBintoolsWith {
|
||||||
|
bintools = pkgs.retro68_binutils_m68k;
|
||||||
|
noLibc = true;
|
||||||
|
};
|
||||||
|
|
||||||
binutils = if pkgs.stdenv.targetPlatform.system == "m68k-macos" then
|
binutils = if pkgs.stdenv.targetPlatform.system == "m68k-macos" then
|
||||||
pkgs.wrapBintoolsWith { bintools = pkgs.retro68_binutils_m68k; }
|
pkgs.wrapBintoolsWith { bintools = pkgs.retro68_binutils_m68k; }
|
||||||
else prev.binutils;
|
else
|
||||||
|
prev.binutils;
|
||||||
|
|
||||||
gcc = if pkgs.stdenv.targetPlatform.system == "m68k-macos" then
|
gcc = if pkgs.stdenv.targetPlatform.system == "m68k-macos" then
|
||||||
pkgs.wrapCC pkgs.retro68_gcc_m68k
|
pkgs.wrapCCWith {
|
||||||
else prev.gcc;
|
cc = pkgs.retro68_gcc_m68k;
|
||||||
|
extraBuildCommands = ''
|
||||||
|
echo "" > $out/nix-support/add-hardening.sh
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
prev.gcc;
|
||||||
|
|
||||||
libcCrossChooser = name: if name == "retro68" then null else prev.libcCrossChooser name;
|
libcCrossChooser = name:
|
||||||
|
if name == "retro68" then null else prev.libcCrossChooser name;
|
||||||
|
|
||||||
retro68_gcc_m68k = with pkgs;
|
retro68_gcc_m68k = with pkgs;
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
@ -136,19 +147,23 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
multiversal = with pkgs;
|
multiversal = with pkgs;
|
||||||
stdenv.mkDerivation {
|
stdenvNoCC.mkDerivation {
|
||||||
name = "multiversal";
|
name = "multiversal";
|
||||||
src = multiversal_src;
|
src = multiversal_src;
|
||||||
nativeBuildInputs =
|
nativeBuildInputs = [
|
||||||
[ ruby retro68_gcc_m68k retro68_binutils_m68k ];
|
buildPackages.ruby
|
||||||
|
buildPackages.retro68_gcc_m68k
|
||||||
|
buildPackages.retro68_binutils_m68k
|
||||||
|
];
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
echo $src
|
echo $src
|
||||||
build=`pwd`
|
build=`pwd`
|
||||||
(cd $src && ruby make-multiverse.rb -G CIncludes -o "$build")
|
(cd $src && ruby make-multiverse.rb -G CIncludes -o "$build")
|
||||||
mkdir $out
|
mkdir $out
|
||||||
cp -r CIncludes $out/
|
cp -r CIncludes $out/include
|
||||||
cp -r lib68k $out/
|
cp -r lib68k $out/lib
|
||||||
'';
|
'';
|
||||||
|
meta = { platforms = [ "m68k-macos" ]; };
|
||||||
};
|
};
|
||||||
|
|
||||||
hfsutils = with pkgs;
|
hfsutils = with pkgs;
|
||||||
@ -187,6 +202,26 @@
|
|||||||
buildInputs = [ boost zlib hfsutils ];
|
buildInputs = [ boost zlib hfsutils ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
libretro = with pkgs;
|
||||||
|
pkgs.stdenv.mkDerivation {
|
||||||
|
name = "libretro";
|
||||||
|
src = filterSrc (self + /libretro);
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [ buildPackages.cmake ];
|
||||||
|
buildInputs = [ multiversal ];
|
||||||
|
|
||||||
|
buildCommand = ''
|
||||||
|
echo "Build command."
|
||||||
|
cmake $src \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=$out \
|
||||||
|
-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release
|
||||||
|
cmake --build .
|
||||||
|
cmake --build . --target install
|
||||||
|
'';
|
||||||
|
meta = { platforms = [ "m68k-macos" ]; };
|
||||||
|
};
|
||||||
|
|
||||||
libretro_m68k = with pkgs;
|
libretro_m68k = with pkgs;
|
||||||
let
|
let
|
||||||
#toolchainFile = retro68_gcc_m68k + "/m68k-apple-macos/cmake/retro68.toolchain.cmake";
|
#toolchainFile = retro68_gcc_m68k + "/m68k-apple-macos/cmake/retro68.toolchain.cmake";
|
||||||
@ -236,9 +271,6 @@
|
|||||||
# cmake --build .
|
# cmake --build .
|
||||||
# '';
|
# '';
|
||||||
};
|
};
|
||||||
|
|
||||||
newlib = null;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Provide some binary packages for selected system types.
|
# Provide some binary packages for selected system types.
|
||||||
@ -247,30 +279,29 @@
|
|||||||
retro68_binutils_m68k retro68_gcc_m68k multiversal hfsutils
|
retro68_binutils_m68k retro68_gcc_m68k multiversal hfsutils
|
||||||
libretro_m68k retro68_tools;
|
libretro_m68k retro68_tools;
|
||||||
|
|
||||||
crosstest = let pkgs =
|
crosstest = let
|
||||||
import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
overlays = [ self.overlay ];
|
overlays = [ self.overlay ];
|
||||||
crossSystem = retroSystems.m68k;
|
crossSystem = retroSystems.m68k;
|
||||||
};
|
};
|
||||||
in
|
in pkgs.stdenv.mkDerivation {
|
||||||
pkgs.stdenv.mkDerivation {
|
#nativeBuildInputs = [pkgs.binutils]; # [nixpkgsFor.${system}.retro68_binutils_m68k_wrapped];
|
||||||
#nativeBuildInputs = [pkgs.binutils]; # [nixpkgsFor.${system}.retro68_binutils_m68k_wrapped];
|
buildInputs = [ pkgs.multiversal pkgs.libretro ];
|
||||||
name = builtins.trace (pkgs.stdenvNoCC.targetPlatform) "crosstest";
|
name = "crosstest";
|
||||||
meta = { platforms = [ "m68k-macos" ]; };
|
meta = { platforms = [ "m68k-macos" ]; };
|
||||||
};
|
};
|
||||||
|
|
||||||
mingtest = let pkgs =
|
mingtest = let
|
||||||
import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
overlays = [ self.overlay ];
|
overlays = [ self.overlay ];
|
||||||
crossSystem = { config = "x86_64-w64-mingw32"; };
|
crossSystem = { config = "x86_64-w64-mingw32"; };
|
||||||
};
|
};
|
||||||
in
|
in pkgs.stdenv.mkDerivation {
|
||||||
pkgs.stdenv.mkDerivation {
|
name = "mingtest";
|
||||||
name = "mingtest";
|
meta = { platforms = pkgs.lib.platforms.all; };
|
||||||
meta = { platforms = pkgs.lib.platforms.all; };
|
};
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
# The default package for 'nix build'. This makes sense if the
|
# The default package for 'nix build'. This makes sense if the
|
||||||
|
Loading…
Reference in New Issue
Block a user