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
|
# spmenu version
|
||||||
VERSION = 1.1
|
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)
|
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations $(OPT) $(INCS) $(CPPFLAGS)
|
||||||
LDFLAGS = $(LIBS)
|
LDFLAGS = $(LIBS)
|
||||||
INCS = -I$(X11INC) -I$(FREETYPEINC) -I$(BDINC) `pkg-config --cflags $(XFTCONF) $(PANGOCONF) $(PANGOXFTCONF) $(OPENSSLCONF) $(LIBCONFIGCONF)`
|
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}}"
|
cc="${cc:-${CC:-gcc}}"
|
||||||
opt="${opt:-${OPT:--O2}}"
|
opt="${opt:-${OPT:--O2}}"
|
||||||
warn="${warn:-true}"
|
warn="${warn:-true}"
|
||||||
|
xresources=""
|
||||||
|
|
||||||
check_dist() {
|
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
|
[ -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"
|
libconfigconf="libconfig"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# xresources
|
||||||
|
if [ "$xresources" = "true" ]; then
|
||||||
|
xrdbtoggle="-DXRESOURCES"
|
||||||
|
fi
|
||||||
|
|
||||||
# fribidi
|
# fribidi
|
||||||
if [ "$fribidi" = "true" ]; then
|
if [ "$fribidi" = "true" ]; then
|
||||||
bdlibs="-lfribidi"
|
bdlibs="-lfribidi"
|
||||||
|
@ -131,6 +137,7 @@ build() {
|
||||||
OPENSSLCONF="$opensslconf" \
|
OPENSSLCONF="$opensslconf" \
|
||||||
LIBCONFIGTOGGLE="$libconfigtoggle" \
|
LIBCONFIGTOGGLE="$libconfigtoggle" \
|
||||||
LIBCONFIGCONF="$libconfigconf" \
|
LIBCONFIGCONF="$libconfigconf" \
|
||||||
|
XRDBTOGGLE="$xrdbtoggle" \
|
||||||
X11LIB="$X11LIB" \
|
X11LIB="$X11LIB" \
|
||||||
X11INC="$X11INC"
|
X11INC="$X11INC"
|
||||||
}
|
}
|
||||||
|
@ -160,6 +167,7 @@ install() {
|
||||||
OPENSSLCONF="$opensslconf" \
|
OPENSSLCONF="$opensslconf" \
|
||||||
LIBCONFIGTOGGLE="$libconfigtoggle" \
|
LIBCONFIGTOGGLE="$libconfigtoggle" \
|
||||||
LIBCONFIGCONF="$libconfigconf" \
|
LIBCONFIGCONF="$libconfigconf" \
|
||||||
|
XRDBTOGGLE="$xrdbtoggle" \
|
||||||
X11LIB="$X11LIB" \
|
X11LIB="$X11LIB" \
|
||||||
X11INC="$X11INC"
|
X11INC="$X11INC"
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ xinerama=true # enable multi monitor support
|
||||||
openssl=true # enable support for openssl, used to calculate MD5
|
openssl=true # enable support for openssl, used to calculate MD5
|
||||||
fribidi=true # enable support for right to left languages
|
fribidi=true # enable support for right to left languages
|
||||||
libconfig=true # enable configuration and themes
|
libconfig=true # enable configuration and themes
|
||||||
|
xresources=true # enable .Xresources support
|
||||||
cc=gcc # compiler and linker
|
cc=gcc # compiler and linker
|
||||||
opt=-O2 # level of optimization
|
opt=-O2 # level of optimization
|
||||||
warn=true # warn about OS quirks
|
warn=true # warn about OS quirks
|
||||||
|
|
|
@ -51,8 +51,12 @@ void readargs(int argc, char *argv[]) {
|
||||||
|
|
||||||
// init/read xrdb
|
// init/read xrdb
|
||||||
if (xresources) {
|
if (xresources) {
|
||||||
|
#if USEXRESOURCES
|
||||||
XrmInitialize();
|
XrmInitialize();
|
||||||
load_xresources();
|
load_xresources();
|
||||||
|
#else
|
||||||
|
; // avoids a warning
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// no arguments
|
// no arguments
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#if USEXRESOURCES
|
||||||
void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst) {
|
void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst) {
|
||||||
char *sdst = NULL;
|
char *sdst = NULL;
|
||||||
int *idst = NULL;
|
int *idst = NULL;
|
||||||
|
@ -49,3 +50,4 @@ void load_xresources(void) {
|
||||||
|
|
||||||
XCloseDisplay(display);
|
XCloseDisplay(display);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#if USEXRESOURCES
|
||||||
enum resource_type {
|
enum resource_type {
|
||||||
STRING = 0,
|
STRING = 0,
|
||||||
INTEGER = 1,
|
INTEGER = 1,
|
||||||
|
@ -13,3 +14,4 @@ typedef struct {
|
||||||
// declare functions
|
// declare functions
|
||||||
static void load_xresources(void);
|
static void load_xresources(void);
|
||||||
static void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst);
|
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.
|
// This .Xresources array is read and compared to the xrdb. Simply add to the array if you need to.
|
||||||
|
#if USEXRESOURCES
|
||||||
ResourcePref resources[] = {
|
ResourcePref resources[] = {
|
||||||
{ "font", STRING, &font },
|
{ "font", STRING, &font },
|
||||||
{ "col_caretfg", STRING, &col_caretfg },
|
{ "col_caretfg", STRING, &col_caretfg },
|
||||||
|
@ -207,3 +208,4 @@ ResourcePref cols[] = {
|
||||||
{ "color14", STRING, &col_sgr14 },
|
{ "color14", STRING, &col_sgr14 },
|
||||||
{ "color15", STRING, &col_sgr15 },
|
{ "color15", STRING, &col_sgr15 },
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
13
spmenu.c
13
spmenu.c
|
@ -57,6 +57,13 @@
|
||||||
#define USECONFIG 1
|
#define USECONFIG 1
|
||||||
#endif
|
#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
|
// include fribidi used for right to left language support
|
||||||
#if USERTL
|
#if USERTL
|
||||||
#include <fribidi.h>
|
#include <fribidi.h>
|
||||||
|
@ -83,9 +90,13 @@
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/Xresource.h>
|
|
||||||
#include <X11/Xft/Xft.h>
|
#include <X11/Xft/Xft.h>
|
||||||
|
|
||||||
|
// include xresources
|
||||||
|
#if USEXRESOURCES
|
||||||
|
#include <X11/Xresource.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// include pango used for markup
|
// include pango used for markup
|
||||||
#if USEPANGO
|
#if USEPANGO
|
||||||
#include <pango/pango.h>
|
#include <pango/pango.h>
|
||||||
|
|
|
@ -29,3 +29,7 @@ OPENSSLCONF = openssl
|
||||||
# Comment these lines if you don't need it.
|
# Comment these lines if you don't need it.
|
||||||
LIBCONFIGTOGGLE = -DCONFIG
|
LIBCONFIGTOGGLE = -DCONFIG
|
||||||
LIBCONFIGCONF = libconfig
|
LIBCONFIGCONF = libconfig
|
||||||
|
|
||||||
|
# .Xresources/xrdb support
|
||||||
|
# Comment this line if you don't need it.
|
||||||
|
XRDBTOGGLE = -DXRESOURCES
|
||||||
|
|
Loading…
Reference in a new issue