|
root / base / hammerhead-desktop / build.sh
build.sh Bash 97 lines 4.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
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/sh
# Build script for hammerhead-desktop (Zygaena marine-dark branding config).
#
# No upstream tarball - all inputs are local files shipped alongside this
# script in the port directory. The only compiled artifact is the cairo
# wallpaper generator, built and run once here (its output PNG is what
# actually ships - the generator binary itself is not installed).
set -e

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

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

# --- Step 1: build + run the wallpaper generator ---
gcc "$PORTDIR/wallpaper-gen.c" $(pkg-config --cflags --libs cairo) -lm -o "$PORTDIR/wg"

mkdir -p "$PKGDIR$PREFIX/share/backgrounds"
"$PORTDIR/wg" "$PKGDIR$PREFIX/share/backgrounds/hammerhead.png"

# --- Step 2: Openbox theme ---
mkdir -p "$PKGDIR$PREFIX/share/themes/Hammerhead/openbox-3"
cp "$PORTDIR/themerc" "$PKGDIR$PREFIX/share/themes/Hammerhead/openbox-3/themerc"

# --- Step 3: tint2 panel config ---
# Matches the existing tint2 port's own default install location
# ($PREFIX/etc/xdg/tint2 - tint2's cmake build doesn't honor
# --sysconfdir), and what the integration step's XDG_CONFIG_DIRS
# ($PREFIX/etc/xdg) resolves against.
mkdir -p "$PKGDIR$PREFIX/etc/xdg/tint2"
cp "$PORTDIR/tint2rc" "$PKGDIR$PREFIX/etc/xdg/tint2/tint2rc"

# --- Step 4: conky config ---
mkdir -p "$PKGDIR$PREFIX/etc/xdg/conky"
cp "$PORTDIR/conky.conf" "$PKGDIR$PREFIX/etc/xdg/conky/conky.conf"

# --- Step 5: Openbox rc.xml + menu.xml ---
mkdir -p "$PKGDIR$PREFIX/etc/xdg/openbox"
cp "$PORTDIR/rc.xml" "$PKGDIR$PREFIX/etc/xdg/openbox/rc.xml"
cp "$PORTDIR/menu.xml" "$PKGDIR$PREFIX/etc/xdg/openbox/menu.xml"

# --- Step 6: autostart (substitute the real $PREFIX) ---
sed "s#@@PREFIX@@#$PREFIX#g" "$PORTDIR/autostart" \
    > "$PKGDIR$PREFIX/etc/xdg/openbox/autostart"
chmod 755 "$PKGDIR$PREFIX/etc/xdg/openbox/autostart"

# --- Step 7: screenshot tool (hh-grab XGetImage->PNG + hh-screenshot wrapper) ---
# Bound to Print in rc.xml; saves to ~/Pictures/hh-<timestamp>.png.
mkdir -p "$PKGDIR$PREFIX/bin"
gcc "$PORTDIR/hh-grab.c" -I"$PREFIX/include" -L"$PREFIX/lib" -R"$PREFIX/lib" -lX11 -lpng \
    -o "$PKGDIR$PREFIX/bin/hh-grab"
install -m 755 "$PORTDIR/hh-screenshot" "$PKGDIR$PREFIX/bin/hh-screenshot"

# --- Step 8: PDF/image launcher wrappers + branded welcome PDF ---
gcc "$PORTDIR/pdf-gen.c" $(pkg-config --cflags --libs cairo) -o "$PORTDIR/pdfgen"
mkdir -p "$PKGDIR$PREFIX/share/hammerhead"
"$PORTDIR/pdfgen" "$PKGDIR$PREFIX/share/hammerhead/welcome.pdf"
rm -f "$PORTDIR/pdfgen"
install -m 755 "$PORTDIR/hh-pdf" "$PKGDIR$PREFIX/bin/hh-pdf"
install -m 755 "$PORTDIR/hh-images" "$PKGDIR$PREFIX/bin/hh-images"

# --- Step 9: Openbox pipemenus (Places, Recent Files) ---
# GTK-free, POSIX-sh, pattern adapted from CrunchBang++'s
# cbpp-places-pipemenu / cbpp-recent-files-pipemenu; referenced from
# menu.xml via execute="hh-places-pipemenu" / "hh-recent-pipemenu".
install -m 755 "$PORTDIR/hh-places-pipemenu" "$PKGDIR$PREFIX/bin/hh-places-pipemenu"
install -m 755 "$PORTDIR/hh-recent-pipemenu" "$PKGDIR$PREFIX/bin/hh-recent-pipemenu"

# --- Step 10: branded tint2 launcher icons + .desktop entries ---
# The stock launcher was illegible: st ships no icon, xnedit's png was loose,
# and hicolor had no index.theme so name-lookup failed. We ship our own cairo
# glyphs and point each .desktop Icon= at an ABSOLUTE path, which tint2 loads
# directly (no icon theme required). tint2rc references these three by path.
gcc "$PORTDIR/icon-gen.c" $(pkg-config --cflags --libs cairo) -lm -o "$PORTDIR/ig"
mkdir -p "$PKGDIR$PREFIX/share/hammerhead-desktop/launcher"
"$PORTDIR/ig" "$PKGDIR$PREFIX/share/hammerhead-desktop/launcher"
rm -f "$PKGDIR$PREFIX/share/hammerhead-desktop/launcher/preview.png"  # review-only
rm -f "$PORTDIR/ig"
mkdir -p "$PKGDIR$PREFIX/share/applications"
cp "$PORTDIR/hh-terminal.desktop" "$PORTDIR/hh-files.desktop" \
   "$PORTDIR/hh-editor.desktop" "$PKGDIR$PREFIX/share/applications/"

# Clean up the transient build helper - not shipped.
rm -f "$PORTDIR/wg"

# --- Step 11: /etc/skel/.xsession (Task 4b) ---
# New users' home dirs are seeded from /etc/skel, so this makes a fresh
# account's X session default to the Openbox desktop without any manual
# ~/.xsession setup.
mkdir -p "$PKGDIR/etc/skel"
install -m 755 "$PORTDIR/dot-xsession" "$PKGDIR/etc/skel/.xsession"

# --- Step 12: hh-desktop-init (per-user ~/.config seed, CBPP-style) ---
# openbox-autostart only reads ~/.config or /etc/xdg (not our /usr/local/etc/xdg),
# so the X session entrypoints call this to seed ~/.config on login for new AND
# existing users (copy-if-missing).
install -m 755 "$PORTDIR/hh-desktop-init" "$PKGDIR$PREFIX/bin/hh-desktop-init"