Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From fe256f79a66e1098707dd1e5b79ed4920d7a13c4 Mon Sep 17 00:00:00 2001
From: Henri Menke <henri@henrimenke.de>
Date: Thu, 9 Apr 2026 07:12:04 +0000
Subject: [PATCH] Makefile: add STATIC and DYNAMIC build variables

---
libutempter/Makefile | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/libutempter/Makefile b/libutempter/Makefile
index 5634d03..7014ca4 100644
--- a/libutempter/Makefile
+++ b/libutempter/Makefile
@@ -27,7 +27,15 @@ SONAME = $(SHAREDLIB).$(MAJOR)
STATICLIB = lib$(PROJECT).a
MAP = lib$(PROJECT).map

-TARGETS = $(PROJECT) $(SHAREDLIB)
+STATIC ?= 0
+DYNAMIC ?= 1
+TARGETS = $(PROJECT)
+ifeq ($(DYNAMIC),1)
+TARGETS += $(SHAREDLIB)
+endif
+ifeq ($(STATIC),1)
+TARGETS += $(STATICLIB)
+endif

INSTALL = install
libdir = /usr/lib
@@ -81,9 +89,14 @@ install:
$(DESTDIR)$(includedir) $(DESTDIR)$(man3dir)
$(INSTALL) -p -m2711 $(PROJECT) $(DESTDIR)$(libexecdir)/$(PROJECT)/
$(INSTALL) -p -m644 $(PROJECT).h $(DESTDIR)$(includedir)/
+ifeq ($(DYNAMIC),1)
$(INSTALL) -p -m755 $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SHAREDLIB).$(VERSION)
ln -fns $(SHAREDLIB).$(VERSION) $(DESTDIR)$(libdir)/$(SONAME)
ln -fns $(SONAME) $(DESTDIR)$(libdir)/$(SHAREDLIB)
+endif
+ifeq ($(STATIC),1)
+ $(INSTALL) -p -m644 $(STATICLIB) $(DESTDIR)$(libdir)/
+endif
$(INSTALL) -p -m644 $(PROJECT).3 $(DESTDIR)$(man3dir)/
for n in lib$(PROJECT) utempter_add_record utempter_remove_record \
utempter_remove_added_record utempter_set_helper; do \
42 changes: 30 additions & 12 deletions pkgs/by-name/li/libutempter/package.nix
Original file line number Diff line number Diff line change
@@ -1,35 +1,53 @@
{
stdenv,
fetchurl,
fetchFromGitHub,
fetchpatch,
lib,
glib,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "libutempter";
version = "1.2.1";
version = "1.2.3";

src = fetchurl {
url = "https://ftp.altlinux.org/pub/people/ldv/utempter/libutempter-${finalAttrs.version}.tar.gz";
sha256 = "sha256-ln/vNy85HeUBhDrYdXDGz12r2WUfAPF4MJD7wSsqNMs=";
src = fetchFromGitHub {
owner = "altlinux";
repo = "libutempter";
tag = "${finalAttrs.version}-alt1";
hash = "sha256-CiRZiEXzfOrtx1XXdMG2QZqzRtvY5mdA4SwTHRxkLUI=";
};

sourceRoot = "${finalAttrs.src.name}/libutempter";

buildInputs = [ glib ];

patches = [ ./exec_path.patch ];
patches = [
./exec_path.patch
(fetchpatch {
name = "build-overwrite-already-existing-symlinks-during-ins.patch";
url = "https://github.com/altlinux/libutempter/commit/717116b93d496a19f7f8abf8702517de0053f66e.patch";
hash = "sha256-4YaxgbORNm+rlp0YzYKj5a7/zJl1dxo72i/Rei9qulg=";
})
./Makefile-add-STATIC-and-DYNAMIC-build-variables.patch # https://github.com/altlinux/libutempter/pull/9
];

patchFlags = [ "-p2" ];

prePatch = ''
substituteInPlace Makefile --replace 2711 0711
'';

makeFlags = [
"libdir=\${out}/lib"
"libexecdir=\${out}/lib"
"includedir=\${out}/include"
"mandir=\${out}/share/man"
];
makeFlags =
lib.optionals stdenv.hostPlatform.isStatic [
"DYNAMIC=0"
"STATIC=1"
]
++ [
"libdir=\${out}/lib"
"libexecdir=\${out}/lib"
"includedir=\${out}/include"
"mandir=\${out}/share/man"
];

meta = {
homepage = "https://github.com/altlinux/libutempter";
Expand Down
Loading