summaryrefslogtreecommitdiffstats
path: root/desktop/compton
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/compton')
-rw-r--r--desktop/compton/compton.SlackBuild26
-rw-r--r--desktop/compton/compton.info10
-rw-r--r--desktop/compton/meson.build2
-rw-r--r--desktop/compton/test.h158
4 files changed, 181 insertions, 15 deletions
diff --git a/desktop/compton/compton.SlackBuild b/desktop/compton/compton.SlackBuild
index a72d5cb66e..f9133cac40 100644
--- a/desktop/compton/compton.SlackBuild
+++ b/desktop/compton/compton.SlackBuild
@@ -22,7 +22,7 @@
# not, see <http://www.gnu.org/licenses/>.
PRGNAM="compton"
-VERSION=${VERSION:-316eac0613bf342ff91cc645a6c3c80e6b9083fb}
+VERSION=${VERSION:-7.2}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@@ -58,9 +58,9 @@ set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
-rm -rf $PRGNAM-${VERSION}
-tar xvf $CWD/$PRGNAM-${VERSION}.tar.gz || exit 1
-cd ${PRGNAM}-${VERSION}
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.?z*
+cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
@@ -68,19 +68,25 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
-make || exit 1
-make install DESTDIR=$PKG
+sed -i "s|'no-unknown-warning-option',\ ||" meson.build
+cp $CWD/meson.build $CWD/test.h subprojects/test.h/
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+meson build . -D build_docs=true -D b_ndebug=true --prefix=/usr
+DESTDIR=$PKG ninja -C build install
+
+mv $PKG/usr/share/man $PKG/usr/man
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
-mv $PKG/usr/share/man $PKG/usr/man
-find $PKG/usr/man -type f -exec gzip -9 {} \;
-for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+install -D -m 0644 $PRGNAM.desktop $PKG/usr/share/applications/$PRGNAM.desktop
+install -D -m 0644 $PRGNAM.sample.conf $PKG/etc/$PRGNAM.conf
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -ar \
- desc.txt dbus-examples compton.sample.conf LICENSE \
+ desc.txt dbus-examples compton.sample.conf COPYING LICENSES \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
diff --git a/desktop/compton/compton.info b/desktop/compton/compton.info
index dd49ce713e..334932e1ce 100644
--- a/desktop/compton/compton.info
+++ b/desktop/compton/compton.info
@@ -1,10 +1,10 @@
PRGNAM="compton"
-VERSION="316eac0613bf342ff91cc645a6c3c80e6b9083fb"
-HOMEPAGE="https://github.com/chjj/compton"
-DOWNLOAD="https://github.com/chjj/compton/archive/316eac0/compton-316eac0613bf342ff91cc645a6c3c80e6b9083fb.tar.gz"
-MD5SUM="eb3fddcd691af8239b3ab56bf89e038c"
+VERSION="7.2"
+HOMEPAGE="https://github.com/yshui/compton/"
+DOWNLOAD="https://github.com/yshui/compton/archive/v7.2/compton-7.2.tar.gz"
+MD5SUM="91e9aa659dfaa17ccd5653a2c0c5707f"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
-REQUIRES="libconfig"
+REQUIRES="libconfig libev libxdg-basedir setconf uthash"
MAINTAINER="melikamp"
EMAIL="melikamp@melikamp.net"
diff --git a/desktop/compton/meson.build b/desktop/compton/meson.build
new file mode 100644
index 0000000000..042e5d5dd2
--- /dev/null
+++ b/desktop/compton/meson.build
@@ -0,0 +1,2 @@
+project('test.h', 'c')
+test_h_dep = declare_dependency(include_directories: include_directories('.'))
diff --git a/desktop/compton/test.h b/desktop/compton/test.h
new file mode 100644
index 0000000000..46ceda4ee5
--- /dev/null
+++ b/desktop/compton/test.h
@@ -0,0 +1,158 @@
+// SPDX-License-Identifier: MIT
+#pragma once
+
+#ifdef UNIT_TEST
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+struct test_file_metadata;
+
+struct test_failure {
+ bool present;
+ const char *message;
+ const char *file;
+ int line;
+};
+
+struct test_case_metadata {
+ void (*fn)(struct test_case_metadata *, struct test_file_metadata *);
+ struct test_failure failure;
+ const char *name;
+ struct test_case_metadata *next;
+};
+
+struct test_file_metadata {
+ bool registered;
+ const char *name;
+ struct test_file_metadata *next;
+ struct test_case_metadata *tests;
+};
+
+struct test_file_metadata __attribute__((weak)) * test_file_head;
+
+#define SET_FAILURE(_message) \
+ metadata->failure = (struct test_failure) { \
+ .message = _message, .file = __FILE__, .line = __LINE__, \
+ .present = true, \
+ }
+
+#define TEST_EQUAL(a, b) \
+ do { \
+ if ((a) != (b)) { \
+ SET_FAILURE(#a " != " #b); \
+ return; \
+ } \
+ } while (0)
+
+#define TEST_TRUE(a) \
+ do { \
+ if (!(a)) { \
+ SET_FAILURE(#a " is not true"); \
+ return; \
+ } \
+ } while (0)
+
+#define TEST_STREQUAL(a, b) \
+ do { \
+ if (strcmp(a, b) != 0) { \
+ SET_FAILURE(#a " != " #b); \
+ return; \
+ } \
+ } while (0)
+
+#define TEST_CASE(_name) \
+ static void __test_h_##_name(struct test_case_metadata *, \
+ struct test_file_metadata *); \
+ static struct test_file_metadata __test_h_file; \
+ static struct test_case_metadata __test_h_meta_##_name = { \
+ .name = #_name, \
+ .fn = __test_h_##_name, \
+ }; \
+ static void __attribute__((constructor(101))) \
+ __test_h_##_name##_register(void) { \
+ __test_h_meta_##_name.next = __test_h_file.tests; \
+ __test_h_file.tests = &__test_h_meta_##_name; \
+ if (!__test_h_file.registered) { \
+ __test_h_file.name = __FILE__; \
+ __test_h_file.next = test_file_head; \
+ test_file_head = &__test_h_file; \
+ __test_h_file.registered = true; \
+ } \
+ } \
+ static void __test_h_##_name( \
+ struct test_case_metadata *metadata __attribute__((unused)), \
+ struct test_file_metadata *file_metadata __attribute__((unused)))
+
+extern void __attribute__((weak)) (*test_h_unittest_setup)(void);
+/// Run defined tests, return true if all tests succeeds
+/// @param[out] tests_run if not NULL, set to whether tests were run
+static inline void __attribute__((constructor(102))) run_tests(void) {
+ bool should_run = false;
+ FILE *cmdlinef = fopen("/proc/self/cmdline", "r");
+ char *arg = NULL;
+ int arglen;
+ fscanf(cmdlinef, "%ms%n", &arg, &arglen);
+ fclose(cmdlinef);
+ for (char *pos = arg; pos < arg + arglen; pos += strlen(pos) + 1) {
+ if (strcmp(pos, "--unittest") == 0) {
+ should_run = true;
+ break;
+ }
+ }
+ free(arg);
+
+ if (!should_run) {
+ return;
+ }
+
+ if (&test_h_unittest_setup) {
+ test_h_unittest_setup();
+ }
+
+ struct test_file_metadata *i = test_file_head;
+ int failed = 0, success = 0;
+ while (i) {
+ fprintf(stderr, "Running tests from %s:\n", i->name);
+ struct test_case_metadata *j = i->tests;
+ while (j) {
+ fprintf(stderr, "\t%s ... ", j->name);
+ j->failure.present = false;
+ j->fn(j, i);
+ if (j->failure.present) {
+ fprintf(stderr, "failed (%s at %s:%d)\n",
+ j->failure.message, j->failure.file,
+ j->failure.line);
+ failed++;
+ } else {
+ fprintf(stderr, "passed\n");
+ success++;
+ }
+ j = j->next;
+ }
+ fprintf(stderr, "\n");
+ i = i->next;
+ }
+ int total = failed + success;
+ fprintf(stderr, "Test results: passed %d/%d, failed %d/%d\n", success, total,
+ failed, total);
+ exit(failed == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
+}
+
+#else
+
+#include <stdbool.h>
+
+#define TEST_CASE(name) static void __attribute__((unused)) __test_h_##name(void)
+
+#define TEST_EQUAL(a, b) \
+ (void)(a); \
+ (void)(b)
+#define TEST_TRUE(a) (void)(a)
+#define TEST_STREQUAL(a, b) \
+ (void)(a); \
+ (void)(b)
+
+#endif