This commit is contained in:
Jeffrey C. Ollie 2024-08-23 12:03:24 -05:00
commit 9c364b72f7
Signed by: jeff
GPG key ID: 6F86035A6D97044E
5 changed files with 175 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/result*

34
asset-dir.patch Normal file
View file

@ -0,0 +1,34 @@
diff --git a/Makefile b/Makefile
index 5988c93..aaf499e 100644
--- a/Makefile
+++ b/Makefile
@@ -68,7 +68,7 @@ ifdef REGISTRY_WRITEABLE
CFLAGS += "-DREGISTRY_WRITEABLE=1"
endif
-CFLAGS += -DASSET_DIR=\"$(DATADIR)\" -DVERSIONSTRING=\"$(VERSION)\"
+CFLAGS += -DASSET_DIR=\"$(DESTDIR)/$(DATADIR)\" -DVERSIONSTRING=\"$(VERSION)\"
CFLAGS += $(SDL_CFLAGS)
CFLAGS += $(CURL_CFLAGS)
# Do not complain about XPMs
diff --git a/src/asset.cpp b/src/asset.cpp
index 999b9db..8c8cd9f 100644
--- a/src/asset.cpp
+++ b/src/asset.cpp
@@ -135,7 +135,7 @@ int Asset_FindMasterDisk(char *path_out)
// TODO the last ditch paths are bunk -- look for better conventions.
int err = 255;
- const int count = 5;
+ const int count = 6;
char *paths[count];
char path[MAX_PATH+1];
@@ -150,6 +150,7 @@ int Asset_FindMasterDisk(char *path_out)
strcat(paths[2], "/.local/share/linapple");
strcpy(paths[3], "/usr/local/share/linapple");
strcpy(paths[4], "/usr/share/linapple");
+ strcpy(paths[5], ASSET_DIR);
for (auto p: paths) {
sprintf(path, "%s/%s", p, ASSET_MASTER_DSK);

61
flake.lock Normal file
View file

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1724224976,
"narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c374d94f1536013ca8e92341b540eba4c22f9c62",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

32
flake.nix Normal file
View file

@ -0,0 +1,32 @@
{
description = "linapple";
inputs = {
nixpkgs = {
url = "github:nixos/nixpkgs/nixos-unstable";
};
flake-utils = {
url = "github:numtide/flake-utils";
};
};
outputs = {
self,
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem
(
system: let
pkgs = import nixpkgs {
inherit system;
};
in {
packages = {
linapple = pkgs.callPackage ./package.nix {};
default = self.packages.${system}.linapple;
};
}
);
}

47
package.nix Normal file
View file

@ -0,0 +1,47 @@
{
curl,
fetchFromGitHub,
imagemagick7,
lib,
libzip,
pkg-config,
SDL,
SDL_image,
stdenv,
...
}:
stdenv.mkDerivation (final: {
pname = "linapple";
version = "2.3.0";
src = fetchFromGitHub {
owner = "linappleii";
repo = "linapple";
rev = "eb1f22e6093bc95cc93756fb905180d01c28656b";
hash = "sha256-KwUOmjGnfjsQomtn2So/SLoe3XSStD+TbWPsxJaaGcc=";
};
patches = [
./asset-dir.patch
];
nativeBuildInputs = [
imagemagick7
];
buildInputs = [
curl
libzip
pkg-config
SDL
SDL_image
];
makeFlags = [
"DESTDIR=$(out)"
];
# installPhase = ''
# make install DESTDIR=$out
# '';
meta = {
homepage = "https://github.com/linappleii/linapple";
license = lib.licenses.gpl2Plus;
mainProgram = "linapple";
};
})