push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
{
lib,
stdenv,
fetchFromGitHub,
autoreconfHook,
boost,
libusb1,
pkg-config,
}:
stdenv.mkDerivation {
pname = "cc-tool";
version = "unstable-2020-05-19";
src = fetchFromGitHub {
owner = "dashesy";
repo = "cc-tool";
rev = "19e707eafaaddee8b996ad27a9f3e1aafcb900d2";
hash = "sha256:1f78j498fdd36xbci57jkgh25gq14g3b6xmp76imdpar0jkpyljv";
};
nativeBuildInputs = [
autoreconfHook
pkg-config
];
buildInputs = [
boost
libusb1
];
postPatch = ''
substituteInPlace udev/90-cc-debugger.rules \
--replace 'MODE="0666"' 'MODE="0660", GROUP="plugdev", TAG+="uaccess"'
'';
doInstallCheck = true;
postInstall = ''
install -D udev/90-cc-debugger.rules $out/lib/udev/rules.d/90-cc-debugger.rules
'';
meta = with lib; {
description = "Command line tool for the Texas Instruments CC Debugger";
mainProgram = "cc-tool";
longDescription = ''
cc-tool provides support for Texas Instruments CC Debugger
'';
homepage = "https://github.com/dashesy/cc-tool";
license = licenses.gpl2;
platforms = with platforms; linux ++ darwin;
maintainers = [ maintainers.CRTified ];
};
}

View File

@@ -0,0 +1,44 @@
{
lib,
stdenv,
fetchFromBitbucket,
asciidoc,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "cc1541";
version = "4.2";
src = fetchFromBitbucket {
owner = "ptv_claus";
repo = "cc1541";
rev = finalAttrs.version;
hash = "sha256-+9ri3fUmxLHXxq9vNMjeNXfHula3PZpjewHO6z7pIhc=";
};
# Manual generation broke in 4.2
env.ENABLE_MAN = false;
makeFlags = [ "prefix=$(out)" ];
nativeBuildInputs = [ asciidoc ];
doInstallCheck = true;
checkPhase = ''
runHook preCheck
make test
runHook postCheck
'';
meta = with lib; {
description = "Tool for creating Commodore 1541 Floppy disk images in D64, D71 or D81 format";
homepage = "https://bitbucket.org/ptv_claus/cc1541/src/master/";
license = licenses.mit;
maintainers = with maintainers; [ matthewcroughan ];
mainProgram = "cc1541";
platforms = platforms.all;
};
})

View File

@@ -0,0 +1,22 @@
diff --git a/cc2538_bsl/cc2538_bsl.py b/cc2538_bsl/cc2538_bsl.py
index b62ea64..f38d872 100755
--- a/cc2538_bsl/cc2538_bsl.py
+++ b/cc2538_bsl/cc2538_bsl.py
@@ -1050,16 +1050,7 @@ def parse_page_address_range(device, pg_range):
def version():
- # Get the version using "git describe".
- try:
- p = Popen(['git', 'describe', '--tags', '--match', '[0-9]*'],
- stdout=PIPE, stderr=PIPE)
- p.stderr.close()
- line = p.stdout.readlines()[0]
- return line.decode('utf-8').strip()
- except:
- # We're not in a git repo, or git failed, use fixed version string.
- return __version__
+ return __version__
def cli_setup():

View File

@@ -0,0 +1,72 @@
{
lib,
fetchFromGitHub,
python3Packages,
}:
let
pypkgs = python3Packages;
version = "2.1-unstable-2025-03-28";
src = fetchFromGitHub {
owner = "JelmerT";
repo = "cc2538-bsl";
rev = "250e8616e6cb00f1b23cb251154de984ce506f7b";
hash = "sha256-SNWHCSbaeO4s4W29Jly9bAEhFjfej9J9qn+mxxpoe30=";
};
version' = "${lib.versions.majorMinor version}.dev0+g${lib.substring 0 7 src.rev}";
in
pypkgs.buildPythonApplication rec {
pname = "cc2538-bsl";
inherit version src;
pyproject = true;
# if you happen to run cc2538-bsl from a git repository of any kind, you will get the
# version of *that* rather than the application itself because it will run 'git describe'
patches = [ ./do_not_run_git.patch ];
postPatch = ''
substituteInPlace cc2538_bsl/cc2538_bsl.py \
--replace-fail '__version__ = "2.1"' '__version__ = "${version'}"'
'';
env.SETUPTOOLS_SCM_PRETEND_VERSION = version';
build-system = with pypkgs; [
setuptools-scm
];
dependencies = with pypkgs; [
intelhex
pyserial
python-magic
];
nativeCheckInputs = with pypkgs; [
pytestCheckHook
scripttest
];
# we need to patch these tests to make them work inside our sandbox, so just disable them for
# now as we run this in `postInstallCheck`
disabledTests = [
"test_help_output"
"test_version"
];
# this is just to ensure that `meta.mainProgram` exists and is executable since we disable `test_help_output`
postInstallCheck = ''
$out/bin/${meta.mainProgram} --help
'';
meta = {
homepage = "https://github.com/JelmerT/cc2538-bsl";
description = "Flash TI SimpleLink chips (CC2538, CC13xx, CC26xx) over serial";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ lorenz ];
mainProgram = "cc2538-bsl";
};
}

View File

@@ -0,0 +1,62 @@
{
lib,
gccStdenv,
fetchFromGitHub,
}:
gccStdenv.mkDerivation rec {
pname = "cc65";
version = "2.19";
src = fetchFromGitHub {
owner = "cc65";
repo = "cc65";
rev = "V${version}";
sha256 = "01a15yvs455qp20hri2pbg2wqvcip0d50kb7dibi9427hqk9cnj4";
};
makeFlags = [ "PREFIX=${placeholder "out"}" ];
enableParallelBuilding = true;
meta = with lib; {
homepage = "https://cc65.github.io/";
description = "C compiler for processors of 6502 family";
longDescription = ''
cc65 is a complete cross development package for 65(C)02 systems,
including a powerful macro assembler, a C compiler, linker, librarian and
several other tools.
cc65 has C and runtime library support for many of the old 6502 machines,
including the following Commodore machines:
- VIC20
- C16/C116 and Plus/4
- C64
- C128
- CBM 510 (aka P500)
- the 600/700 family
- newer PET machines (not 2001).
- the Apple ][+ and successors.
- the Atari 8-bit machines.
- the Atari 2600 console.
- the Atari 5200 console.
- GEOS for the C64, C128 and Apple //e.
- the Bit Corporation Gamate console.
- the NEC PC-Engine (aka TurboGrafx-16) console.
- the Nintendo Entertainment System (NES) console.
- the Watara Supervision console.
- the VTech Creativision console.
- the Oric Atmos.
- the Oric Telestrat.
- the Lynx console.
- the Ohio Scientific Challenger 1P.
The libraries are fairly portable, so creating a version for other 6502s
shouldn't be too much work.
'';
license = licenses.zlib;
maintainers = [ ];
platforms = platforms.unix;
};
}

View File

@@ -0,0 +1,29 @@
diff --git a/test/run b/test/run
index 43a57312..398be8d8 100755
--- a/test/run
+++ b/test/run
@@ -148,21 +148,17 @@ file_size() {
objdump_cmd() {
local file="$1"
- if $HOST_OS_APPLE; then
- xcrun dwarfdump -r 0 "$file"
- elif $HOST_OS_WINDOWS || $HOST_OS_CYGWIN; then
+ if $HOST_OS_WINDOWS || $HOST_OS_CYGWIN; then
# For some reason objdump only shows the basename of the file, so fall
# back to brute force and ignorance.
strings "$1"
else
- objdump -W "$file"
+ @objdump@ -W "$file"
fi
}
objdump_grep_cmd() {
- if $HOST_OS_APPLE; then
- grep -Fq "\"$1\""
- elif $HOST_OS_WINDOWS || $HOST_OS_CYGWIN; then
+ if $HOST_OS_WINDOWS || $HOST_OS_CYGWIN; then
grep -Fq "$1"
else
grep -Fq ": $1"

View File

@@ -0,0 +1,185 @@
{
lib,
stdenv,
fetchFromGitHub,
replaceVars,
binutils,
asciidoctor,
cmake,
perl,
fmt,
hiredis,
xxHash,
zstd,
bashInteractive,
doctest,
xcodebuild,
makeWrapper,
ctestCheckHook,
writableTmpDirAsHomeHook,
nix-update-script,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "ccache";
version = "4.11.3";
src = fetchFromGitHub {
owner = "ccache";
repo = "ccache";
tag = "v${finalAttrs.version}";
# `git archive` replaces `$Format:%H %D$` in cmake/CcacheVersion.cmake
# we need to replace it with something reproducible
# see https://github.com/NixOS/nixpkgs/pull/316524
postFetch = ''
sed -i -E \
's/version_info "([0-9a-f]{40}) .*(tag: v[^,]+).*"/version_info "\1 \2"/g w match' \
$out/cmake/CcacheVersion.cmake
if [ -s match ]; then
rm match
else # pattern didn't match
exit 1
fi
'';
hash = "sha256-w41e73Zh5HhYhgLPtaaSiJ48BklBNtnK9S859tol5wc=";
};
outputs = [
"out"
"man"
];
patches = [
# When building for Darwin, test/run uses dwarfdump, whereas on
# Linux it uses objdump. We don't have dwarfdump packaged for
# Darwin, so this patch updates the test to also use objdump on
# Darwin.
# Additionally, when cross compiling, the correct target prefix
# needs to be set.
(replaceVars ./fix-objdump-path.patch {
objdump = "${binutils.bintools}/bin/${binutils.targetPrefix}objdump";
})
];
strictDeps = true;
nativeBuildInputs = [
asciidoctor
cmake
perl
];
buildInputs = [
fmt
hiredis
xxHash
zstd
];
cmakeFlags = lib.optional (!finalAttrs.finalPackage.doCheck) "-DENABLE_TESTING=OFF";
doCheck = true;
nativeCheckInputs = [
# test/run requires the compgen function which is available in
# bashInteractive, but not bash.
bashInteractive
ctestCheckHook
writableTmpDirAsHomeHook
]
++ lib.optional stdenv.hostPlatform.isDarwin xcodebuild;
checkInputs = [
doctest
];
disabledTests = [
"test.trim_dir" # flaky on hydra (possibly filesystem-specific?)
"test.fileclone" # flaky on hydra, also seems to fail on zfs
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
"test.basedir"
"test.multi_arch"
"test.nocpp2"
];
passthru = {
# A derivation that provides gcc and g++ commands, but that
# will end up calling ccache for the given cacheDir
links =
{ unwrappedCC, extraConfig }:
stdenv.mkDerivation {
pname = "ccache-links";
inherit (finalAttrs) version;
passthru = {
isClang = unwrappedCC.isClang or false;
isGNU = unwrappedCC.isGNU or false;
isCcache = true;
};
lib = lib.getLib unwrappedCC;
nativeBuildInputs = [ makeWrapper ];
# Unwrapped clang does not have a targetPrefix because it is multi-target
# target is decided with argv0.
buildCommand =
let
targetPrefix =
if unwrappedCC.isClang or false then
""
else
(lib.optionalString (
unwrappedCC ? targetConfig && unwrappedCC.targetConfig != null && unwrappedCC.targetConfig != ""
) "${unwrappedCC.targetConfig}-");
in
''
mkdir -p $out/bin
wrap() {
local cname="${targetPrefix}$1"
if [ -x "${unwrappedCC}/bin/$cname" ]; then
makeWrapper ${finalAttrs.finalPackage}/bin/ccache $out/bin/$cname \
--run ${lib.escapeShellArg extraConfig} \
--add-flags ${unwrappedCC}/bin/$cname
fi
}
wrap cc
wrap c++
wrap gcc
wrap g++
wrap clang
wrap clang++
for executable in $(ls ${unwrappedCC}/bin); do
if [ ! -x "$out/bin/$executable" ]; then
ln -s ${unwrappedCC}/bin/$executable $out/bin/$executable
fi
done
for file in $(ls ${unwrappedCC} | grep -vw bin); do
ln -s ${unwrappedCC}/$file $out/$file
done
'';
meta = {
inherit (unwrappedCC.meta) mainProgram;
};
};
updateScript = nix-update-script { };
};
meta = with lib; {
description = "Compiler cache for fast recompilation of C/C++ code";
homepage = "https://ccache.dev";
downloadPage = "https://ccache.dev/download.html";
changelog = "https://ccache.dev/releasenotes.html#_ccache_${
builtins.replaceStrings [ "." ] [ "_" ] finalAttrs.version
}";
license = licenses.gpl3Plus;
maintainers = with maintainers; [
kira-bruneau
r-burns
];
platforms = platforms.unix;
mainProgram = "ccache";
};
})

View File

@@ -0,0 +1,42 @@
{
stdenv,
lib,
fetchurl,
makeWrapper,
ghostscript_headless, # for ps2pdf binary
}:
stdenv.mkDerivation rec {
pname = "ccal";
version = "2.5.3";
src = fetchurl {
url = "https://ccal.chinesebay.com/ccal-${version}.tar.gz";
sha256 = "sha256-PUy9yfkFzgKrSEBB+79/C3oxmuajUMbBbWNuGlpQ35Y=";
};
nativeBuildInputs = [ makeWrapper ];
makeFlags = [
"CXX:=$(CXX)"
"BINDIR=$(out)/bin"
"MANDIR=$(out)/share/man"
];
installTargets = [
"install"
"install-man"
];
# ccalpdf depends on a `ps2pdf` binary in PATH
postFixup = ''
wrapProgram $out/bin/ccalpdf \
--prefix PATH : ${lib.makeBinPath [ ghostscript_headless ]}:$out/bin
'';
meta = {
homepage = "https://ccal.chinesebay.com/ccal.htm";
description = "Command line Chinese calendar viewer, similar to cal";
license = lib.licenses.gpl3;
maintainers = with lib.maintainers; [ sharzy ];
platforms = lib.platforms.all;
};
}

View File

@@ -0,0 +1,24 @@
diff --git a/cccc/cccc_tbl.cc b/cccc/cccc_tbl.cc
index df98e2b..59f2572 100644
--- a/cccc/cccc_tbl.cc
+++ b/cccc/cccc_tbl.cc
@@ -96,7 +96,7 @@ bool CCCC_Table<T>::remove(T* old_item_ptr)
typename map_t::iterator value_iterator=map_t::find(old_item_ptr->key());
if(value_iterator!=map_t::end())
{
- erase(value_iterator);
+ map_t::erase(value_iterator);
retval=true;
}
return retval;
diff --git a/makefile b/makefile
index 23ad004..2cca469 100644
--- a/makefile
+++ b/makefile
@@ -20,5 +20,5 @@ test :
cd test ; make -f posix.mak
install :
- cd install ; su root -c "make -f install.mak"
+ cd install ; make -f install.mak

View File

@@ -0,0 +1,42 @@
{
lib,
stdenv,
fetchurl,
}:
stdenv.mkDerivation rec {
pname = "cccc";
version = "3.1.4";
src = fetchurl {
url = "mirror://sourceforge/cccc/${version}/cccc-${version}.tar.gz";
sha256 = "1gsdzzisrk95kajs3gfxks3bjvfd9g680fin6a9pjrism2lyrcr7";
};
hardeningDisable = [ "format" ];
patches = [ ./cccc.patch ];
preConfigure = ''
substituteInPlace install/install.mak --replace /usr/local/bin $out/bin
substituteInPlace install/install.mak --replace MKDIR=mkdir "MKDIR=mkdir -p"
'';
buildFlags = [
"CCC=c++"
"LD=c++"
];
meta = {
description = "C and C++ Code Counter";
mainProgram = "cccc";
longDescription = ''
CCCC is a tool which analyzes C++ and Java files and generates a report
on various metrics of the code. Metrics supported include lines of code, McCabe's
complexity and metrics proposed by Chidamber&Kemerer and Henry&Kafura.
'';
homepage = "https://cccc.sourceforge.net/";
license = lib.licenses.gpl2;
platforms = lib.platforms.unix;
maintainers = [ lib.maintainers.linquize ];
};
}

View File

@@ -0,0 +1,9 @@
--- a/src/ccd2iso.c 2024-06-16 09:01:37
+++ b/src/ccd2iso.c 2024-06-16 09:01:49
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "clonecd.h"

View File

@@ -0,0 +1,28 @@
{
lib,
stdenv,
fetchurl,
}:
stdenv.mkDerivation rec {
pname = "ccd2iso";
version = "0.3";
src = fetchurl {
url = "mirror://sourceforge/ccd2iso/ccd2iso-${version}.tar.gz";
sha256 = "1z000zi7hpr2h9cabj6hzf3n6a6gd6glmm8nn36v4b8i4vzbhx7q";
};
patches = [
./include.patch
];
meta = with lib; {
description = "CloneCD to ISO converter";
homepage = "https://sourceforge.net/projects/ccd2iso/";
license = licenses.gpl2Plus;
maintainers = [ ];
platforms = platforms.unix;
mainProgram = "ccd2iso";
};
}

View File

@@ -0,0 +1,79 @@
{
lib,
stdenv,
fetchurl,
makeDesktopItem,
makeWrapper,
jre,
useCCTweaked ? true,
}:
let
version = "unstable-2023-07-08";
rev = "989cfe52a0458b991e0a7d87edec81d3fef472ac";
baseUrl = "https://emux.cc/versions/${lib.substring 0 8 rev}/CCEmuX";
jar =
if useCCTweaked then
fetchurl {
url = "${baseUrl}-cct.jar";
hash = "sha256-nna5KRp6jVLkbWKOHGtQqaPr3Zl05mVkCf/8X9C5lRY=";
}
else
fetchurl {
url = "${baseUrl}-cc.jar";
hash = "sha256-2Z38O6z7OrHKe8GdLnexin749uJzQaCZglS+SwVD5YE=";
};
desktopIcon = fetchurl {
url = "https://github.com/CCEmuX/CCEmuX/raw/${rev}/src/main/resources/img/icon.png";
hash = "sha256-gqWURXaOFD/4aZnjmgtKb0T33NbrOdyRTMmLmV42q+4=";
};
desktopItem = makeDesktopItem {
name = "CCEmuX";
exec = "ccemux";
icon = desktopIcon;
comment = "A modular ComputerCraft emulator";
desktopName = "CCEmuX";
genericName = "ComputerCraft Emulator";
categories = [ "Emulator" ];
};
in
stdenv.mkDerivation rec {
pname = "ccemux";
inherit version;
src = jar;
dontUnpack = true;
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ jre ];
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,share/ccemux}
cp -r ${desktopItem}/share/applications $out/share/applications
install -D ${src} $out/share/ccemux/ccemux.jar
install -D ${desktopIcon} $out/share/pixmaps/ccemux.png
makeWrapper ${jre}/bin/java $out/bin/ccemux \
--add-flags "-jar $out/share/ccemux/ccemux.jar"
runHook postInstall
'';
meta = with lib; {
description = "Modular ComputerCraft emulator";
homepage = "https://github.com/CCEmuX/CCEmuX";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.mit;
maintainers = with maintainers; [
CrazedProgrammer
viluon
];
mainProgram = "ccemux";
};
}

View File

@@ -0,0 +1,154 @@
{
lib,
stdenv,
fetchFromGitHub,
writeTextFile,
pkg-config,
cmake,
ninja,
cargo,
rustc,
corrosion,
rustPlatform,
gpac,
protobufc,
libpng,
zlib,
utf8proc,
freetype,
ffmpeg,
libarchive,
curl,
libiconv,
enableOcr ? true,
leptonica,
tesseract,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "ccextractor";
version = "0.94-unstable-2025-05-20";
src = fetchFromGitHub {
owner = "CCExtractor";
repo = "ccextractor";
rev = "407d0f4e93611c5b0ceb14b7fc01d4a4c2e90433";
hash = "sha256-BfsQmCNB4HRafqJ3pC2ECiwhOgwKuIqiLjr2/bvHr7Q=";
};
patches = [
./remove-default-commit-hash.patch
./remove-vendored-libraries.patch
]
++ finalAttrs.cargoDeps.vendorStaging.patches;
cmakeDir = "../src";
cargoRoot = "src/rust";
cargoDeps = rustPlatform.fetchCargoVendor {
inherit (finalAttrs) src cargoRoot;
patches = [ ./use-rsmpeg-0.15.patch ];
hash = "sha256-68Y8nzPHxhVIRHoPXOy9tc71177lCBuOf//z3cqyDGQ=";
};
nativeBuildInputs = [
pkg-config
cmake
ninja
cargo
rustc
corrosion
rustPlatform.cargoSetupHook
rustPlatform.bindgenHook
];
buildInputs = [
gpac
protobufc
libpng
zlib
utf8proc
freetype
ffmpeg
libarchive
curl
libiconv
]
++ lib.optionals enableOcr [
leptonica
tesseract
];
cmakeFlags = [
# The tests are all part of one `cargo test` invocation, so lets
# get the output from it.
(lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" "--verbose")
# TODO: This (and the corresponding patch) should probably be
# removed for the next stable release.
(lib.cmakeFeature "GIT_COMMIT_HASH" finalAttrs.src.rev)
]
++ lib.optionals enableOcr [
(lib.cmakeBool "WITH_OCR" true)
(lib.cmakeBool "WITH_HARDSUBX" true)
];
env = {
FFMPEG_INCLUDE_DIR = "${lib.getDev ffmpeg}/include";
# Upstreams FFmpeg binding crate needs an explicit path to a shared
# object to do dynamic linking. The key word is *an* explicit path;
# they dont support passing more than one. This linker script hack
# pulls in all the FFmpeg libraries they bind to.
#
# See: <https://github.com/CCExtractor/rusty_ffmpeg/pull/69>
FFMPEG_DLL_PATH =
let
ffmpegLibNames = [
"avcodec"
"avdevice"
"avfilter"
"avformat"
"avutil"
"swresample"
"swscale"
];
ffmpegLibDir = "${lib.getLib ffmpeg}/lib";
ffmpegLibExt = stdenv.hostPlatform.extensions.library;
ffmpegLibPath = ffmpegLibName: "${ffmpegLibDir}/lib${ffmpegLibName}.${ffmpegLibExt}";
ffmpegLinkerScript = writeTextFile {
name = "ccextractor-ffmpeg-linker-script";
destination = "/lib/ffmpeg.ld";
text = "INPUT(${lib.concatMapStringsSep " " ffmpegLibPath ffmpegLibNames})";
};
in
"${ffmpegLinkerScript}/lib/ffmpeg.ld";
};
doCheck = true;
postPatch = lib.optionalString enableOcr ''
substituteInPlace src/lib_ccx/ocr.c \
--replace-fail 'getenv("TESSDATA_PREFIX")' '"${tesseract}/share"'
'';
meta = {
homepage = "https://www.ccextractor.org/";
changelog = "${finalAttrs.src.meta.homepage}/blob/${finalAttrs.src.rev}/docs/CHANGES.TXT";
description = "Tool that produces subtitles from closed caption data in videos";
longDescription = ''
A tool that analyzes video files and produces independent subtitle files from
closed captions data. CCExtractor is portable, small, and very fast.
It works on Linux, Windows, and OSX.
'';
platforms = lib.platforms.unix;
sourceProvenance = [ lib.sourceTypes.fromSource ];
license = lib.licenses.gpl2Only;
maintainers = [ lib.maintainers.emily ];
mainProgram = "ccextractor";
};
})

View File

@@ -0,0 +1,14 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d7fdda02e3...2738cab631 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -24,9 +24,6 @@
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
-ELSE(EXISTS "${BASE_PROJ_DIR}/.git")
- set(GIT_BRANCH "Unknown")
- set(GIT_COMMIT_HASH "Unknown")
ENDIF(EXISTS "${BASE_PROJ_DIR}/.git")
#Get the date

View File

@@ -0,0 +1,187 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2738cab631...5bb2b7d17a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -48,93 +48,20 @@
include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_SOURCE_DIR}/lib_ccx)
include_directories(${PROJECT_SOURCE_DIR}/lib_ccx/zvbi)
-include_directories(${PROJECT_SOURCE_DIR}/thirdparty)
-include_directories(${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c)
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/lib_hash)
-include_directories(${PROJECT_SOURCE_DIR}/thirdparty/libpng)
-# Check if the operating system is macOS (Darwin)
-if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
- if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "arm64")
- # ARM Macs
- include_directories("/opt/homebrew/include")
- include_directories(${PROJECT_SOURCE_DIR}/thirdparty/libpng/arm)
- aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/libpng/arm SOURCEFILE)
- else()
- include_directories("/usr/local/include")
- endif()
-endif()
-
-include_directories(${PROJECT_SOURCE_DIR}/thirdparty/zlib)
-include_directories(${PROJECT_SOURCE_DIR}/thirdparty/freetype/include)
aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/lib_hash/ SOURCEFILE)
-aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/libpng/ SOURCEFILE)
-aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c/ SOURCEFILE)
-aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/zlib/ SOURCEFILE)
aux_source_directory(${PROJECT_SOURCE_DIR}/lib_ccx/zvbi/ SOURCEFILE)
-set(UTF8PROC_SOURCE ${PROJECT_SOURCE_DIR}/thirdparty/utf8proc/utf8proc.c)
+set(UTF8PROC_SOURCE)
-set(FREETYPE_SOURCE
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/autofit/autofit.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftbase.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftbbox.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftbdf.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftbitmap.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftcid.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftfntfmt.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftfstype.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftgasp.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftglyph.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftgxval.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftinit.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftlcdfil.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftmm.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftotval.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftpatent.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftpfr.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftstroke.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftsynth.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftsystem.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/fttype1.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftwinfnt.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/bdf/bdf.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/bzip2/ftbzip2.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/cache/ftcache.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/cff/cff.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/cid/type1cid.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/gzip/ftgzip.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/lzw/ftlzw.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/pcf/pcf.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/pfr/pfr.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/psaux/psaux.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/pshinter/pshinter.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/psnames/psnames.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/raster/raster.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/sfnt/sfnt.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/smooth/smooth.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/truetype/truetype.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/type1/type1.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/type42/type42.c
- ${PROJECT_SOURCE_DIR}/thirdparty/freetype/winfonts/winfnt.c
- )
+set(FREETYPE_SOURCE)
#Windows specific libraries and linker flags
if(WIN32)
include_directories ("${PROJECT_SOURCE_DIR}/thirdparty/win_spec_incld/")
include_directories ("${PROJECT_SOURCE_DIR}/thirdparty/win_iconv/")
aux_source_directory ("${PROJECT_SOURCE_DIR}/thirdparty/win_iconv/" SOURCEFILE)
set (EXTRA_LIBS ${EXTRA_LIBS} ws2_32 winmm Bcrypt)
-else (WIN32)
- # Adding some platform specific library path
- if(UNIX AND NOT APPLE)
- link_directories (/usr/local/lib)
- endif()
-
- if(APPLE)
- # Homebrew library paths
- link_directories(/usr/local/lib)
- link_directories(/opt/homebrew/lib)
- endif()
endif(WIN32)
if(MSVC)
@@ -212,9 +139,6 @@
pkg_check_modules (NANOMSG REQUIRED libnanomsg)
set (EXTRA_LIBS ${EXTRA_LIBS} ${NANOMSG_STATIC_LIBRARIES})
- include_directories ("${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c/")
- aux_source_directory ("${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c/" SOURCEFILE)
-
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_SHARING")
endif (PKG_CONFIG_FOUND AND WITH_SHARING)
diff --git a/src/lib_ccx/CMakeLists.txt b/src/lib_ccx/CMakeLists.txt
index 4f329bcaab...a334d20c4d 100644
--- a/src/lib_ccx/CMakeLists.txt
+++ b/src/lib_ccx/CMakeLists.txt
@@ -13,9 +13,39 @@
find_package(PkgConfig)
pkg_check_modules (GPAC REQUIRED gpac)
+set (REQUIRES_PRIVATE "libpng libprotobuf-c")
+
+if (WITH_FFMPEG)
+ set (REQUIRES_PRIVATE "${REQUIRES_PRIVATE} libavutil")
+endif (WITH_FFMPEG)
+
+if (WITH_HARDSUBX)
+ set (REQUIRES_PRIVATE "${REQUIRES_PRIVATE} libavcodec libavformat libswscale tesseract lept")
+endif (WITH_HARDSUBX)
+
set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${GPAC_INCLUDE_DIRS})
set (EXTRA_LIBS ${EXTRA_LIBS} ${GPAC_LIBRARIES})
+pkg_check_modules (PROTOBUFC REQUIRED libprotobuf-c)
+set (EXTRA_LIBS ${EXTRA_LIBS} ${PROTOBUFC_LIBRARIES})
+set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${PROTOBUFC_INCLUDE_DIRS}/protobuf-c)
+
+pkg_check_modules (LIBPNG REQUIRED libpng)
+set (EXTRA_LIBS ${EXTRA_LIBS} ${LIBPNG_LIBRARIES})
+set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${LIBPNG_INCLUDE_DIRS})
+
+pkg_check_modules (ZLIB REQUIRED zlib)
+set (EXTRA_LIBS ${EXTRA_LIBS} ${ZLIB_LIBRARIES})
+set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${ZLIB_INCLUDE_DIRS})
+
+pkg_check_modules (UTF8PROC REQUIRED libutf8proc)
+set (EXTRA_LIBS ${EXTRA_LIBS} ${UTF8PROC_LIBRARIES})
+set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${UTF8PROC_INCLUDE_DIRS})
+
+pkg_check_modules (FREETYPE REQUIRED freetype2)
+set (EXTRA_LIBS ${EXTRA_LIBS} ${FREETYPE_LIBRARIES})
+set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${FREETYPE_INCLUDE_DIRS})
+
if (WITH_FFMPEG)
find_package(PkgConfig)
@@ -94,7 +124,7 @@
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDISABLE_RUST")
endif (WITHOUT_RUST)
-file (GLOB HeaderFiles *.h)
+file (GLOB_RECURSE HeaderFiles *.h)
file (WRITE ccx.pc "prefix=${CMAKE_INSTALL_PREFIX}\n"
"includedir=\${prefix}/include\n"
"libdir=\${prefix}/lib\n\n"
@@ -102,8 +132,8 @@
"Description: Closed Caption Extraction library\n"
"Version: 0.75\n"
"Cflags: -I\${includedir}/\n"
- "Libs: -L\${libdir} -lccx -lpng\n"
- "Libs.private: -lpng\n"
+ "Libs: -L\${libdir} -lccx\n"
+ "Requires.private: ${REQUIRES_PRIVATE}\n"
)
install (TARGETS ccx DESTINATION lib)
diff --git a/src/lib_ccx/params.c b/src/lib_ccx/params.c
index eb1562e50c...984070a285 100644
--- a/src/lib_ccx/params.c
+++ b/src/lib_ccx/params.c
@@ -14,7 +14,7 @@
#include "../lib_hash/sha2.h"
#include <string.h>
#include <stdio.h>
-#include <utf8proc/utf8proc.h>
+#include <utf8proc.h>
#ifdef ENABLE_OCR
#include <tesseract/capi.h>

View File

@@ -0,0 +1,42 @@
diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock
index 5c49573775..3e855aa637 100644
--- a/src/rust/Cargo.lock
+++ b/src/rust/Cargo.lock
@@ -665,11 +665,10 @@
[[package]]
name = "rsmpeg"
-version = "0.14.2+ffmpeg.6.1"
+version = "0.15.1+ffmpeg.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "927012cd6ae43519f519741f4a69602ce3a47cf84750784da124dffd03527cc0"
+checksum = "d3ffbead667d06e0c77c4363f83d49a3481cc3838bc9a61882aa07b01e3f63e1"
dependencies = [
- "libc",
"paste",
"rusty_ffmpeg",
"thiserror",
@@ -711,9 +710,9 @@
[[package]]
name = "rusty_ffmpeg"
-version = "0.13.3+ffmpeg.6.1"
+version = "0.14.1+ffmpeg.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "716adffa5f909c8533611b1dab9ab5666bece35687845865b75ed6a990fc239c"
+checksum = "40f4db8e3e23d4a3044d53a41aba5324eae70d3e7fe82375ce833521533bc315"
dependencies = [
"bindgen 0.69.4",
"camino",
diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml
index 4c1e73dcf0..68502915dc 100644
--- a/src/rust/Cargo.toml
+++ b/src/rust/Cargo.toml
@@ -15,7 +15,7 @@
env_logger = "0.8.4"
palette = "0.6.1"
-rsmpeg = { version = "0.14.2", optional = true, features = [
+rsmpeg = { version = "0.15.1", optional = true, features = [
"link_system_ffmpeg",
] }
tesseract-sys = { version = "0.5.15", optional = true, default-features = false }

View File

@@ -0,0 +1,95 @@
{
lib,
stdenv,
fetchFromGitHub,
flex,
libusb1,
meson,
ninja,
nix-update-script,
pcsclite,
perl,
pkg-config,
zlib,
}:
stdenv.mkDerivation rec {
pname = "ccid";
version = "1.6.2";
src = fetchFromGitHub {
owner = "LudovicRousseau";
repo = "CCID";
tag = version;
hash = "sha256-n7rOjnLZH4RLmddtBycr3FK2Bi/OLR+9IjWBRbWjnUw=";
};
postPatch = ''
patchShebangs .
substituteInPlace meson.build --replace-fail \
"pcsc_dep.get_variable('usbdropdir')" \
"'$out/pcsc/drivers'"
'';
mesonFlags = [
(lib.mesonBool "serial" true)
];
# error: call to undeclared function 'InterruptRead';
# ISO C99 and later do not support implicit function declarations
env = lib.optionalAttrs stdenv.cc.isClang {
NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration";
};
nativeBuildInputs = [
flex
perl
pkg-config
meson
ninja
];
buildInputs = [
libusb1
pcsclite
zlib
];
doInstallCheck = true;
postInstall = ''
install -Dm 0444 -t $out/lib/udev/rules.d ../src/92_pcscd_ccid.rules
substituteInPlace $out/lib/udev/rules.d/92_pcscd_ccid.rules \
--replace-fail "/usr/sbin/pcscd" "${pcsclite}/bin/pcscd"
'';
# The resulting shared object ends up outside of the default paths which are
# usually getting stripped.
stripDebugList = [ "pcsc" ];
passthru.updateScript = nix-update-script { };
installCheckPhase =
let
platform = if stdenv.hostPlatform.isLinux then "Linux" else "MacOS";
in
lib.optionalString (stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isDarwin) ''
runHook preInstallCheck
[ -f $out/etc/reader.conf.d/libccidtwin ]
[ -f $out/lib/udev/rules.d/92_pcscd_ccid.rules ]
[ -f $out/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist ]
[ -f $out/pcsc/drivers/ifd-ccid.bundle/Contents/${platform}/libccid${stdenv.hostPlatform.extensions.sharedLibrary} ]
[ -f $out/pcsc/drivers/serial/libccidtwin${stdenv.hostPlatform.extensions.sharedLibrary} ]
runHook postInstallCheck
'';
meta = with lib; {
description = "PC/SC driver for USB CCID smart card readers";
homepage = "https://ccid.apdu.fr/";
license = licenses.lgpl21Plus;
maintainers = [ maintainers.anthonyroussel ];
platforms = platforms.unix;
};
}

View File

@@ -0,0 +1,59 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
llvmPackages,
rapidjson,
runtimeShell,
}:
stdenv.mkDerivation rec {
pname = "ccls";
version = "0.20241108";
src = fetchFromGitHub {
owner = "MaskRay";
repo = "ccls";
rev = version;
sha256 = "sha256-0hZ4VnscnKYBrXy58IjeoeDxja1oNq0mNaQGPmej5BA=";
};
nativeBuildInputs = [
cmake
llvmPackages.llvm.dev
];
buildInputs = with llvmPackages; [
libclang
llvm
rapidjson
];
cmakeFlags = [ "-DCCLS_VERSION=${version}" ];
preConfigure = ''
cmakeFlagsArray+=(-DCMAKE_CXX_FLAGS="-fvisibility=hidden -fno-rtti")
'';
clang = llvmPackages.clang;
shell = runtimeShell;
postFixup = ''
export wrapped=".ccls-wrapped"
mv $out/bin/ccls $out/bin/$wrapped
substituteAll ${./wrapper} $out/bin/ccls
chmod --reference=$out/bin/$wrapped $out/bin/ccls
'';
meta = with lib; {
description = "C/c++ language server powered by clang";
mainProgram = "ccls";
homepage = "https://github.com/MaskRay/ccls";
license = licenses.asl20;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [
mic92
tobim
];
};
}

View File

@@ -0,0 +1,9 @@
#! @shell@ -e
printf -v extraArgs ',\"%s\"' \
$(cat @clang@/nix-support/libc-cflags \
@clang@/nix-support/libcxx-cxxflags) \
${NIX_CFLAGS_COMPILE}
initString="--init={\"clang\":{\"extraArgs\":[${extraArgs:1}],\"resourceDir\":\"@clang@/resource-root\"}}"
exec -a "$0" "@out@/bin/@wrapped@" "${initString}" "$@"

View File

@@ -0,0 +1,32 @@
{
lib,
stdenv,
fetchFromGitHub,
autoreconfHook,
libiconv,
}:
stdenv.mkDerivation rec {
pname = "cconv";
version = "0.6.3";
src = fetchFromGitHub {
owner = "xiaoyjy";
repo = "cconv";
rev = "v${version}";
sha256 = "RAFl/+I+usUfeG/l17F3ltThK7G4+TekyQGwzQIgeH8=";
};
nativeBuildInputs = [ autoreconfHook ];
buildInputs = [ libiconv ];
configureFlags = lib.optional stdenv.hostPlatform.isDarwin "LDFLAGS=-liconv";
meta = with lib; {
description = "Iconv based simplified-traditional chinese conversion tool";
mainProgram = "cconv";
homepage = "https://github.com/xiaoyjy/cconv";
license = licenses.mit;
platforms = platforms.all;
maintainers = [ maintainers.redfish64 ];
};
}

View File

@@ -0,0 +1,40 @@
{
lib,
stdenv,
fetchurl,
pkg-config,
ucommon,
openssl,
libgcrypt,
}:
stdenv.mkDerivation rec {
pname = "ccrtp";
version = "2.1.2";
src = fetchurl {
url = "mirror://gnu/ccrtp/ccrtp-${version}.tar.gz";
sha256 = "17ili8l7zqbbkzr1rcy4hlnazkf50mds41wg6n7bfdsx3c7cldgh";
};
nativeBuildInputs = [ pkg-config ];
propagatedBuildInputs = [
ucommon
openssl
libgcrypt
];
configureFlags = [
"--disable-demos"
];
doCheck = true;
meta = {
description = "Implementation of the IETF real-time transport protocol (RTP)";
homepage = "https://www.gnu.org/software/ccrtp/";
license = lib.licenses.gpl2;
maintainers = with lib.maintainers; [ marcweber ];
platforms = lib.platforms.linux;
};
}

View File

@@ -0,0 +1,28 @@
{
lib,
stdenv,
fetchurl,
perl,
}:
stdenv.mkDerivation rec {
pname = "ccrypt";
version = "1.11";
src = fetchurl {
url = "mirror://sourceforge/ccrypt/ccrypt-${version}.tar.gz";
sha256 = "0kx4a5mhmp73ljknl2lcccmw9z3f5y8lqw0ghaymzvln1984g75i";
};
nativeBuildInputs = [ perl ];
hardeningDisable = [ "format" ];
meta = {
homepage = "https://ccrypt.sourceforge.net/";
description = "Utility for encrypting and decrypting files and streams with AES-256";
license = lib.licenses.gpl2Plus;
maintainers = [ ];
platforms = with lib.platforms; all;
};
}

View File

@@ -0,0 +1,38 @@
{
lib,
stdenvNoCC,
fetchurl,
unzip,
}:
stdenvNoCC.mkDerivation rec {
pname = "ccsymbols";
version = "2020-04-19";
src = fetchurl {
url = "https://www.ctrl.blog/file/${version}_cc-symbols.zip";
hash = "sha256-hkARhb8T6VgGAybYkVuPuebjhuk1dwiBJ1bZMwvYpMY=";
};
sourceRoot = ".";
nativeBuildInputs = [ unzip ];
installPhase = ''
runHook preInstall
install -Dm644 CCSymbols.* -t $out/share/fonts/ccsymbols
runHook postInstall
'';
passthru = { inherit pname version; };
meta = with lib; {
description = "Creative Commons symbol font";
homepage = "https://www.ctrl.blog/entry/creative-commons-unicode-fallback-font.html";
maintainers = with maintainers; [ qyliss ];
license = licenses.publicDomain;
platforms = platforms.all;
};
}

View File

@@ -0,0 +1,53 @@
From 55b2a5fcc38eb62f53e155bd8c741481690f1c73 Mon Sep 17 00:00:00 2001
From: Randy Eckenrode <randy@largeandhighquality.com>
Date: Wed, 10 Apr 2024 19:08:39 -0400
Subject: [PATCH 1/6] Fix build issues with misc/redo_prebinding.c
- Add missing headers; and
- Add missing arguments to `writeout`.
---
misc/redo_prebinding.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/misc/redo_prebinding.c b/misc/redo_prebinding.c
index a5a3c81..9d0f4c8 100644
--- a/misc/redo_prebinding.c
+++ b/misc/redo_prebinding.c
@@ -83,6 +83,7 @@
#include <mach-o/redo_prebinding.h>
#endif /* defined(LIBRARY_API) */
+#import <stdint.h>
#import <stdio.h>
#import <stdlib.h>
#import <string.h>
@@ -106,7 +107,7 @@
#import <stuff/hppa.h>
#import <stuff/execute.h>
#import <stuff/guess_short_name.h>
-//#import <stuff/seg_addr_table.h>
+#import <stuff/seg_addr_table.h>
#import <stuff/macosx_deployment_target.h>
#include <mach-o/dyld.h>
@@ -918,7 +919,7 @@ char *envp[])
if(write_to_stdout)
output_file = NULL;
writeout(archs, narchs, output_file, mode, TRUE, FALSE, FALSE,
- FALSE, NULL);
+ FALSE, FALSE, NULL);
if(errors){
if(write_to_stdout == FALSE)
unlink(output_file);
@@ -928,7 +929,7 @@ char *envp[])
else{
output_file = makestr(input_file, ".redo_prebinding", NULL);
writeout(archs, narchs, output_file, mode, TRUE, FALSE, FALSE,
- FALSE, NULL);
+ FALSE, FALSE, NULL);
if(errors){
unlink(output_file);
return(2);
--
2.45.2

View File

@@ -0,0 +1,25 @@
From 419c469634891d09f6688d56da9e26431018f342 Mon Sep 17 00:00:00 2001
From: Randy Eckenrode <randy@largeandhighquality.com>
Date: Wed, 10 Apr 2024 20:36:53 -0400
Subject: [PATCH 2/6] Rely on libcd_is_blob_a_linker_signature
---
libstuff/code_directory.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libstuff/code_directory.c b/libstuff/code_directory.c
index 7c158fa..3b8eb77 100644
--- a/libstuff/code_directory.c
+++ b/libstuff/code_directory.c
@@ -146,7 +146,7 @@ static const char* format_version_xyz(uint32_t version)
*/
int codedir_is_linker_signed(const char* data, uint32_t size)
{
-#if 1
+#if 0
// HACK: libcodedirectory.h is in both the macOS SDK in /usr/local/include, and in the tool chain at /usr/include.
// but there is no way to control clang's search path to look in the toolchain first.
// So, declare newer API locally. Once this new header is in all SDKs we can remove this.
--
2.45.2

View File

@@ -0,0 +1,57 @@
From 86b5ad551ef0ffc7ca4da24b7619937bec738522 Mon Sep 17 00:00:00 2001
From: Randy Eckenrode <randy@largeandhighquality.com>
Date: Mon, 15 Apr 2024 20:47:59 -0400
Subject: [PATCH 4/6] Use nixpkgs clang with the assembler driver
---
as/driver.c | 20 +++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)
diff --git a/as/driver.c b/as/driver.c
index a0d49ad..c15dcbf 100644
--- a/as/driver.c
+++ b/as/driver.c
@@ -36,7 +36,7 @@ char **envp)
char *p, c, *arch_name, *as, *as_local;
char **new_argv;
const char *CLANG = "clang";
- char *prefix, buf[MAXPATHLEN], resolved_name[PATH_MAX];
+ char *prefix = "@clang-unwrapped@/bin/";
uint32_t bufsize;
struct arch_flag arch_flag;
const struct arch_flag *arch_flags, *family_arch_flag;
@@ -50,22 +50,6 @@ char **envp)
qflag = FALSE;
Qflag = FALSE;
some_input_files = FALSE;
- /*
- * Construct the prefix to the assembler driver.
- */
- bufsize = MAXPATHLEN;
- p = buf;
- i = _NSGetExecutablePath(p, &bufsize);
- if(i == -1){
- p = allocate(bufsize);
- _NSGetExecutablePath(p, &bufsize);
- }
- prefix = realpath(p, resolved_name);
- if(prefix == NULL)
- system_fatal("realpath(3) for %s failed", p);
- p = rindex(prefix, '/');
- if(p != NULL)
- p[1] = '\0';
/*
* Process the assembler flags exactly like the assembler would (except
* let the assembler complain about multiple flags, bad combinations of
@@ -362,6 +346,8 @@ char **envp)
exit(1);
}
+ prefix = "@gas@/bin/"; /* `libexec` is found relative to the assembler drivers path. */
+
/*
* If this assembler exist try to run it else print an error message.
*/
--
2.45.2

View File

@@ -0,0 +1,28 @@
From e62f7d75380540937f24f896c82736a1e653cc75 Mon Sep 17 00:00:00 2001
From: Randy Eckenrode <randy@largeandhighquality.com>
Date: Mon, 22 Apr 2024 18:15:53 -0400
Subject: [PATCH 5/6] Find ld64 in the store
---
libstuff/execute.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libstuff/execute.c b/libstuff/execute.c
index 8526ab7..abbbf1b 100644
--- a/libstuff/execute.c
+++ b/libstuff/execute.c
@@ -149,6 +149,11 @@ char *
cmd_with_prefix(
char *str)
{
+ // Return the path to ld64 in the store.
+ if (strcmp(str, "ld") == 0) {
+ return "@ld64_path@";
+ }
+
int i;
char *p;
char *prefix, buf[MAXPATHLEN], resolved_name[PATH_MAX];
--
2.45.2

View File

@@ -0,0 +1,30 @@
From e25de788260051892b9e34177ea957cbafe6c415 Mon Sep 17 00:00:00 2001
From: Randy Eckenrode <randy@largeandhighquality.com>
Date: Thu, 2 May 2024 07:55:05 -0400
Subject: [PATCH 6/6] Support target prefixes in ranlib detection
---
misc/libtool.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/misc/libtool.c b/misc/libtool.c
index 289ec4d..8265d53 100644
--- a/misc/libtool.c
+++ b/misc/libtool.c
@@ -426,11 +426,11 @@ char **envp)
p++;
else
p = argv[0];
- if(strncmp(p, "ranlib", sizeof("ranlib") - 1) == 0) {
+ if(strncmp(p, "@targetPrefix@ranlib", sizeof("@targetPrefix@ranlib") - 1) == 0) {
cmd_flags.ranlib = TRUE;
}
else if (getenv("LIBTOOL_FORCE_RANLIB")) {
- progname = "ranlib";
+ progname = "@targetPrefix@ranlib";
cmd_flags.ranlib = TRUE;
}
--
2.45.2

View File

@@ -0,0 +1,643 @@
# Build settings based on the upstream Xcode project.
# See: https://github.com/apple-oss-distributions/cctools/blob/main/cctools.xcodeproj/project.pbxproj
# Project settings
project(
'cctools',
'c',
version : '@version@',
default_options : {
'c_args': [
'-DCCTB_MACOS=YES',
'-DCCTB_PROJECT=cctools',
'-DCCTB_PROJVERS=cctools-@version@',
'-DCCTB_VERSION=@version@',
'-DCURRENT_PROJECT_VERSION="@version@"',
'-DCODEDIRECTORY_SUPPORT',
'-DLTO_SUPPORT',
],
},
)
fs = import('fs')
# Options
target_prefix = get_option('target_prefix')
# Dependencies
cc = meson.get_compiler('c')
libcxx = cc.find_library('c++')
libcodedirectory = cc.find_library('codedirectory')
libprunetrie = cc.find_library('prunetrie')
incdirs = include_directories('include')
# Static libraries
libstuff = static_library(
'stuff',
c_args : [
'-DCPU_TYPE_RISCV32=24', # Per src/abstraction/MachOFileAbstraction.hpp from ld64
],
include_directories : [incdirs, 'include/stuff'],
sources : [
'libstuff/SymLoc.c',
'libstuff/align.c',
'libstuff/allocate.c',
'libstuff/apple_version.c',
'libstuff/arch.c',
'libstuff/arch_usage.c',
'libstuff/args.c',
'libstuff/best_arch.c',
'libstuff/breakout.c',
'libstuff/bytesex.c',
'libstuff/checkout.c',
'libstuff/code_directory.c',
'libstuff/coff_bytesex.c',
'libstuff/crc32.c',
'libstuff/depinfo.c',
'libstuff/diagnostics.c',
'libstuff/dylib_roots.c',
'libstuff/dylib_table.c',
'libstuff/errors.c',
'libstuff/execute.c',
'libstuff/fatal_arch.c',
'libstuff/fatals.c',
'libstuff/get_arch_from_host.c',
'libstuff/get_toc_byte_sex.c',
'libstuff/guess_short_name.c',
'libstuff/hash_string.c',
'libstuff/hppa.c',
'libstuff/llvm.c',
'libstuff/lto.c',
'libstuff/macosx_deployment_target.c',
'libstuff/ofile.c',
'libstuff/ofile_error.c',
'libstuff/ofile_get_word.c',
'libstuff/print.c',
'libstuff/reloc.c',
'libstuff/rnd.c',
'libstuff/seg_addr_table.c',
'libstuff/set_arch_flag_name.c',
'libstuff/swap_headers.c',
'libstuff/symbol_list.c',
'libstuff/unix_standard_mode.c',
'libstuff/version_number.c',
'libstuff/vm_flush_cache.c',
'libstuff/write64.c',
'libstuff/writeout.c',
'libstuff/xcode.c',
],
)
libstuff_otool = static_library(
'stuff_otool',
c_args : [
'-DCPU_TYPE_RISCV32=24', # Per src/abstraction/MachOFileAbstraction.hpp from ld64
],
include_directories : [incdirs, 'include/stuff', 'otool'],
sources : [
'libstuff/SymLoc.c',
'libstuff/align.c',
'libstuff/allocate.c',
'libstuff/apple_version.c',
'libstuff/arch.c',
'libstuff/arch_usage.c',
'libstuff/args.c',
'libstuff/best_arch.c',
'libstuff/breakout.c',
'libstuff/bytesex.c',
'libstuff/checkout.c',
'libstuff/code_directory.c',
'libstuff/coff_bytesex.c',
'libstuff/crc32.c',
'libstuff/depinfo.c',
'libstuff/diagnostics.c',
'libstuff/dylib_roots.c',
'libstuff/dylib_table.c',
'libstuff/errors.c',
'libstuff/execute.c',
'libstuff/fatal_arch.c',
'libstuff/fatals.c',
'libstuff/get_arch_from_host.c',
'libstuff/get_toc_byte_sex.c',
'libstuff/guess_short_name.c',
'libstuff/hash_string.c',
'libstuff/hppa.c',
'libstuff/llvm.c',
'libstuff/lto.c',
'libstuff/macosx_deployment_target.c',
'libstuff/ofile.c',
'libstuff/ofile_error.c',
'libstuff/ofile_get_word.c',
'libstuff/print.c',
'libstuff/reloc.c',
'libstuff/rnd.c',
'libstuff/seg_addr_table.c',
'libstuff/set_arch_flag_name.c',
'libstuff/swap_headers.c',
'libstuff/symbol_list.c',
'libstuff/unix_standard_mode.c',
'libstuff/version_number.c',
'libstuff/vm_flush_cache.c',
'libstuff/write64.c',
'libstuff/writeout.c',
'libstuff/xcode.c',
],
)
# Binaries
ar = executable(
f'@target_prefix@ar',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : [
'ar/append.c',
'ar/ar.c',
'ar/archive.c',
'ar/contents.c',
'ar/delete.c',
'ar/extract.c',
'ar/misc.c',
'ar/move.c',
'ar/print.c',
'ar/replace.c',
],
)
install_man(
'ar/ar.1',
'ar/ar.5',
)
as = executable(
f'@target_prefix@gas',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['as/driver.c'],
)
as_common = files(
'as/app.c',
'as/as.c',
'as/atof-generic.c',
'as/atof-ieee.c',
'as/dwarf2dbg.c',
'as/expr.c',
'as/fixes.c',
'as/flonum-const.c',
'as/flonum-copy.c',
'as/flonum-mult.c',
'as/frags.c',
'as/hash.c',
'as/hex-value.c',
'as/input-file.c',
'as/input-scrub.c',
'as/layout.c',
'as/messages.c',
'as/obstack.c',
'as/read.c',
'as/sections.c',
'as/symbols.c',
'as/write_object.c',
'as/xmalloc.c',
)
as_arm = executable(
'as-arm',
c_args : [
'-DARM',
'-DNeXT_MOD',
],
include_directories : [
incdirs,
'as',
'include/gnu',
],
install : true,
install_dir : 'libexec/as/arm',
link_with : [libstuff],
sources : [as_common, 'as/arm.c'],
)
as_i386 = executable(
'as-i386',
c_args : [
'-DI386',
'-Di486',
'-Di586',
'-Di686',
'-DNeXT_MOD',
],
include_directories : [
incdirs,
'as',
'include/gnu',
],
install : true,
install_dir : 'libexec/as/i386',
link_with : [libstuff],
sources : [as_common, 'as/i386.c'],
)
as_x86_64 = executable(
'as-x86_64',
c_args : [
'-DI386',
'-Di486',
'-Di586',
'-Di686',
'-DARCH64',
'-DNeXT_MOD',
],
include_directories : [
incdirs,
'as',
'include/gnu'
],
install : true,
install_dir : 'libexec/as/x86_64',
link_with : [libstuff],
sources : [as_common, 'as/i386.c'],
)
# # ld # excluded because ld64 is built separately
bitcode_strip = executable(
f'@target_prefix@bitcode_strip',
dependencies : [libcodedirectory],
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/bitcode_strip.c'],
)
install_man('man/bitcode_strip.1')
check_dylib = executable(
f'@target_prefix@check_dylib',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/check_dylib.c'],
)
install_man('man/check_dylib.1')
checksyms = executable(
f'@target_prefix@checksyms',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/checksyms.c'],
)
install_man('man/checksyms.1')
cmpdylib = executable(
f'@target_prefix@cmpdylib',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/cmpdylib.c'],
)
install_man('man/cmpdylib.1')
codesign_allocate = executable(
f'@target_prefix@codesign_allocate',
dependencies : [libcodedirectory],
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/codesign_allocate.c'],
)
install_man('man/codesign_allocate.1')
ctf_insert = executable(
f'@target_prefix@ctf_insert',
dependencies : [libcodedirectory],
include_directories : [incdirs, 'include/stuff'],
install : true,
link_with : [libstuff],
sources : ['misc/ctf_insert.c'],
)
install_man('man/ctf_insert.1')
depinfo = executable(
f'@target_prefix@depinfo',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/depinfo.c'],
)
install_man('man/depinfo.1')
diagtest = executable(
f'@target_prefix@diagtest',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/diagtest.c'],
)
install_man('man/diagtest.1')
gprof = executable(
f'@target_prefix@gprof',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : [
'gprof/arcs.c',
'gprof/calls.c',
'gprof/dfn.c',
'gprof/getnfile.c',
'gprof/gprof.c',
'gprof/hertz.c',
'gprof/lookup.c',
'gprof/printgprof.c',
'gprof/printlist.c',
'gprof/scatter.c',
],
)
install_man('man/gprof.1')
# Not supported on 64-bit architectures
# indr = executable(
# f'@target_prefix@indr',
# include_directories : incdirs,
# sources : ['misc/indr.c'],
# )
# install_man('man/indr.1')
install_name_tool = executable(
f'@target_prefix@install_name_tool',
dependencies : [libcodedirectory],
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/install_name_tool.c'],
)
install_man('man/install_name_tool.1')
libtool = executable(
f'@target_prefix@libtool',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/libtool.c'],
)
install_man('man/libtool.1')
lipo = executable(
f'@target_prefix@lipo',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/lipo.c'],
)
install_man('man/lipo.1')
mtoc = executable(
f'@target_prefix@mtoc',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['efitools/mtoc.c'],
)
install_man('man/mtoc.1')
mtor = executable(
f'@target_prefix@mtor',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['efitools/mtor.c'],
)
install_man('man/mtor.1')
nm = executable(
f'@target_prefix@nm',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/nm.c'],
)
install_man('man/nm-classic.1')
nmedit = executable(
f'@target_prefix@nmedit',
c_args : ['-DNMEDIT'],
dependencies : [libcodedirectory],
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/strip.c'],
)
install_man('man/nmedit.1')
otool = executable(
f'@target_prefix@otool',
c_args : ['-DEFI_SUPPORT'],
dependencies : [libcxx],
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : [
'otool/arm64_disasm.c',
'otool/arm_disasm.c',
'otool/coff_print.c',
'otool/dyld_bind_info.c',
'otool/hppa_disasm.c',
'otool/i386_disasm.c',
'otool/i860_disasm.c',
'otool/m68k_disasm.c',
'otool/m88k_disasm.c',
'otool/main.c',
'otool/ofile_print.c',
'otool/ppc_disasm.c',
'otool/print_bitcode.c',
'otool/print_objc.c',
'otool/print_objc2_32bit.c',
'otool/print_objc2_64bit.c',
'otool/print_objc2_util.c',
'otool/sparc_disasm.c',
],
)
install_man('man/otool-classic.1')
pagestuff = executable(
f'@target_prefix@pagestuff',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/pagestuff.c'],
)
install_man('man/pagestuff.1')
# ranlib is a symlink to libtool
install_man(
'man/ranlib.1',
'man/ranlib.5',
)
redo_prebinding = executable(
f'@target_prefix@redo_prebinding',
dependencies : [libcodedirectory],
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/redo_prebinding.c'],
)
install_man('man/redo_prebinding.1')
seg_addr_table = executable(
f'@target_prefix@seg_addr_table',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/seg_addr_table.c'],
)
install_man('man/seg_addr_table.1')
seg_hack = executable(
f'@target_prefix@seg_hack',
dependencies : [libcodedirectory],
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/seg_hack.c'],
)
segedit = executable(
f'@target_prefix@segedit',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/segedit.c'],
)
install_man('man/segedit.1',)
size = executable(
f'@target_prefix@size',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/size.c'],
)
install_man('man/size-classic.1')
strings = executable(
f'@target_prefix@strings',
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/strings.c'],
)
install_man('man/strings.1')
strip = executable(
f'@target_prefix@strip',
c_args : ['-DTRIE_SUPPORT'],
dependencies : [libcxx, libcodedirectory, libprunetrie],
include_directories : incdirs,
install : true,
link_with : [libstuff],
sources : ['misc/strip.c'],
)
install_man('man/strip.1')
vtool = executable(
f'@target_prefix@vtool',
dependencies : [libcodedirectory],
include_directories : [incdirs, 'include/stuff'],
install : true,
link_with : [libstuff],
sources : ['misc/vtool.c'],
)
install_man('man/vtool.1')
# Development files
# Static libraries
libmacho = static_library(
'macho',
include_directories : incdirs,
sources : [
'libmacho/arch.c',
'libmacho/get_end.c',
'libmacho/getsecbyname.c',
'libmacho/getsegbyname.c',
'libmacho/hppa_swap.c',
'libmacho/i386_swap.c',
'libmacho/i860_swap.c',
'libmacho/m68k_swap.c',
'libmacho/m88k_swap.c',
'libmacho/ppc_swap.c',
'libmacho/slot_name.c',
'libmacho/sparc_swap.c',
'libmacho/swap.c',
],
)
libredo_prebinding = static_library(
'redo_prebinding',
c_args : ['-DLIBRARY_API'],
include_directories : incdirs,
sources : ['misc/redo_prebinding.c'],
)
install_man('man/redo_prebinding.3')
# Development files
# Based on the contents of the upstream SDK.
install_headers(
'include/mach-o/arch.h',
'include/mach-o/fat.h',
'include/mach-o/getsect.h',
'include/mach-o/ldsyms.h',
'include/mach-o/loader.h',
'include/mach-o/nlist.h',
'include/mach-o/ranlib.h',
'include/mach-o/reloc.h',
'include/mach-o/stab.h',
'include/mach-o/swap.h',
subdir : 'mach-o',
)
# Some of these architectures are irrelevant, but the Libsystem derivation expects their headers to be present.
# Not every arch has both headers, so tailor the lists for each that does.
foreach arch : ['arm', 'arm64', 'hppa', 'i860', 'm88k', 'ppc', 'sparc', 'x86_64']
install_headers(
f'include/mach-o/@arch@/reloc.h',
subdir : f'mach-o/@arch@',
)
endforeach
foreach arch : ['hppa', 'i386', 'i860', 'm68k', 'm88k', 'ppc', 'sparc']
install_headers(
f'include/mach-o/@arch@/swap.h',
subdir : f'mach-o/@arch@',
)
endforeach
install_data(
'include/modules/mach-o.modulemap',
install_dir : get_option('includedir'),
rename : 'mach-o/module.map',
)
install_man(
'man/Mach-O.5',
'man/NSModule.3',
'man/NSObjectFileImage.3',
'man/NSObjectFileImage_priv.3',
'man/arch.3',
'man/dyld.3',
'man/end.3',
'man/get_end.3',
'man/getsectbyname.3',
'man/getsectbynamefromheader.3',
'man/getsectdata.3',
'man/getsectdatafromheader.3',
'man/getsegbyname.3',
'man/stab.5',
)

View File

@@ -0,0 +1,6 @@
option(
'target_prefix',
type : 'string',
value : '',
description: 'Specifies the prefix to use when building for cross-compilation (e.g., `aarch64-apple-darwin`)'
)

View File

@@ -0,0 +1,170 @@
{
lib,
stdenv,
fetchFromGitHub,
buildPackages,
ld64,
llvm,
meson,
ninja,
openssl,
xar,
gitUpdater,
}:
let
# The targetPrefix is prepended to binary names to allow multiple binuntils on the PATH to both be usable.
targetPrefix = lib.optionalString (
stdenv.targetPlatform != stdenv.hostPlatform
) "${stdenv.targetPlatform.config}-";
# First version with all the required files
xnu = fetchFromGitHub {
name = "xnu-src";
owner = "apple-oss-distributions";
repo = "xnu";
rev = "xnu-7195.50.7.100.1";
hash = "sha256-uHmAOm6k9ZXWfyqHiDSpm+tZqUbERlr6rXSJ4xNACkM=";
};
in
stdenv.mkDerivation (finalAttrs: {
pname = "${targetPrefix}cctools";
version = "1010.6";
outputs = [
"out"
"dev"
"man"
"gas"
"libtool"
];
src = fetchFromGitHub {
owner = "apple-oss-distributions";
repo = "cctools";
rev = "cctools-${finalAttrs.version}";
hash = "sha256-JiKCP6U+xxR4mk4TXWv/mEo9Idg+QQqUYmB/EeRksCE=";
};
xcodeHash = "sha256-5RBbGrz1UKV0wt2Uk7RIHdfgWH8sgw/jy7hfTVrtVuM=";
postUnpack = ''
unpackFile '${xnu}'
# Verify that the Xcode project has not changed unexpectedly.
hashType=$(echo $xcodeHash | cut -d- -f1)
expectedHash=$(echo $xcodeHash | cut -d- -f2)
hash=$(openssl "$hashType" -binary "$sourceRoot/cctools.xcodeproj/project.pbxproj" | base64)
if [ "$hash" != "$expectedHash" ]; then
echo 'error: hash mismatch in cctools.xcodeproj/project.pbxproj'
echo " specified: $xcodeHash"
echo " got: $hashType-$hash"
echo
echo 'Upstream Xcode project has changed. Update `meson.build` with any changes, then update `xcodeHash`.'
echo 'Use `nix-hash --flat --sri --type sha256 cctools.xcodeproj/project.pbxproj` to regenerate it.'
exit 1
fi
'';
patches = [
# Fix compile errors in redo_prebinding.c
./0001-Fix-build-issues-with-misc-redo_prebinding.c.patch
# Use libcd_is_blob_a_linker_signature as defined in the libcodedirectory.h header
./0002-Rely-on-libcd_is_blob_a_linker_signature.patch
# Use the nixpkgs clangs path as the prefix.
./0004-Use-nixpkgs-clang-with-the-assembler-driver.patch
# Make sure cctools can find ld64 in the store
./0005-Find-ld64-in-the-store.patch
# `ranlib` is a symlink to `libtool`. Make sure its detection works when it is used in cross-compilation.
./0006-Support-target-prefixes-in-ranlib-detection.patch
];
postPatch = ''
substitute ${./meson.build} meson.build \
--subst-var version
cp ${./meson.options} meson.options
# Make sure ass clang driver uses clang from nixpkgs and finds the drivers in the store.
substituteInPlace as/driver.c \
--subst-var-by clang-unwrapped '${lib.getBin buildPackages.clang.cc}' \
--subst-var-by gas '${placeholder "gas"}'
# Need to set the path to make sure cctools can find ld64 in the store.
substituteInPlace libstuff/execute.c \
--subst-var-by ld64_path '${lib.getBin ld64}/bin/ld'
# Set the target prefix for `ranlib`
substituteInPlace misc/libtool.c \
--subst-var-by targetPrefix '${targetPrefix}'
# Use libxar from nixpkgs
for cctool_src in misc/nm.c otool/print_bitcode.c; do
substituteInPlace $cctool_src \
--replace-fail 'makestr(prefix, "../lib/libxar.dylib", NULL)' '"${lib.getLib xar}/lib/libxar.dylib"' \
--replace-fail '/usr/lib/libxar.dylib' '${lib.getLib xar}/lib/libxar.dylib'
done
# Use libLTO.dylib from nixpkgs LLVM
substituteInPlace libstuff/llvm.c \
--replace-fail 'getenv("LIBLTO_PATH")' '"${lib.getLib llvm}/lib/libLTO.dylib"'
cp ../xnu-src/EXTERNAL_HEADERS/mach-o/fixup-chains.h include/mach-o/fixup-chains.h
'';
strictDeps = true;
nativeBuildInputs = [
meson
ninja
openssl
];
buildInputs = [
ld64
llvm
];
mesonBuildType = "release";
mesonFlags = [
(lib.mesonOption "b_ndebug" "if-release")
]
++ lib.optionals (targetPrefix != "") [ (lib.mesonOption "target_prefix" targetPrefix) ];
postInstall = ''
ln -s ${targetPrefix}libtool "$out/bin/${targetPrefix}ranlib"
ln -s nm-classic.1 "''${!outputMan}/share/man/man1/nm.1"
ln -s otool-classic.1 "''${!outputMan}/share/man/man1/otool.1"
ln -s size-classic.1 "''${!outputMan}/share/man/man1/size.1"
# Move GNU as to its own output to prevent it from being used accidentally.
moveToOutput bin/gas "$gas"
moveToOutput libexec "$gas"
for arch in arm i386 x86_64; do
mv "$gas/libexec/as/$arch/as-$arch" "$gas/libexec/as/$arch/as"
done
# Move libtool to its own output to allow packages to add it without pulling in all of cctools
moveToOutput bin/${targetPrefix}libtool "$libtool"
ln -s "$libtool/bin/${targetPrefix}libtool" "$out/bin/${targetPrefix}libtool"
'';
__structuredAttrs = true;
passthru = {
inherit targetPrefix;
updateScript = gitUpdater { rev-prefix = "cctools-"; };
};
meta = {
description = "Classic linker for Darwin";
homepage = "https://opensource.apple.com/releases/";
license = with lib.licenses; [
apple-psl20
gpl2 # GNU as
];
teams = [ lib.teams.darwin ];
platforms = lib.platforms.darwin;
};
})

View File

@@ -0,0 +1,64 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
pkg-config,
qt5,
ffmpeg,
gtest,
libva,
}:
stdenv.mkDerivation {
pname = "cctv-viewer";
version = "0.1.9-unstable-2025-06-13";
src = fetchFromGitHub {
owner = "iEvgeny";
repo = "cctv-viewer";
rev = "8a8fff2612ae2123b8be156c954a29706383b480";
hash = "sha256-Euw9S+iONAEENkFwo169x/+pcyeTXLe8wb70KKjv3bE=";
fetchSubmodules = true;
};
cmakeFlags = [
"-DBUILD_TESTS=OFF"
];
nativeBuildInputs = [
cmake
pkg-config
qt5.wrapQtAppsHook
qt5.qttools
gtest
];
buildInputs = [
qt5.qtbase
qt5.qtquickcontrols2
qt5.qtsvg
qt5.qtmultimedia
qt5.qtgraphicaleffects
ffmpeg
libva
];
installPhase = ''
runHook preInstall
install -D cctv-viewer --target-directory=$out/bin
install -Dm644 $src/cctv-viewer.desktop --target-directory=$out/share/applications
install -Dm644 $src/images/cctv-viewer.svg --target-directory=$out/share/icons/hicolor/scalable/apps
runHook postInstall
'';
meta = {
description = "Viewer and mounter for video streams";
homepage = "https://cctv-viewer.org";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ teohz ];
platforms = lib.platforms.linux;
};
}

View File

@@ -0,0 +1,41 @@
{
lib,
stdenv,
fetchFromGitHub,
}:
stdenv.mkDerivation rec {
pname = "cctz";
version = "2.5";
src = fetchFromGitHub {
owner = "google";
repo = "cctz";
rev = "v${version}";
sha256 = "sha256-YCE0DXuOT5tCOfLlemMH7I2F8c7HEK1NEUJvtfqnCg8=";
};
env.NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-framework CoreFoundation";
makeFlags = [ "PREFIX=$(out)" ];
installTargets = [
"install_hdrs"
]
++ lib.optional (!stdenv.hostPlatform.isStatic) "install_shared_lib"
++ lib.optional stdenv.hostPlatform.isStatic "install_lib";
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
install_name_tool -id $out/lib/libcctz.so $out/lib/libcctz.so
'';
enableParallelBuilding = true;
meta = with lib; {
homepage = "https://github.com/google/cctz";
description = "C++ library for translating between absolute and civil times";
license = licenses.asl20;
maintainers = with maintainers; [ orivej ];
platforms = platforms.all;
};
}

View File

@@ -0,0 +1,61 @@
{
lib,
stdenv,
fetchFromGitLab,
autoconf,
ncurses,
pcre2,
quilt,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "ccze";
version = "0.2.1-8";
src = fetchFromGitLab {
domain = "salsa.debian.org";
owner = "debian";
repo = "ccze";
rev = "debian/${finalAttrs.version}";
hash = "sha256-sESbs+HTDRX9w7c+LYnzQoemPIxAtqk27IVSTtiAGEk=";
};
postPatch = ''
QUILT_PATCHES=debian/patches quilt push -a
'';
nativeBuildInputs = [
autoconf
quilt
];
buildInputs = [
ncurses
pcre2
];
preConfigure = ''
autoheader
autoconf
'';
# provide correct pcre2-config for cross
env.PCRE_CONFIG = lib.getExe' (lib.getDev pcre2) "pcre2-config";
meta = with lib; {
mainProgram = "ccze";
description = "Fast, modular log colorizer";
homepage = "https://salsa.debian.org/debian/ccze";
changelog = "https://salsa.debian.org/debian/ccze/-/raw/master/debian/changelog?ref_type=heads";
longDescription = ''
Fast log colorizer written in C, intended to be a drop-in replacement for the Perl colorize tool.
Includes plugins for a variety of log formats (Apache, Postfix, Procmail, etc.).
'';
license = licenses.gpl2Plus;
maintainers = with maintainers; [
malyn
philiptaron
];
platforms = platforms.linux;
};
})