darwin: fix builds

This commit is contained in:
Victor Fuentes 2024-05-14 01:42:59 -04:00
parent f31f6acd3e
commit a1e8870cc3
Signed by: vlinkz
GPG key ID: 0A88B68D6A9ACAE0
45 changed files with 1626 additions and 25 deletions

View file

@ -24,7 +24,7 @@ with pkgs;
inherit (stdenv.targetPlatform) linker;
in
if linker == "lld" then llvmPackages.bintools-unwrapped
# else if linker == "cctools" then darwin.binutils-unwrapped
else if linker == "cctools" then darwin.binutils-unwrapped
else if linker == "bfd" then binutils-unwrapped
else if linker == "gold" then binutils-unwrapped.override { enableGoldDefault = true; }
else null;

View file

@ -51,8 +51,9 @@ stdenv.mkDerivation (finalAttrs: {
"CFLAGS_EXTRA=-DNO_SOFT_VDB"
];
# `gctest` fails under emulation on aarch64-darwin
doCheck = !(stdenv.isDarwin && stdenv.isx86_64);
# `gctest` fails under x86_64 emulation on aarch64-darwin
# and also on aarch64-linux (qemu-user)
doCheck = !((stdenv.isDarwin && stdenv.isx86_64) || (stdenv.isLinux && stdenv.isAarch64));
enableParallelBuilding = true;

View file

@ -199,6 +199,6 @@ stdenv.mkDerivation (finalAttrs: {
maintainers = with lib.maintainers; [ ttuegel lnl7 AndersonTorres ];
platforms = lib.platforms.all;
mainProgram = "cmake";
broken = (/*qt5UI &&*/ stdenv.isDarwin);
# broken = (qt5UI && stdenv.isDarwin);
};
})

View file

@ -0,0 +1,56 @@
{ fetchurl, fetchpatch, lib, stdenv, cmake }:
stdenv.mkDerivation rec {
pname = "cmocka";
majorVersion = "1.1";
version = "${majorVersion}.7";
src = fetchurl {
url = "https://cmocka.org/files/${majorVersion}/cmocka-${version}.tar.xz";
sha256 = "sha256-gQVw6wuNZIBDMfgrKf9Hx5DOnNaxY+mNR6SAcEfsrYI=";
};
patches = [
./uintptr_t.patch
];
nativeBuildInputs = [ cmake ];
cmakeFlags = lib.optional doCheck "-DUNIT_TESTING=ON"
++ lib.optional stdenv.hostPlatform.isStatic "-DBUILD_SHARED_LIBS=OFF";
doCheck = true;
meta = with lib; {
description = "Lightweight library to simplify and generalize unit tests for C";
longDescription = ''
There are a variety of C unit testing frameworks available however
many of them are fairly complex and require the latest compiler
technology. Some development requires the use of old compilers which
makes it difficult to use some unit testing frameworks. In addition
many unit testing frameworks assume the code being tested is an
application or module that is targeted to the same platform that will
ultimately execute the test. Because of this assumption many
frameworks require the inclusion of standard C library headers in the
code module being tested which may collide with the custom or
incomplete implementation of the C library utilized by the code under
test.
Cmocka only requires a test application is linked with the standard C
library which minimizes conflicts with standard C library headers.
Also, CMocka tries to avoid the use of some of the newer features of
C compilers.
This results in CMocka being a relatively small library that can be
used to test a variety of exotic code. If a developer wishes to
simply test an application with the latest compiler then other unit
testing frameworks may be preferable.
This is the successor of Google's Cmockery.
'';
homepage = "https://cmocka.org/";
license = licenses.asl20;
platforms = platforms.all;
maintainers = with maintainers; [ kragniz rasendubi ];
};
}

View file

@ -0,0 +1,16 @@
Resolve messy situation with uintptr_t and stdint.h
Platforms common in nixpkgs will have stdint.h - thereby we avoid problems
that seem complicated to avoid. References:
https://gitlab.com/cmocka/cmocka/-/issues/38#note_1286565655
https://git.alpinelinux.org/aports/plain/main/cmocka/musl_uintptr.patch?id=6a15dd0d0ba9cc354a621fb359ca5e315ff2eabd
It isn't easy, as 1.1.6 codebase is missing stdint.h includes on many places,
and HAVE_UINTPTR_T from cmake also wouldn't get on all places it needs to.
--- a/include/cmocka.h
+++ b/include/cmocka.h
@@ -18,2 +18,4 @@
#define CMOCKA_H_
+#include <stdint.h>
+#define HAVE_UINTPTR_T 1

View file

@ -0,0 +1,44 @@
{ lib, stdenv, fetchsvn, autoreconfHook }:
stdenv.mkDerivation rec {
pname = "ctags";
version = "816";
src = fetchsvn {
url = "https://svn.code.sf.net/p/ctags/code/trunk";
rev = version;
sha256 = "0jmbkrmscbl64j71qffcc39x005jrmphx8kirs1g2ws44wil39hf";
};
nativeBuildInputs = [ autoreconfHook ];
# don't use $T(E)MP which is set to the build directory
configureFlags= [ "--enable-tmpdir=/tmp" ];
patches = [
# Library defines an `__unused__` which is a reserved name, and may
# conflict with the standard library definition. One such conflict is with
# macOS headers.
./unused-collision.patch
];
meta = with lib; {
description = "A tool for fast source code browsing (exuberant ctags)";
mainProgram = "ctags";
longDescription = ''
Ctags generates an index (or tag) file of language objects found
in source files that allows these items to be quickly and easily
located by a text editor or other utility. A tag signifies a
language object for which an index entry is available (or,
alternatively, the index entry created for that object). Many
programming languages are supported.
'';
homepage = "https://ctags.sourceforge.net/";
license = licenses.gpl2Plus;
platforms = platforms.unix;
# So that Exuberant ctags is preferred over emacs's ctags
priority = 1;
};
}

View file

@ -0,0 +1,246 @@
--- a/c.c (revision 816)
+++ b/c.c (working copy)
@@ -619,7 +619,7 @@
return name;
}
-static void __unused__ pt (tokenInfo *const token)
+static void UNUSED pt (tokenInfo *const token)
{
if (isType (token, TOKEN_NAME))
printf ("type: %-12s: %-13s line: %lu\n",
@@ -634,7 +634,7 @@
tokenString (token->type), token->lineNumber);
}
-static void __unused__ ps (statementInfo *const st)
+static void UNUSED ps (statementInfo *const st)
{
unsigned int i;
printf ("scope: %s decl: %s gotName: %s gotParenName: %s\n",
--- a/eiffel.c (revision 816)
+++ b/eiffel.c (working copy)
@@ -807,7 +807,7 @@
static boolean parseType (tokenInfo *const token);
-static void parseGeneric (tokenInfo *const token, boolean declaration __unused__)
+static void parseGeneric (tokenInfo *const token, boolean declaration UNUSED)
{
unsigned int depth = 0;
#ifdef TYPE_REFERENCE_TOOL
--- a/general.h (revision 816)
+++ b/general.h (working copy)
@@ -57,10 +57,10 @@
* to prevent warnings about unused variables.
*/
#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) && !defined (__GNUG__)
-# define __unused__ __attribute__((unused))
+# define UNUSED __attribute__((unused))
# define __printf__(s,f) __attribute__((format (printf, s, f)))
#else
-# define __unused__
+# define UNUSED
# define __printf__(s,f)
#endif
--- a/lregex.c (revision 816)
+++ b/lregex.c (working copy)
@@ -538,11 +538,11 @@
#endif /* HAVE_REGEX */
extern void addTagRegex (
- const langType language __unused__,
- const char* const regex __unused__,
- const char* const name __unused__,
- const char* const kinds __unused__,
- const char* const flags __unused__)
+ const langType language UNUSED,
+ const char* const regex UNUSED,
+ const char* const name UNUSED,
+ const char* const kinds UNUSED,
+ const char* const flags UNUSED)
{
#ifdef HAVE_REGEX
Assert (regex != NULL);
@@ -564,10 +564,10 @@
}
extern void addCallbackRegex (
- const langType language __unused__,
- const char* const regex __unused__,
- const char* const flags __unused__,
- const regexCallback callback __unused__)
+ const langType language UNUSED,
+ const char* const regex UNUSED,
+ const char* const flags UNUSED,
+ const regexCallback callback UNUSED)
{
#ifdef HAVE_REGEX
Assert (regex != NULL);
@@ -581,7 +581,7 @@
}
extern void addLanguageRegex (
- const langType language __unused__, const char* const regex __unused__)
+ const langType language UNUSED, const char* const regex UNUSED)
{
#ifdef HAVE_REGEX
if (! regexBroken)
@@ -602,7 +602,7 @@
*/
extern boolean processRegexOption (const char *const option,
- const char *const parameter __unused__)
+ const char *const parameter UNUSED)
{
boolean handled = FALSE;
const char* const dash = strchr (option, '-');
@@ -624,7 +624,7 @@
return handled;
}
-extern void disableRegexKinds (const langType language __unused__)
+extern void disableRegexKinds (const langType language UNUSED)
{
#ifdef HAVE_REGEX
if (language <= SetUpper && Sets [language].count > 0)
@@ -639,8 +639,8 @@
}
extern boolean enableRegexKind (
- const langType language __unused__,
- const int kind __unused__, const boolean mode __unused__)
+ const langType language UNUSED,
+ const int kind UNUSED, const boolean mode UNUSED)
{
boolean result = FALSE;
#ifdef HAVE_REGEX
@@ -660,7 +660,7 @@
return result;
}
-extern void printRegexKinds (const langType language __unused__, boolean indent __unused__)
+extern void printRegexKinds (const langType language UNUSED, boolean indent UNUSED)
{
#ifdef HAVE_REGEX
if (language <= SetUpper && Sets [language].count > 0)
--- a/lua.c (revision 816)
+++ b/lua.c (working copy)
@@ -37,7 +37,7 @@
*/
/* for debugging purposes */
-static void __unused__ print_string (char *p, char *q)
+static void UNUSED print_string (char *p, char *q)
{
for ( ; p != q; p++)
fprintf (errout, "%c", *p);
--- a/main.c (revision 816)
+++ b/main.c (working copy)
@@ -522,7 +522,7 @@
* Start up code
*/
-extern int main (int __unused__ argc, char **argv)
+extern int main (int UNUSED argc, char **argv)
{
cookedArgs *args;
#ifdef VMS
--- a/options.c (revision 816)
+++ b/options.c (working copy)
@@ -730,7 +730,7 @@
}
static void processExcludeOption (
- const char *const option __unused__, const char *const parameter)
+ const char *const option UNUSED, const char *const parameter)
{
const char *const fileName = parameter + 1;
if (parameter [0] == '\0')
@@ -867,7 +867,7 @@
}
static void processFilterTerminatorOption (
- const char *const option __unused__, const char *const parameter)
+ const char *const option UNUSED, const char *const parameter)
{
freeString (&Option.filterTerminator);
Option.filterTerminator = stringCopy (parameter);
@@ -930,8 +930,8 @@
}
static void processHelpOption (
- const char *const option __unused__,
- const char *const parameter __unused__)
+ const char *const option UNUSED,
+ const char *const parameter UNUSED)
{
printProgramIdentification ();
putchar ('\n');
@@ -1139,8 +1139,8 @@
}
static void processLicenseOption (
- const char *const option __unused__,
- const char *const parameter __unused__)
+ const char *const option UNUSED,
+ const char *const parameter UNUSED)
{
printProgramIdentification ();
puts ("");
@@ -1166,8 +1166,8 @@
}
static void processListMapsOption (
- const char *const __unused__ option,
- const char *const __unused__ parameter)
+ const char *const UNUSED option,
+ const char *const UNUSED parameter)
{
if (parameter [0] == '\0' || strcasecmp (parameter, "all") == 0)
printLanguageMaps (LANG_AUTO);
@@ -1183,8 +1183,8 @@
}
static void processListLanguagesOption (
- const char *const option __unused__,
- const char *const parameter __unused__)
+ const char *const option UNUSED,
+ const char *const parameter UNUSED)
{
printLanguageList ();
exit (0);
@@ -1358,8 +1358,8 @@
}
static void processVersionOption (
- const char *const option __unused__,
- const char *const parameter __unused__)
+ const char *const option UNUSED,
+ const char *const parameter UNUSED)
{
printProgramIdentification ();
exit (0);
--- a/parse.c (revision 816)
+++ b/parse.c (working copy)
@@ -376,7 +376,7 @@
*/
extern void processLanguageDefineOption (
- const char *const option, const char *const parameter __unused__)
+ const char *const option, const char *const parameter UNUSED)
{
#ifdef HAVE_REGEX
if (parameter [0] == '\0')
--- a/routines.c (revision 816)
+++ b/routines.c (working copy)
@@ -526,7 +526,7 @@
#if ! defined (HAVE_STAT_ST_INO)
-static void canonicalizePath (char *const path __unused__)
+static void canonicalizePath (char *const path UNUSED)
{
#if defined (MSDOS_STYLE_PATH)
char *p;

View file

@ -0,0 +1,78 @@
{ pkgs, ctags }:
with pkgs.lib;
# define some ctags wrappers adding support for some not that common languages
# customization:
# a) add stuff here
# b) override asLang, phpLang, ... using packageOverrides
# c) use ctagsWrapped.override {args = [ your liste ];}
# install using -iA ctagsWrapped.ctagsWrapped
{
# the derivation. use language extensions specified by args
ctagsWrapped = makeOverridable ( {args, name} : pkgs.writeScriptBin name ''
#!${pkgs.runtimeShell}
exec ${pkgs.ctags}/bin/ctags ${concatStringsSep " " (map escapeShellArg args)} "$@"
'') {
args = let x = pkgs.ctagsWrapped; in concatLists [
x.defaultArgs x.phpLang x.jsLang x.nixLang x.asLang x.rubyLang
];
name = "${ctags.name}-wrapped";
};
### language arguments
# don't scan version control directories
defaultArgs = [
"--exclude=.svn"
"--exclude=.hg"
"--exclude=.git"
"--exclude=_darcs"
"--sort=yes"
];
# actionscript
asLang = [
"--langdef=ActionScript"
"--langmap=ActionScript:.as"
"--regex-ActionScript=/function[ \\t]+([A-Za-z0-9_]+)[ \\t]*\\(/\\1/f,function,functions/"
"--regex-ActionScript=/function[ \\t]+(set|get)[ \\t]+([A-Za-z0-9_]+)[ \\t]*\\(/\\2/p,property,properties/"
"--regex-ActionScript=/interface[ \\t]+[a-z0-9_.]*([A-Z][A-Za-z0-9_]+)/\\1/i,interface,interfaces/"
"--regex-ActionScript=/package[ \\t]+([^ \\t]*)/\\1/p/"
"--regex-ActionScript=/class[ \\t]+[a-z0-9_.]*([A-Z][A-Za-z0-9_]+)/\\1/c,class,classes/"
];
# PHP
phpLang = [
"--langmap=PHP:.php"
"--regex-PHP=/abstract class ([^ ]*)/\\1/c/"
"--regex-PHP=/interface ([^ ]*)/\\1/i/"
"--regex-PHP=/function[ \\t]+([^ (]*)/\\1/f/"
];
# Javascript: also find unnamed functions and functions being passed within a dict.
# the dict properties is used to implement duck typing in frameworks
# var foo = function () { ... }
# {
# a : function () {}
# only recognize names up 100 characters. Else you'll be in trouble scanning compressed .js files.
jsLang = [
"--regex-JavaScript=/([^ \\t]{1,100})[ \\t]*:[ \\t]*function[ \\t]*\\(/\\1/f/"
];
# find foo in "foo =", don't think we can do a lot better
nixLang = [
"--langdef=NIX"
"--langmap=NIX:.nix"
"--regex-NIX=/([^ \\t*]*)[ \\t]*=/\\1/f/"
];
rubyLang = [
"--langmap=RUBY:.rb"
"--regex-RUBY=/class ([^ ]*)/\\1/c/"
"--regex-RUBY=/^[ ]*module[ ]*([^ ]*)/\\1/m/"
];
}

View file

@ -1,6 +1,6 @@
{ stdenvNoCC, fetchurl, newScope, lib, pkgs
, stdenv, overrideCC
, xar, cpio, python3, pbzx }:
, xar, cpio, python3, pbzx, path }:
let
mkSusDerivation = args: stdenvNoCC.mkDerivation (args // {
@ -120,7 +120,7 @@ let
inherit (pkgs.darwin.apple_sdk_11_0) stdenv;
inherit (pkgs) rustc cargo;
} // {
inherit (pkgs.callPackage ../../../build-support/rust/hooks {
inherit (pkgs.callPackage (path + "/pkgs/build-support/rust/hooks") {
inherit (pkgs.darwin.apple_sdk_11_0) stdenv;
inherit (pkgs) cargo rustc;
clang = mkCc pkgs.clang;

View file

@ -3,6 +3,7 @@
runCommand,
writeText,
sdkVersion,
path
}:
let
@ -39,7 +40,7 @@ runCommand "sdkroot-${sdkVersion}" { } ''
ln -s "$sdk" "$sdk/usr"
install -D '${../../../build-support/setup-hooks/role.bash}' "$out/nix-support/setup-hook"
install -D '${path + "/pkgs/build-support/setup-hooks/role.bash"}' "$out/nix-support/setup-hook"
cat >> "$out/nix-support/setup-hook" <<-hook
#
# See comments in cc-wrapper's setup hook. This works exactly the same way.
@ -47,7 +48,7 @@ runCommand "sdkroot-${sdkVersion}" { } ''
[[ -z \''${strictDeps-} ]] || (( "\$hostOffset" < 0 )) || return 0
sdkRootHook() {
# See ../../../build-support/setup-hooks/role.bash
# See pkgs/build-support/setup-hooks/role.bash
local role_post
getHostRoleEnvHook
@ -57,7 +58,7 @@ runCommand "sdkroot-${sdkVersion}" { } ''
fi
}
# See ../../../build-support/setup-hooks/role.bash
# See pkgs/build-support/setup-hooks/role.bash
getTargetRole
addEnvHooks "\$targetOffset" sdkRootHook

View file

@ -1,6 +1,7 @@
{ stdenv, appleDerivation, lib
, enableStatic ? stdenv.hostPlatform.isStatic
, enableShared ? !stdenv.hostPlatform.isStatic
, path
}:
appleDerivation {
@ -27,8 +28,8 @@ appleDerivation {
'';
setupHooks = [
../../../../build-support/setup-hooks/role.bash
../../../../development/libraries/libiconv/setup-hook.sh
(path + "/pkgs/build-support/setup-hooks/role.bash")
(path + "/pkgs/by-name/li/libiconv/setup-hook.sh")
];
meta = {

View file

@ -0,0 +1,141 @@
{ lib, stdenvNoLibs, buildPackages
, gcc, glibc
, libiberty
}:
let
stdenv = stdenvNoLibs;
gccConfigureFlags = gcc.cc.configureFlags ++ [
"--disable-fixincludes"
"--disable-intl"
"--enable-threads=posix"
"--with-glibc-version=${glibc.version}"
"--disable-plugin"
# these are required in order to prevent inhibit_libc=true,
# which will cripple libgcc's unwinder; see:
# https://github.com/NixOS/nixpkgs/issues/213453#issuecomment-1616346163
"--with-headers=${lib.getDev glibc}/include"
"--with-native-system-header-dir=${lib.getDev glibc}${glibc.incdir or "/include"}"
"--with-build-sysroot=/"
];
in stdenv.mkDerivation (finalAttrs: {
pname = "libgcc";
inherit (gcc.cc) src version;
outputs = [ "out" "dev" ];
strictDeps = true;
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ libiberty ];
buildInputs = [ glibc ];
postUnpack = ''
mkdir -p ./build
buildRoot=$(readlink -e "./build")
'';
postPatch =
gcc.cc.passthru.forceLibgccToBuildCrtStuff
+ ''
sourceRoot=$(readlink -e "./libgcc")
'';
hardeningDisable = [ "pie" ];
preConfigure =
''
# Drop in libiberty, as external builds are not expected
cd "$buildRoot"
(
mkdir -p build-${stdenv.buildPlatform.config}/libiberty/
cd build-${stdenv.buildPlatform.config}/libiberty/
ln -s ${buildPackages.libiberty}/lib/libiberty.a ./
)
mkdir -p "$buildRoot/gcc"
cd "$buildRoot/gcc"
(
# We "shift" the tools over to fake platforms perspective from the previous stage.
export AS_FOR_BUILD=${buildPackages.stdenv.cc}/bin/$AS_FOR_BUILD
export CC_FOR_BUILD=${buildPackages.stdenv.cc}/bin/$CC_FOR_BUILD
export CPP_FOR_BUILD=${buildPackages.stdenv.cc}/bin/$CPP_FOR_BUILD
export CXX_FOR_BUILD=${buildPackages.stdenv.cc}/bin/$CXX_FOR_BUILD
export LD_FOR_BUILD=${buildPackages.stdenv.cc.bintools}/bin/$LD_FOR_BUILD
export AS=$AS_FOR_BUILD
export CC=$CC_FOR_BUILD
export CPP=$CPP_FOR_BUILD
export CXX=$CXX_FOR_BUILD
export LD=$LD_FOR_BUILD
export AS_FOR_TARGET=${stdenv.cc}/bin/$AS
export CC_FOR_TARGET=${stdenv.cc}/bin/$CC
export CPP_FOR_TARGET=${stdenv.cc}/bin/$CPP
export LD_FOR_TARGET=${stdenv.cc.bintools}/bin/$LD
# We define GENERATOR_FILE so nothing bothers looking for GNU GMP.
export NIX_CFLAGS_COMPILE_FOR_BUILD+=' -DGENERATOR_FILE=1'
"$sourceRoot/../gcc/configure" ${lib.concatStringsSep " " gccConfigureFlags}
# We remove the `libgcc.mvar` deps so that the bootstrap xgcc isn't built.
sed -e 's,libgcc.mvars:.*$,libgcc.mvars:,' -i Makefile
make \
config.h \
libgcc.mvars \
tconfig.h \
tm.h \
options.h \
insn-constants.h \
'' + lib.optionalString stdenv.targetPlatform.isM68k ''
sysroot-suffix.h \
'' + lib.optionalString stdenv.targetPlatform.isAarch32 ''
arm-isa.h \
arm-cpu.h \
'' + ''
insn-modes.h
)
mkdir -p "$buildRoot/gcc/include"
# Preparing to configure + build libgcc itself
mkdir -p "$buildRoot/gcc/${stdenv.hostPlatform.config}/libgcc"
cd "$buildRoot/gcc/${stdenv.hostPlatform.config}/libgcc"
configureScript=$sourceRoot/configure
chmod +x "$configureScript"
export AS_FOR_BUILD=${buildPackages.stdenv.cc}/bin/$AS_FOR_BUILD
export CC_FOR_BUILD=${buildPackages.stdenv.cc}/bin/$CC_FOR_BUILD
export CPP_FOR_BUILD=${buildPackages.stdenv.cc}/bin/$CPP_FOR_BUILD
export CXX_FOR_BUILD=${buildPackages.stdenv.cc}/bin/$CXX_FOR_BUILD
export LD_FOR_BUILD=${buildPackages.stdenv.cc.bintools}/bin/$LD_FOR_BUILD
export AS=${stdenv.cc}/bin/$AS
export CC=${stdenv.cc}/bin/$CC
export CPP=${stdenv.cc}/bin/$CPP
export CXX=${stdenv.cc}/bin/$CXX
export LD=${stdenv.cc.bintools}/bin/$LD
export AS_FOR_TARGET=${stdenv.cc}/bin/$AS_FOR_TARGET
export CC_FOR_TARGET=${stdenv.cc}/bin/$CC_FOR_TARGET
export CPP_FOR_TARGET=${stdenv.cc}/bin/$CPP_FOR_TARGET
export LD_FOR_TARGET=${stdenv.cc.bintools}/bin/$LD_FOR_TARGET
'';
configurePlatforms = [ "build" "host" ];
configureFlags = [
"cross_compiling=true"
"--disable-gcov"
"--with-glibc-version=${glibc.version}"
];
makeFlags = [ "MULTIBUILDTOP:=../" ];
postInstall = ''
moveToOutput "lib/gcc/${stdenv.hostPlatform.config}/${finalAttrs.version}/include" "$dev"
mkdir -p "$out/lib" "$dev/include"
ln -s "$out/lib/gcc/${stdenv.hostPlatform.config}/${finalAttrs.version}"/* "$out/lib"
ln -s "$dev/lib/gcc/${stdenv.hostPlatform.config}/${finalAttrs.version}/include"/* "$dev/include/"
'';
})

View file

@ -16,12 +16,11 @@ with pkgs;
# Being redundant to avoid cycles on boot. TODO: find a better way
glibcCross = callPackage ./. {
stdenv = gccCrossLibcStdenv; # doesn't compile without gcc
# TODO: Fix broken reference to libgcc
# libgcc = callPackage ../core/gcc/libgcc {
# gcc = gccCrossLibcStdenv.cc;
# glibc = glibcCross.override { libgcc = null; };
# stdenvNoLibs = gccCrossLibcStdenv;
# };
libgcc = callPackage ./libgcc {
gcc = gccCrossLibcStdenv.cc;
glibc = glibcCross.override { libgcc = null; };
stdenvNoLibs = gccCrossLibcStdenv;
};
};
# Only supported on Linux and only on glibc

View file

@ -0,0 +1,49 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, pkg-config
, libusb1
, udev
, Cocoa
, IOKit
# for passthru.tests
# , testers
}:
stdenv.mkDerivation (finalAttrs: {
pname = "hidapi";
version = "0.14.0";
src = fetchFromGitHub {
owner = "libusb";
repo = "hidapi";
rev = "${finalAttrs.pname}-${finalAttrs.version}";
sha256 = "sha256-p3uzBq5VxxQbVuy1lEHEEQdxXwnhQgJDIyAAWjVWNIg=";
};
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = lib.optionals stdenv.isLinux [ libusb1 udev ];
enableParallelBuilding = true;
propagatedBuildInputs = lib.optionals stdenv.isDarwin [ Cocoa IOKit ];
# passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
meta = with lib; {
description = "Library for communicating with USB and Bluetooth HID devices";
homepage = "https://github.com/libusb/hidapi";
maintainers = with maintainers; [ prusnak ];
# You can choose between GPLv3, BSD or HIDAPI license (even more liberal)
license = with licenses; [ bsd3 /* or */ gpl3Only ] ;
pkgConfigModules = lib.optionals stdenv.isDarwin [
"hidapi"
] ++ lib.optionals stdenv.isLinux [
"hidapi-hidraw"
"hidapi-libusb"
];
platforms = platforms.unix;
};
})

View file

@ -0,0 +1,9 @@
{ ... }:
res: pkgs: super:
with pkgs;
{
hidapi = callPackage ./. {
inherit (darwin.apple_sdk.frameworks) Cocoa IOKit;
};
}

View file

@ -0,0 +1,64 @@
{ lib
, stdenv
, fetchurl
, fetchpatch
, libintl
, texinfo
, buildPackages
, pkgsStatic
}:
stdenv.mkDerivation rec {
pname = "indent";
version = "2.2.13";
src = fetchurl {
url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz";
hash = "sha256-nmRjT8TOZ5eyBLy4iXzhT90KtIyldpb3h2fFnK5XgJU=";
};
patches = [
(fetchpatch {
name = "CVE-2023-40305.part-1.patch";
url = "https://git.savannah.gnu.org/cgit/indent.git/patch/?id=df4ab2d19e247d059e0025789ba513418073ab6f";
hash = "sha256-OLXBlYTdEuFK8SIsyC5Xr/hHWlvXiRqY2h79w+H5pGk=";
})
(fetchpatch {
name = "CVE-2023-40305.part-2.patch";
url = "https://git.savannah.gnu.org/cgit/indent.git/patch/?id=2685cc0bef0200733b634932ea7399b6cf91b6d7";
hash = "sha256-t+QF7N1aqQ28J2O8esZ2bc5K042cUuZR4MeMeuWIgPw=";
})
];
# avoid https://savannah.gnu.org/bugs/?64751
postPatch = ''
sed -E -i '/output\/else-comment-2-br(-ce)?.c/d' regression/TEST
sed -E -i 's/else-comment-2-br(-ce)?.c//g' regression/TEST
'';
makeFlags = [ "AR=${stdenv.cc.targetPrefix}ar" ];
strictDeps = true;
nativeBuildInputs = [ texinfo ];
buildInputs = [ libintl ];
depsBuildBuild = [ buildPackages.stdenv.cc ]; # needed when cross-compiling
env.NIX_CFLAGS_COMPILE = toString (
lib.optional stdenv.cc.isClang "-Wno-implicit-function-declaration"
++ lib.optional (stdenv.cc.isClang && lib.versionAtLeast (lib.getVersion stdenv.cc) "13") "-Wno-unused-but-set-variable"
);
hardeningDisable = [ "format" ];
doCheck = true;
passthru.tests.static = pkgsStatic.indent;
meta = {
homepage = "https://www.gnu.org/software/indent/";
description = "A source code reformatter";
mainProgram = "indent";
license = lib.licenses.gpl3Plus;
maintainers = [ lib.maintainers.mmahut ];
platforms = lib.platforms.unix;
};
}

View file

@ -0,0 +1,59 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, cmocka
# for passthru.tests
# , libfido2
# , mysql80
# , openssh
# , systemd
}:
stdenv.mkDerivation (finalAttrs: {
pname = "libcbor";
version = "0.11.0";
src = fetchFromGitHub {
owner = "PJK";
repo = "libcbor";
rev = "v${finalAttrs.version}";
hash = "sha256-N1xYkZw/6lX/nX/TE6/pVuEFgSyDiUJ50msK42NrKwI=";
};
outputs = [ "out" "dev" ];
strictDeps = true;
nativeBuildInputs = [ cmake ];
buildInputs = [
cmocka # cmake expects cmocka module
];
cmakeFlags = lib.optional finalAttrs.finalPackage.doCheck "-DWITH_TESTS=ON"
++ lib.optional (!stdenv.hostPlatform.isStatic) "-DBUILD_SHARED_LIBS=ON";
# Tests are restricted while pkgsStatic.cmocka is broken. Tracked at:
# https://github.com/NixOS/nixpkgs/issues/213623
doCheck = !stdenv.hostPlatform.isStatic
&& stdenv.hostPlatform == stdenv.buildPlatform;
nativeCheckInputs = [ cmocka ];
# passthru.tests = {
# inherit libfido2 mysql80;
# openssh = (openssh.override { withFIDO = true; });
# systemd = (systemd.override {
# withFido2 = true;
# withCryptsetup = true;
# });
# };
meta = with lib; {
description = "CBOR protocol implementation for C and others";
homepage = "https://github.com/PJK/libcbor";
license = licenses.mit;
maintainers = with maintainers; [ dtzWill ];
};
})

View file

@ -0,0 +1,34 @@
{ lib, stdenv, fetchFromGitHub, cmake, unstableGitUpdater }:
stdenv.mkDerivation {
pname = "libcxxrt";
version = "4.0.10-unstable-2024-04-15";
src = fetchFromGitHub {
owner = "libcxxrt";
repo = "libcxxrt";
rev = "25541e312f7094e9c90895000d435af520d42418";
sha256 = "d5uhtlO+28uc2Xnf5trXsy43jgmzBHs2jZhCK57qRM4=";
};
nativeBuildInputs = [ cmake ];
installPhase = ''
mkdir -p $out/include $out/lib
cp ../src/cxxabi.h $out/include
cp lib/libcxxrt${stdenv.hostPlatform.extensions.library} $out/lib
'';
passthru = {
libName = "cxxrt";
updateScript = unstableGitUpdater { };
};
meta = with lib; {
homepage = "https://github.com/libcxxrt/libcxxrt";
description = "Implementation of the Code Sourcery C++ ABI";
maintainers = with maintainers; [ qyliss ];
platforms = platforms.all;
license = licenses.bsd2;
};
}

View file

@ -0,0 +1,11 @@
{ ... }:
res: pkgs: super:
with pkgs;
{
libcxxrt = callPackage ./. {
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildPackages.llvmPackages.tools.clangNoLibcxx
else stdenv;
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, buildPackages
, staticBuild ? stdenv.hostPlatform.isStatic
}:
let inherit (buildPackages.buildPackages) gcc; in
stdenv.mkDerivation {
pname = "libiberty";
version = "${gcc.cc.version}";
inherit (gcc.cc) src;
outputs = [ "out" "dev" ];
postUnpack = "sourceRoot=\${sourceRoot}/libiberty";
configureFlags = [ "--enable-install-libiberty" ]
++ lib.optional (!staticBuild) "--enable-shared";
postInstall = lib.optionalString (!staticBuild) ''
cp pic/libiberty.a $out/lib*/libiberty.a
'';
meta = with lib; {
homepage = "https://gcc.gnu.org/";
license = licenses.lgpl2;
description = "Collection of subroutines used by various GNU programs";
maintainers = with maintainers; [ abbradar ericson2314 ];
platforms = platforms.unix;
};
}

View file

@ -2,6 +2,7 @@
, enableStatic ? stdenv.hostPlatform.isStatic
, enableShared ? !stdenv.hostPlatform.isStatic
, enableDarwinABICompat ? false
, path
}:
# assert !stdenv.hostPlatform.isLinux || stdenv.hostPlatform != stdenv.buildPlatform; # TODO: improve on cross
@ -18,7 +19,7 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
setupHooks = [
../../../build-support/setup-hooks/role.bash
(path + "/pkgs/build-support/setup-hooks/role.bash")
./setup-hook.sh
];

View file

@ -0,0 +1,74 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, autoreconfHook
, doxygen
, pkg-config
, enableUdev ? stdenv.isLinux && !stdenv.hostPlatform.isStatic
, udev
, libobjc
, IOKit
, Security
, withExamples ? false
, withStatic ? false
, withDocs ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
}:
stdenv.mkDerivation rec {
pname = "libusb";
version = "1.0.27";
src = fetchFromGitHub {
owner = "libusb";
repo = "libusb";
rev = "v${version}";
sha256 = "sha256-OtzYxWwiba0jRK9X+4deWWDDTeZWlysEt0qMyGUarDo=";
};
outputs = [ "out" "dev" ] ++ lib.optionals withDocs [ "doc" ];
nativeBuildInputs = [
pkg-config
autoreconfHook
] ++ lib.optionals withDocs [ doxygen ];
propagatedBuildInputs =
lib.optional enableUdev udev ++
lib.optionals stdenv.isDarwin [ libobjc IOKit Security ];
dontDisableStatic = withStatic;
# libusb-1.0.rc:11: fatal error: opening dependency file .deps/libusb-1.0.Tpo: No such file or directory
dontAddDisableDepTrack = stdenv.hostPlatform.isWindows;
configureFlags =
lib.optional (!enableUdev) "--disable-udev"
++ lib.optional (withExamples) "--enable-examples-build";
postBuild = lib.optionalString withDocs ''
make -C doc
mkdir -p "$doc/share/doc/libusb"
cp -r doc/api-1.0/* "$doc/share/doc/libusb/"
'';
preFixup = lib.optionalString enableUdev ''
sed 's,-ludev,-L${lib.getLib udev}/lib -ludev,' -i $out/lib/libusb-1.0.la
'';
postInstall = lib.optionalString withExamples ''
mkdir -p $out/{bin,sbin,examples/bin}
cp -r examples/.libs/* $out/examples/bin
ln -s $out/examples/bin/fxload $out/sbin/fxload
'';
meta = with lib; {
homepage = "https://libusb.info/";
description = "cross-platform user-mode USB device library";
longDescription = ''
libusb is a cross-platform user-mode library that provides access to USB devices.
'';
platforms = platforms.all;
license = licenses.lgpl21Plus;
maintainers = with maintainers; [ prusnak realsnick ];
};
}

View file

@ -0,0 +1,10 @@
{ ... }:
res: pkgs: super:
with pkgs;
{
libusb1 = callPackage ./. {
inherit (darwin) libobjc;
inherit (darwin.apple_sdk.frameworks) IOKit Security;
};
}

View file

@ -0,0 +1,27 @@
{ lib, stdenv
, fetchFromGitHub
, autoreconfHook
}:
stdenv.mkDerivation rec {
pname = "libyaml";
version = "0.2.5";
src = fetchFromGitHub {
owner = "yaml";
repo = "libyaml";
rev = version;
sha256 = "18zsnsxc53pans4a01cs4401a2cjk3qi098hi440pj4zijifgcsb";
};
outputs = [ "out" "dev" ];
nativeBuildInputs = [ autoreconfHook ];
meta = with lib; {
homepage = "https://pyyaml.org/";
description = "A YAML 1.1 parser and emitter written in C";
license = licenses.mit;
platforms = platforms.all;
};
}

View file

@ -0,0 +1,70 @@
{ lib, stdenv, fetchFromGitHub, fetchpatch #, valgrind
, enableStatic ? stdenv.hostPlatform.isStatic
, enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec {
pname = "lz4";
version = "1.9.4";
src = fetchFromGitHub {
sha256 = "sha256-YiMCD3vvrG+oxBUghSrCmP2LAfAGZrEaKz0YoaQJhpI=";
rev = "v${version}";
repo = pname;
owner = pname;
};
patches = [
(fetchpatch { # https://github.com/lz4/lz4/pull/1162
name = "build-shared-no.patch";
url = "https://github.com/lz4/lz4/commit/851ef4b23c7cbf4ceb2ba1099666a8b5ec4fa195.patch";
sha256 = "sha256-P+/uz3m7EAmHgXF/1Vncc0uKKxNVq6HNIsElx0rGxpw=";
})
];
# TODO(@Ericson2314): Separate binaries and libraries
outputs = [ "bin" "out" "dev" ];
# buildInputs = lib.optional doCheck valgrind;
enableParallelBuilding = true;
makeFlags = [
"PREFIX=$(out)"
"INCLUDEDIR=$(dev)/include"
"BUILD_STATIC=${if enableStatic then "yes" else "no"}"
"BUILD_SHARED=${if enableShared then "yes" else "no"}"
"WINDRES:=${stdenv.cc.bintools.targetPrefix}windres"
]
# TODO make full dictionary
++ lib.optional stdenv.hostPlatform.isMinGW "TARGET_OS=MINGW"
++ lib.optional stdenv.hostPlatform.isLinux "TARGET_OS=Linux"
;
# doCheck = false; # tests take a very long time
checkTarget = "test";
# TODO(@Ericson2314): Make resusable setup hook for this issue on Windows.
postInstall =
lib.optionalString stdenv.hostPlatform.isWindows ''
mv $out/bin/*.dll $out/lib
ln -s $out/lib/*.dll
''
+ ''
moveToOutput bin "$bin"
'';
meta = with lib; {
description = "Extremely fast compression algorithm";
longDescription = ''
Very fast lossless compression algorithm, providing compression speed
at 400 MB/s per core, with near-linear scalability for multi-threaded
applications. It also features an extremely fast decoder, with speed in
multiple GB/s per core, typically reaching RAM speed limits on
multi-core systems.
'';
homepage = "https://lz4.github.io/lz4/";
license = with licenses; [ bsd2 gpl2Plus ];
platforms = platforms.all;
};
}

View file

@ -0,0 +1,65 @@
{ lib, stdenv, fetchurl, cpio, xar, undmg, libtapi, DiskArbitration }:
stdenv.mkDerivation rec {
pname = "macfuse-stubs";
version = "4.4.1";
src = fetchurl {
url = "https://github.com/osxfuse/osxfuse/releases/download/macfuse-${version}/macfuse-${version}.dmg";
sha256 = "2a2d0f37ec5fcff547c5efa7d08539103a0b46bc16080c2b41a7e749f6e65c61";
};
nativeBuildInputs = [ cpio xar undmg libtapi ];
propagatedBuildInputs = [ DiskArbitration ];
postUnpack = ''
xar -xf 'Install macFUSE.pkg'
cd Core.pkg
gunzip -dc Payload | cpio -i
'';
sourceRoot = ".";
buildPhase = ''
pushd usr/local/lib
for f in *.dylib; do
tapi stubify --filetype=tbd-v2 "$f" -o "''${f%%.dylib}.tbd"
done
sed -i "s|^prefix=.*|prefix=$out|" pkgconfig/fuse.pc
popd
'';
# NOTE: Keep in mind that different parts of macFUSE are distributed under a
# different license
installPhase = ''
mkdir -p $out/include $out/lib/pkgconfig
cp usr/local/lib/*.tbd $out/lib
cp usr/local/lib/pkgconfig/*.pc $out/lib/pkgconfig
cp -R usr/local/include/* $out/include
'';
meta = with lib; {
homepage = "https://osxfuse.github.io";
description = "Build time stubs for FUSE on macOS";
longDescription = ''
macFUSE is required for this package to work on macOS. To install macFUSE,
use the installer from the <link xlink:href="https://osxfuse.github.io/">
project website</link>.
'';
platforms = platforms.darwin;
maintainers = with maintainers; [ midchildan ];
# macFUSE as a whole includes code with restrictions on commercial
# redistribution. However, the build artifacts that we actually touch for
# this derivation are distributed under a free license.
license = with licenses; [
lgpl2Plus # libfuse
];
};
passthru.warning = ''
macFUSE is required for this package to work on macOS. To install macFUSE,
use the installer from the <link xlink:href="https://osxfuse.github.io/">
project website</link>.
'';
}

View file

@ -0,0 +1,10 @@
{ ... }:
res: pkgs: super:
with pkgs;
{
macfuse-stubs = callPackage ./. {
inherit (darwin) libtapi;
inherit (darwin.apple_sdk.frameworks) DiskArbitration;
};
}

View file

@ -0,0 +1,63 @@
{
lib,
llvmPackages,
fetchFromGitHub,
opencflite,
libuuid,
zlib,
}:
let
stdenv = llvmPackages.libcxxStdenv;
in
stdenv.mkDerivation {
pname = "maloader";
version = "0-unstable-2018-05-02";
src = fetchFromGitHub {
owner = "shinh";
repo = "maloader";
rev = "464a90fdfd06a54c9da5d1a3725ed6229c0d3d60";
hash = "sha256-0N3+tr8XUsn3WhJNsPVknumBrfMgDawTEXVRkIs/IV8=";
};
postPatch = ''
substituteInPlace ld-mac.cc \
--replace-fail 'loadLibMac(mypath)' 'loadLibMac("${placeholder "out"}/lib/")' \
--replace-fail 'libCoreFoundation.so' '${opencflite}/lib/libCoreFoundation.so'
substituteInPlace libmac/stack_protector-obsd.c \
--replace-fail 'sys/sysctl.h' 'linux/sysctl.h'
'';
buildInputs = [
libuuid
zlib
];
buildFlags = [
"USE_LIBCXX=1"
"release"
];
env.NIX_CFLAGS_COMPILE = "-Wno-error=unused-command-line-argument";
installPhase = ''
runHook preInstall
install -vD libmac.so "$out/lib/libmac.so"
for bin in extract macho2elf ld-mac; do
install -vD "$bin" "$out/bin/$bin"
done
runHook postInstall
'';
meta = {
description = "Mach-O loader for Linux";
homepage = "https://github.com/shinh/maloader";
license = lib.licenses.bsd2;
maintainers = with lib.maintainers; [ wegank ];
inherit (opencflite.meta) platforms;
};
}

View file

@ -0,0 +1,8 @@
{ ... }:
res: pkgs: super:
with pkgs;
{
musl-fts = callPackage ./. { };
fts = if stdenv.hostPlatform.isMusl then musl-fts else null;
}

View file

@ -0,0 +1,24 @@
Subject: Add audit_token_to_pid()
Description: Apple provides audit_token_to_pid to get the pid of an
audit token. Unfortunately, they have never released this to the
OpenBSM project.
diff -r -u -p1 a/bsm/libbsm.h b/bsm/libbsm.h
--- a/bsm/libbsm.h 2009-04-15 16:45:54.000000000 -0500
+++ b/bsm/libbsm.h 2018-05-11 04:11:14.063083147 -0500
@@ -1298,1 +1298,2 @@ int audit_set_stat(au_stat_t *stats, siz
int audit_send_trigger(int *trigger);
+pid_t audit_token_to_pid(audit_token_t atoken);
diff -r -u -p1 a/libbsm/bsm_wrappers.c b/libbsm/bsm_wrappers.c
--- a/libbsm/bsm_wrappers.c 2009-04-15 16:46:06.000000000 -0500
+++ b/libbsm/bsm_wrappers.c 2018-05-11 04:10:15.710820393 -0500
@@ -823,1 +823,6 @@ audit_get_car(char *path, size_t sz)
}
+
+pid_t audit_token_to_pid(audit_token_t atoken)
+{
+ return atoken.val[5];
+}

View file

@ -0,0 +1,29 @@
{ stdenv, fetchFromGitHub, lib }:
stdenv.mkDerivation rec {
pname = "openbsm";
version = "1.1";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = lib.toUpper (builtins.replaceStrings ["." "-"] ["_" "_"] "${pname}-${version}");
sha256 = "0b98359hd8mm585sh145ss828pg2y8vgz38lqrb7nypapiyqdnd1";
};
patches = lib.optionals stdenv.isDarwin [ ./bsm-add-audit_token_to_pid.patch ];
preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") ''
MACOSX_DEPLOYMENT_TARGET=10.16
'';
configureFlags = [ "ac_cv_file__usr_include_mach_audit_triggers_defs=no" ];
meta = {
description = "An implementation of Sun's Basic Security Module (BSM) security audit API and file format";
homepage = "http://www.openbsm.org/";
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ matthewbauer ];
license = lib.licenses.bsd2;
};
}

View file

@ -0,0 +1,43 @@
{
lib,
stdenv,
fetchFromGitHub,
pkg-config,
icu,
libkqueue,
libuuid,
tzdata,
zlib,
}:
stdenv.mkDerivation rec {
pname = "opencflite";
version = "635.21.8";
src = fetchFromGitHub {
owner = "gerickson";
repo = "opencflite";
rev = "opencflite-${version}";
hash = "sha256-ijyj4SFYQ0wZAFM2ehNnR9+yu5yDTSVW3VBycBT9l+A=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [
icu
libkqueue
libuuid
tzdata
zlib
];
enableParallelBuilding = true;
meta = {
description = "Cross platform port of the macOS CoreFoundation";
homepage = "https://github.com/gerickson/opencflite";
license = lib.licenses.apple-psl20;
maintainers = with lib.maintainers; [ wegank ];
platforms = [ "x86_64-linux" ];
};
}

View file

@ -135,7 +135,7 @@ stdenv.mkDerivation rec {
homepage = "https://www.openldap.org/";
description = "An open source implementation of the Lightweight Directory Access Protocol";
license = licenses.openldap;
maintainers = with maintainers; [ hexa ] ++ teams.helsinki-systems.members;
maintainers = [ ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,19 @@
{ stdenv, fetchurl, lib }:
stdenv.mkDerivation rec {
pname = "openpam";
version = "20170430";
src = fetchurl {
url = "mirror://sourceforge/openpam/openpam/Resedacea/${pname}-${version}.tar.gz";
sha256 = "0pz8kf9mxj0k8yp8jgmhahddz58zv2b7gnyjwng75xgsx4i55xi2";
};
meta = with lib; {
homepage = "https://www.openpam.org";
description = "An open source PAM library that focuses on simplicity, correctness, and cleanliness";
platforms = platforms.unix;
maintainers = with maintainers; [ matthewbauer ];
license = licenses.bsd3;
};
}

View file

@ -13,7 +13,7 @@ in
};
extraPatches = [ ./ssh-keysign-8.5.patch ];
extraMeta.maintainers = lib.teams.helsinki-systems.members;
extraMeta.maintainers = [ ];
};
openssh_hpn = common rec {
@ -52,7 +52,7 @@ in
extraConfigureFlags = [ "--with-hpn" ];
extraMeta = {
maintainers = with lib.maintainers; [ abbe ];
maintainers = with lib.maintainers; [ ];
};
};

View file

@ -0,0 +1,112 @@
{ stdenv
, lib
, fetchFromGitLab
, autoreconfHook
, autoconf-archive
, flex
, pkg-config
, perl
, python3
, dbus
, polkit
, systemdLibs
, dbusSupport ? stdenv.isLinux
, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemdLibs
, udevSupport ? dbusSupport
, libusb1
, IOKit
, testers
, nix-update-script
, pname ? "pcsclite"
, polkitSupport ? false
}:
assert polkitSupport -> dbusSupport;
assert systemdSupport -> dbusSupport;
stdenv.mkDerivation (finalAttrs: {
inherit pname;
version = "2.1.0";
outputs = [ "out" "lib" "dev" "doc" "man" ];
src = fetchFromGitLab {
domain = "salsa.debian.org";
owner = "rousseau";
repo = "PCSC";
rev = "refs/tags/${finalAttrs.version}";
hash = "sha256-aJKI6pWrZJFmiTxZ9wgCuxKRWRMFVRAkzlo+tSqV8B4=";
};
configureFlags = [
"--enable-confdir=/etc"
# The OS should care on preparing the drivers into this location
"--enable-usbdropdir=/var/lib/pcsc/drivers"
(lib.enableFeature systemdSupport "libsystemd")
(lib.enableFeature polkitSupport "polkit")
"--enable-ipcdir=/run/pcscd"
] ++ lib.optionals systemdSupport [
"--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
] ++ lib.optionals (!udevSupport) [
"--disable-libudev"
];
makeFlags = [
"POLICY_DIR=$(out)/share/polkit-1/actions"
];
# disable building pcsc-wirecheck{,-gen} when cross compiling
# see also: https://github.com/LudovicRousseau/PCSC/issues/25
postPatch = lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
substituteInPlace src/Makefile.am \
--replace-fail "noinst_PROGRAMS = testpcsc pcsc-wirecheck pcsc-wirecheck-gen" \
"noinst_PROGRAMS = testpcsc"
'' + ''
substituteInPlace src/libredirect.c src/spy/libpcscspy.c \
--replace-fail "libpcsclite_real.so.1" "$lib/lib/libpcsclite_real.so.1"
'';
postInstall = ''
# pcsc-spy is a debugging utility and it drags python into the closure
moveToOutput bin/pcsc-spy "$dev"
'';
enableParallelBuilding = true;
nativeBuildInputs = [
autoreconfHook
autoconf-archive
flex
pkg-config
perl
];
buildInputs = [ python3 ]
++ lib.optionals systemdSupport [ systemdLibs ]
++ lib.optionals stdenv.isDarwin [ IOKit ]
++ lib.optionals dbusSupport [ dbus ]
++ lib.optionals polkitSupport [ polkit ]
++ lib.optionals (!udevSupport) [ libusb1 ];
passthru = {
tests = {
pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
version = testers.testVersion {
package = finalAttrs.finalPackage;
command = "pcscd --version";
};
};
updateScript = nix-update-script { };
};
meta = {
description = "Middleware to access a smart card using SCard API (PC/SC)";
homepage = "https://pcsclite.apdu.fr/";
changelog = "https://salsa.debian.org/rousseau/PCSC/-/blob/${finalAttrs.version}/ChangeLog";
license = lib.licenses.bsd3;
mainProgram = "pcscd";
maintainers = [ lib.maintainers.anthonyroussel ];
pkgConfigModules = [ "libpcsclite" ];
platforms = lib.platforms.unix;
};
})

View file

@ -0,0 +1,9 @@
{ ... }:
res: pkgs: super:
with pkgs;
{
pcsclite = callPackage ./. {
inherit (darwin.apple_sdk.frameworks) IOKit;
};
}

View file

@ -0,0 +1,29 @@
{ lib, buildPythonPackage, fetchPypi, isPy3k, glibcLocales, future }:
buildPythonPackage rec {
pname = "commonmark";
version = "0.9.1";
format = "setuptools";
src = fetchPypi {
inherit pname version;
sha256 = "452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60";
};
preCheck = ''
export LC_ALL="en_US.UTF-8"
'';
# UnicodeEncodeError on Python 2
doCheck = isPy3k;
nativeCheckInputs = [ glibcLocales ];
propagatedBuildInputs = [ future ];
meta = with lib; {
description = "Python parser for the CommonMark Markdown spec";
mainProgram = "cmark";
homepage = "https://github.com/rolandshoemaker/CommonMark-py";
license = licenses.bsd3;
};
}

View file

@ -0,0 +1,52 @@
{ lib
, buildPythonPackage
, fetchPypi
# build-system
, setuptools
}:
buildPythonPackage rec {
pname = "future";
version = "1.0.0";
pyproject = true;
src = fetchPypi {
inherit pname version;
hash = "sha256-vSloMJMHhh7a4UWKT4pPNZjAO+Q7l1IQdq6/XZTAewU=";
};
nativeBuildInputs = [
setuptools
];
pythonImportsCheck = [
"future.builtins"
"future.moves"
"future.standard_library"
"past.builtins"
"past.translation"
];
doCheck = false;
meta = {
changelog = "https://github.com/PythonCharmers/python-future/blob/v${version}/docs/whatsnew.rst";
description = "Clean single-source support for Python 3 and 2";
longDescription = ''
python-future is the missing compatibility layer between Python 2 and
Python 3. It allows you to use a single, clean Python 3.x-compatible
codebase to support both Python 2 and Python 3 with minimal overhead.
It provides future and past packages with backports and forward ports
of features from Python 3 and 2. It also comes with futurize and
pasteurize, customized 2to3-based scripts that helps you to convert
either Py2 or Py3 code easily to support both Python 2 and 3 in a
single clean Py3-style codebase, module by module.
'';
homepage = "https://python-future.org";
downloadPage = "https://github.com/PythonCharmers/python-future/releases";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ prikhi ];
};
}

View file

@ -0,0 +1,42 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, pytestCheckHook
, commonmark
, docutils
, sphinx
, isPy3k
}:
buildPythonPackage rec {
pname = "recommonmark";
version = "0.7.1";
format = "setuptools";
src = fetchFromGitHub {
owner = "rtfd";
repo = pname;
rev = version;
sha256 = "0kwm4smxbgq0c0ybkxfvlgrfb3gq9amdw94141jyykk9mmz38379";
};
nativeCheckInputs = [ pytestCheckHook ];
propagatedBuildInputs = [ commonmark docutils sphinx ];
dontUseSetuptoolsCheck = true;
disabledTests = [
# https://github.com/readthedocs/recommonmark/issues/164
"test_lists"
"test_integration"
];
doCheck = !isPy3k; # Not yet compatible with latest Sphinx.
pythonImportsCheck = [ "recommonmark" ];
meta = {
description = "A docutils-compatibility bridge to CommonMark";
homepage = "https://github.com/rtfd/recommonmark";
license = lib.licenses.mit;
};
}

View file

@ -2384,7 +2384,7 @@ self: super: with self; {
# commoncode = callPackage ./python-modules/commoncode { };
# commonmark = callPackage ./python-modules/commonmark { };
commonmark = callPackage ./python-modules/commonmark { };
# compiledb = callPackage ./python-modules/compiledb { };
@ -4562,7 +4562,7 @@ self: super: with self; {
# fusepy = callPackage ./python-modules/fusepy { };
# future = callPackage ./python-modules/future { };
future = callPackage ./python-modules/future { };
# future-fstrings = callPackage ./python-modules/future-fstrings { };
@ -13030,7 +13030,7 @@ self: super: with self; {
# python3Packages = self;
# });
# recommonmark = callPackage ./python-modules/recommonmark { };
recommonmark = callPackage ./python-modules/recommonmark { };
# reconplogger = callPackage ./python-modules/reconplogger { };

View file

@ -0,0 +1,30 @@
{ lib, stdenv, fetchFromGitHub, zlib, bzip2, lzfse, pkg-config }:
stdenv.mkDerivation rec {
version = "1.1.0";
pname = "undmg";
src = fetchFromGitHub {
owner = "matthewbauer";
repo = "undmg";
rev = "v${version}";
sha256 = "0rb4h89jrl04vwf6p679ipa4mp95hzmc1ca11wqbanv3xd1kcpxm";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ zlib bzip2 lzfse ];
setupHook = ./setup-hook.sh;
makeFlags = [ "PREFIX=$(out)" ];
meta = with lib; {
homepage = "https://github.com/matthewbauer/undmg";
description = "Extract a DMG file";
license = licenses.gpl3;
platforms = platforms.all;
maintainers = with maintainers; [ matthewbauer lnl7 ];
mainProgram = "undmg";
};
}

View file

@ -0,0 +1,5 @@
unpackCmdHooks+=(_tryUnpackDmg)
_tryUnpackDmg() {
if ! [[ "$curSrc" =~ \.dmg$ ]]; then return 1; fi
undmg "$curSrc"
}

View file

@ -0,0 +1,39 @@
{ lib, stdenv, fetchFromGitHub, cmake
# for passthru.tests
# , tmux
# , fcft
# , arrow-cpp
}:
stdenv.mkDerivation rec {
pname = "utf8proc";
version = "2.9.0";
src = fetchFromGitHub {
owner = "JuliaStrings";
repo = pname;
rev = "v${version}";
sha256 = "sha256-Sgh8vTbclUV+lFZdR29PtNUy8F+9L/OAXk647B+l2mg=";
};
nativeBuildInputs = [ cmake ];
cmakeFlags = [
"-DBUILD_SHARED_LIBS=ON"
"-DUTF8PROC_ENABLE_TESTING=ON"
];
doCheck = true;
# passthru.tests = {
# inherit fcft tmux arrow-cpp;
# };
meta = with lib; {
description = "A clean C library for processing UTF-8 Unicode data";
homepage = "https://juliastrings.github.io/utf8proc/";
license = licenses.mit;
platforms = platforms.all;
maintainers = [ maintainers.ftrvxmtrx maintainers.sternenseemann ];
};
}

View file

@ -74,7 +74,7 @@ in stdenv.mkDerivation {
description = "Xcode-compatible build tool";
homepage = "https://github.com/facebook/xcbuild";
platforms = platforms.unix;
maintainers = with maintainers; [ copumpkin matthewbauer ];
maintainers = with maintainers; [ ];
license = with licenses; [ bsd2 bsd3 ];
};
}