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

P=doxygen
V=1.8.18
SRC=$P-$V
USER=`cat /etc/sysconfig/tcuser`
LIST="compiletc submitqc cmake python "
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 \
http://$P.nl/files/$SRC.src.tar.gz  " $USER
tar xvf $SRC*gz
mkdir $P
cd $SRC
mkdir build && cd build
cmake -G "Unix Makefiles" ..
make install DESTDIR=/tmp/$P # takes 2 min 40 
cd /tmp

# no dev TCZ
##############

# main
#####
mkdir -p  $P/usr/local/share/doc/$P
echo 'see https://www.doxygen.nl/manual/index.html for license' >  $P/usr/local/share/doc/$P/COPYING
cd $P
find . | xargs file | grep "executable" | grep ELF | grep "not stripped" | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
cd /tmp

# TCZ them
#######
LIST="$P "
for Z in $LIST
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
done



echo 'Title:          doxygen.tcz
Description:    make docs from source code 
Version:        1.8.18
Author:         Dimitri van Heesch
Original-site:  https://www.doxygen.nl/index.html
Copying-policy: GPL v2
Size:           4.9M	
Extension_by:   aus9 
Tags:           documentation 
Comments:       Doxygen is the de facto standard tool for generating 
                documentation from annotated C++ sources.
                This acts like a dev file that might be used by some
                TCEs to build docs
                
                list can but not forced to build docs for packages seen
                by clicking show more under required by
                https://www.archlinux.org/packages/extra/x86_64/doxygen/

Change-log:     2018/07/08 Original 9x v 1.8.14 
Current:        2020/04/05  1.8.18 on 11x' > $P.tcz.info

submitqc --libs
