mirror of
https://github.com/autc04/Retro68.git
synced 2024-12-02 18:53:22 +00:00
rearrange packages
This commit is contained in:
parent
11fb59b652
commit
7b0091ae49
125
default.nix
125
default.nix
@ -79,13 +79,14 @@ let
|
||||
};
|
||||
|
||||
# A Nixpkgs overlay.
|
||||
overlay = pkgs: prev: {
|
||||
overlay = pkgs: prev:
|
||||
{
|
||||
retro68 = {
|
||||
# ----------- Native Tools -------------
|
||||
|
||||
# hfsutils -- Utilities for manipulating HFS volumes & disk images.
|
||||
hfsutils = with pkgs;
|
||||
stdenv.mkDerivation {
|
||||
name = "hfsutils";
|
||||
name = "retro68.hfsutils";
|
||||
srcs = ./hfsutils;
|
||||
|
||||
preConfigure = ''
|
||||
@ -97,10 +98,10 @@ let
|
||||
configureFlags = [ "--mandir=$(out)/share/man" "--enable-devlibs" ];
|
||||
};
|
||||
|
||||
# retro68_tools -- native tools that are part of Retro68
|
||||
retro68_tools = with pkgs;
|
||||
# tools -- native tools that are part of Retro68
|
||||
tools = with pkgs;
|
||||
stdenv.mkDerivation {
|
||||
name = "retro68_tools";
|
||||
name = "retro68.tools";
|
||||
src = nix-gitignore.gitignoreSource [
|
||||
"/*"
|
||||
"!/CMakeLists.txt"
|
||||
@ -117,15 +118,17 @@ let
|
||||
] ./.;
|
||||
|
||||
nativeBuildInputs = [ cmake bison flex ];
|
||||
buildInputs = [ boost zlib hfsutils ];
|
||||
buildInputs = [ boost zlib retro68.hfsutils ];
|
||||
};
|
||||
|
||||
} // prev.lib.optionalAttrs (prev.targetPlatform ? retro68) {
|
||||
|
||||
# ----------- Binutils & GCC -------------
|
||||
|
||||
# retro68_binutils -- binutils, without any wrappers
|
||||
retro68_binutils = with pkgs;
|
||||
# binutils_unwrapped -- binutils, without any wrappers
|
||||
binutils_unwrapped = with pkgs;
|
||||
stdenv.mkDerivation rec {
|
||||
name = "retro68_binutils";
|
||||
name = "retro68.binutils_unwrapped";
|
||||
src = ./binutils;
|
||||
|
||||
configureFlags =
|
||||
@ -150,12 +153,12 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
# retro68_gcc -- gcc, without any wrappers
|
||||
retro68_gcc = with pkgs;
|
||||
# gcc -- gcc, without any wrappers
|
||||
gcc_unwrapped = with pkgs;
|
||||
stdenv.mkDerivation rec {
|
||||
name = "retro68_gcc";
|
||||
name = "retro68.gcc_unwrapped";
|
||||
src = ./gcc;
|
||||
buildInputs = [ retro68_binutils gmp mpfr libmpc ];
|
||||
buildInputs = [ retro68.binutils_unwrapped gmp mpfr libmpc ];
|
||||
configureFlags = [
|
||||
"--target=${stdenv.targetPlatform.config}"
|
||||
"--enable-languages=c,c++"
|
||||
@ -168,7 +171,7 @@ let
|
||||
# nix does in-source builds by default, and something breaks
|
||||
buildCommand = ''
|
||||
mkdir -p $out/${stdenv.targetPlatform.config}/bin
|
||||
ln -s ${retro68_binutils}/${stdenv.targetPlatform.config}/bin/* $out/${stdenv.targetPlatform.config}/bin/
|
||||
ln -s ${retro68.binutils_unwrapped}/${stdenv.targetPlatform.config}/bin/* $out/${stdenv.targetPlatform.config}/bin/
|
||||
|
||||
export target_configargs="--disable-nls --enable-libstdcxx-dual-abi=no --disable-libstdcxx-verbose"
|
||||
$src/configure ${builtins.toString configureFlags} --prefix=$out
|
||||
@ -177,55 +180,25 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
# ----------- Binutils & GCC wrapped for nixpkgs -------------
|
||||
} // prev.lib.optionalAttrs (prev.hostPlatform ? retro68) {
|
||||
|
||||
# binutils -- binutils with the wrappers provided by nixpkgs
|
||||
binutils = if pkgs.stdenv.targetPlatform ? retro68 then
|
||||
pkgs.wrapBintoolsWith { bintools = pkgs.retro68_binutils; }
|
||||
else
|
||||
prev.binutils;
|
||||
|
||||
# gcc -- gcc with the wrappers provided by nixpkgs
|
||||
gcc = if pkgs.stdenv.targetPlatform ? retro68 then
|
||||
pkgs.wrapCCWith {
|
||||
cc = pkgs.retro68_gcc;
|
||||
|
||||
# don't allow nix to add options for hardening
|
||||
extraBuildCommands = ''
|
||||
echo "" > $out/nix-support/add-hardening.sh
|
||||
'';
|
||||
|
||||
extraPackages = with pkgs.targetPackages; [
|
||||
multiversal
|
||||
import-libraries
|
||||
libretro
|
||||
retro68_setup_hook
|
||||
];
|
||||
}
|
||||
else
|
||||
prev.gcc;
|
||||
|
||||
# no separate libc package for now
|
||||
libcCrossChooser = name:
|
||||
if name == "retro68" then null else prev.libcCrossChooser name;
|
||||
|
||||
retro68_setup_hook = let
|
||||
setup_hook = let
|
||||
systemName = pkgs.targetPlatform.cmakeSystemName;
|
||||
toolchain = pkgs.writeTextFile {
|
||||
name = "retro68-cmake-toolchain";
|
||||
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_TEMPLATES_PATH ${pkgs.libretro}/RIncludes)
|
||||
set( REZ "${pkgs.buildPackages.retro68.tools}/bin/Rez" )
|
||||
set(REZ_TEMPLATES_PATH ${pkgs.retro68.libretro}/RIncludes)
|
||||
|
||||
include(${./cmake/add_application.cmake})
|
||||
'';
|
||||
};
|
||||
hook = pkgs.writeTextFile {
|
||||
name = "retro68_setup_hook";
|
||||
name = "retro68.setup_hook";
|
||||
text = ''
|
||||
export CMAKE_TOOLCHAIN_FILE=${toolchain}
|
||||
|
||||
@ -246,8 +219,8 @@ let
|
||||
addEnvHooks "$targetOffset" retro68_addRIncludes
|
||||
|
||||
'' + (pkgs.lib.optionalString (systemName == "Retro68") ''
|
||||
export RETRO68_LD_WRAPPER_Retro68="${pkgs.buildPackages.retro68_tools}/bin/Elf2Mac"
|
||||
export RETRO68_REAL_LD="${pkgs.buildPackages.retro68_binutils}/bin/m68k-apple-macos-ld.real"
|
||||
export RETRO68_LD_WRAPPER_Retro68="${pkgs.buildPackages.retro68.tools}/bin/Elf2Mac"
|
||||
export RETRO68_REAL_LD="${pkgs.buildPackages.retro68.binutils_unwrapped}/bin/m68k-apple-macos-ld.real"
|
||||
'');
|
||||
};
|
||||
in pkgs.makeSetupHook { } hook;
|
||||
@ -259,7 +232,7 @@ let
|
||||
(stdenv.override {
|
||||
cc = stdenv.cc.override { extraPackages = [ ]; };
|
||||
}).mkDerivation {
|
||||
name = "multiversal";
|
||||
name = "retro68.multiversal";
|
||||
src = ./multiversal;
|
||||
nativeBuildInputs = [ buildPackages.ruby ];
|
||||
buildCommand = ''
|
||||
@ -275,10 +248,10 @@ let
|
||||
"");
|
||||
};
|
||||
|
||||
import-libraries = with pkgs;
|
||||
import_libraries = with pkgs;
|
||||
if stdenvNoCC.targetPlatform != retroSystems.m68k then
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "import-libraries";
|
||||
name = "retro68.import_libraries";
|
||||
src = ./ImportLibraries;
|
||||
buildCommand = ''
|
||||
mkdir -p $out/lib
|
||||
@ -306,7 +279,7 @@ let
|
||||
src = ./libretro;
|
||||
|
||||
nativeBuildInputs = [ buildPackages.cmake ];
|
||||
buildInputs = [ multiversal ];
|
||||
buildInputs = [ retro68.multiversal ];
|
||||
|
||||
buildCommand = ''
|
||||
echo "Build command."
|
||||
@ -320,6 +293,36 @@ let
|
||||
'';
|
||||
};
|
||||
};
|
||||
} // prev.lib.optionalAttrs (prev.targetPlatform ? retro68) {
|
||||
|
||||
# ----------- Binutils & GCC wrapped for nixpkgs -------------
|
||||
|
||||
# binutils -- binutils with the wrappers provided by nixpkgs
|
||||
binutils =
|
||||
pkgs.wrapBintoolsWith { bintools = pkgs.retro68.binutils_unwrapped; };
|
||||
|
||||
# gcc -- gcc with the wrappers provided by nixpkgs
|
||||
gcc = pkgs.wrapCCWith {
|
||||
cc = pkgs.retro68.gcc_unwrapped;
|
||||
|
||||
# don't allow nix to add options for hardening
|
||||
extraBuildCommands = ''
|
||||
echo "" > $out/nix-support/add-hardening.sh
|
||||
'';
|
||||
|
||||
extraPackages = with pkgs.targetPackages.retro68; [
|
||||
multiversal
|
||||
import_libraries
|
||||
libretro
|
||||
setup_hook
|
||||
];
|
||||
};
|
||||
|
||||
# no separate libc package for now
|
||||
libcCrossChooser = name:
|
||||
if name == "retro68" then null else prev.libcCrossChooser name;
|
||||
|
||||
};
|
||||
|
||||
pkgs = import <nixpkgs> {
|
||||
inherit system;
|
||||
@ -336,8 +339,12 @@ let
|
||||
|
||||
shell = pkgs.lib.mapAttrs (name: cross:
|
||||
cross.mkShell {
|
||||
nativeBuildInputs =
|
||||
[ pkgs.hfsutils pkgs.retro68_tools pkgs.cmake pkgs.gnumake ];
|
||||
nativeBuildInputs = with pkgs; [
|
||||
retro68.hfsutils
|
||||
retro68.tools
|
||||
cmake
|
||||
gnumake
|
||||
];
|
||||
} // cross) crossPkgs;
|
||||
|
||||
in shell.m68k // shell // { inherit overlay; }
|
||||
|
Loading…
Reference in New Issue
Block a user