From 96765f40426e6aad610a652d8d7bfb92665f7cf1 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sun, 5 Jun 2022 22:23:56 -0500 Subject: user/xsettingsd: New package --- user/xsettingsd/APKBUILD | 41 ++++++++++++++++++++++++ user/xsettingsd/endian.patch | 76 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 user/xsettingsd/APKBUILD create mode 100644 user/xsettingsd/endian.patch diff --git a/user/xsettingsd/APKBUILD b/user/xsettingsd/APKBUILD new file mode 100644 index 000000000..77bf659cd --- /dev/null +++ b/user/xsettingsd/APKBUILD @@ -0,0 +1,41 @@ +# Maintainer: A. Wilcox +pkgname=xsettingsd +pkgver=1.0.2 +pkgrel=0 +pkgdesc="Small, fast XSETTINGS daemon implementation" +url="https://github.com/derat/xsettingsd/wiki" +arch="all" +license="BSD-3-Clause" +depends="" +checkdepends="gtest gtest-dev" +makedepends="cmake libx11-dev" +subpackages="$pkgname-doc" +source="xsettingsd-$pkgver.tar.gz::https://github.com/derat/xsettingsd/archive/refs/tags/v$pkgver.tar.gz + endian.patch + " + +build() { + if [ "$CBUILD" != "$CHOST" ]; then + CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux" + fi + cmake \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DBUILD_SHARED_LIBS=True \ + -DCMAKE_BUILD_TYPE=RelWithDebugInfo \ + -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ + ${CMAKE_CROSSOPTS} \ + . + make +} + +check() { + CTEST_OUTPUT_ON_FAILURE=TRUE ctest +} + +package() { + make DESTDIR="$pkgdir" install +} + +sha512sums="da2a82d0b3f5061a1fad7632d800539f4e81bd3f8631dd724705d0601556c044c62da7469a974cbe8f6d8e070247493ac5776bac966cf36f1fae825562457baa xsettingsd-1.0.2.tar.gz +bfce6288d2c3f5a15a26f2de842b800317b15e2668f587bf05b72b7be62ccc5cf4cca28023db38aa8b1930d8410d9d7b2e1130e7d04333440ac4b64f6be7682f endian.patch" diff --git a/user/xsettingsd/endian.patch b/user/xsettingsd/endian.patch new file mode 100644 index 000000000..c5ac01b85 --- /dev/null +++ b/user/xsettingsd/endian.patch @@ -0,0 +1,76 @@ +--- xsettingsd-1.0.2/setting_test.cc.old 2021-01-08 12:00:13.000000000 -0600 ++++ xsettingsd-1.0.2/setting_test.cc 2022-06-05 22:19:35.511364966 -0500 +@@ -53,14 +53,20 @@ + IntegerSetting setting(5); + setting.UpdateSerial(NULL, 3); + ASSERT_TRUE(setting.Write("name", &writer)); +- // TODO: Won't work on big-endian systems. + const char expected[] = { + 0x0, // type + 0x0, // unused ++#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ++ 0x0, 0x4, // name-len ++ 0x6e, 0x61, 0x6d, 0x65, // "name" (multiple of 4, so no padding) ++ 0x0, 0x0, 0x0, 0x3, // serial ++ 0x0, 0x0, 0x0, 0x5, // value ++#else + 0x4, 0x0, // name-len + 0x6e, 0x61, 0x6d, 0x65, // "name" (multiple of 4, so no padding) + 0x3, 0x0, 0x0, 0x0, // serial + 0x5, 0x0, 0x0, 0x0, // value ++#endif + }; + ASSERT_EQ(sizeof(expected), writer.bytes_written()); + EXPECT_PRED_FORMAT3(BytesAreEqual, expected, buffer, sizeof(expected)); +@@ -74,15 +80,22 @@ + StringSetting setting("testing"); + setting.UpdateSerial(NULL, 5); + ASSERT_TRUE(setting.Write("setting", &writer)); +- // TODO: Won't work on big-endian systems. + const char expected[] = { + 0x1, // type + 0x0, // unused ++#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ++ 0x0, 0x7, // name-len ++ 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, // "setting" (name) ++ 0x0, // padding ++ 0x0, 0x0, 0x0, 0x5, // serial ++ 0x0, 0x0, 0x0, 0x7, // value-len ++#else + 0x7, 0x0, // name-len + 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, // "setting" (name) + 0x0, // padding + 0x5, 0x0, 0x0, 0x0, // serial + 0x7, 0x0, 0x0, 0x0, // value-len ++#endif + 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, // "testing" (value) + 0x0, // padding + }; +@@ -98,10 +111,18 @@ + ColorSetting setting(32768, 65535, 0, 255); + setting.UpdateSerial(NULL, 2); + ASSERT_TRUE(setting.Write("name", &writer)); +- // TODO: Won't work on big-endian systems. + const char expected[] = { + 0x2, // type + 0x0, // unused ++#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ++ 0x0, 0x4, // name-len ++ 0x6e, 0x61, 0x6d, 0x65, // "name" (multiple of 4, so no padding) ++ 0x0, 0x0, 0x0, 0x2, // serial ++ 0x80, 0x0, // red ++ 0x0, 0x0, // blue (yes, the order is strange) ++ 0xff, 0xff, // green ++ 0x0, 0xff, // alpha ++#else + 0x4, 0x0, // name-len + 0x6e, 0x61, 0x6d, 0x65, // "name" (multiple of 4, so no padding) + 0x2, 0x0, 0x0, 0x0, // serial +@@ -109,6 +130,7 @@ + 0x0, 0x0, // blue (yes, the order is strange) + 0xff, 0xff, // green + 0xff, 0x0, // alpha ++#endif + }; + ASSERT_EQ(sizeof(expected), writer.bytes_written()); + EXPECT_PRED_FORMAT3(BytesAreEqual, expected, buffer, sizeof(expected)); -- cgit v1.2.3-70-g09d2