2022-01-01 19:45:59 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2022-01-03 21:38:34 +00:00
|
|
|
case "$1" in
|
|
|
|
"-h" | "--help")
|
|
|
|
echo "usage: ${0##*/} [PACKAGE_NAME]"
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
"")
|
2022-01-09 15:08:26 +00:00
|
|
|
PACKAGE_NAME=${PWD##*/} # '##*/' removes everything before the last slash and the last slash
|
2022-01-03 21:38:34 +00:00
|
|
|
;;
|
|
|
|
*)
|
2022-01-09 15:08:26 +00:00
|
|
|
PACKAGE_NAME=${1%.xdc} # '%.xdc' removes the extension and allows PACKAGE_NAME to be given with or without extension
|
2022-01-03 21:38:34 +00:00
|
|
|
;;
|
|
|
|
esac
|
2022-01-01 19:45:59 +00:00
|
|
|
|
2022-01-19 05:14:32 +00:00
|
|
|
rm "$PACKAGE_NAME.xdc" 2> /dev/null
|
2022-01-17 22:49:35 +00:00
|
|
|
zip -9 --recurse-paths "$PACKAGE_NAME.xdc" * --exclude README.md webxdc.js webxdc.d.ts "*.sh" "*.xdc"
|
2022-01-01 19:45:59 +00:00
|
|
|
|
|
|
|
echo "success, archive contents:"
|
2022-01-19 05:14:32 +00:00
|
|
|
unzip -l "$PACKAGE_NAME.xdc"
|
|
|
|
|
|
|
|
# check package size
|
|
|
|
MAXSIZE=102400
|
|
|
|
size=$(wc -c < "$PACKAGE_NAME.xdc")
|
|
|
|
if [ $size -ge $MAXSIZE ]; then
|
|
|
|
echo "WARNING: package size exceeded the limit ($size > $MAXSIZE)"
|
|
|
|
fi
|