summaryrefslogtreecommitdiff
path: root/devel/efivar/files
diff options
context:
space:
mode:
Diffstat (limited to 'devel/efivar/files')
-rw-r--r--devel/efivar/files/patch-Make.rules15
-rw-r--r--devel/efivar/files/patch-src-Makefile18
-rw-r--r--devel/efivar/files/patch-src-efivar.c51
-rw-r--r--devel/efivar/files/patch-src-efivar.h28
-rw-r--r--devel/efivar/files/patch-src-efivar.pc.in19
-rw-r--r--devel/efivar/files/patch-src-efivarfs.c29
-rw-r--r--devel/efivar/files/patch-src-guid.c44
-rw-r--r--devel/efivar/files/patch-src-guid.h20
-rw-r--r--devel/efivar/files/patch-src-test-Makefile11
-rw-r--r--devel/efivar/files/patch-src-test-tester.c14
-rw-r--r--devel/efivar/files/patch-src-vars.c47
-rw-r--r--devel/efivar/files/patch-src_compiler.h13
-rw-r--r--devel/efivar/files/patch-src_creator.c26
-rw-r--r--devel/efivar/files/patch-src_disk.c32
-rw-r--r--devel/efivar/files/patch-src_dp.h13
-rw-r--r--devel/efivar/files/patch-src_efisecdb.c38
-rw-r--r--devel/efivar/files/patch-src_efivar.c31
-rw-r--r--devel/efivar/files/patch-src_efivarfs.c162
-rw-r--r--devel/efivar/files/patch-src_gpt.c59
-rw-r--r--devel/efivar/files/patch-src_include_defaults.mk26
-rw-r--r--devel/efivar/files/patch-src_include_gcc.specs8
-rw-r--r--devel/efivar/files/patch-src_linux.c108
-rw-r--r--devel/efivar/files/patch-src_mntent.h192
-rw-r--r--devel/efivar/files/patch-src_test_tester.c13
-rw-r--r--devel/efivar/files/patch-src_thread-test.c22
-rw-r--r--devel/efivar/files/patch-src_time.c20
-rw-r--r--devel/efivar/files/patch-src_util.h13
27 files changed, 776 insertions, 296 deletions
diff --git a/devel/efivar/files/patch-Make.rules b/devel/efivar/files/patch-Make.rules
deleted file mode 100644
index 24d302516477..000000000000
--- a/devel/efivar/files/patch-Make.rules
+++ /dev/null
@@ -1,15 +0,0 @@
---- Make.rules.orig 2014-10-15 13:48:49 UTC
-+++ Make.rules
-@@ -2,10 +2,10 @@
- $(AR) -cvqs $@ $^
-
- % : %.o
-- $(CCLD) $(ccldflags) -o $@ $^ $(foreach lib,$(LIBS),-l$(lib))
-+ $(CCLD) $(ccldflags) -o $@ $^ $(LIBS)
-
- %.so.$(SONAME_VERSION) :
-- $(CCLD) $(cflags) -Wl,-soname,$(SONAME) $(ccldflags) $(LIBFLAGS) $^ -o $@ $(foreach lib,$(LIBS),-l$(lib))
-+ $(CCLD) $(cflags) -Wl,-soname,$(SONAME) $(ccldflags) $(LIBFLAGS) $^ -o $@ $(LIBS)
-
- %.so : %.so.$(SONAME_VERSION)
- ln -sf $^ $@
diff --git a/devel/efivar/files/patch-src-Makefile b/devel/efivar/files/patch-src-Makefile
deleted file mode 100644
index f0fdf02e6ac4..000000000000
--- a/devel/efivar/files/patch-src-Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
---- src/Makefile.orig 2014-10-15 13:48:49 UTC
-+++ src/Makefile
-@@ -15,14 +15,13 @@ all : $(LIBTARGETS) $(PCTARGETS) $(BINTA
- OBJECTS = lib.o vars.o efivarfs.o guid.o guidlist.o guid-symbols.o
- DEPS = .lib.c.P .efivar.c.P .efivar.h.P .vars.c.P .lib.h.P \
- .generics.h.P .guid.h.P .guid.c.P
--LIBS = dl
-
- libefivar.a :: $(OBJECTS)
-
- libefivar.so.$(SONAME_VERSION) :: $(OBJECTS)
-
- efivar : efivar.o libefivar.so
-- $(CCLD) $(ccldflags) -L. -lefivar -o $@ $^ -lpopt $(foreach lib,$(LIBS),-l$(lib))
-+ $(CCLD) $(ccldflags) -L. -lefivar -o $@ $^ -lpopt $(LIBS)
-
- efivar.pc : efivar.pc.in
- sed -e "s,@@VERSION@@,$(VERSION),g" \
diff --git a/devel/efivar/files/patch-src-efivar.c b/devel/efivar/files/patch-src-efivar.c
deleted file mode 100644
index a06dddab8713..000000000000
--- a/devel/efivar/files/patch-src-efivar.c
+++ /dev/null
@@ -1,51 +0,0 @@
---- src/efivar.c.orig 2014-10-15 15:48:49.000000000 +0200
-+++ src/efivar.c 2015-01-19 15:41:34.000000000 +0100
-@@ -16,11 +16,11 @@
- * along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
--#include <ctype.h>
- #include <fcntl.h>
- #include <popt.h>
- #include <stdio.h>
- #include <stdlib.h>
-+#include <sys/endian.h>
- #include <sys/mman.h>
- #include <sys/types.h>
- #include <sys/stat.h>
-@@ -53,7 +53,7 @@ list_all_variables(void)
- int rc;
- while ((rc = efi_get_next_variable_name(&guid, &name)) > 0)
- printf(GUID_FORMAT "-%s\n",
-- guid->a, guid->b, guid->c, bswap_16(guid->d),
-+ guid->a, guid->b, guid->c, bswap16(guid->d),
- guid->e[0], guid->e[1], guid->e[2], guid->e[3],
- guid->e[4], guid->e[5], name);
-
-@@ -142,7 +142,7 @@ show_variable(char *guid_name)
- }
-
- printf("GUID: "GUID_FORMAT "\n",
-- guid.a, guid.b, guid.c, bswap_16(guid.d),
-+ guid.a, guid.b, guid.c, bswap16(guid.d),
- guid.e[0], guid.e[1], guid.e[2], guid.e[3],
- guid.e[4], guid.e[5]);
- printf("Name: \"%s\"\n", name);
-@@ -240,7 +240,7 @@ prepare_data(const char *filename, void
- goto err;
-
- buflen = statbuf.st_size;
-- buf = mmap(NULL, buflen, PROT_READ, MAP_PRIVATE|MAP_POPULATE, fd, 0);
-+ buf = mmap(NULL, buflen, PROT_READ, MAP_PRIVATE, fd, 0);
- if (!buf)
- goto err;
-
-@@ -338,7 +338,7 @@ int main(int argc, char *argv[])
- {
- printf("{"GUID_FORMAT"} {%s} %s %s\n",
- guid->guid.a, guid->guid.b,
-- guid->guid.c, bswap_16(guid->guid.d),
-+ guid->guid.c, bswap16(guid->guid.d),
- guid->guid.e[0], guid->guid.e[1],
- guid->guid.e[2], guid->guid.e[3],
- guid->guid.e[4], guid->guid.e[5],
diff --git a/devel/efivar/files/patch-src-efivar.h b/devel/efivar/files/patch-src-efivar.h
deleted file mode 100644
index 80c6a8ccbd57..000000000000
--- a/devel/efivar/files/patch-src-efivar.h
+++ /dev/null
@@ -1,28 +0,0 @@
---- src/efivar.h.orig 2014-10-15 15:48:49.000000000 +0200
-+++ src/efivar.h 2015-01-19 15:32:22.000000000 +0100
-@@ -25,7 +25,6 @@
- #include <sys/stat.h>
- #include <sys/types.h>
- #include <unistd.h>
--#include <byteswap.h>
-
- typedef struct {
- uint32_t a;
-@@ -40,7 +39,7 @@ typedef struct {
- #endif
-
- #define EFI_GUID(a,b,c,d,e0,e1,e2,e3,e4,e5) \
--((efi_guid_t) {(a), (b), (c), bswap_16(d), { (e0), (e1), (e2), (e3), (e4), (e5) }})
-+((efi_guid_t) {(a), (b), (c), bswap16(d), { (e0), (e1), (e2), (e3), (e4), (e5) }})
-
- #define EFI_GLOBAL_GUID EFI_GUID(0x8be4df61,0x93ca,0x11d2,0xaa0d,0x00,0xe0,0x98,0x03,0x2b,0x8c)
-
-@@ -85,7 +84,7 @@ efi_set_variable(efi_guid_t guid, const
- return -1;
- }
-
-- if (__va_arg_pack_len() == 0)
-+ if (__builtin_va_arg_pack_len() == 0)
- return _efi_set_variable(guid, name, data, data_size,
- attributes, 0644);
-
diff --git a/devel/efivar/files/patch-src-efivar.pc.in b/devel/efivar/files/patch-src-efivar.pc.in
deleted file mode 100644
index 1220e37ce7df..000000000000
--- a/devel/efivar/files/patch-src-efivar.pc.in
+++ /dev/null
@@ -1,19 +0,0 @@
---- src/efivar.pc.in.orig 2014-10-15 15:48:49.000000000 +0200
-+++ src/efivar.pc.in 2015-01-19 16:23:12.000000000 +0100
-@@ -1,10 +1,11 @@
--prefix=/usr
--exec_prefix=/usr
--libdir=@@LIBDIR@@
--includedir=/usr/include
-+prefix=%%PREFIX%%
-+exec_prefix=${prefix}
-+libdir=${exec_prefix}/lib
-+includedir=${prefix}/include
-
- Name: efivar
- Description: UEFI Variable Management
- Version: @@VERSION@@
- Requires:
--Libs: -L${libdir} -lefivar -ldl
-+Libs: -L${libdir} -lefivar
-+Cflags: -I${includedir}
diff --git a/devel/efivar/files/patch-src-efivarfs.c b/devel/efivar/files/patch-src-efivarfs.c
deleted file mode 100644
index f28f06f61598..000000000000
--- a/devel/efivar/files/patch-src-efivarfs.c
+++ /dev/null
@@ -1,29 +0,0 @@
---- src/efivarfs.c.orig 2015-01-19 15:38:34.000000000 +0100
-+++ src/efivarfs.c 2015-01-19 15:40:15.000000000 +0100
-@@ -18,15 +18,15 @@
-
- #include <errno.h>
- #include <fcntl.h>
--#include <linux/magic.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <sys/mman.h>
-+#include <sys/mount.h>
- #include <sys/types.h>
-+#include <sys/param.h>
- #include <sys/stat.h>
- #include <sys/uio.h>
--#include <sys/vfs.h>
- #include <unistd.h>
-
- #include "lib.h"
-@@ -66,7 +66,7 @@ efivarfs_probe(void)
- #define make_efivarfs_path(str, guid, name) ({ \
- asprintf(str, EFIVARS_PATH "%s-" GUID_FORMAT, \
- name, (guid).a, (guid).b, (guid).c, \
-- bswap_16((guid).d), \
-+ bswap16((guid).d), \
- (guid).e[0], (guid).e[1], (guid).e[2], \
- (guid).e[3], (guid).e[4], (guid).e[5]); \
- })
diff --git a/devel/efivar/files/patch-src-guid.c b/devel/efivar/files/patch-src-guid.c
deleted file mode 100644
index 314601d34995..000000000000
--- a/devel/efivar/files/patch-src-guid.c
+++ /dev/null
@@ -1,44 +0,0 @@
---- src/guid.c.orig 2015-01-19 15:37:01.000000000 +0100
-+++ src/guid.c 2015-01-19 15:37:10.000000000 +0100
-@@ -41,17 +41,17 @@ efi_guid_to_str(const efi_guid_t *guid,
-
- if (!sp) {
- return snprintf(NULL, 0, GUID_FORMAT,
-- guid->a, guid->b, guid->c, bswap_16(guid->d),
-+ guid->a, guid->b, guid->c, bswap16(guid->d),
- guid->e[0], guid->e[1], guid->e[2], guid->e[3],
- guid->e[4], guid->e[5]);
- } else if (sp && *sp) {
- return snprintf(*sp, GUID_LENGTH_WITH_NUL, GUID_FORMAT,
-- guid->a, guid->b, guid->c, bswap_16(guid->d),
-+ guid->a, guid->b, guid->c, bswap16(guid->d),
- guid->e[0], guid->e[1], guid->e[2], guid->e[3],
- guid->e[4], guid->e[5]);
- } else {
- rc = asprintf(&ret, GUID_FORMAT,
-- guid->a, guid->b, guid->c, bswap_16(guid->d),
-+ guid->a, guid->b, guid->c, bswap16(guid->d),
- guid->e[0], guid->e[1], guid->e[2], guid->e[3],
- guid->e[4], guid->e[5]);
- if (rc >= 0)
-@@ -161,17 +161,17 @@ efi_guid_to_id_guid(const efi_guid_t *gu
- }
- if (!sp) {
- return snprintf(NULL, 0, "{"GUID_FORMAT"}",
-- guid->a, guid->b, guid->c, bswap_16(guid->d),
-+ guid->a, guid->b, guid->c, bswap16(guid->d),
- guid->e[0], guid->e[1], guid->e[2], guid->e[3],
- guid->e[4], guid->e[5]);
- } else if (sp && *sp) {
- return snprintf(*sp, GUID_LENGTH_WITH_NUL+2, "{"GUID_FORMAT"}",
-- guid->a, guid->b, guid->c, bswap_16(guid->d),
-+ guid->a, guid->b, guid->c, bswap16(guid->d),
- guid->e[0], guid->e[1], guid->e[2], guid->e[3],
- guid->e[4], guid->e[5]);
- }
- rc = asprintf(&ret, "{"GUID_FORMAT"}",
-- guid->a, guid->b, guid->c, bswap_16(guid->d),
-+ guid->a, guid->b, guid->c, bswap16(guid->d),
- guid->e[0], guid->e[1], guid->e[2], guid->e[3],
- guid->e[4], guid->e[5]);
- if (rc >= 0)
diff --git a/devel/efivar/files/patch-src-guid.h b/devel/efivar/files/patch-src-guid.h
deleted file mode 100644
index 006318f755f9..000000000000
--- a/devel/efivar/files/patch-src-guid.h
+++ /dev/null
@@ -1,20 +0,0 @@
---- src/guid.h.orig 2014-10-15 15:48:49.000000000 +0200
-+++ src/guid.h 2015-01-19 15:34:12.000000000 +0100
-@@ -19,7 +19,7 @@
- #ifndef LIBEFIVAR_GUID_H
- #define LIBEFIVAR_GUID_H 1
-
--#include <endian.h>
-+#include <sys/endian.h>
- #include <errno.h>
- #include <limits.h>
- #include <stdlib.h>
-@@ -111,7 +111,7 @@ text_to_guid(const char *text, efi_guid_
- strncpy(fourbytes, text+19, 4);
- if (check_segment_sanity(fourbytes, 4) < 0)
- return -1;
-- guid->d = bswap_16((uint16_t)strtoul(fourbytes, NULL, 16));
-+ guid->d = bswap16((uint16_t)strtoul(fourbytes, NULL, 16));
-
- /* 84be9c3e-8a32-42c0-891c-4cd3b072becc
- * ^ */
diff --git a/devel/efivar/files/patch-src-test-Makefile b/devel/efivar/files/patch-src-test-Makefile
deleted file mode 100644
index 22c70f7c9a73..000000000000
--- a/devel/efivar/files/patch-src-test-Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/test/Makefile.orig 2014-10-15 13:48:49 UTC
-+++ src/test/Makefile
-@@ -4,7 +4,7 @@ TOPDIR = $(realpath $(SRCDIR)/../..)
- include $(TOPDIR)/Make.defaults
-
- ccldflags += -L$(TOPDIR)/src/ -Wl,-rpath=$(TOPDIR)/src/
--LIBS=efivar
-+LIBS = -lefivar
-
- all : tester
-
diff --git a/devel/efivar/files/patch-src-test-tester.c b/devel/efivar/files/patch-src-test-tester.c
deleted file mode 100644
index fabd2c8bf30c..000000000000
--- a/devel/efivar/files/patch-src-test-tester.c
+++ /dev/null
@@ -1,14 +0,0 @@
---- src/test/tester.c.orig 2015-01-19 15:43:11.000000000 +0100
-+++ src/test/tester.c 2015-01-19 15:43:31.000000000 +0100
-@@ -1,10 +1,10 @@
--#include <alloca.h>
- #include <errno.h>
- #include <fcntl.h>
- #include <stdarg.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <sys/endian.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <unistd.h>
diff --git a/devel/efivar/files/patch-src-vars.c b/devel/efivar/files/patch-src-vars.c
deleted file mode 100644
index fd9a2c6593f3..000000000000
--- a/devel/efivar/files/patch-src-vars.c
+++ /dev/null
@@ -1,47 +0,0 @@
---- src/vars.c.orig 2015-01-19 15:36:23.000000000 +0100
-+++ src/vars.c 2015-01-19 15:36:36.000000000 +0100
-@@ -94,7 +94,7 @@ vars_get_variable_size(efi_guid_t guid,
-
- char *path = NULL;
- int rc = asprintf(&path, VARS_PATH "%s-"GUID_FORMAT"/size",
-- name, guid.a, guid.b, guid.c, bswap_16(guid.d),
-+ name, guid.a, guid.b, guid.c, bswap16(guid.d),
- guid.e[0], guid.e[1], guid.e[2], guid.e[3],
- guid.e[4], guid.e[5]);
- if (rc < 0)
-@@ -146,7 +146,7 @@ vars_get_variable(efi_guid_t guid, const
- size_t bufsize = -1;
- char *path;
- int rc = asprintf(&path, VARS_PATH "%s-" GUID_FORMAT "/raw_var",
-- name, guid.a, guid.b, guid.c, bswap_16(guid.d),
-+ name, guid.a, guid.b, guid.c, bswap16(guid.d),
- guid.e[0], guid.e[1], guid.e[2],
- guid.e[3], guid.e[4], guid.e[5]);
- if (rc < 0)
-@@ -193,7 +193,7 @@ vars_del_variable(efi_guid_t guid, const
- int ret = -1;
- char *path;
- int rc = asprintf(&path, VARS_PATH "%s-" GUID_FORMAT "/raw_var",
-- name, guid.a, guid.b, guid.c, bswap_16(guid.d),
-+ name, guid.a, guid.b, guid.c, bswap16(guid.d),
- guid.e[0], guid.e[1], guid.e[2],
- guid.e[3], guid.e[4], guid.e[5]);
- if (rc < 0)
-@@ -280,7 +280,7 @@ vars_chmod_variable(efi_guid_t guid, con
-
- char *path;
- int rc = asprintf(&path, VARS_PATH "%s-" GUID_FORMAT,
-- name, guid.a, guid.b, guid.c, bswap_16(guid.d),
-+ name, guid.a, guid.b, guid.c, bswap16(guid.d),
- guid.e[0], guid.e[1], guid.e[2], guid.e[3],
- guid.e[4], guid.e[5]);
- if (rc < 0)
-@@ -312,7 +312,7 @@ vars_set_variable(efi_guid_t guid, const
-
- char *path;
- int rc = asprintf(&path, VARS_PATH "%s-" GUID_FORMAT "/data",
-- name, guid.a, guid.b, guid.c, bswap_16(guid.d),
-+ name, guid.a, guid.b, guid.c, bswap16(guid.d),
- guid.e[0], guid.e[1], guid.e[2], guid.e[3],
- guid.e[4], guid.e[5]);
- if (rc < 0)
diff --git a/devel/efivar/files/patch-src_compiler.h b/devel/efivar/files/patch-src_compiler.h
new file mode 100644
index 000000000000..ad398379bffa
--- /dev/null
+++ b/devel/efivar/files/patch-src_compiler.h
@@ -0,0 +1,13 @@
+--- src/compiler.h.orig 2024-01-31 20:08:46 UTC
++++ src/compiler.h
+@@ -74,7 +74,9 @@
+
+ #define __ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask))
+ #define __ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a) - 1)
+-#define ALIGN(x, a) __ALIGN((x), (a))
++#if !defined(ALIGN)
++# define ALIGN(x, a) __ALIGN((x), (a))
++#endif
+ #define ALIGN_DOWN(x, a) __ALIGN((x) - ((a) - 1), (a))
+
+ #define ALIGNMENT_PADDING(value, align) ((align - (value % align)) % align)
diff --git a/devel/efivar/files/patch-src_creator.c b/devel/efivar/files/patch-src_creator.c
new file mode 100644
index 000000000000..21c7feb2106f
--- /dev/null
+++ b/devel/efivar/files/patch-src_creator.c
@@ -0,0 +1,26 @@
+--- src/creator.c.orig 2024-01-31 20:08:46 UTC
++++ src/creator.c
+@@ -9,16 +9,22 @@
+ #include <fcntl.h>
+ #include <inttypes.h>
+ #include <limits.h>
++#if defined(__linux__)
+ #include <mntent.h>
++#endif
++#include <sys/types.h>
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+-#include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/socket.h>
+
+ #include "efiboot.h"
++
++#if defined(__FreeBSD__)
++# include "mntent.h"
++#endif
+
+ static int NONNULL(1, 2, 3)
+ find_file(const char * const filepath, char **devicep, char **relpathp)
diff --git a/devel/efivar/files/patch-src_disk.c b/devel/efivar/files/patch-src_disk.c
new file mode 100644
index 000000000000..796a0904ed29
--- /dev/null
+++ b/devel/efivar/files/patch-src_disk.c
@@ -0,0 +1,32 @@
+--- src/disk.c.orig 2024-01-31 20:08:46 UTC
++++ src/disk.c
+@@ -14,6 +14,10 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#ifdef __FreeBSD__
++# include <sys/disk.h>
++# undef LIST_HEAD
++#endif
+ #include <sys/ioctl.h>
+ #include <sys/mount.h>
+ #include <sys/stat.h>
+@@ -158,8 +162,18 @@ msdos_disk_get_partition_info (int fd, int write_signa
+ } else if (num == 0) {
+ /* Whole disk */
+ *start = 0;
++#if defined(__linux__)
+ ioctl(fd, BLKGETSIZE, &disk_size);
+ *size = disk_size;
++#elif defined(__FreeBSD__)
++ long sector_size=0;
++ ioctl(fd, DIOCGMEDIASIZE, &disk_size);
++ ioctl(fd, DIOCGSECTORSIZE, &sector_size);
++ *size = disk_size / sector_size;
++#else
++ efi_error("could not get disk size (not implemented on your OS)");
++ return -1;
++#endif
+ } else if (num >= 1 && num <= 4) {
+ /* Primary partition */
+ *start = mbr->partition[num-1].starting_lba;
diff --git a/devel/efivar/files/patch-src_dp.h b/devel/efivar/files/patch-src_dp.h
new file mode 100644
index 000000000000..27a3cc282b2b
--- /dev/null
+++ b/devel/efivar/files/patch-src_dp.h
@@ -0,0 +1,13 @@
+--- src/dp.h.orig 2024-01-31 20:08:46 UTC
++++ src/dp.h
+@@ -6,7 +6,9 @@
+ #ifndef _EFIVAR_INTERNAL_DP_H
+ #define _EFIVAR_INTERNAL_DP_H
+
+-#include <alloca.h>
++#if defined(__linux__)
++# include <alloca.h>
++#endif
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <stdlib.h>
diff --git a/devel/efivar/files/patch-src_efisecdb.c b/devel/efivar/files/patch-src_efisecdb.c
new file mode 100644
index 000000000000..dd61da8d2eb3
--- /dev/null
+++ b/devel/efivar/files/patch-src_efisecdb.c
@@ -0,0 +1,38 @@
+--- src/efisecdb.c.orig 2024-01-31 20:08:46 UTC
++++ src/efisecdb.c
+@@ -93,7 +93,7 @@ secdb_warnx(const char * const fmt, ...)
+ int errnum = errno;
+
+ fflush(stdout);
+- fprintf(stderr, "%s: ", program_invocation_short_name);
++ fprintf(stderr, "%s: ", getprogname());
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+@@ -109,7 +109,7 @@ secdb_err(int status, const char * const fmt, ...)
+ int errnum = errno;
+
+ fflush(stdout);
+- fprintf(stderr, "%s: ", program_invocation_short_name);
++ fprintf(stderr, "%s: ", getprogname());
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+@@ -126,7 +126,7 @@ secdb_errx(int status, const char * const fmt, ...)
+ int errnum = errno;
+
+ fflush(stdout);
+- fprintf(stderr, "%s: ", program_invocation_short_name);
++ fprintf(stderr, "%s: ", getprogname());
+ va_start(ap, fmt);
+ errno = errnum;
+ vfprintf(stderr, fmt, ap);
+@@ -149,7 +149,7 @@ usage(int status)
+ " -t, --type=<hash-type> hash type to add (\"help\" lists options)\n"
+ " -c, --certificate=<file> certificate file to add\n"
+ " -L, --list-guids list well known guids\n",
+- program_invocation_short_name);
++ getprogname());
+ exit(status);
+ }
+
diff --git a/devel/efivar/files/patch-src_efivar.c b/devel/efivar/files/patch-src_efivar.c
new file mode 100644
index 000000000000..5a419a603b42
--- /dev/null
+++ b/devel/efivar/files/patch-src_efivar.c
@@ -0,0 +1,31 @@
+--- src/efivar.c.orig 2024-01-31 20:08:46 UTC
++++ src/efivar.c
+@@ -20,6 +20,10 @@
+ #include <string.h>
+ #include <limits.h>
+
++#if defined(__FreeBSD__)
++# undef LIST_HEAD
++#endif
++
+ extern char *optarg;
+ extern int optind, opterr, optopt;
+
+@@ -408,7 +412,7 @@ prepare_data(const char *filename, uint8_t **data, siz
+ goto err;
+
+ buflen = statbuf.st_size;
+- buf = mmap(NULL, buflen, PROT_READ, MAP_PRIVATE|MAP_POPULATE, fd, 0);
++ buf = mmap(NULL, buflen, PROT_READ, MAP_PRIVATE, fd, 0);
+ if (buf == MAP_FAILED)
+ goto err;
+
+@@ -447,7 +451,7 @@ usage(int ret)
+ "Help options:\n"
+ " -?, --help Show this help message\n"
+ " --usage Display brief usage message\n",
+- program_invocation_short_name);
++ getprogname());
+ exit(ret);
+ }
+
diff --git a/devel/efivar/files/patch-src_efivarfs.c b/devel/efivar/files/patch-src_efivarfs.c
new file mode 100644
index 000000000000..1ca8a549aba8
--- /dev/null
+++ b/devel/efivar/files/patch-src_efivarfs.c
@@ -0,0 +1,162 @@
+--- src/efivarfs.c.orig 2024-01-31 20:08:46 UTC
++++ src/efivarfs.c
+@@ -9,20 +9,32 @@
+ #include <err.h>
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <linux/magic.h>
++#if defined(__linux__)
++# include <linux/magic.h>
++#endif
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <sys/mman.h>
+ #include <sys/types.h>
++#include <sys/param.h>
++#include <sys/mount.h>
+ #include <sys/stat.h>
+ #include <sys/uio.h>
+-#include <sys/vfs.h>
++#if defined(__linux__)
++# include <sys/vfs.h>
++#endif
+ #include <unistd.h>
+
++#if defined(__FreeBSD__)
++# undef LIST_HEAD
++#endif
++
+ #include "efivar.h"
+
+-#include <linux/fs.h>
++#if defined(__linux__)
++# include <linux/fs.h>
++#endif
+
+ #ifndef EFIVARFS_MAGIC
+ # define EFIVARFS_MAGIC 0xde5e81e4
+@@ -102,6 +114,7 @@ efivarfs_set_fd_immutable(int fd, int immutable)
+ static int
+ efivarfs_set_fd_immutable(int fd, int immutable)
+ {
++#if defined(__linux__)
+ unsigned int flags;
+ int rc = 0;
+
+@@ -124,11 +137,42 @@ efivarfs_set_fd_immutable(int fd, int immutable)
+ }
+
+ return rc;
++#elif defined(__FreeBSD__)
++ struct stat sb;
++ int rc = 0;
++ unsigned long flags;
++
++ if (fstat(fd, &sb) == -1) {
++ if (errno == EBADF)
++ rc = 0;
++ else
++ efi_error("fstat(%d) failed", fd);
++ return rc;
++ }
++
++ flags = sb.st_flags;
++
++ if ((immutable && !(flags & UF_IMMUTABLE)) ||
++ (!immutable && (flags & UF_IMMUTABLE))) {
++ if (immutable)
++ flags |= UF_IMMUTABLE;
++ else
++ flags &= ~UF_IMMUTABLE;
++
++ if (chflagsat(fd, "", flags, AT_EMPTY_PATH) == -1) {
++ efi_error("chflagsat(%d) failed\n", fd);
++ rc = -1;
++ }
++ }
++
++ return rc;
++#endif
+ }
+
+ static int
+ efivarfs_make_fd_mutable(int fd, unsigned long *orig_attrs)
+ {
++#if defined(__linux__)
+ unsigned long mutable_attrs = 0;
+
+ *orig_attrs = 0;
+@@ -145,6 +189,26 @@ efivarfs_make_fd_mutable(int fd, unsigned long *orig_a
+ return -1;
+
+ return 0;
++#elif defined(__FreeBSD__)
++ struct stat sb;
++
++ *orig_attrs = 0;
++
++ if (fstat(fd, &sb) == -1)
++ return -1;
++
++ *orig_attrs = sb.st_flags;
++
++ // if the file is not immutable, nothing to do
++ if ((sb.st_flags & UF_IMMUTABLE) == 0)
++ return 0;
++
++ // remove user immutable flag
++ if (chflagsat(fd, "", sb.st_flags & ~UF_IMMUTABLE, AT_EMPTY_PATH) == -1)
++ return -1;
++
++ return 0;
++#endif
+ }
+
+ static int
+@@ -375,10 +439,17 @@ efivarfs_set_variable(efi_guid_t guid, const char *nam
+ goto err;
+ }
+
++#if defined(__linux__)
+ /* if the file is indeed immutable, clear and remember it */
+ if (efivarfs_make_fd_mutable(rfd, &orig_attrs) == 0 &&
+ (orig_attrs & FS_IMMUTABLE_FL))
+ restore_immutable_fd = rfd;
++#elif defined(__FreeBSD__)
++ /* if the file is indeed immutable, clear and remember it */
++ if (efivarfs_make_fd_mutable(rfd, &orig_attrs) == 0 &&
++ (orig_attrs & UF_IMMUTABLE))
++ restore_immutable_fd = rfd;
++#endif
+ }
+
+ /*
+@@ -414,9 +485,15 @@ efivarfs_set_variable(efi_guid_t guid, const char *nam
+ * immediately, and the write() below would fail otherwise.
+ */
+ if (rfd == -1) {
++#if defined(__linux__)
+ if (efivarfs_make_fd_mutable(wfd, &orig_attrs) == 0 &&
+ (orig_attrs & FS_IMMUTABLE_FL))
+ restore_immutable_fd = wfd;
++#elif defined(__FreeBSD__)
++ if (efivarfs_make_fd_mutable(wfd, &orig_attrs) == 0 &&
++ (orig_attrs & UF_IMMUTABLE))
++ restore_immutable_fd = wfd;
++#endif
+ } else {
+ /* make sure rfd and wfd refer to the same file */
+ struct stat wfd_stat;
+@@ -452,7 +529,11 @@ err:
+ if (ret == -1 && rfd == -1 && wfd != -1 && unlink(path) == -1)
+ efi_error("failed to unlink %s", path);
+
++#if defined(__linux__)
+ ioctl(restore_immutable_fd, FS_IOC_SETFLAGS, &orig_attrs);
++#elif defined(__FreeBSD__)
++ chflagsat(restore_immutable_fd, "", orig_attrs, AT_EMPTY_PATH);
++#endif
+
+ if (wfd >= 0)
+ close(wfd);
diff --git a/devel/efivar/files/patch-src_gpt.c b/devel/efivar/files/patch-src_gpt.c
new file mode 100644
index 000000000000..87d6d523d72a
--- /dev/null
+++ b/devel/efivar/files/patch-src_gpt.c
@@ -0,0 +1,59 @@
+--- src/gpt.c.orig 2024-01-31 20:08:46 UTC
++++ src/gpt.c
+@@ -16,6 +16,11 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#if defined(__FreeBSD__)
++# include <sys/disk.h>
++# undef LIST_HEAD
++#endif
++#include <sys/ioctl.h>
+ #include <sys/mount.h>
+ #include <sys/param.h>
+ #include <sys/stat.h>
+@@ -60,6 +65,7 @@ is_pmbr_valid(legacy_mbr *mbr)
+ return (magic && found);
+ }
+
++#if defined(__linux__)
+ /**
+ * kernel_has_blkgetsize64()
+ *
+@@ -92,6 +98,7 @@ kernel_has_blkgetsize64(void)
+ return 0;
+ return 1;
+ }
++#endif
+
+ /************************************************************
+ * _get_num_sectors
+@@ -114,6 +121,8 @@ _get_num_sectors(int filedes)
+ unsigned long sectors=0;
+ uint64_t bytes=0;
+ int rc;
++
++#if defined(__linux__)
+ if (kernel_has_blkgetsize64()) {
+ rc = ioctl(filedes, BLKGETSIZE64, &bytes);
+ if (!rc)
+@@ -125,6 +134,19 @@ _get_num_sectors(int filedes)
+ return 0;
+
+ return sectors;
++#elif defined(__FreeBSD__)
++ rc = ioctl(filedes, DIOCGMEDIASIZE, &bytes);
++ if (rc == -1)
++ return 0;
++
++ rc = ioctl(filedes, DIOCGSECTORSIZE, &sectors);
++ if (rc == -1)
++ return 0;
++
++ return bytes / sectors;
++#else
++ return 0;
++#endif
+ }
+
+ /************************************************************
diff --git a/devel/efivar/files/patch-src_include_defaults.mk b/devel/efivar/files/patch-src_include_defaults.mk
new file mode 100644
index 000000000000..9c56eb219471
--- /dev/null
+++ b/devel/efivar/files/patch-src_include_defaults.mk
@@ -0,0 +1,26 @@
+--- src/include/defaults.mk.orig 2024-01-31 20:08:46 UTC
++++ src/include/defaults.mk
+@@ -43,7 +43,6 @@ override CFLAGS = $(_CFLAGS) \
+ override CFLAGS = $(_CFLAGS) \
+ -std=gnu11 \
+ -funsigned-char \
+- -fvisibility=hidden \
+ $(call family,CFLAGS) \
+ $(call pkg-config-cflags)
+ LDFLAGS_CLANG ?= -rtlib=compiler-rt
+@@ -53,7 +52,6 @@ override LDFLAGS = $(CFLAGS) -L. $(_LDFLAGS) $(_CCLDFL
+ override _LDFLAGS := $(LDFLAGS)
+ override LDFLAGS = $(CFLAGS) -L. $(_LDFLAGS) $(_CCLDFLAGS) \
+ -Wl,--build-id \
+- -Wl,--no-allow-shlib-undefined \
+ -Wl,--no-undefined-version \
+ -Wl,-z,now \
+ -Wl,-z,muldefs \
+@@ -99,7 +97,6 @@ override HOST_LDFLAGS = $(HOST_CFLAGS) -L. \
+ override HOST_LDFLAGS = $(HOST_CFLAGS) -L. \
+ $(_HOST_LDFLAGS) $(_HOST_CCLDFLAGS) \
+ -Wl,--build-id \
+- -Wl,--no-allow-shlib-undefined \
+ -Wl,-z,now \
+ -Wl,-z,muldefs \
+ $(call family,HOST_LDFLAGS) \
diff --git a/devel/efivar/files/patch-src_include_gcc.specs b/devel/efivar/files/patch-src_include_gcc.specs
new file mode 100644
index 000000000000..388f3d9e22cd
--- /dev/null
+++ b/devel/efivar/files/patch-src_include_gcc.specs
@@ -0,0 +1,8 @@
+--- src/include/gcc.specs.orig 2024-01-31 20:08:46 UTC
++++ src/include/gcc.specs
+@@ -5,4 +5,4 @@ + %{!shared:%{!static:%{!r:-pie}}} %{static:-Wl,-no-fa
+ + %{!shared:%{!static:%{!r:-pie}}} %{static:-Wl,-no-fatal-warnings -Wl,-static -static -Wl,-z,relro,-z,now} -grecord-gcc-switches
+
+ *link:
+-+ %{!static:--fatal-warnings} --no-undefined-version --no-allow-shlib-undefined -z now --build-id %{!static:%{!shared:-pie}} %{shared:-z relro} %{static:%<pie}
+++ %{!static:--fatal-warnings} --no-undefined-version -z now --build-id %{!static:%{!shared:-pie}} %{shared:-z relro} %{static:%<pie}
diff --git a/devel/efivar/files/patch-src_linux.c b/devel/efivar/files/patch-src_linux.c
new file mode 100644
index 000000000000..1948fba2d92b
--- /dev/null
+++ b/devel/efivar/files/patch-src_linux.c
@@ -0,0 +1,108 @@
+--- src/linux.c.orig 2024-01-31 20:08:46 UTC
++++ src/linux.c
+@@ -12,17 +12,30 @@
+ #include <fcntl.h>
+ #include <inttypes.h>
+ #include <limits.h>
+-#include <linux/ethtool.h>
+-#include <linux/version.h>
+-#include <linux/sockios.h>
++#if defined(__linux__)
++# include <linux/ethtool.h>
++# include <linux/version.h>
++# include <linux/sockios.h>
++#elif defined(__FreeBSD__)
++# include <net/if.h>
++# include <net/if_dl.h>
++#endif
+ #include <net/if.h>
+-#include <scsi/scsi.h>
++#if defined(__linux__)
++# include <scsi/scsi.h>
++#endif
+ #include <stdbool.h>
+ #include <stdio.h>
++#if defined(__FreeBSD__)
++# include <sys/disk.h>
++# undef LIST_HEAD
++#endif
+ #include <sys/ioctl.h>
+ #include <sys/mount.h>
+ #include <sys/socket.h>
+-#include <sys/sysmacros.h>
++#if defined(__linux__)
++# include <sys/sysmacros.h>
++#endif
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/stat.h>
+@@ -630,6 +643,7 @@ make_blockdev_path(uint8_t *buf, ssize_t size, struct
+ return off;
+ }
+
++#if defined(__linux__)
+ ssize_t HIDDEN
+ make_mac_path(uint8_t *buf, ssize_t size, const char * const ifname)
+ {
+@@ -693,7 +707,48 @@ err:
+ close(fd);
+ return ret;
+ }
++#elif defined(__FreeBSD__)
++ssize_t HIDDEN
++make_mac_path(uint8_t *buf, ssize_t size, const char * const ifname)
++{
++ int fd;
++ struct ifreq ifr;
++ struct sockaddr_dl *sdl;
++ ssize_t ret = -1;
+
++ if (!buf || !ifname)
++ return -1;
++
++ fd = socket(AF_INET, SOCK_DGRAM, 0);
++ if (fd < 0)
++ return -1;
++
++ memset(&ifr, 0, sizeof(ifr));
++ strncpy(ifr.ifr_name, ifname, IFNAMSIZ-1);
++ ifr.ifr_name[IFNAMSIZ-1] = '\0';
++
++ if (ioctl(fd, SIOCGIFADDR, &ifr) < 0) {
++ close(fd);
++ return -1;
++ }
++
++ // For MAC, use AF_LINK (sockaddr_dl)
++ if (ioctl(fd, SIOCGIFCONF, &ifr) < 0) {
++ close(fd);
++ return -1;
++ }
++
++ sdl = (struct sockaddr_dl *)&ifr.ifr_addr;
++ if (sdl->sdl_alen > 0 && sdl->sdl_alen <= size) {
++ memcpy(buf, LLADDR(sdl), sdl->sdl_alen);
++ ret = sdl->sdl_alen;
++ }
++
++ close(fd);
++ return ret;
++}
++#endif
++
+ /************************************************************
+ * get_sector_size
+ * Requires:
+@@ -707,7 +762,12 @@ get_sector_size(int filedes)
+ {
+ int rc, sector_size = 512;
+
++ (void)filedes;
++#if defined(__linux__)
+ rc = ioctl(filedes, BLKSSZGET, &sector_size);
++#elif defined(__FreeBSD__)
++ rc = ioctl(filedes, DIOCGSECTORSIZE, &sector_size);
++#endif
+ if (rc)
+ sector_size = 512;
+ return sector_size;
diff --git a/devel/efivar/files/patch-src_mntent.h b/devel/efivar/files/patch-src_mntent.h
new file mode 100644
index 000000000000..f4cf03ef4d55
--- /dev/null
+++ b/devel/efivar/files/patch-src_mntent.h
@@ -0,0 +1,192 @@
+--- src/mntent.h.orig 2025-10-12 11:00:40 UTC
++++ src/mntent.h
+@@ -0,0 +1,189 @@
++/*
++ * mntent
++ * mntent.h - compatibility header for FreeBSD
++ *
++ * Copyright (c) 2001 David Rufino <daverufino@btinternet.com>
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ */
++
++#ifndef VIFM__UTILS__MNTENT_H__
++#define VIFM__UTILS__MNTENT_H__
++
++#include <stddef.h>
++#include <stdio.h>
++
++#define MOUNTED "dummy"
++
++#define MNTTYPE_NFS "nfs"
++
++struct mntent
++{
++ char *mnt_fsname;
++ char *mnt_dir;
++ char *mnt_type;
++ char *mnt_opts;
++ int mnt_freq;
++ int mnt_passno;
++};
++
++#define setmntent(x,y) ((FILE *)0x1)
++struct mntent * getmntent(FILE *fp);
++char * hasmntopt(const struct mntent *mnt, const char option[]);
++#define endmntent(x) ((int)1)
++
++#endif /* VIFM__UTILS__MNTENT_H__ */
++
++#include <sys/param.h>
++#include <sys/ucred.h>
++#include <sys/mount.h>
++
++#include <stdlib.h>
++#include <string.h>
++
++#ifdef __NetBSD__
++#define statfs statvfs
++#define f_flags f_flag
++#endif
++
++static struct mntent * statfs_to_mntent(struct statfs *mntbuf);
++static char * flags2opts(int flags);
++static char * catopt(char s0[], const char s1[]);
++
++char *
++hasmntopt(const struct mntent *mnt, const char option[])
++{
++ char *opt, *optbuf;
++
++ optbuf = strdup(mnt->mnt_opts);
++ for(opt = optbuf; (opt = strtok(opt, " ")) != NULL; opt = NULL)
++ {
++ if(!strcasecmp(opt, option))
++ {
++ opt = opt - optbuf + mnt->mnt_opts;
++ free(optbuf);
++ return (opt);
++ }
++ }
++ free(optbuf);
++ return NULL;
++}
++
++struct mntent *
++getmntent(FILE *fp)
++{
++ static int pos = -1;
++ static int mntsize = -1;
++
++ static struct statfs *mntbuf;
++
++ (void)fp;
++
++ if(pos == -1 || mntsize == -1)
++ {
++ mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
++ }
++
++ pos++;
++ if(pos == mntsize)
++ {
++ pos = mntsize = -1;
++ return NULL;
++ }
++
++ return statfs_to_mntent(&mntbuf[pos]);
++}
++
++static struct mntent *
++statfs_to_mntent(struct statfs *mntbuf)
++{
++ static struct mntent _mntent;
++ static char opts_buf[40], *tmp;
++
++ _mntent.mnt_fsname = mntbuf->f_mntfromname;
++ _mntent.mnt_dir = mntbuf->f_mntonname;
++ _mntent.mnt_type = mntbuf->f_fstypename;
++ tmp = flags2opts (mntbuf->f_flags);
++ if(tmp != NULL)
++ {
++ opts_buf[sizeof(opts_buf) - 1] = '\0';
++ strncpy(opts_buf, tmp, sizeof(opts_buf) - 1);
++ free(tmp);
++ }
++ else
++ {
++ *opts_buf = '\0';
++ }
++ _mntent.mnt_opts = opts_buf;
++ _mntent.mnt_freq = _mntent.mnt_passno = 0;
++ return &_mntent;
++}
++
++static char *
++flags2opts(int flags)
++{
++ char *res = catopt(NULL, (flags & MNT_RDONLY) ? "ro" : "rw");
++ if(flags & MNT_SYNCHRONOUS) res = catopt(res, "sync");
++ if(flags & MNT_NOEXEC) res = catopt(res, "noexec");
++ if(flags & MNT_NOSUID) res = catopt(res, "nosuid");
++#ifndef __OpenBSD__
++ if(flags & MNT_UNION) res = catopt(res, "union");
++#endif
++ if(flags & MNT_ASYNC) res = catopt(res, "async");
++ if(flags & MNT_NOATIME) res = catopt(res, "noatime");
++#if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
++ if(flags & MNT_NOCLUSTERR) res = catopt(res, "noclusterr");
++ if(flags & MNT_NOCLUSTERW) res = catopt(res, "noclusterw");
++ if(flags & MNT_NOSYMFOLLOW) res = catopt(res, "nosymfollow");
++ if(flags & MNT_SUIDDIR) res = catopt(res, "suiddir");
++#endif
++
++ return res;
++}
++
++static char *
++catopt(char s0[], const char s1[])
++{
++ char *cp;
++
++ if(s1 == NULL || *s1 == '\0')
++ {
++ return s0;
++ }
++ if(s0 && *s0)
++ {
++ const size_t i = strlen(s0) + strlen(s1) + 1 + 1;
++ if((cp = malloc(i)) == NULL)
++ {
++ return NULL;
++ }
++ (void)snprintf(cp, i, "%s %s", s0, s1);
++ }
++ else
++ {
++ cp = strdup(s1);
++ }
++
++ free(s0);
++ return cp;
++}
diff --git a/devel/efivar/files/patch-src_test_tester.c b/devel/efivar/files/patch-src_test_tester.c
new file mode 100644
index 000000000000..d93bb2d6456c
--- /dev/null
+++ b/devel/efivar/files/patch-src_test_tester.c
@@ -0,0 +1,13 @@
+--- src/test/tester.c.orig 2024-01-31 20:08:46 UTC
++++ src/test/tester.c
+@@ -5,7 +5,9 @@
+ * Copyright 2012-2018 Peter M. Jones <pjones@redhat.com>
+ */
+
+-#include <alloca.h>
++#if defined(__linux__)
++# include <alloca.h>
++#endif
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <stdarg.h>
diff --git a/devel/efivar/files/patch-src_thread-test.c b/devel/efivar/files/patch-src_thread-test.c
new file mode 100644
index 000000000000..b46bf0bb4ead
--- /dev/null
+++ b/devel/efivar/files/patch-src_thread-test.c
@@ -0,0 +1,22 @@
+--- src/thread-test.c.orig 2024-01-31 20:08:46 UTC
++++ src/thread-test.c
+@@ -6,7 +6,9 @@
+
+ #include "fix_coverity.h"
+
+-#include <alloca.h>
++#if defined(__linux__)
++# include <alloca.h>
++#endif
+ #include <efivar.h>
+ #include <err.h>
+ #include <errno.h>
+@@ -125,7 +127,7 @@ usage(int ret)
+ "Help options:\n"
+ " -?, --help Show this help message\n"
+ " --usage Display brief usage message\n",
+- program_invocation_short_name);
++ getprogname());
+ exit(ret);
+ }
+
diff --git a/devel/efivar/files/patch-src_time.c b/devel/efivar/files/patch-src_time.c
new file mode 100644
index 000000000000..4a7edf743ef4
--- /dev/null
+++ b/devel/efivar/files/patch-src_time.c
@@ -0,0 +1,20 @@
+--- src/time.c.orig 2024-01-31 20:08:46 UTC
++++ src/time.c
+@@ -52,7 +52,17 @@ tm_to_efi_time(const struct tm * const s, efi_time_t *
+
+ if (tzadj) {
+ tzset();
++
++#if defined(__FreeBSD__)
++ time_t t = time(NULL);
++ struct tm lt = {0};
++
++ localtime_r(&t, &lt);
++
++ d->timezone = lt.tm_gmtoff / 60;
++#else
+ d->timezone = timezone / 60;
++#endif
+ }
+
+ return 0;
diff --git a/devel/efivar/files/patch-src_util.h b/devel/efivar/files/patch-src_util.h
new file mode 100644
index 000000000000..7c47def1ebf9
--- /dev/null
+++ b/devel/efivar/files/patch-src_util.h
@@ -0,0 +1,13 @@
+--- src/util.h.orig 2024-01-31 20:08:46 UTC
++++ src/util.h
+@@ -8,7 +8,9 @@
+ #ifndef EFIVAR_UTIL_H
+ #define EFIVAR_UTIL_H 1
+
+-#include <alloca.h>
++#if defined(__linux__)
++# include <alloca.h>
++#endif
+ #include <ctype.h>
+ #include <endian.h>
+ #include <err.h>