void-packages/srcpkgs/dar/patches/musl-getopt.patch
Đoàn Trần Công Danh b6bcd8cd34 srcpkgs/d*: convert patches to -Np1
* daemontools and dmraid is kept at -Np0

```sh

git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

19 lines
748 B
Diff

Since the musl libc constellation results in unistd.h being
included, which defines the getopt() function but not the
getopt globals, define them here as well.
--- a/src/dar_suite/my_getopt_long.h 2015-10-17 10:42:50.000000000 +0200
+++ b/src/dar_suite/my_getopt_long.h 2015-10-18 13:13:32.631006858 +0200
@@ -27,6 +27,12 @@
#ifndef MY_GETOPT_LONG_H
#define MY_GETOPT_LONG_H
+#if !defined(__GLIBC__)
+// declare externs which would be defined when including getopt.h
+extern char *optarg;
+extern int optind, opterr, optopt, optreset;
+#endif
+
// getopt may be declated in <unistd.h> on systems like FreeBSD.
// if you want to use libgnugetopt you need to include <getopt.h>
// on this system. Thus a conflict appear because the getopt is