#!/bin/sh
# test we are root
if [ "$(id -u)" != "0" ]; then
   echo "run as root now exitting"
   exit 1
fi

# prev script xfconf this is next

export CFLAGS="-march=armv8-a+crc -mtune=cortex-a72 -Os -pipe" 
export CXXFLAGS="-march=armv8-a+crc -mtune=cortex-a72 -Os -pipe \
-fno-exceptions -fno-rtti"

P=libxfce4ui
V=4.14.1
SRC=$P-$V
USER=`cat /etc/sysconfig/tcuser`
LIST="compiletc squashfs-tools wget zsync xfconf-dev libX11-dev gtk3-dev libICE-dev "
for Z in $LIST
    do 
    su -c "tce-load -i $Z" $USER
done

cd /tmp
su -c "/usr/local/bin/wget -nc --no-check-certificate \
https://archive.xfce.org/xfce/4.14/src/$SRC.tar.bz2"  $USER
mkdir $P
tar jxvf $SRC*bz2
cd $SRC
./configure --prefix=/usr/local --enable-introspection=no --disable-nls --disable-debug 
# GTK2 support:  no
# Glade Interface Designer:  no
# Glade 3.0 Interface Designer:  no
# Keyboard library support:  yes
# Startup notification:      no
# X11 session management:    yes
# Debug support:             no
# Build tests:               no
# GNU Visibility:            yes
# Vendor:                    none
# Manual website:            https://docs.xfce.org/help.php
make -j5 # takes seconds
make install-strip DESTDIR=/tmp/$P
cd /tmp

# dev
#####
mkdir -p $P-dev/usr/local/lib/
mv $P/usr/local/include $P-dev/usr/local/
mv $P/usr/local/lib/pkgconfig $P-dev/usr/local/lib/
mv $P/usr/local/lib/*a $P-dev/usr/local/lib/
chmod 644 $P-dev/usr/local/lib/*a 

# no locale
#########
rm -rf $P/usr/local/share/locale 

# no doc
#####
rm -rf $P/usr/local/share/gtk-doc

# main no need to mod desktop


# TCZ them
###########
LIST2="$P $P-dev "
for Z in $LIST2
do
	mksquashfs $Z $Z.tcz
	md5sum $Z.tcz > $Z.tcz.md5.txt
	cd $Z
	find usr -not -type d > /tmp/$Z.tcz.list
        sed 's|usr|/usr|g' -i /tmp/$Z.tcz.list
	cd /tmp
        zsyncmake $Z.tcz
done

ls -hal

echo 'Title:          libxfce4ui-dev.tcz
Description:    dev files
Version:        4.14.1
Author:         Benedikt Meurer, Brian Tarricone, Jannis Pohlmann,
                Jasper Huijsmans, Nick Schermer & Olivier Fourdan 
Original-site:  https://archive.xfce.org/xfce/4.14/src/
Copying-policy: LGPL v2
Size:           16K
Extension_by:   aus9
Tags:           xfce
Comments:       dev files

Change-log:     2020/10/22 Original 4.14.1 on 12x
Current:        2020/10/22   ' > $P-dev.tcz.info

echo 'Title:          libxfce4ui.tcz
Description:    gtk3 widgets for other xfce TCEs
Version:        4.14.1
Author:         Benedikt Meurer, Brian Tarricone, Jannis Pohlmann,
                Jasper Huijsmans & Nick Schermer & Olivier Fourdan 
Original-site:  https://archive.xfce.org/xfce/4.14/src/
Copying-policy: LGPL v2
Size:           88K
Extension_by:   aus9
Tags:           xfce
Comments:       xfce utility files

Change-log:     2020/10/22 Original 4.14.1 on 12x
Current:        2020/10/22   ' > $P.tcz.info

echo 'xfconf.tcz
gtk3.tcz' > $P.tcz.dep
echo 'libxfce4ui.tcz
xfconf-dev.tcz 
libX11-dev.tcz 
gtk3-dev.tcz
libICE-dev.tcz ' > $P-dev.tcz.dep

# xfce4-about -> GUI opens looks correct
