From 54687912c5d6824f1bd2a245e03ff096014c55a8 Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Wed, 27 Jul 2011 14:15:40 +0200 Subject: [PATCH] Old build system can still be used --- Makefile.in | 87 +++++++++++++++++++++++++++++++++++++++++++ README | 5 ++- configure | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 Makefile.in create mode 100755 configure diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..4543f90 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,87 @@ +PROG=wmfs +MAN=wmfs.1 + +# wmfs version +VERSION=$(shell scripts/setlocalversion) + +SRCS= \ +src/barwin.c \ +src/client.c \ +src/config.c \ +src/draw.c \ +src/event.c \ +src/ewmh.c \ +src/frame.c \ +src/infobar.c \ +src/init.c \ +src/launcher.c \ +src/layout.c \ +src/menu.c \ +src/mouse.c \ +src/parse_api.c \ +src/parse.c \ +src/screen.c \ +src/status.c \ +src/systray.c \ +src/tag.c \ +src/util.c \ +src/color.c \ +src/split.c \ +src/cfactor.c \ +src/wmfs.c + +# flags +CFLAGS+= -DXDG_CONFIG_DIR=\"${XDG_CONFIG_DIR}\" +CFLAGS+= -DWMFS_VERSION=\"${VERSION}\" +CFLAGS+= -Wall -Wextra + +OBJS= ${SRCS:.c=.o} + +all: ${PROG} ${MAN}.gz + +${PROG}: ${OBJS} src/structs.h src/wmfs.h src/parse.h + ${CC} -o $@ ${OBJS} ${LDFLAGS} + +${MAN}.gz: ${MAN} + gzip -cn -9 ${MAN} > $@ + +.c.o: + ${CC} -c ${CFLAGS} $< -o $@ + +.PHONY: all clean distclean install uninstall dist + +clean: + rm -f ${OBJS} wmfs ${MAN}.gz + +distclean: clean + rm -f Makefile + +install: all + @echo installing executable file to ${DESTDIR}${PREFIX}/bin + mkdir -p ${DESTDIR}${PREFIX}/bin + install ${PROG} ${DESTDIR}${PREFIX}/bin + @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 + mkdir -p ${DESTDIR}${MANPREFIX}/man1 + install -m 644 ${MAN}.gz ${DESTDIR}${MANPREFIX}/man1/ + @echo installing xsession file to ${DESTDIR}${PREFIX}/share/xsessions + mkdir -p ${DESTDIR}${PREFIX}/share/xsessions + install -m 644 wmfs.desktop ${DESTDIR}${PREFIX}/share/xsessions/ + @echo installing default config file to ${DESTDIR}${XDG_CONFIG_DIR}/wmfs/ + mkdir -p ${DESTDIR}${XDG_CONFIG_DIR}/wmfs/ + install -m 444 wmfsrc ${DESTDIR}${XDG_CONFIG_DIR}/wmfs/ + +uninstall: + @echo removing executable file from ${DESTDIR}${PREFIX}/bin + rm -f ${DESTDIR}${PREFIX}/bin/wmfs + @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 + rm -f ${DESTDIR}${MANPREFIX}/man1/wmfs.1.gz + @echo removing xsession file from ${DESTDIR}${PREFIX}/share/xsessions + rm -f ${DESTDIR}${PREFIX}/share/xsessions/wmfs.desktop + @echo removing config file from ${DESTDIR}${XDG_CONFIG_DIR}/wmfs/ + rm -f ${DESTDIR}${XDG_CONFIG_DIR}/wmfs/wmfsrc + rmdir ${DESTDIR}${XDG_CONFIG_DIR}/wmfs/ + +dist: + @echo "Generate wmfs-`date +%Y%m`.tar.gz" + git archive --format=tar --prefix=wmfs-`date +%Y%m`/ master | gzip -c > wmfs-`date +%Y%m`.tar.gz + diff --git a/README b/README index d57d536..d05c924 100644 --- a/README +++ b/README @@ -21,7 +21,7 @@ LICENSE : BSD, see COPYING. REQUIREMENT : - libx11 - libxft (optional) - \- freetype + - freetype - libxinerama (optional) - libxrandr (optional) - imlib2 (optional) @@ -35,6 +35,9 @@ INSTALL : mkdir build/ && cd build/ cmake .. +You can also use old build system if you don't want^Whave cmake +./configure && make + DISTROS : - wmfs port for FreeBSD at x11-wm/wmfs - wmfs is available with AUR in ArchLinux (wmfs or wmfs-git) diff --git a/configure b/configure new file mode 100755 index 0000000..27b83e0 --- /dev/null +++ b/configure @@ -0,0 +1,105 @@ +#!/bin/sh + +LIBS="x11 xft freetype2" +USE_XINERAMA="xinerama" +USE_XRANDR="xrandr" +USE_IMLIB2="imlib2" +OS=`uname -s` +PREFIX=/usr/local +MANPREFIX="$PREFIX/man" +XDG_CONFIG_DIR="$PREFIX/etc/xdg" + +while true; do + case "$1" in + --without-xinerama) + USE_XINERAMA=""; shift;; + --without-xrandr) + USE_XRANDR=""; shift;; + --without-imlib2) + USE_IMLIB2=""; shift;; + --prefix) + [ -z "$2" ] && echo "Missing argument" && exit 1 + PREFIX=$2; shift 2;; + --xdg-config-dir) + [ -z "$2" ] && echo "Missing argument" && exit 1 + XDG_CONFIG_DIR=$2; shift 2;; + --man-prefix) + [ -z "$2" ] && echo "Missing argument" && exit 1 + MANPREFIX=$2; shift 2;; + --help|-h) + echo "Usage: ./configure [options] + --without-imlib2 : compile without imlib2 support + --without-xrandr : compile without xrandr support + --without-xinerama : compile without xinerama support + --prefix DIRECTORY : install binary with specified prefix (default $PREFIX) + --xdg-config-dir DIRECTORY : install configuration to specified directory (default $XDG_CONFIG_DIR) + --man-prefix DIRECTORY : install man page to specified prefix (default $MANPREFIX)" + exit 0;; + *) break;; + esac +done + +LIBS="$LIBS $USE_XINERAMA $USE_XRANDR $USE_IMLIB2" + +which pkg-config >/dev/null 2>&1 + +if [ $? -eq 0 ]; +then + CFLAGS=`pkg-config --cflags-only-I $LIBS` + LDFLAGS=`pkg-config --libs $LIBS` +else + # Try to use some known paths + case $OS in + FreeBSD) + CFLAGS="-I/usr/local/include -I/usr/local/include/freetype2" + LDFLAGS="-L/usr/local/lib";; + OpenBSD) + CFLAGS="-I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/usr/local/include" + LDFLAGS="-L/usr/X11R6/lib -L/usr/local/lib";; + NetBSD) + CFLAGS="-I/usr/X11R7/include -I/usr/X11R7/include/freetype2 -I/usr/local/include" + LDFLAGS="-L/usr/X11R7/lib -L/usr/local/lib";; + Linux) + CFLAGS="-I/usr/include/freetype2" + LDFLAGS="" + ;; + *) + echo "No default CFLAGS and LDFLAGS found for your OS, feel free to contribute or install pkg-config :)" + exit 1;; + esac + + LDFLAGS="$LDFLAGS -lX11 -lXft -lfreetype" + + [ -n "$USE_XINERAMA" ] && LDFLAGS="$LDFLAGS -lXinerama" + [ -n "$USE_XRANDR" ] && LDFLAGS="$LDFLAGS -lXrandr" + [ -n "$USE_IMLIB2" ] && LDFLAGS="$LDFLAGS -lImlib2" +fi + +[ -n "$USE_XINERAMA" ] && CFLAGS="$CFLAGS -DHAVE_XINERAMA" +[ -n "$USE_XRANDR" ] && CFLAGS="$CFLAGS -DHAVE_XRANDR" +[ -n "$USE_IMLIB2" ] && CFLAGS="$CFLAGS -DHAVE_IMLIB" + +LDFLAGS="$LDFLAGS -lpthread" + +cat > Makefile << EOF +PREFIX=$PREFIX +XDG_CONFIG_DIR=$XDG_CONFIG_DIR +MANPREFIX=$MANPREFIX + +CFLAGS+=$CFLAGS +LDFLAGS+=$LDFLAGS + +EOF + +cat Makefile.in >> Makefile + +echo "Compilation resume: +OS=$OS +CFLAGS=$CFLAGS +LDFLAGS=$LDFLAGS +PREFIX=$PREFIX +MANPREFIX=$MANPREFIX +XDG_CONFIG_DIR=$XDG_CONFIG_DIR + +You can run 'make' now :-) +"