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

CFLAGS="-mtune=generic -Os -pipe"
CXX="g++ -flto -fuse-linker-plugin -mtune=generic -Os -pipe -fno-exceptions -fno-rtti"

P=hwdata
V=0.393
SRC=$P-$V
USER=`cat /etc/sysconfig/tcuser`
LIST="compiletc submitqc  "
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://github.com/vcrhonek/$P/archive/refs/tags/v$V.tar.gz"  $USER
tar xvf v$V*gz
cd $SRC
sed 's|usr|usr/local|' -i configure 
sed 's|true|false|' -i configure  # convert blacklist to disable
make -j4 # nothing to be done
make install DESTDIR=/tmp/$P
cd /tmp

# main 
######
mkdir -p $P/usr/local/share/doc/$P
echo 'GPL v 2' > $P/usr/local/share/doc/$P/COPYING

# lets try move non-std pc pathway to normal pathway
mkdir -p $P/usr/local/lib/
mv $P/usr/local/share/pkgconfig $P/usr/local/lib/

# TCZ them
###########
LIST2="$P "
for Z in $LIST2
do
	mksquashfs $Z $Z.tcz
	md5sum $Z.tcz > $Z.tcz.md5.txt
	cd $Z
	find . -not -type d | cut -c 2- | sort > /tmp/$Z.tcz.list
	cd /tmp
done

ls -hal

echo 'Title:          hwdata.tcz
Description:    pci, pnp & usb ids
Version:        0.393
Author:         Vitezslav Crhonek  
Original-site:  https://github.com/vcrhonek/hwdata
Copying-policy: GPL v 2
Size:           3.2M          		
Extension_by:   aus9
Tags:           pci pnp iab oui usb hardware
Comments:       pci.ids pnp.ids & usb.ids
                Also has iab data which I believe is
                Integrated Access and Backhaul

                Also has oui data which I believe is
                for public mac addresses
                Contains pc file too
            
Change-log:     2023/04/21 v 0.369 on 14x (aus)
                2024/05/15 v 0.382 on 15x (Juanito) 
Current:        2025/03/13 v 0.939 on 16x (aus9)  ' > $P.tcz.info

# no dep its data only

submitqc --libs
rm -rf *.zsync


