diff --git a/srcpkgs/xlunch/INSTALL b/srcpkgs/xlunch/INSTALL
new file mode 100644
index 00000000000..6e180ef88f0
--- /dev/null
+++ b/srcpkgs/xlunch/INSTALL
@@ -0,0 +1,34 @@
+# This file is originally called 'genconf' in the src, but it needs to
+# run on the machine that this actually gets installed on, so it will
+# be an install script here...
+
+case "$ACTION" in
+    pre)
+    ;;
+    post)
+        APPS=/usr/share/applications
+        ICONS=/usr/share/icons/hicolor
+        SIZE=48
+
+        echo "generating config file from $APPS ..." >&2
+
+
+        find $APPS | fgrep .desktop | while read DESKTOPFILE; do
+            NAME="$(cat $DESKTOPFILE | egrep -i "^Name=" | head -n 1 | cut -d "=" -f 2-)"
+            EXEC="$(cat $DESKTOPFILE | egrep -i "^Exec=" | head -n 1 | cut -d "=" -f 2-)"
+            ICON="$(cat $DESKTOPFILE | egrep -i "^Icon=" | head -n 1 | cut -d "=" -f 2-)"
+            TERM="$(cat $DESKTOPFILE | egrep -i "^Terminal=" | head -n 1 | cut -d "=" -f 2-)"
+
+            if [ "$TERM" = "true" ]; then
+                EXEC="xterm -e ""$EXEC"
+            fi
+
+            if [ "$ICON" != "" ]; then
+                ICON=$(find "$ICONS" | grep $SIZE"x"$SIZE | grep $ICON"[.]png" | head -n 1)
+                if [ "$ICON" != "" -a "$EXEC" != "" -a "$NAME" != "" ]; then
+                    echo "$NAME;$ICON;$EXEC"
+                fi
+            fi
+        done | sort | uniq > etc/xlunch/icons.conf
+        ;;
+esac
diff --git a/srcpkgs/xlunch/patches/ldflags.patch b/srcpkgs/xlunch/patches/ldflags.patch
new file mode 100644
index 00000000000..b80b8ba80c9
--- /dev/null
+++ b/srcpkgs/xlunch/patches/ldflags.patch
@@ -0,0 +1,9 @@
+--- Makefile.orig	2017-05-16 00:48:25.302317545 -0500
++++ Makefile	2017-05-16 00:47:47.801022135 -0500
+@@ -1,5 +1,5 @@
+ CC = gcc
+-LDFLAGS = -lImlib2 -lX11
++override LDFLAGS += -lImlib2 -lX11
+ CFLAGS ?= -O2 -s
+ 
+ all: xlunch icons.conf
diff --git a/srcpkgs/xlunch/patches/musl.patch b/srcpkgs/xlunch/patches/musl.patch
new file mode 100644
index 00000000000..777d18c35fb
--- /dev/null
+++ b/srcpkgs/xlunch/patches/musl.patch
@@ -0,0 +1,12 @@
+--- xlunch.c.orig	2017-05-17 21:38:59.048445309 -0500
++++ xlunch.c	2017-05-17 21:39:41.334944291 -0500
+@@ -27,6 +27,9 @@
+ #include <sys/file.h>
+ #include <errno.h>
+ 
++/* file I/O stuff */
++#include <fcntl.h>
++
+ /* some globals for our window & X display */
+ Display *disp;
+ Window   win;
diff --git a/srcpkgs/xlunch/template b/srcpkgs/xlunch/template
new file mode 100644
index 00000000000..4ac14eba74b
--- /dev/null
+++ b/srcpkgs/xlunch/template
@@ -0,0 +1,12 @@
+# Template file for 'xlunch'
+pkgname=xlunch
+version=2.4.2
+revision=1
+build_style=gnu-makefile
+makedepends="libX11-devel imlib2-devel"
+short_desc="Graphical app launcher for X with little dependencies"
+maintainer="Michael Aldridge <aldridge.mac@gmail.com>"
+license="GPL-3"
+homepage="http://xlunch.org/"
+distfiles="https://github.com/Tomas-M/xlunch/archive/v${version}.tar.gz"
+checksum=daedfeba280ed5748e4ab77c82baf147236211d0a70501ba6eca3c4729face34