Configure build

This commit is contained in:
Alex Kotov 2021-11-17 03:02:06 +05:00
parent e716ffd4a0
commit 000c7fbeea
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
6 changed files with 164 additions and 45 deletions

5
.gitignore vendored
View file

@ -1,3 +1,6 @@
/config/active.mk
/config/1-custom.mk
/config/2-generated.mk
/config/3-custom.mk
/config/5-custom.mk
/polytreewm
/src/*.o

View file

@ -1,14 +1,17 @@
# PolytreeWM - tiling window manager
# See LICENSE file for copyright and license details.
include config.mk
CONFIGMKS = \
config/1-custom.mk \
config/2-generated.mk \
config/3-custom.mk \
config/4-defvars.mk \
config/5-custom.mk
include $(CONFIGMKS)
VERSION = 6.2
CPPFLAGS += -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L
CFLAGS += $(CPPFLAGS) -std=c99 -Os -pedantic -Wall -Wno-deprecated-declarations
LDFLAGS +=
SRC = \
src/atoms.c \
src/drw.c \
@ -57,23 +60,26 @@ polytreewm: ${OBJ}
${CC} -c $< -o $@ ${CFLAGS}
dwm.o: ${DWM_SRC} ${DWM_HDR}
${OBJ}: ${HDR}
${OBJ}: ${CONFIGMKS} ${HDR}
clean:
rm -f polytreewm ${OBJ}
distclean: clean
rm -f config/2-generated.mk
install: all
mkdir -p ${DESTDIR}${PREFIX}/bin
cp -f polytreewm ${DESTDIR}${PREFIX}/bin
chmod 755 ${DESTDIR}${PREFIX}/bin/polytreewm
mkdir -p ${DESTDIR}${BINDIR}
cp -f polytreewm ${DESTDIR}${BINDIR}
chmod 755 ${DESTDIR}${BINDIR}/polytreewm
mkdir -p ${DESTDIR}${MANPREFIX}/man1
sed "s/VERSION/${VERSION}/g" < polytreewm.1 > ${DESTDIR}${MANPREFIX}/man1/polytreewm.1
chmod 644 ${DESTDIR}${MANPREFIX}/man1/polytreewm.1
mkdir -p ${DESTDIR}${MANDIR}/man1
sed "s/VERSION/${VERSION}/g" < polytreewm.1 > ${DESTDIR}${MANDIR}/man1/polytreewm.1
chmod 644 ${DESTDIR}${MANDIR}/man1/polytreewm.1
uninstall:
rm -f \
${DESTDIR}${PREFIX}/bin/polytreewm \
${DESTDIR}${MANPREFIX}/man1/polytreewm.1
${DESTDIR}${BINDIR}/polytreewm \
${DESTDIR}${MANDIR}/man1/polytreewm.1
.PHONY: all options clean install uninstall
.PHONY: all options clean distclean install uninstall

View file

@ -1,23 +0,0 @@
##########################
# Compiler, linker, etc. #
##########################
CC = cc
PKGCONFIG = pkg-config
#########
# Paths #
#########
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/share/man
################
# Dependencies #
################
PKGS = fontconfig freetype2 x11 x11-xcb xcb xcb-res xft xinerama
CPPFLAGS = -DXINERAMA
CFLAGS = `$(PKGCONFIG) --cflags $(PKGS)`
LDFLAGS = `$(PKGCONFIG) --libs $(PKGS)`

15
config/4-defvars.mk Normal file
View file

@ -0,0 +1,15 @@
CC = cc
PKGCONFIG = pkg-config
PKGS += fontconfig freetype2 x11 x11-xcb xcb xcb-res xft
ifeq (yes,$(ENABLE_XINERAMA))
CPPFLAGS += -DENABLE_XINERAMA
PKGS += xinerama
endif
CFLAGS += `$(PKGCONFIG) --cflags $(PKGS)`
LDFLAGS += `$(PKGCONFIG) --libs $(PKGS)`
CPPFLAGS += -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L
CFLAGS += $(CPPFLAGS) -std=c99 -Os -pedantic -Wall -Wno-deprecated-declarations

118
configure vendored Executable file
View file

@ -0,0 +1,118 @@
#!/bin/sh
set -e
help() {
cat <<HELP
This script tries to be similar to autotools' \`configure', but is different.
Usage: ./configure [OPTION]...
Defaults for the options are specified in brackets.
Configuration:
-h, --help Display this help and exit
Installation directories:
--prefix PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, \`make install' will install all the files in
\`/usr/local/bin', \`/usr/local/lib' etc. You can specify
an installation prefix other than \`/usr/local' using \`--prefix',
for instance \`--prefix \$HOME'.
For better control, use the options below.
File tuning of the installation directories:
--bindir DIR user executables [EPREFIX/bin]
--datarootdir DIR read-only arch.-independent data root [PREFIX/share]
--mandir DIR man documentation [DATAROOTDIR/man]
Optional Features:
--disable-xinerama disable Xinerama
HELP
}
prefix='/usr/local'
eprefix=''
bindir=''
datarootdir=''
mandir=''
enable_xinerama='yes'
while [ $# -gt 0 ]; do
case "$1" in
-h | -? | --help | -help | help)
help
exit
;;
--prefix)
shift
prefix="$1"
;;
--exec-prefix)
shift
eprefix="$1"
;;
--bindir)
shift
bindir="$1"
;;
--datarootdir)
shift
datarootdir="$1"
;;
--mandir)
shift
mandir="$1"
;;
--disable-xinerama)
enable_xinerama='no'
;;
*)
help
exit
;;
esac
shift
done
if [ "$eprefix" = '' ]; then
eprefix="$prefix"
fi
if [ "$bindir" = '' ]; then
bindir="$eprefix/bin"
fi
if [ "$datarootdir" = '' ]; then
datarootdir="$prefix/share"
fi
if [ "$mandir" = '' ]; then
mandir="$datarootdir/man"
fi
echo "PREFIX = $prefix"
echo "EPREFIX = $eprefix"
echo "BINDIR = $bindir"
echo "DATAROOTDIR = $datarootdir"
echo "MANDIR = $mandir"
echo "ENABLE_XINERAMA = $enable_xinerama"
touch 'config/1-custom.mk'
touch 'config/3-custom.mk'
touch 'config/5-custom.mk'
rm -f 'config/2-generated.mk'
echo "PREFIX = $prefix" >> 'config/2-generated.mk'
echo "EPREFIX = $eprefix" >> 'config/2-generated.mk'
echo "BINDIR = $bindir" >> 'config/2-generated.mk'
echo "DATAROOTDIR = $datarootdir" >> 'config/2-generated.mk'
echo "MANDIR = $mandir" >> 'config/2-generated.mk'
echo "ENABLE_XINERAMA = $enable_xinerama" >> 'config/2-generated.mk'

View file

@ -34,9 +34,9 @@
#include <X11/Xlib.h>
#include <X11/Xproto.h>
#include <X11/Xutil.h>
#ifdef XINERAMA
#ifdef ENABLE_XINERAMA
#include <X11/extensions/Xinerama.h>
#endif /* XINERAMA */
#endif /* ENABLE_XINERAMA */
#include <X11/Xft/Xft.h>
#include <X11/Xlib-xcb.h>
#include <xcb/res.h>
@ -1007,7 +1007,7 @@ incnmaster(const Arg *arg)
arrange(selmon);
}
#ifdef XINERAMA
#ifdef ENABLE_XINERAMA
static int
isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info)
{
@ -1017,7 +1017,7 @@ isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info)
return 0;
return 1;
}
#endif /* XINERAMA */
#endif /* ENABLE_XINERAMA */
void
killclient(const Arg *arg)
@ -2047,7 +2047,7 @@ updategeom(void)
{
int dirty = 0;
#ifdef XINERAMA
#ifdef ENABLE_XINERAMA
if (XineramaIsActive(dpy)) {
int i, j, n, nn;
Client *c;
@ -2102,7 +2102,7 @@ updategeom(void)
}
free(unique);
} else
#endif /* XINERAMA */
#endif /* ENABLE_XINERAMA */
{ /* default monitor setup */
if (!mons)
mons = createmon();