Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions srcpkgs/herbe/patches/Xresources.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
diff --git a/config.def.h b/config.def.h
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elaborate on reasoning about this patch or mention the source if any

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got the patch from here and it was convenient for me to add it so that users can modify the settings from the Xresources file and not compile it from source.

Copy link
Copy Markdown
Member

@Piraty Piraty Dec 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reference the origin of that patch in the patch header. nobody reads github. side-note: Void won't patch in random features that upstream doesn't want/reviewed

index 86b7e76..d545925 100644
--- a/config.def.h
+++ b/config.def.h
@@ -2,18 +2,18 @@ static const char *background_color = "#3e3e3e";
static const char *border_color = "#ececec";
static const char *font_color = "#ececec";
static const char *font_pattern = "monospace:size=10";
-static const unsigned line_spacing = 5;
-static const unsigned int padding = 15;
+static unsigned line_spacing = 5;
+static unsigned int padding = 15;

-static const unsigned int width = 450;
-static const unsigned int border_size = 2;
-static const unsigned int pos_x = 30;
-static const unsigned int pos_y = 60;
+static unsigned int width = 450;
+static unsigned int border_size = 2;
+static unsigned int pos_x = 30;
+static unsigned int pos_y = 60;

enum corners { TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT };
enum corners corner = TOP_RIGHT;

-static const unsigned int duration = 5; /* in seconds */
+static unsigned int duration = 5; /* in seconds */

#define DISMISS_BUTTON Button1
#define ACTION_BUTTON Button3
diff --git a/herbe.c b/herbe.c
index 51d3990..574e967 100644
--- a/herbe.c
+++ b/herbe.c
@@ -1,5 +1,6 @@
#include <X11/Xlib.h>
#include <X11/Xft/Xft.h>
+#include <X11/Xresource.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
@@ -15,6 +16,13 @@
#define EXIT_FAIL 1
#define EXIT_DISMISS 2

+#define XRES_STR(name) \
+ if (XrmGetResource(db, "herbe." #name, "*", &type, &val)) \
+ name = val.addr
+#define XRES_INT(name) \
+ if (XrmGetResource(db, "herbe." #name, "*", &type, &val)) \
+ name = strtoul(val.addr, 0, 10)
+
Display *display;
Window window;
int exit_code = EXIT_DISMISS;
@@ -107,6 +115,28 @@ int main(int argc, char *argv[])
if (!(display = XOpenDisplay(0)))
die("Cannot open display");

+ XrmInitialize();
+
+ char *res_man = XResourceManagerString(display);
+ XrmDatabase db = XrmGetStringDatabase(res_man);
+
+ char *type;
+ XrmValue val;
+
+ XRES_STR(background_color);
+ XRES_STR(border_color);
+ XRES_STR(font_color);
+ XRES_STR(font_pattern);
+
+ XRES_INT(line_spacing);
+ XRES_INT(padding);
+ XRES_INT(width);
+ XRES_INT(border_size);
+ XRES_INT(pos_x);
+ XRES_INT(pos_y);
+ XRES_INT(corner);
+ XRES_INT(duration);
+
int screen = DefaultScreen(display);
Visual *visual = DefaultVisual(display, screen);
Colormap colormap = DefaultColormap(display, screen);
@@ -214,7 +244,8 @@ int main(int argc, char *argv[])
XftDrawDestroy(draw);
XftColorFree(display, visual, colormap, &color);
XftFontClose(display, font);
+ XrmDestroyDatabase(db);
XCloseDisplay(display);

return exit_code;
-}
\ No newline at end of file
+}
21 changes: 21 additions & 0 deletions srcpkgs/herbe/template
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Template file for 'herbe'
pkgname=herbe
version=1.0.0
revision=1
build_style=gnu-makefile
makedepends="libXft-devel freetype-devel"
short_desc="Daemon-less notifications without D-Bus. Minimal and lightweight"
maintainer="tuxliban <tenshalito@gmail.com>"
license="MIT"
homepage="https://github.com/dudik/herbe"
distfiles="${homepage}/archive/${version}.tar.gz"
checksum=78e454159050c86e030fb5a6cf997ac914345210cdf5a4ca4d7600c5296b7f76
patch_args="-Np1"

do_build() {
export CFLAGS=${CFLAGS}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this

  1. doesn't build anything and renders the package empty (except license)
  2. should not be necessary as CFLAGS is already in env

Copy link
Copy Markdown
Contributor Author

@tuxliban tuxliban Dec 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously I tried to build the binary directly with the help of the gnu-makefile build script, but despite having specified the makedepends in the middle of the process it gives me an error for missing a header.
The only way I was able to build the binary was as the template currently is.

-> $ ./xbps-src -f pkg herbe
=> xbps-src: updating repositories for host (x86_64-musl)...
[*] Updating repository `https://alpha.us.repo.voidlinux.org/current/musl/x86_64-musl-repodata' ...
[*] Updating repository `https://alpha.de.repo.voidlinux.org/current/musl/x86_64-musl-repodata' ...
[*] Updating repository `https://alpha.de.repo.voidlinux.org/current/musl/nonfree/x86_64-musl-repodata' ...
=> xbps-src: updating software in / masterdir...
=> xbps-src: cleaning up / masterdir...
=> herbe-1.0.0_1: removing autodeps, please wait...
=> herbe-1.0.0_1: building [gnu-makefile] for x86_64-musl...
   [target] libXft-devel-2.3.3_1: found (https://alpha.de.repo.voidlinux.org/current/musl)
   [target] freetype-devel-2.10.4_1: found (https://alpha.de.repo.voidlinux.org/current/musl)
=> herbe-1.0.0_1: installing target dependencies: libXft-devel-2.3.3_1 freetype-devel-2.10.4_1 ...
=> herbe-1.0.0_1: running do-fetch hook: 00-distfiles ...
=> herbe-1.0.0_1: running do-extract hook: 00-distfiles ...
=> herbe-1.0.0_1: extracting distfile(s), please wait...
=> herbe-1.0.0_1: running do-patch hook: 00-patches ...
=> herbe-1.0.0_1: patching: Xresources.diff.
=> herbe-1.0.0_1: running pre-configure hook: 00-gnu-configure-asneeded ...
=> herbe-1.0.0_1: running pre-configure hook: 01-override-config ...
=> herbe-1.0.0_1: running pre-configure hook: 02-script-wrapper ...
=> herbe-1.0.0_1: running pre-build hook: 02-script-wrapper ...
=> herbe-1.0.0_1: running do_build ...
cp config.def.h config.h
cc herbe.c -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -march=native -O2 -pipe    -o herbe
In file included from herbe.c:2:
/usr/include/X11/Xft/Xft.h:39:10: fatal error: ft2build.h: No such file or directory
   39 | #include <ft2build.h>
      |          ^~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:12: herbe] Error 1
=> ERROR: herbe-1.0.0_1: do_build: '${make_cmd} CC="$CC" CXX="$CXX" LD="$LD" AR="$AR" RANLIB="$RANLIB" CPP="$CPP" AS="$AS" OBJCOPY="$OBJCOPY" OBJDUMP="$OBJDUMP" CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" ${makejobs} ${make_build_args} ${make_build_target}' exited with 2
=> ERROR:   in do_build() at common/build-style/gnu-makefile.sh:9

It should also be said that the program does not have a user manual since its use is relatively very simple

Copy link
Copy Markdown
Member

@Piraty Piraty Dec 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as the template is now, the package just ships one file (the license).
the error indicates you're missing a package in makedepends (hint: it's freetype-devel. you can use xlocate from xtools to find files)

}

do_install() {
vlicense LICENSE
}