add the option to not include support for .Xresources in the build
This commit is contained in:
parent
dac2dddc57
commit
409fc8db5e
2
Makefile
2
Makefile
|
@ -7,7 +7,7 @@ include toggle.mk
|
|||
# spmenu version
|
||||
VERSION = 1.1
|
||||
|
||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XINERAMATOGGLE) $(BDTOGGLE) $(PANGOTOGGLE) $(IMLIB2TOGGLE) $(LIBCONFIGTOGGLE)
|
||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XINERAMATOGGLE) $(BDTOGGLE) $(PANGOTOGGLE) $(IMLIB2TOGGLE) $(LIBCONFIGTOGGLE) $(XRDBTOGGLE)
|
||||
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations $(OPT) $(INCS) $(CPPFLAGS)
|
||||
LDFLAGS = $(LIBS)
|
||||
INCS = -I$(X11INC) -I$(FREETYPEINC) -I$(BDINC) `pkg-config --cflags $(XFTCONF) $(PANGOCONF) $(PANGOXFTCONF) $(OPENSSLCONF) $(LIBCONFIGCONF)`
|
||||
|
|
8
build.sh
8
build.sh
|
@ -7,6 +7,7 @@ makebin="${makebin:-$(command -v make)}"
|
|||
cc="${cc:-${CC:-gcc}}"
|
||||
opt="${opt:-${OPT:--O2}}"
|
||||
warn="${warn:-true}"
|
||||
xresources=""
|
||||
|
||||
check_dist() {
|
||||
[ -f "/etc/pacman.conf" ] && [ "$warn" != "false" ] && printf "hint: detected Pacman. if you want you can run 'makepkg' with proper arguments to install it using pacman.\n" && pacman=true
|
||||
|
@ -98,6 +99,11 @@ build() {
|
|||
libconfigconf="libconfig"
|
||||
fi
|
||||
|
||||
# xresources
|
||||
if [ "$xresources" = "true" ]; then
|
||||
xrdbtoggle="-DXRESOURCES"
|
||||
fi
|
||||
|
||||
# fribidi
|
||||
if [ "$fribidi" = "true" ]; then
|
||||
bdlibs="-lfribidi"
|
||||
|
@ -131,6 +137,7 @@ build() {
|
|||
OPENSSLCONF="$opensslconf" \
|
||||
LIBCONFIGTOGGLE="$libconfigtoggle" \
|
||||
LIBCONFIGCONF="$libconfigconf" \
|
||||
XRDBTOGGLE="$xrdbtoggle" \
|
||||
X11LIB="$X11LIB" \
|
||||
X11INC="$X11INC"
|
||||
}
|
||||
|
@ -160,6 +167,7 @@ install() {
|
|||
OPENSSLCONF="$opensslconf" \
|
||||
LIBCONFIGTOGGLE="$libconfigtoggle" \
|
||||
LIBCONFIGCONF="$libconfigconf" \
|
||||
XRDBTOGGLE="$xrdbtoggle" \
|
||||
X11LIB="$X11LIB" \
|
||||
X11INC="$X11INC"
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ xinerama=true # enable multi monitor support
|
|||
openssl=true # enable support for openssl, used to calculate MD5
|
||||
fribidi=true # enable support for right to left languages
|
||||
libconfig=true # enable configuration and themes
|
||||
xresources=true # enable .Xresources support
|
||||
cc=gcc # compiler and linker
|
||||
opt=-O2 # level of optimization
|
||||
warn=true # warn about OS quirks
|
||||
|
|
|
@ -51,8 +51,12 @@ void readargs(int argc, char *argv[]) {
|
|||
|
||||
// init/read xrdb
|
||||
if (xresources) {
|
||||
#if USEXRESOURCES
|
||||
XrmInitialize();
|
||||
load_xresources();
|
||||
#else
|
||||
; // avoids a warning
|
||||
#endif
|
||||
}
|
||||
|
||||
// no arguments
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#if USEXRESOURCES
|
||||
void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst) {
|
||||
char *sdst = NULL;
|
||||
int *idst = NULL;
|
||||
|
@ -49,3 +50,4 @@ void load_xresources(void) {
|
|||
|
||||
XCloseDisplay(display);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#if USEXRESOURCES
|
||||
enum resource_type {
|
||||
STRING = 0,
|
||||
INTEGER = 1,
|
||||
|
@ -13,3 +14,4 @@ typedef struct {
|
|||
// declare functions
|
||||
static void load_xresources(void);
|
||||
static void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst);
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// This .Xresources array is read and compared to the xrdb. Simply add to the array if you need to.
|
||||
#if USEXRESOURCES
|
||||
ResourcePref resources[] = {
|
||||
{ "font", STRING, &font },
|
||||
{ "col_caretfg", STRING, &col_caretfg },
|
||||
|
@ -207,3 +208,4 @@ ResourcePref cols[] = {
|
|||
{ "color14", STRING, &col_sgr14 },
|
||||
{ "color15", STRING, &col_sgr15 },
|
||||
};
|
||||
#endif
|
||||
|
|
13
spmenu.c
13
spmenu.c
|
@ -57,6 +57,13 @@
|
|||
#define USECONFIG 1
|
||||
#endif
|
||||
|
||||
// check if we should enable .Xresources support
|
||||
#ifndef XRESOURCES
|
||||
#define USEXRESOURCES 0
|
||||
#else
|
||||
#define USEXRESOURCES 1
|
||||
#endif
|
||||
|
||||
// include fribidi used for right to left language support
|
||||
#if USERTL
|
||||
#include <fribidi.h>
|
||||
|
@ -83,9 +90,13 @@
|
|||
#include <X11/Xatom.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xresource.h>
|
||||
#include <X11/Xft/Xft.h>
|
||||
|
||||
// include xresources
|
||||
#if USEXRESOURCES
|
||||
#include <X11/Xresource.h>
|
||||
#endif
|
||||
|
||||
// include pango used for markup
|
||||
#if USEPANGO
|
||||
#include <pango/pango.h>
|
||||
|
|
Loading…
Reference in a new issue