freebsd: 13.1.0 -> 14.0.0

The old patches are kept because the version is actually configurable.
In the future both versions may be exposed.

Co-Auhtored-By: Artemis Tosini <me@artem.ist>
Co-Authored-by: John Ericson <John.Ericson@Obsidian.Systems>
This commit is contained in:
Audrey Dutcher 2024-05-11 21:45:23 -04:00 committed by John Ericson
parent 06b05d2289
commit 2cc214b4c3
17 changed files with 264 additions and 2 deletions

View File

@ -5,7 +5,7 @@
callPackage,
crossLibcStdenv,
attributePathToSplice ? [ "freebsd" ],
branch ? "release/13.1.0",
branch ? "release/14.0.0",
}:
let

View File

@ -0,0 +1,11 @@
--- a/share/mk/src.libnames.mk 2023-12-21 23:56:50.767042385 -0800
+++ b/share/mk/src.libnames.mk 2023-12-21 23:56:39.671089506 -0800
@@ -392,7 +392,7 @@
_DP_ztest= geom m nvpair umem zpool pthread avl zfs_core spl zutil zfs uutil icp
# The libc dependencies are not strictly needed but are defined to make the
# assert happy.
-_DP_c= compiler_rt
+_DP_c=
# Use libssp_nonshared only on i386 and power*. Other archs emit direct calls
# to __stack_chk_fail, not __stack_chk_fail_local provided by libssp_nonshared.
.if ${MK_SSP} != "no" && \

View File

@ -0,0 +1,32 @@
--- a/tools/build/cross-build/include/common/sys/_types.h
+++ b/tools/build/cross-build/include/common/sys/_types.h
@@ -47,3 +47,6 @@
* Neither GLibc nor macOS define __va_list but many FreeBSD headers require it.
*/
typedef __builtin_va_list __va_list;
+
+typedef __UINTPTR_TYPE__ __uintptr_t;
+typedef __INTPTR_TYPE__ __intptr_t;
--- a/tools/build/cross-build/include/common/sys/types.h
+++ b/tools/build/cross-build/include/common/sys/types.h
@@ -49,9 +49,6 @@
#include <sys/sysmacros.h>
#endif
-typedef __UINTPTR_TYPE__ __uintptr_t;
-typedef __INTPTR_TYPE__ __intptr_t;
-
/* needed for gencat */
typedef int __nl_item;
--- a/tools/build/cross-build/include/linux/sys/types.h
+++ b/tools/build/cross-build/include/linux/sys/types.h
@@ -39,6 +39,8 @@
#include_next <sys/types.h>
+#include <sys/_types.h>
+
#ifndef __size_t
typedef __SIZE_TYPE__ __size_t;
#endif

View File

@ -0,0 +1,40 @@
diff --git a/tools/build/Makefile b/tools/build/Makefile
index 948a5f9dfdb..592af84eeae 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -327,14 +327,14 @@ host-symlinks:
# and cross-tools stages. We do this here using mkdir since mtree may not exist
# yet (this happens if we are crossbuilding from Linux/Mac).
INSTALLDIR_LIST= \
- bin \
- lib/geom \
- usr/include/casper \
- usr/include/private/ucl \
- usr/include/private/zstd \
- usr/lib \
- usr/libdata/pkgconfig \
- usr/libexec
+ ${BINDIR} \
+ ${LIBDIR}/geom \
+ ${INCLUDEDIR}/casper \
+ ${INCLUDEDIR}/private/ucl \
+ ${INCLUDEDIR}/private/zstd \
+ ${LIBDIR} \
+ ${LIBDIR}/libdata/pkgconfig \
+ ${LIBEXECDIR}
installdirs:
mkdir -p ${INSTALLDIR_LIST:S,^,${DESTDIR}/,}
@@ -352,9 +352,9 @@ installdirs:
rm -rf "${DESTDIR}/${_dir}"; \
fi
.endfor
- ln -sfn bin ${DESTDIR}/sbin
- ln -sfn ../bin ${DESTDIR}/usr/bin
- ln -sfn ../bin ${DESTDIR}/usr/sbin
+ ln -sfn bin ${DESTDIR}/${SBINDIR}
+ ln -sfn ../bin ${DESTDIR}/${BINDIR}
+ ln -sfn ../bin ${DESTDIR}/${SBINDIR}
.for _group in ${INCSGROUPS:NINCS}
mkdir -p "${DESTDIR}/${${_group}DIR}"
.endfor

View File

@ -0,0 +1,11 @@
--- a/usr.bin/xinstall/Makefile 2023-09-23 19:18:49.165192183 -0700
+++ b/usr.bin/xinstall/Makefile 2023-12-06 17:06:57.836888028 -0700
@@ -14,7 +14,7 @@
CFLAGS+= -I${SRCTOP}/lib/libnetbsd
LIBADD= md
-CFLAGS+= -DWITH_MD5 -DWITH_RIPEMD160
+CFLAGS+= -I${BSDSRCDIR}/contrib/libc-vis -I${BSDSRCDIR}/lib/libnetbsd
.ifdef BOOTSTRAPPING
# For the bootstrap we disable copy_file_range()

View File

@ -0,0 +1,11 @@
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -194,7 +194,7 @@ SUBDIR.${MK_TESTS}+= tests
# recording a build dependency
CFLAGS+= -I${SRCTOP}/lib/libutil
# Same issue with libm
-MSUN_ARCH_SUBDIR != ${MAKE} -B -C ${SRCTOP}/lib/msun -V ARCH_SUBDIR
+MSUN_ARCH_SUBDIR = ${MACHINE_CPUARCH:S/i386/i387/}
# unfortunately msun/src contains both private and public headers
CFLAGS+= -I${SRCTOP}/lib/msun/${MSUN_ARCH_SUBDIR}
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"

View File

@ -0,0 +1,10 @@
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -58,7 +58,6 @@ CFLAGS+=${CANCELPOINTS_CFLAGS}
# Link with static libcompiler_rt.a.
#
LDFLAGS+= -nodefaultlibs
-LIBADD+= compiler_rt
.if ${MK_SSP} != "no" && \
(${LIBC_ARCH} == "i386" || ${MACHINE_ARCH:Mpower*} != "")

View File

@ -0,0 +1,32 @@
diff --git a/Makefile b/Makefile
index 22710f3d933..22effc848cf 100644
--- a/lib/libnetbsd/Makefile
+++ b/lib/libnetbsd/Makefile
@@ -9,6 +9,26 @@ CFLAGS+= -I${.CURDIR}
SRCS+= efun.c sockaddr_snprintf.c strsuftoll.c util.c util.h
-INTERNALLIB=
+INCSGROUPS= INCS SYSINCS NETINETINCS
+
+INCS+= \
+ glob.h \
+ pthread.h \
+ rmd160.h \
+ sha1.h \
+ sha2.h \
+ stdlib.h \
+ util.h
+
+SYSINCSDIR= ${INCLUDEDIR}/sys
+SYSINCS+= \
+ sys/cdefs.h \
+ sys/event.h \
+ sys/types.h \
+ sys/wait.h
+
+NETINETINCSDIR= ${INCLUDEDIR}/netinet
+NETINETINCS+= \
+ netinet/in.h
.include <bsd.lib.mk>

View File

@ -0,0 +1,11 @@
--- a/lib/librpcsvc/Makefile
+++ b/lib/librpcsvc/Makefile
@@ -20,7 +20,7 @@ OTHERSRCS+= yp_passwd.c yp_update.c
RPCCOM= RPCGEN_CPP=${CPP:Q} rpcgen -C
-INCDIRS= -I${SYSROOT:U${DESTDIR}}/usr/include/rpcsvc
+INCDIRS= -I${INCLUDEDIR}/rpcsvc
CFLAGS+= -DYP ${INCDIRS}

View File

@ -0,0 +1,13 @@
--- a/contrib/mtree/Makefile 2023-12-04 23:02:13.919144141 -0700
+++ b/contrib/mtree/Makefile 2023-12-04 23:02:58.371810109 -0700
@@ -10,8 +10,8 @@
SRCS= compare.c crc.c create.c excludes.c misc.c mtree.c spec.c specspec.c \
verify.c getid.c pack_dev.c only.c
.if (${HOSTPROG:U} == "")
-DPADD+= ${LIBUTIL}
-LDADD+= -lutil
+LIBADD+= ${LIBUTIL}
+#LIBADD+= -lutil
.endif
CPPFLAGS+= -I${NETBSDSRCDIR}/sbin/mknod

View File

@ -0,0 +1,11 @@
--- a/etc/mtree/BSD.include.dist
+++ b/etc/mtree/BSD.include.dist
@@ -3,7 +3,7 @@
# Please see the file src/etc/mtree/README before making changes to this file.
#
-/set type=dir uname=root gname=wheel mode=0755
+/set type=dir
.
arpa
..

View File

@ -0,0 +1,10 @@
--- a/libexec/rtld-elf/Makefile
+++ b/libexec/rtld-elf/Makefile
@@ -86,7 +86,6 @@
# Some of the required math functions (div & mod) are implemented in
# libcompiler_rt on some architectures.
-LIBADD+= compiler_rt
.include <bsd.prog.mk>
${PROG_FULL}: ${VERSION_MAP}

View File

@ -0,0 +1,13 @@
diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index c594724d814..d5287c7b992 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -177,7 +177,7 @@ u=${USER:-root}
d=$(pwd)
h=${HOSTNAME:-$(hostname)}
if [ -n "$SOURCE_DATE_EPOCH" ]; then
- if ! t=$(date -r $SOURCE_DATE_EPOCH 2>/dev/null); then
+ if ! t=$(date -d @$SOURCE_DATE_EPOCH 2>/dev/null); then
echo "Invalid SOURCE_DATE_EPOCH" >&2
exit 1
fi

View File

@ -0,0 +1,42 @@
--- a/sys/modules/aesni/Makefile 2023-12-16 09:19:28.454892154 -0700
+++ b/sys/Modules/aesni/Makefile 2023-12-16 09:19:41.975047684 -0700
@@ -1,6 +1,5 @@
.PATH: ${SRCTOP}/sys/crypto/aesni
-.PATH: ${SRCTOP}/contrib/llvm-project/clang/lib/Headers
KMOD= aesni
SRCS= aesni.c
@@ -39,8 +38,8 @@
aesni_ghash.o: aesni.h
aesni_wrap.o: aesni.h
aesni_ccm.o: aesni.h
-intel_sha1.o: sha_sse.h immintrin.h shaintrin.h tmmintrin.h xmmintrin.h
-intel_sha256.o: sha_sse.h immintrin.h shaintrin.h tmmintrin.h xmmintrin.h
+intel_sha1.o: sha_sse.h
+intel_sha256.o: sha_sse.h
.include <bsd.kmod.mk>
diff --git a/sys/modules/blake2/Makefile b/sys/modules/blake2/Makefile
index e4b3fb9f126..5bfd9c2ae02 100644
--- a/sys/modules/blake2/Makefile
+++ b/sys/modules/blake2/Makefile
@@ -3,7 +3,6 @@
.PATH: ${SRCTOP}/sys/contrib/libb2
.PATH: ${SRCTOP}/sys/crypto/blake2
.PATH: ${SRCTOP}/sys/opencrypto
-.PATH: ${SRCTOP}/contrib/llvm-project/clang/lib/Headers
KMOD = blake2
@@ -64,8 +63,7 @@ ${src:S/.c/.o/}: ${src}
-D_MM_MALLOC_H_INCLUDED -Wno-unused-function ${.IMPSRC}
${CTFCONVERT_CMD}
-${src:S/.c/.o/}: intrin.h emmintrin.h tmmintrin.h smmintrin.h immintrin.h \
- x86intrin.h ${SRCS:M*.h}
+${src:S/.c/.o/}: ${SRCS:M*.h}
.endfor
# FreeBSD-specific sources:

View File

@ -40,6 +40,9 @@ mkDerivation {
# Take only individual headers, or else we will clobber native libc, etc.
"sys/rpc/types.h"
]
++ lib.optionals (versionData.major == 14) [ "sys/sys/bitcount.h" ]
++ [
# Listed in Makekfile as INC
"include/mpool.h"
@ -53,6 +56,13 @@ mkDerivation {
"include/nl_types.h"
"include/elf.h"
"sys/sys/ctf.h"
]
++ lib.optionals (versionData.major == 14) [
"include/bitstring.h"
"sys/sys/bitstring.h"
"sys/sys/nv_namespace.h"
]
++ [
# Listed in Makekfile as SYSINC

View File

@ -42,7 +42,10 @@ mkDerivation {
"contrib/gdtoa"
"contrib/libc-pwcache"
"contrib/libc-vis"
"contrib/tzcode/stdtime"
]
++ lib.optionals (versionData.major == 13) [ "contrib/tzcode/stdtime" ]
++ lib.optionals (versionData.major == 14) [ "contrib/tzcode" ]
++ [
# libthr
"lib/libthr"

View File

@ -98,6 +98,8 @@ lib.makeOverridable (
preBuild =
''
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -D_VA_LIST -D_VA_LIST_DECLARED -Dva_list=__builtin_va_list -D_SIZE_T_DECLARED -D_SIZE_T -Dsize_t=__SIZE_TYPE__ -D_WCHAR_T"
''
+ lib.optionalString (versionData.major == 13) ''
export NIX_LDFLAGS="$NIX_LDFLAGS --undefined-version"
''
+ (attrs.preBuild or "");