diff options
Diffstat (limited to 'misc/flag-icons')
-rw-r--r-- | misc/flag-icons/Makefile | 37 | ||||
-rw-r--r-- | misc/flag-icons/distinfo | 3 | ||||
-rw-r--r-- | misc/flag-icons/files/makeflags.sh | 67 | ||||
-rw-r--r-- | misc/flag-icons/pkg-descr | 2 |
4 files changed, 109 insertions, 0 deletions
diff --git a/misc/flag-icons/Makefile b/misc/flag-icons/Makefile new file mode 100644 index 000000000000..21cf09b196fc --- /dev/null +++ b/misc/flag-icons/Makefile @@ -0,0 +1,37 @@ +PORTNAME= flag-icons +PORTVERSION= 7.3.2 +DISTVERSIONPREFIX= v +CATEGORIES= misc + +MAINTAINER= danfe@FreeBSD.org +COMMENT= Curated collection of all country flags rendered in PNG +WWW= https://flagicons.lipis.dev/ + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE + +BUILD_DEPENDS= convert:graphics/ImageMagick6 # ${IMAGEMAGICK_DEFAULT} + +USE_GITHUB= yes +GH_ACCOUNT= lipis + +NO_ARCH= yes +NO_INSTALL= yes + +FLAGS_TOPDIR= ${PREFIX}/share/icons/${PORTNAME} +FLAG_SIZES= 16 24 32 48 64 96 128 192 256 # 512 adds 25+ MB for .tbz package + +FLAVORS= plain bordered rounded + +.if ${FLAVOR:U:Nplain} +PKGNAMESUFFIX= -${FLAVOR} +.endif + +do-build: + cd ${BUILD_WRKSRC}/flags && ${SH} ${FILESDIR}/makeflags.sh \ + ${FLAVOR} ${STAGEDIR}${FLAGS_TOPDIR}/${FLAVOR} ${FLAG_SIZES} + +post-stage: + cd ${STAGEDIR}${PREFIX} && ${FIND} share -type f >> ${TMPPLIST} + +.include <bsd.port.mk> diff --git a/misc/flag-icons/distinfo b/misc/flag-icons/distinfo new file mode 100644 index 000000000000..4635639281ae --- /dev/null +++ b/misc/flag-icons/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1737122630 +SHA256 (lipis-flag-icons-v7.3.2_GH0.tar.gz) = 6a5497e1029e66415c3941a5e5ee001944b0a7e46bf365c6d5a91a033acee87e +SIZE (lipis-flag-icons-v7.3.2_GH0.tar.gz) = 1322290 diff --git a/misc/flag-icons/files/makeflags.sh b/misc/flag-icons/files/makeflags.sh new file mode 100644 index 000000000000..160212b7c673 --- /dev/null +++ b/misc/flag-icons/files/makeflags.sh @@ -0,0 +1,67 @@ +simple() +{ + local comment convert_extra_args destdir height ratio subdir t0 width + + comment=$1; convert_extra_args=$2; destdir=$3; shift 3 + + for subdir in ?x?; do + ratio=${subdir%x*}/${subdir#*x} + for height; do + width=$((height * $ratio)) + mkdir -p "$destdir/${width}x${height}" + 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 \ + "$flag" "$destdir/${width}x${height}/$(basename "$flag" svg)png" + done + echo "finished in $(date -ur $((`date +%s`-t0)) +%M:%S)" + done + done +} + +plain() +{ + simple undecorated -strip "$@" +} + +bordered() +{ + simple black-bordered '-shave 1x1 -bordercolor black -border 1 -strip' "$@" +} + +# https://joeldare.com/rounding-image-corners-with-imagemagick +rounded() +{ + local destdir height mask radius ratio subdir t0 width + + destdir=$1; shift + mask=$(mktemp) + + for subdir in ?x?; do + ratio=${subdir%x*}/${subdir#*x} + for height; do + width=$((height * $ratio)) + radius=$((height / 10)) + + convert -size ${width}x${height} xc:none -draw \ + "roundRectangle 0,0,$((width-1)),$((height-1)),$radius,$radius" \ + -strip "png:$mask" + + mkdir -p "$destdir/${width}x${height}" + + echo -n "Generating rounded corner flags ${width}x${height}... " + t0=$(date +%s) + for flag in $subdir/*.svg; do + convert -resize ${width}x${height} \ + "$flag" -matte "$mask" \ + -compose DstIn -composite -strip \ + "$destdir/${width}x${height}/$(basename "$flag" svg)png" + done + echo "finished in $(date -ur $((`date +%s`-t0)) +%M:%S)" + done + done + rm "$mask" +} + +"$@" diff --git a/misc/flag-icons/pkg-descr b/misc/flag-icons/pkg-descr new file mode 100644 index 000000000000..c1cedd032cda --- /dev/null +++ b/misc/flag-icons/pkg-descr @@ -0,0 +1,2 @@ +A curated collection of all country flags in 4x3 and 1x1 formats +converted from SVG to PNG for various sizes, from 16px to 256px. |