cdb: 0.75 -> 20251021

This commit is contained in:
Xiangyan Sun
2026-05-05 00:10:40 -07:00
parent 15c8ea3b6e
commit 0850fe595b
2 changed files with 50 additions and 44 deletions

View File

@@ -0,0 +1,22 @@
diff --git a/instcopy.c b/instcopy.c
index 5e3b245..a1270ce 100644
--- a/instcopy.c
+++ b/instcopy.c
@@ -31,8 +31,6 @@ void hier_h(const char *home,num mode)
if (mkdir(home,0700) == -1)
if (errno != EEXIST)
strerr_die4sys(111,FATAL,"unable to mkdir ",home,": ");
- if (chmod(home,mode) == -1)
- strerr_die4sys(111,FATAL,"unable to chmod ",home,": ");
}
void hier_d(const char *home,const char *subdir,num mode)
@@ -42,8 +40,6 @@ void hier_d(const char *home,const char *subdir,num mode)
if (mkdir(subdir,0700) == -1)
if (errno != EEXIST)
strerr_die6sys(111,FATAL,"unable to mkdir ",home,"/",subdir,": ");
- if (chmod(subdir,mode) == -1)
- strerr_die6sys(111,FATAL,"unable to chmod ",home,"/",subdir,": ");
}
static char inbuf_space[INBUF_SIZE];

View File

@@ -2,72 +2,56 @@
stdenv,
lib,
fetchurl,
fetchFromGitHub,
}:
let
version = "0.75";
sha256 = "1iajg55n47hqxcpdzmyq4g4aprx7bzxcp885i850h355k5vmf68r";
# Please dont forget to update the docs:
# clone https://github.com/Profpatsch/cdb-docs
# and create a pull request with the result of running
# ./update <version>
# from the repositorys root folder.
docRepo = fetchFromGitHub {
owner = "Profpatsch";
repo = "cdb-docs";
rev = "359b6c55c9e170ebfc88f3f38face8ae2315eacb";
sha256 = "1y0ivviy58i0pmavhvrpznc4yjigjknff298gnw9rkg5wxm0gbbq";
};
in
stdenv.mkDerivation {
stdenv.mkDerivation (finalAttrs: {
pname = "cdb";
inherit version;
version = "20251021";
src = fetchurl {
url = "https://cr.yp.to/cdb/cdb-${version}.tar.gz";
inherit sha256;
url = "https://cdb.cr.yp.to/cdb-${finalAttrs.version}.tar.gz";
hash = "sha256-jlMdY5C818mky9Fv7TYybu546LDlwHg6gVimp5Q3490=";
};
outputs = [
"bin"
"doc"
"out"
"doc"
"man"
];
env.NIX_CFLAGS_COMPILE = toString [
"-Wno-error=implicit-int"
"-Wno-error=implicit-function-declaration"
patches = [
# disable chmod on output directories
./disable-chmod-dirs.patch
];
postPatch = ''
# A little patch, borrowed from Archlinux AUR, borrowed from Gentoo Portage
sed -e 's/^extern int errno;$/#include <errno.h>/' -i error.h
# Don't hardcode gcc
substituteInPlace conf-cc conf-ld --replace-fail 'gcc' '${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc'
'';
configurePhase = ''
runHook preConfigure
# Set install prefix to output directory
echo "$out" > conf-home
runHook postConfigure
'';
postInstall = ''
# don't use make setup, but move the binaries ourselves
mkdir -p $bin/bin
install -m 755 -t $bin/bin/ cdbdump cdbget cdbmake cdbmake-12 cdbmake-sv cdbstats cdbtest
mkdir -p $man/share/man/man1 $man/share/man/man3
cp doc/man/*.1 $man/share/man/man1/
cp doc/man/*.3 $man/share/man/man3/
# patch paths in scripts
function cdbmake-subst {
substituteInPlace $bin/bin/$1 \
--replace /usr/local/bin/cdbmake $bin/bin/cdbmake
}
cdbmake-subst cdbmake-12
cdbmake-subst cdbmake-sv
# docs
mkdir -p $doc/share/cdb
cp -r "${docRepo}/docs" $doc/share/cdb/html
mkdir -p $doc/share/doc/cdb
cp doc/*.md $doc/share/doc/cdb/
cp -r doc/html $doc/share/doc/cdb/
'';
meta = {
homepage = "https://cr.yp.to/cdb.html";
homepage = "https://cdb.cr.yp.to/";
license = lib.licenses.publicDomain;
maintainers = [ ];
platforms = lib.platforms.unix;
};
}
})