|
root / base / xfe / build.sh
build.sh Bash 64 lines 2.9 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
# Build script for Xfe 2.1.8 (autotools, Template A + CXXFLAGS - C++ port).
# Consumes fox-toolkit via pkg-config (fox.pc, installed to $PREFIX by
# base/fox-toolkit). startup-notification is not ported, so it's disabled.
set -e

PORTDIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)

cd "$SRCDIR"

for p in "$PORTDIR"/patches/*.patch; do
    [ -f "$p" ] || continue
    echo "==> Applying patch: $(basename "$p")"
    patch -p1 < "$p"
done

# MANDATORY libtool fix - see Template A.
if [ -f configure ]; then
    sed -i -E 's/(kopensolaris\*-gnu)([^)]*\))/\1 | hammerhead*\2/' configure
fi

export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$PREFIX/share/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH"
# Xfe's configure finds FOX via `pkg-config fox` (fox.pc) and also probes
# fox-config as a fallback - make sure both resolve under $PREFIX.
export PATH="$PREFIX/bin:$PATH"
export CFLAGS="${CFLAGS} -I$PREFIX/include -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS"
export CXXFLAGS="${CXXFLAGS} -I$PREFIX/include -I$PREFIX/include/fox-1.6 -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS"
export LDFLAGS="${LDFLAGS} -L$PREFIX/lib -R$PREFIX/lib"

./configure \
    --prefix="$PREFIX" \
    --build="$BUILD_TRIPLE" \
    --host="$BUILD_TRIPLE" \
    --sysconfdir="$SYSCONFDIR" \
    --disable-static

# GOTCHA: --disable-nls (tried first) has a bad side effect - it makes
# configure skip probing MSGFMT entirely and hardcode it to ":", which
# ALSO breaks `xfe.desktop: xfe.desktop.in` (Makefile.am's rule is
# literally `$(MSGFMT) --desktop -d po --template $< -o $@` - msgfmt has
# a `--desktop` mode used for both translation AND desktop-file
# generation). msgfmt itself IS present on Hammerhead and works fine;
# it's msgmerge (used only inside po/'s own stamp-po recipe, to refresh
# each lang's .po against the .pot before compiling it to .gmo) that's
# missing from our gettext install. So: leave NLS enabled (MSGFMT stays
# real) and instead drop `po` out of SUBDIRS post-configure, skipping
# recursion into the one directory that actually needs msgmerge - the
# top-level `xfe.desktop` rule doesn't need po/ built, it reads the raw
# .po files directly.
sed -i -E 's/^(SUBDIRS[[:space:]]*=[[:space:]]*)po /\1/' Makefile

# GOTCHA #2: turns out moot - Hammerhead's /usr/bin/msgfmt is itself
# non-functional (`msgfmt --version` -> "Cannot open file --version",
# i.e. not real GNU gettext), so configure's own functional probe
# resolves MSGFMT to ":" regardless of NLS/SUBDIRS. Not something to fix
# from this port (system gettext bug, not in scope for xfe/mupdf/neovim/
# XNEdit) - work around it here: since we have no translations to merge
# anyway (po/ excluded above), `msgfmt --desktop`/`--xml` on an
# untranslated build is equivalent to a plain copy of the .in template.
sed -i -E 's#\$\(MSGFMT\) --(desktop|xml) -d \$\(top_srcdir\)/po --template \$< -o \$@#cp $< $@#' Makefile

gmake -j${JOBS:-1}
gmake install DESTDIR="$PKGDIR"