-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Nix setup for Makefile build * Modify nix files for ninja/dtk build * Allow specifying prebuilt dtk binary * Fix compiler zip url * Rename nix/ to .nix/ * Add Nix CI workflow Co-authored-by: Robin Avery <[email protected]>
- Loading branch information
Showing
15 changed files
with
489 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[*.nix] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ lib | ||
, fetchFromGitHub | ||
, git | ||
, rustPlatform | ||
, stdenv | ||
}: | ||
|
||
rustPlatform.buildRustPackage rec { | ||
pname = "decomp-toolkit"; | ||
version = "0.7.3"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "encounter"; | ||
repo = "decomp-toolkit"; | ||
rev = "v${version}"; | ||
hash = "sha256-cpHaoxRr/Lyx6tpyUx7Sm+9h0BicrO+jVJA09BBgKJ4="; | ||
}; | ||
|
||
nativeBuildInputs = [ | ||
git | ||
]; | ||
|
||
cargoLock.lockFile = "${src}/Cargo.lock"; | ||
cargoLock.outputHashes."ar-0.8.0" = "sha256-OLyo+cRRWMsI1i8NsgsBKRJH1XsKW1CculQnJ/wcya0="; | ||
cargoLock.outputHashes."dol-0.1.0" = "sha256-YfMXWNtmZJhK39R3w98DEGm4y9x59osFGliG36BcuLU="; | ||
|
||
meta = with lib; { | ||
description = "A GameCube & Wii decompilation toolkit"; | ||
homepage = "https://github.com/encounter/decomp-toolkit"; | ||
license = with licenses; [ asl20 mit ]; | ||
maintainers = with maintainers; [ r-burns ]; | ||
mainProgram = "dtk"; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
sources ? import ./sources.nix, | ||
}: | ||
let | ||
pkgs = import sources.nixpkgs { | ||
overlays = [ | ||
(self: super: { | ||
decomp-toolkit = super.callPackage ./decomp-toolkit.nix {}; | ||
devkitppc = super.callPackage ./devkitppc.nix {}; | ||
mwcc = super.callPackage ./mwcc.nix {}; | ||
wibo = super.pkgsi686Linux.callPackage ./wibo.nix {}; | ||
}) | ||
]; | ||
}; | ||
in | ||
|
||
pkgs.callPackage ./melee.nix {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ stdenvNoCC, lib | ||
, buildEnv | ||
, fetchFromGitHub | ||
, fetchpatch | ||
, makeWrapper | ||
, overrideCC | ||
, pkgsCross | ||
}: | ||
|
||
let | ||
version = "43"; | ||
|
||
tag = "devkitPPC_r${version}"; | ||
|
||
ppcCrossBinutils = pkgsCross.ppc-embedded.buildPackages.binutils-unwrapped; | ||
|
||
bintools' = ppcCrossBinutils.overrideAttrs (oa: { | ||
patches = oa.patches ++ [ | ||
(fetchpatch { | ||
url = "https://raw.githubusercontent.com/devkitPro/buildscripts/${tag}/dkppc/patches/binutils-${oa.version}.patch"; | ||
hash = "sha256-IOqa20LQYBxfR1KKxkp0hVV21CKd9IZrvNeEyuW09us="; | ||
}) | ||
]; | ||
}); | ||
in | ||
stdenvNoCC.mkDerivation { | ||
pname = "devkitppc"; | ||
inherit version; | ||
nativeBuildInputs = [ | ||
makeWrapper | ||
]; | ||
buildCommand = '' | ||
for bindir in '${lib.getBin bintools'}/bin'; do | ||
cd "$bindir" | ||
for f in powerpc-none-eabi-*; do | ||
short="$(echo "$f" | sed s/powerpc-none-eabi-/powerpc-eabi-/)" | ||
makeWrapper "$bindir/$f" "$out/bin/$short" | ||
done | ||
done | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ lib | ||
, stdenv | ||
, decomp-toolkit | ||
, devkitppc | ||
, fetchurl | ||
, mwcc | ||
, ninja | ||
, python3 | ||
, wibo | ||
}: | ||
let | ||
sjiswrap = fetchurl { | ||
url = "https://github.com/encounter/sjiswrap/releases/download/v1.1.1/sjiswrap-windows-x86.exe"; | ||
hash = "sha256-J6PF1PJj5OuW5WGc/Noi9F0zzNEhEEx/9qN+FbP0J80="; | ||
}; | ||
in | ||
stdenv.mkDerivation { | ||
name = "doldecomp-melee"; | ||
|
||
src = lib.cleanSourceWith { | ||
filter = name: type: let | ||
basename = baseNameOf (toString name); | ||
in !(false | ||
|| basename == "build" | ||
|| basename == "expected" | ||
|| lib.hasSuffix ".nix" basename | ||
|| lib.hasSuffix ".dump" basename | ||
|| lib.hasSuffix ".o" basename | ||
); | ||
src = lib.cleanSource ../.; | ||
}; | ||
|
||
shellHook = '' | ||
runHook postPatch | ||
''; | ||
|
||
nativeBuildInputs = [ | ||
decomp-toolkit | ||
devkitppc | ||
ninja | ||
python3 | ||
wibo | ||
]; | ||
|
||
configurePhase = '' | ||
runHook preConfigure | ||
python3 ./configure.py --wrapper ${wibo}/bin/wibo \ | ||
--build-dtk ${decomp-toolkit}/bin/dtk \ | ||
--sjiswrap ${sjiswrap} \ | ||
--compilers ${mwcc} | ||
runHook postConfigure | ||
''; | ||
|
||
enableParallelBuilding = true; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out | ||
cp build/GALE01/main.dol $out/ | ||
runHook postInstall | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ lib | ||
, stdenv | ||
, fetchzip | ||
}: | ||
stdenv.mkDerivation { | ||
name = "GC_WII_COMPILERS"; | ||
src = fetchzip { | ||
url = "https://files.decomp.dev/compilers_20230715.zip"; | ||
stripRoot = false; | ||
sha256 = "sha256-IX3byvEUVJB6Rmc+NqO9ZNt1jl95nQpEIqxbHI+uUio="; | ||
}; | ||
# Patch 1.1 linker to not read garbage from stack. | ||
# Fixes random crashes under wibo. | ||
postPatch = '' | ||
printf '\x51' | dd of=GC/1.1/mwldeppc.exe bs=1 seek=130933 count=1 conv=notrunc | ||
''; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
cp -r . $out/ | ||
runHook postInstall | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
sources ? import ./sources.nix, | ||
}: | ||
let | ||
pkgs = import sources.nixpkgs { | ||
overlays = [ | ||
(self: super: { | ||
decomp-toolkit = super.callPackage ./decomp-toolkit.nix {}; | ||
devkitppc = super.callPackage ./devkitppc.nix {}; | ||
mwcc = super.callPackage ./mwcc.nix {}; | ||
wibo = super.pkgsi686Linux.callPackage ./wibo.nix {}; | ||
}) | ||
]; | ||
}; | ||
|
||
melee = import ./default.nix { inherit sources; }; | ||
in | ||
|
||
melee.overrideAttrs (oa: { | ||
nativeBuildInputs = oa.nativeBuildInputs ++ [ | ||
(pkgs.clang-tools.override { | ||
llvmPackages = pkgs.llvmPackages_15; | ||
}) | ||
pkgs.clang.cc.python | ||
]; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"nixpkgs": { | ||
"branch": "nixos-unstable", | ||
"description": "Nix Packages collection", | ||
"homepage": "", | ||
"owner": "NixOS", | ||
"repo": "nixpkgs", | ||
"rev": "73de017ef2d18a04ac4bfd0c02650007ccb31c2a", | ||
"sha256": "1v9sy2i2dy3qksx4mf81gwzfl0jzpqccfkzq7fjxgq832f9d255i", | ||
"type": "tarball", | ||
"url": "https://github.com/NixOS/nixpkgs/archive/73de017ef2d18a04ac4bfd0c02650007ccb31c2a.tar.gz", | ||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" | ||
} | ||
} |
Oops, something went wrong.