misc/flag-icons: add Esperanto flag and parallelize the build.
This commit is contained in:
@@ -27,9 +27,13 @@ FLAVORS= plain bordered rounded
|
||||
PKGNAMESUFFIX= -${FLAVOR}
|
||||
.endif
|
||||
|
||||
post-extract:
|
||||
cd ${WRKSRC}/flags && ${SH} ${FILESDIR}/makeflags.sh add-missing-flags
|
||||
|
||||
do-build:
|
||||
cd ${BUILD_WRKSRC}/flags && ${SH} ${FILESDIR}/makeflags.sh \
|
||||
${FLAVOR} ${STAGEDIR}${FLAGS_TOPDIR}/${FLAVOR} ${FLAG_SIZES}
|
||||
cd ${BUILD_WRKSRC}/flags && JOBS=${MAKE_JOBS_NUMBER} ${SH} \
|
||||
${FILESDIR}/makeflags.sh ${FLAVOR} \
|
||||
${STAGEDIR}${FLAGS_TOPDIR}/${FLAVOR} ${FLAG_SIZES}
|
||||
|
||||
post-stage:
|
||||
cd ${STAGEDIR}${PREFIX} && ${FIND} share -type f >> ${TMPPLIST}
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
# https://commons.wikimedia.org/wiki/File:Flag_of_Esperanto.svg
|
||||
add-esperanto-flag()
|
||||
{
|
||||
cat > "$1/epo.svg" << EOD
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="$2" height="400">
|
||||
<path fill="#FFF" d="m0,0h202v202H0"/>
|
||||
<path fill="#090" d="m0,200H200V0H$2V400H0m58-243 41-126 41,126-107-78h133"/>
|
||||
</svg>
|
||||
EOD
|
||||
}
|
||||
|
||||
add-missing-flags()
|
||||
{
|
||||
add-esperanto-flag 1x1 400
|
||||
add-esperanto-flag 4x3 533
|
||||
}
|
||||
|
||||
async() { "$@" & }
|
||||
|
||||
simple()
|
||||
{
|
||||
local comment convert_extra_args destdir height ratio subdir t0 width
|
||||
local comment convert_extra_args destdir flag height i=0 ratio subdir t0 width
|
||||
|
||||
comment=$1; convert_extra_args=$2; destdir=$3; shift 3
|
||||
|
||||
@@ -12,9 +32,11 @@ simple()
|
||||
echo -n "Generating $comment flags ${width}x${height}... "
|
||||
t0=$(date +%s)
|
||||
for flag in $subdir/*.svg; do
|
||||
convert -resize ${width}x${height} $convert_extra_args \
|
||||
i=$((i % ${JOBS:-1}))
|
||||
test $((i+=1)) -eq 1 && wait
|
||||
async convert -resize ${width}x${height} $convert_extra_args \
|
||||
"$flag" "$destdir/${width}x${height}/$(basename "$flag" svg)png"
|
||||
done
|
||||
done; wait
|
||||
echo "finished in $(date -ur $((`date +%s`-t0)) +%M:%S)"
|
||||
done
|
||||
done
|
||||
@@ -33,7 +55,7 @@ bordered()
|
||||
# https://joeldare.com/rounding-image-corners-with-imagemagick
|
||||
rounded()
|
||||
{
|
||||
local destdir height mask radius ratio subdir t0 width
|
||||
local destdir flag height i=0 mask radius ratio subdir t0 width
|
||||
|
||||
destdir=$1; shift
|
||||
mask=$(mktemp)
|
||||
@@ -53,11 +75,13 @@ rounded()
|
||||
echo -n "Generating rounded corner flags ${width}x${height}... "
|
||||
t0=$(date +%s)
|
||||
for flag in $subdir/*.svg; do
|
||||
convert -resize ${width}x${height} \
|
||||
i=$((i % ${JOBS:-1}))
|
||||
test $((i+=1)) -eq 1 && wait
|
||||
async convert -resize ${width}x${height} \
|
||||
"$flag" -matte "$mask" \
|
||||
-compose DstIn -composite -strip \
|
||||
"$destdir/${width}x${height}/$(basename "$flag" svg)png"
|
||||
done
|
||||
done; wait
|
||||
echo "finished in $(date -ur $((`date +%s`-t0)) +%M:%S)"
|
||||
done
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user