Skip to content

Commit ab324de

Browse files
authored
x16: adopt, fix build on GCC 14, modernize (#408332)
2 parents 10862bc + 0405671 commit ab324de

File tree

3 files changed

+25
-18
lines changed

3 files changed

+25
-18
lines changed

pkgs/by-name/x1/x16/package.nix

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
lib,
33
stdenv,
44
fetchFromGitHub,
5+
fetchpatch2,
56
SDL2,
67
callPackage,
78
zlib,
9+
nix-update-script,
810
}:
911

1012
stdenv.mkDerivation (finalAttrs: {
@@ -14,10 +16,19 @@ stdenv.mkDerivation (finalAttrs: {
1416
src = fetchFromGitHub {
1517
owner = "X16Community";
1618
repo = "x16-emulator";
17-
rev = "r${finalAttrs.version}";
19+
tag = "r${finalAttrs.version}";
1820
hash = "sha256-E4TosRoORCWLotOIXROP9oqwqo1IRSa6X13GnmuxE9A=";
1921
};
2022

23+
# Fix build on GCC 14
24+
# TODO: Remove for next release as it should already be included in upstream
25+
patches = [
26+
(fetchpatch2 {
27+
url = "https://github.com/X16Community/x16-emulator/commit/3da83c93d46a99635cf73a6f9fdcf1bd4a4ae04f.patch";
28+
hash = "sha256-DZItqq7B1lXZ6VFsQUdQKn0wt1HaX4ymq2pI2DamY3w=";
29+
})
30+
];
31+
2132
postPatch = ''
2233
substituteInPlace Makefile \
2334
--replace-fail '/bin/echo' 'echo'
@@ -48,14 +59,16 @@ stdenv.mkDerivation (finalAttrs: {
4859
run = (callPackage ./run.nix { }) {
4960
inherit (finalAttrs.finalPackage) emulator rom;
5061
};
62+
63+
updateScript = nix-update-script { };
5164
};
5265

5366
meta = {
5467
homepage = "https://cx16forum.com/";
5568
description = "Official emulator of CommanderX16 8-bit computer";
56-
changelog = "https://github.com/X16Community/x16-emulator/blob/r${finalAttrs.version}/RELEASES.md";
69+
changelog = "https://github.com/X16Community/x16-emulator/blob/${finalAttrs.src.rev}/RELEASES.md";
5770
license = lib.licenses.bsd2;
58-
maintainers = with lib.maintainers; [ ];
71+
maintainers = with lib.maintainers; [ pluiedev ];
5972
mainProgram = "x16emu";
6073
inherit (SDL2.meta) platforms;
6174
broken = stdenv.hostPlatform.isAarch64; # ofborg fails to compile it

pkgs/by-name/x1/x16/rom.nix

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
cc65,
66
lzsa,
77
python3,
8+
nix-update-script,
89
}:
910

1011
stdenv.mkDerivation (finalAttrs: {
@@ -27,7 +28,7 @@ stdenv.mkDerivation (finalAttrs: {
2728
postPatch = ''
2829
patchShebangs findsymbols scripts/
2930
substituteInPlace Makefile \
30-
--replace-fail '/bin/echo' 'echo'
31+
--replace-fail '/bin/echo' 'echo'
3132
'';
3233

3334
dontConfigure = true;
@@ -47,13 +48,14 @@ stdenv.mkDerivation (finalAttrs: {
4748
# upstream project recommends emulator and rom to be synchronized; passing
4849
# through the version is useful to ensure this
4950
inherit (finalAttrs) version;
51+
updateScript = nix-update-script { };
5052
};
5153

5254
meta = {
5355
homepage = "https://github.com/X16Community/x16-rom";
5456
description = "ROM file for CommanderX16 8-bit computer";
5557
license = lib.licenses.bsd2;
56-
maintainers = with lib.maintainers; [ ];
58+
maintainers = with lib.maintainers; [ pluiedev ];
5759
inherit (cc65.meta) platforms;
5860
broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64;
5961
};

pkgs/by-name/x1/x16/run.nix

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
11
{
22
runtimeShell,
33
symlinkJoin,
4-
writeTextFile,
4+
writeShellScriptBin,
55
}:
66

77
{ emulator, rom }:
88

99
assert emulator.version == rom.version;
1010

1111
let
12-
runScript = writeTextFile {
13-
name = "run-x16";
14-
text = ''
15-
#!${runtimeShell}
16-
17-
defaultRom="${rom}/share/x16-rom/rom.bin"
18-
19-
exec "${emulator}/bin/x16emu" -rom $defaultRom "$@"
20-
'';
21-
executable = true;
22-
destination = "/bin/run-x16";
23-
};
12+
runScript = writeShellScriptBin "run-x16" ''
13+
defaultRom="${rom}/share/x16-rom/rom.bin"
14+
exec "${emulator}/bin/x16emu" -rom $defaultRom "$@"
15+
'';
2416
in
2517
symlinkJoin {
2618
pname = "run-x16";

0 commit comments

Comments
 (0)