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

license: mit


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 f24c88a0732024028fffe0372039a847e91722ea Mon Sep 17 00:00:00 2001
From: Christopher Baines <mail@cbaines.net>
Date: Tue, 1 Jan 2019 22:36:29 +0000
Subject: [PATCH] Mark more tests that require the network

I believe all these tests require the network, at least they seem to
fail if it's I run them without connecting my computer to the web.

I'm looking at this as part of packaging linkchecker for GNU Guix,
where the package is build and the tests are run in a isolated
environment, intentionally without network access, to avoid issues
with non-reproducible package builds.
---
 tests/checker/test_http.py          | 2 ++
 tests/checker/test_http_misc.py     | 2 ++
 tests/checker/test_http_redirect.py | 2 ++
 tests/checker/test_httpbin.py       | 5 +++++
 tests/checker/test_misc.py          | 4 ++++
 tests/checker/test_whitespace.py    | 3 +++
 6 files changed, 18 insertions(+)

diff --git a/tests/checker/test_http.py b/tests/checker/test_http.py
index e4c1e097..8a8af567 100644
--- a/tests/checker/test_http.py
+++ b/tests/checker/test_http.py
@@ -20,6 +20,7 @@

 import pytest

+from tests import need_network
 from .httpserver import HttpServerTest, CookieRedirectHttpRequestHandler

 class TestHttp (HttpServerTest):
@@ -29,6 +30,7 @@ def __init__(self, methodName='runTest'):
         super(TestHttp, self).__init__(methodName=methodName)
         self.handler = CookieRedirectHttpRequestHandler

+    @need_network
     def test_html (self):
         confargs = dict(recursionlevel=1)
         self.file_test("http.html", confargs=confargs)
diff --git a/tests/checker/test_http_misc.py b/tests/checker/test_http_misc.py
index 9922d85f..c6b6afdb 100644
--- a/tests/checker/test_http_misc.py
+++ b/tests/checker/test_http_misc.py
@@ -20,11 +20,13 @@
 import os
 import sys
 from .httpserver import HttpServerTest
+from tests import need_network
 from linkcheck.network import iputil

 class TestHttpMisc (HttpServerTest):
     """Test http:// misc link checking."""

+    @need_network
     def test_html (self):
         self.swf_test()
         self.obfuscate_test()
diff --git a/tests/checker/test_http_redirect.py b/tests/checker/test_http_redirect.py
index f212d98e..2253a70d 100644
--- a/tests/checker/test_http_redirect.py
+++ b/tests/checker/test_http_redirect.py
@@ -17,6 +17,7 @@
 """
 Test http checking.
 """
+from tests import need_network
 from .httpserver import HttpServerTest, CookieRedirectHttpRequestHandler

 class TestHttpRedirect (HttpServerTest):
@@ -26,6 +27,7 @@ def __init__(self, methodName='runTest'):
         super(TestHttpRedirect, self).__init__(methodName=methodName)
         self.handler = CookieRedirectHttpRequestHandler

+    @need_network
     def test_redirect (self):
         self.redirect1()
         self.redirect2()
diff --git a/tests/checker/test_httpbin.py b/tests/checker/test_httpbin.py
index 0319c2f6..4c8fa846 100644
--- a/tests/checker/test_httpbin.py
+++ b/tests/checker/test_httpbin.py
@@ -18,6 +18,7 @@
 Test http stuff with httpbin.org.
 """
 import re
+from tests import need_network
 from . import LinkCheckTest

@@ -30,6 +31,7 @@ def get_httpbin_url(path):
 class TestHttpbin(LinkCheckTest):
     """Test http:// link redirection checking."""

+    @need_network
     def test_http_link(self):
         linkurl = u"http://www.example.com"
         nlinkurl = self.norm(linkurl)
@@ -48,6 +50,7 @@ def test_http_link(self):
         ]
         self.direct(url, resultlines, recursionlevel=1)

+    @need_network
     def test_basic_auth(self):
         user = u"testuser"
         password = u"testpassword"
@@ -67,6 +70,7 @@ def test_basic_auth(self):
         ]
         self.direct(url, resultlines, confargs=confargs)

+    @need_network
     def test_http_refresh_header(self):
         linkurl = u"http://www.example.com"
         nlinkurl = self.norm(linkurl)
@@ -85,6 +89,7 @@ def test_http_refresh_header(self):
         ]
         self.direct(url, resultlines, recursionlevel=1)

+    @need_network
     def test_http_content_location_header(self):
         linkurl = u"http://www.example.com"
         nlinkurl = self.norm(linkurl)
diff --git a/tests/checker/test_misc.py b/tests/checker/test_misc.py
index 2e4cfd07..f9591f9d 100644
--- a/tests/checker/test_misc.py
+++ b/tests/checker/test_misc.py
@@ -17,6 +17,7 @@
 """
 Test miscellaneous html tag parsing and URL types
 """
+from tests import need_network
 from . import LinkCheckTest

@@ -25,15 +26,18 @@ class TestMisc (LinkCheckTest):
     Test misc link types.
     """

+    @need_network
     def test_misc (self):
         self.file_test("misc.html")

     def test_html5 (self):
         self.file_test("html5.html")

+    @need_network
     def test_archive (self):
         self.file_test("archive.html")

+    @need_network
     def test_itms_services(self):
         url = u"itms-services:?action=download-manifest&url=http://www.example.com/"
         resultlines = [
diff --git a/tests/checker/test_whitespace.py b/tests/checker/test_whitespace.py
index 609c108a..fc2727d6 100644
--- a/tests/checker/test_whitespace.py
+++ b/tests/checker/test_whitespace.py
@@ -17,6 +17,7 @@
 """
 Test whitespace handling.
 """
+from tests import need_network
 from . import LinkCheckTest

@@ -25,6 +26,7 @@ class TestWhitespace (LinkCheckTest):
     Test whitespace in URLs.
     """

+    @need_network
     def test_leading_whitespace (self):
         # Leading whitespace
         url = u" http://www.example.org/"
@@ -50,6 +52,7 @@ def test_leading_whitespace (self):
         ]
         self.direct(url, resultlines)

+    @need_network
     def test_trailing_whitespace (self):
         # Trailing whitespace
         url = u"http://www.example.org/ "


code:
From ecaab0f73d0b74bbfbf150286305fa6e12970037 Mon Sep 17 00:00:00 2001
From: Ronan Abhamon <ronan.abhamon@belledonne-communications.com>
Date: Fri, 19 Jan 2018 14:42:01 +0100
Subject: [PATCH] fix(SettingsWindow): rename icon property of TabButton to
 iconName (issue with Qt 5.10 and new icon property)

---
 ui/modules/Common/Form/Tab/TabButton.qml |  8 ++++----
 ui/views/App/Settings/SettingsWindow.qml | 14 +++++++-------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/ui/modules/Common/Form/Tab/TabButton.qml b/ui/modules/Common/Form/Tab/TabButton.qml
index ad220ab2..a47bb20b 100644
--- a/ui/modules/Common/Form/Tab/TabButton.qml
+++ b/ui/modules/Common/Form/Tab/TabButton.qml
@@ -12,8 +12,8 @@ Controls.TabButton {

   // ---------------------------------------------------------------------------

-  property string icon
   property int iconSize: TabButtonStyle.icon.size
+  property string iconName

   readonly property bool _isSelected: parent.parent.currentItem === button

@@ -66,9 +66,9 @@ Controls.TabButton {
       Layout.leftMargin: TabButtonStyle.text.leftPadding

       icon: {
-        var icon = button.icon
-        return icon.length
-          ? (icon + '_' + (button._isSelected ? 'selected' : 'normal'))
+        var iconName = button.iconName
+        return iconName.length
+          ? (iconName + '_' + (button._isSelected ? 'selected' : 'normal'))
           : ''
       }
       iconSize: button.iconSize
diff --git a/ui/views/App/Settings/SettingsWindow.qml b/ui/views/App/Settings/SettingsWindow.qml
index b8f5a80f..58909544 100644
--- a/ui/views/App/Settings/SettingsWindow.qml
+++ b/ui/views/App/Settings/SettingsWindow.qml
@@ -48,43 +48,43 @@ ApplicationWindow {
         id: tabBar

         TabButton {
-          icon: 'settings_sip_accounts'
+          iconName: 'settings_sip_accounts'
           text: qsTr('sipAccountsTab')
           width: implicitWidth
         }

         TabButton {
-          icon: 'settings_audio'
+          iconName: 'settings_audio'
           text: qsTr('audioTab')
           width: implicitWidth
         }

         TabButton {
-          icon: 'settings_video'
+          iconName: 'settings_video'
           text: qsTr('videoTab')
           width: implicitWidth
         }

         TabButton {
-          icon: 'settings_call'
+          iconName: 'settings_call'
           text: qsTr('callsAndChatTab')
           width: implicitWidth
         }

         TabButton {
-          icon: 'settings_network'
+          iconName: 'settings_network'
           text: qsTr('networkTab')
           width: implicitWidth
         }

         TabButton {
-          icon: 'settings_advanced'
+          iconName: 'settings_advanced'
           text: qsTr('uiTab')
           width: implicitWidth
         }

         TabButton {
-          icon: 'settings_advanced'
+          iconName: 'settings_advanced'
           text: qsTr('uiAdvanced')
           width: implicitWidth
         }
--
2.21.0


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


code:
This patch was downloaded from https://sft.its.cern.ch/jira/browse/ROOT-7047.
It fixes the build of clang 3.5 with GCC 5.  File paths have been adjusted.

From 00f3ed6eee41da871799ad0fd19153c7682d61fe Mon Sep 17 00:00:00 2001
From: Alexander Klimov <alserkli@inbox.ru>
Date: Mon, 26 Jan 2015 18:45:23 +0200
Subject: [PATCH] [ADT/IntrusiveRefCntPtr] Give friend access to
 IntrusiveRefCntPtr<X> so the relevant move constructor can
 access 'Obj'.

From LLVM upstream:
Author: Argyrios Kyrtzidis <akyrtzi@gmail.com>
Date:   Tue Sep 23 06:06:43 2014 +0000
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218295 91177308-0d34-0410-b5e6-96231b3b80d8
---
 interpreter/llvm/src/include/llvm/ADT/IntrusiveRefCntPtr.h |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/llvm/ADT/IntrusiveRefCntPtr.h b/include/llvm/ADT/IntrusiveRefCntPtr.h
index f9df378..c859c98 100644
--- a/include/llvm/ADT/IntrusiveRefCntPtr.h
+++ b/include/llvm/ADT/IntrusiveRefCntPtr.h
@@ -197,6 +197,9 @@ public:
   private:
     void retain() { if (Obj) IntrusiveRefCntPtrInfo<T>::retain(Obj); }
     void release() { if (Obj) IntrusiveRefCntPtrInfo<T>::release(Obj); }
+
+    template <typename X>
+    friend class IntrusiveRefCntPtr;
   };

   template<class T, class U>
--
1.7.10.4


code:
From f8e146f3430de3a6cd904f3f3f7aa1bfaefee14c Mon Sep 17 00:00:00 2001
From: Bjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Date: Thu, 28 Nov 2019 23:18:28 +0100
Subject: [PATCH] [InstCombine] Fix big-endian miscompile of (bitcast
 (zext/trunc (bitcast)))

Summary:
optimizeVectorResize is rewriting patterns like:
  %1 = bitcast vector %src to integer
  %2 = trunc/zext %1
  %dst = bitcast %2 to vector

Since bitcasting between integer an vector types gives
different integer values depending on endianness, we need
to take endianness into account. As it happens the old
implementation only produced the correct result for little
endian targets.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=44178

Reviewers: spatel, lattner, lebedev.ri

Reviewed By: spatel, lebedev.ri

Subscribers: lebedev.ri, hiraditya, uabelho, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70844

(cherry picked from commit a9d6b0e5444741d08ff1df7cf71d1559e7fefc1f)
---
 .../InstCombine/InstCombineCasts.cpp          | 79 +++++++++++++------
 llvm/test/Transforms/InstCombine/cast.ll      |  6 +-
 2 files changed, 60 insertions(+), 25 deletions(-)

diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 2c9ba203fbf3..0af3de300e77 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -18,6 +18,7 @@
 #include "llvm/IR/DIBuilder.h"
 #include "llvm/IR/PatternMatch.h"
 #include "llvm/Support/KnownBits.h"
+#include <numeric>
 using namespace llvm;
 using namespace PatternMatch;

@@ -1820,12 +1821,24 @@ Instruction *InstCombiner::visitPtrToInt(PtrToIntInst &CI) {
 }

 /// This input value (which is known to have vector type) is being zero extended
-/// or truncated to the specified vector type.
+/// or truncated to the specified vector type. Since the zext/trunc is done
+/// using an integer type, we have a (bitcast(cast(bitcast))) pattern,
+/// endianness will impact which end of the vector that is extended or
+/// truncated.
+///
+/// A vector is always stored with index 0 at the lowest address, which
+/// corresponds to the most significant bits for a big endian stored integer and
+/// the least significant bits for little endian. A trunc/zext of an integer
+/// impacts the big end of the integer. Thus, we need to add/remove elements at
+/// the front of the vector for big endian targets, and the back of the vector
+/// for little endian targets.
+///
 /// Try to replace it with a shuffle (and vector/vector bitcast) if possible.
 ///
 /// The source and destination vector types may have different element types.
-static Instruction *optimizeVectorResize(Value *InVal, VectorType *DestTy,
-                                         InstCombiner &IC) {
+static Instruction *optimizeVectorResizeWithIntegerBitCasts(Value *InVal,
+                                                            VectorType *DestTy,
+                                                            InstCombiner &IC) {
   // We can only do this optimization if the output is a multiple of the input
   // element size, or the input is a multiple of the output element size.
   // Convert the input type to have the same element type as the output.
@@ -1844,31 +1857,53 @@ static Instruction *optimizeVectorResize(Value *InVal, VectorType *DestTy,
     InVal = IC.Builder.CreateBitCast(InVal, SrcTy);
   }

+  bool IsBigEndian = IC.getDataLayout().isBigEndian();
+  unsigned SrcElts = SrcTy->getNumElements();
+  unsigned DestElts = DestTy->getNumElements();
+
+  assert(SrcElts != DestElts && "Element counts should be different.");
+
   // Now that the element types match, get the shuffle mask and RHS of the
   // shuffle to use, which depends on whether we're increasing or decreasing the
   // size of the input.
-  SmallVector<uint32_t, 16> ShuffleMask;
+  SmallVector<uint32_t, 16> ShuffleMaskStorage;
+  ArrayRef<uint32_t> ShuffleMask;
   Value *V2;

-  if (SrcTy->getNumElements() > DestTy->getNumElements()) {
-    // If we're shrinking the number of elements, just shuffle in the low
-    // elements from the input and use undef as the second shuffle input.
-    V2 = UndefValue::get(SrcTy);
-    for (unsigned i = 0, e = DestTy->getNumElements(); i != e; ++i)
-      ShuffleMask.push_back(i);
+  // Produce an identify shuffle mask for the src vector.
+  ShuffleMaskStorage.resize(SrcElts);
+  std::iota(ShuffleMaskStorage.begin(), ShuffleMaskStorage.end(), 0);

+  if (SrcElts > DestElts) {
+    // If we're shrinking the number of elements (rewriting an integer
+    // truncate), just shuffle in the elements corresponding to the least
+    // significant bits from the input and use undef as the second shuffle
+    // input.
+    V2 = UndefValue::get(SrcTy);
+    // Make sure the shuffle mask selects the "least significant bits" by
+    // keeping elements from back of the src vector for big endian, and from the
+    // front for little endian.
+    ShuffleMask = ShuffleMaskStorage;
+    if (IsBigEndian)
+      ShuffleMask = ShuffleMask.take_back(DestElts);
+    else
+      ShuffleMask = ShuffleMask.take_front(DestElts);
   } else {
-    // If we're increasing the number of elements, shuffle in all of the
-    // elements from InVal and fill the rest of the result elements with zeros
-    // from a constant zero.
+    // If we're increasing the number of elements (rewriting an integer zext),
+    // shuffle in all of the elements from InVal. Fill the rest of the result
+    // elements with zeros from a constant zero.
     V2 = Constant::getNullValue(SrcTy);
-    unsigned SrcElts = SrcTy->getNumElements();
-    for (unsigned i = 0, e = SrcElts; i != e; ++i)
-      ShuffleMask.push_back(i);
-
-    // The excess elements reference the first element of the zero input.
-    for (unsigned i = 0, e = DestTy->getNumElements()-SrcElts; i != e; ++i)
-      ShuffleMask.push_back(SrcElts);
+    // Use first elt from V2 when indicating zero in the shuffle mask.
+    uint32_t NullElt = SrcElts;
+    // Extend with null values in the "most significant bits" by adding elements
+    // in front of the src vector for big endian, and at the back for little
+    // endian.
+    unsigned DeltaElts = DestElts - SrcElts;
+    if (IsBigEndian)
+      ShuffleMaskStorage.insert(ShuffleMaskStorage.begin(), DeltaElts, NullElt);
+    else
+      ShuffleMaskStorage.append(DeltaElts, NullElt);
+    ShuffleMask = ShuffleMaskStorage;
   }

   return new ShuffleVectorInst(InVal, V2,
@@ -2359,8 +2394,8 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) {
         CastInst *SrcCast = cast<CastInst>(Src);
         if (BitCastInst *BCIn = dyn_cast<BitCastInst>(SrcCast->getOperand(0)))
           if (isa<VectorType>(BCIn->getOperand(0)->getType()))
-            if (Instruction *I = optimizeVectorResize(BCIn->getOperand(0),
-                                               cast<VectorType>(DestTy), *this))
+            if (Instruction *I = optimizeVectorResizeWithIntegerBitCasts(
+                    BCIn->getOperand(0), cast<VectorType>(DestTy), *this))
               return I;
       }

diff --git a/llvm/test/Transforms/InstCombine/cast.ll b/llvm/test/Transforms/InstCombine/cast.ll
index b6d1eda0601d..3ce8de033422 100644
--- a/llvm/test/Transforms/InstCombine/cast.ll
+++ b/llvm/test/Transforms/InstCombine/cast.ll
@@ -824,7 +824,7 @@ define i64 @test59(i8 %A, i8 %B) {

 define <3 x i32> @test60(<4 x i32> %call4) {
 ; CHECK-LABEL: @test60(
-; CHECK-NEXT:    [[P10:%.*]] = shufflevector <4 x i32> [[CALL4:%.*]], <4 x i32> undef, <3 x i32> <i32 0, i32 1, i32 2>
+; CHECK-NEXT:    [[P10:%.*]] = shufflevector <4 x i32> [[CALL4:%.*]], <4 x i32> undef, <3 x i32> <i32 1, i32 2, i32 3>
 ; CHECK-NEXT:    ret <3 x i32> [[P10]]
 ;
   %p11 = bitcast <4 x i32> %call4 to i128
@@ -836,7 +836,7 @@ define <3 x i32> @test60(<4 x i32> %call4) {

 define <4 x i32> @test61(<3 x i32> %call4) {
 ; CHECK-LABEL: @test61(
-; CHECK-NEXT:    [[P10:%.*]] = shufflevector <3 x i32> [[CALL4:%.*]], <3 x i32> <i32 0, i32 undef, i32 undef>, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
+; CHECK-NEXT:    [[P10:%.*]] = shufflevector <3 x i32> [[CALL4:%.*]], <3 x i32> <i32 0, i32 undef, i32 undef>, <4 x i32> <i32 3, i32 0, i32 1, i32 2>
 ; CHECK-NEXT:    ret <4 x i32> [[P10]]
 ;
   %p11 = bitcast <3 x i32> %call4 to i96
@@ -848,7 +848,7 @@ define <4 x i32> @test61(<3 x i32> %call4) {
 define <4 x i32> @test62(<3 x float> %call4) {
 ; CHECK-LABEL: @test62(
 ; CHECK-NEXT:    [[TMP1:%.*]] = bitcast <3 x float> [[CALL4:%.*]] to <3 x i32>
-; CHECK-NEXT:    [[P10:%.*]] = shufflevector <3 x i32> [[TMP1]], <3 x i32> <i32 0, i32 undef, i32 undef>, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
+; CHECK-NEXT:    [[P10:%.*]] = shufflevector <3 x i32> [[TMP1]], <3 x i32> <i32 0, i32 undef, i32 undef>, <4 x i32> <i32 3, i32 0, i32 1, i32 2>
 ; CHECK-NEXT:    ret <4 x i32> [[P10]]
 ;
   %p11 = bitcast <3 x float> %call4 to i96
--
2.26.2


code:
From 011fb5bf8b31316472fccb1a19c91912246df9b2 Mon Sep 17 00:00:00 2001
From: Reid Kleckner <rnk@google.com>
Date: Sat, 28 Mar 2020 11:03:14 -0700
Subject: [PATCH] [CodeGen] Fix sinking local values in lpads with phis

There was already a test case for landingpads to handle this case, but I
had forgotten to consider PHI instructions preceding the EH_LABEL in the
landingpad.

PR45261
---
 llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 17 +++++++++-
 llvm/test/CodeGen/X86/sink-local-value.ll  | 36 ++++++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index 5ac3606dc662..2638b1e8a05c 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -225,6 +225,21 @@ static bool isRegUsedByPhiNodes(unsigned DefReg,
   return false;
 }

+static bool isTerminatingEHLabel(MachineBasicBlock *MBB, MachineInstr &MI) {
+  // Ignore non-EH labels.
+  if (!MI.isEHLabel())
+    return false;
+
+  // Any EH label outside a landing pad must be for an invoke. Consider it a
+  // terminator.
+  if (!MBB->isEHPad())
+    return true;
+
+  // If this is a landingpad, the first non-phi instruction will be an EH_LABEL.
+  // Don't consider that label to be a terminator.
+  return MI.getIterator() != MBB->getFirstNonPHI();
+}
+
 /// Build a map of instruction orders. Return the first terminator and its
 /// order. Consider EH_LABEL instructions to be terminators as well, since local
 /// values for phis after invokes must be materialized before the call.
@@ -233,7 +248,7 @@ void FastISel::InstOrderMap::initialize(
   unsigned Order = 0;
   for (MachineInstr &I : *MBB) {
     if (!FirstTerminator &&
-        (I.isTerminator() || (I.isEHLabel() && &I != &MBB->front()))) {
+        (I.isTerminator() || isTerminatingEHLabel(MBB, I))) {
       FirstTerminator = &I;
       FirstTerminatorOrder = Order;
     }
diff --git a/llvm/test/CodeGen/X86/sink-local-value.ll b/llvm/test/CodeGen/X86/sink-local-value.ll
index b0e511ac1189..f7d861ac9b6c 100644
--- a/llvm/test/CodeGen/X86/sink-local-value.ll
+++ b/llvm/test/CodeGen/X86/sink-local-value.ll
@@ -145,6 +145,42 @@ try.cont:                                         ; preds = %entry, %lpad
 ; CHECK:         retl

+define i32 @lpad_phi() personality i32 (...)* @__gxx_personality_v0 {
+entry:
+  store i32 42, i32* @sink_across
+  invoke void @may_throw()
+          to label %try.cont unwind label %lpad
+
+lpad:                                             ; preds = %entry
+  %p = phi i32 [ 11, %entry ]  ; Trivial, but -O0 keeps it
+  %0 = landingpad { i8*, i32 }
+          catch i8* null
+  store i32 %p, i32* @sink_across
+  br label %try.cont
+
+try.cont:                                         ; preds = %entry, %lpad
+  %r.0 = phi i32 [ 13, %entry ], [ 55, %lpad ]
+  ret i32 %r.0
+}
+
+; The constant materialization should be *after* the stores to sink_across, but
+; before any EH_LABEL.
+
+; CHECK-LABEL: lpad_phi:
+; CHECK:         movl    $42, sink_across
+; CHECK:         movl    $13, %{{[a-z]*}}
+; CHECK: .Ltmp{{.*}}:
+; CHECK:         calll   may_throw
+; CHECK: .Ltmp{{.*}}:
+; CHECK:         jmp     .LBB{{.*}}
+; CHECK: .LBB{{.*}}:                                # %lpad
+; CHECK-NEXT: .Ltmp{{.*}}:
+; CHECK:         movl    {{.*}}, sink_across
+; CHECK:         movl    $55, %{{[a-z]*}}
+; CHECK: .LBB{{.*}}:                                # %try.cont
+; CHECK:         retl
+
+
 ; Function Attrs: nounwind readnone speculatable
 declare void @llvm.dbg.value(metadata, metadata, metadata) #0


code:
Guix note: this got detected with the test suite of rustc 1.41.1, but
the issue potentially affects all consumers of LLVM.

From 58e8c793d0e43150a6452e971a32d7407a8a7401 Mon Sep 17 00:00:00 2001
From: Tim Northover <tnorthover@apple.com>
Date: Mon, 30 Sep 2019 07:46:52 +0000
Subject: [PATCH] Revert "[SCEV] add no wrap flag for SCEVAddExpr."

This reverts r366419 because the analysis performed is within the context of
the loop and it's only valid to add wrapping flags to "global" expressions if
they're always correct.

llvm-svn: 373184
---
 llvm/lib/Analysis/ScalarEvolution.cpp              | 2 +-
 llvm/test/Analysis/ScalarEvolution/limit-depth.ll  | 2 +-
 llvm/test/Analysis/ScalarEvolution/nsw.ll          | 2 +-
 llvm/test/Analysis/ScalarEvolution/trip-count12.ll | 2 +-
 llvm/test/Analysis/ScalarEvolution/trip-count9.ll  | 8 ++++----
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 354ae05bb841..c29fc5dbccfb 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -4992,7 +4992,7 @@ const SCEV *ScalarEvolution::createSimpleAffineAddRec(PHINode *PN,
   // overflow.
   if (auto *BEInst = dyn_cast<Instruction>(BEValueV))
     if (isLoopInvariant(Accum, L) && isAddRecNeverPoison(BEInst, L))
-      (void)getAddRecExpr(getAddExpr(StartVal, Accum, Flags), Accum, L, Flags);
+      (void)getAddRecExpr(getAddExpr(StartVal, Accum), Accum, L, Flags);

   return PHISCEV;
 }
diff --git a/llvm/test/Analysis/ScalarEvolution/limit-depth.ll b/llvm/test/Analysis/ScalarEvolution/limit-depth.ll
index db68a4f84c91..6fdf8c5df974 100644
--- a/llvm/test/Analysis/ScalarEvolution/limit-depth.ll
+++ b/llvm/test/Analysis/ScalarEvolution/limit-depth.ll
@@ -46,7 +46,7 @@ define void @test_mul(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f) {
 define void @test_sext(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f) {
 ; CHECK-LABEL: @test_sext
 ; CHECK:        %se2 = sext i64 %iv2.inc to i128
-; CHECK-NEXT:   -->  {(1 + (sext i64 {(sext i32 (1 + %a)<nsw> to i64),+,1}<nsw><%loop> to i128))<nsw>,+,1}<nsw><%loop2>
+; CHECK-NEXT:   -->  {(1 + (sext i64 {(sext i32 (1 + %a) to i64),+,1}<nsw><%loop> to i128))<nsw>,+,1}<nsw><%loop2>
 entry:
   br label %loop

diff --git a/llvm/test/Analysis/ScalarEvolution/nsw.ll b/llvm/test/Analysis/ScalarEvolution/nsw.ll
index 69427368625d..ca24f9d4a04b 100644
--- a/llvm/test/Analysis/ScalarEvolution/nsw.ll
+++ b/llvm/test/Analysis/ScalarEvolution/nsw.ll
@@ -163,7 +163,7 @@ bb5:                                              ; preds = %bb2
 declare void @f(i32)

 ; CHECK-LABEL: nswnowrap
-; CHECK: --> {(1 + %v)<nsw>,+,1}<nsw><%for.body>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (2 + %v)
+; CHECK: --> {(1 + %v)<nsw>,+,1}<nsw><%for.body>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (1 + ((1 + %v)<nsw> smax %v))
 define void @nswnowrap(i32 %v, i32* %buf) {
 entry:
   %add = add nsw i32 %v, 1
diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count12.ll b/llvm/test/Analysis/ScalarEvolution/trip-count12.ll
index 5e7d72d5e4f3..d0086ee2e6ac 100644
--- a/llvm/test/Analysis/ScalarEvolution/trip-count12.ll
+++ b/llvm/test/Analysis/ScalarEvolution/trip-count12.ll
@@ -1,7 +1,7 @@
 ; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s

 ; CHECK: Determining loop execution counts for: @test
-; CHECK: Loop %for.body: backedge-taken count is ((-2 + %len)<nsw> /u 2)
+; CHECK: Loop %for.body: backedge-taken count is ((-2 + %len) /u 2)
 ; CHECK: Loop %for.body: max backedge-taken count is 1073741823

 define zeroext i16 @test(i16* nocapture %p, i32 %len) nounwind readonly {
diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count9.ll b/llvm/test/Analysis/ScalarEvolution/trip-count9.ll
index c0a1d12fa00e..9a080b34743f 100644
--- a/llvm/test/Analysis/ScalarEvolution/trip-count9.ll
+++ b/llvm/test/Analysis/ScalarEvolution/trip-count9.ll
@@ -179,7 +179,7 @@ exit:
 }

 ; CHECK: Determining loop execution counts for: @nsw_startx
-; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x)<nsw> smax %n))
+; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax %n))
 ; CHECK: Loop %loop: max backedge-taken count is -1
 define void @nsw_startx(i4 %n, i4 %x) {
 entry:
@@ -195,7 +195,7 @@ exit:
 }

 ; CHECK: Determining loop execution counts for: @nsw_startx_step2
-; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x)<nsw> smax %n)) /u 2)
+; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax %n)) /u 2)
 ; CHECK: Loop %loop: max backedge-taken count is 7
 define void @nsw_startx_step2(i4 %n, i4 %x) {
 entry:
@@ -381,7 +381,7 @@ exit:
 }

 ; CHECK: Determining loop execution counts for: @even_nsw_startx
-; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x)<nsw> smax (2 * %n)))
+; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax (2 * %n)))
 ; CHECK: Loop %loop: max backedge-taken count is -2
 define void @even_nsw_startx(i4 %n, i4 %x) {
 entry:
@@ -398,7 +398,7 @@ exit:
 }

 ; CHECK: Determining loop execution counts for: @even_nsw_startx_step2
-; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x)<nsw> smax (2 * %n))) /u 2)
+; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax (2 * %n))) /u 2)
 ; CHECK: Loop %loop: max backedge-taken count is 7
 define void @even_nsw_startx_step2(i4 %n, i4 %x) {
 entry:


code:
fancontrol: Deal with moving hwmon attributes

Several kernel drivers have already moved their attributes from the
hardware device to the hwmon class device, and others will follow.
Teach fancontrol about this possibility and let it adjust the attribute
paths transparently.

Patch by Jean Delvare <khali@linux-fr.org>.
See <http://www.lm-sensors.org/changeset/6216>.

--- lm-sensors/prog/pwm/fancontrol	(revision 6172)
+++ lm-sensors/prog/pwm/fancontrol	(revision 6216)
@@ -207,4 +207,63 @@
 }

+function FixupDeviceFiles
+{
+	local DEVICE="$1"
+	local fcvcount pwmo tsen fan
+
+	let fcvcount=0
+	while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs
+	do
+		pwmo=${AFCPWM[$fcvcount]}
+		AFCPWM[$fcvcount]=${pwmo//$DEVICE\/device/$DEVICE}
+		if [ "${AFCPWM[$fcvcount]}" != "$pwmo" ]
+		then
+			echo "Adjusing $pwmo -> ${AFCPWM[$fcvcount]}"
+		fi
+		let fcvcount=$fcvcount+1
+	done
+
+	let fcvcount=0
+	while (( $fcvcount < ${#AFCTEMP[@]} )) # go through all temp inputs
+	do
+		tsen=${AFCTEMP[$fcvcount]}
+		AFCTEMP[$fcvcount]=${tsen//$DEVICE\/device/$DEVICE}
+		if [ "${AFCTEMP[$fcvcount]}" != "$tsen" ]
+		then
+			echo "Adjusing $tsen -> ${AFCTEMP[$fcvcount]}"
+		fi
+		let fcvcount=$fcvcount+1
+	done
+
+	let fcvcount=0
+	while (( $fcvcount < ${#AFCFAN[@]} )) # go through all fan inputs
+	do
+		fan=${AFCFAN[$fcvcount]}
+		AFCFAN[$fcvcount]=${fan//$DEVICE\/device/$DEVICE}
+		if [ "${AFCFAN[$fcvcount]}" != "$fan" ]
+		then
+			echo "Adjusing $fan -> ${AFCFAN[$fcvcount]}"
+		fi
+		let fcvcount=$fcvcount+1
+	done
+}
+
+# Some drivers moved their attributes from hard device to class device
+function FixupFiles
+{
+	local DEVPATH="$1"
+	local entry device
+
+	for entry in $DEVPATH
+	do
+		device=`echo "$entry" | sed -e 's/=[^=]*$//'`
+
+		if [ -e "$device/name" ]
+		then
+			FixupDeviceFiles "$device"
+		fi
+	done
+}
+
 # Check that all referenced sysfs files exist
 function CheckFiles
@@ -306,4 +365,8 @@
 	echo "Configuration appears to be outdated, please run pwmconfig again" >&2
 	exit 1
+fi
+if [ "$DIR" = "/sys/class/hwmon" ]
+then
+	FixupFiles "$DEVPATH"
 fi
 CheckFiles || exit 1


code:
Normally localed would do an approximate parsing of the Xorg config file
to determine the XKB keyboard layout.  This doesn't make sense on Guix
where there's no such file in /etc, and where the keyboard layout is
known statically at configuration time.

This patch removes the XOrg configuration parsing and expects to read the
configuration from environment variables instead.  It also removes the
stateful bits that would write configuration to /etc/vconsole.conf
and /etc/X11, which are unused in Guix anyway.

Patch by Ludovic Courtès <ludo@gnu.org>.

diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c
index 6b6b32a591..46aab472b0 100644
--- a/src/locale/keymap-util.c
+++ b/src/locale/keymap-util.c
@@ -174,32 +174,16 @@ int vconsole_read_data(Context *c, sd_bus_message *m) {
                 c->vc_cache = sd_bus_message_ref(m);
         }

-        if (stat("/etc/vconsole.conf", &st) < 0) {
-                if (errno != ENOENT)
-                        return -errno;
-
-                c->vc_mtime = USEC_INFINITY;
-                context_free_vconsole(c);
-                return 0;
-        }
-
-        /* If mtime is not changed, then we do not need to re-read */
-        t = timespec_load(&st.st_mtim);
-        if (c->vc_mtime != USEC_INFINITY && t == c->vc_mtime)
-                return 0;
-
-        c->vc_mtime = t;
+        c->vc_mtime = USEC_INFINITY;
         context_free_vconsole(c);
-
-        r = parse_env_file(NULL, "/etc/vconsole.conf",
-                           "KEYMAP",        &c->vc_keymap,
-                           "KEYMAP_TOGGLE", &c->vc_keymap_toggle);
-        if (r < 0)
-                return r;
-
         return 0;
 }

+static char *getenv_strdup(const char *variable) {
+        const char *value = getenv(variable);
+        return value == NULL ? NULL : strdup(value);
+}
+
 int x11_read_data(Context *c, sd_bus_message *m) {
         _cleanup_fclose_ FILE *f = NULL;
         bool in_section = false;
@@ -216,258 +200,27 @@ int x11_read_data(Context *c, sd_bus_message *m) {
                 c->x11_cache = sd_bus_message_ref(m);
         }

-        if (stat("/etc/X11/xorg.conf.d/00-keyboard.conf", &st) < 0) {
-                if (errno != ENOENT)
-                        return -errno;
-
-                c->x11_mtime = USEC_INFINITY;
-                context_free_x11(c);
-                return 0;
-        }
-
-        /* If mtime is not changed, then we do not need to re-read */
-        t = timespec_load(&st.st_mtim);
-        if (c->x11_mtime != USEC_INFINITY && t == c->x11_mtime)
-                return 0;
-
-        c->x11_mtime = t;
+        c->x11_mtime = 0;
         context_free_x11(c);

-        f = fopen("/etc/X11/xorg.conf.d/00-keyboard.conf", "re");
-        if (!f)
-                return -errno;
-
-        for (;;) {
-                _cleanup_free_ char *line = NULL;
-                char *l;
-
-                r = read_line(f, LONG_LINE_MAX, &line);
-                if (r < 0)
-                        return r;
-                if (r == 0)
-                        break;
-
-                l = strstrip(line);
-                if (IN_SET(l[0], 0, '#'))
-                        continue;
-
-                if (in_section && first_word(l, "Option")) {
-                        _cleanup_strv_free_ char **a = NULL;
-
-                        r = strv_split_extract(&a, l, WHITESPACE, EXTRACT_QUOTES);
-                        if (r < 0)
-                                return r;
-
-                        if (strv_length(a) == 3) {
-                                char **p = NULL;
-
-                                if (streq(a[1], "XkbLayout"))
-                                        p = &c->x11_layout;
-                                else if (streq(a[1], "XkbModel"))
-                                        p = &c->x11_model;
-                                else if (streq(a[1], "XkbVariant"))
-                                        p = &c->x11_variant;
-                                else if (streq(a[1], "XkbOptions"))
-                                        p = &c->x11_options;
-
-                                if (p) {
-                                        free_and_replace(*p, a[2]);
-                                }
-                        }
-
-                } else if (!in_section && first_word(l, "Section")) {
-                        _cleanup_strv_free_ char **a = NULL;
-
-                        r = strv_split_extract(&a, l, WHITESPACE, EXTRACT_QUOTES);
-                        if (r < 0)
-                                return -ENOMEM;
-
-                        if (strv_length(a) == 2 && streq(a[1], "InputClass"))
-                                in_section = true;
-
-                } else if (in_section && first_word(l, "EndSection"))
-                        in_section = false;
-        }
+        c->x11_layout = getenv_strdup("GUIX_XKB_LAYOUT");
+        c->x11_model = getenv_strdup("GUIX_XKB_MODEL");
+        c->x11_variant = getenv_strdup("GUIX_XKB_VARIANT");
+        c->x11_options = getenv_strdup("GUIX_XKB_OPTIONS");

         return 0;
 }

 int locale_write_data(Context *c, char ***settings) {
-        _cleanup_strv_free_ char **l = NULL;
-        struct stat st;
-        int r, p;
-
-        /* Set values will be returned as strv in *settings on success. */
-
-        for (p = 0; p < _VARIABLE_LC_MAX; p++) {
-                _cleanup_free_ char *t = NULL;
-                char **u;
-                const char *name;
-
-                name = locale_variable_to_string(p);
-                assert(name);
-
-                if (isempty(c->locale[p]))
-                        continue;
-
-                if (asprintf(&t, "%s=%s", name, c->locale[p]) < 0)
-                        return -ENOMEM;
-
-                u = strv_env_set(l, t);
-                if (!u)
-                        return -ENOMEM;
-
-                strv_free_and_replace(l, u);
-        }
-
-        if (strv_isempty(l)) {
-                if (unlink("/etc/locale.conf") < 0)
-                        return errno == ENOENT ? 0 : -errno;
-
-                c->locale_mtime = USEC_INFINITY;
-                return 0;
-        }
-
-        r = write_env_file_label("/etc/locale.conf", l);
-        if (r < 0)
-                return r;
-
-        *settings = TAKE_PTR(l);
-
-        if (stat("/etc/locale.conf", &st) >= 0)
-                c->locale_mtime = timespec_load(&st.st_mtim);
-
-        return 0;
+        return -ENOSYS;
 }

 int vconsole_write_data(Context *c) {
-        _cleanup_strv_free_ char **l = NULL;
-        struct stat st;
-        int r;
-
-        r = load_env_file(NULL, "/etc/vconsole.conf", &l);
-        if (r < 0 && r != -ENOENT)
-                return r;
-
-        if (isempty(c->vc_keymap))
-                l = strv_env_unset(l, "KEYMAP");
-        else {
-                _cleanup_free_ char *s = NULL;
-                char **u;
-
-                s = strappend("KEYMAP=", c->vc_keymap);
-                if (!s)
-                        return -ENOMEM;
-
-                u = strv_env_set(l, s);
-                if (!u)
-                        return -ENOMEM;
-
-                strv_free_and_replace(l, u);
-        }
-
-        if (isempty(c->vc_keymap_toggle))
-                l = strv_env_unset(l, "KEYMAP_TOGGLE");
-        else  {
-                _cleanup_free_ char *s = NULL;
-                char **u;
-
-                s = strappend("KEYMAP_TOGGLE=", c->vc_keymap_toggle);
-                if (!s)
-                        return -ENOMEM;
-
-                u = strv_env_set(l, s);
-                if (!u)
-                        return -ENOMEM;
-
-                strv_free_and_replace(l, u);
-        }
-
-        if (strv_isempty(l)) {
-                if (unlink("/etc/vconsole.conf") < 0)
-                        return errno == ENOENT ? 0 : -errno;
-
-                c->vc_mtime = USEC_INFINITY;
-                return 0;
-        }
-
-        r = write_env_file_label("/etc/vconsole.conf", l);
-        if (r < 0)
-                return r;
-
-        if (stat("/etc/vconsole.conf", &st) >= 0)
-                c->vc_mtime = timespec_load(&st.st_mtim);
-
-        return 0;
+        return -ENOSYS;
 }

 int x11_write_data(Context *c) {
-        _cleanup_fclose_ FILE *f = NULL;
-        _cleanup_free_ char *temp_path = NULL;
-        struct stat st;
-        int r;
-
-        if (isempty(c->x11_layout) &&
-            isempty(c->x11_model) &&
-            isempty(c->x11_variant) &&
-            isempty(c->x11_options)) {
-
-                if (unlink("/etc/X11/xorg.conf.d/00-keyboard.conf") < 0)
-                        return errno == ENOENT ? 0 : -errno;
-
-                c->vc_mtime = USEC_INFINITY;
-                return 0;
-        }
-
-        mkdir_p_label("/etc/X11/xorg.conf.d", 0755);
-
-        r = fopen_temporary("/etc/X11/xorg.conf.d/00-keyboard.conf", &f, &temp_path);
-        if (r < 0)
-                return r;
-
-        (void) __fsetlocking(f, FSETLOCKING_BYCALLER);
-        (void) fchmod(fileno(f), 0644);
-
-        fputs("# Written by systemd-localed(8), read by systemd-localed and Xorg. It's\n"
-              "# probably wise not to edit this file manually. Use localectl(1) to\n"
-              "# instruct systemd-localed to update it.\n"
-              "Section \"InputClass\"\n"
-              "        Identifier \"system-keyboard\"\n"
-              "        MatchIsKeyboard \"on\"\n", f);
-
-        if (!isempty(c->x11_layout))
-                fprintf(f, "        Option \"XkbLayout\" \"%s\"\n", c->x11_layout);
-
-        if (!isempty(c->x11_model))
-                fprintf(f, "        Option \"XkbModel\" \"%s\"\n", c->x11_model);
-
-        if (!isempty(c->x11_variant))
-                fprintf(f, "        Option \"XkbVariant\" \"%s\"\n", c->x11_variant);
-
-        if (!isempty(c->x11_options))
-                fprintf(f, "        Option \"XkbOptions\" \"%s\"\n", c->x11_options);
-
-        fputs("EndSection\n", f);
-
-        r = fflush_sync_and_check(f);
-        if (r < 0)
-                goto fail;
-
-        if (rename(temp_path, "/etc/X11/xorg.conf.d/00-keyboard.conf") < 0) {
-                r = -errno;
-                goto fail;
-        }
-
-        if (stat("/etc/X11/xorg.conf.d/00-keyboard.conf", &st) >= 0)
-                c->x11_mtime = timespec_load(&st.st_mtim);
-
-        return 0;
-
-fail:
-        if (temp_path)
-                (void) unlink(temp_path);
-
-        return r;
+        return -ENOSYS;
 }

 static int read_next_mapping(const char* filename,


code:
Patch taken from the Sage packaging system.

From 4a5e1c8c3c11efdb1cbb4239825a6bf4bf1c52f8 Mon Sep 17 00:00:00 2001
From: Anders Skovsted Buch <asbuch@math.rutgers.edu>
Date: Sun, 29 Nov 2015 16:25:56 -0500
Subject: [PATCH] Patch by Jeroen Demeyer to change include <vector.h> to
 "vector.h", plus similar cases.

---
 src/lrcalc.c   | 2 +-
 src/maple.c    | 4 ++--
 src/schublib.h | 2 +-
 src/symfcn.c   | 6 +++---
 src/symfcn.h   | 4 ++--
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/lrcalc.c b/src/lrcalc.c
index aff3f75..60df49e 100644
--- a/src/lrcalc.c
+++ b/src/lrcalc.c
@@ -8,7 +8,7 @@
 #include <stdlib.h>
 extern char *optarg;

-#include <vectarg.h>
+#include "vectarg.h"

 #include "symfcn.h"
 #include "maple.h"
diff --git a/src/maple.c b/src/maple.c
index fdc0768..a5f4d14 100644
--- a/src/maple.c
+++ b/src/maple.c
@@ -4,8 +4,8 @@
  */

 #include <stdio.h>
-#include <vector.h>
-#include <hashtab.h>
+#include "vector.h"
+#include "hashtab.h"
 #include "maple.h"

diff --git a/src/schublib.h b/src/schublib.h
index a8e8511..864850c 100644
--- a/src/schublib.h
+++ b/src/schublib.h
@@ -1,7 +1,7 @@
 #ifndef _SCHUBLIB_H
 #define _SCHUBLIB_H

-#include <hashtab.h>
+#include "hashtab.h"

 hashtab *trans(vector *w, int vars, hashtab *res);
 hashtab *monk(int i, hashtab *slc, int rank);
diff --git a/src/symfcn.c b/src/symfcn.c
index 4ffbe4b..fd5df5d 100644
--- a/src/symfcn.c
+++ b/src/symfcn.c
@@ -5,9 +5,9 @@

 #include <stdio.h>

-#include <alloc.h>
-#include <vector.h>
-#include <hashtab.h>
+#include "alloc.h"
+#include "vector.h"
+#include "hashtab.h"

 #include "symfcn.h"

diff --git a/src/symfcn.h b/src/symfcn.h
index b8543b1..29bb00d 100644
--- a/src/symfcn.h
+++ b/src/symfcn.h
@@ -1,8 +1,8 @@
 #ifndef _SYMFCN_H
 #define _SYMFCN_H

-#include <hashtab.h>
-#include <vector.h>
+#include "hashtab.h"
+#include "vector.h"

 int part_itr_sz(vector *part);
 int part_itr_sub(vector *part, vector *outer);
--
2.1.1.1.g1fb337f


code:
From 38386bd482c0a8102a79958cb3eddcb97a167ca3 Mon Sep 17 00:00:00 2001
From: Con Kolivas <kernel@kolivas.org>
Date: Fri, 9 Mar 2018 17:39:40 +1100
Subject: [PATCH] CVE-2017-8842 Fix divide-by-zero in bufRead::get

---
 libzpaq/libzpaq.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libzpaq/libzpaq.h b/libzpaq/libzpaq.h
index 93387da..cbe211d 100644
--- a/libzpaq/libzpaq.h
+++ b/libzpaq/libzpaq.h
@@ -465,7 +465,8 @@ struct bufRead: public libzpaq::Reader {

 	int get() {
 		if (progress && !(*s_len % 128)) {
-			int pct = (total_len - *s_len) * 100 / total_len;
+			int pct = (total_len > 0) ?
+				(total_len - *s_len) * 100 / total_len : 100;

 			if (pct / 10 != *last_pct / 10) {
 				int i;


code:
From: Enrico Tassi <gareuselesinge@debian.org>
Date: Tue, 26 Aug 2014 16:20:55 +0200
Subject: Fix stack overflow in vararg functions

---
 src/ldo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ldo.c b/src/ldo.c
index d1bf786..30333bf 100644
--- a/src/ldo.c
+++ b/src/ldo.c
@@ -274,7 +274,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
     CallInfo *ci;
     StkId st, base;
     Proto *p = cl->p;
-    luaD_checkstack(L, p->maxstacksize);
+    luaD_checkstack(L, p->maxstacksize + p->numparams);
     func = restorestack(L, funcr);
       base = func + 1;


code:
This applies to Lua 5.2 and 5.3.

From 7a1b4e0829124976878ca2765a8e546667a92ceb Mon Sep 17 00:00:00 2001
From: Leo Famulari <leo@famulari.name>
Date: Fri, 30 Oct 2015 19:11:31 -0400
Subject: [PATCH] apply existing non-executable library patch and install
 libraries as executable

---
 Makefile     | 6 +++---
 src/Makefile | 8 +++++++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 1aea8e6..bfcfed9 100644
--- a/Makefile
+++ b/Makefile
@@ -44,7 +44,7 @@ INTERPRETER= lua
 COMPILER= luac
 TO_BIN= $(INTERPRETER) $(COMPILER)
 TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
-TO_LIB= liblua.a
+TO_LIB= liblua.a liblua.so liblua.so.${V}
 TO_PC=  lua-$(V).pc
 TO_MAN= lua.1 luac.1

@@ -56,7 +56,7 @@ R= $V.3
 all:	$(PLAT)

 $(PLATS):
-	cd src && $(MAKE) $@
+	cd src && $(MAKE) $@ V=$(V) R=$(R)

 clean:
 	cd src && $(MAKE) $@
@@ -69,7 +69,7 @@ install: dummy $(TO_PC)
 	cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_PC) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
 	cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
 	cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
-	cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+	cd src && $(INSTALL_EXEC) $(TO_LIB) $(INSTALL_LIB)
 	cd src && $(INSTALL_DATA) ../$(TO_PC) $(INSTALL_PC)
 	cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)

diff --git a/src/Makefile b/src/Makefile
index 7b4b2b7..c86476e 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -29,6 +29,7 @@ MYOBJS=
 PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris

 LUA_A=	liblua.a
+LUA_SO= liblua.so
 CORE_O=	lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
 	lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
 	ltm.o lundump.o lvm.o lzio.o
@@ -43,7 +44,7 @@ LUAC_T=	luac
 LUAC_O=	luac.o

 ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
+ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
 ALL_A= $(LUA_A)

 # Targets start here.
@@ -55,6 +56,11 @@ o:	$(ALL_O)

 a:	$(ALL_A)

+$(LUA_SO): $(CORE_O) $(LIB_O)
+	$(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS)
+	ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V)
+	ln -sf $(LUA_SO).$(R) $(LUA_SO)
+
 $(LUA_A): $(BASE_O)
 	$(AR) $@ $(BASE_O)
 	$(RANLIB) $@
--
2.6.1


code:
Enables generating Lua's pkg-config file.

http://lua-users.org/lists/lua-l/2015-03/msg00338.html

--- a/Makefile	2014-10-30 00:14:41.000000000 +0100
+++ b/Makefile	2015-03-26 18:54:37.678374827 +0100
@@ -14,6 +14,7 @@
 INSTALL_BIN= $(INSTALL_TOP)/bin
 INSTALL_INC= $(INSTALL_TOP)/include
 INSTALL_LIB= $(INSTALL_TOP)/lib
+INSTALL_PC= $(INSTALL_LIB)/pkgconfig
 INSTALL_MAN= $(INSTALL_TOP)/man/man1
 INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
 INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
@@ -39,9 +40,12 @@
 PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris

 # What to install.
-TO_BIN= lua luac
+INTERPRETER= lua
+COMPILER= luac
+TO_BIN= $(INTERPRETER) $(COMPILER)
 TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
 TO_LIB= liblua.a
+TO_PC=  lua-$(V).pc
 TO_MAN= lua.1 luac.1

 # Lua version and release.
@@ -51,23 +55,29 @@
 # Targets start here.
 all:	$(PLAT)

-$(PLATS) clean:
+$(PLATS):
 	cd src && $(MAKE) $@

+clean:
+	cd src && $(MAKE) $@
+	$(RM) $(TO_PC)
+
 test:	dummy
 	src/lua -v

-install: dummy
-	cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
+install: dummy $(TO_PC)
+	cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_PC) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
 	cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
 	cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
 	cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+	cd src && $(INSTALL_DATA) ../$(TO_PC) $(INSTALL_PC)
 	cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)

 uninstall:
 	cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
 	cd src && cd $(INSTALL_INC) && $(RM) $(TO_INC)
 	cd src && cd $(INSTALL_LIB) && $(RM) $(TO_LIB)
+	cd src && cd $(INSTALL_PC)  && $(RM) $(TO_PC)
 	cd doc && cd $(INSTALL_MAN) && $(RM) $(TO_MAN)

 local:
@@ -90,11 +100,13 @@
 	@echo "TO_BIN= $(TO_BIN)"
 	@echo "TO_INC= $(TO_INC)"
 	@echo "TO_LIB= $(TO_LIB)"
+	@echo "TO_PC= $(TO_PC)"
 	@echo "TO_MAN= $(TO_MAN)"
 	@echo "INSTALL_TOP= $(INSTALL_TOP)"
 	@echo "INSTALL_BIN= $(INSTALL_BIN)"
 	@echo "INSTALL_INC= $(INSTALL_INC)"
 	@echo "INSTALL_LIB= $(INSTALL_LIB)"
+	@echo "INSTALL_PC= $(INSTALL_PC)"
 	@echo "INSTALL_MAN= $(INSTALL_MAN)"
 	@echo "INSTALL_LMOD= $(INSTALL_LMOD)"
 	@echo "INSTALL_CMOD= $(INSTALL_CMOD)"
@@ -103,12 +115,28 @@

 # echo pkg-config data
 pc:
-	@echo "version=$R"
-	@echo "prefix=$(INSTALL_TOP)"
-	@echo "libdir=$(INSTALL_LIB)"
-	@echo "includedir=$(INSTALL_INC)"
+	@echo 'prefix=$(INSTALL_TOP)'
+	@echo 'libdir=$(INSTALL_LIB)'
+	@echo 'includedir=$(INSTALL_INC)'
+	@echo 'bindir=$(INSTALL_BIN)'
+	@echo
+	@echo 'INSTALL_LMOD=$(INSTALL_LMOD)'
+	@echo 'INSTALL_CMOD=$(INSTALL_CMOD)'
+	@echo 'INTERPRETER=$${bindir}/$(INTERPRETER)'
+	@echo 'COMPILER=$${bindir}/$(COMPILER)'
+	@echo
+	@echo 'Name: Lua'
+	@echo 'Description: A powerful, fast, lightweight, embeddable scripting language'
+	@echo 'Version: $(R)'
+	@echo
+	@echo 'Libs: -L$${libdir} -llua -lm'
+	@echo 'Cflags: -I$${includedir}'
+
+pkg-config: $(TO_PC)
+$(TO_PC):
+	@$(MAKE) -s pc > $@

 # list targets that do not create files (but not all makes understand .PHONY)
-.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho
+.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho pkg-config

 # (end of Makefile)


code:
Patch the two Makefile to also create liblua.so
Original patch by Allan McRae <allan@archlinux.org>
for Archlinux

diff -ruN lua-5.1.5/Makefile lua-5.1.5-new/Makefile
--- lua-5.1.5/Makefile	2012-02-10 10:50:23.000000000 +0100
+++ lua-5.1.5-new/Makefile	2014-09-10 20:17:28.913951433 +0200
@@ -43,7 +43,7 @@
 # What to install.
 TO_BIN= lua luac
 TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
-TO_LIB= liblua.a
+TO_LIB= liblua.a liblua.so liblua.so.${V}
 TO_MAN= lua.1 luac.1

 # Lua version and release.
@@ -53,7 +53,7 @@
 all:	$(PLAT)

 $(PLATS) clean:
-	cd src && $(MAKE) $@
+	cd src && $(MAKE) $@ V=$(V) R=$(R)

 test:	dummy
 	src/lua test/hello.lua
diff -ruN lua-5.1.5/src/Makefile lua-5.1.5-new/src/Makefile
--- lua-5.1.5/src/Makefile	2012-02-13 21:41:22.000000000 +0100
+++ lua-5.1.5-new/src/Makefile	2014-09-10 20:16:09.982952152 +0200
@@ -8,7 +8,7 @@
 PLAT= none

 CC= gcc
-CFLAGS= -O2 -Wall $(MYCFLAGS)
+CFLAGS= -O2 -Wall $(MYCFLAGS) -fPIC
 AR= ar rcu
 RANLIB= ranlib
 RM= rm -f
@@ -34,9 +34,10 @@

 LUAC_T=	luac
 LUAC_O=	luac.o print.o
+LUA_SO= liblua.so

 ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
+ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
 ALL_A= $(LUA_A)

 default: $(PLAT)
@@ -57,6 +58,13 @@
 $(LUAC_T): $(LUAC_O) $(LUA_A)
 	$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)

+$(LUA_SO): $(CORE_O) $(LIB_O)
+	$(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS)
+	ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V)
+	ln -sf $(LUA_SO).$(R) $(LUA_SO)
+
+
+
 clean:
 	$(RM) $(ALL_T) $(ALL_O)


code:
Enables generating Lua's pkg-config file.

http://lua-users.org/lists/lua-l/2015-03/msg00338.html

--- a/Makefile	2016-08-16 19:44:27.363614964 +0200
+++ b/Makefile	2016-08-16 19:49:22.623070005 +0200
@@ -13,6 +13,7 @@
 INSTALL_BIN= $(INSTALL_TOP)/bin
 INSTALL_INC= $(INSTALL_TOP)/include
 INSTALL_LIB= $(INSTALL_TOP)/lib
+INSTALL_PC= $(INSTALL_LIB)/pkgconfig
 INSTALL_MAN= $(INSTALL_TOP)/man/man1
 #
 # You probably want to make INSTALL_LMOD and INSTALL_CMOD consistent with
@@ -41,9 +42,12 @@
 PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris

 # What to install.
-TO_BIN= lua luac
+INTERPRETER= lua
+COMPILER= luac
+TO_BIN= $(INTERPRETER) $(COMPILER)
 TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
 TO_LIB= liblua.a liblua.so liblua.so.${V}
+TO_PC= lua-$(V).pc
 TO_MAN= lua.1 luac.1

 # Lua version and release.
@@ -52,17 +56,22 @@

 all:	$(PLAT)

-$(PLATS) clean:
+$(PLATS):
 	cd src && $(MAKE) $@ V=$(V) R=$(R)

+clean:
+	cd src && $(MAKE) $@
+	$(RM) $(TO_PC)
+
 test:	dummy
 	src/lua test/hello.lua

-install: dummy
-	cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
+install: dummy $(TO_PC)
+	cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_PC) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
 	cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
 	cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
 	cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+	cd src && $(INSTALL_DATA) ../$(TO_PC) $(INSTALL_PC)
 	cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)

 ranlib:
@@ -95,6 +104,7 @@
 	@echo "INSTALL_BIN = $(INSTALL_BIN)"
 	@echo "INSTALL_INC = $(INSTALL_INC)"
 	@echo "INSTALL_LIB = $(INSTALL_LIB)"
+	@echo "INSTALL_PC = $(INSTALL_PC)"
 	@echo "INSTALL_MAN = $(INSTALL_MAN)"
 	@echo "INSTALL_LMOD = $(INSTALL_LMOD)"
 	@echo "INSTALL_CMOD = $(INSTALL_CMOD)"
@@ -111,6 +121,7 @@
 	@echo "TO_BIN = $(TO_BIN)"
 	@echo "TO_INC = $(TO_INC)"
 	@echo "TO_LIB = $(TO_LIB)"
+	@echo "TO_PC = $(TO_PC)"
 	@echo "TO_MAN = $(TO_MAN)"

 # echo config parameters as Lua code
@@ -122,7 +133,29 @@
 	@$(MAKE) echo | grep = | sed -e 's/= /= "/' -e 's/$$/"/' #-e 's/""/nil/'
 	@echo "-- EOF"

+pc:
+	@echo 'prefix=$(INSTALL_TOP)'
+	@echo 'libdir=$(INSTALL_LIB)'
+	@echo 'includedir=$(INSTALL_INC)'
+	@echo 'bindir=$(INSTALL_BIN)'
+	@echo
+	@echo 'INSTALL_LMOD=$(INSTALL_LMOD)'
+	@echo 'INSTALL_CMOD=$(INSTALL_CMOD)'
+	@echo 'INTERPRETER=$${bindir}/$(INTERPRETER)'
+	@echo 'COMPILER=$${bindir}/$(COMPILER)'
+	@echo
+	@echo 'Name: Lua'
+	@echo 'Description: A powerful, fast, lightweight, embeddable scripting language'
+	@echo 'Version: $(R)'
+	@echo
+	@echo 'Libs: -L$${libdir} -llua -lm'
+	@echo 'Cflags: -I$${includedir}'
+
+pkg-config: $(TO_PC)
+$(TO_PC):
+	@$(MAKE) -s pc > $@
+
 # list targets that do not create files (but not all makes understand .PHONY)
-.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho
+.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho pkg-config

 # (end of Makefile)


code:
From 629200f48e18dc1a3a5229739748bad0e2a6a0a2 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Tom=C3=A1=C5=A1=20=C4=8Cech?= <sleep_walker@suse.cz>
Date: Wed, 4 Feb 2015 11:37:16 +0100
Subject: [PATCH] Do not silently and prematurely end install when ldconfig is
 missing

---
 Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 343ecb5..4667146 100644
--- a/Makefile
+++ b/Makefile
@@ -112,9 +112,10 @@ install: $(INSTALL_DEP)
 	$(RM) $(INSTALL_TSYM) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2)
 	cd src && test -f $(FILE_SO) && \
 	  $(INSTALL_X) $(FILE_SO) $(INSTALL_DYN) && \
-	  $(LDCONFIG) $(INSTALL_LIB) && \
-	  $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT1) && \
-	  $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT2) || :
+	  ( $(LDCONFIG) $(INSTALL_LIB) ; \
+	    $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT1) && \
+	    $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT2) || : \
+	  )
 	cd etc && $(INSTALL_F) $(FILE_MAN) $(INSTALL_MAN)
 	cd etc && $(SED_PC) $(FILE_PC) > $(FILE_PC).tmp && \
 	  $(INSTALL_F) $(FILE_PC).tmp $(INSTALL_PC) && \
--
2.2.2


code:
See https://bugs.freedesktop.org/show_bug.cgi?id=47792;
should become obsolete with the next release.

diff -u luit-1.1.1.orig/sys.c luit-1.1.1/sys.c
--- luit-1.1.1.orig/sys.c	2012-03-23 05:23:07.000000000 +0100
+++ luit-1.1.1/sys.c	2013-11-27 22:45:53.000000000 +0100
@@ -20,6 +20,8 @@
 THE SOFTWARE.
 */

+#define _XOPEN_SOURCE 600
+
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif


code:
Fix static linking of 'lvm.static', which indirectly depend on libpthread
and libm via libdevmapper.a.

--- LVM2.2.02.166/tools/Makefile.in	2016-11-22 21:31:15.521045149 +0100
+++ LVM2.2.02.166/tools/Makefile.in	2016-11-22 21:31:24.085082767 +0100
@@ -137,7 +137,7 @@
 lvm.static: $(OBJECTS) lvm-static.o $(LVMINTERNAL_LIBS)
 	@echo "    [CC] $@"
 	$(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ $+ \
-	      $(DMEVENT_LIBS) $(STATIC_LIBS) $(LVMLIBS)
+	      $(DMEVENT_LIBS) $(STATIC_LIBS) $(LVMLIBS) $(PTHREAD_LIBS)

 liblvm2cmd.a: $(top_builddir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o
 	@echo "    [AR] $@"
--- a/make.tmpl.in     2018-07-31 22:00:39.969983104 +0200
+++ b/make.tmpl.in     2018-07-31 22:00:58.467613682 +0200
@@ -63,7 +63,7 @@

 LIBS += @LIBS@ $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) $(RT_LIBS) $(M_LIBS)
 # Extra libraries always linked with static binaries
-STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS)
+STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) $(M_LIBS)
 DEFS += @DEFS@
 # FIXME set this only where it's needed, not globally?
 CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@
--- a/libdm/make.tmpl.in	2018-12-18 15:22:34.000000000 +0100
+++ b/libdm/make.tmpl.in	2019-01-29 21:45:33.637345799 +0100
@@ -57,7 +57,7 @@
 LIBS = @LIBS@
 LIBS += $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) $(RT_LIBS) -lm
 # Extra libraries always linked with static binaries
-STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS)
+STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) $(PTHREAD_LIBS) $(M_LIBS)
 DEFS += @DEFS@
 # FIXME set this only where it's needed, not globally?
 CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@