code:
Copied from Debian.

Description: Fix build of  WebRTC on non-Linux systems
 * Define the WEBRTC_LINUX macro only on Linux, and not on GNU/Hurd or FreeBSD.
 * Fix type cast in the CurrentThreadId function.
Bug-Debian: https://bugs.debian.org/920851
Author: Nicholas Guriev <guriev-ns@ya.ru>
Last-Update: Tue, 29 Jan 2019 23:26:44 +0300

--- a/libtgvoip.gyp
+++ b/libtgvoip.gyp
@@ -869,20 +869,18 @@
             '"<(OS)" == "linux"', {
               'defines': [
                 'WEBRTC_POSIX',
-                'WEBRTC_LINUX',
               ],
               'conditions': [
                 [ '"<!(uname -m)" == "i686"', {
                   'cflags_cc': [
                     '-msse2',
                   ],
+                }], ['"<!(uname -s)" == "Linux"', {
+                  'defines': [
+                    'WEBRTC_LINUX',
+                  ],
                 }]
               ],
-              'direct_dependent_settings': {
-                'libraries': [
-
-                ],
-              },
             },
           ],
         ],
--- a/webrtc_dsp/rtc_base/platform_thread_types.cc
+++ b/webrtc_dsp/rtc_base/platform_thread_types.cc
@@ -31,7 +31,7 @@ PlatformThreadId CurrentThreadId() {
   return syscall(__NR_gettid);
 #else
   // Default implementation for nacl and solaris.
-  return reinterpret_cast<pid_t>(pthread_self());
+  return static_cast<pid_t>(pthread_self());
 #endif
 #endif  // defined(WEBRTC_POSIX)
 }


code:
Minimally patch libtheora's ancient config.guess to support mips64.

--- libtheora/config.guess.orig	2009-02-23 22:50:50.000000000 -0500
+++ libtheora/config.guess	2013-10-31 23:49:48.155999944 -0400
@@ -798,25 +798,24 @@
     m68*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit 0 ;;
-    mips:Linux:*:*)
+    mips:Linux:*:* | mips64:Linux:*:*)
 	eval $set_cc_for_build
 	sed 's/^	//' << EOF >$dummy.c
 	#undef CPU
-	#undef mips
-	#undef mipsel
+	#undef ${UNAME_MACHINE}
+	#undef ${UNAME_MACHINE}el
 	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mipsel
+	CPU=${UNAME_MACHINE}el
 	#else
 	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips
+	CPU=${UNAME_MACHINE}
 	#else
 	CPU=
 	#endif
 	#endif
 EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
-	rm -f $dummy.c && rmdir $tmpdir
-	test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit 0; }
 	;;
     ppc:Linux:*:*)
 	echo powerpc-unknown-linux-gnu

repo_name: maximed/guix

license: mit


code:
Taken from https://salsa.debian.org/debian/libtirpc/-/raw/master/debian/patches/06-hurd-client-port.diff

Description: Fix client code for hurd, avoiding malloc overflow
 When trying to setup a inet connection, it happens the following:
 - in libtirp, src/clnt_vc.c, clnt_vc_create gets called
 - when trying to allocate vc_fd_locks, __rpc_dtbsize() is used as size
   for that array of fd locks
 - __rpc_dtbsize(), in src/rpc_generic.c, queries using rlimit the
   maximum (rlim_max) number of file descriptors (RLIMIT_NOFILE):
   - on Linux, the default is { rlim_cur = 1024, rlim_max = 4096 }
   - on kFreeBSD, the default is { rlim_cur = 1024, rlim_max = 1024 }
   - on Hurd, the default is { rlim_cur = 1024, rlim_max = RLIM_INFINITY }
  meaning that on Hurd the memory allocation fails (as
  __rpc_dtbsize() * sizeof(int) overflows and is negative)

 Change libtiprc so __rpc_dtbsize falls back on rlim_cur if rlim_max
 is unlimited.

 This patch fixes the client connection using inet sockets; local unix
 sockets are not working, for two reasons so far:
 - getpeername on them gives EOPNOTSUPP
 - SO_REUSEADDR is not implemented for them
Author: Pino Toscano <pino@debian.org>

Bug-Debian: http://bugs.debian.org/739674
Forwarded: no
Reviewed-By: Petter Reinholdtsen
Last-Update: 2014-03-03

--- a/src/rpc_generic.c
+++ b/src/rpc_generic.c
@@ -107,12 +107,17 @@
 {
 	static int tbsize;
 	struct rlimit rl;
+	rlim_t lim;

 	if (tbsize) {
 		return (tbsize);
 	}
 	if (getrlimit(RLIMIT_NOFILE, &rl) == 0) {
-		return (tbsize = (int)rl.rlim_max);
+		lim = rl.rlim_max;
+		if (lim == RLIM_INFINITY) {
+			lim = rl.rlim_cur;
+		}
+		return (tbsize = (int)lim);
 	}
 	/*
 	 * Something wrong.  I'll try to save face by returning a


code:
This is a combination of two patches:

1) Taken from https://salsa.debian.org/debian/libtirpc/-/raw/master/debian/patches/03-kfreebsd.diff

Description: Fix build on non Linux architectures
Author: Andreas Beckmann <anbe@debian.org>
Last-Update: 2019-09-01

2) Taken from https://salsa.debian.org/debian/libtirpc/-/raw/master/debian/patches/05-hurd-port.diff

Description: Get source building on Hurd
 - Look for <sys/user.h> before using it.
 - Define MAXHOSTNAMELEN to 64 if missing.
 - Bind sockets on Hurd like on Linux.
Author: Petter Reinholdtsen <pere@hungry.com>

--- a/src/svc_dg.c
+++ b/src/svc_dg.c
@@ -648,6 +648,7 @@
 void
 svc_dg_enable_pktinfo(int fd, const struct __rpc_sockinfo *si)
 {
+#ifdef __linux__
 	int val = 1;

 	switch (si->si_af) {
@@ -660,6 +661,7 @@
 		break;
 #endif
 	}
+#endif
 }

 /*
@@ -670,6 +672,7 @@
 int
 svc_dg_valid_pktinfo(struct msghdr *msg)
 {
+#ifdef __linux__
 	struct cmsghdr *cmsg;

 	if (!msg->msg_name)
@@ -716,4 +719,7 @@
 	}

 	return 1;
+#else
+        return 0;
+#endif
 }
--- a/src/clnt_vc.c
+++ b/src/clnt_vc.c
@@ -71,10 +71,12 @@
 #define MCALL_MSG_SIZE 24

 #define CMGROUP_MAX    16
-#define SCM_CREDS      0x03            /* process creds (struct cmsgcred) */

 #undef rpc_createerr                   /* make it clear it is a thread safe variable */

+#ifndef SCM_CREDS
+#define SCM_CREDS      0x03            /* process creds (struct cmsgcred) */
+
 /*
  * Credentials structure, used to verify the identity of a peer
  * process that has sent us a message. This is allocated by the
@@ -90,6 +92,7 @@
         short   cmcred_ngroups;         /* number or groups */
         gid_t   cmcred_groups[CMGROUP_MAX];     /* groups */
 };
+#endif

 struct cmessage {
         struct cmsghdr cmsg;
--- a/src/getpeereid.c
+++ b/src/getpeereid.c
@@ -25,9 +25,14 @@
  */

+#include "config.h"
+
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <sys/un.h>
+#ifdef HAVE_SYS_USER_H
+#  include <sys/user.h>
+#endif /* HAVE_SYS_USER_H */

 #include <errno.h>
 #include <unistd.h>
--- a/src/getpeereid.c
+++ b/src/getpeereid.c
@@ -35,12 +36,25 @@
 int
 getpeereid(int s, uid_t *euid, gid_t *egid)
 {
+#ifndef HAVE_SYS_USER_H
+        return(-1);
+#else
+#ifdef XUCRED_VERSION
+	struct xucred uc;
+#define uid  cr_uid
+#define gid  cr_gid
+#else
 	struct ucred uc;
+#endif
 	socklen_t uclen;
 	int error;

 	uclen = sizeof(uc);
+#ifdef XUCRED_VERSION
+	error = getsockopt(s, 0, LOCAL_PEERCRED, &uc, &uclen);
+#else
 	error = getsockopt(s, SOL_SOCKET, SO_PEERCRED, &uc, &uclen); /*  SCM_CREDENTIALS */
+#endif
 	if (error != 0)
 		return (error);
 	//	if (uc.cr_version != XUCRED_VERSION)
@@ -59,4 +66,5 @@
 	*euid = uc.uid;
 	*egid = uc.gid;
 	return (0);
+#endif /* HAVE_SYS_USER_H */
  }
--- a/tirpc/reentrant.h
+++ b/tirpc/reentrant.h
@@ -36,7 +36,7 @@
  * These definitions are only guaranteed to be valid on Linux.
  */

-#if defined(__linux__)
+#if defined(__linux__) || defined(__GLIBC__)

 #include <pthread.h>

--- a/configure.ac
+++ b/configure.ac
@@ -93,7 +93,7 @@
 AC_PROG_LIBTOOL
 AC_HEADER_DIRENT
 AC_PREFIX_DEFAULT(/usr)
-AC_CHECK_HEADERS([arpa/inet.h fcntl.h libintl.h limits.h locale.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h unistd.h features.h gssapi/gssapi_ext.h])
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h libintl.h limits.h locale.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h unistd.h features.h gssapi/gssapi_ext.h sys/user.h])
 AC_CHECK_LIB([pthread], [pthread_create])
 AC_CHECK_FUNCS([getrpcbyname getrpcbynumber setrpcent endrpcent getrpcent])

--- a/src/auth_unix.c
+++ b/src/auth_unix.c
@@ -56,6 +56,11 @@
 #include <rpc/auth.h>
 #include <rpc/auth_unix.h>

+/* Workaround for Hurd */
+#ifndef MAXHOSTNAMELEN
+#  define MAXHOSTNAMELEN   64
+#endif
+
 /* auth_unix.c */
 static void authunix_nextverf (AUTH *);
 static bool_t authunix_marshal (AUTH *, XDR *);
--- a/src/bindresvport.c
+++ b/src/bindresvport.c
@@ -64,7 +64,7 @@
         return bindresvport_sa(sd, (struct sockaddr *)sin);
 }

-#ifdef __linux__
+#if defined(__linux__) || defined(__GNU__)

 #define STARTPORT 600
 #define LOWPORT 512


code:
https://github.com/libtom/libtommath/commit/93dea3a4162527346cd8856bfda6f17ffe98ab04.patch

From 93dea3a4162527346cd8856bfda6f17ffe98ab04 Mon Sep 17 00:00:00 2001
From: Steffen Jaeckel <s@jaeckel.eu>
Date: Thu, 31 Jan 2019 14:12:03 +0100
Subject: [PATCH] makefile.shared: fix compilation and linkage

---
 makefile.shared | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/makefile.shared b/makefile.shared
index 3955f830..870b18d1 100644
--- a/makefile.shared
+++ b/makefile.shared
@@ -18,6 +18,7 @@ ifndef LIBTOOL
   endif
 endif
 LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC)
+LTLINK = $(LIBTOOL) --mode=link --tag=CC $(CC)

 LCOV_ARGS=--directory .libs --directory .

@@ -59,7 +60,7 @@ objs: $(OBJECTS)
 LOBJECTS = $(OBJECTS:.o=.lo)

 $(LIBNAME):  $(OBJECTS)
-	$(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) $(LOBJECTS) -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION_SO) $(LIBTOOLFLAGS)
+	$(LTLINK) $(LDFLAGS) $(LOBJECTS) -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION_SO) $(LIBTOOLFLAGS)

 install: $(LIBNAME)
 	install -d $(DESTDIR)$(LIBPATH)
@@ -76,16 +77,16 @@ uninstall:
 	rm $(DESTDIR)$(LIBPATH)/pkgconfig/libtommath.pc

 test: $(LIBNAME) demo/demo.o
-	$(CC) $(CFLAGS) -c demo/demo.c -o demo/demo.o
-	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o test demo/demo.o $(LIBNAME)
+	$(LTCOMPILE) $(CFLAGS) -c demo/demo.c -o demo/demo.o
+	$(LTLINK) $(LDFLAGS) -o test demo/demo.o $(LIBNAME)

 test_standalone: $(LIBNAME) demo/demo.o
-	$(CC) $(CFLAGS) -c demo/demo.c -o demo/demo.o
-	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o test demo/demo.o $(LIBNAME)
+	$(LTCOMPILE) $(CFLAGS) -c demo/demo.c -o demo/demo.o
+	$(LTLINK) $(LDFLAGS) -o test demo/demo.o $(LIBNAME)

 .PHONY: mtest
 mtest:
-	cd mtest ; $(CC) $(CFLAGS) $(LDFLAGS) mtest.c -o mtest
+	cd mtest ; $(CC) $(CFLAGS) -O0 mtest.c $(LDFLAGS) -o mtest

 timing: $(LIBNAME) demo/timing.c
-	$(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -DTIMER demo/timing.c $(LIBNAME) -o timing
+	$(LTLINK) $(CFLAGS) $(LDFLAGS) -DTIMER demo/timing.c $(LIBNAME) -o timing


code:
Skip the nopic test on ARM and MIPS systems.

--- libtool-2.4.6/tests/demo.at.orig	2015-01-16 13:52:04.000000000 -0500
+++ libtool-2.4.6/tests/demo.at	2015-02-16 10:48:51.435851966 -0500
@@ -510,7 +510,7 @@
 AT_SETUP([force non-PIC objects])

 AT_CHECK([case $host in
-hppa*|x86_64*|s390*)
+hppa*|x86_64*|s390*|arm*|mips*)
   # These hosts cannot use non-PIC shared libs
   exit 77 ;;
 *-solaris*|*-sunos*)
--- libtool-2.4.6/tests/testsuite.orig	2015-02-15 11:15:25.000000000 -0500
+++ libtool-2.4.6/tests/testsuite	2015-02-16 10:50:58.736483216 -0500
@@ -8741,7 +8741,7 @@

 { set +x
 $as_echo "$at_srcdir/demo.at:535: case \$host in
-hppa*|x86_64*|s390*)
+hppa*|x86_64*|s390*|arm*|mips*)
   # These hosts cannot use non-PIC shared libs
   exit 77 ;;
 *-solaris*|*-sunos*)
@@ -8766,7 +8766,7 @@
 "
 at_fn_check_prepare_notrace 'a `...` command substitution' "demo.at:535"
 ( $at_check_trace; case $host in
-hppa*|x86_64*|s390*)
+hppa*|x86_64*|s390*|arm*|mips*)
   # These hosts cannot use non-PIC shared libs
   exit 77 ;;
 *-solaris*|*-sunos*)


code:
Disable tests who fail because they have to run as root.

--- libusb-0.1.12/tests/Makefile.in	2006-03-04 03:54:06.000000000 +0100
+++ libusb-0.1.12/tests/Makefile.in	2017-07-13 16:17:45.201728019 +0200
@@ -255,8 +255,8 @@
 hub_strings_LDADD = $(top_builddir)/libusbpp.la @OSLIBS@
 driver_name_SOURCES = driver_name.cpp
 driver_name_LDADD = $(top_builddir)/libusbpp.la @OSLIBS@
-TESTS = testlibusb descriptor_test id_test find_hubs find_mice \
-		get_resolution hub_strings $(OS_SPECIFIC)
+TESTS = testlibusb descriptor_test id_test find_hubs find_mice
+		#get_resolution hub_strings $(OS_SPECIFIC)

 XFAIL_TESTS = get_resolution hub_strings $(OS_SPECIFIC_XFAIL)
 all: all-am


code:
diff --git a/libusb/descriptor.c b/libusb/descriptor.c
index 74d6de5..0b0e314 100644
--- a/libusb/descriptor.c
+++ b/libusb/descriptor.c
@@ -1174,7 +1174,7 @@ int API_EXPORTED libusb_get_string_descriptor_ascii(libusb_device_handle *dev_ha
 		return LIBUSB_ERROR_IO;

 	if (tbuf[0] > r)
-		return LIBUSB_ERROR_IO;
+		tbuf[0] = r;

 	di = 0;
 	for (si = 2; si < tbuf[0]; si += 2) {
--
2.17.0


code:
--- a/libutils/CallStack.cpp	2018-04-25 20:13:06.348665241 +0200
+++ b/libutils/CallStack.cpp	2018-04-25 20:13:18.360510763 +0200
@@ -17,7 +17,7 @@
 #define LOG_TAG "CallStack"

 #include <memory>
-
+#include <cstdlib>
 #include <utils/CallStack.h>
 #include <utils/Printer.h>
 #include <utils/Errors.h>


code:
--- a/include/utils/StrongPointer.h	2018-04-25 18:42:34.321003602 +0200
+++ b/include/utils/StrongPointer.h	2018-04-25 18:42:42.180912201 +0200
@@ -17,8 +17,6 @@
 #ifndef ANDROID_STRONG_POINTER_H
 #define ANDROID_STRONG_POINTER_H

-#include <cutils/atomic.h>
-
 #include <stdint.h>
 #include <sys/types.h>
 #include <stdlib.h>
--- a/libutils/Trace.cpp	2018-04-25 20:41:48.775049786 +0200
+++ b/libutils/Trace.cpp	2018-04-25 20:42:13.674744182 +0200
@@ -21,5 +21,7 @@

 static void traceInit()
 {
+#if defined(__ANDROID__)
     ::android::add_sysprop_change_callback(atrace_update_tags, 0);
+#endif
 }


code:
From 18e3ff648356cf06a39372aa4a4bbf2732d9d0f4 Mon Sep 17 00:00:00 2001
From: Efraim Flashner <efraim@flashner.co.il>
Date: Tue, 12 Dec 2017 21:36:44 +0200
Subject: [PATCH] don't use bundled libvdpau headers

---
 CMakeLists.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0484179..e950707 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,16 +9,17 @@ find_package(PkgConfig REQUIRED)
 find_package(X11 REQUIRED)
 pkg_check_modules(LIBVA      libva-x11  REQUIRED)
 pkg_check_modules(LIBGL      gl         REQUIRED)
+pkg_check_modules(LIBVDPAU   vdpau      REQUIRED)

 set(DRIVER_NAME "vdpau_va_gl" CACHE STRING "driver name")
 set(LIB_SUFFIX "" CACHE STRING "library path suffix (if needed)")
 set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/vdpau" CACHE PATH "library installation path")

 include_directories (
-    3rdparty
     ${X11_INCLUDE_DIRS}
     ${LIBVA_INCLUDE_DIRS}
     ${LIBGL_INCLUDE_DIRS}
+    ${LIBVDPAU_INCLUDE_DIRS}
     ${GENERATED_INCLUDE_DIRS}
     ${CMAKE_BINARY_DIR}
 )
--
2.15.1


code:
Patch from NixOS:
https://raw.githubusercontent.com/NixOS/nixpkgs/b98031a49c66095dd1eb9185ecdaeeb5e3cd752d/pkgs/development/libraries/libvirt/0001-meson-patch-in-an-install-prefix-for-building-on-nix.patch

From a896b0be849455edb83a9305dfec9b41447ef3e4 Mon Sep 17 00:00:00 2001
From: Euan Kemp <euank@euank.com>
Date: Thu, 14 Jan 2021 00:32:00 -0800
Subject: [PATCH] meson: patch in an install prefix for building on nix

Used in the nixpkgs version of libvirt so that we can install things in
the nix store, but read them from the root filesystem.
---
 meson.build                       |  9 +++++++++
 meson_options.txt                 |  2 ++
 src/libxl/meson.build             |  6 +++---
 src/locking/meson.build           |  8 ++++----
 src/lxc/meson.build               |  6 +++---
 src/meson.build                   | 18 +++++++++---------
 src/network/meson.build           | 12 ++++++------
 src/nwfilter/xml/meson.build      |  2 +-
 src/qemu/meson.build              | 14 +++++++-------
 src/remote/meson.build            |  6 +++---
 src/security/apparmor/meson.build |  8 ++++----
 tools/meson.build                 |  4 ++--
 12 files changed, 53 insertions(+), 42 deletions(-)

diff --git a/meson.build b/meson.build
index b5164f6..33719f1 100644
--- a/meson.build
+++ b/meson.build
@@ -39,6 +39,8 @@ if host_machine.system() == 'windows'
   conf.set('WINVER', '0x0600') # Win Vista / Server 2008
 endif

+# patched in for nix
+install_prefix = get_option('install_prefix')

 # set various paths

@@ -57,6 +59,13 @@ else
   sysconfdir = prefix / get_option('sysconfdir')
 endif

+# nix: don't prefix the localstatedir; some things need to write to it, so it
+# can't be in the nix store, and that's what the prefix is.
+# We'll prefix things ourselves where needed
+localstatedir = get_option('localstatedir')
+# Same for sysconfidr
+sysconfdir = get_option('sysconfdir')
+
 # if --prefix is /usr, don't use /usr/var for localstatedir or /usr/etc for
 # sysconfdir as this makes a lot of things break in testing situations
 if prefix == '/usr'
diff --git a/meson_options.txt b/meson_options.txt
index e5d79c2..081cd32 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,5 @@
+option('install_prefix', type: 'string', value: '', description: 'prefix for nix store installation')
+
 option('no_git', type: 'boolean', value: false, description: 'Disable git submodule update')
 option('packager', type: 'string', value: '', description: 'Extra packager name')
 option('packager_version', type: 'string', value: '', description: 'Extra packager version')
diff --git a/src/libxl/meson.build b/src/libxl/meson.build
index 3bb6cc5..78d7be0 100644
--- a/src/libxl/meson.build
+++ b/src/libxl/meson.build
@@ -84,8 +84,8 @@ if conf.has('WITH_LIBXL')
   }

   virt_install_dirs += [
-    localstatedir / 'lib' / 'libvirt' / 'libxl',
-    runstatedir / 'libvirt' / 'libxl',
-    localstatedir / 'log' / 'libvirt' / 'libxl',
+    install_prefix + localstatedir / 'lib' / 'libvirt' / 'libxl',
+    install_prefix + runstatedir / 'libvirt' / 'libxl',
+    install_prefix + localstatedir / 'log' / 'libvirt' / 'libxl',
   ]
 endif
diff --git a/src/locking/meson.build b/src/locking/meson.build
index 8a28310..9da81cc 100644
--- a/src/locking/meson.build
+++ b/src/locking/meson.build
@@ -243,14 +243,14 @@ if conf.has('WITH_LIBVIRTD')
   }

   virt_install_dirs += [
-    localstatedir / 'lib' / 'libvirt' / 'lockd',
-    localstatedir / 'lib' / 'libvirt' / 'lockd' / 'files',
-    runstatedir / 'libvirt' / 'lockd',
+    install_prefix + localstatedir / 'lib' / 'libvirt' / 'lockd',
+    install_prefix + localstatedir / 'lib' / 'libvirt' / 'lockd' / 'files',
+    install_prefix + runstatedir / 'libvirt' / 'lockd',
   ]

   if conf.has('WITH_SANLOCK')
     virt_install_dirs += [
-      localstatedir / 'lib' / 'libvirt' / 'sanlock',
+      install_prefix + localstatedir / 'lib' / 'libvirt' / 'sanlock',
     ]
   endif
 endif
diff --git a/src/lxc/meson.build b/src/lxc/meson.build
index f8e2a88..96d6687 100644
--- a/src/lxc/meson.build
+++ b/src/lxc/meson.build
@@ -182,8 +182,8 @@ if conf.has('WITH_LXC')
   }

   virt_install_dirs += [
-    localstatedir / 'lib' / 'libvirt' / 'lxc',
-    runstatedir / 'libvirt' / 'lxc',
-    localstatedir / 'log' / 'libvirt' / 'lxc',
+    install_prefix + localstatedir / 'lib' / 'libvirt' / 'lxc',
+    install_prefix + runstatedir / 'libvirt' / 'lxc',
+    install_prefix + localstatedir / 'log' / 'libvirt' / 'lxc',
   ]
 endif
diff --git a/src/meson.build b/src/meson.build
index 7c47821..d33d16a 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -669,7 +669,7 @@ endforeach

 virt_conf_files += 'libvirt.conf'

-install_data(virt_conf_files, install_dir: confdir)
+install_data(virt_conf_files, install_dir: install_prefix + confdir)
 install_data(virt_aug_files, install_dir: virt_aug_dir)

 # augeas_test_data:
@@ -729,7 +729,7 @@ foreach data : virt_daemon_confs
     output: '@0@.conf'.format(data['name']),
     configuration: daemon_conf,
     install: true,
-    install_dir: confdir,
+    install_dir: install_prefix + confdir,
   )

   if data.get('with_ip', false)
@@ -853,14 +853,14 @@ if conf.has('WITH_LIBVIRTD')

       install_data(
         init_file,
-        install_dir: sysconfdir / 'init.d',
+        install_dir: install_prefix + sysconfdir / 'init.d',
         rename: [ init['name'] ],
       )

       if init.has_key('confd')
         install_data(
           init['confd'],
-          install_dir: sysconfdir / 'conf.d',
+          install_dir: install_prefix + sysconfdir / 'conf.d',
           rename: [ init['name'] ],
         )
       endif
@@ -872,7 +872,7 @@ if init_script != 'none'
   foreach sysconf : sysconf_files
     install_data(
       sysconf['file'],
-      install_dir: sysconfdir / 'sysconfig',
+      install_dir: install_prefix + sysconfdir / 'sysconfig',
       rename: [ sysconf['name'] ],
     )
   endforeach
@@ -897,10 +897,10 @@ endif
 # Install empty directories

 virt_install_dirs += [
-  localstatedir / 'cache' / 'libvirt',
-  localstatedir / 'lib' / 'libvirt' / 'images',
-  localstatedir / 'lib' / 'libvirt' / 'filesystems',
-  localstatedir / 'lib' / 'libvirt' / 'boot',
+  install_prefix + localstatedir / 'cache' / 'libvirt',
+  install_prefix + localstatedir / 'lib' / 'libvirt' / 'images',
+  install_prefix + localstatedir / 'lib' / 'libvirt' / 'filesystems',
+  install_prefix + localstatedir / 'lib' / 'libvirt' / 'boot',
 ]

 meson.add_install_script(
diff --git a/src/network/meson.build b/src/network/meson.build
index 3ec598c..b02040b 100644
--- a/src/network/meson.build
+++ b/src/network/meson.build
@@ -79,9 +79,9 @@ if conf.has('WITH_NETWORK')
   }

   virt_install_dirs += [
-    localstatedir / 'lib' / 'libvirt' / 'network',
-    localstatedir / 'lib' / 'libvirt' / 'dnsmasq',
-    runstatedir / 'libvirt' / 'network',
+    install_prefix + localstatedir / 'lib' / 'libvirt' / 'network',
+    install_prefix + localstatedir / 'lib' / 'libvirt' / 'dnsmasq',
+    install_prefix + runstatedir / 'libvirt' / 'network',
   ]

   configure_file(
@@ -89,12 +89,12 @@ if conf.has('WITH_NETWORK')
     output: '@BASENAME@',
     copy: true,
     install: true,
-    install_dir: confdir / 'qemu' / 'networks',
+    install_dir: install_prefix + confdir / 'qemu' / 'networks',
   )

   meson.add_install_script(
     meson_python_prog.path(), python3_prog.path(), meson_install_symlink_prog.path(),
-    confdir / 'qemu' / 'networks' / 'autostart',
+    install_prefix + confdir / 'qemu' / 'networks' / 'autostart',
     '../default.xml', 'default.xml',
   )

diff --git a/src/nwfilter/xml/meson.build b/src/nwfilter/xml/meson.build
index 0d96c54..66c92a1 100644
--- a/src/nwfilter/xml/meson.build
+++ b/src/nwfilter/xml/meson.build
@@ -25,4 +25,4 @@ nwfilter_xml_files = [
   'qemu-announce-self.xml',
 ]

-install_data(nwfilter_xml_files, install_dir: sysconfdir / 'libvirt' / 'nwfilter')
+install_data(nwfilter_xml_files, install_dir: install_prefix + sysconfdir / 'libvirt' / 'nwfilter')
diff --git a/src/qemu/meson.build b/src/qemu/meson.build
index 90640b0..8802cec 100644
--- a/src/qemu/meson.build
+++ b/src/qemu/meson.build
@@ -171,12 +171,12 @@ if conf.has('WITH_QEMU')
   }

   virt_install_dirs += [
-    localstatedir / 'lib' / 'libvirt' / 'qemu',
-    runstatedir / 'libvirt' / 'qemu',
-    localstatedir / 'cache' / 'libvirt' / 'qemu',
-    localstatedir / 'log' / 'libvirt' / 'qemu',
-    localstatedir / 'lib' / 'libvirt' / 'swtpm',
-    runstatedir / 'libvirt' / 'qemu' / 'swtpm',
-    localstatedir / 'log' / 'swtpm' / 'libvirt' / 'qemu',
+    install_prefix + localstatedir / 'lib' / 'libvirt' / 'qemu',
+    install_prefix + runstatedir / 'libvirt' / 'qemu',
+    install_prefix + localstatedir / 'cache' / 'libvirt' / 'qemu',
+    install_prefix + localstatedir / 'log' / 'libvirt' / 'qemu',
+    install_prefix + localstatedir / 'lib' / 'libvirt' / 'swtpm',
+    install_prefix + runstatedir / 'libvirt' / 'qemu' / 'swtpm',
+    install_prefix + localstatedir / 'log' / 'swtpm' / 'libvirt' / 'qemu',
   ]
 endif
diff --git a/src/remote/meson.build b/src/remote/meson.build
index 9ad2f6a..429a15b 100644
--- a/src/remote/meson.build
+++ b/src/remote/meson.build
@@ -245,7 +245,7 @@ if conf.has('WITH_REMOTE')
     }

     virt_install_dirs += [
-      localstatedir / 'log' / 'libvirt',
+      install_prefix + localstatedir / 'log' / 'libvirt',
     ]

     logrotate_conf = configuration_data()
@@ -259,7 +259,7 @@ if conf.has('WITH_REMOTE')
       )
       install_data(
         log_file,
-        install_dir: sysconfdir / 'logrotate.d',
+        install_dir: install_prefix + sysconfdir / 'logrotate.d',
         rename: [ name ],
       )
     endforeach
@@ -309,7 +309,7 @@ endif
 if conf.has('WITH_SASL')
   install_data(
     'libvirtd.sasl',
-    install_dir: sysconfdir / 'sasl2',
+    install_dir: install_prefix + sysconfdir / 'sasl2',
     rename: [ 'libvirt.conf' ],
   )
 endif
diff --git a/src/security/apparmor/meson.build b/src/security/apparmor/meson.build
index af43780..e2d6c81 100644
--- a/src/security/apparmor/meson.build
+++ b/src/security/apparmor/meson.build
@@ -17,22 +17,22 @@ foreach name : apparmor_gen_profiles
     output: name,
     configuration: apparmor_gen_profiles_conf,
     install: true,
-    install_dir: apparmor_dir,
+    install_dir: install_prefix + apparmor_dir,
   )
 endforeach

 install_data(
   [ 'libvirt-qemu', 'libvirt-lxc' ],
-  install_dir: apparmor_dir / 'abstractions',
+  install_dir: install_prefix + apparmor_dir / 'abstractions',
 )

 install_data(
   [ 'TEMPLATE.qemu', 'TEMPLATE.lxc' ],
-  install_dir: apparmor_dir / 'libvirt',
+  install_dir: install_prefix + apparmor_dir / 'libvirt',
 )

 install_data(
   'usr.lib.libvirt.virt-aa-helper.local',
-  install_dir: apparmor_dir / 'local',
+  install_dir: install_prefix + apparmor_dir / 'local',
   rename: 'usr.lib.libvirt.virt-aa-helper',
 )
diff --git a/tools/meson.build b/tools/meson.build
index b8c6802..dacd0ff 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -115,7 +115,7 @@ if conf.has('WITH_LOGIN_SHELL')
     install_rpath: libvirt_rpath,
   )

-  install_data('virt-login-shell.conf', install_dir: sysconfdir / 'libvirt')
+  install_data('virt-login-shell.conf', install_dir: install_prefix + sysconfdir / 'libvirt')
 endif

 if host_machine.system() == 'windows'
@@ -274,7 +274,7 @@ configure_file(
 if init_script == 'systemd'
   install_data(
     'libvirt-guests.sysconf',
-    install_dir: sysconfdir / 'sysconfig',
+    install_dir: install_prefix + sysconfdir / 'sysconfig',
     rename: 'libvirt-guests',
   )


code:
From 9ca0b2955edea162b255b428e493cd8ffac52167 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
 <rosen644835@gmail.com>
Date: Fri, 1 Nov 2019 17:29:00 +0100
Subject: [PATCH] vircgroup: Ensure /machine group is associated with its
 parent.

Call first virCgroupNew on the parent group virCgroupNewPartition if
it is available on before the creation of the child group.  This
ensures that the creation of a first level group on the unified
architecture, as the check at virCgroupV2ParseControllersFile as the
parent file is there.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1760233
---
 src/util/vircgroup.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index b46f20abfd..33c61f2d45 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -855,9 +855,6 @@ virCgroupNewPartition(const char *path,
     if (virCgroupSetPartitionSuffix(path, &newPath) < 0)
         goto cleanup;

-    if (virCgroupNew(-1, newPath, NULL, controllers, group) < 0)
-        goto cleanup;
-
     if (STRNEQ(newPath, "/")) {
         char *tmp;
         parentPath = g_strdup(newPath);
@@ -868,7 +865,12 @@ virCgroupNewPartition(const char *path,

         if (virCgroupNew(-1, parentPath, NULL, controllers, &parent) < 0)
             goto cleanup;
+    }

+    if (virCgroupNew(-1, newPath, parent, controllers, group) < 0)
+        goto cleanup;
+
+    if (parent) {
         if (virCgroupMakeGroup(parent, *group, create, VIR_CGROUP_NONE) < 0)
             goto cleanup;
     }
--
2.23.0


code:
Patch contents copied from Mozilla esr45 changeset 312077:7ebfe49f001c

  changeset:   312077:7ebfe49f001c
  user:        Randell Jesup <rjesup@jesup.org>
  Date:        Fri Apr 15 23:11:01 2016 -0400
  summary:     Bug 1263384: validate input frames against configured resolution in vp8 r=rillian, a=ritu,lizzard

  MozReview-Commit-ID: BxDCnJe0mzs

--- libvpx-1.5.0/vp8/vp8_cx_iface.c.orig	2015-11-09 17:12:38.000000000 -0500
+++ libvpx-1.5.0/vp8/vp8_cx_iface.c	2016-06-08 08:48:46.037213092 -0400
@@ -860,11 +860,20 @@
     if (img != NULL) {
       res = image2yuvconfig(img, &sd);

-      if (vp8_receive_raw_frame(ctx->cpi, ctx->next_frame_flag | lib_flags, &sd,
-                                dst_time_stamp, dst_end_time_stamp)) {
-        VP8_COMP *cpi = (VP8_COMP *)ctx->cpi;
-        res = update_error_state(ctx, &cpi->common.error);
-      }
+            if (sd.y_width != ctx->cfg.g_w || sd.y_height != ctx->cfg.g_h) {
+                /* from vp8_encoder.h for g_w/g_h:
+                   "Note that the frames passed as input to the encoder must have this resolution"
+                */
+                ctx->base.err_detail = "Invalid input frame resolution";
+                res = VPX_CODEC_INVALID_PARAM;
+            } else {
+                if (vp8_receive_raw_frame(ctx->cpi, ctx->next_frame_flag | lib_flags,
+                                          &sd, dst_time_stamp, dst_end_time_stamp))
+                {
+                    VP8_COMP *cpi = (VP8_COMP *)ctx->cpi;
+                    res = update_error_state(ctx, &cpi->common.error);
+                }
+            }

       /* reset for next frame */
       ctx->next_frame_flag = 0;


code:
This patch adds an "--xpath0" option to xmllint so that NUL characters
can be used as separators.

See <https://gitlab.gnome.org/GNOME/libxml2/-/issues/227>.

diff --git a/doc/xmllint.xml b/doc/xmllint.xml
--- a/doc/xmllint.xml
+++ b/doc/xmllint.xml
@@ -70,6 +70,7 @@
 			<arg choice="plain"><option>--debug</option></arg>
 			<arg choice="plain"><option>--shell</option></arg>
 			<arg choice="plain"><option>--xpath "<replaceable class="option">XPath_expression</replaceable>"</option></arg>
+			<arg choice="plain"><option>--xpath0 "<replaceable class="option">XPath_expression</replaceable>"</option></arg>
 			<arg choice="plain"><option>--debugent</option></arg>
 			<arg choice="plain"><option>--copy</option></arg>
 			<arg choice="plain"><option>--recover</option></arg>
@@ -537,6 +538,21 @@
 			node set is serialized in full in the output. In case
 			of an empty node set the "XPath set is empty" result
 			will be shown and an error exit code will be returned.
+			Results are separated by the newline character.
+		</para>
+	</listitem>
+		</varlistentry>
+
+		<varlistentry>
+	<term><option>--xpath0 "<replaceable class="option">XPath_expression</replaceable>"</option></term>
+	<listitem>
+		<para>
+			Run an XPath expression given as argument and print the
+			result. In case of a nodeset result, each node in the
+			node set is serialized in full in the output. In case
+			of an empty node set the "XPath set is empty" result
+			will be shown and an error exit code will be returned.
+			Results are separated by the null character.
 		</para>
 	</listitem>
 		</varlistentry>
diff --git a/xmllint.c b/xmllint.c
--- a/xmllint.c
+++ b/xmllint.c
@@ -194,6 +194,7 @@ static int sax1 = 0;
 #endif /* LIBXML_SAX1_ENABLED */
 #ifdef LIBXML_XPATH_ENABLED
 static const char *xpathquery = NULL;
+static const char *xpathsep = "\n";
 #endif
 static int options = XML_PARSE_COMPACT | XML_PARSE_BIG_LINES;
 static int sax = 0;
@@ -2095,7 +2096,7 @@ static void doXPathDump(xmlXPathObjectPtr cur) {
             for (i = 0;i < cur->nodesetval->nodeNr;i++) {
                 node = cur->nodesetval->nodeTab[i];
                 xmlNodeDumpOutput(buf, NULL, node, 0, 0, NULL);
-                xmlOutputBufferWrite(buf, 1, "\n");
+		xmlOutputBufferWrite(buf, 1, xpathsep);
             }
             xmlOutputBufferClose(buf);
 #else
@@ -2104,27 +2105,27 @@ static void doXPathDump(xmlXPathObjectPtr cur) {
 	    break;
         }
         case XPATH_BOOLEAN:
-	    if (cur->boolval) printf("true\n");
-	    else printf("false\n");
+	    if (cur->boolval) printf("true%s", xpathsep);
+	    else printf("false%s", xpathsep);
 	    break;
         case XPATH_NUMBER:
 	    switch (xmlXPathIsInf(cur->floatval)) {
 	    case 1:
-		printf("Infinity\n");
+	        printf("Infinity%s", xpathsep);
 		break;
 	    case -1:
-		printf("-Infinity\n");
+	        printf("-Infinity%s", xpathsep);
 		break;
 	    default:
 		if (xmlXPathIsNaN(cur->floatval)) {
-		    printf("NaN\n");
+		    printf("NaN%s", xpathsep);
 		} else {
-		    printf("%0g\n", cur->floatval);
+		    printf("%0g%s", cur->floatval, xpathsep);
 		}
 	    }
 	    break;
         case XPATH_STRING:
-	    printf("%s\n", (const char *) cur->stringval);
+	    printf("%s%s", (const char *) cur->stringval, xpathsep);
 	    break;
         case XPATH_UNDEFINED:
 	    fprintf(stderr, "XPath Object is uninitialized\n");
@@ -3098,7 +3099,8 @@ static void usage(FILE *f, const char *name) {
     fprintf(f, "\t--sax: do not build a tree but work just at the SAX level\n");
     fprintf(f, "\t--oldxml10: use XML-1.0 parsing rules before the 5th edition\n");
 #ifdef LIBXML_XPATH_ENABLED
-    fprintf(f, "\t--xpath expr: evaluate the XPath expression, imply --noout\n");
+    fprintf(f, "\t--xpath expr: evaluate the XPath expression, results are separated by \\n, imply --noout\n");
+    fprintf(f, "\t--xpath0 expr: evaluate the XPath expression, results are separated by \\0, imply --noout\n");
 #endif

     fprintf(f, "\nLibxml project home page: http://xmlsoft.org/\n");
@@ -3480,6 +3482,13 @@ main(int argc, char **argv) {
 	    i++;
 	    noout++;
 	    xpathquery = argv[i];
+	    xpathsep = "\n";
+        } else if ((!strcmp(argv[i], "-xpath0")) ||
+                   (!strcmp(argv[i], "--xpath0"))) {
+	    i++;
+	    noout++;
+	    xpathquery = argv[i];
+	    xpathsep = "\0";
 #endif
 	} else if ((!strcmp(argv[i], "-oldxml10")) ||
 	           (!strcmp(argv[i], "--oldxml10"))) {
@@ -3712,6 +3721,11 @@ main(int argc, char **argv) {
 	    i++;
 	    continue;
 	}
+        if ((!strcmp(argv[i], "-xpath0")) ||
+	    (!strcmp(argv[i], "--xpath0"))) {
+	    i++;
+	    continue;
+	}
 #endif
 	if ((timing) && (repeat))
 	    startTimer();


code:
This makes generated IDs deterministic.

Written by Daniel Veillard.

This should be fixed in next release (2.29).
See https://bugzilla.gnome.org/show_bug.cgi?id=751621.

diff --git a/libxslt/functions.c b/libxslt/functions.c
index 6448bde..5b00a6d 100644
--- a/libxslt/functions.c
+++ b/libxslt/functions.c
@@ -651,6 +651,63 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs)
 }

 /**
+ * xsltCleanupIds:
+ * @ctxt: the transformation context
+ * @root: the root of the resulting document
+ *
+ * This clean up ids which may have been saved in Element contents
+ * by xsltGenerateIdFunction() to provide stable IDs on elements.
+ *
+ * Returns the number of items cleaned or -1 in case of error
+ */
+int
+xsltCleanupIds(xsltTransformContextPtr ctxt, xmlNodePtr root) {
+    xmlNodePtr cur;
+    int count = 0;
+
+    if ((ctxt == NULL) || (root == NULL))
+        return(-1);
+    if (root->type != XML_ELEMENT_NODE)
+        return(-1);
+
+    cur = root;
+    while (cur != NULL) {
+	if (cur->type == XML_ELEMENT_NODE) {
+	    if (cur->content != NULL) {
+	        cur->content = NULL;
+		count++;
+	    }
+	    if (cur->children != NULL) {
+		cur = cur->children;
+		continue;
+	    }
+	}
+	if (cur->next != NULL) {
+	    cur = cur->next;
+	    continue;
+	}
+	do {
+	    cur = cur->parent;
+	    if (cur == NULL)
+		break;
+	    if (cur == (xmlNodePtr) root) {
+		cur = NULL;
+		break;
+	    }
+	    if (cur->next != NULL) {
+		cur = cur->next;
+		break;
+	    }
+	} while (cur != NULL);
+    }
+
+fprintf(stderr, "Attributed %d IDs for element, cleaned up %d\n",
+        ctxt->nextid, count);
+
+    return(count);
+}
+
+/**
  * xsltGenerateIdFunction:
  * @ctxt:  the XPath Parser context
  * @nargs:  the number of arguments
@@ -701,7 +758,39 @@ xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){
     if (obj)
         xmlXPathFreeObject(obj);

-    val = (long)((char *)cur - (char *)&base_address);
+    /*
+     * Try to provide stable ID for generated document:
+     *   - usually ID are computed to be placed on elements via attributes
+     *     so using the element as the node for the ID
+     *   - the cur->content should be a correct placeholder for this, we use
+     *     it to hold element node numbers in xmlXPathOrderDocElems to
+     *     speed up XPath too
+     *   - xsltCleanupIds() clean them up before handing the XSLT output
+     *     to the API client.
+     *   - other nodes types use the node address method but that should
+     *     not end up in resulting document ID
+     *   - we can enable this by default without risk of performance issues
+     *     only the one pass xsltCleanupIds() is added
+     */
+    if (cur->type == XML_ELEMENT_NODE) {
+        if (cur->content == NULL) {
+	    xsltTransformContextPtr tctxt;
+
+	    tctxt = xsltXPathGetTransformContext(ctxt);
+	    if (tctxt == NULL) {
+		val = (long)((char *)cur - (char *)&base_address);
+	    } else {
+		tctxt->nextid++;
+		val = tctxt->nextid;
+		cur->content = (void *) (val);
+	    }
+	} else {
+	    val = (long) cur->content;
+	}
+    } else {
+	val = (long)((char *)cur - (char *)&base_address);
+    }
+
     if (val >= 0) {
       sprintf((char *)str, "idp%ld", val);
     } else {
diff --git a/libxslt/functions.h b/libxslt/functions.h
index e0e0bf9..4a1e163 100644
--- a/libxslt/functions.h
+++ b/libxslt/functions.h
@@ -64,6 +64,13 @@ XSLTPUBFUN void XSLTCALL
 					 int nargs);

 /*
+ * Cleanup for ID generation
+ */
+XSLTPUBFUN int XSLTCALL
+	xsltCleanupIds			(xsltTransformContextPtr ctxt,
+					 xmlNodePtr root);
+
+/*
  * And the registration
  */

diff --git a/libxslt/transform.c b/libxslt/transform.c
index 24f9eb2..2bdf6bf 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -700,6 +700,7 @@ xsltNewTransformContext(xsltStylesheetPtr style, xmlDocPtr doc) {
     cur->traceCode = (unsigned long*) &xsltDefaultTrace;
     cur->xinclude = xsltGetXIncludeDefault();
     cur->keyInitLevel = 0;
+    cur->nextid = 0;

     return(cur);

@@ -6092,6 +6093,13 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
     if (root != NULL) {
         const xmlChar *doctype = NULL;

+        /*
+	 * cleanup ids which may have been saved in Elements content ptrs
+	 */
+	if (ctxt->nextid != 0) {
+	    xsltCleanupIds(ctxt, root);
+	}
+
         if ((root->ns != NULL) && (root->ns->prefix != NULL))
 	    doctype = xmlDictQLookup(ctxt->dict, root->ns->prefix, root->name);
 	if (doctype == NULL)
diff --git a/libxslt/xsltInternals.h b/libxslt/xsltInternals.h
index 95e8fe6..8eedae4 100644
--- a/libxslt/xsltInternals.h
+++ b/libxslt/xsltInternals.h
@@ -1782,6 +1782,8 @@ struct _xsltTransformContext {
     int maxTemplateVars;
     unsigned long opLimit;
     unsigned long opCount;
+
+    unsigned long nextid;/* for generating stable ids */
 };

 /**


code:
diff --git a/src/Intrinsic.c b/src/Intrinsic.c
index c9624ec..addcdba 100644
--- a/src/Intrinsic.c
+++ b/src/Intrinsic.c
@@ -1312,21 +1312,101 @@ static void FillInLangSubs(
     } else (void) strcpy(*rest, string);
 }

+
+
 /*
- * default path used if environment variable XFILESEARCHPATH
- * is not defined.  Also substitued for %D.
- * The exact value should be documented in the implementation
- * notes for any Xt implementation.
+   Return the default search path for the function
+   XtResolvePathname to use if XFILESEARCHPATH is
+   not defined.
+
+   It returns the combination the set of values which are the 6 "stems" below,
+   prepended with "/run/current-system/profile", and $GUIX_PROFILE and
+   "$HOME/.guix-profile"
+
+   These values provide the default paths where Guix/GuixSD can expect
+   to find resources for installed packages.
  */
-static const char *implementation_default_path(void)
+static const char *guix_default_path(void)
 {
-#if defined(WIN32)
-    static char xfilesearchpath[] = "";
+  static const char *search_path_default_stem[] = {
+    "/lib/X11/%L/%T/%N%C%S",
+    "/lib/X11/%l/%T/%N%C%S",
+    "/lib/X11/%T/%N%C%S",
+    "/lib/X11/%L/%T/%N%S",
+    "/lib/X11/%l/%T/%N%S",
+    "/lib/X11/%T/%N%S"
+  };
+
+#define SIZEOF_STEMS  (strlen (search_path_default_stem[0])	\
+		       + strlen (search_path_default_stem[1])	\
+		       + strlen (search_path_default_stem[2])	\
+		       + strlen (search_path_default_stem[3])	\
+		       + strlen (search_path_default_stem[4])	\
+		       + strlen (search_path_default_stem[5]))
+
+
+  int i;
+  const char *current_profile = "/run/current-system/profile";
+  char *home = getenv ("HOME");
+  char *guix_profile = getenv ("GUIX_PROFILE");
+
+  size_t bytesAllocd = SIZEOF_STEMS + 1;
+
+  /* This function is evaluated multiple times and the calling
+     code assumes that it is idempotent. So we must not allow
+     (say) a changed environment variable to cause it to return
+     something different. */
+  static char *path = NULL;
+  if (path)
+    return path;
+
+  bytesAllocd += 6 * (1 + strlen (current_profile));
+
+  if (guix_profile != NULL)
+    {
+      bytesAllocd += SIZEOF_STEMS;
+      bytesAllocd += 6 * (1 + strlen (guix_profile));
+    }

-    return xfilesearchpath;
-#else
-    return XFILESEARCHPATHDEFAULT;
-#endif
+  if (home != NULL)
+    {
+      bytesAllocd += SIZEOF_STEMS;
+      bytesAllocd += 6 * (1 + strlen(home) + strlen ("/.guix-profile"));
+    }
+
+  path = XtMalloc(bytesAllocd);
+  if (path == NULL) _XtAllocError(NULL);
+
+  memset (path, 0, bytesAllocd);
+
+  for (i = 0 ; i < 6 ; ++i)
+    {
+      strcat (path, current_profile);
+      strcat (path, search_path_default_stem[i]);
+      strcat (path, ":");
+    }
+
+  if (guix_profile != NULL)
+    for (i = 0 ; i < 6 ; ++i)
+      {
+	strcat (path, guix_profile);
+	strcat (path, search_path_default_stem[i]);
+	strcat (path, ":");
+      }
+
+  if (home != NULL)
+    for (i = 0 ; i < 6 ; ++i)
+      {
+	strcat (path, home);
+	strcat (path, "/.guix-profile");
+	strcat (path, search_path_default_stem[i]);
+	strcat (path, ":");
+      }
+
+  /* Remove final : */
+  path[strlen(path) - 1] = '\0';
+
+  return path;
 }

@@ -1354,7 +1434,7 @@ _XtString XtResolvePathname(
 {
     XtPerDisplay pd;
     static const char *defaultPath = NULL;
-    const char *impl_default = implementation_default_path();
+    const char *impl_default = guix_default_path();
     int idef_len = (int) strlen(impl_default);
     char *massagedPath;
     int bytesAllocd, bytesLeft;


code:
--- a/libziparchive/zip_writer.cc	2018-04-25 22:33:05.472674164 +0200
+++ b/libziparchive/zip_writer.cc	2018-04-25 22:33:21.296519518 +0200
@@ -22,6 +22,7 @@

 #include <sys/param.h>

+#include <cstring>
 #include <cassert>
 #include <cstdio>
 #include <memory>


code:
Patch copied from Debian:

https://anonscm.debian.org/cgit/pkg-games/lierolibre.git/tree/debian/patches/0001-Use-unaligned-access-define-over-checking-arch.patch?id=82910748906855f6e6bfe30b3f077e8c793ae424

From 396f19b6b7743d394307f70f0c0108419824437b Mon Sep 17 00:00:00 2001
From: Martin Erik Werner <martinerikwerner@gmail.com>
Date: Sun, 28 Jun 2015 16:31:34 +0200
Subject: [PATCH 1/3] Use unaligned access define over checking arch

This todo item seems like it done, and just needed implementing...
---
 io/encoding.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gvl/io/encoding.hpp b/src/gvl/io/encoding.hpp
index c491677..89bb612 100644
--- a/src/gvl/io/encoding.hpp
+++ b/src/gvl/io/encoding.hpp
@@ -374,7 +374,7 @@ struct octet_stream_writer
 		// inlining of the common case
 		if(std::size_t(end_ - cur_) >= len)
 		{
-#if GVL_X86 || GVL_X86_64 // TODO: A define that says whether unaligned access is allowed
+#if GVL_UNALIGNED_ACCESS
 			if(len < 64) // TODO: Tweak this limit
 			{
 				while(len > 4)
--
2.4.6


code:
Remove outdated license text. See COPYING and the description
at http://liero.be/ for more information.

--- a/data/LIEROENG.TXT
+++ b/data/LIEROENG.TXT
@@ -11,14 +11,6 @@
 -----------------------------------------------------------------------------

 GENERAL STUFF
-
-	Liero is freeware. What that means is that you don't have to pay
-	for it and using it has not been restricted in any way. You may
-        distribute it to anyone and anyhow WITHOUT ANY CHANGES MADE TO IT'S
-	CONTAINMENTS.
-
-	The source code of this game is not distributed freely (neither
-        commercially). So if you thought that maybe you could... forget it.

 	Liero is a wormgame with weapons for 2 players. The object of the
 	game is definately what you think it is. Liero is excellent for
--- a/data/LIERO.TXT
+++ b/data/LIERO.TXT
@@ -12,15 +12,6 @@

 YLEIST�

-        Liero on freeware, mik� tarkoittaa ett� sen k�yt�st� ei tarvitse
-        maksaa mit��n eik� k�ytt�� ole rajoitettu mitenk��n. Lieroa saa
-        kopioida kelle tahansa ja miten tahansa SIS�LT�� MITENK��N
-        MUUTTAMATTA.
-
-        Todettakoon t�ss� ett� Lieron l�hdekoodi ei ole vapaassa (sen
-        enenp�� kuin kaupallisessakaan) jakelussa. Joten jos ajattelit
-        ett�... niin j�t� ajatukset sikseen.
-
         Liero on kahden pelattava aseellinen matosimulaatiopeli. Pelin
         p��m��r�n� on ep�ilem�tt� se mit� luuletkin. Liero sopii
         erinomaisen hyvin aggressioiden purkuun ja kaverin rokitt�miseen


code:
Fix compatibility with newer libconfig.

Patch copied from upstream source repository:

https://gitlab.com/lierolibre/lierolibre/commit/b27e3604aa6bfbfcc50db1000b394d06c87ae2f2

diff --git a/src/common.cpp b/src/common.cpp
index 2d6ada5..4942b05 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -162,7 +162,7 @@ void Texts::loadFromCFG(std::string cfgFilePath)
 	const libconfig::Setting &sgmodes = texts["gameModes"];
 	for(int i = 0; i < 4; ++i)
 	{
-		gameModes[i] = (char const*)sgmodes["gameModes" + to_string(i)];
+		gameModes[i] = (char const*)sgmodes[("gameModes" + to_string(i)).c_str()];
 	}

 	const libconfig::Setting &sgmspec = texts["gameModeSpec"];
@@ -181,13 +181,13 @@ void Texts::loadFromCFG(std::string cfgFilePath)
 	const libconfig::Setting &swstates = texts["weapStates"];
 	for(int i = 0; i < 3; ++i)
 	{
-		 weapStates[i] = (char const*)swstates["weapStates" + to_string(i)];
+		 weapStates[i] = (char const*)swstates[("weapStates" + to_string(i)).c_str()];
 	}

 	const libconfig::Setting &sknames = texts["keyNames"];
 	for(int i = 1; i < 177; ++i) // First key starts at 1
 	{
-		keyNames[i] = (char const*)sknames["keyNames" + to_string(i)];
+		keyNames[i] = (char const*)sknames[("keyNames" + to_string(i)).c_str()];
 	}

 	selWeap = (char const*)texts["selWeap"];
@@ -315,8 +315,8 @@ void Common::loadPaletteFromCFG(std::string cfgFilePath)
 	const libconfig::Setting &scanim = palette["colorAnim"];
 	for(int i = 0; i < 4; ++i)
 	{
-		colorAnim[i].from = (int)scanim["colorAnim" + to_string(i) + "from"];
-		colorAnim[i].to = (int)scanim["colorAnim" + to_string(i) + "to"];
+		colorAnim[i].from = (int)scanim[("colorAnim" + to_string(i) + "from").c_str()];
+		colorAnim[i].to = (int)scanim[("colorAnim" + to_string(i) + "to").c_str()];
 	}
 }

@@ -383,7 +383,7 @@ void Common::loadMaterialsFromCFG(std::string cfgFilePath)

 	for(int i = 0; i < 256; ++i)
 	{
-		const libconfig::Setting &smflags = smaterials["flags" + to_string(i)];
+		const libconfig::Setting &smflags = smaterials[("flags" + to_string(i)).c_str()];
 		materials[i].flags = smflags;
 	}
 }
diff --git a/src/configCompat.cpp b/src/configCompat.cpp
index 1aeb262..a72c40f 100644
--- a/src/configCompat.cpp
+++ b/src/configCompat.cpp
@@ -160,19 +160,19 @@ void Common::loadConstantsFromCFGVer0(string cfgFilePath)
 	const Setting &vconstants = constants["Values"];
 	for(int i = 0; i < MaxC; ++i)
 	{
-		C[i] = (int)vconstants[valueConstantsNamesCFGVer0[i]];
+		C[i] = (int)vconstants[valueConstantsNamesCFGVer0[i].c_str()];
 	}

 	const Setting &sconstants = constants["Strings"];
 	for(int i = 0; i < MaxS; ++i)
 	{
-		S[i]= (char const*)sconstants[stringConstantsNamesCFGVer0[i]];
+		S[i]= (char const*)sconstants[stringConstantsNamesCFGVer0[i].c_str()];
 	}

 	const Setting &hconstants = constants["Hacks"];
 	for(int i = 0; i < MaxH; ++i)
 	{
-		H[i] = (bool)hconstants[hackConstantsNamesVer0[i]];
+		H[i] = (bool)hconstants[hackConstantsNamesVer0[i].c_str()];
 	}
 }

diff --git a/src/configHelper.cpp b/src/configHelper.cpp
index fcd1f3f..a63bddc 100644
--- a/src/configHelper.cpp
+++ b/src/configHelper.cpp
@@ -54,15 +54,11 @@ template Uint8 ConfigHelper::getValue<Uint8, const Setting, int>(const Setting &

 template Uint8 ConfigHelper::getValue<Uint8, const Setting, char const*>(const Setting &node, char const* index);

-template Uint8 ConfigHelper::getValue<Uint8, const Setting, string>(const Setting &node, string index);
-
 // Non-const
 template Uint8 ConfigHelper::getValue<Uint8, Setting, int>(Setting &node, int index);

 template Uint8 ConfigHelper::getValue<Uint8, Setting, char const*>(Setting &node, char const* index);

-template Uint8 ConfigHelper::getValue<Uint8, Setting, string>(Setting &node, string index);
-

 // Since we still need specialisation per value type (Setting::Type),
 // no need to templateify these
@@ -72,7 +68,7 @@ void ConfigHelper::put(Setting &node, string variable, string value)
 	{
 		node.add(variable, Setting::TypeString) = value;
 	} else {
-		Setting &var = node[variable];
+		Setting &var = node[variable.c_str()];
 		var = value;
 	}
 }
@@ -83,7 +79,7 @@ void ConfigHelper::put(Setting &node, string variable, int value)
 	{
 		node.add(variable, Setting::TypeInt) = value;
 	} else {
-		Setting &var = node[variable];
+		Setting &var = node[variable.c_str()];
 		var = value;
 	}
 }
@@ -94,7 +90,7 @@ void ConfigHelper::put(Setting &node, string variable, Uint8 value)
 	{
 		node.add(variable, Setting::TypeInt) = value;
 	} else {
-		Setting &var = node[variable];
+		Setting &var = node[variable.c_str()];
 		var = value;
 	}
 }
@@ -105,7 +101,7 @@ void ConfigHelper::put(Setting &node, string variable, bool value)
 	{
 		node.add(variable, Setting::TypeBoolean) = value;
 	} else {
-		Setting &var = node[variable];
+		Setting &var = node[variable.c_str()];
 		var = value;
 	}
 }
@@ -135,6 +131,6 @@ Setting& ConfigHelper::getSubgroup(Setting &node, string groupName)
 	{
 		node.add(groupName, Setting::TypeGroup);
 	}
-	return node[groupName];
+	return node[groupName.c_str()];
 }

diff --git a/src/constants.cpp b/src/constants.cpp
index 7fced6a..cf7bbfc 100644
--- a/src/constants.cpp
+++ b/src/constants.cpp
@@ -523,19 +523,19 @@ void Common::loadConstantsFromCFG(std::string cfgFilePath)
 	const libconfig::Setting &vconstants = constants["Values"];
 	for(int i = 0; i < MaxC; ++i)
 	{
-		C[i] = (int)vconstants[valueConstantsNames[i]];
+		C[i] = (int)vconstants[valueConstantsNames[i].c_str()];
 	}

 	const libconfig::Setting &sconstants = constants["Strings"];
 	for(int i = 0; i < MaxS; ++i)
 	{
-		S[i]= (char const*)sconstants[stringConstantsNames[i]];
+		S[i]= (char const*)sconstants[stringConstantsNames[i].c_str()];
 	}

 	const libconfig::Setting &hconstants = constants["Hacks"];
 	for(int i = 0; i < MaxH; ++i)
 	{
-		H[i] = (bool)hconstants[hackConstantsNames[i]];
+		H[i] = (bool)hconstants[hackConstantsNames[i].c_str()];
 	}
 }

diff --git a/src/gfx/palette.cpp b/src/gfx/palette.cpp
index 3fd08c4..3d3bf22 100644
--- a/src/gfx/palette.cpp
+++ b/src/gfx/palette.cpp
@@ -124,9 +124,9 @@ void Palette::readFromCFG(std::string cfgFilePath)

 	for(int i = 0; i < 256; ++i)
 	{
-		entries[i].r = cfgHelp.getValue<Uint8>(spentries, "entries" + to_string(i) + "r");
-		entries[i].g = cfgHelp.getValue<Uint8>(spentries, "entries" + to_string(i) + "g");
-		entries[i].b = cfgHelp.getValue<Uint8>(spentries, "entries" + to_string(i) + "b");
+		entries[i].r = cfgHelp.getValue<Uint8>(spentries, ("entries" + to_string(i) + "r").c_str());
+		entries[i].g = cfgHelp.getValue<Uint8>(spentries, ("entries" + to_string(i) + "g").c_str());
+		entries[i].b = cfgHelp.getValue<Uint8>(spentries, ("entries" + to_string(i) + "b").c_str());
 	}
 }


code:
Copied from Debian:

https://anonscm.debian.org/cgit/pkg-games/lierolibre.git/tree/debian/patches/0003-Remove-unknown-arch-warning.patch?id=82910748906855f6e6bfe30b3f077e8c793ae424

From a9592533eeabed075b13d11c64f63f503dc13343 Mon Sep 17 00:00:00 2001
From: Martin Erik Werner <martinerikwerner@gmail.com>
Date: Sun, 28 Jun 2015 19:31:30 +0200
Subject: [PATCH 3/3] Remove unknown arch warning

The warning was just excessivley spammy, remove it.
---
 support/platform.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/gvl/support/platform.h b/src/gvl/support/platform.h
index 1857b7c..ff6a7d2 100644
--- a/src/gvl/support/platform.h
+++ b/src/gvl/support/platform.h
@@ -87,8 +87,6 @@
 #  define GVL_X86_64 1
 # elif defined(__i386__) || defined(_M_IX86) || defined(i386) || defined(i486) || defined(intel) || defined(x86) || defined(i86pc)
 #  define GVL_X86 1
-# else
-#  warning "Unknown architecture, please add it"
 # endif
 #endif

--
2.4.6


code:
Copied from Debian:

https://anonscm.debian.org/cgit/pkg-games/lierolibre.git/tree/debian/patches/0001-Use-unaligned-access-define-over-checking-arch.patch?id=82910748906855f6e6bfe30b3f077e8c793ae424

From a70691fb003cae1a33f06d682269285f9baa2dd9 Mon Sep 17 00:00:00 2001
From: Martin Erik Werner <martinerikwerner@gmail.com>
Date: Sun, 28 Jun 2015 19:00:23 +0200
Subject: [PATCH 2/3] At least try building for other archs than x86*

Allow attempting to build for other architectures than x86 and x86_64,
whether or not the build will succeed or produce sane output is another
question... It emits plenty of warnings about it now though...

Configuration of the FPU controller is disabled on all but x86*, and the
uninformed hope and prayer is that defaults will be fine without messing
with them.
---
 math/ieee.cpp      | 2 ++
 support/platform.h | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gvl/math/ieee.cpp b/src/gvl/math/ieee.cpp
index 8b740d4..e0803d2 100644
--- a/src/gvl/math/ieee.cpp
+++ b/src/gvl/math/ieee.cpp
@@ -54,6 +54,8 @@ void gvl_init_ieee()
 {
 #if GVL_MSVCPP
 // Nothing needs to be done, TODO: we should however check that the x87 state is right
+#elif !GVL_X86 && !GVL_X86_64
+// No idea what to do, but run with defaults and pray it doesn't mess things up
 #elif GVL_GCC && GVL_WIN32
     unsigned int const flags = _RC_NEAR | _PC_53 | _EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW | _EM_UNDERFLOW | _EM_INEXACT;
     _control87(flags, _MCW_EM | _MCW_PC | _MCW_RC);
diff --git a/src/gvl/support/platform.h b/src/gvl/support/platform.h
index 86dcaa6..1857b7c 100644
--- a/src/gvl/support/platform.h
+++ b/src/gvl/support/platform.h
@@ -88,12 +88,12 @@
 # elif defined(__i386__) || defined(_M_IX86) || defined(i386) || defined(i486) || defined(intel) || defined(x86) || defined(i86pc)
 #  define GVL_X86 1
 # else
-#  error "Unknown architecture, please add it"
+#  warning "Unknown architecture, please add it"
 # endif
 #endif

 #if !GVL_LITTLE_ENDIAN && !GVL_BIG_ENDIAN
-# if GVL_X86 || GVL_X86_64
+# if GVL_X86 || GVL_X86_64 || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN
 #  define GVL_LITTLE_ENDIAN 1
 # else
 #  define GVL_BIG_ENDIAN 1
--
2.4.6


code:
Backported from:

From 426eb97ba762c7663884f57ead0909f2aa3cd6a5 Mon Sep 17 00:00:00 2001
From: Cyril Bouvier <cyril.bouvier@lirmm.fr>
Date: Thu, 17 Jan 2019 16:32:19 +0100
Subject: [PATCH] Remove @LINBOXSAGE_LIBS@ from linbox.pc.in

---
 linbox.pc.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linbox.pc.in b/linbox.pc.in
index 278f127e4..c6b8091eb 100644
--- a/linbox.pc.in
+++ b/linbox.pc.in
@@ -9,6 +9,6 @@ Description: Exact Linear Algebra library
 URL: http://github.com/linbox-team/linbox
 Version: @VERSION@
 Requires: fflas-ffpack >= 2.4.0, givaro >= 4.1.0
-Libs: -L${libdir} -llinbox @LINBOXSAGE_LIBS@ @NTL_LIBS@ @MPFR_LIBS@ @FPLLL_LIBS@ @IML_LIBS@ @FLINT_LIBS@ @OCL_LIBS@
+Libs: -L${libdir} -llinbox @NTL_LIBS@ @MPFR_LIBS@ @FPLLL_LIBS@ @IML_LIBS@ @FLINT_LIBS@ @OCL_LIBS@
 Cflags: @DEFAULT_CFLAGS@ -DDISABLE_COMMENTATOR -I${includedir} @NTL_CFLAGS@ @MPFR_CFLAGS@ @FPLLL_CFLAGS@  @IML_CFLAGS@ @FLINT_CFLAGS@
 \-------------------------------------------------------


code:
From cfdf6d1c2051d6a20d0cbb94d81fe398f70dea4d Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <rg@raghavgururajan.name>
Date: Sun, 21 Mar 2021 21:13:53 -0400
Subject: [PATCH] [PATCH]: Fix building from git.

---
 CMakeLists.txt                                | 73 +------------------
 linphone-app/CMakeLists.txt                   | 12 +--
 .../cmake_builder/additional_steps.cmake      |  2 +-
 .../linphone_package/CMakeLists.txt           | 38 ----------
 linphone-app/linphoneqt_version.cmake         |  1 +
 linphone-app/src/config.h.cmake               |  1 +
 6 files changed, 6 insertions(+), 121 deletions(-)
 create mode 100644 linphone-app/linphoneqt_version.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f7eb05f2..3e853bdd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -48,16 +48,6 @@ project(linphoneqt)
 include(GNUInstallDirs)
 include(CheckCXXCompilerFlag)

-# Prepare gobal CMAKE configuration specific to the current project
-set(SDK_BUILD_DIR "${CMAKE_BINARY_DIR}/WORK")       # SDK build in WORK. Keep all in it.
-set(LINPHONE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/linphone-sdk/desktop")
-
-set(APPLICATION_OUTPUT_DIR "${CMAKE_BINARY_DIR}/OUTPUT")
-
-set(CMAKE_PREFIX_PATH "${LINPHONE_OUTPUT_DIR};${APPLICATION_OUTPUT_DIR}${PREFIX_PATH}")
-string(REPLACE ";" "|" PREFIX_PATH "${CMAKE_PREFIX_PATH}")
-#set(PREFIX_PATH "${LINPHONE_OUTPUT_DIR}|${APPLICATION_OUTPUT_DIR}${PREFIX_PATH}")
-
 # Avoid cmake warning if CMP0071 is not set.
 if (POLICY CMP0071)
     cmake_policy(SET CMP0071 NEW)
@@ -116,9 +106,6 @@ if(ENABLE_V4L)
 endif()
 list(APPEND APP_OPTIONS "-DENABLE_RELATIVE_PREFIX=${ENABLE_RELATIVE_PREFIX}")

-list(APPEND APP_OPTIONS "-DLINPHONE_OUTPUT_DIR=${LINPHONE_OUTPUT_DIR}")
-
-include(ExternalProject)
 set(PROJECT_BUILD_COMMAND "")
 if(CMAKE_BUILD_PARALLEL_LEVEL)
 	list(APPEND APP_OPTIONS "-DCMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL}")
@@ -133,32 +120,10 @@ if(CMAKE_VERBOSE_MAKEFILE)
 	endif()
 endif()
 if(UNIX AND NOT APPLE)
-	set(CMAKE_INSTALL_RPATH "$ORIGIN:$ORIGIN/lib64:$ORIGIN/../lib64:$ORIGIN/lib:$ORIGIN/../lib:${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_LIBDIR}")
 	list(APPEND APP_OPTIONS "-DCMAKE_INSTALL_RPATH=${CMAKE_INSTALL_RPATH}")
 endif()
-ExternalProject_Add(sdk PREFIX "${CMAKE_BINARY_DIR}/sdk"
-    SOURCE_DIR "${CMAKE_SOURCE_DIR}/linphone-sdk"
-    INSTALL_DIR "${LINPHONE_OUTPUT_DIR}"
-    STAMP_DIR "${SDK_BUILD_DIR}/stamp"
-    BINARY_DIR "${SDK_BUILD_DIR}"
-    STEP_TARGETS build
-    BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --config $<CONFIG> ${PROJECT_BUILD_COMMAND}
-    INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Install step is already done at build time."
-    LIST_SEPARATOR | # Use the alternate list separator
-    CMAKE_ARGS ${APP_OPTIONS} ${USER_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_PREFIX_PATH=${PREFIX_PATH}
-    #BUILD_ALWAYS NO #${DO_BUILD}
-)
-ExternalProject_Add_Step(sdk force_build
-	COMMENT "Forcing build for 'desktop'"
-	DEPENDEES configure
-	DEPENDERS build
-	ALWAYS 1
-)
 include(FindPkgConfig)

-set(APP_DEPENDS sdk)
-
-
 find_package(Qt5 5.12 COMPONENTS Core REQUIRED)

 if ( NOT Qt5_FOUND )
@@ -173,39 +138,5 @@ find_package(Mediastreamer2 CONFIG QUIET)
 find_package(ortp CONFIG QUIET)

-if(NOT (LinphoneCxx_FOUND) OR NOT (Linphone_FOUND) OR NOT (bctoolbox_FOUND) OR NOT (belcard_FOUND) OR NOT (Mediastreamer2_FOUND) OR NOT (ortp_FOUND) OR FORCE_APP_EXTERNAL_PROJECTS)
-	message("Projects are set as External projects. You can start building them by using for example : cmake --build . --target install")
-	ExternalProject_Add(linphone-qt PREFIX "${CMAKE_BINARY_DIR}/linphone-app"
-		SOURCE_DIR "${CMAKE_SOURCE_DIR}/linphone-app"
-		INSTALL_DIR "${APPLICATION_OUTPUT_DIR}"
-		BINARY_DIR "${CMAKE_BINARY_DIR}/linphone-app"
-		DEPENDS ${APP_DEPENDS}
-		BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --config $<CONFIG> ${PROJECT_BUILD_COMMAND}
-		INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Install step will not be done by external project"
-		LIST_SEPARATOR | # Use the alternate list separator
-		CMAKE_ARGS ${APP_OPTIONS} ${USER_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_PREFIX_PATH=${PREFIX_PATH}
-	# ${APP_OPTIONS}
-		BUILD_ALWAYS ON
-	)
-	install(CODE "message(STATUS Running install)")
-	set(AUTO_REGENERATION auto_regeneration)
-	add_custom_target(${AUTO_REGENERATION} ALL
-		COMMAND ${CMAKE_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}
-		DEPENDS linphone-qt)
-else()
-	message("Adding Linphone Desktop in an IDE-friendly state")
-	set(CMAKE_INSTALL_PREFIX "${APPLICATION_OUTPUT_DIR}")
-	add_subdirectory(${CMAKE_SOURCE_DIR}/linphone-app)
-	add_dependencies(app-library ${APP_DEPENDS})
-endif()
-ExternalProject_Add(linphone-qt-only PREFIX "${CMAKE_BINARY_DIR}/linphone-app"
-    SOURCE_DIR "${CMAKE_SOURCE_DIR}/linphone-app"
-    INSTALL_DIR "${APPLICATION_OUTPUT_DIR}"
-    BINARY_DIR "${CMAKE_BINARY_DIR}/linphone-app"
-    BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --config $<CONFIG> ${PROJECT_BUILD_COMMAND}
-#    INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Install step is already done at build time."
-    LIST_SEPARATOR | # Use the alternate list separator
-    CMAKE_ARGS ${APP_OPTIONS} ${USER_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_PREFIX_PATH=${PREFIX_PATH}
-    EXCLUDE_FROM_ALL ON
-    BUILD_ALWAYS ON
-)
+message("Adding Linphone Desktop in an IDE-friendly state")
+add_subdirectory(${CMAKE_SOURCE_DIR}/linphone-app)
diff --git a/linphone-app/CMakeLists.txt b/linphone-app/CMakeLists.txt
index 3bc9420a..5267cd4a 100644
--- a/linphone-app/CMakeLists.txt
+++ b/linphone-app/CMakeLists.txt
@@ -21,17 +21,8 @@
 ################################################################################
 cmake_minimum_required(VERSION 3.1)

+include(linphoneqt_version.cmake)
 find_package(bctoolbox CONFIG)
-set(FULL_VERSION )
-bc_compute_full_version(FULL_VERSION)
-set(version_major )
-set(version_minor )
-set(version_patch )
-set(identifiers )
-set(metadata )
-bc_parse_full_version("${FULL_VERSION}" version_major version_minor version_patch identifiers metadata)
-
-project(linphoneqt VERSION "${version_major}.${version_minor}.${version_patch}")

 if(ENABLE_BUILD_VERBOSE)
 	#message("CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH}")
@@ -49,7 +40,6 @@ if(UNIX AND NOT APPLE)
     set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
 endif()
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
-list(APPEND CMAKE_MODULE_PATH "${LINPHONE_OUTPUT_DIR}/cmake")

 set(APP_LIBRARY app-library)
 include(application_info.cmake)
diff --git a/linphone-app/cmake_builder/additional_steps.cmake b/linphone-app/cmake_builder/additional_steps.cmake
index 7f7fd573..48e3c716 100644
--- a/linphone-app/cmake_builder/additional_steps.cmake
+++ b/linphone-app/cmake_builder/additional_steps.cmake
@@ -61,7 +61,7 @@ if (ENABLE_PACKAGING)
       SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/linphone_package"
       DOWNLOAD_COMMAND ""
       CMAKE_GENERATOR ${CMAKE_GENERATOR}
-      CMAKE_ARGS ${LINPHONE_BUILDER_EP_ARGS} -DCMAKE_INSTALL_PREFIX=${LINPHONE_BUILDER_WORK_DIR}/PACKAGE -DTOOLS_DIR=${CMAKE_BINARY_DIR}/programs -DLINPHONE_OUTPUT_DIR=${CMAKE_INSTALL_PREFIX} -DLINPHONE_DESKTOP_DIR=${CMAKE_CURRENT_LIST_DIR}/.. -DLINPHONE_SOURCE_DIR=${EP_linphone_SOURCE_DIR} ${ENABLE_VARIABLES} -DLINPHONE_BUILDER_SIGNING_IDENTITY=${LINPHONE_BUILDER_SIGNING_IDENTITY}
+      CMAKE_ARGS ${LINPHONE_BUILDER_EP_ARGS} -DCMAKE_INSTALL_PREFIX=${LINPHONE_BUILDER_WORK_DIR}/PACKAGE -DTOOLS_DIR=${CMAKE_BINARY_DIR}/programs -DLINPHONE_DESKTOP_DIR=${CMAKE_CURRENT_LIST_DIR}/.. -DLINPHONE_SOURCE_DIR=${EP_linphone_SOURCE_DIR} ${ENABLE_VARIABLES} -DLINPHONE_BUILDER_SIGNING_IDENTITY=${LINPHONE_BUILDER_SIGNING_IDENTITY}
     )
   endif ()
 endif ()
diff --git a/linphone-app/cmake_builder/linphone_package/CMakeLists.txt b/linphone-app/cmake_builder/linphone_package/CMakeLists.txt
index baea03cf..d06dcb74 100644
--- a/linphone-app/cmake_builder/linphone_package/CMakeLists.txt
+++ b/linphone-app/cmake_builder/linphone_package/CMakeLists.txt
@@ -200,44 +200,6 @@ elseif (APPLE)
   endif ()
 #  install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_NAME}.app" DESTINATION "." USE_SOURCE_PERMISSIONS)
 else()# Not Windows and Apple
-	foreach (LIBRARY ${SHARED_LIBRARIES})
-		get_filename_component(LIBRARY_FILENAME ${LIBRARY} NAME)
-		message("Changing RPATH of ${LIBRARY_FILENAME} from '${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_LIBDIR}' to '$ORIGIN/../${CMAKE_INSTALL_LIBDIR}'")
-		execute_process(COMMAND install_name_tool -rpath "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_LIBDIR}" "$ORIGIN/../lib" "${LIBRARY}")
-		execute_process(COMMAND install_name_tool -addrpath "$ORIGIN/../lib64" "${LIBRARY}")
-	endforeach ()
-	install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_BINDIR}/" DESTINATION "${CMAKE_INSTALL_BINDIR}" USE_SOURCE_PERMISSIONS)
-#Just in case. This is useless because we have to use CMAKE_INSTALL_LIBDIR
-	if( EXISTS "${LINPHONE_OUTPUT_DIR}/lib/")
-		file(GLOB SHARED_LIBRARIES "${LINPHONE_OUTPUT_DIR}/lib/*.so*")
-		if( ENABLE_OPENH264 )# Remove openH264 lib from the installation. this codec will be download by user
-			foreach(item ${SHARED_LIBRARIES})
-				get_filename_component(LIBRARY_FILENAME ${item} NAME)
-				if("${LIBRARY_FILENAME}" MATCHES "^libopenh264.*$")
-					list(REMOVE_ITEM SHARED_LIBRARIES ${item})
-				endif()
-			endforeach(item)
-		endif()
-		install(FILES ${SHARED_LIBRARIES} DESTINATION "lib")
-	endif()
-	if( EXISTS "${LINPHONE_OUTPUT_DIR}/lib64/")
-		file(GLOB SHARED_LIBRARIES "${LINPHONE_OUTPUT_DIR}/lib64/*.so*")
-		if( ENABLE_OPENH264 )# Remove openH264 lib from the installation. this codec will be download by user
-			foreach(item ${SHARED_LIBRARIES})
-				get_filename_component(LIBRARY_FILENAME ${item} NAME)
-				if("${LIBRARY_FILENAME}" MATCHES "^libopenh264.*$")
-					list(REMOVE_ITEM SHARED_LIBRARIES ${item})
-				endif()
-			endforeach(item)
-		endif()
-		install(FILES ${SHARED_LIBRARIES} DESTINATION "lib64")
-	endif()
-	install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}" USE_SOURCE_PERMISSIONS)
-	if(ENABLE_BUILD_VERBOSE)
-		message("INSTALLATION : ${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/" )
-	endif()
-	file(GLOB PLUGINS_FILES "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_LIBDIR}/mediastreamer/plugins/*")
-	install(FILES ${PLUGINS_FILES} DESTINATION "plugins/mediastreamer/" )
 # Install desktop/icon files.
 	configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../../assets/linphone.desktop.cmake" "${CMAKE_CURRENT_BINARY_DIR}/../../${EXECUTABLE_NAME}.desktop" @ONLY)
 	install(FILES "${CMAKE_CURRENT_BINARY_DIR}/../../${EXECUTABLE_NAME}.desktop" DESTINATION "${CMAKE_INSTALL_DATADIR}/applications")
diff --git a/linphone-app/linphoneqt_version.cmake b/linphone-app/linphoneqt_version.cmake
new file mode 100644
index 00000000..a85d3455
--- /dev/null
+++ b/linphone-app/linphoneqt_version.cmake
@@ -0,0 +1 @@
+project(linphoneqt VERSION ${GUIX-SET-VERSION})
\ No newline at end of file
diff --git a/linphone-app/src/config.h.cmake b/linphone-app/src/config.h.cmake
index 093539e0..5a238c70 100644
--- a/linphone-app/src/config.h.cmake
+++ b/linphone-app/src/config.h.cmake
@@ -28,3 +28,4 @@
 #cmakedefine ENABLE_UPDATE_CHECK 1
 #cmakedefine EXECUTABLE_NAME "${EXECUTABLE_NAME}"
 #cmakedefine MSPLUGINS_DIR "${MSPLUGINS_DIR}"
+#define LINPHONE_QT_GIT_VERSION "${PROJECT_VERSION}"
\ No newline at end of file
--
2.31.0


code:
From 3a75704e99a118f2d8a4d70f07781558bde85770 Mon Sep 17 00:00:00 2001
From: Jian-Hong Pan <jhp@endlessos.org>
Date: Thu, 24 Sep 2020 14:30:43 +0800
Subject: [PATCH] arm64: dts: rockchip: disable USB type-c DisplayPort

The cdn-dp sub driver probes the device failed on PINEBOOK Pro.

kernel: cdn-dp fec00000.dp: [drm:cdn_dp_probe [rockchipdrm]] *ERROR* missing extcon or phy
kernel: cdn-dp: probe of fec00000.dp failed with error -22

Then, the device halts all of the DRM related device jobs. For example,
the operations: vop_component_ops, vop_component_ops and
rockchip_dp_component_ops cannot be bound to corresponding devices. So,
Xorg cannot find the correct DRM device.

The USB type-C DisplayPort does not work for now. So, disable the
DisplayPort node until the type-C phy work has been done.

Link: https://patchwork.kernel.org/patch/11794141/#23639877
Signed-off-by: Jian-Hong Pan <jhp@endlessos.org>
---
 arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
index 219b7507a10f..45769764425d 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
@@ -380,7 +380,7 @@
 };

 &cdn_dp {
-	status = "okay";
+	status = "disabled";
 };

 &cpu_b0 {
--
2.30.2


code:
From d87a8072e8129a579246d8d31a591ca2aec05275 Mon Sep 17 00:00:00 2001
From: Tobias Schramm <t.schramm@manjaro.org>
Date: Wed, 4 Mar 2020 22:30:23 +0100
Subject: [PATCH] arm64: dts: rockchip: Add initial support for Pinebook Pro

This commit adds initial dt support for the rk3399 based Pinebook Pro.

Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
Link: https://lore.kernel.org/r/20200304213023.689983-3-t.schramm@manjaro.org
Signed-off-by: Heiko Stuebner <heiko@sntech.de>

Taken from next-20200313 commit 5a65505a6988443b211d3bf3f5bb5b79907c33b9
---
 arch/arm64/boot/dts/rockchip/Makefile         |    1 +
 .../boot/dts/rockchip/rk3399-pinebook-pro.dts | 1096 +++++++++++++++++
 2 files changed, 1097 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts

diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile
index 1f18a9392d15..7de9b61d6415 100644
--- a/arch/arm64/boot/dts/rockchip/Makefile
+++ b/arch/arm64/boot/dts/rockchip/Makefile
@@ -25,6 +25,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopc-t4.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-m4.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-neo4.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-orangepi.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-pinebook-pro.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-puma-haikou.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4.dtb
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
new file mode 100644
index 000000000000..5ea281b55fe2
--- /dev/null
+++ b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
@@ -0,0 +1,1096 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
+ * Copyright (c) 2018 Akash Gajjar <Akash_Gajjar@mentor.com>
+ * Copyright (c) 2020 Tobias Schramm <t.schramm@manjaro.org>
+ */
+
+/dts-v1/;
+#include <dt-bindings/input/gpio-keys.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/pwm/pwm.h>
+#include <dt-bindings/usb/pd.h>
+#include <dt-bindings/leds/common.h>
+#include "rk3399.dtsi"
+#include "rk3399-opp.dtsi"
+
+/ {
+	model = "Pine64 Pinebook Pro";
+	compatible = "pine64,pinebook-pro", "rockchip,rk3399";
+
+	chosen {
+		stdout-path = "serial2:1500000n8";
+	};
+
+	backlight: edp-backlight {
+		compatible = "pwm-backlight";
+		power-supply = <&vcc_12v>;
+		pwms = <&pwm0 0 740740 0>;
+	};
+
+	edp_panel: edp-panel {
+		compatible = "boe,nv140fhmn49";
+		backlight = <&backlight>;
+		enable-gpios = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&panel_en_gpio>;
+		power-supply = <&vcc3v3_panel>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				panel_in_edp: endpoint@0 {
+					reg = <0>;
+					remote-endpoint = <&edp_out_panel>;
+				};
+			};
+		};
+	};
+
+	/*
+	 * Use separate nodes for gpio-keys to allow for selective deactivation
+	 * of wakeup sources via sysfs without disabling the whole key
+	 */
+	gpio-key-lid {
+		compatible = "gpio-keys";
+		pinctrl-names = "default";
+		pinctrl-0 = <&lidbtn_gpio>;
+
+		lid {
+			debounce-interval = <20>;
+			gpios = <&gpio1 RK_PA1 GPIO_ACTIVE_LOW>;
+			label = "Lid";
+			linux,code = <SW_LID>;
+			linux,input-type = <EV_SW>;
+			wakeup-event-action = <EV_ACT_DEASSERTED>;
+			wakeup-source;
+		};
+	};
+
+	gpio-key-power {
+		compatible = "gpio-keys";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pwrbtn_gpio>;
+
+		power {
+			debounce-interval = <20>;
+			gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
+			label = "Power";
+			linux,code = <KEY_POWER>;
+			wakeup-source;
+		};
+	};
+
+	leds {
+		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pwrled_gpio &slpled_gpio>;
+
+		green-led {
+			color = <LED_COLOR_ID_GREEN>;
+			default-state = "on";
+			function = LED_FUNCTION_POWER;
+			gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>;
+			label = "green:power";
+		};
+
+		red-led {
+			color = <LED_COLOR_ID_RED>;
+			default-state = "off";
+			function = LED_FUNCTION_STANDBY;
+			gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
+			label = "red:standby";
+			panic-indicator;
+			retain-state-suspended;
+		};
+	};
+
+	/* Power sequence for SDIO WiFi module */
+	sdio_pwrseq: sdio-pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		clocks = <&rk808 1>;
+		clock-names = "ext_clock";
+		pinctrl-names = "default";
+		pinctrl-0 = <&wifi_enable_h_gpio>;
+		post-power-on-delay-ms = <100>;
+		power-off-delay-us = <500000>;
+
+		/* WL_REG_ON on module */
+		reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
+	};
+
+	/* Audio components */
+	es8316-sound {
+		compatible = "simple-audio-card";
+		pinctrl-names = "default";
+		pinctrl-0 = <&hp_det_gpio>;
+		simple-audio-card,name = "rockchip,es8316-codec";
+		simple-audio-card,format = "i2s";
+		simple-audio-card,mclk-fs = <256>;
+
+		simple-audio-card,widgets =
+			"Microphone", "Mic Jack",
+			"Headphone", "Headphones",
+			"Speaker", "Speaker";
+		simple-audio-card,routing =
+			"MIC1", "Mic Jack",
+			"Headphones", "HPOL",
+			"Headphones", "HPOR",
+			"Speaker Amplifier INL", "HPOL",
+			"Speaker Amplifier INR", "HPOR",
+			"Speaker", "Speaker Amplifier OUTL",
+			"Speaker", "Speaker Amplifier OUTR";
+
+		simple-audio-card,hp-det-gpio = <&gpio0 RK_PB0 GPIO_ACTIVE_LOW>;
+		simple-audio-card,aux-devs = <&speaker_amp>;
+		simple-audio-card,pin-switches = "Speaker";
+
+		simple-audio-card,cpu {
+			sound-dai = <&i2s1>;
+		};
+
+		simple-audio-card,codec {
+			sound-dai = <&es8316>;
+		};
+	};
+
+	speaker_amp: speaker-amplifier {
+		compatible = "simple-audio-amplifier";
+		enable-gpios = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>;
+		sound-name-prefix = "Speaker Amplifier";
+		VCC-supply = <&pa_5v>;
+	};
+
+	/* Power tree */
+	/* Root power source */
+	vcc_sysin: vcc-sysin {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc_sysin";
+		regulator-always-on;
+		regulator-boot-on;
+	};
+
+	/* Regulators supplied by vcc_sysin */
+	/* LCD backlight supply */
+	vcc_12v: vcc-12v {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc_12v";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <12000000>;
+		regulator-max-microvolt = <12000000>;
+		vin-supply = <&vcc_sysin>;
+
+		regulator-state-mem {
+			regulator-off-in-suspend;
+		};
+	};
+
+	/* Main 3.3 V supply */
+	vcc3v3_sys: wifi_bat: vcc3v3-sys {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc3v3_sys";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		vin-supply = <&vcc_sysin>;
+
+		regulator-state-mem {
+			regulator-on-in-suspend;
+		};
+	};
+
+	/* 5 V USB power supply */
+	vcc5v0_usb: pa_5v: vcc5v0-usb-regulator {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpio = <&gpio1 RK_PB5 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pwr_5v_gpio>;
+		regulator-name = "vcc5v0_usb";
+		regulator-always-on;
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		vin-supply = <&vcc_sysin>;
+
+		regulator-state-mem {
+			regulator-off-in-suspend;
+		};
+	};
+
+	/* RK3399 logic supply */
+	vdd_log: vdd-log {
+		compatible = "pwm-regulator";
+		pwms = <&pwm2 0 25000 1>;
+		regulator-name = "vdd_log";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <800000>;
+		regulator-max-microvolt = <1400000>;
+		vin-supply = <&vcc_sysin>;
+
+		regulator-state-mem {
+			regulator-on-in-suspend;
+		};
+	};
+
+	/* Regulators supplied by vcc3v3_sys */
+	/* 0.9 V supply, always on */
+	vcc_0v9: vcc-0v9 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc_0v9";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <900000>;
+		regulator-max-microvolt = <900000>;
+		vin-supply = <&vcc3v3_sys>;
+	};
+
+	/* S3 1.8 V supply, switched by vcc1v8_s3 */
+	vcca1v8_s3: vcc1v8-s3 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcca1v8_s3";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		vin-supply = <&vcc3v3_sys>;
+	};
+
+	/* micro SD card power */
+	vcc3v0_sd: vcc3v0-sd {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&sdmmc0_pwr_h_gpio>;
+		regulator-name = "vcc3v0_sd";
+		regulator-always-on;
+		regulator-min-microvolt = <3000000>;
+		regulator-max-microvolt = <3000000>;
+		vin-supply = <&vcc3v3_sys>;
+
+		regulator-state-mem {
+			regulator-off-in-suspend;
+		};
+	};
+
+	/* LCD panel power, called VCC3V3_S0 in schematic */
+	vcc3v3_panel: vcc3v3-panel {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpio = <&gpio1 RK_PC6 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&lcdvcc_en_gpio>;
+		regulator-name = "vcc3v3_panel";
+		regulator-always-on;
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-enable-ramp-delay = <100000>;
+		vin-supply = <&vcc3v3_sys>;
+
+		regulator-state-mem {
+			regulator-off-in-suspend;
+		};
+	};
+
+	/* M.2 adapter power, switched by vcc1v8_s3 */
+	vcc3v3_ssd: vcc3v3-ssd {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc3v3_ssd";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		vin-supply = <&vcc3v3_sys>;
+	};
+
+	/* Regulators supplied by vcc5v0_usb */
+	/* USB 3 port power supply regulator  */
+	vcc5v0_otg: vcc5v0-otg {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpio = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&vcc5v0_host_en_gpio>;
+		regulator-name = "vcc5v0_otg";
+		regulator-always-on;
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		vin-supply = <&vcc5v0_usb>;
+
+		regulator-state-mem {
+			regulator-off-in-suspend;
+		};
+	};
+
+	/* Regulators supplied by vcc5v0_usb */
+	/* Type C port power supply regulator */
+	vbus_5vout: vbus_typec: vbus-5vout {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&vcc5v0_typec0_en_gpio>;
+		regulator-name = "vbus_5vout";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		vin-supply = <&vcc5v0_usb>;
+
+		regulator-state-mem {
+			regulator-off-in-suspend;
+		};
+	};
+
+	/* Regulators supplied by vcc_1v8 */
+	/* Primary 0.9 V LDO */
+	vcca0v9_s3: vcca0v9-s3 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc0v9_s3";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		vin-supply = <&vcc_1v8>;
+
+		regulator-state-mem {
+			regulator-on-in-suspend;
+		};
+	};
+
+	mains_charger: dc-charger {
+		compatible = "gpio-charger";
+		charger-type = "mains";
+		gpios = <&gpio4 RK_PD0 GPIO_ACTIVE_LOW>;
+
+		/* Also triggered by USB charger */
+		pinctrl-names = "default";
+		pinctrl-0 = <&dc_det_gpio>;
+	};
+};
+
+&cdn_dp {
+	status = "okay";
+};
+
+&cpu_b0 {
+	cpu-supply = <&vdd_cpu_b>;
+};
+
+&cpu_b1 {
+	cpu-supply = <&vdd_cpu_b>;
+};
+
+&cpu_l0 {
+	cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l1 {
+	cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l2 {
+	cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l3 {
+	cpu-supply = <&vdd_cpu_l>;
+};
+
+&edp {
+	force-hpd;
+	pinctrl-names = "default";
+	pinctrl-0 = <&edp_hpd>;
+	status = "okay";
+
+	ports {
+		edp_out: port@1 {
+			reg = <1>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			edp_out_panel: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&panel_in_edp>;
+			};
+		};
+	};
+};
+
+&emmc_phy {
+	status = "okay";
+};
+
+&gpu {
+	mali-supply = <&vdd_gpu>;
+	status = "okay";
+};
+
+&hdmi_sound {
+	status = "okay";
+};
+
+&i2c0 {
+	clock-frequency = <400000>;
+	i2c-scl-falling-time-ns = <4>;
+	i2c-scl-rising-time-ns = <168>;
+	status = "okay";
+
+	rk808: pmic@1b {
+		compatible = "rockchip,rk808";
+		reg = <0x1b>;
+		#clock-cells = <1>;
+		clock-output-names = "xin32k", "rk808-clkout2";
+		interrupt-parent = <&gpio3>;
+		interrupts = <10 IRQ_TYPE_LEVEL_LOW>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pmic_int_l_gpio>;
+		rockchip,system-power-controller;
+		wakeup-source;
+
+		vcc1-supply = <&vcc_sysin>;
+		vcc2-supply = <&vcc_sysin>;
+		vcc3-supply = <&vcc_sysin>;
+		vcc4-supply = <&vcc_sysin>;
+		vcc6-supply = <&vcc_sysin>;
+		vcc7-supply = <&vcc_sysin>;
+		vcc8-supply = <&vcc3v3_sys>;
+		vcc9-supply = <&vcc_sysin>;
+		vcc10-supply = <&vcc_sysin>;
+		vcc11-supply = <&vcc_sysin>;
+		vcc12-supply = <&vcc3v3_sys>;
+		vcc13-supply = <&vcc_sysin>;
+		vcc14-supply = <&vcc_sysin>;
+
+		regulators {
+			/* rk3399 center logic supply */
+			vdd_center: DCDC_REG1 {
+				regulator-name = "vdd_center";
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <750000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-ramp-delay = <6001>;
+
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vdd_cpu_l: DCDC_REG2 {
+				regulator-name = "vdd_cpu_l";
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <750000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-ramp-delay = <6001>;
+
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vcc_ddr: DCDC_REG3 {
+				regulator-name = "vcc_ddr";
+				regulator-always-on;
+				regulator-boot-on;
+
+				regulator-state-mem {
+					regulator-on-in-suspend;
+				};
+			};
+
+			vcc_1v8: vcc_wl: DCDC_REG4 {
+				regulator-name = "vcc_1v8";
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+
+				regulator-state-mem {
+					regulator-on-in-suspend;
+					regulator-suspend-microvolt = <1800000>;
+				};
+			};
+
+			/* not used */
+			LDO_REG1 {
+			};
+
+			/* not used */
+			LDO_REG2 {
+			};
+
+			vcc1v8_pmupll: LDO_REG3 {
+				regulator-name = "vcc1v8_pmupll";
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+
+				regulator-state-mem {
+					regulator-on-in-suspend;
+					regulator-suspend-microvolt = <1800000>;
+				};
+			};
+
+			vcc_sdio: LDO_REG4 {
+				regulator-name = "vcc_sdio";
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3000000>;
+
+				regulator-state-mem {
+					regulator-on-in-suspend;
+					regulator-suspend-microvolt = <3000000>;
+				};
+			};
+
+			vcca3v0_codec: LDO_REG5 {
+				regulator-name = "vcca3v0_codec";
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3000000>;
+
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vcc_1v5: LDO_REG6 {
+				regulator-name = "vcc_1v5";
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <1500000>;
+				regulator-max-microvolt = <1500000>;
+
+				regulator-state-mem {
+					regulator-on-in-suspend;
+					regulator-suspend-microvolt = <1500000>;
+				};
+			};
+
+			vcca1v8_codec: LDO_REG7 {
+				regulator-name = "vcca1v8_codec";
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vcc_3v0: LDO_REG8 {
+				regulator-name = "vcc_3v0";
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3000000>;
+
+				regulator-state-mem {
+					regulator-on-in-suspend;
+					regulator-suspend-microvolt = <3000000>;
+				};
+			};
+
+			vcc3v3_s3: SWITCH_REG1 {
+				regulator-name = "vcc3v3_s3";
+				regulator-always-on;
+				regulator-boot-on;
+
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vcc3v3_s0: SWITCH_REG2 {
+				regulator-name = "vcc3v3_s0";
+				regulator-always-on;
+				regulator-boot-on;
+
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+		};
+	};
+
+	vdd_cpu_b: regulator@40 {
+		compatible = "silergy,syr827";
+		reg = <0x40>;
+		fcs,suspend-voltage-selector = <1>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&vsel1_gpio>;
+		regulator-name = "vdd_cpu_b";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <712500>;
+		regulator-max-microvolt = <1500000>;
+		regulator-ramp-delay = <1000>;
+		vin-supply = <&vcc_1v8>;
+
+		regulator-state-mem {
+			regulator-off-in-suspend;
+		};
+	};
+
+	vdd_gpu: regulator@41 {
+		compatible = "silergy,syr828";
+		reg = <0x41>;
+		fcs,suspend-voltage-selector = <1>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&vsel2_gpio>;
+		regulator-name = "vdd_gpu";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <712500>;
+		regulator-max-microvolt = <1500000>;
+		regulator-ramp-delay = <1000>;
+		vin-supply = <&vcc_1v8>;
+
+		regulator-state-mem {
+			regulator-off-in-suspend;
+		};
+	};
+};
+
+&i2c1 {
+	clock-frequency = <100000>;
+	i2c-scl-falling-time-ns = <4>;
+	i2c-scl-rising-time-ns = <168>;
+	status = "okay";
+
+	es8316: es8316@11 {
+		compatible = "everest,es8316";
+		reg = <0x11>;
+		clocks = <&cru SCLK_I2S_8CH_OUT>;
+		clock-names = "mclk";
+		#sound-dai-cells = <0>;
+	};
+};
+
+&i2c3 {
+	i2c-scl-falling-time-ns = <15>;
+	i2c-scl-rising-time-ns = <450>;
+	status = "okay";
+};
+
+&i2c4 {
+	i2c-scl-falling-time-ns = <20>;
+	i2c-scl-rising-time-ns = <600>;
+	status = "okay";
+
+	fusb0: fusb30x@22 {
+		compatible = "fcs,fusb302";
+		reg = <0x22>;
+		fcs,int_n = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&fusb0_int_gpio>;
+		vbus-supply = <&vbus_typec>;
+
+		connector {
+			compatible = "usb-c-connector";
+			data-role = "host";
+			label = "USB-C";
+			op-sink-microwatt = <1000000>;
+			power-role = "dual";
+			sink-pdos =
+				<PDO_FIXED(5000, 2500, PDO_FIXED_USB_COMM)>;
+			source-pdos =
+				<PDO_FIXED(5000, 1400, PDO_FIXED_USB_COMM)>;
+			try-power-role = "sink";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				port@0 {
+					reg = <0>;
+
+					usbc_hs: endpoint {
+						remote-endpoint =
+							<&u2phy0_typec_hs>;
+					};
+				};
+
+				port@1 {
+					reg = <1>;
+
+					usbc_ss: endpoint {
+						remote-endpoint =
+							<&tcphy0_typec_ss>;
+					};
+				};
+
+				port@2 {
+					reg = <2>;
+
+					usbc_dp: endpoint {
+						remote-endpoint =
+							<&tcphy0_typec_dp>;
+					};
+				};
+			};
+		};
+	};
+};
+
+&i2s1 {
+	#sound-dai-cells = <0>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2s_8ch_mclk_gpio>, <&i2s1_2ch_bus>;
+	rockchip,capture-channels = <8>;
+	rockchip,playback-channels = <8>;
+	status = "okay";
+};
+
+&io_domains {
+	audio-supply = <&vcc_3v0>;
+	gpio1830-supply = <&vcc_3v0>;
+	sdmmc-supply = <&vcc_sdio>;
+	status = "okay";
+};
+
+&pcie_phy {
+	status = "okay";
+};
+
+&pcie0 {
+	bus-scan-delay-ms = <1000>;
+	ep-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>;
+	max-link-speed = <2>;
+	num-lanes = <4>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcie_clkreqn_cpm>;
+	vpcie0v9-supply = <&vcca0v9_s3>;
+	vpcie1v8-supply = <&vcca1v8_s3>;
+	vpcie3v3-supply = <&vcc3v3_ssd>;
+	status = "okay";
+};
+
+&pinctrl {
+	buttons {
+		pwrbtn_gpio: pwrbtn-gpio {
+			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
+		};
+
+		lidbtn_gpio: lidbtn-gpio {
+			rockchip,pins = <1 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>;
+		};
+	};
+
+	dc-charger {
+		dc_det_gpio: dc-det-gpio {
+			rockchip,pins = <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+
+	es8316 {
+		hp_det_gpio: hp-det-gpio {
+			rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_down>;
+		};
+	};
+
+	fusb302x {
+		fusb0_int_gpio: fusb0-int-gpio {
+			rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>;
+		};
+	};
+
+	i2s1 {
+		i2s_8ch_mclk_gpio: i2s-8ch-mclk-gpio {
+			rockchip,pins = <4 RK_PA0 1 &pcfg_pull_none>;
+		};
+	};
+
+	lcd-panel {
+		lcdvcc_en_gpio: lcdvcc-en-gpio {
+			rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+
+		panel_en_gpio: panel-en-gpio {
+			rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+
+		lcd_panel_reset_gpio: lcd-panel-reset-gpio {
+			rockchip,pins = <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up>;
+		};
+	};
+
+	leds {
+		pwrled_gpio: pwrled_gpio {
+			rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+
+		slpled_gpio: slpled_gpio {
+			rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+
+	pmic {
+		pmic_int_l_gpio: pmic-int-l-gpio {
+			rockchip,pins = <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
+		};
+
+		vsel1_gpio: vsel1-gpio {
+			rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
+		};
+
+		vsel2_gpio: vsel2-gpio {
+			rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
+		};
+	};
+
+	sdcard {
+		sdmmc0_pwr_h_gpio: sdmmc0-pwr-h-gpio {
+			rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+
+	};
+
+	sdio-pwrseq {
+		wifi_enable_h_gpio: wifi-enable-h-gpio {
+			rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+
+	usb-typec {
+		vcc5v0_typec0_en_gpio: vcc5v0-typec0-en-gpio {
+			rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
+		};
+	};
+
+	usb2 {
+		pwr_5v_gpio: pwr-5v-gpio {
+			rockchip,pins = <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+
+		vcc5v0_host_en_gpio: vcc5v0-host-en-gpio {
+			rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+
+	wireless-bluetooth {
+		bt_wake_gpio: bt-wake-gpio {
+			rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+
+		bt_host_wake_gpio: bt-host-wake-gpio {
+			rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+
+		bt_reset_gpio: bt-reset-gpio {
+			rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+};
+
+&pmu_io_domains {
+	pmu1830-supply = <&vcc_3v0>;
+	status = "okay";
+};
+
+&pwm0 {
+	status = "okay";
+};
+
+&pwm2 {
+	status = "okay";
+};
+
+&saradc {
+	vref-supply = <&vcca1v8_s3>;
+	status = "okay";
+};
+
+&sdmmc {
+	bus-width = <4>;
+	cap-mmc-highspeed;
+	cap-sd-highspeed;
+	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
+	disable-wp;
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4>;
+	sd-uhs-sdr104;
+	vmmc-supply = <&vcc3v0_sd>;
+	vqmmc-supply = <&vcc_sdio>;
+	status = "okay";
+};
+
+&sdio0 {
+	bus-width = <4>;
+	cap-sd-highspeed;
+	cap-sdio-irq;
+	keep-power-in-suspend;
+	mmc-pwrseq = <&sdio_pwrseq>;
+	non-removable;
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
+	sd-uhs-sdr104;
+	status = "okay";
+};
+
+&sdhci {
+	bus-width = <8>;
+	mmc-hs200-1_8v;
+	non-removable;
+	status = "okay";
+};
+
+&spi1 {
+	max-freq = <10000000>;
+	status = "okay";
+
+	spiflash: flash@0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		m25p,fast-read;
+		spi-max-frequency = <10000000>;
+	};
+};
+
+&tcphy0 {
+	status = "okay";
+};
+
+&tcphy0_dp {
+	port {
+		tcphy0_typec_dp: endpoint {
+			remote-endpoint = <&usbc_dp>;
+		};
+	};
+};
+
+&tcphy0_usb3 {
+	port {
+		tcphy0_typec_ss: endpoint {
+			remote-endpoint = <&usbc_ss>;
+		};
+	};
+};
+
+&tcphy1 {
+	status = "okay";
+};
+
+&tsadc {
+	/* tshut mode 0:CRU 1:GPIO */
+	rockchip,hw-tshut-mode = <1>;
+	/* tshut polarity 0:LOW 1:HIGH */
+	rockchip,hw-tshut-polarity = <1>;
+	status = "okay";
+};
+
+&u2phy0 {
+	status = "okay";
+
+	u2phy0_otg: otg-port {
+		status = "okay";
+	};
+
+	u2phy0_host: host-port {
+		phy-supply = <&vcc5v0_otg>;
+		status = "okay";
+	};
+
+	port {
+		u2phy0_typec_hs: endpoint {
+			remote-endpoint = <&usbc_hs>;
+		};
+	};
+};
+
+&u2phy1 {
+	status = "okay";
+
+	u2phy1_otg: otg-port {
+		status = "okay";
+	};
+
+	u2phy1_host: host-port {
+		phy-supply = <&vcc5v0_otg>;
+		status = "okay";
+	};
+};
+
+&uart0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
+	uart-has-rtscts;
+	status = "okay";
+
+	bluetooth {
+		compatible = "brcm,bcm4345c5";
+		clocks = <&rk808 1>;
+		clock-names = "lpo";
+		device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>;
+		host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>;
+		max-speed = <1500000>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&bt_host_wake_gpio &bt_wake_gpio &bt_reset_gpio>;
+		shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
+		vbat-supply = <&wifi_bat>;
+		vddio-supply = <&vcc_wl>;
+	};
+};
+
+&uart2 {
+	status = "okay";
+};
+
+&usb_host0_ehci {
+	status = "okay";
+};
+
+&usb_host0_ohci {
+	status = "okay";
+};
+
+&usb_host1_ehci {
+	status = "okay";
+};
+
+&usb_host1_ohci {
+	status = "okay";
+};
+
+&usbdrd3_0 {
+	status = "okay";
+};
+
+&usbdrd_dwc3_0 {
+	dr_mode = "host";
+	status = "okay";
+};
+
+&usbdrd3_1 {
+	status = "okay";
+};
+
+&usbdrd_dwc3_1 {
+	dr_mode = "host";
+	status = "okay";
+};
+
+&vopb {
+	status = "okay";
+};
+
+&vopb_mmu {
+	status = "okay";
+};
+
+&vopl {
+	status = "okay";
+};
+
+&vopl_mmu {
+	status = "okay";
+};
--
2.25.1


code:
On systems without 'setfsuid', use 'setreuid' instead.

The patch originates from the Debian project for GNU/Hurd.
Authors: Steve Langasek <vorlon@debian.org>
Upstream status: A ticket was opened to request apply the patch,
ticket: 'https://fedorahosted.org/linux-pam/ticket/64'.

--- Linux-PAM-1.2.1/libpam/pam_modutil_priv.c	2015-03-24 06:02:32.000000000 -0600
+++ pam_modutil_priv-mod.c	2016-09-20 13:36:53.150663205 -0500
@@ -14,7 +14,9 @@
 #include <syslog.h>
 #include <pwd.h>
 #include <grp.h>
+#ifdef HAVE_SYS_FSUID_H
 #include <sys/fsuid.h>
+#endif /* HAVE_SYS_FSUID_H */

 /*
  * Two setfsuid() calls in a row are necessary to check
@@ -22,17 +24,55 @@
  */
 static int change_uid(uid_t uid, uid_t *save)
 {
+#ifdef HAVE_SYS_FSUID_H
 	uid_t tmp = setfsuid(uid);
 	if (save)
 		*save = tmp;
 	return (uid_t) setfsuid(uid) == uid ? 0 : -1;
+#else
+	uid_t euid = geteuid();
+	uid_t ruid = getuid();
+	if (save)
+		*save = ruid;
+	if (ruid == uid && uid != 0)
+		if (setreuid(euid, uid))
+			return -1;
+	else {
+		setreuid(0, -1);
+		if (setreuid(-1, uid)) {
+			setreuid(-1, 0);
+			setreuid(0, -1);
+			if (setreuid(-1, uid))
+				return -1;
+		}
+	}
+#endif
 }
 static int change_gid(gid_t gid, gid_t *save)
 {
+#ifdef HAVE_SYS_FSUID_H
 	gid_t tmp = setfsgid(gid);
 	if (save)
 		*save = tmp;
 	return (gid_t) setfsgid(gid) == gid ? 0 : -1;
+#else
+	gid_t egid = getegid();
+	gid_t rgid = getgid();
+	if (save)
+		*save = rgid;
+	if (rgid == gid)
+		if (setregid(egid, gid))
+			return -1;
+	else {
+		setregid(0, -1);
+		if (setregid(-1, gid)) {
+			setregid(-1, 0);
+			setregid(0, -1);
+			if (setregid(-1, gid))
+				return -1;
+		}
+	}
+#endif
 }

 static int cleanup(struct pam_modutil_privs *p)


code:
Do not try to create $localstatedir as we cannot do this when it is /var.

--- lirc-0.9.2a/daemons/Makefile.in
+++ lirc-0.9.2a/daemons/Makefile.in
@@ -790,9 +790,6 @@
 	uninstall-local uninstall-sbinPROGRAMS

-install-exec-local:
-	test -d  $(DESTDIR)$(varrundir)/$(PACKAGE) \
-		 || mkdir -p $(DESTDIR)$(varrundir)/$(PACKAGE)
 uninstall-local:
 	-$(RM) $(DESTDIR)$(varrundir)/$(PACKAGE)/lircd


code:
Build Lirc reproducibly.

https://sourceforge.net/p/lirc/tickets/301/
https://sourceforge.net/p/lirc/git/merge-requests/33/
https://sourceforge.net/p/lirc/git/merge-requests/34/
https://sourceforge.net/p/lirc/git/merge-requests/36/

Index: lirc-0.10.1/tools/lirc-lsplugins.cpp
===================================================================
--- lirc-0.10.1.orig/tools/lirc-lsplugins.cpp
+++ lirc-0.10.1/tools/lirc-lsplugins.cpp
@@ -415,10 +415,9 @@ static void print_header(void)
 static void print_yaml_header(void)
 {
 	static const char* const YAML_HEADER =
-		"#\n# Generated by lirc-lsplugins --yaml (%s) at %s#\n ";
-	const time_t now = time(NULL);
+		"#\n# Generated by lirc-lsplugins --yaml (%s)#\n ";

-	printf(YAML_HEADER, VERSION, ctime(&now));
+	printf(YAML_HEADER, VERSION);
 	printf("\ndrivers:\n");
 }

Index: lirc-0.10.1/python-pkg/lirc/database.py
===================================================================
--- lirc-0.10.1.orig/python-pkg/lirc/database.py
+++ lirc-0.10.1/python-pkg/lirc/database.py
@@ -156,7 +156,7 @@ class Database(object):
             d['device_hint'] = hint

         configs = {}
-        for path in glob.glob(configdir + '/*.conf'):
+        for path in sorted(glob.glob(configdir + '/*.conf')):
             with open(path) as f:
                 cf = yaml.load(f.read())
             configs[cf['config']['id']] = cf['config']
Index: lirc-0.10.1/tools/irdb-get
===================================================================
--- lirc-0.10.1.orig/tools/irdb-get
+++ lirc-0.10.1/tools/irdb-get
@@ -9,7 +9,6 @@ import fnmatch
 import os
 import os.path
 import sys
-import time
 import urllib.error          # pylint: disable=no-name-in-module,F0401,E0611
 import urllib.request        # pylint: disable=no-name-in-module,F0401,E0611

@@ -193,7 +192,7 @@ def do_yaml_config():
         lircmd_by_driver[driver].append("%s/%s" % (tokens[0], tokens[2]))

     print("#")
-    print("# Created by 'irdb-get yaml-config' at " + time.ctime())
+    print("# Created by 'irdb-get yaml-config'")
     print("#")
     print("\nlircd_by_driver:")
     print_yaml_dict(lircd_by_driver)
Index: lirc-0.10.1/tools/lirc-make-devinput
===================================================================
--- lirc-0.10.1.orig/tools/lirc-make-devinput
+++ lirc-0.10.1/tools/lirc-make-devinput
@@ -61,8 +61,7 @@ if test -n "$lirc_map"; then
 fi

-echo "# Generated by $(basename $0) on $(uname -r)"
-echo "# Date: $(date)"
+echo "# Generated by $(basename $0)"
 cat <<EOF

 begin remote