Commit: 2f4e64cd20d2afcb26294dac84a6a745d0aa2adf
Parent: f532d110fb11ed60f52c8db53d537b82428f2be8
Author: Randy Palamar
Date:   Tue, 10 Sep 2024 07:36:10 -0600
add u-config a tiny pkg-config clone
Unfortunately I still need to use this garbage when building other
peoples code so might as well use a good version.
Diffstat:
7 files changed, 40 insertions(+), 5 deletions(-)
diff --git a/.gitmodules b/.gitmodules
@@ -31,6 +31,9 @@
 	path = pkg/devel/the_silver_searcher/src
 	url = https://github.com/ggreer/the_silver_searcher.git
 	ignore = all
+[submodule "pkg/devel/u-config/src"]
+	path = pkg/devel/u-config/src
+	url = https://github.com/skeeto/u-config.git
 [submodule "pkg/editors/vis/src"]
 	path = pkg/editors/vis/src
 	url = https://github.com/martanne/vis.git
diff --git a/README.md b/README.md
@@ -17,11 +17,12 @@ Changes
 
 Additional Packages
 -------------------
-* [hyx][] - tiny hex editor
-* [libgit2][] - no network support; needed for stagit.
-* [optipng][] - PNG image optimizer
-* [spm][] - simpler pass
-* [stagit][] - static webpage generator for git repos.
+* [hyx][]      - tiny hex editor
+* [libgit2][]  - no network support; needed for stagit.
+* [optipng][]  - PNG image optimizer
+* [spm][]      - simpler pass
+* [stagit][]   - static webpage generator for git repos.
+* [u-config][] - tiny pkg-config clone that doesn't require libc on amd64.
 
 [hyx]: https://yx7.cc/code/
 [libgit2]: https://github.com/libgit2/libgit2
@@ -30,3 +31,4 @@ Additional Packages
 [optipng]: https://optipng.sourceforge.net/
 [spm]: https://github.com/rnpnr/spm
 [stagit]: https://git.codemadness.org/stagit/file/README.html
+[u-config]: https://github.com/skeeto/u-config/
diff --git a/pkg/devel/gen.lua b/pkg/devel/gen.lua
@@ -7,3 +7,4 @@ subgen('qbe')
 subgen('samurai')
 subgen('strace')
 subgen('the_silver_searcher')
+subgen('u-config')
diff --git a/pkg/devel/u-config/gen.lua b/pkg/devel/u-config/gen.lua
@@ -0,0 +1,26 @@
+-- TODO: i686 support?
+local arch = ({
+	x86_64='x86_64',
+})[config.target.platform:match('[^-]*')]
+if not arch then arch = 'generic' end
+
+local archcflags = {}
+local archldflags = {}
+archcflags['generic']  = {}
+archldflags['generic'] = {}
+archcflags['x86_64']   = {'-fno-stack-protector', '-ffreestanding', '-fno-builtin'}
+archldflags['x86_64']  = {'-nostartfiles'}
+
+local archexe = {}
+archexe['generic'] = function() exe('u-config', {'generic_main.c'}) end
+archexe['x86_64']  = function() exe('u-config', {'linux_amd64_main.c'}) end
+
+cflags(archcflags[arch])
+set('ldflags', '$ldflags '..table.concat(archldflags[arch], ' '))
+
+archexe[arch]()
+file('bin/u-config', '755', '$outdir/u-config')
+sym('bin/pkg-config', 'u-config')
+man({'u-config.1'})
+
+fetch('git')
diff --git a/pkg/devel/u-config/src b/pkg/devel/u-config/src
@@ -0,0 +1 @@
+Subproject commit dee0676fbf4fdf470d7fcde7bbc29b0f0941ed4f
diff --git a/pkg/devel/u-config/ver b/pkg/devel/u-config/ver
@@ -0,0 +1 @@
+0.33.1
diff --git a/sets.lua b/sets.lua
@@ -27,6 +27,7 @@ S.bin = {
 	'strace',
 	'the_silver_searcher',
 	'transmission',
+	'u-config',
 	'vis',
 }