commit
c525614549
38
README.md
38
README.md
|
@ -155,37 +155,39 @@ Using Retro68 with Nix
|
|||
If you are not using the [Nix Package Manager](https://www.nixos.org), please skip this section. But maybe you should be using it ;-).
|
||||
|
||||
Nix is a package manager that runs on Linux and macOS, and NixOS is a Linux distribution based on it.
|
||||
Try the [Determinate Nix Installer](https://install.determinate.systems/) for the best installation experience.
|
||||
|
||||
If you've got `nix` installed, after downloading Retro68, you can run
|
||||
[TODO: docs on using the binary cache to avoid builds]
|
||||
|
||||
nix-shell
|
||||
Once you've got `nix` installed, and without checking out the Retro68 repository, you can run
|
||||
|
||||
nix develop github:autc04/Retro68#m68k
|
||||
|
||||
from the Retro68 directory to get a shell with the compiler tools targeting
|
||||
68K Macs available in the path, and `CC` and other environment variables already
|
||||
set up for you. You can then `cd` to one of the example directories or to your
|
||||
own project and use `cmake` to build it.
|
||||
|
||||
You can use the `nix-shell` command to invoke various useful shell environments:
|
||||
Likewise, use
|
||||
|
||||
| Command | What |
|
||||
|-------------------------------------|----------------------------------------------|
|
||||
| `nix-shell` | 68K development environment |
|
||||
| `nix-shell -A m68k` | 68K development environment |
|
||||
| `nix-shell -A powerpc` | PowerPC development environment |
|
||||
| `nix-shell -A retro68.monolithic` | Shell for running `build-toolchain.bash` |
|
||||
nix develop github:autc04/Retro68#powerpc
|
||||
|
||||
You can also use the `nix-build` command to build packages. As always with `nix`,
|
||||
... to get an environment targeting PowerPC Macs.
|
||||
|
||||
If you have a local checkout of Retro68, you can replace `github:autc04/Retro68` by the path
|
||||
to that local checkout, e.g., run `nix develop .#m68k` from inside the Retro68 directory.
|
||||
|
||||
You can also use the `nix build` command to build packages. As always with `nix`,
|
||||
the result will be somewhere in a subdirectory of `/nix/store`, with a symlink
|
||||
named `result` placed in your Retro68 directory.
|
||||
named `result` placed in the directory where you invoked the command.
|
||||
|
||||
| Command | What |
|
||||
|----------------------------------------|----------------------------------------------|
|
||||
| `nix-build -A m68k.retro68.samples` | Sample programs for 68K |
|
||||
| `nix-build -A powerpc.retro68.samples` | Sample programs for PowerPC |
|
||||
| `nix-build -A retro68.monolithic` | Result of `build-toolchain.bash --no-carbon` |
|
||||
| `nix-build -A m68k.zlib` | zlib library, cross-compiled for 68K Macs |
|
||||
| `nix-build -A m68k.`*packagename* | cross-compile *packagename* to 68K |
|
||||
| `nix-build -A powerpc.`*packagename* | cross-compile *packagename* to PowerPC |
|
||||
|--------------------------------------------------------------------|-------------------------------------------|
|
||||
| `nix build github:autc04/Retro68#samples-m68k` | Sample programs for 68K |
|
||||
| `nix build github:autc04/Retro68#samples-powerpc` | Sample programs for PowerPC |
|
||||
| `nix build github:autc04/Retro68#pkgsCross.m68k.zlib` | zlib library, cross-compiled for 68K Macs |
|
||||
| `nix build github:autc04/Retro68#pkgsCross.m68k.`*packagename* | cross-compile *packagename* to 68K |
|
||||
| `nnix build github:autc04/Retro68#pkgsCross.powerpc.`*packagename* | cross-compile *packagename* to PowerPC |
|
||||
|
||||
You can attempt to cross-compile *any* package from the `nixpkgs` collection. Unless the
|
||||
package contains a very portable library, the command will of course fail. Please don't
|
||||
|
|
|
@ -91,36 +91,32 @@ jobs:
|
|||
TARGET: powerpc
|
||||
Carbon:
|
||||
TARGET: carbon
|
||||
maxParallel: 2
|
||||
pool:
|
||||
vmImage: 'ubuntu-20.04'
|
||||
vmImage: 'ubuntu-latest'
|
||||
steps:
|
||||
- checkout: self
|
||||
submodules: true
|
||||
- script: |
|
||||
docker run -i --name nix -v`pwd`:/src nixos/nix:2.18.1 <<EOF
|
||||
nix-env -iA cachix -f https://cachix.org/api/v1/install
|
||||
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix \
|
||||
| sh -s -- install --no-confirm --extra-conf "trusted-users = root vsts"
|
||||
displayName: Install Nix
|
||||
- script: |
|
||||
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
nix profile install --accept-flake-config nixpkgs#cachix
|
||||
cachix use autc04
|
||||
nix-build src -A ${TARGET}.retro68.samples
|
||||
EOF
|
||||
displayName: Build inside nixos/nix docker
|
||||
displayName: Setup Cachix
|
||||
- checkout: self
|
||||
submodules: false
|
||||
- script: |
|
||||
mkdir CompiledSamples
|
||||
cd CompiledSamples
|
||||
docker cp -L nix:result - | tar x --strip-components 1
|
||||
displayName: Copy result out of docker
|
||||
|
||||
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
nix develop .#${TARGET} --profile dev-profile -c true
|
||||
nix build .#samples-${TARGET} --out-link CompiledSamples
|
||||
displayName: Build
|
||||
- publish: CompiledSamples
|
||||
artifact: Samples ($(TARGET))
|
||||
- script: |
|
||||
docker start nix -i <<EOF || true
|
||||
set -e
|
||||
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
export CACHIX_AUTH_TOKEN=$(CACHIX_AUTH_TOKEN)
|
||||
cd src
|
||||
nix-build -A ${TARGET}.retro68.samples | cachix push autc04
|
||||
nix-shell -A ${TARGET} --command exit
|
||||
nix-store -qR --include-outputs \$(nix-instantiate default.nix -A ${TARGET}) | cachix push autc04
|
||||
EOF
|
||||
cachix push autc04 dev-profile
|
||||
cachix push autc04 CompiledSamples
|
||||
displayName: Push to Cachix
|
||||
condition: and(succeeded(), ne(variables['CACHIX_AUTH_TOKEN'], ''))
|
||||
|
||||
|
@ -134,32 +130,29 @@ jobs:
|
|||
TARGET: powerpc
|
||||
Carbon:
|
||||
TARGET: carbon
|
||||
maxParallel: 2
|
||||
pool:
|
||||
vmImage: 'macOS-11'
|
||||
vmImage: 'macOS-latest'
|
||||
steps:
|
||||
- script: |
|
||||
export NIX_EXTRA_CONF="trusted-users = root runner"
|
||||
sh <(curl -L https://nixos.org/nix/install)
|
||||
displayName: Install nix
|
||||
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix \
|
||||
| sh -s -- install --no-confirm --extra-conf "trusted-users = root runner"
|
||||
displayName: Install Nix
|
||||
- script: |
|
||||
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
nix-env -iA cachix -f https://cachix.org/api/v1/install
|
||||
nix profile install --accept-flake-config nixpkgs#cachix
|
||||
cachix use autc04
|
||||
displayName: setup cachix
|
||||
|
||||
displayName: Setup Cachix
|
||||
- checkout: self
|
||||
submodules: false
|
||||
- script: |
|
||||
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
nix-build -A $(TARGET).retro68.samples
|
||||
displayName: build
|
||||
nix develop .#${TARGET} --profile dev-profile -c true
|
||||
nix build .#samples-${TARGET} --out-link CompiledSamples
|
||||
displayName: Build
|
||||
- script: |
|
||||
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
export CACHIX_AUTH_TOKEN=$(CACHIX_AUTH_TOKEN)
|
||||
nix-build -A $(TARGET).retro68.samples | (cachix push autc04 || true)
|
||||
nix-shell -A $(TARGET) --command exit
|
||||
nix-store -qR --include-outputs `nix-instantiate default.nix -A $(TARGET)` | (cachix push autc04 || true)
|
||||
cachix push autc04 dev-profile
|
||||
cachix push autc04 CompiledSamples
|
||||
displayName: Push to Cachix
|
||||
condition: and(succeeded(), ne(variables['CACHIX_AUTH_TOKEN'], ''))
|
||||
|
||||
|
|
38
default.nix
38
default.nix
|
@ -1,16 +1,18 @@
|
|||
let sources = import ./nix/sources.nix;
|
||||
in { system ? builtins.currentSystem, nixpkgs ? sources.nixpkgs, ... }:
|
||||
in { system ? builtins.currentSystem
|
||||
, nixpkgs ? sources.nixpkgs
|
||||
, multiversal_src ? if builtins.pathExists ./multiversal/make-multiverse.rb then
|
||||
./multiversal
|
||||
else
|
||||
sources.multiversal
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
retroPlatforms = import nix/platforms.nix;
|
||||
|
||||
lib = ((import nixpkgs) { inherit system; }).lib;
|
||||
|
||||
multiversal_src = if builtins.pathExists ./multiversal/make-multiverse.rb then
|
||||
./multiversal
|
||||
else
|
||||
sources.multiversal;
|
||||
|
||||
# A Nixpkgs overlay.
|
||||
overlay = lib.composeManyExtensions [
|
||||
((import nix/overlay.nix) { inherit multiversal_src; })
|
||||
|
@ -23,16 +25,21 @@ let
|
|||
overlays = [ overlay ];
|
||||
};
|
||||
|
||||
crossPkgs = lib.mapAttrs (name: plat:
|
||||
crossPkgs = lib.mapAttrs
|
||||
(name: plat:
|
||||
import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ overlay ];
|
||||
crossSystem = plat;
|
||||
config = { allowUnsupportedSystem = true; };
|
||||
}) retroPlatforms;
|
||||
})
|
||||
retroPlatforms;
|
||||
targetPkgs = lib.mapAttrs (name: cross: cross.buildPackages) crossPkgs;
|
||||
|
||||
shell = lib.mapAttrs (name: cross:
|
||||
cross.mkShell {
|
||||
shell = lib.mapAttrs
|
||||
(name: cross:
|
||||
cross.mkShell
|
||||
{
|
||||
nativeBuildInputs = with overlaidPkgs; [
|
||||
retro68.hfsutils
|
||||
retro68.tools
|
||||
|
@ -40,9 +47,14 @@ let
|
|||
gnumake
|
||||
];
|
||||
buildInputs = [ cross.retro68.console ];
|
||||
} // cross) crossPkgs;
|
||||
} // cross)
|
||||
crossPkgs;
|
||||
|
||||
in shell.m68k // shell // {
|
||||
in
|
||||
builtins.trace
|
||||
"Warning: Retro68's default.nix is deprecated and will disappear soon. Please use the flake instead."
|
||||
(shell.m68k // shell // {
|
||||
inherit overlay;
|
||||
inherit (overlaidPkgs) retro68;
|
||||
}
|
||||
targetPkg = targetPkgs;
|
||||
})
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1701473968,
|
||||
"narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"multiversal": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1703617805,
|
||||
"narHash": "sha256-GngLWR9i+hC7hJ+ZkKlRK4K63lIJ4D/CMXZwefcVAqw=",
|
||||
"owner": "autc04",
|
||||
"repo": "multiversal",
|
||||
"rev": "27c08c654bbd48d23f025741e3a584b59374904a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "autc04",
|
||||
"repo": "multiversal",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1703200384,
|
||||
"narHash": "sha256-q5j06XOsy0qHOarsYPfZYJPWbTbc8sryRxianlEPJN0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0b3d618173114c64ab666f557504d6982665d328",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1701253981,
|
||||
"narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"multiversal": "multiversal",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
{
|
||||
description = "Description for the project";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
multiversal.url = "github:autc04/multiversal";
|
||||
multiversal.flake = false;
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
};
|
||||
|
||||
outputs = inputs@{ flake-parts, nixpkgs, multiversal, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } ({ self, lib, retroPlatforms, ... }: {
|
||||
_module.args.lib = import (nixpkgs + "/lib");
|
||||
_module.args.retroPlatforms = import ./nix/platforms.nix;
|
||||
|
||||
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
|
||||
perSystem = { config, self', inputs', pkgs, system, ... }:
|
||||
{
|
||||
_module.args.pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.default ]; };
|
||||
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
|
||||
legacyPackages.pkgsCross = lib.mapAttrs
|
||||
(name: plat:
|
||||
import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ self.overlays.default ];
|
||||
crossSystem = plat;
|
||||
config = { allowUnsupportedSystem = true; };
|
||||
})
|
||||
retroPlatforms;
|
||||
|
||||
devShells = {
|
||||
default = pkgs.mkShell {
|
||||
inputsFrom = [ pkgs.retro68.monolithic ];
|
||||
nativeBuildInputs = [ pkgs.nixpkgs-fmt ];
|
||||
};
|
||||
} // lib.mapAttrs
|
||||
(name: cross:
|
||||
cross.mkShell
|
||||
{
|
||||
nativeBuildInputs = with pkgs; [
|
||||
retro68.hfsutils
|
||||
retro68.tools
|
||||
cmake
|
||||
gnumake
|
||||
ninja
|
||||
];
|
||||
buildInputs = [ cross.retro68.console ];
|
||||
} // cross)
|
||||
self'.legacyPackages.pkgsCross;
|
||||
|
||||
packages = {
|
||||
tools = pkgs.retro68.tools;
|
||||
hfsutils = pkgs.retro68.hfsutils;
|
||||
|
||||
default = pkgs.runCommand "Retro68" { } ''
|
||||
mkdir $out
|
||||
mkdir $out/m68k-apple-macos
|
||||
mkdir $out/powerpc-apple-macos
|
||||
${pkgs.xorg.lndir}/bin/lndir -silent ${self'.legacyPackages.pkgsCross.m68k.retro68.libretro}/. $out/m68k-apple-macos
|
||||
${pkgs.xorg.lndir}/bin/lndir -silent ${self'.legacyPackages.pkgsCross.m68k.retro68.multiversal}/. $out/m68k-apple-macos
|
||||
${pkgs.xorg.lndir}/bin/lndir -silent ${self'.legacyPackages.pkgsCross.powerpc.retro68.libretro}/. $out/powerpc-apple-macos
|
||||
${pkgs.xorg.lndir}/bin/lndir -silent ${self'.legacyPackages.pkgsCross.powerpc.retro68.multiversal}/. $out/powerpc-apple-macos
|
||||
${pkgs.xorg.lndir}/bin/lndir -silent ${self'.legacyPackages.pkgsCross.carbon.retro68.libretro}/. $out/powerpc-apple-macos
|
||||
${pkgs.xorg.lndir}/bin/lndir -silent ${self'.legacyPackages.pkgsCross.carbon.retro68.multiversal}/. $out/powerpc-apple-macos
|
||||
${pkgs.xorg.lndir}/bin/lndir -silent ${pkgs.retro68.tools}/. $out
|
||||
${pkgs.xorg.lndir}/bin/lndir -silent ${pkgs.retro68.hfsutils}/. $out
|
||||
${pkgs.xorg.lndir}/bin/lndir -silent ${pkgs.cmake}/. $out
|
||||
${pkgs.xorg.lndir}/bin/lndir -silent ${pkgs.gnumake}/. $out
|
||||
${pkgs.xorg.lndir}/bin/lndir -silent ${pkgs.ninja}/. $out
|
||||
|
||||
${pkgs.rsync}/bin/rsync -a ${self'.legacyPackages.pkgsCross.m68k.buildPackages.retro68.gcc_unwrapped}/. $out
|
||||
${pkgs.rsync}/bin/rsync -a ${self'.legacyPackages.pkgsCross.powerpc.buildPackages.retro68.gcc_unwrapped}/. $out
|
||||
${pkgs.rsync}/bin/rsync -a ${self'.legacyPackages.pkgsCross.carbon.buildPackages.retro68.gcc_unwrapped}/. $out
|
||||
'';
|
||||
|
||||
samples = pkgs.linkFarm "Retro68-Samples" [
|
||||
{ name = "m68k"; path = self'.legacyPackages.pkgsCross.m68k.retro68.samples; }
|
||||
{ name = "powerpc"; path = self'.legacyPackages.pkgsCross.powerpc.retro68.samples; }
|
||||
{ name = "carbon"; path = self'.legacyPackages.pkgsCross.carbon.retro68.samples; }
|
||||
];
|
||||
} // lib.mapAttrs'
|
||||
(name: cross: lib.nameValuePair "samples-${name}" cross.retro68.samples)
|
||||
self'.legacyPackages.pkgsCross;
|
||||
};
|
||||
flake = {
|
||||
overlays.default =
|
||||
lib.composeManyExtensions [
|
||||
((import nix/overlay.nix) {
|
||||
multiversal_src =
|
||||
if builtins.pathExists ./multiversal/make-multiverse.rb
|
||||
then ./multiversal
|
||||
else multiversal;
|
||||
})
|
||||
(import nix/universal.nix)
|
||||
(import nix/samples.nix)
|
||||
];
|
||||
};
|
||||
});
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
# turn off garnix for now
|
||||
builds:
|
||||
include: []
|
||||
exclude: []
|
|
@ -19,6 +19,8 @@
|
|||
* $Id: data.h,v 1.7 1998/11/02 22:08:58 rob Exp $
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
extern const unsigned char hfs_charorder[];
|
||||
|
||||
signed char d_getsb(register const unsigned char *);
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
* $Id: data.h,v 1.5 1998/04/11 08:27:18 rob Exp $
|
||||
*/
|
||||
|
||||
# include <time.h>
|
||||
|
||||
extern const unsigned char hfs_charorder[];
|
||||
|
||||
signed char d_getsb(const unsigned char *);
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d7aac1e58d165c30fd3a0796e7b4745e78d34643
|
||||
Subproject commit 27c08c654bbd48d23f025741e3a584b59374904a
|
|
@ -1,6 +1,5 @@
|
|||
{ multiversal_src }:
|
||||
pkgs: prevPkgs:
|
||||
{
|
||||
pkgs: prevPkgs: {
|
||||
retro68 = pkgs.lib.makeScope pkgs.newScope (self:
|
||||
{
|
||||
platforms = import ./platforms.nix;
|
||||
|
@ -33,6 +32,7 @@ pkgs: prevPkgs:
|
|||
mkdir -p $out/share/man/man1
|
||||
'';
|
||||
configureFlags = [ "--mandir=$(out)/share/man" "--enable-devlibs" ];
|
||||
env.CFLAGS = "--std=c89"; # the configure script fails with modern C
|
||||
};
|
||||
|
||||
# tools -- native tools that are part of Retro68
|
||||
|
@ -75,11 +75,13 @@ pkgs: prevPkgs:
|
|||
++ stdenv.targetPlatform.retro68BinutilsConfig or [ ];
|
||||
enableParallelBuilding = true;
|
||||
|
||||
postInstall = let
|
||||
postInstall =
|
||||
let
|
||||
ld = "$out/bin/${stdenv.targetPlatform.config}-ld";
|
||||
ld_real = "$out/bin/${stdenv.targetPlatform.config}-ld.real";
|
||||
|
||||
in ''
|
||||
in
|
||||
''
|
||||
mv ${ld} ${ld_real}
|
||||
|
||||
echo "#!${stdenv.shell}" > ${ld}
|
||||
|
@ -117,11 +119,38 @@ pkgs: prevPkgs:
|
|||
make -j$NIX_BUILD_CORES
|
||||
make install
|
||||
'';
|
||||
env.CXXFLAGS = "--std=c++14"; # gcc 9 doesn't seem to like C++17
|
||||
};
|
||||
|
||||
# binutils -- binutils with the wrappers provided by nixpkgs
|
||||
binutils = pkgs.wrapBintoolsWith {
|
||||
bintools = pkgs.retro68.binutils_unwrapped;
|
||||
libc = null;
|
||||
};
|
||||
|
||||
# gcc -- gcc with the wrappers provided by nixpkgs
|
||||
gcc = pkgs.wrapCCWith {
|
||||
cc = pkgs.retro68.gcc_unwrapped;
|
||||
bintools = pkgs.retro68.binutils;
|
||||
libc = null;
|
||||
|
||||
# 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
|
||||
];
|
||||
};
|
||||
|
||||
} // prevPkgs.lib.optionalAttrs (prevPkgs.hostPlatform ? retro68) {
|
||||
|
||||
setup_hook = let
|
||||
setup_hook =
|
||||
let
|
||||
systemName = pkgs.targetPlatform.cmakeSystemName;
|
||||
toolchain = pkgs.writeTextFile {
|
||||
name = "retro68.cmake-toolchain";
|
||||
|
@ -168,7 +197,8 @@ pkgs: prevPkgs:
|
|||
export RETRO68_REAL_LD="${pkgs.buildPackages.retro68.binutils_unwrapped}/bin/m68k-apple-macos-ld.real"
|
||||
'');
|
||||
};
|
||||
in pkgs.makeSetupHook { } hook;
|
||||
in
|
||||
pkgs.makeSetupHook { name = "retro68.setup_hook"; } hook;
|
||||
|
||||
# ----------- Retro68 core libraries -------------
|
||||
|
||||
|
@ -179,7 +209,7 @@ pkgs: prevPkgs:
|
|||
}).mkDerivation {
|
||||
name = "retro68.multiversal";
|
||||
src = multiversal_src;
|
||||
nativeBuildInputs = [ buildPackages.ruby ];
|
||||
nativeBuildInputs = [ pkgsBuildBuild.ruby ];
|
||||
buildCommand = ''
|
||||
echo $src
|
||||
build=`pwd`
|
||||
|
@ -193,10 +223,10 @@ pkgs: prevPkgs:
|
|||
"");
|
||||
};
|
||||
|
||||
|
||||
import_libraries = with pkgs;
|
||||
if stdenvNoCC.targetPlatform.system != "m68k-macos" then
|
||||
stdenvNoCC.mkDerivation {
|
||||
stdenvNoCC.mkDerivation
|
||||
{
|
||||
name = "retro68.import_libraries";
|
||||
src = ../ImportLibraries;
|
||||
buildCommand = ''
|
||||
|
@ -218,7 +248,8 @@ pkgs: prevPkgs:
|
|||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
'';
|
||||
};
|
||||
in (pkgs.stdenv.override {
|
||||
in
|
||||
(pkgs.stdenv.override {
|
||||
cc = stdenv.cc.override { extraPackages = [ ]; };
|
||||
}).mkDerivation {
|
||||
name = "libretro";
|
||||
|
@ -248,33 +279,22 @@ pkgs: prevPkgs:
|
|||
};
|
||||
|
||||
});
|
||||
} // prevPkgs.lib.optionalAttrs (prevPkgs.targetPlatform ? retro68) {
|
||||
|
||||
# ----------- Binutils & GCC wrapped for nixpkgs -------------
|
||||
|
||||
# binutils -- binutils with the wrappers provided by nixpkgs
|
||||
# note: on nix/darwin (as of nixpkgs 23.11), nixpkgs seems to
|
||||
# ignore (or re-override) this override.
|
||||
binutils =
|
||||
pkgs.wrapBintoolsWith { bintools = pkgs.retro68.binutils_unwrapped; };
|
||||
if (prevPkgs.targetPlatform ? retro68) then
|
||||
pkgs.retro68.binutils
|
||||
else
|
||||
prevPkgs.binutils;
|
||||
|
||||
# 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 prevPkgs.libcCrossChooser name;
|
||||
|
||||
gcc =
|
||||
if (prevPkgs.targetPlatform ? retro68) then
|
||||
pkgs.retro68.gcc
|
||||
else
|
||||
prevPkgs.gcc;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
m68k = {
|
||||
system = "m68k-macos";
|
||||
config = "m68k-apple-macos";
|
||||
libc = "retro68";
|
||||
libc = null;
|
||||
parsed = {
|
||||
cpu = {
|
||||
name = "m68k";
|
||||
|
@ -14,6 +14,8 @@
|
|||
name = "macos";
|
||||
execFormat = { name = "unknown"; };
|
||||
};
|
||||
vendor = { name = "apple"; };
|
||||
abi = { name = "macos"; };
|
||||
};
|
||||
bfdEmulation = "m68k";
|
||||
isStatic = true;
|
||||
|
@ -25,7 +27,7 @@
|
|||
powerpc = {
|
||||
system = "powerpc-macos";
|
||||
config = "powerpc-apple-macos";
|
||||
libc = "retro68";
|
||||
libc = null;
|
||||
parsed = {
|
||||
cpu = {
|
||||
name = "powerpc";
|
||||
|
@ -37,6 +39,8 @@
|
|||
name = "macos";
|
||||
execFormat = { name = "unknown"; };
|
||||
};
|
||||
vendor = { name = "apple"; };
|
||||
abi = { name = "macos"; };
|
||||
};
|
||||
|
||||
isStatic = true;
|
||||
|
@ -48,7 +52,7 @@
|
|||
carbon = {
|
||||
system = "powerpc-carbon";
|
||||
config = "powerpc-apple-macos";
|
||||
libc = "retro68";
|
||||
libc = null;
|
||||
parsed = {
|
||||
cpu = {
|
||||
name = "powerpc";
|
||||
|
@ -60,6 +64,8 @@
|
|||
name = "carbon";
|
||||
execFormat = { name = "unknown"; };
|
||||
};
|
||||
vendor = { name = "apple"; };
|
||||
abi = { name = "macos"; };
|
||||
};
|
||||
isStatic = true;
|
||||
retro68BinutilsConfig = [ "--disable-plugins" ];
|
||||
|
@ -67,9 +73,4 @@
|
|||
retro68 = true;
|
||||
cmakeSystemName = "RetroCarbon";
|
||||
};
|
||||
|
||||
isStatic = true;
|
||||
retro68BinutilsConfig = [ "--disable-plugins" ];
|
||||
retro68GccConfig = [ "--disable-lto" ];
|
||||
retro68 = true;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,8 @@ pkgs: prevPkgs: {
|
|||
retro68 = prevPkgs.retro68.overrideScope' (self: prevRetro: {
|
||||
samples = with pkgs;
|
||||
let
|
||||
individualSamples = lib.mapAttrs (key: path:
|
||||
individualSamples = lib.mapAttrs
|
||||
(key: path:
|
||||
stdenv.mkDerivation {
|
||||
name = "retro68.samples." + key;
|
||||
src = path;
|
||||
|
@ -13,7 +14,8 @@ pkgs: prevPkgs: {
|
|||
cp *.bin $out/
|
||||
rm -f $out/*.code.bin $out/*.rsrc.bin
|
||||
'';
|
||||
}) ({
|
||||
})
|
||||
({
|
||||
dialog = ../Samples/Dialog;
|
||||
helloworld = ../Samples/HelloWorld;
|
||||
raytracer = ../Samples/Raytracer;
|
||||
|
@ -26,7 +28,8 @@ pkgs: prevPkgs: {
|
|||
systemextension = ../Samples/SystemExtension;
|
||||
launcher = ../Samples/Launcher;
|
||||
}) // { launchapplserver = self.launchapplserver; };
|
||||
in runCommand "retro68.samples" { } ''
|
||||
in
|
||||
runCommand "retro68.samples" { } ''
|
||||
mkdir -p $out/
|
||||
|
||||
${lib.concatMapStrings (x: ''
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
"homepage": null,
|
||||
"owner": "autc04",
|
||||
"repo": "multiversal",
|
||||
"rev": "ce33b1bada9b0acb14021c21ac916927c757d525",
|
||||
"sha256": "1fsyjad4kwsqgr2mlx9dfl7z8z42cf2sgw1arqmci47zhaj8is1f",
|
||||
"rev": "27c08c654bbd48d23f025741e3a584b59374904a",
|
||||
"sha256": "1b022pvpjw3n6713zq09abgbm0iba6lr16czhjxi1yk23xchny0s",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/autc04/multiversal/archive/ce33b1bada9b0acb14021c21ac916927c757d525.tar.gz",
|
||||
"url": "https://github.com/autc04/multiversal/archive/27c08c654bbd48d23f025741e3a584b59374904a.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"niv": {
|
||||
|
@ -17,22 +17,22 @@
|
|||
"homepage": "https://github.com/nmattia/niv",
|
||||
"owner": "nmattia",
|
||||
"repo": "niv",
|
||||
"rev": "5830a4dd348d77e39a0f3c4c762ff2663b602d4c",
|
||||
"sha256": "1d3lsrqvci4qz2hwjrcnd8h5vfkg8aypq3sjd4g3izbc8frwz5sm",
|
||||
"rev": "6bd7cd686220bf3db0e212481faf9578e8c8ff0f",
|
||||
"sha256": "15claxlj6y15db67qc7kb4vzyn6sv7r13z4q502vq7a4z2488z94",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/nmattia/niv/archive/5830a4dd348d77e39a0f3c4c762ff2663b602d4c.tar.gz",
|
||||
"url": "https://github.com/nmattia/niv/archive/6bd7cd686220bf3db0e212481faf9578e8c8ff0f.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"nixpkgs": {
|
||||
"branch": "release-21.11",
|
||||
"branch": "nixos-23.11",
|
||||
"description": "Nix Packages collection",
|
||||
"homepage": "",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d1e59cfc49961e121583abe32e2f3db1550fbcff",
|
||||
"sha256": "03ldf1dlxqf3g8qh9x5vp6vd9zvvr481fyjds111imll69y60wpm",
|
||||
"rev": "0b3d618173114c64ab666f557504d6982665d328",
|
||||
"sha256": "1p941x8rx6hq8zrcmwnw6rnxd4v0v7vn1v5a763lmjxcfglz965b",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/d1e59cfc49961e121583abe32e2f3db1550fbcff.tar.gz",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/0b3d618173114c64ab666f557504d6982665d328.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,12 +27,33 @@ let
|
|||
fetch_git = name: spec:
|
||||
let
|
||||
ref =
|
||||
if spec ? ref then spec.ref else
|
||||
spec.ref or (
|
||||
if spec ? branch then "refs/heads/${spec.branch}" else
|
||||
if spec ? tag then "refs/tags/${spec.tag}" else
|
||||
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
|
||||
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"
|
||||
);
|
||||
submodules = spec.submodules or false;
|
||||
submoduleArg =
|
||||
let
|
||||
nixSupportsSubmodules = builtins.compareVersions builtins.nixVersion "2.4" >= 0;
|
||||
emptyArgWithWarning =
|
||||
if submodules
|
||||
then
|
||||
builtins.trace
|
||||
(
|
||||
"The niv input \"${name}\" uses submodules "
|
||||
+ "but your nix's (${builtins.nixVersion}) builtins.fetchGit "
|
||||
+ "does not support them"
|
||||
)
|
||||
{ }
|
||||
else { };
|
||||
in
|
||||
builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; };
|
||||
if nixSupportsSubmodules
|
||||
then { inherit submodules; }
|
||||
else emptyArgWithWarning;
|
||||
in
|
||||
builtins.fetchGit
|
||||
({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg);
|
||||
|
||||
fetch_local = spec: spec.path;
|
||||
|
||||
|
@ -95,7 +116,7 @@ let
|
|||
# the path directly as opposed to the fetched source.
|
||||
replace = name: drv:
|
||||
let
|
||||
saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
|
||||
saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name;
|
||||
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
|
||||
in
|
||||
if ersatz == "" then drv else
|
||||
|
@ -131,7 +152,7 @@ let
|
|||
inherit (builtins) lessThan nixVersion fetchTarball;
|
||||
in
|
||||
if lessThan nixVersion "1.12" then
|
||||
fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
|
||||
fetchTarball ({ inherit url; } // (optionalAttrs (name != null) { inherit name; }))
|
||||
else
|
||||
fetchTarball attrs;
|
||||
|
||||
|
@ -141,25 +162,28 @@ let
|
|||
inherit (builtins) lessThan nixVersion fetchurl;
|
||||
in
|
||||
if lessThan nixVersion "1.12" then
|
||||
fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
|
||||
fetchurl ({ inherit url; } // (optionalAttrs (name != null) { inherit name; }))
|
||||
else
|
||||
fetchurl attrs;
|
||||
|
||||
# Create the final "sources" from the config
|
||||
mkSources = config:
|
||||
mapAttrs (
|
||||
mapAttrs
|
||||
(
|
||||
name: spec:
|
||||
if builtins.hasAttr "outPath" spec
|
||||
then abort
|
||||
then
|
||||
abort
|
||||
"The values in sources.json should not have an 'outPath' attribute"
|
||||
else
|
||||
spec // { outPath = replace name (fetch config.pkgs name spec); }
|
||||
) config.sources;
|
||||
)
|
||||
config.sources;
|
||||
|
||||
# The "config" used by the fetchers
|
||||
mkConfig =
|
||||
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
|
||||
, sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
|
||||
, sources ? if sourcesFile == null then { } else builtins.fromJSON (builtins.readFile sourcesFile)
|
||||
, system ? builtins.currentSystem
|
||||
, pkgs ? mkPkgs sources system
|
||||
}: rec {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
pkgs: prevPkgs:
|
||||
{
|
||||
retro68 = if !(prevPkgs.hostPlatform ? retro68) then
|
||||
retro68 =
|
||||
if !(prevPkgs.hostPlatform ? retro68) then
|
||||
prevPkgs.retro68
|
||||
else
|
||||
prevPkgs.retro68.overrideScope' (self: prevRetro: {
|
||||
|
@ -53,7 +54,6 @@ pkgs: prevPkgs:
|
|||
'');
|
||||
};
|
||||
});
|
||||
} // prevPkgs.lib.optionalAttrs (prevPkgs.targetPlatform ? retro68) {
|
||||
|
||||
stdenvUniversal = pkgs.stdenv.override {
|
||||
cc = pkgs.stdenv.cc.override {
|
||||
|
|
Loading…
Reference in New Issue