|
root / base / dmenu / build.sh
build.sh Bash 38 lines 1.6 KB
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
# Build script for dmenu (suckless, plain Makefile - NOT a template build).
# Deps: libX11, libXft, libXinerama, fontconfig (all ported).
#
# Same class of fix as base/st: dmenu's shipped config.mk hardcodes
# X11INC/X11LIB to /usr/X11R6 (doesn't exist on Hammerhead) and links
# -lX11/-lXinerama/-lfontconfig/-lXft directly instead of going through
# pkg-config. Rewrite config.mk to resolve everything via pkg-config
# against $PREFIX.
set -e
cd "$SRCDIR"

export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$PREFIX/share/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH"

# NOTE: dmenu 5.4's config.mk (unlike st's) has no PKG_CONFIG variable at
# all - use the literal `pkg-config` binary name directly rather than a
# $(PKG_CONFIG) make-variable reference that would expand to nothing.
sed -i \
    -e "s#^PREFIX = .*#PREFIX = $PREFIX#" \
    -e '/^X11INC/d' -e '/^X11LIB/d' \
    -e '/^XINERAMALIBS/d' -e '/^FREETYPELIBS/d' -e '/^FREETYPEINC/d' \
    -e 's#^INCS = .*#INCS = `pkg-config --cflags x11 xft xinerama fontconfig`#' \
    -e 's#^LIBS = .*#LIBS = `pkg-config --libs x11 xft xinerama fontconfig`#' \
    config.mk

# __EXTENSIONS__: hidden POSIX/SysV prototypes on illumos headers - same
# gotcha as every other X11 port here. Add rpath since /usr/local/lib is
# not on Hammerhead's default ld.so search path.
sed -i \
    -e 's#^CFLAGS   = .*#CFLAGS   = -std=c99 -pedantic -Wall -Os $(INCS) $(CPPFLAGS) -D__EXTENSIONS__#' \
    -e "s#^LDFLAGS  = .*#LDFLAGS  = \$(LIBS) -Wl,-R,$PREFIX/lib#" \
    config.mk

gmake CC=gcc PREFIX="$PREFIX"

mkdir -p "$PKGDIR$PREFIX/bin"
gmake PREFIX="$PREFIX" DESTDIR="$PKGDIR" install