Skip to content

Instantly share code, notes, and snippets.

@jgottula
Created December 23, 2019 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgottula/0397ade6735a1a191bc7a81c7f26e94f to your computer and use it in GitHub Desktop.
Save jgottula/0397ade6735a1a191bc7a81c7f26e94f to your computer and use it in GitHub Desktop.
Build time reduction via parallelization for AUR package: tango-icon-theme-extras
--- Makefile.am.slow_and_horrible 2006-01-10 14:22:35.000000000 -0800
+++ Makefile.am.fast_and_awesome 2019-12-22 15:54:39.516918706 -0800
@@ -32,8 +32,6 @@
if ENABLE_ICON_FRAMING
$(mkinstalldirs) $(DESTDIR)$(themedir)/24x24/$(context)
(cd $(DESTDIR)$(themedir) && \
- for icon in $(icons_DATA); do \
- $(CONVERT) $(size)/$(context)/$$icon 24x24/$(context)/$$icon; \
- done)
+ parallel --will-cite -- $(CONVERT) $(size)/$(context)/{} 24x24/$(context)/{} ::: $(icons_DATA))
(cd $(DESTDIR)$(themedir)/24x24 && $(ICONMAP) -c $(context))
endif
--- Makefile.am.slow_and_horrible 2006-01-10 14:22:32.000000000 -0800
+++ Makefile.am.fast_and_wonderful 2019-12-22 15:51:55.070733552 -0800
@@ -33,8 +33,6 @@
for i in 32 48 64 72 96 128; do \
pngdir="$(DESTDIR)$(themedir)/$${i}x$${i}/$(context)"; \
$(mkinstalldirs) $$pngdir; \
- for icon in $(icons_DATA); do \
- $(top_builddir)/svg2png.sh $$i $$pngdir $$icon; \
- done; \
+ parallel --will-cite -- $(top_builddir)/svg2png.sh $$i $$pngdir {} ::: $(icons_DATA); \
(cd $(DESTDIR)$(themedir)/$${i}x$${i} && $(ICONMAP) -c $(context)); \
done
--- PKGBUILD.original 2019-12-22 15:46:17.584465748 -0800
+++ PKGBUILD.parallel 2019-12-22 15:58:51.409844193 -0800
@@ -3,25 +3,41 @@
# Contributor: Thayer Williams <thayer at archlinux dot org>
# Contributor: James Rayner <james at archlinux dot org>
# Contributor: William Rea <sillywilly at gmail dot com>
+# Contributor: Justin Gottula <justin@jgottula.com>
pkgname=tango-icon-theme-extras
pkgver=0.1.0
-pkgrel=7
+pkgrel=8
pkgdesc="Extra icons for Tango"
arch=('any')
url="http://tango.freedesktop.org"
license=('CCPL:by-sa')
depends=('tango-icon-theme')
-makedepends=('imagemagick' 'icon-naming-utils')
+makedepends=('imagemagick' 'icon-naming-utils' 'parallel')
options=(!strip !zipman)
source=(${url}/releases/${pkgname}-${pkgver}.tar.gz
- rsvg.patch)
+ rsvg.patch
+ convert-parallel-scalable.patch
+ convert-parallel-22x22.patch)
md5sums=('caaceaec7b61f1cbda0db9842f9db281'
- '80790fcc8c4f26269be53960c4c39cb9')
+ '80790fcc8c4f26269be53960c4c39cb9'
+ 'ffba2bea0d7108de73519dd5366402c9'
+ 'a09bd4446992e74366750fa935047338')
prepare() {
cd ${pkgname}-${pkgver}
patch -p0 < "${srcdir}/rsvg.patch"
+
+ # patch the makefiles so they will run parallel instances of ImageMagick,
+ # instead of painfully running convert instances serially one-file-at-a-time
+ # (DRAMATIC reduction in package build time for multi-core machines!)
+ for file in scalable/*/Makefile.am; do
+ patch -uN $file "${srcdir}/convert-parallel-scalable.patch"
+ done
+ for file in 22x22/*/Makefile.am; do
+ patch -uN $file "${srcdir}/convert-parallel-22x22.patch"
+ done
+
autoreconf -fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment