#!/bin/sh

export CFLAGS="-mtune=generic -Os -pipe"
export CXXFLAGS="-mtune=generic -Os -pipe"
export LDFLAGS="-Wl,-O1"

tce-load -wi compiletc automake git xorg-server-dev libXaw-dev
git clone --depth 1 --branch xfontsel-1.1.1 \
  "https://gitlab.freedesktop.org/xorg/app/xfontsel.git" xfontsel

cd xfontsel

./autogen.sh --prefix=/usr/local
make -j

mkdir xfontsel-i
mkdir -p xfontsel-doc/usr/local/share/man/man1/
make DESTDIR="$PWD/xfontsel-i" install
mv xfontsel-i/usr/local/share/man/man1/xfontsel.1 \
   xfontsel-doc/usr/local/share/man/man1/
strip xfontsel-i/usr/local/bin/xfontsel

mksquashfs xfontsel-i xfontsel.tcz
mksquashfs xfontsel-doc xfontsel-doc.tcz

rm -rf xfontsel-i xfontsel-doc
mv xfontsel.tcz xfontsel-doc.tcz ..

cd ..

rm -rf xfontsel
