Compare commits

..

2 commits

5 changed files with 149 additions and 50 deletions

View file

@ -1,10 +1,11 @@
{ {
lib, lib,
stdenv, stdenv,
fetchFromGitHub,
cmake, cmake,
gettext,
curl, curl,
fetchFromGitHub,
gettext,
glib,
libjpeg, libjpeg,
libpng, libpng,
libseccomp, libseccomp,
@ -12,10 +13,25 @@
lzo, lzo,
nettle, nettle,
pkg-config, pkg-config,
tinyxml2, tinyxml-2,
zlib, zlib,
zstd, zstd,
glib
# Not really required afaik, but I like quieting the warnings :)
pcre2,
minizip-ng,
libselinux,
libsepol,
util-linux,
inih,
# Use "Ninja" for the build.
useNinja ? false,
ninja,
# Enable GNOME "Tracker".
useTracker ? false,
tracker
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
@ -25,40 +41,72 @@ stdenv.mkDerivation {
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "GerbilSoft"; owner = "GerbilSoft";
repo = "rom-properties"; repo = "rom-properties";
rev = "1df55be31d5aab88db1ba722267255389a812802"; rev = "10c20ccc3b5550e7950e036a56b0a34714edb263";
hash = "sha256-e2K2XRPLLSXM+lWv5aFiU3PwotuUT0V8INAFc9QKmYY="; hash = "sha256-uoyD2xuPkdoKidyG1Dlckk5ImKnGw/rk8G27IS1cTes=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
nettle.dev
pkg-config pkg-config
# So many "dev" package outputs, lol
nettle.dev
glib.dev glib.dev
]; libselinux.dev
libsepol.dev
buildInputs = [ pcre2.dev
gettext util-linux.dev
curl.dev curl.dev
libjpeg.dev libjpeg.dev
libpng.dev libpng.dev
libseccomp.dev libseccomp.dev
lz4.dev lz4.dev
lzo
tinyxml2
zlib.dev zlib.dev
zstd.dev zstd.dev
]; ]
++ lib.optionals useNinja [ ninja ];
buildInputs = [
gettext
lzo
tinyxml-2
minizip-ng
inih
]
++ lib.optionals useTracker [ tracker ];
cmakeFlags = [ cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Release" (lib.cmakeBool "INSTALL_APPARMOR" false)
"-DINSTALL_APPARMOR=OFF" (lib.cmakeBool "ENABLE_DECRYPTION" true)
(lib.cmakeBool "ENABLE_EXTRA_SECURITY" true)
(lib.cmakeBool "ENABLE_JPEG" true)
(lib.cmakeBool "ENABLE_XML" true)
(lib.cmakeBool "ENABLE_UNICE68" true)
(lib.cmakeBool "ENABLE_LIBMSPACK" true)
(lib.cmakeBool "ENABLE_PVRTC" true)
(lib.cmakeBool "ENABLE_ZSTD" true)
(lib.cmakeBool "ENABLE_LZ4" true)
(lib.cmakeBool "ENABLE_LZO" true)
(lib.cmakeBool "ENABLE_NLS" true)
(lib.cmakeBool "ENABLE_OPENMP" true)
] ++ lib.optionals useTracker [ (lib.cmakeFeature "TRACKER_INSTALL_API_VERSION" "3") ];
patches = [
./patches/fix_debug_paths.diff
./patches/fix_getdents64_build.diff
./patches/fix_rp-stub_symlink.diff
]; ];
/* /*
About "postPatch"... patches. About "patches":
"src/librpsecure/os-secure_linux.c" change is needed to complete the "fix_debug_paths.diff" is needed to properly have some correct debug
build as it's not being detected automatically. (WSL Issue????) paths, due to "cmake"'s weird path issues.
"src/rp-stub/CMakeLists.txt" change is needed to properly symlink (See below references for "fix_rp-stub_symlink.diff".)
"fix_getdents64_build.diff" is needed to properly complete and then run
the build as it's not being detected automatically.
(Maybe it's an issue with WSL?)
"fix_rp-stub_symlink.diff" is needed to properly symlink
`result/libexec/rp-thumbnail` to `result/bin/rp-stub` due to the odd `result/libexec/rp-thumbnail` to `result/bin/rp-stub` due to the odd
double-path bug as described in double-path bug as described in
https://github.com/NixOS/nixpkgs/issues/144170 https://github.com/NixOS/nixpkgs/issues/144170
@ -68,13 +116,6 @@ stdenv.mkDerivation {
https://github.com/NixOS/nixpkgs/pull/247474 https://github.com/NixOS/nixpkgs/pull/247474
# cmake: make check-pc-files hook also check .cmake files # cmake: make check-pc-files hook also check .cmake files
*/ */
postPatch = ''
substituteInPlace "src/librpsecure/os-secure_linux.c" \
--replace-fail "SCMP_SYS(write)," \
"SCMP_SYS(write), SCMP_SYS(getdents64),"
substituteInPlace "src/rp-stub/CMakeLists.txt" \
--replace-fail "{CMAKE_INSTALL_PREFIX}/\$" ""
'';
meta = { meta = {
description = "ROM Properties Page shell extension"; description = "ROM Properties Page shell extension";
@ -86,29 +127,26 @@ stdenv.mkDerivation {
}; };
} }
###################################################################
/* /* NOTES
Notes: *** ROM Properties Page Shell Extension v2.3.0+ ***
Build Summary:
"$STORE_PATH" in these notes reference "nix/store/pnyxqz1vi124i18zdbl8ad1vypai73yg-rom-properties-git" - Target CPU architecture: amd64
"$CMAKE_INSTALL_BINDIR" matches variable in Cmake flags - Building these UI frontends:
"$CMAKE_INSTALL_LIBDIR" matches variable in Cmake flags - Building command-line frontend: Yes
"$CMAKE_INSTALL_LIBEXECDIR" matches variable in Cmake flags - GNOME Tracker API version: (none)
============================================================= - libromdata is built as: shared library (.so)
/$CMAKE_INSTALL_LIBDIR/debug/$STORE_PATH/$CMAKE_INSTALL_LIBEXECDIR/rp-download.debug - Security mechanism: seccomp()
/$CMAKE_INSTALL_LIBDIR/debug/$STORE_PATH/$CMAKE_INSTALL_LIBDIR/libromdata.debug - Decryption functionality: Enabled
/$CMAKE_INSTALL_LIBDIR/debug/$STORE_PATH/$CMAKE_INSTALL_BINDIR/rpcli.debug - XML parsing: Enabled (system)
/$CMAKE_INSTALL_LIBDIR/debug/$STORE_PATH/$CMAKE_INSTALL_BINDIR/rp-thumbnail.debug - PVRTC decoder: Enabled
/$CMAKE_INSTALL_LIBDIR/debug/$STORE_PATH/$CMAKE_INSTALL_BINDIR/rp-config.debug - ZSTD decompression: Enabled (system)
- LZ4 decompression: Enabled (system)
What I think I want the debug paths to end up as: - LZO decompression: Enabled (system)
$CMAKE_INSTALL_LIBDIR/debug/libexec/rp-download.debug Building these third-party libraries from extlib:
$CMAKE_INSTALL_LIBDIR/debug/lib/libromdata.debug - minizip-ng
$CMAKE_INSTALL_LIBDIR/debug/bin/rpcli.debug - inih
$CMAKE_INSTALL_LIBDIR/debug/bin/rp-thumbnail.debug
$CMAKE_INSTALL_LIBDIR/debug/bin/rp-config.debug
... Do I even need to build the debug executables anyway?
*/ */

View file

@ -0,0 +1,34 @@
diff --git a/cmake/macros/DirInstallPaths.cmake b/cmake/macros/DirInstallPaths.cmake
index 7aefd5de6..1b180e3d2 100644
--- a/cmake/macros/DirInstallPaths.cmake
+++ b/cmake/macros/DirInstallPaths.cmake
@@ -65,10 +65,10 @@ IF(UNIX AND NOT APPLE)
SET(DIR_INSTALL_XDG_MIME "share/mime")
SET(DIR_INSTALL_XDG_DESKTOP "share/applications")
SET(DIR_INSTALL_XDG_APPSTREAM "share/metainfo")
- SET(DIR_INSTALL_EXE_DEBUG "lib/debug/${CMAKE_INSTALL_PREFIX}/${DIR_INSTALL_EXE}")
- SET(DIR_INSTALL_DLL_DEBUG "lib/debug/${CMAKE_INSTALL_PREFIX}/${DIR_INSTALL_DLL}")
- SET(DIR_INSTALL_LIB_DEBUG "lib/debug/${CMAKE_INSTALL_PREFIX}/${DIR_INSTALL_LIB}")
- SET(DIR_INSTALL_LIBEXEC_DEBUG "lib/debug/${CMAKE_INSTALL_PREFIX}/${DIR_INSTALL_LIBEXEC}")
+ SET(DIR_INSTALL_EXE_DEBUG "lib/debug/bin")
+ SET(DIR_INSTALL_DLL_DEBUG "lib/debug/lib")
+ SET(DIR_INSTALL_LIB_DEBUG "lib/debug/lib")
+ SET(DIR_INSTALL_LIBEXEC_DEBUG "lib/debug/libexec")
# AppArmor profile directory
SET(DIR_INSTALL_APPARMOR "/etc/apparmor.d")
@@ -88,10 +88,10 @@ ELSEIF(APPLE)
UNSET(DIR_INSTALL_XDG_MIME)
UNSET(DIR_INSTALL_XDG_DESKTOP)
UNSET(DIR_INSTALL_XDG_APPSTREAM)
- SET(DIR_INSTALL_EXE_DEBUG "lib/debug/${CMAKE_INSTALL_PREFIX}/${DIR_INSTALL_EXE}")
- SET(DIR_INSTALL_DLL_DEBUG "lib/debug/${CMAKE_INSTALL_PREFIX}/${DIR_INSTALL_DLL}")
- SET(DIR_INSTALL_LIB_DEBUG "lib/debug/${CMAKE_INSTALL_PREFIX}/${DIR_INSTALL_LIB}")
- SET(DIR_INSTALL_LIBEXEC_DEBUG "lib/debug/${CMAKE_INSTALL_PREFIX}/${DIR_INSTALL_LIBEXEC}")
+ SET(DIR_INSTALL_EXE_DEBUG "lib/debug/bin")
+ SET(DIR_INSTALL_DLL_DEBUG "lib/debug/lib")
+ SET(DIR_INSTALL_LIB_DEBUG "lib/debug/lib")
+ SET(DIR_INSTALL_LIBEXEC_DEBUG "lib/debug/libexec")
ELSEIF(WIN32)
# Win32-style install paths.
# Files are installed relative to root, since the

View file

@ -0,0 +1,12 @@
diff --git a/src/librpsecure/os-secure_linux.c b/src/librpsecure/os-secure_linux.c
index bd245ff40..0a4c7159f 100644
--- a/src/librpsecure/os-secure_linux.c
+++ b/src/librpsecure/os-secure_linux.c
@@ -71,6 +71,7 @@ int rp_secure_enable(rp_secure_param_t param)
SCMP_SYS(read),
SCMP_SYS(rt_sigreturn),
SCMP_SYS(write),
+ SCMP_SYS(getdents64),
SCMP_SYS(access),
SCMP_SYS(faccessat), // Linux on aarch64 does not have an access() syscall

View file

@ -0,0 +1,13 @@
diff --git a/src/rp-stub/CMakeLists.txt b/src/rp-stub/CMakeLists.txt
index acad9bdcd..d611b38cf 100644
--- a/src/rp-stub/CMakeLists.txt
+++ b/src/rp-stub/CMakeLists.txt
@@ -39,7 +39,7 @@ INCLUDE(DirInstallPaths)
# Create symlinks for rp-thumbnail and rp-config.
# Reference: https://stackoverflow.com/questions/34578362/how-can-i-package-a-symlink-with-cpack
ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD
- COMMAND ln -sf "${CMAKE_INSTALL_PREFIX}/${DIR_INSTALL_EXE}/${PROJECT_NAME}" rp-thumbnail
+ COMMAND ln -sf "${DIR_INSTALL_EXE}/${PROJECT_NAME}" rp-thumbnail
WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
VERBATIM
)

View file

@ -15,6 +15,9 @@ let
ps3dec = pkgs.callPackage ./packages/ps3dec/package.nix {}; ps3dec = pkgs.callPackage ./packages/ps3dec/package.nix {};
sabretools = pkgs.callPackage ./packages/sabretools/package.nix {}; sabretools = pkgs.callPackage ./packages/sabretools/package.nix {};
rom-properties = pkgs.callPackage ./packages/rom-properties/package.nix {}; rom-properties = pkgs.callPackage ./packages/rom-properties/package.nix {};
# rom-properties_ninja = pkgs.callPackage ./package.nix { useNinja = true; };
# rom-properties_gtracker = pkgs.callPackage ./package.nix { useTracker = true; };
# rom-properties_ninja_gtracker = pkgs.callPackage ./package.nix { useNinja = true; useTracker = true; };
new_rclone = pkgs.rclone.overrideAttrs (oldAttrs: rec { new_rclone = pkgs.rclone.overrideAttrs (oldAttrs: rec {
patches = [ ./packages/new_rclone/patches/rclone_8ffe3e462cbf5688c37c54009db09d8dcb486860.diff ]; patches = [ ./packages/new_rclone/patches/rclone_8ffe3e462cbf5688c37c54009db09d8dcb486860.diff ];
} }
@ -147,7 +150,6 @@ in
# Not needed on WSL, even though I'd like it on WSL sometimes. # Not needed on WSL, even though I'd like it on WSL sometimes.
pkgs.yt-dlp pkgs.yt-dlp
# Not needed on WSL # Not needed on WSL
my_packages.hactoolnet-bin my_packages.hactoolnet-bin
# Not needed on WSL as I currently use the Windows version. # Not needed on WSL as I currently use the Windows version.
*/ */