code:
[deps]
xproto
libx11
xextproto
scrnsaverproto

[vars]
filesize=290437
sha512=973aed3ad296c7160b66fccd4fff7375afc4332239acbe0ae1644fed9c453de69040f8174882ba264c731448edba9b499d398d013d556aea72434339399ed29f

[mirrors]
http://xorg.freedesktop.org/releases/individual/lib/libXScrnSaver-1.2.2.tar.bz2

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') --with-sysroot=$butch_root_dir"
CFLAGS="$optcflags" LDFLAGS="$optldflags" \
  ./configure -C --prefix="$butch_prefix" $xconfflags \
  --disable-static

patch -p1 < "$K"/libtool-sysroot.patch

make V=1 DESTDIR="$butch_install_dir" -j$MAKE_THREADS install

path: pkg/libxscrnsaver


code:
[mirrors]
http://xorg.freedesktop.org/releases/individual/lib/libxshmfence-1.1.tar.bz2

[vars]
filesize=291347
sha512=ed3aae4a44849c11ce041df53d47667606dba5357059c13d5c0989205df57dfa626598db6ad66432114a80e69ab4118fb067877ea275897aab64d4bbf9bcd346

[deps]

[build]

[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine) \
  --with-sysroot=$butch_root_dir"

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" CXXFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" --disable-nls $xconfflags

#[ -n "$CROSS_COMPILE" ] && "$K"/libtool.cross.gen --sysroot="$butch_root_dir"

make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

repo_name: aarf/bkauler

path: pkg/libxshmfence

license: unknown


code:
[mirrors]
http://xmlsoft.org/sources/libxslt-1.1.28.tar.gz

[vars]
filesize=3435907
sha512=20b65bdaceaac5bd11d509bf683ce8e344030bc95164639266ae705d41659bcba47b5be1b059d0d67681e6428b0710db675d1749c06aa531bc2212ed3d0511b1

[deps]
libxml2

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') --with-sysroot=$butch_root_dir"
CFLAGS=-D_GNU_SOURCE ./configure -C --prefix="$butch_prefix" \
  --without-python --without-crypto $xconfflags
make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/libxslt


code:
[deps]
libsm
libice
libx11

[vars]
filesize=762331
sha512=57721def16bf29e05deb746566400d71cf0cd5bf9b8b7ebed19abb7c6804e14073060b6cf94409903aa464d27acca2e91f55654b2d4770677b2b4b4dc78fd423

[mirrors]
http://xorg.freedesktop.org/releases/individual/lib/libXt-1.1.4.tar.bz2

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine) --with-sysroot=$butch_root_dir"
CFLAGS="$optcflags" LDFLAGS="$optldflags" \
  ./configure -C --prefix="$butch_prefix" $xconfflags
make DESTDIR="$butch_install_dir" -j$MAKE_THREADS install

path: pkg/libxt


code:
[deps]
recordproto
xproto
libx11

[vars]
filesize=321784
sha512=1cf040f16d426e6a6d1cf8c0f966c171418c082165ae6e9bed6285cd45f144e4ef58bf74c6d34fd81e6894534d21df55efe5d0bc0b2a28f9bb9d74e168dd7369

[mirrors]
http://xorg.freedesktop.org/releases/individual/lib/libXtst-1.2.2.tar.bz2

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine) --with-sysroot=$butch_root_dir"
CFLAGS="$optcflags" LDFLAGS="$optldflags" \
  ./configure -C --prefix="$butch_prefix" $xconfflags \
  ac_cv_func__XEatDataWords=yes
make V=1 DESTDIR="$butch_install_dir" -j$MAKE_THREADS install

path: pkg/libxtst


code:
[deps]
xproto
libx11
videoproto

[vars]
filesize=300633
sha512=3c9642006dbc7a74f91263aa3a94711a95ee436b03d97ef51fce2bc2f602c25589606e1fcb58287ea0efebb3b9dbe7ef5fcb94e11ad3ec6be7830947a4cefe03

[mirrors]
http://xorg.freedesktop.org/releases/individual/lib/libXv-1.0.10.tar.bz2

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine) --with-sysroot=$butch_root_dir"
CFLAGS="$optcflags" LDFLAGS="$optldflags" \
  ./configure -C --prefix="$butch_prefix" $xconfflags
make DESTDIR="$butch_install_dir" -j$MAKE_THREADS install

path: pkg/libxv


code:
[deps]
xproto
libx11
libxv

[vars]
filesize=305234
sha512=781a53ad1d60a06019ed24150b85a96f2608e6ca0d876de9f06511c0e086cdf837804994e33b51ee8b3714150dc1d6060449e89ab7458476c8535b5b336147bf

[mirrors]
http://xorg.freedesktop.org/releases/individual/lib/libXvMC-1.0.8.tar.bz2

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine) --with-sysroot=$butch_root_dir"
CFLAGS="$optcflags" LDFLAGS="$optldflags" \
  ./configure -C --prefix="$butch_prefix" $xconfflags \
  ac_cv_func__XEatDataWords=yes
make V=1 DESTDIR="$butch_install_dir" -j$MAKE_THREADS install

path: pkg/libxvmc


code:
[vars]
filesize=280216
sha512=58d81a7850275fc8382018bcc56dbc65b4200828b1f1379dcee3da1878f12a83ee681a9d474bcd564d99bf93bedfeb7b243370e0ebb89177652b37cee158a3f2

[mirrors]
http://xorg.freedesktop.org/releases/individual/lib/libXxf86dga-1.1.4.tar.bz2

[deps]
libxext
xf86dgaproto
xf86vidmodeproto

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine) --with-sysroot=$butch_root_dir"
CFLAGS="$optcflags -D_GNU_SOURCE" LDFLAGS="$optldflags" \
  ./configure -C --prefix="$butch_prefix" $xconfflags \
  ac_cv_func__XEatDataWords=yes
make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install


code:
[vars]
filesize=284279
sha512=7cd5491b79920f9c1d134f2815f14d45b0a29cf5f99d866c35418b6f84ce6b48e702db3472bd7c6158804e573f2384ad4ebee78e5ea8f07afec2e34489d99ed4

[mirrors]
http://xorg.freedesktop.org/releases/individual/lib/libXxf86vm-1.1.3.tar.bz2

[deps]
libxext
xf86vidmodeproto

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine) --with-sysroot=$butch_root_dir"
CFLAGS="$optcflags -D_GNU_SOURCE" LDFLAGS="$optldflags" \
  ./configure -C --prefix="$butch_prefix" $xconfflags \
  ac_cv_func__XEatDataWords=yes
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install


code:
[mirrors]
https://github.com/lloyd/yajl/archive/2.0.4.tar.gz

[vars]
filesize=82793
sha512=d89e0fcd42fc77e2b3aad82248e6cc198ca49c39e226d683ae5fe2278d87841317f25c2b5071027044d0cfc1097691ea7e912fd417e2d7cec42291359b8d86d7
tardir=yajl-2.0.4
tarball=yajl-2.0.4.tar.gz

[deps.host]
ruby
cmake

[build]
patch -p1 < "$K"/yajl-test.patch

CFLAGS="-D_GNU_SOURCE $optcflags" LDFLAGS="$optldflags" \
  ./configure --prefix="$butch_prefix"

sed -i 's@all: distro doc test@all: distro@' Makefile

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install
dest="$butch_install_dir""$butch_prefix"
mkdir -p "$dest"/lib/pkgconfig
mv "$dest"/share/pkgconfig/* "$dest"/lib/pkgconfig/
rm -rf "$dest"/share/pkgconfig

path: pkg/libyajl


code:
[mirrors]
http://sortix.org/libz/release/libz-1.2.8.2015.12.26.tar.gz

[vars]
filesize=135668
sha512=20398a642acef402d59301dbffb7c1864d28214f8dddcb5403ae50071b1ebd3c0dc1df5b0e567443ad3813ba9d11bd0da1eeb36db3dcafc48f098a6dd6cd5a54

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine)"

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure --prefix="$butch_prefix" $xconfflags

make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/libz


code:
[mirrors]
http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.33.tar.xz
[vars]
filesize=555248
sha512=120720ed9c6e0fe2639d6908214c96e352cde6ea0639857ab326c0b4b3890824ddb06a5384985c551a5e84b619ea91777a5b3836ab4ee91cdccebe355341ece2

[deps]
libressl
bzip2
pcre

[build]
printf "all:\n\ttrue\n\ninstall:\n\ttrue\n\n" > tests/Makefile.in
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine) --with-sysroot=$butch_root_dir"
CFLAGS="-D_GNU_SOURCE -DUIO_MAXIOV=1024 $optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" $xconfflags
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/lighttpd


code:
[vars]
filesize=328443
sha512=52d105c9543b3ee27ea16026339b58d8b65643ae4f54f19f90f41681bd7902be237ef126edf9dc6a12a26373f7d69eb51b4849dbef07e28ef2043de02819a221
desc="LilyTerm is a terminal emulator based off of libvte that aims to be fast and lightweight, Licensed under GPLv3."

[mirrors]
http://lilyterm.luna.com.tw/file/lilyterm-0.9.9.2.tar.gz

[deps]
vte2
gtk+2

[build]
[ -n "$CROSS_COMPILE" ] && {
	sed -i 's@conf:@conf:\n\ttouch lilyterm.conf\n\nfoo:@' data/Makefile
	echo "WARNING: lilyterm.conf needs to be generated on the target"
	echo "by doing lilyterm -p > lilyterm.conf"
}

CFLAGS="$optcflags $optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" --disable-nls

make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/lilyterm


code:
[deps.host]
bash
git

[build]
url=https://kernel.googlesource.com/pub/scm/linux/kernel/git/firmware/linux-firmware.git
url=git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git

dest="$S/build/linux-firmware-git"
mkdir -p "$dest"
if [ -d "$dest/linux-firmware" ]; then
	cd "$dest/linux-firmware"
	git pull
else
	cd "$dest"
	git clone --depth=1 "$url"
	cd linux-firmware
fi
make SHELL=/bin/bash DESTDIR="$butch_install_dir" install

path: pkg/linux-firmware-git


code:
[mirrors]
http://llvm.org/releases/3.4/llvm-3.4.src.tar.gz

[vars]
filesize=15920544
sha512=4ccd8c4fc15dd9abc43f93b62f0b1349c419a2afeba05304fa98c157325e31dbbdb1587afc18d0a3f5dba14c95d64a3d40a825efe89ddf6f93fa96002496675c
tardir=llvm-3.4

[deps.host]
cmake

[deps]
libffi
clang34
compiler-rt34

[build]
tar xf "$C"/clang-3.4.src.tar.gz
mv ./clang-3.4 ./tools/clang
tar xf "$C"/compiler-rt-3.4.src.tar.gz
mv ./compiler-rt-3.4 ./projects/compiler-rt

patch -p1 < "$K"/llvm34.patch
patch -p1 < "$K"/llvm34-dynlinker.patch

conflags='--enable-libffi --enable-optimized --enable-shared
	--disable-docs --enable-targets=all --prefix='"$butch_prefix"
if [ ! -z "$DEBUGBUILD" ] ; then
	conflags='--enable-debug-runtime --enable-debug-symbols
	--enable-keep-symbols --enable-libffi --enable-optimized
	--enable-shared --disable-docs --enable-targets=all --prefix='"$butch_prefix"
fi
./configure $conflags

# For whatever reason, PROJ_INSTALL_ROOT doesn't get defined when building sample.
sed -i '/$(error Projects must define PROJ_INSTALL_ROOT)/c\
PROJ_INSTALL_ROOT := '"$butch_install_dir"'' ./projects/sample/Makefile.llvm.config

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install


code:
[mirrors]
http://ftp.u-strasbg.fr/securite/lsof/lsof_4.89.tar.bz2

[vars]
filesize=784560
sha512=cafb0209143c7863e5cebe7efc33a2520d36f9e26222350e4edfa18debbcfb5c81f42f71469e5913fb21f49a7562bbe761b72dfc8f297dadf75ac619cdcb318c
desc='lists open files and sockets'

[build]
tar xf lsof_4.89_src.tar && cd lsof_4.89_src

patch -p1 < "$K"/lsof-rpc-configure.patch
patch -p1 < "$K"/lsof-Makefile.patch
patch -p1 < "$K"/lsof-dsock.patch

./Configure -n linux

make -j$MAKE_THREADS CC="$CC" CDEF="$optcflags" \
  LDFLAGS="$optldflags -static"

dest="$butch_install_dir""$butch_prefix"
install -D -m 755 lsof "$dest"/bin/lsof && \
install -D -m 644 lsof.8 "$dest"/share/man/man8

path: pkg/lsof


code:
[mirrors]
http://www.lua.org/ftp/lua-5.2.4.tar.gz

[vars]
filesize=252651
sha512=cd77148aba4b707b6c159758b5e8444e04f968092eb98f6b4c405b2fb647e709370d5a8dcf604176101d3407e196a7433b5dcdce4fe9605c76191d3649d61a8c

[deps]
readline

[build]
sed -i "s@#define LUA_ROOT\t"'"/usr/local/"@#define LUA_ROOT "/"@' src/luaconf.h
sed -i 's@INSTALL_TOP= /usr/local@INSTALL_TOP='"$butch_install_dir""$butch_prefix"'@' Makefile

make \
  CC="$CC" \
  -j$MAKE_THREADS \
  MYCFLAGS="-fPIC $optcflags" \
  MYLDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  linux
make INSTALL_TOP="$butch_install_dir""$butch_prefix" install
dest="$butch_install_dir""$butch_prefix"
mkdir -p "$dest"/lib/pkgconfig
for subver in 1 2 ; do
cat << EOF > "$dest"/lib/pkgconfig/lua-5.${subver}.pc
majver=5
minver=$subver
relver=0
version=\${majver}.\${minver}.\${relver}
abiver=5.$subver

prefix=$butch_prefix
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
libname=lua
includedir=\${prefix}/include

INSTALL_LMOD=\${prefix}/share/lua/\${abiver}
INSTALL_CMOD=${prefix}/lib/lua/${abiver}

Name: lua
Description: Just-in-time compiler for Lua
URL: http://luajit.org
Version: \${version}
Requires:
Libs: -L\${libdir} -l\${libname}
Libs.private: -Wl,-E -lm -ldl
Cflags: -I\${includedir}

EOF
done

path: pkg/lua


code:
[mirrors]
http://luajit.org/download/LuaJIT-2.0.3.tar.gz

[vars]
filesize=844927
sha512=7b3e3de22ac3602299b5918b60801e45a3278e547a15c16fdae7359538d4ada27ba664935d5f97c7409f330c2f8efeaae9ea03415f5e9d5a9d81e022cd5d36e0

[deps]

[build]
sed -i 's,export PREFIX=,-include config.mak #,' Makefile
echo "export PREFIX = $butch_prefix" > config.mak
echo "export DESTDIR = $butch_install_dir" >> config.mak
make CFLAGS=-D_GNU_SOURCE Q= -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

dest="$butch_install_dir""$butch_prefix"

if [ -n "$LUAJIT_REPLACE_LUA" ] ; then

mkdir -p "$dest"/include/lua
( cd "$dest"/include/luajit-2.0/
  for i in *.h ; do
	ln -sf ../luajit-2.0/"$i" "$dest"/include/lua/
  done
)

ln -s libluajit-5.1.so.2.0.2 "$dest"/lib/liblua.so
ln -s libluajit-5.1.a "$dest"/lib/liblua.a
ln -s libluajit-5.1.so.2.0.2 "$dest"/lib/libluajit-5.1.so.2
ln -s libluajit-5.1.so.2.0.2 "$dest"/lib/libluajit-5.1.so

cat << EOF > "$dest"/lib/pkgconfig/lua.pc
majver=5
minver=1
relver=0
version=\${majver}.\${minver}.\${relver}
abiver=5.1

prefix=$butch_prefix
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
libname=lua
includedir=\${prefix}/include/lua

INSTALL_LMOD=\${prefix}/share/lua/\${abiver}
INSTALL_CMOD=${prefix}/lib/lua/${abiver}

Name: lua
Description: Just-in-time compiler for Lua
URL: http://luajit.org
Version: \${version}
Requires:
Libs: -L\${libdir} -l\${libname}
Libs.private: -Wl,-E -lm -ldl
Cflags: -I\${includedir}

EOF

fi

path: pkg/luajit


code:
[mirrors]
http://downloads.sourceforge.net/project/v4l-lib/Luvcview/luvcview-20070512.tar.gz

[vars]
filesize=89405
sha512=2efd7221fb6edbdc327b79859b0f2e33f87574f7201a62d1b6b0a32d3cfd48281943744a7e3c752096af3f1fcc0f3b0631e9ac378f60ffd323bfe72c0d4c273d

[deps]
sdl

[build]
sed -i 's@linux/videodev.h@linux/videodev2.h@g' *.[ch]
make V=1 -j$MAKE_THREADS BIN="$butch_prefix"/bin \
  SDLLIBS=-lSDL SDLFLAGS= CFLAGS="-DVERSION=\\\"0.2.1\\\" -D_GNU_SOURCE $optcflags $optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib"
install -Dm 755 luvcview "$butch_install_dir$butch_prefix"/bin/luvcview

path: pkg/luvcview


code:
[mirrors]
ftp://sources.redhat.com/pub/lvm2/releases/LVM2.2.02.152.tgz
http://mirrors.kernel.org/sources.redhat.com/lvm2/releases/LVM2.2.02.152.tgz
ftp://mirrors.kernel.org/sources.redhat.com/lvm2/releases/LVM2.2.02.152.tgz

[vars]
filesize=2008985
sha512=44ebf79ee90f371835d9525db09e98e439ca5a6fcec4bfe4cb790df4c11e32e6dc4abea6a60e2f4f5a5e85c635354f10cc4d5ad04bbbf21653a357ca581defac

[deps]
kernel-headers

[build]
for i in stdio mallinfo libdir-config mlockall-config ; do
	echo lvm2-$i.patch
	patch -p1 < "$K"/lvm2-$i.patch
done

[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/')"
CFLAGS="-D_GNU_SOURCE $optcflags" LDFLAGS="$optldflags"
  ./configure -C --prefix="$butch_prefix" $xconfflags \
  --disable-readline

# since musl's BRE regex engine is now sufficiently glibc-compatible,
# the versioning nonsense in the .export.sym linker script is now correctly
# generated. needs rebuild of busybox against latest musl.

# there is something fishy with install-sh, however it seems to work anyway:
# http://www.redhat.com/archives/linux-lvm/2013-January/msg00038.html

# make doesnt work, only make install does
make -j$MAKE_THREADS DESTDIR="$butch_install_dir" install

path: pkg/lvm


code:
[mirrors]
http://kent.dl.sourceforge.net/project/lxde/LXAppearance/lxappearance-0.5.2.tar.gz
http://switch.dl.sourceforge.net/project/lxde/LXAppearance/lxappearance-0.5.2.tar.gz

[vars]
filesize=278331
sha512=b08adf0cb9e5d3efe2d6be05c3fef99f18be6b4f85497951c111fde76010351b6265ea162acd8920ebb382c660d29d45a0a0bf601757d29739c8394b1328c0d5

[deps]
gtk+2
intltool

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/')"
CFLAGS="$optcflags -D_GNU_SOURCE" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" $xconfflags
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/lxappearance


code:
[mirrors]
http://kent.dl.sourceforge.net/project/lxde/LXAppearance%20Obconf/lxappearance-obconf-0.2.0.tar.gz
http://switch.dl.sourceforge.net/project/lxde/LXAppearance%20Obconf/lxappearance-obconf-0.2.0.tar.gz

[vars]
filesize=414949
sha512=51635e37a5d0e13cc6cc3ee8c7361239b7984d25233358e73684ebe475671012d698141508f373e368d999ed120ce0b8b2ba0642b20b025382b8d439b5ebe348

[deps]
lxappearance

[build]
# TODO
exit 1
CFLAGS=-D_GNU_SOURCE ./configure -C --prefix="$butch_prefix"
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/lxappearance-obconf


code:
[mirrors]
https://linuxcontainers.org/downloads/lxc-1.1.0.tar.gz
http://pkgs.fedoraproject.org/repo/extras/lxc/lxc-1.1.0.tar.gz/ab1cbabf859abc15165050c854979c5c/lxc-1.1.0.tar.gz
[vars]
filesize=833398
sha512=1df418ae8a49a36df169191855244500b3b1361ab852a0b0b07ce992fb6e3c914962af81d1555ad5a9cbbc53560be9c4e6db69765b5bd93b3687fde8ca7d53ae

[deps]
libcap2
bash
debootstrap
rsync
seccomp

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/')"
CFLAGS="$optcflags" LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
   ./configure -C --prefix="$butch_prefix" \
            --bindir="$butch_prefix"/bin \
            --sbindir="$butch_prefix"/bin \
            --with-usernic-db=/var/run/lxc/nics \
            --with-runtime-path=/var/run \
            $xconfflags

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install
install -D -m 660 "$K"/lxc-debian.X.common.conf $butch_install_dir/share/lxc/config/debian.X.common.conf
install -D -m 750 "$K"/lxc-autodev-X $butch_install_dir/share/lxc/hooks/autodev-debian.X

path: pkg/lxc


code:
[deps]
xorg
openbox
obconf
gpicview
menu-cache
lxappearance
lxde-common
lxde-icon-theme
lxdm
lxpanel
lxinput
lxmenu-data
lxrandr
lxsession
lxsession-edit
lxshortcut
lxtask
lxterminal
leafpad
pcmanfm
xarchiver
hicolor-icon-theme-fake

path: pkg/lxde


code:
[mirrors]
http://kent.dl.sourceforge.net/project/lxde/lxde-common%20%28default%20config%29/LXDE%20Common%200.5.5/lxde-common-0.5.5.tar.gz
http://switch.dl.sourceforge.net/project/lxde/lxde-common%20%28default%20config%29/LXDE%20Common%200.5.5/lxde-common-0.5.5.tar.gz

[vars]
filesize=899075
sha512=44848286ccf3aa269df1680e14a8d3c41be1c2af956bd5121fc05d97a892fdc13d1e74191a2a11a40e96a8f31f8be37b1cfb9afeac4474fcab88d07508647c7f

[deps]

[build]
patch -p1 < "$K"/openbox-config.patch
CFLAGS=-D_GNU_SOURCE ./configure -C --prefix="$butch_prefix"
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install
dest="$butch_install_dir""$butch_prefix"
cp -f "$K"/sabotage-menu.png  "$dest"/share/lxde/images/
cp -f "$K"/panel "$dest"/share/lxpanel/profile/LXDE/panels/panel

path: pkg/lxde-common


code:
[mirrors]
http://kent.dl.sourceforge.net/project/lxde/LXDE%20Icon%20Theme/lxde-icon-theme-0.5.0/lxde-icon-theme-0.5.0.tar.bz2
http://switch.dl.sourceforge.net/project/lxde/LXDE%20Icon%20Theme/lxde-icon-theme-0.5.0/lxde-icon-theme-0.5.0.tar.bz2

[vars]
filesize=4545598
sha512=4ca3e94b5826f7fe87d840feddf0c130fa77e8f14f22a59d9749252a5106d54661237e3c9286f4880d0aaa50bd330cb4bfb9d663ca35d6ee4b9e3c2af30fe9ab

[deps]

[build]
CFLAGS=-D_GNU_SOURCE ./configure -C --prefix="$butch_prefix"
sed -i 's@--no-preserve=ownership@@g' Makefile

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/lxde-icon-theme


code:
[mirrors]
http://kent.dl.sourceforge.net/project/lxde/lxdm/LXDM%200.4.1/lxdm-0.4.1.tar.gz
http://switch.dl.sourceforge.net/project/lxde/lxdm/LXDM%200.4.1/lxdm-0.4.1.tar.gz

[vars]
filesize=296714
sha512=8ed4a955a910def4db66958d1cb24976db178b8763199a024b6c2119894745e3646566c42d01472dffbbcbb7fd21784b01e74dc88038e01caebaa3b6d720ff27

[deps]
glib
gdk-pixbuf
gtk+2
intltool

[build]
patch -p1 < "$K"/lxdm-backtrace.patch
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/')"
CFLAGS="$optcflags -D_GNU_SOURCE" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" $xconfflags

for i in po ; do
	printf 'all:\n\ttrue\ninstall:\n\ttrue\clean:\n\ttrue\n' > "$i"/Makefile
done

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/lxdm


code:
[mirrors]
http://kent.dl.sourceforge.net/project/lxde/LXInput%20%28Kbd%20and%20amp_%20mouse%20config%29/LXInput%200.3.2/lxinput-0.3.2.tar.gz
http://switch.dl.sourceforge.net/project/lxde/LXInput%20%28Kbd%20and%20amp_%20mouse%20config%29/LXInput%200.3.2/lxinput-0.3.2.tar.gz

[vars]
filesize=259203
sha512=50921151d3050fae1e4640aade2b0bf88d94445f95e18c21c3d67a012ec7d33b6b9dada8574898d915a350c37fcd568f376bafff1b804e222543a5cadf87431a

[deps]
gtk+2
intltool

[build]
[ -n "$CROSS_COMPILE" ] && xconfflags="--host=$($CC -dumpmachine)"
CFLAGS="$optcflags -D_GNU_SOURCE" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" $xconfflags
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/lxinput


code:
[mirrors]
http://kent.dl.sourceforge.net/project/lxde/lxmenu-data%20%28desktop%20menu%29/lxmenu-data%200.1.2/lxmenu-data-0.1.2.tar.gz
http://switch.dl.sourceforge.net/project/lxde/lxmenu-data%20%28desktop%20menu%29/lxmenu-data%200.1.2/lxmenu-data-0.1.2.tar.gz

[vars]
filesize=298734
sha512=8e18d5a0309d69fbd410f8e3e5393f8a49852c2684aa2d2f0c460cf9e1f0fb88810885551d6b3dee1c6270a2a8a8a14973ca5e72b714898d1b6b9b676e3bf922

[deps]
intltool

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/')"
CFLAGS="$optcflags -D_GNU_SOURCE" LDFLAGS="$optldflags" \
  ./configure -C --prefix="$butch_prefix" --disable-nls $xconfflags
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/lxmenu-data


code:
[mirrors]
http://kent.dl.sourceforge.net/project/lxde/LXPanel%20%28desktop%20panel%29/LXPanel%200.5.10/lxpanel-0.5.10.tar.gz
http://switch.dl.sourceforge.net/project/lxde/LXPanel%20%28desktop%20panel%29/LXPanel%200.5.10/lxpanel-0.5.10.tar.gz

[vars]
filesize=1330296
sha512=52985cffeb2db215f8fb77a9b01e5671c285741a2e333f2b4a630d6b514177dbf6f1ab45449787bb058edbe91d74c0176e7408e9df4144f6746700a44b5b5ac7

[deps]
gtk+2
glib
menu-cache
libwnck
wireless-tools
intltool

[build]
patch -p1 < "$K"/lxpanel-linux.patch
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') --with-sysroot=$butch_root_dir"
CFLAGS="$optcflags -D_GNU_SOURCE -std=gnu89" \
LDFLAGS="$optldflags -lgmodule-2.0 -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" $xconfflags
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/lxpanel


code:
[mirrors]
http://kent.dl.sourceforge.net/project/lxde/LXRandR%20%28monitor%20config%20tool%29/LXRandR%200.1.2/lxrandr-0.1.2.tar.gz
http://switch.dl.sourceforge.net/project/lxde/LXRandR%20%28monitor%20config%20tool%29/LXRandR%200.1.2/lxrandr-0.1.2.tar.gz

[vars]
filesize=230394
sha512=a2131706b1f6febea3cb12758403650700a29ad1fe036caf5ecf962264f6f8180fdef392f88a77071b3d218ea2f08b0a1f66e4d58db6c2c55125d475bdee256a

[deps]
gtk+2
intltool

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/')"
CFLAGS="$optcflags -D_GNU_SOURCE" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" $xconfflags

for i in po ; do
	printf 'all:\n\ttrue\ninstall:\n\ttrue\clean:\n\ttrue\n' > "$i"/Makefile
done

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/lxrandr


code:
[mirrors]
http://kent.dl.sourceforge.net/project/lxde/LXSession%20%28session%20manager%29/LXSession%200.4.6.1/lxsession-0.4.6.1.tar.gz
http://switch.dl.sourceforge.net/project/lxde/LXSession%20%28session%20manager%29/LXSession%200.4.6.1/lxsession-0.4.6.1.tar.gz

[vars]
filesize=407100
sha512=eea554ba70b3fd278b7ce0bb2d278241dff26eaccf74f2a4a0a9846515688fd5dd846c97f29c71139a0c3b95bc5e906efc4673f0cd79d8db427894dff5524f16

[deps]
intltool
gtk+2

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') --with-sysroot=$butch_root_dir"
CFLAGS="$optcflags -D_GNU_SOURCE" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" $xconfflags \
  --disable-dbus

for i in po ; do
	printf 'all:\n\ttrue\ninstall:\n\ttrue\clean:\n\ttrue\n' > "$i"/Makefile
done

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/lxsession


code:
[mirrors]
http://kent.dl.sourceforge.net/project/lxde/LXSession%20Edit/lxsession-edit%200.2.0/lxsession-edit-0.2.0.tar.gz
http://switch.dl.sourceforge.net/project/lxde/LXSession%20Edit/lxsession-edit%200.2.0/lxsession-edit-0.2.0.tar.gz

[vars]
filesize=224146
sha512=6bf039322738502ec92e2d600d98142dafff7caa3e4a45f132cc7f4460985df2351b38fdf57ea214c49311d1b4fd96b79086936fade44fb0316dd013c417ba9f

[deps]
gtk+2
intltool

[build]
[ -n "$CROSS_COMPILE" ] && xconfflags="--host=$($CC -dumpmachine)"
CFLAGS="$optcflags -D_GNU_SOURCE" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" $xconfflags

for i in po ; do
	printf 'all:\n\ttrue\ninstall:\n\ttrue\clean:\n\ttrue\n' > "$i"/Makefile
done

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/lxsession-edit


code:
[mirrors]
http://kent.dl.sourceforge.net/project/lxde/LXShortcut%20%28edit%20app%20shortcut%29/LXShortcut%200.1.2/lxshortcut-0.1.2.tar.gz
http://switch.dl.sourceforge.net/project/lxde/LXShortcut%20%28edit%20app%20shortcut%29/LXShortcut%200.1.2/lxshortcut-0.1.2.tar.gz

[vars]
filesize=224223
sha512=0567c0ee77dbe7ea5f7d23e3ec2d3ba68f458bc9d8e4e5c8764bb53963eecf07d69dee2617f695b8d86dcb71916864c4e01dab12bd4b73db5366aebe24867e0c

[deps]
gtk+2
intltool

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/')"
CFLAGS="$optcflags -D_GNU_SOURCE" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" $xconfflags

for i in po ; do
	printf 'all:\n\ttrue\ninstall:\n\ttrue\clean:\n\ttrue\n' > "$i"/Makefile
done

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/lxshortcut


code:
[mirrors]
http://kent.dl.sourceforge.net/project/lxde/LXTask%20%28task%20manager%29/LXTask%200.1.4/lxtask-0.1.4.tar.gz
http://switch.dl.sourceforge.net/project/lxde/LXTask%20%28task%20manager%29/LXTask%200.1.4/lxtask-0.1.4.tar.gz

[vars]
filesize=241034
sha512=60a9b55880ee0a5b86043edacefb93b83caddbb045e781537b6fd04d2e3259e4fa5117fc84c7f0ca0dd914d9e14b602a9ab0022a74d9b634b72fdf4f950189c5

[deps]
gtk+2
intltool

[build]
patch -p1 < "$K"/lxtask-types.patch
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/')"
CFLAGS="$optcflags -D_GNU_SOURCE" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" $xconfflags

for i in po ; do
	printf 'all:\n\ttrue\ninstall:\n\ttrue\clean:\n\ttrue\n' > "$i"/Makefile
done

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/lxtask


code:
[mirrors]
http://downloads.sourceforge.net/project/lxde/LXTerminal%20%28terminal%20emulator%29/LXTerminal%200.2.0/lxterminal-0.2.0.tar.gz

[vars]
filesize=248698
sha512=5bec0e16fa4d929203e4c206fb59fb0c88e02f29adbf527c31fa2a0007d3dddbdf12f2219e204360b5dd95a68a89410fcf937325f3a7eb1229b568c9c10c0e78
desc='GTK+ terminal emulator'

[deps]
vte2

[build]
#patch -p1 < "$K"/some.patch

[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" CXXFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" --disable-nls $xconfflags

#[ -n "$CROSS_COMPILE" ] && "$K"/libtool.cross.gen --sysroot="$butch_root_dir"

make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/lxterminal


code:
[mirrors]
http://invisible-mirror.net/archives/lynx/tarballs/lynx2.8.9dev.8.tar.bz2

[vars]
filesize=2657804
sha512=f1705e1fde9b97d65fb223ee5606cd1ea0dfd4e536b523eb36e9ef78f0e4b28e84d37dc0d776670d176698cf27344a1e4f27302a8ff78338cd9fe7cf8e4eaee5
desc='terminal web browser. supports HTTPS but not javascript'

[deps]
libressl
curses
ca-certificates

[build]
# fix gnu assumptions
patch -p1 < "$K"/lynx-gzip.patch
sed -i 's/define ACCEPT_ALL_COOKIES FALSE/define ACCEPT_ALL_COOKIES TRUE/' userdefs.h

[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/')"

CFLAGS="-D_GNU_SOURCE -I$butch_root_dir$butch_prefix/include/openssl $optcflags" \
LDFLAGS="$optldflags" \
LIBS="-lcurses -lterminfo -lssl -lcrypto -lz" \
  ./configure -C --prefix="$butch_prefix" --sysconfdir="$butch_prefix"/etc --mandir="$butch_prefix"/share/man \
  --with-ssl --disable-nls --enable-ipv6  $xconfflags
#passing -jXXX to make has no effect on this pkg
make
make DESTDIR="$butch_install_dir" install

path: pkg/lynx


code:
[vars]
filesize=583045
sha512=2369b87627c6f075b58b88189344989969050289185596db1174e6d918baa2b86e6076c8ec9cc68953df10c13bd1145d841603f26bde8a80111fb0d7091bf1c7

[mirrors]
http://www.oberhumer.com/opensource/lzo/download/lzo-2.06.tar.gz

[deps]

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CFLAGS="-fPIC -D_GNU_SOURCE $optcflags" \
  LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" $xconfflags

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/lzo


code:
[mirrors]
http://download.savannah.gnu.org/releases/m2c/0.7/m2c-0.7.tar.gz

[vars]
filesize=212463
sha512=9bcb90e7c5be6713370e3196773a9039a3fa0ffe265e2e42837f371532e9aed62c9bf9ad6fc2fbc54c62ae3ddef17e826e6cb439996d462cd99940eaeb458209

[build]
dest="$butch_install_dir""$butch_prefix"

mkdir -p "$dest"/bin
mkdir -p "$dest"/m2lib
mkdir -p "$dest"/include
mkdir -p "$dest"/man/man1

sed -i -e "s@prefix=/usr/local@prefix=$dest@" Makefile.tmpl

./configure +srcdir=../m2c-0.7 +cc=gcc
make -j$MAKE_THREADS
make install prefix="$dest"


code:
[deps]

[vars]
filesize=1005264
sha512=1123671ab3e0b1b13a4a08035e792a93af0d7d0a5b9027982fe7b5104488a0746906068a0f4774c1f1bc2648ba1bc74d690836e90ff9391464278e4ccbc7edf0
desc='the GNU m4 shellscript macro preprocessor. used heavily by autoconf/make'

[mirrors]
http://ftp.gnu.org/gnu/m4/m4-1.4.16.tar.xz

[build]
"$K"/gnulibfix lib > /dev/null
printf "all:\n\ttrue\n\ninstall:\n\ttrue\n\n" > tests/Makefile.in
[ -n "$CROSS_COMPILE" ] && xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/')"
LDFLAGS="$optldflags -static" \
CPPFLAGS="-Drpl_strstr=strstr -Drpl_mkstemp=mkstemp -Drpl_readlink=readlink" \
CFLAGS="$optcflags" \
./configure -C --prefix="$butch_prefix" \
  gl_cv_func_strtod_works=yes $xconfflags
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install


code:
[vars]
filesize=1242186
sha512=3260be0d1a9a7c5eb0dbb87179a9a9521fdfc7809ca51f13ee5a37ba5e63d21ad50a4249ec7d3929a9d0ce8c8f6cf302558743964f0f7ff742efe283b91df9de
desc='the standard build tool for *nix source packages'

[deps]
kernel-headers

[deps.stage0]
stage0-musl

[mirrors]
http://ftp.gnu.org/gnu/make/make-3.82.tar.bz2

[build]
[ "$STAGE" = "0" ] && CC="$butch_root_dir"/bin/musl-gcc
patch -p1 < "$K"/make-3.82-upstream_fixes-3.patch
patch -p1 < "$K"/make-3.82-stack_limit.patch

[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/')"

CFLAGS="-D_GNU_SOURCE $optcflags" LDFLAGS="$optldflags -static" \
./configure -C --prefix="$butch_prefix" $xconfflags --disable-nls
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/make


code:
[mirrors]
http://prdownloads.sourceforge.net/advancemame/makebootfat-1.4.tar.gz

[vars]
filesize=146722
sha512=638356c951670187960d0050d963116391d4b494bc9b082b3d4673188450e47f22fda5733aa09b15cfbb1640807676f5f8743dd094b9931f150b445eb8d335dd

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" CXXFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" --disable-nls $xconfflags

make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/makebootfat


code:
[vars]
filesize=143498
sha512=e28d71c3ce4f74ca6479771fcdd123c19ab18e3f2aa690a7798237f21f13fca4c4d66d7b7b1d708c2c214b8e17f8fe37e6cf5b75a4d2b88514c50addea2600cb

[mirrors]
http://xorg.freedesktop.org/archive/individual/util/makedepend-1.0.5.tar.bz2

[deps]
libx11

[build]
CFLAGS=-D_GNU_SOURCE ./configure -C --prefix="$butch_prefix"
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/makedepend


code:
[vars]
filesize=9924
sha512=640df51e214dfa3be1b7425fb9cd6477f1b4da57441a58243913aae12e1b2c0b7ef35906384cb79975fda4f6c747534f9f72dde59b742ac3bc26c87cb69f65f5
tardir=makedev-2.3.1.orig

[mirrors]
http://http.debian.net/debian/pool/main/m/makedev/makedev_2.3.1.orig.tar.gz

[deps]
makedev-debian-patch

[build]
gzip -c -d "$C"/makedev_*.diff.gz |patch -p1
install -D -m 755 MAKEDEV "$butch_install_dir""$butch_prefix"/bin/MAKEDEV

path: pkg/makedev-debian


path: pkg/makedev-debian-patch


code:
[build]
$CC $optcflags -std=gnu99 -o man "$K"/man.c -static $optldflags
install -D -m 755 man "$butch_install_dir""$butch_prefix"/bin/man
install -D -m 755 "$K"/manpp "$butch_install_dir""$butch_prefix"/bin/manpp

path: pkg/man


code:
[mirrors]
http://mdocml.bsd.lv/snapshots/mdocml-1.13.3.tar.gz

[vars]
filesize=358971
sha512=a3b7304e313b905b3575d79eb7ac861723e0ef3f700199c136abe4d4c698929e99ee0789bfc6e591224fb0006c709afe0e4c1bb578605a767c371ec7dee26024
desc="manpage viewer. recommended to use instead of sabotage's minimal man prog"

[deps]

[build]
sed -i 's@pager = "/usr/bin/more -s"@pager = "/bin/less -s"@' main.c

cat << EOF > configure.local
PREFIX=$butch_prefix
MANDIR="$butch_prefix"/share/man
LIBDIR="$butch_prefix"/lib
CFLAGS="$optcflags"
BUILD_DB=0
HAVE_DIRENT_NAMLEN=0
HAVE_FGETLN=1
HAVE_FTS=0
HAVE_GETSUBOPT=1
HAVE_MMAP=1
HAVE_STRCASESTR=1
HAVE_STRLCAT=1
HAVE_STRLCPY=1
HAVE_STRPTIME=1
HAVE_STRSEP=1
HAVE_WCHAR=1
EOF

./configure -C --disable-nls $xconfflags

make V=1 -j$MAKE_THREADS LDFLAGS="$optldflags"
make DESTDIR="$butch_install_dir" install

dest="$butch_install_dir""$butch_prefix"
rm "$dest"/bin/man
chmod 0755 "$dest"/bin/mandoc
chmod 0755 "$dest"/bin/demandoc
ln -sf mandoc "$dest"/bin/man

path: pkg/mandoc


code:
[mirrors]
http://invisible-mirror.net/archives/mawk/mawk-1.3.4-20150503.tgz

[vars]
filesize=468794
sha512=ac9dde6948328d8db94458448abdf7389f8862ae6093315dd19ed9d1cbeab60fca1fc7b084cda4ce09505010f7108612585e3c4ba9663ddf3adb869bf1d9d7b6

[deps]

[build]
#patch -p1 < "$K"/some.patch

[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" CXXFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" --disable-nls $xconfflags

#[ -n "$CROSS_COMPILE" ] && "$K"/libtool.cross.gen --sysroot="$butch_root_dir"

make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/mawk


code:
[mirrors]
https://tls.mbed.org/download/mbedtls-2.2.1-apache.tgz

[vars]
filesize=1863674
sha512=6a74abc4ea225eb6bcf20894bb1a6faa82dbaff11129c41849151e2654570609efeee70d0644ce63c4d2c11e6142b2db262b88f3a22fdceff0a215a64a5d6eb0
tardir=mbedtls-2.2.1

[deps]

[build]
# NOTE: the mirror requires tls, download with curl:
# 	USE_CURL=1 butch install mbedtls
# hiawatha requires these options (see USE_SYSTEM_MBEDTLS in its
# CMakeLists.txt)
echo "#define MBEDTLS_THREADING_C" >> include/mbedtls/config.h
echo "#define MBEDTLS_THREADING_PTHREAD" >> include/mbedtls/config.h

# build the library and all binaries statically (includes
# mbedtls_selftest)
sed -i 's@^\.SILENT:.*$@@' library/Makefile programs/Makefile Makefile
make -j$MAKE_THREADS no_test CFLAGS="$optcflags" LDFLAGS="$optldflags"

make DESTDIR="$butch_install_dir" install

path: pkg/mbedtls


code:
[mirrors]
http://www.midnight-commander.org/downloads/mc-4.8.16.tar.xz

[vars]
filesize=2387724
sha512=209a4f92f493d1df5d9976bbd2547b92172270fd35c221e4d4d99630b3530a5cc849bfdff842b47f35e32d215d5af35aadd5cd02bd12567f3736ad4915abb944
desc='midnight commander - terminal file manager (norton commander clone)'

[deps]
curses
glib

[build]
patch -p1 < "$K"/mc-curses.patch
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CPPFLAGS=-D_GNU_SOURCE CFLAGS="$optcflags" LDFLAGS="$optldflags -lterminfo" \
  ./configure -C --prefix="$butch_prefix" $xconfflags \
  --disable-nls \
  --disable-silent-rules \
  --without-x \
  --without-gpm-mouse \
  --with-screen=ncurses
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/mc


code:
[mirrors]
ftp://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-3.2.6.tar.xz
http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-3.2.6.tar.xz
http://mirror.mcs.anl.gov/pub/linux/utils/raid/mdadm/mdadm-3.2.6.tar.xz

[vars]
filesize=365196
sha512=0ad0f71fe2f91b8bdba2daf2beed93c746a7cb0afcd94e8d5a4d092ea61fccc543d332d326b5420645aec141af9e607280897b014824f64b0b59d3ebe57e7a8a

[deps]
kernel-headers

[build]
patch -p1 < "$K"/mdadm_h.patch
patch -p1 < "$K"/mdadm_canonicalize.patch

# -ftree-dce -fdata-sections -ffunction-sections -Wl,--gc-sections
# is supported by gcc4+, and removes dead code.
# it's not as efficient as -flto -fwhole-program, but it takes
# *much* less time to compile.
# in this specific case, the difference is only 16K but build time
# with lto is more than 4x slower.

make -j$MAKE_THREADS LDFLAGS="-static -Wl,--gc-sections" STRIP=-s \
  CXFLAGS="-Os -ftree-dce -fdata-sections -ffunction-sections -Wl,--gc-sections" \
  CWFLAGS=-Wall \
  DESTDIR="$butch_install_dir" install

path: pkg/mdadm


code:
[mirrors]
http://kent.dl.sourceforge.net/project/lxde/menu-cache/menu-cache%200.3.3/menu-cache-0.3.3.tar.gz
http://switch.dl.sourceforge.net/project/lxde/menu-cache/menu-cache%200.3.3/menu-cache-0.3.3.tar.gz

[vars]
filesize=392291
sha512=1966b94989cdae0a1a3a48f19d337471a28acadecf7f03dac8c27d515324b8eb4d15102e2aa293c251e020f521f6e586aa13c8eca7ae7909b9ce5e67ef3ebafe

[deps]
glib

[build]
sed -i 's@sys/fcntl.h@fcntl.h@' libmenu-cache/menu-cache.c
sed -i 's@sys/fcntl.h@fcntl.h@' menu-cache-daemon/menu-cached.c
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') --with-sysroot=$butch_root_dir"
CFLAGS="$optcflags -D_GNU_SOURCE" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" $xconfflags
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/menu-cache


code:
[mirrors]
https://www.mercurial-scm.org/release/mercurial-3.7.3.tar.gz

[vars]
filesize=4636732
sha512=7f9f97229e40c7092c16ccf227b19a08a9839d8ce19a9d057341fff75876bff32241ee9aa10eab293f779ea3e8a1d97577597187bd96251fb499cbb1075a82cf

[deps.run]
python

[deps.host]
python
wget

[build]
python setup.py build
python setup.py install --prefix="$butch_prefix" \
       --root="$butch_install_dir"

path: pkg/mercurial


code:
[mirrors]
http://ftp.oregonstate.edu/pub/blfs/conglomeration/MesaLib/MesaLib-10.2.7.tar.bz2

[vars]
filesize=7107753
sha512=c6d346499ef9596d3b5cd0bdc0ec64b58e8170203e0c977c54b55652c8792beb471822c101461745f7228a7d15a43924211f56fc0cc989defdc1acc4ea7b8a71
tardir=Mesa-10.2.7

[deps]
dri2proto
dri3proto
presentproto
gettext
glproto
libdrm
libxdamage
libxext
libxml2
libxshmfence
libxxf86vm
eudev
expat

[deps.host]
flex
bison

[build]
if false ; then
  # add mesaglut to deps when you need it
  # currently this is non-functional as nothing in the glut src tree will
  # be built, so it needs some additional makefile patches.
  tar xf "$C"/MesaGLUT-7.9.2.tar.gz
  mv Mesa-7.9.2/src/glut src/
  mv Mesa-7.9.2/include/GL/* include/GL/
fi

patch -p1 < "$K"/mesa-10.patch
patch -p1 < "$K"/mesa-tls.patch
patch -p1 < "$K"/mesalib-fpclassify.patch

archflags=
[ "$A" = arm ] || [ "$A" = mips ] && archflags=--with-dri-drivers=swrast
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine) --with-sysroot=$butch_root_dir"
CPPFLAGS="-D_GNU_SOURCE -I $PWD/include/c11" \
CFLAGS="$optcflags" LDFLAGS="$optldflags" \
  ./configure -C --prefix="$butch_prefix" $xconfflags \
  --sysconfdir="$butch_prefix"/etc \
  --with-gallium-drivers=nouveau \
  --enable-gallium-llvm=no \
  --enable-gallium-egl=no \
  --enable-gallium-gbm=no \
  --enable-gallium-tests=no \
  --enable-gallium-g3dvl=no \
  --enable-texture-float         \
  --enable-gles1                 \
  --enable-gles2                 \
  --enable-osmesa                \
  --disable-xa                    \
  --disable-gbm                  \
  --disable-asm			\
  --enable-glx-tls               \
  --with-egl-platforms="x11" $archflags \

[ -n "$CROSS_COMPILE" ] && "$K"/libtool.cross.gen --sysroot="$butch_root_dir"

echo true >  bin/missing

make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/mesalib


code:
[mirrors]
http://distro.ibiblio.org/quirky/quirky6/sources/t2/april/metamail-2.7.tar.bz2

[vars]
filesize=128437
sha512=647ac2c7240fe11fb229496e0a2afa1b3dffd929a70e4350308cbe6c3e90df1bbf6a11a4ecbc1d90fc3fc34fea05d45468ad45a3abe770fa158dedce69e1a13f
desc="Metamail is a program developed at Bellcore that decodes MIME encoded mail"

[deps]

[build]
#FAIL WON'T COMPILE, WANTS sgtty.h FROM glibc
#from T2...
patch -p1 < "$K"/metamail-1-2.7-54.patch
patch -p1 < "$K"/metamail-2-automake.patch
patch -p1 < "$K"/metamail-3-uue-getline.patch

LDFLAGS="$optldflags" make -j1 || exit 1

make DESTDIR="$butch_install_dir" install

path: pkg/metamail


code:
[mirrors]
http://pkgs.fedoraproject.org/repo/pkgs/midori/midori_0.5.5_all_.tar.bz2/b99e87d4b73a4732ed1c1e591f0242ac/midori_0.5.5_all_.tar.bz2
http://www.mirrorservice.org/sites/download.salixos.org/i486/14.1/source/xap/midori/midori_0.5.5_all_.tar.bz2

[vars]
filesize=1092309
sha512=89d1ddb461af460a83744cc761989d430750dcef9565ac98960c1c87e6082ebb35e61c4f21f28891a19119e2733dc8a6440bc51c0bd206c37ac068e434fc0231
tardir=midori-0.5.5

[deps]
librsvg
webkitgtk1

[deps.host]
python
vala

[build]
patch -p1 < "$K"/midori-no-notify.patch

rm extensions/devpet.vala

DISABLE_NOTIFY=1 ./configure  --prefix="$butch_install_dir" --disable-docs --disable-apidocs \
	--disable-unique --disable-granite --disable-tests --disable-gtk3 \
	--disable-webkit2 --disable-zeitgeist
make -j$MAKE_THREADS
make DESTDIR="/" install
dest="$butch_install_dir""$butch_prefix"
install -m644 -D _build/icons/48x48/midori.png "$dest"/share/pixmaps/midori.png

path: pkg/midori


code:
[mirrors]
http://www.milkytracker.org/files/milkytracker-0.90.85.tar.bz2

[vars]
filesize=2509060
sha512=b7129f537d8ee5ec35b77fe287d3ebc693a2cf5b679ccde672fa66e6a5cf1b003594e4128c6db6c037f13b54264064e1a8283339367fdf327e87c23784bb00c7

[deps]
sdl
zlib
zziplib

[build]
patch -p1 < "$K"/milkytracker-64bit.patch
patch -p1 < "$K"/milkytracker-gzip.patch

[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" CXXFLAGS="$optcflags" \
LDFLAGS="$optldflags" \
  ./configure -C --prefix="$butch_prefix" $xconfflags
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

# install desktop file
dest="$butch_install_dir""$butch_prefix"
mkdir -p "$dest"/share/applications
cp "$K"/milkytracker.desktop "$dest"/share/applications/

path: pkg/milkytracker


code:
[mirrors]
http://downloads.sourceforge.net/project/mingetty/mingetty/1.08/mingetty-1.08.tar.gz

[vars]
filesize=13476
sha512=d2c050a412af81d4635cbaa5610dfa2cf2addce0d3116fa53f73eb15cd6b53d476165a0509ae630a151de07a5bdc82cba1b5da0ab78d0313b200adece3c8872b
desc="A very small getty for Linux"

[deps]

[build]

#sed -i -e "s%^DESTDIR=.*%DESTDIR=${butch_install_dir}%" Makefile

make || exit 1

dest="$butch_install_dir""$butch_prefix"
mkdir -p $dest/sbin
install -m 0755 mingetty $dest/sbin

path: pkg/mingetty


code:
[mirrors]
http://miniupnp.free.fr/files/miniupnpc-1.7.20120830.tar.gz

[vars]
filesize=70074
sha512=cb1635bea248c0205efd576a0710c201426bfd4c2f4e6b1804cfa35d96c06ba702af78ce917f82d8bff0c75db8a182844342711ff21fa3a4f1bfcfed18d10900

[deps]

[build]
patch -p1 < "$K"/miniupnpc.patch
patch -p1 < "$K"/miniupnp-cve-2015-6031.patch
patch -p1 < "$K"/miniupnp-cve-2014-3985.patch
make -j$MAKE_THREADS
make INSTALLPREFIX="$butch_install_dir""$butch_prefix" install

path: pkg/miniupnpc


code:
[mirrors]
http://distro.ibiblio.org/quirky/quirky6/sources/t2/april/minixcal-1.1.1.tar.bz2

[vars]
filesize=15772
sha512=c2876bc17b4bb8141a1efd760facad96809d7d37bcf51f8a9c1c886810186d95fe155ec8b7be0b72cf2a789b79833ed5aec85a2c15c292817e3fdfcb1d072783
desc="Calendar applet, written in gtk2. Excellent as tray applet"

[deps]
gtk+2

[build]
[ -f minixcal ] && rm -f minixcal
gcc minixcal.c -o minixcal `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` -lX11

dest="$butch_install_dir""$butch_prefix"
mkdir -p "$dest"/bin
install -m755 -s minixcal "$dest"/bin

path: pkg/minixcal


code:
[mirrors]
http://downloads.sourceforge.net/project/mirdir/mirdir/2.1/mirdir-2.1-Unix.tar.gz

[vars]
filesize=74002
sha512=d99cbc04a5d99a739c16fea9198d92cd0209fb5fd4fc931eb2af2bb6c0c0ddcec3c34a27269bf108d7ffebcf760c9817088ea2091abbe9d3c4e932724e85c680
desc="Compare two directory trees, copy differences"
tardir=mirdir-2.1-UNIX

[deps]

[build]

CFLAGS="-D_GNU_SOURCE $optcflags" \
LDFLAGS="$optldflags" \
  ./configure -C --prefix="$butch_prefix" $xconfflags

make -j$MAKE_THREADS V=1 || exit 1

dest="$butch_install_dir""$butch_prefix"
mkdir -p $dest/bin
install -m755 -s bin/mirdir $dest/bin

path: pkg/mirdir


code:
[vars]
filesize=108195
sha512=96d1920565514f90621e18a87fb5a2db9e052d1bffc6552d9659e065a21e252ab98b4e62013755032b98ed6d8c3381eb75c3c8e02651766ee4791ca622dcef1f

[mirrors]
http://xorg.freedesktop.org/releases/individual/app/mkfontdir-1.0.7.tar.bz2

[deps]
mkfontscale

[build]

[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" CXXFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" --disable-nls $xconfflags

make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/mkfontdir


code:
[vars]
filesize=139923
sha512=7a6da239b2f166c6283090c219889e998be9332ee1e8eb4d84bbdf0cb58125a3773fe7ee97774d86f2cd5385dc49636a797c7b9c25c6c8bbe24b898329f97220

[mirrors]
http://xorg.freedesktop.org/releases/individual/app/mkfontscale-1.1.1.tar.bz2

[deps]

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" CXXFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" --disable-nls $xconfflags

make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/mkfontscale


code:
[mirrors]
http://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R51.tgz

[vars]
filesize=382169
sha512=dea2dea283959c0564cb6e9dbb9eecf004365cd01d83f1a8bbaff319c8ebefc4eb5e85898e207c7ce0577af525be0563e7c6b5f4b3449a2439e93f3f8bfd43ea
tardir=mksh

[deps]

[build]
CFLAGS='-Os -ftree-dce -fdata-sections -ffunction-sections -Wl,--gc-sections' LDSTATIC=-static LDFLAGS="-Wl,--gc-sections" \
    sh Build.sh -r -M

make -j$MAKE_THREADS -f - all <<'EOF'
include Makefrag.inc
VPATH=		.
all: $(PROG)
$(PROG): $(OBJS_BP)
	+$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS_BP) $(LIBS)
$(OBJS_BP): $(SRCS_FP) $(NONSRCS)
.c.o:
	+$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
EOF

"$CROSS_COMPILE"strip -s -R .note -R .comment mksh

install -D -m 755 mksh "$butch_install_dir""$butch_prefix"/bin/mksh
install -D -m 644 mksh.1 "$butch_install_dir""$butch_prefix"/share/man/man1/mksh.1

path: pkg/mksh


code:
[mirrors]
http://distro.ibiblio.org/quirky/quirky6/sources/t2/april/modem-stats-1.0.1.src.elf.tar.bz2

[vars]
filesize=51396
sha512=57488d7e18602edcafc459e0741c1900fd33c1b4061714cee3306329257651c704136bc68ecce929d1a0a96424b1c8f72ca8ccb6c29939bc604f3bb513ebd5e8
desc="Send Hayes commands to a serial or usb modem"
tardir=modem-stats-1.0.1

[deps]

[build]

gcc $optcflags -o modem-stats $optldflags modem-stats.c
dest=$butch_install_dir$butch_prefix
mkdir -p "$dest"/bin
install -m755 -s modem-stats "$dest"/bin

path: pkg/modem-stats


code:
[mirrors]
http://mosh.mit.edu/mosh-1.2.5.tar.gz

[vars]
filesize=308857
sha512=6a5a42e5ed3f265bc8bee045340a59f604ab8f08b041573264f5679c29678e84d101537aa2d856923eee8d0a0f9c052dc81cfbfa50ce12bd0eeddc5c8f1fc3ae

[deps]
protobuf
curses
zlib
libressl

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CFLAGS="-D_GNU_SOURCE -DSTDC_HEADERS $optcflags" \
CXXFLAGS="-D_GNU_SOURCE $optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
 ./configure -C --prefix="$butch_prefix" $xconfflags

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/mosh


code:
[mirrors]
http://distro.ibiblio.org/quirky/quirky6/sources/t2/april/mp-3.2.13.tar.bz2

[vars]
filesize=149398
sha512=1b5b97a008c409a8e81e3685e2e937bd7238a4e93150c1b4f82561f6abb825a5b72efdc1aa698e8f73c9a615bd161ccd13537b53c81da379b4ea1a3f2ee22dac
desc="Text editor with syntax highlighting. Compiling console mode only"

[deps]
curses

[build]

sed -i -e 's%^CURSES=.*%CURSES=curses%' makefile

LDFLAGS="$optldflags -lterminfo" make mp || exit 1

dest="$butch_install_dir""$butch_prefix"
mkdir -p $dest/bin
install -m755 -s mp $dest/bin

path: pkg/mp


code:
[mirrors]
http://sourceforge.net/projects/mp3blaster/files/mp3blaster/mp3blaster-3.2.5/mp3blaster-3.2.5.tar.gz

[vars]
filesize=329407
sha512=53f623340b7a8e4be6cd973474fd5f23c623b6d1c667478dc0d4c7a1ef5758f4bbc09d9d0698d1539d8d1c3ef45301b447f3ed74f68586070a07a7f9fa8c353e

[deps]
curses
sdl
sdl-sound

[build]
cp -f "$K"/config.sub .
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine) \
  --with-sysroot=$butch_root_dir"

printf "#!/bin/sh\necho -lSDL -I$butch_root_dir$butch_prefix/include/SDL\n" > sdl-config
chmod +x sdl-config

for i in . src nmixer mpegsound ; do
sed -i 's,^INCLUDES = .*,INCLUDES=-I$(srcdir) -I../mpegsound -I../nmixer,' $i/Makefile.in
done

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" CXXFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" --disable-nls $xconfflags \
  ac_cv_path_SDL12_CONFIG=$PWD/sdl-config

make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install


code:
[deps]
mpfr

[vars]
filesize=565953
sha512=84daf8e6f63c876ba4c58bd1f25aea2766dd42d6e020aa02e93682e7a1d03da6c30d02c09ac006a507feedb46ea18de415e2affa1cdb71d37d63f3130bb7dfc4

[mirrors]
http://www.multiprecision.org/mpc/download/mpc-0.9.tar.gz

[build]
printf "all:\n\ttrue\n\ninstall:\n\ttrue\n\n" > tests/Makefile.in
[ -n "$CROSS_COMPILE" ] && xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/')"
CFLAGS="$optcflags" LDFLAGS="$optldflags" \
  ./configure -C --prefix="$butch_prefix" \
  --disable-shared $xconfflags
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install
dest="$butch_install_dir""$butch_prefix"
rm -f "$dest"/lib/libmpc.la

path: pkg/mpc


code:
[deps]
gmp

[vars]
filesize=1016096
sha512=a025e70bff2f0b8e2d5c93f147a04c66ae40fa6595613671495eeb2a93ad720098826a634fa2255432de3e98ef8d3c0a7ef2ee461b006bf0ab0c0d39858b7a85

[mirrors]
http://www.mpfr.org/mpfr-3.0.1/mpfr-3.0.1.tar.xz
http://ftp.gnu.org/gnu/mpfr/mpfr-3.0.1.tar.xz

[build]
printf "all:\n\ttrue\n\ninstall:\n\ttrue\n\n" > tests/Makefile.in
[ -n "$CROSS_COMPILE" ] && xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/')"
CFLAGS="$optcflags" LDFLAGS="$optldflags" \
./configure -C $xconfflags \
  --prefix="$butch_prefix" --disable-shared
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install
dest="$butch_install_dir""$butch_prefix"
rm -f "$dest"/lib/libmpfr.la

path: pkg/mpfr


code:
[mirrors]
http://heanet.dl.sourceforge.net/project/mpg123/mpg123/1.14.4/mpg123-1.14.4.tar.bz2
http://surfnet.dl.sourceforge.net/project/mpg123/mpg123/1.14.4/mpg123-1.14.4.tar.bz2
http://switch.dl.sourceforge.net/project/mpg123/mpg123/1.14.4/mpg123-1.14.4.tar.bz2

[vars]
filesize=797694
sha512=bb20de004271ab40ec26da0d4759970d02855970c88d4ca9971b7d41ea72679032619cc952d96d343bd46c6b5eca6e38eb9f000845960bc464894b850b4de014

[deps]
alsa-lib

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" LDFLAGS="$optldflags" \
  ./configure -C --prefix="$butch_prefix" $xconfflags
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install


code:
[vars]
filesize=11202492
sha512=06371d47b02caec83c7662f6bb4a827eafb7f3309f6cda959a0f49b647df031166a6e7c5d530b57b580104289ee260aa96f3f43cbfffcef816cea776b0d5aed0
desc='media player with support for most audio/video formats'

[mirrors]
http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.1.1.tar.xz

[deps]
libtheora
libxxf86dga
libxv
libmad
libao
zlib
sdl
x11-font-dejavu
libxvmc
alsa-lib
mesalib
libpng

[deps.host]
yasm

[build]
patch -p1 < "$K"/mplayer-x11-libs.patch

[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--target="$A"-linux"
isx86=0
disrt=0
case "$A" in
  i[3-6]86) isx86=1 ;;
  x86_64) isx86=1 ;;
  x32) isx86=1 ;;
  arm) disrt=1 ;;
  mips) disrt=1 ;;
esac
test "$isx86"x = 0x && xconfflags="$xconfflags \
  --disable-mmx --disable-mmxext --disable-sse --disable-sse2 --disable-ssse3"
test "$disrt"x = 1x && \
  xconfflags="$xconfflags --disable-runtime-cpudetection"

# figure out arm cpu optimizations...
[ "$A" = arm ] && {
	gccv=$($CC -v 2>&1|grep "^Configured with: ")
	for flag in --with-arch --with-fpu ; do
		for arg in $gccv ; do
			if printf "%s" "$arg" | grep "^$flag=" >/dev/null ; then
			if [ "$flag" = "--with-arch" ] ; then
				case $arg in
					--with-arch=armv[67]*)
						xconfflags="$xconfflags --enable-armv6t2" ;;
					--with-arch=armv5*)
						xconfflags="$xconfflags --enable-armv5te" ;;
				esac
			elif [ "$flag" = "--with-fpu" ] ; then
				case $arg in
					--with-fpu=vfpv3*)
						xconfflags="$xconfflags --enable-vfpv3" ;;
					--with-fpu=vfp*)
						xconfflags="$xconfflags --enable-armvfp" ;;
					--with-fpu=neon*)
						xconfflags="$xconfflags --enable-neon" ;;
				esac
			fi
			fi
		done
	done
}

printf "#!/bin/sh\necho -lfreetype -I$butch_root_dir$butch_prefix/include/freetype2\n" > freetype-config
chmod +x freetype-config
printf "#!/bin/sh\necho -lSDL -I$butch_root_dir$butch_prefix/include/SDL\n" > sdl-config
chmod +x sdl-config
export PATH="$PWD:$PATH"

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" CXXFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
./configure --prefix="$butch_prefix" \
	--disable-gui \
	--disable-gif \
	--disable-arts \
	--enable-x11 \
	--enable-runtime-cpudetection \
	--disable-nas \
	--enable-gl \
	--disable-musepack \
	--disable-mp3lib \
	--disable-ossaudio \
	--disable-pulse \
	--disable-openal \
	--disable-mp3lib \
	--disable-esd \
	--disable-mga \
	--disable-lirc \
	--enable-xvmc \
	--disable-nemesi $xconfflags
echo "INSTALLSTRIP =" >> config.mak
sed -i 's@strip@$(STRIP)@' Makefile
make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install STRIP=true

path: pkg/mplayer


code:
[mirrors]
https://github.com/mpv-player/mpv/archive/v0.15.0.tar.gz

[vars]
filesize=2849513
sha512=6f12487ff9bedd6872993189e3359c04ab0de559fd42bfcc5accdbfbd02e0d863cf3d7cfa5cceaedd174a4c16c831914945cf9cf6c918732f72fa44467127332
tardir=mpv-0.15.0
tarball=mpv-0.15.0.tar.gz
desc='media player forked from mplayer with major cleanups'

[deps]
ffmpeg
libass
lua

[deps.host]
python
wget

[build]
./bootstrap.py

CFLAGS="-D_GNU_SOURCE $optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./waf configure --prefix="$butch_prefix"

./waf -v build -j$MAKE_THREADS
./waf install --destdir="$butch_install_dir"

path: pkg/mpv


code:
[vars]
filesize=603978
sha512=572bb4dda9f9b9dcb597f3185922646523bce34003f536acca82992f68f8f7c1a5f2778d626f805ea2cd061e8451fbbf12010e5d655221f76b83440825c80992

[mirrors]
http://prdownloads.sourceforge.net/materm/mrxvt-0.5.4.tar.gz

[deps]
xorg-proto-headers
xorg-libraries

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" $xconfflags \
   --enable-xft \
   --disable-utmp \
   --disable-wtmp

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/mrxvt


code:
[vars]
filesize=273780
sha512=75da652e720cce9efcc23c2b72a0d8050096f054eff1338e02477816e107d469a7f9c5f4973146d38d939c3515ea39e926c70cf8f2ca0372c83c75506c61732b

[mirrors]
http://bitmath.org/code/mtdev/mtdev-1.1.4.tar.bz2

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" CXXFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" --disable-nls $xconfflags

#[ -n "$CROSS_COMPILE" ] && "$K"/libtool.cross.gen --sysroot="$butch_root_dir"

make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/mtdev


code:
[mirrors]
http://ftp.gnu.org/gnu/mtools/mtools-4.0.18.tar.bz2

[vars]
filesize=420190
sha512=3981a4727aa4e2ec5c931201b236f52fcd1c9d55f888cb2fbdc5c4172402e2b229ede9a5005b972ffdad59bcb861e2fcc01404845e521116419079ae78239090

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"
CFLAGS="$optcflags -UHAVE_ICONV_H" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" $xconfflags
make PREFIX="$butch_prefix" DESTDIR="$butch_install_dir" -j1 all install

path: pkg/mtools


code:
[mirrors]
http://mupdf.com/downloads/archive/mupdf-1.9a-source.tar.gz

[vars]
filesize=20493793
sha512=9f804fd65c2dc6b7a3bd73961b1f1a8bf93d52903cccf6302acd6982dfa433125a3b8e77b808984921aee097877280fa21aafb87468cd0a8e4cfa900284a262b
desc='fast and relatively unbloated PDF viewer. used on embedded devices'

[deps]
musl
zlib
curl
freetype
jbig2dec
libjpeg
libxext
libressl

[deps.host]
freetype
zlib
libressl
jbig2dec

[build]
rm -rf thirdparty/curl thirdparty/freetype thirdparty/jpeg thirdparty/zlib thirdparty/jbig2dec
for i in fontdump cmapdump bin2hex cquote ; do
	make verbose=yes CC=cc \
	FREETYPE_CFLAGS=-I/usr/include/freetype2 \
	FREETYPE_LIBS=-lfreetype \
	OPENSSL_CFLAGS="-DHAVE_OPENSSL" \
	OPENSSL_LIBS="-lssl -lcrypto" \
	build=release build/release/"$i"
done
CFLAGS="$optcflags" \
LDFLAGS="$optldflags  -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  make verbose=yes -j $MAKE_THREADS DESTDIR="$butch_install_dir" \
  prefix="$butch_prefix" build=release install

path: pkg/mupdf


code:
[mirrors]
http://www.musl-libc.org/releases/musl-1.1.14.tar.gz

[vars]
filesize=894971
sha512=9016246b44a7e6ef51477f0a246373c79f3e796c70031c3323be1b6c4c0518a2d4578f1aa712adfd9a80cdc1d71918bd7a35855052a0452b854755bf0cc2424e
desc='the C standard library (libc)'

[deps.host]
gcc4

[build]
patch -p1 < "$K"/musl-1.1.14-regex.patch
./configure --prefix=$butch_prefix --syslibdir=$butch_prefix/lib
if [ "$A" = "powerpc" ] ; then
cat << EOF >> config.mak
LDFLAGS += -Wl,--secure-plt
CFLAGS += -msecure-plt
EOF
fi

# enable debug libc when DEBUGBUILD is set
[ ! -z "$DEBUGBUILD" ] && echo "CFLAGS += -O0 -g" >> config.mak
[ ! -z "$DEBUGBUILD" ] && echo "CFLAGS_ALL_SHARED += -O0 -g" >> config.mak

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

[ "$butch_prefix" = "/" ] && butch_prefix=
dest=$butch_install_dir$butch_prefix
mkdir -p "$dest"/bin
ln -sf  ../lib/libc.so "$dest"/bin/ldd

musl_gcc="$dest/bin/musl-gcc"

cp "$K/musl-gcc" "$musl_gcc"
chmod +x "$musl_gcc"
sed -i "s,AAAA,$A," "$musl_gcc"
sed -i "s,PPPP,$butch_prefix," "$musl_gcc"

#create dynlinker path file which only contains /lib
#this should speed up dynamic linker path search
mkdir -p "$dest"/etc
printf "%s\n" "$butch_prefix"/lib > "$dest"/etc/ld-musl-$A.path

path: pkg/musl


code:
[deps.host]
dynamic-toolchain
git

[build]
dest="$S/build/"
if [ -d "$dest/musl-git/.git" ] ; then
	cd "$dest/musl-git"
	git pull
else
	mkdir -p "$dest"
	cd "$dest"
	git clone git://git.musl-libc.org/musl musl-git
	cd musl-git
fi

./configure --prefix=$butch_prefix --syslibdir=$butch_prefix/lib
if [ "$A" = "powerpc" ] ; then
cat << EOF >> config.mak
LDFLAGS += -Wl,--secure-plt
CFLAGS += -msecure-plt
EOF
fi

# enable debug libc when DEBUGBUILD is set
[ ! -z "$DEBUGBUILD" ] && echo "CFLAGS += -O0 -g3" >> config.mak
[ ! -z "$DEBUGBUILD" ] && echo "CFLAGS_ALL_SHARED += -O0 -g3" >> config.mak

make clean
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/musl-git


code:
[vars]
filesize=3782032
sha512=f1b4a7230253651857f61bd7215cce870a613012f613d4c907d401556083726c8ed7d429d57a8bf858c3b5b23683380d4c1494540d86ca80813e22cb6b95bc1e
tardir=mutt-1.5.23
desc='terminal email client'

[mirrors]
http://ftp.vim.org/pub/mail/mutt/mutt-1.5.23.tar.gz

[deps]
curses
libressl
cyrus-sasl

[deps.host]
perl

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" CXXFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
./configure --prefix="$butch_prefix" $xconfflags \
--disable-nls \
--disable-silent-rules \
--enable-imap \
--enable-smtp \
--with-ssl  \
--with-sasl  \
--with-homespool=/var/spool/
for i in doc ; do
        printf 'all:\n\ttrue\ninstall:\n\ttrue\clean:\n\ttrue\n' > "$i"/Makefile
done

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/mutt


code:
[mirrors]
http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.20.tar.gz
http://files.directadmin.com/services/all/mysql/mysql-5.6.20.tar.gz

[vars]
filesize=32979820
sha512=c4bcc2a209616a38c04a4679cc7a76b354f0d7d3dda860b82b9cdb4746f897aa5c8204a440e1c65f55d81b2ac526b205dd0ba28786ba21778cc068efd71403ac

[deps.host]
cmake

[deps]
curses
readline

[build]
patch -p1 < "$K"/mysql-srv_buf_size.patch
sed -i '/OPENSSL_MAJOR_VERSION/s/1/2/' cmake/ssl.cmake

# prevent installation of 10K tests, 180MB, + and additional 35MB of symlinks
DISABLE_TESTS=true
if $DISABLE_TESTS ; then
	echo "RETURN()" > tests/CMakeLists.txt
	echo "RETURN()" > libmysqld/examples/CMakeLists.txt
	sed -i 's@  ADD_SUBDIRECTORY(tests)@@' CMakeLists.txt
	sed -i 's@  ADD_SUBDIRECTORY(mysql-test)@@' CMakeLists.txt
	sed -i 's@  ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess)@@' CMakeLists.txt
	rm -rf tests mysql-test
fi

mkdir build && cd build

CC="$CC -DTHD_LIB_LT=1 -Dthd_lib_detected=2" cmake \
  -DCMAKE_INSTALL_PREFIX=$butch_prefix \
  -DINSTALL_DOCDIR=share/doc/mysql \
  -DINSTALL_DOCREADMEDIR=share/doc/mysql \
  -DINSTALL_INCLUDEDIR=include/mysql \
  -DINSTALL_INFODIR=share/info \
  -DINSTALL_MANDIR=share/man \
  -DINSTALL_MYSQLDATADIR=$butch_prefix/srv/mysql \
  -DINSTALL_MYSQLSHAREDIR=share/mysql \
  -DINSTALL_MYSQLTESTDIR=share/mysql/test \
  -DINSTALL_PLUGINDIR=lib/mysql \
  -DINSTALL_SBINDIR=sbin \
  -DINSTALL_SCRIPTDIR=bin \
  -DINSTALL_SQLBENCHDIR=share/mysql/bench \
  -DINSTALL_SUPPORTFILESDIR=share/mysql/support \
  -DMYSQL_DATADIR=/srv/mysql \
  -DMYSQL_UNIX_ADDR=/var/run/mysql/mysql.sock \
  -DSYSCONFDIR=/etc \
  -DWITH_PARTITION_STORAGE_ENGINE=OFF \
  -DWITH_PERFSCHEMA_STORAGE_ENGINE=OFF \
  -DWITH_ATOMIC_LOCKS=ON \
  -DWITH_SSL=system \
  -DWITH_ZLIB=system \
  -DWITH_PIC=ON \
  -DENABLE_PROFILING=OFF \
  -DWITH_DEBUG=OFF \
  -DWITH_UNIT_TESTS=OFF \
  -DMANUFACTURER=YourMOM \
  -DWITH_EXTRA_CHARSETS=none \
  -DCMAKE_BUILD_TYPE=MinSizeRel \
  -DCMAKE_C_FLAGS="-D__STDC_ISO_10646__ -DSHM_R=0400 -DSHM_W=0400" \
  -DWITH_READLINE=OFF \
  -DWITH_LIBEDIT=system \
  -DDEFAULT_MYSQL_HOME="/" \
  -DDEFAULT_CHARSET_HOME="/" \
  -DCMAKE_EXE_LINKER_FLAGS="-lterminfo $optldflags" \
      ..

CC="$CC -DTHD_LIB_LT=1 -Dthd_lib_detected=2" make -j$MAKE_THREADS VERBOSE=1

#  -DWITH_READLINE=OFF \
#  -DWITH_LIBEDIT=system \

# possible CMAKE_BUILD_TYPEs: Debug, Release, RelWithDebInfo and MinSizeRel

make DESTDIR="$butch_install_dir" install

path: pkg/mysql


code:
[mirrors]
http://www.nano-editor.org/dist/v2.4/nano-2.4.0.tar.gz

[vars]
filesize=1886052
sha512=7f079e307521a47405ba6d107d481df6869dbd7ea9297de6c69e831d00335cee403ac3ec1ef3578488cbec65c2e2ddec15edfddd45071f0fb4e2eccc94cbef1d
desc='a terminal-based, easy-to-use text editor'

[deps]
curses

[build]
sed -ie 's/__time_t/time_t/g' src/text.c

[ -n "$CROSS_COMPILE" ] && xconfflags="--host=$($CC -dumpmachine)"
printf '#!/bin/sh\necho -lncursesw\n' > ncursesw5-config
chmod +x ncursesw5-config
PATH="$PWD:$PATH" \
LDFLAGS="-static $optldflags" CFLAGS="$optcflags" \
./configure -C --prefix="$butch_prefix" $xconfflags \
  --enable-utf8 \
  --disable-nls \
  --disable-wrapping
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/nano


code:
[mirrors]
http://www.nasm.us/pub/nasm/releasebuilds/2.11.08/nasm-2.11.08.tar.xz

[vars]
filesize=764872
sha512=f7caf42d0fe1b850de13180a1f363e34a6d44a02696312dd8f12f4116ad1c1f3d01e6606c3a79fb881e76fc70d20894d85b333c84a75d60265ff9551f7b8cde4

[deps.host]
perl

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CFLAGS="-D_GNU_SOURCE $optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" $xconfflags

make PREFIX="$butch_prefix" INSTALLROOT="$butch_install_dir" -j$MAKE_THREADS all install

path: pkg/nasm


code:
[mirrors]
https://dev.yorhel.nl/download/ncdu-1.11.tar.gz

[vars]
filesize=134093
sha512=4b9319900dd11da7c3bd2ba9a478c52b8280e3560b8b5b6610fc145c5d81d726715db69cd21bd400d75339a5bcf140bcafb3b4430075427a51b65763e81d8c48
desc='ncurses disk usage'

[deps]
curses

[build]
#patch -p1 < "$K"/some.patch

[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine) \
  --with-sysroot=$butch_root_dir"

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" CXXFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" --disable-nls $xconfflags

#[ -n "$CROSS_COMPILE" ] && "$K"/libtool.cross.gen --sysroot="$butch_root_dir"

make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/ncdu


code:
[deps]

[vars]
filesize=2826473
sha512=d7c5e54b6d4d8b9211f0006ca8786f7609d180cc1aaebf4f25e7e35e12959779cf66447359a602daed625621ca32b0d910d67aef3eb8b6fdc3c373819a88faa1

[mirrors]
http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz

[build]
patch -p1 < "$K"/ncurses-cross-include.patch
patch -p1 < "$K"/ncurses-gcc5.patch
# prevent pulling in the hosts termcap.h which may conflict - plus it doesn't
# define everything ncurses expects from its own termcap.h
ln -s termcap.h include/termcap_internal.h
t=ncurses/tinfo
for culprit in progs/tset.c $t/lib_baudrate.c $t/lib_cur_term.c $t/lib_termcap.c $t/lib_tgoto.c $t/lib_tputs.c ; do
	sed -i 's@termcap\.h@termcap_internal.h@' $culprit
done
#the fallbacks file is needed to have no external dependencies.
#it is created using:
#ncurses/tinfo/MKfallback.sh /usr/share/terminfo/ /etc/termcap tic linux vt100 term xterm-256color > fallback.c
#on a machine that has those files.
cp "$K"/ncurses-fallback.c ncurses/fallback.c

[ -n "$CROSS_COMPILE" ] && xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/')"

# that </dev/ptmx is to fix an insanely stupid test for poll which
# needs to block on fd 1 (which they assume to be a tty).
# -fPIC is needed to unbreak lto, as ncurses builds only some .o's with it
CFLAGS="-D_GNU_SOURCE $optcflags -fPIC" ./configure -C \
   --with-normal --without-tests \
   --enable-widec \
   --with-shared \
   --enable-sigwinch --with-fallbacks="linux vt100 xterm xterm256-color" \
   --prefix="$butch_prefix" --includedir="$butch_prefix"/include --mandir="$butch_prefix"/share/man \
   --disable-nls --without-dlsym \
   --without-cxx-binding $xconfflags </dev/ptmx
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

dest="$butch_install_dir""$butch_prefix"
(
cd "$dest"/lib/
for i in  lib*.* ; do
	l=$(echo $i | awk '{ p = index($1, "."); if(substr($1, p-1, 1) == "w") { a = substr($1, 0, p -2);} else { a = substr($1, 0, p -4) "_g"; } ; b = substr ($1, p); $0 = a b; print; }')
	ln -s "$i" "$l"
done
)

path: pkg/ncurses


code:
[mirrors]
http://ndhcp.googlecode.com/files/ndhcp-1.0.tar.gz

[vars]
filesize=52792
sha512=17e3333f99d37b6b7f72282482e559210a1181cb1c5c9d760e6c9f7ab8454a4236ad53d970c3166e24aa07f431ec0db34f7b24d1a718430be951c9b3a6a4a2b3

[deps]
libcap2

[build]
#CFLAGS=-D_GNU_SOURCE ./configure -C --prefix="$butch_prefix"
make -j$MAKE_THREADS

# ndhcp lacks install target
mkdir -p "$butch_install_dir"/"$butch_prefix"/bin
cp build/ifchd build/ndhc "$butch_install_dir"/"$butch_prefix"/bin/

path: pkg/ndhcp


code:
[deps]
ndhcp

[build]

# note : do not run this script in a sabotage chroot
# it is intended to be used *once* inside a running sabotage system
# for primary setup of ndchp
# after it's done use /etc/rc.dhcp start/stop to use it

# bluntly copied from ndhcp README
#    a) Become root and create new group "ifchd".

#        $ su -
         umask 077
         groupadd ifchd

#    b) Create new users "ifchd" and "dhcp".  The primary group of these
#       users should be "ifchd".

         useradd -d /var/lib/ndhc -s /sbin/nologin -g ifchd ifchd
         useradd -d /var/lib/ndhc -s /sbin/nologin -g ifchd dhcp

#    b) Create the jail directory and set its ownership properly.

         mkdir /var/lib/ndhc
         chown root.root /var/lib/ndhc
         chmod a+rx /var/lib/ndhc
         cd /var/lib/ndhc
         mkdir var
         mkdir var/state
         mkdir var/run
         chown -R ifchd.ifchd var
         chmod -R a+rx var
         chmod g+w var/run

#    c) Create a urandom device for ndhc to use within the jail.

         mkdir dev
         mknod dev/urandom c 1 9
         mknod dev/null c 1 3
         chown -R root.root dev
         chmod a+rx dev
         chmod a+r dev/urandom
         chmod a+rw dev/null

#        d) (optional) If you wish for logging to properly work, you
#           will need to properly configure your logging daemon so that it
#           opens a domain socket in the proper location within the jail.
#           Since this varies per-daemon, I cannot provide a general
#           configuration.

#3)  At this point the jail is usable; ifchd and ndhc are ready to
#    be used.  As an example of a sample configuration, here is my
#    rc.dhcp:

#--START--

cat << EOF > /etc/rc.dhcp
#!/bin/sh
case "\$1" in
        start)
                ifchd -i wan0 -p /var/run/ifchd.pid -u ifchd -g ifchd -U dhcp \
                      -G ifchd -c /var/lib/ndhc &> /dev/null
                ndhc -b -i wan0 -u dhcp -C /var/lib/ndhc &> /dev/null
                ;;
        stop)
                killall ndhc ifchd
                ;;
esac
EOF
chmod +x /etc/rc.dhcp

#--END--

#    This script works fine with my personal machines, which are set up
#    exactly as I have outlined above.  If you have not entirely followed my
#    directions, the script will of course require modifications.

#4o) If you encounter problems, I suggest running both ifchd and ndhc in the
#    foreground and examining the printed output.

echo done, if everything worked as expected you should be able to run /etc/rc.dhcp start

exit 0

path: pkg/ndhcp-init


code:
[deps]
musl
libressl
expat

[deps.host]
pkgconf

[vars]
filesize=882267
sha512=26424f30936170a28fdb0188e10985c2b0e1e4266c4c1832384a02b69828741eb1370015646656f979cc74f2fd6a092d0d32bca401c04939b9890db3fb696260

[mirrors]
http://www.webdav.org/neon/neon-0.29.6.tar.gz

[build]
patch -p1 < "$K"/neon-configure.patch
patch -p1 < "$K"/neon-ne_socket.patch
CFLAGS="-D_GNU_SOURCE" ./configure -C --prefix="$butch_prefix" --with-ssl=openssl --enable-shared=yes
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/neon


code:
[mirrors]
http://downloads.sourceforge.net/project/nethack/nethack/3.4.3/nethack-343-src.tgz

[vars]
filesize=3497458
sha512=052342c19619219f291571d48cf7799f962eb6ec6f8a276427225c0abbd833eada18abeff9fbd647919f2a9e3bb097d7f154675e283fe48abc4752f24c192d8f
tardir=nethack-3.4.3

[deps]
flex
curses

[build]
patch -p1 < "$K"/nethack-options.patch
sh ./sys/unix/setup.sh x
sed -i "s@PREFIX   = /@PREFIX = $butch_install_dir$butch_prefix@" Makefile
sed -i 's@recover Guidebook@recover@' Makefile
make all
mkdir -p "$butch_install_dir$butch_prefix"/bin
mkdir -p "$butch_install_dir$butch_prefix"/lib/nethack
for i in dat/cmdhelp dat/opthelp dat/history dat/license dat/hh \
	dat/wizhelp dat/nhdat dat/help ;
do
	cp "$i" "$butch_install_dir$butch_prefix"/lib/nethack/
done
touch "$butch_install_dir$butch_prefix"/lib/nethack/perm
cp src/nethack "$butch_install_dir$butch_prefix"/bin/nethack
cp util/recover "$butch_install_dir$butch_prefix"/bin/nethack-recover

path: pkg/nethack


code:
[mirrors]
http://downloads.sourceforge.net/project/netpbm/archive_of_old_release_system/10.34/netpbm-10.34.tgz

[vars]
filesize=2507007
sha512=5d5a2ad223762725d195dae492463c115210ab04a528982bb2bb304ca17dfda817a6685e69b75755195b2b7a940fa9148494ad91bbf2ea63fcdbf5cc709de21a
desc="Netpbm is a CLI toolkit for conversion and manipulation of images"

[deps]
libpng
giflib
libtiff
libjpeg
zlib

[build]
# BK
# note, we use 10.34 in Puppy Linux, as later versions do not work in at least
# one of our scripts. we never followed this up with the developer.
# converter/ppm/xpmtoppm.c has getline(), conflicts with /usr/include/stdio.h
# i have inserted a rename to my_getline().
#oh man, this is a hairy build!!!...

#from T2...
patch -p1 < "$K"/netpbm-glibc.patch
patch -p1 < "$K"/netpbm-jpeg.patch
patch -p1 < "$K"/netpbm-makefile.patch
patch -p1 < "$K"/netpbm-shared_files-fix.patch
patch -p1 < "$K"/netpbm-zlib.patch

{ echo -e "\ngnu\nregular\nshared\ny\n\n\n"
  echo -e "\n\n\n\n\n\n`pkgprefix libdir libx11`/libX11.so\n\nnone\n" ; } | ./configure

sed -i -e 's%getline%my_getline%' converter/ppm/xpmtoppm.c
sed -i -e 's% -ffast-math % -ffast-math -flax-vector-conversions -fPIC -lz %' Makefile.config

make

[ -d /tmp/netpbm.bin ] && rm -rf /tmp/netpbm.bin
make package pkgdir=/tmp/netpbm.bin

dest="$butch_install_dir""$butch_prefix"
{ echo -e "/tmp/netpbm.bin"
  echo -e "$dest\n$dest/bin\n$dest/lib"
  echo -e "n"
  echo -e "$dest/lib\n$dest/share\n\n\n\nn\n" ; } | ./installnetpbm

rm -rf /tmp/netpbm.bin

path: pkg/netpbm


code:
[mirrors]
http://download.netsurf-browser.org/netsurf/releases/source-full/netsurf-all-3.5.tar.gz

[vars]
filesize=7190734
sha512=a39eb8c11b394e4d5c1164da46d74f283f489057f70c192277d94e511a3716c86474a07a7c80ce602a53e41959f75e82312ad9f5cb365953c24445af4456e1ce

[deps]
libpng
curl
libxml2
cairo
gtk+2
libglade
libmng
liblcms

[deps.host]
perl
perl5-HTML-Parser
flex
gperf

[build]
patch -p1 < "$K"/netsurf-gperf-warning.patch
# FIXME: netsurfs Makefile suppresses parallel builds
CFLAGS="-I$butch_prefix/include/cairo/" NETSURF_USE_BMP=NO \
 make Q= -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

dest="$butch_install_dir""$butch_prefix"
mkdir -p "$dest"/share/applications
cat << EOF > "$dest"/share/applications/netsurf.desktop
[Desktop Entry]
Name=Netsurf
Comment=Web Browser
Exec=netsurf
Icon=netsurf
MimeType=text/html;x-scheme-handler/http;x-scheme-handler/https;
Terminal=false
Type=Application
Categories=GTK;Network;WebBrowser;
EOF

path: pkg/netsurf


code:
[mirrors]
http://distro.ibiblio.org/quirky/quirky6/sources/t2/april/network_tray-3.1.tar.bz2

[vars]
filesize=16864
sha512=1f0078d23c4368175efbf039b1a7abdbcabd55e0790800a5c5b212ab797209514a1d59e574e987bbdd0f5160eaf726888794307ba97c940e603fdfbcde63c1ce
desc="Displays network connection status, for desktop tray"

[deps]
gtk+2
gettext-gnu

[build]
dest="$butch_install_dir""$butch_prefix"

sed -i -e 's%/usr/%/%' network_tray.c
sed -i -e 's%/local/lib/%/share/%' network_tray.c

[ -f network_tray ] && rm -f network_tray
[ -f network_tray.pot ] && rm -f network_tray.pot
gcc network_tray.c -o network_tray `pkg-config --cflags --libs gtk+-2.0`
xgettext --keyword="_" -o network_tray.pot network_tray.c

#these destinations are Puppy-heritage: /root/Startup, /usr/local/lib/X11/mini-icons
#need to rethink these. set to /lib/Startup, /share/mini-icons...
strip --strip-unneeded network_tray
mkdir -p "$dest"/share/mini-icons
cp -f networkblank.xpm "$dest"/share/mini-icons/
cp -f networkboth.xpm "$dest"/share/mini-icons/
cp -f networkdead.xpm "$dest"/share/mini-icons/
cp -f networkin.xpm "$dest"/share/mini-icons/
cp -f networkout.xpm "$dest"/share/mini-icons/
mkdir -p "$dest"/lib/Startup
cp -a -f network_tray "$dest"/lib/Startup/
mkdir -p "$dest"/share/doc/nls/network_tray
cp -a -f network_tray.pot "$dest"/share/doc/nls/network_tray/

path: pkg/network-tray


code:
[mirrors]
http://nginx.org/download/nginx-1.10.0.tar.gz

[vars]
filesize=908954
sha512=495da729ce6de935399c2bf7fc0c2cd112197d9dba6d8604f639d5815cbb8bb3ff70e994f942785481e064cc1df97211f886297ee72519b332a7197999d9f14e

[deps]
libressl
pcre
zlib

[build]
CFLAGS="$optcflags" \
LDFLAGS="$optldflags" ./configure \
  --with-http_ssl_module --with-ipv6 \
  --prefix="$butch_prefix" \
  --sbin-path="$butch_prefix/bin/nginx" \
  --conf-path="$butch_prefix"/etc/nginx/nginx.conf \
  --error-log-path="$butch_prefix"/var/log/nginx/error.log \
  --http-log-path="$butch_prefix"/var/log/nginx/access.log \
  --pid-path="$butch_prefix"/var/run/nginx.pid \
  --lock-path="$butch_prefix"/var/lock/nginx.lock \
  --http-client-body-temp-path="$butch_prefix"/var/spool/nginx/body \
  --http-fastcgi-temp-path="$butch_prefix"/var/spool/nginx/fastcgi \
  --http-proxy-temp-path="$butch_prefix"/var/spool/nginx/proxy \
  --http-scgi-temp-path="$butch_prefix"/var/spool/nginx/scgi \
  --http-uwsgi-temp-path="$butch_prefix"/var/spool/nginx/uwsgi \

make -j$MAKE_THREADS
make install DESTDIR="$butch_install_dir"
mkdir -p "$butch_install_dir""$butch_prefix"/var/spool/nginx

path: pkg/nginx


code:
[mirrors]
http://nmap.org/dist/nmap-7.12.tar.bz2

[vars]
filesize=8960599
sha512=91156499c6f903fb565fa2b0faa74043d078493312f9489071fafc687301017afc16c7eb26c092f1fa142e78c98a436833f56a9f015cb2a17aa6f6220b6a0b98

[deps]
libpcap
pcre
zlib
lua
libressl

[deps.host]
dynamic-toolchain

[build]
patch -p1 < "$K"/nmap-configure-pcap_suitable.patch
patch -p1 < "$K"/nmap-nbase_h.patch

[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CFLAGS="-D_GNU_SOURCE -D_BSD_SOURCE $optcflags" \
CXXFLAGS="-DIPPROTO_MAX=256 $CFLAGS" \
LDFLAGS="$optldflags" \
  ./configure -C --prefix="$butch_prefix" $xconfflags \
    --without-subversion --without-nmap-update --without-zenmap \
    --without-ndiff \
    ac_cv_working_getaddrinfo=yes ac_cv_working_getnameinfo=yes

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install STRIP=true

path: pkg/nmap


code:
[mirrors]
https://nodejs.org/download/release/v0.12.13/node-v0.12.13.tar.xz

[vars]
filesize=12357620
sha512=2195b91c1816e2e70931f3db1b4a8968ea6a4c63699d0170835356f53565a82a36ca209dba8e628d1869ee5dc7dd700234a6fec702452ba06cdcc93d8c5816c7
uchkurl=https://nodejs.org/download/release/

[deps.host]
dynamic-toolchain
python

[build]
# nodejs has 3 supported versions currently:
# - v5 (stable)
# - v4 (LTS)
# - v0.12 (Maintenance, does not require GCC 4.8, support end: 2017)

patch -p1 < "$K"/nodejs-nameser_compat.h
patch -p1 < "$K"/nodejs-openssl_termios.h
patch -p1 < "$K"/nodejs-prefix.patch

CFLAGS="-D_GNU_SOURCE $optcflags" \
CXXFLAGS="-D_GNU_SOURCE $optcflags" \
LDFLAGS="$optldflags" ./configure --prefix="$butch_prefix" --without-snapshot

# the python configure script does not care about C(XX)FLAGS being passed
sed -i "s@cflags': \[\]@cflags': ['-D_GNU_SOURCE -D_BSD_SOURCE']@" config.gypi

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/nodejs


code:
[mirrors]
http://nodejs.org/dist/v4.2.3/node-v4.2.3.tar.xz

[vars]
filesize=12768804
sha512=4b6196ee7a430a7834d30424728ddeea7e0fa44d3776f53072931337a8396f8ea3620880f5962eec469f585723d9036b1a1768f859b080f973c5568fc0c060db

[deps.host]
dynamic-toolchain
python

[build]
# Better fail here, than in the middle of the build!
if ! ($CC --version | grep -q -E '((4\.[8-9])|([5-9]\.[0-9]+))\.'); then
	echo "ERROR: GCC 4.8 or higher required!"
	exit 1
fi

patch -p1 < "$K"/nodejs-nameser_compat.h
patch -p1 < "$K"/nodejs-openssl_termios.h
patch -p1 < "$K"/nodejs-prefix.patch

CFLAGS="-D_GNU_SOURCE $optcflags" CXXFLAGS="-D_GNU_SOURCE $optcflags" LDFLAGS="$optldflags" ./configure --prefix="$butch_prefix"

# the python configure script does not care about C(XX)FLAGS being passed
sed -i "s@cflags': \[\]@cflags': ['-D_GNU_SOURCE -D_BSD_SOURCE']@" config.gypi

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install


code:
[mirrors]
ftp://ftp.gnupg.org/gcrypt/npth/npth-0.90.tar.bz2
[vars]
filesize=294430
sha512=be5b626e4eb1e1b0cc727c03f8412b1a3d8e9fd9ddac147680175f501249ab6a6e5ae6d3fafe1e5a8e450e922b0335e47976474625af3ad0a99e91ed9987b916

[deps]

[build]
CFLAGS=-D_GNU_SOURCE ./configure -C --prefix="$butch_prefix"
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/npth


code:
[mirrors]
https://tuxera.com/opensource/ntfs-3g_ntfsprogs-2016.2.22.tgz

[vars]
filesize=1264364
sha512=dbd36fadd2881db1d17fdbf5d2b4e50bbe11dc9dd0ad4917e7f8bc4032c2287346143756ce8754df0d46ce9209f2c0c41b626cad929d76a9bc881712c7101c15
desc="NTFS-3G Read/Write userspace driver and utilities, replaces ntfsprogs"
tardir=ntfs-3g_ntfsprogs-2016.2.22

[deps]
fuse
libgcrypt

[build]
#note, if have --enable-crypto, will require pkgs libnettle, libtasn1, gnutls.

CFLAGS="$optcflags" LDFLAGS="$optldflags" \
  ./configure -C --prefix="$butch_prefix" $xconfflags \
  --with-fuse=external --enable-extras --disable-crypto --enable-mount-helper

make -j$MAKE_THREADS || exit 1

make DESTDIR="$butch_install_dir" install


code:
[mirrors]
http://distro.ibiblio.org/quirky/quirky6/sources/t2/april/numlockx-1.2.tar.bz2

[vars]
filesize=68264
sha512=2441b427aa0aed2109fe34f7c3e2241b75c73f5d36af7dd4c741502f7bfb357bca9d117f0543eb218f52288080b6a8b1bf348cb56f06e1ca0d61d9b509e73bb6
desc="A small tool to start X with NumLock turned on"

[deps]
libx11
libxtst
libxext
inputproto
xextproto
kbproto
xproto

[build]
CFLAGS="-D_GNU_SOURCE $optcflags" \
LDFLAGS="$optldflags" \
  ./configure --prefix="$butch_prefix" $xconfflags

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/numlockx


code:
[vars]
filesize=48885
sha512=65985b9b963e2815c5aecdf1d728c802e4b4e97cd496a8e725e8a4c9040dd20ef7f727bfcd0fc012a1f5484f79322831c932e5e4c025c7a1704a687fd956d42a

[mirrors]
http://pkgs.fedoraproject.org/repo/pkgs/nwipe/nwipe-0.16.tar.gz/98487303370494b65df47e98649a054a/nwipe-0.16.tar.gz

[deps.host]
automake
autoconf

[deps]
libdevmapper
libuuid
libblkid
parted

[build]
patch -p1 < "$K"/nwipe-configure.patch
sh init.sh
CFLAGS="-Dloff_t=off_t $optcflags" LDFLAGS="$optldflags" LIBS="-lparted -luuid -ldevmapper -lblkid" \
  ./configure --prefix="$butch_prefix"

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/nwipe


code:
[mirrors]
http://openbox.org/dist/obconf/obconf-2.0.3.tar.gz

[vars]
filesize=267589
sha512=6bfef2a2b9be7c921ae2717582f53bef74f232d6cd5fee7da2ee1c982bbb61e0b3bc3bcdd64909d78cf3d6ab5eb774eb60b26d28786e1efc4f6def0c25866965
desc='configuration frontend for the openbox window manager'

[deps]
openbox
libstartup-notification
gtk+2
libglade

[build]
patch -p1 < "$K"/obconf-git.patch || \
  echo "WARNING: Patch failed to apply properly"
patch -p1 < "$K"/obconf-implicit.patch || \
  echo "WARNING: Patch failed to apply properly"

[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/')"
CFLAGS="$optcflags -D_GNU_SOURCE" \
LDFLAGS="$optldflags -llzma -lz -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C $xconfflags \
  --prefix="$butch_prefix" \
  --disable-nls
printf '#include <ctype.h>\n' >> config.h
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/obconf


code:
[mirrors]
https://github.com/ocaml/ocaml/archive/4.02.2.tar.gz

[vars]
filesize=3314612
sha512=1ed697383cb4772167178f1781d22f237dc0aceec2dc3cd4ecc051252c2933631d2ccd51725ce108b78a15589f260ca7691feea291233f5f2ef4384e6b1fcd01
tardir=ocaml-4.02.2
tarball=ocaml-4.02.2.tar.gz

[build]
./configure -prefix "$butch_install_dir""$butch_prefix" -libdir "$butch_root""$butch_prefix"/lib/ocaml
make world.opt
sed -i "s@$butch_root$butch_prefix/lib/ocaml@$butch_install_dir$butch_prefix/lib/ocaml@" config/Makefile
make install

path: pkg/ocaml


code:
[mirrors]
https://github.com/ocaml/camlp4/archive/4.02+6.tar.gz

[vars]
filesize=647140
sha512=abf5b2b652ea7abb5d380b83ec02b3df88146ccf3e9c73504829f382517b0b9b99e474747321212a84d93a2509968bff190722afbce65b004e8f00a0620f208c
tardir=camlp4-4.02-6

[deps.host]
ocaml

[build]
./configure --libdir="$butch_install_dir""$butch_prefix"/lib/ocaml --bindir="$butch_install_dir""$butch_prefix"/bin
make
make install


code:
[mirrors]
https://github.com/ocaml/opam/archive/1.2.2.tar.gz

[vars]
filesize=648951
sha512=12105b5219a14d4c4cb29c387dd5af858d2b4a2a1bad7dcd70e4c284fc52848df82933396571b85251d904b3c14cdf02db55060c1ba29dc34b8bab3721d05f54
tardir=opam-1.2.2

[deps.host]
ocaml
ocaml-camlp4
curl

[build]
./configure --prefix="$butch_prefix"
make lib-ext
make
make DESTDIR="$butch_install_dir" install

path: pkg/ocaml-opam


code:
[deps]
alsa-lib

[mirrors]
http://kcat.strangesoft.net/openal-releases/openal-soft-1.15.1.tar.bz2

[vars]
filesize=253006
sha512=ca6dafdd503d06892dff08763bc00b974ec6e7c4bf3dcebb4cb41a486b4ea777c278299a198db182fee888a19a5716bd57d91a2859b764a532138a79f2bd672f

[build]
mv Alc/mixer_inc.c Alc/mixer_inc.h

# patch so *.c can be compiled without depending on system specifics
patch -p1 < "$K"/openal-mixer.patch

cp "$K/openal.Makefile" Makefile

# find openal-soft-1.15.1/ -name '*.c' | xargs grep HAVE_ | perl -pe 's/.*?(HAVE_[\w+]*).*/$1/;' | sort -u | perl -ne 'print "// #define $_"'

cat << EOF > config.h
#ifndef CONFIG_H
#define CONFIG_H

#define ALSOFT_VERSION "1.15.1"
#define AL_ALEXT_PROTOTYPES

#ifdef __GNUC__
#define ALIGN(x) __attribute__((aligned(x)))
#define RESTRICT __restrict
#else
#define ALIGN(x)
#define RESTRICT
#endif

// #define HAVE_ALIGNED_ALLOC
#define HAVE_ALSA
// #define HAVE_ARM_NEON_H
// #define HAVE_COREAUDIO
// #define HAVE_CPUID_H
// #define HAVE_DLFCN_H
// #define HAVE_DSOUND
// #define HAVE_DYNLOAD
// #define HAVE_FESETROUND
#define HAVE_FLOAT_H
#define HAVE_GCC_DESTRUCTOR
// #define HAVE_GUIDDEF_H
// #define HAVE_IEEEFP_H
// #define HAVE_MALLOC_H
// #define HAVE_MMDEVAPI
// #define HAVE_NEON
// #define HAVE_OPENSL
// #define HAVE_OSS
// #define HAVE_PORTAUDIO
#define HAVE_POSIX_MEMALIGN
// #define HAVE_PTHREAD_NP_H
// #define HAVE_PTHREAD_SETSCHEDPARAM
// #define HAVE_PULSEAUDIO
// #define HAVE_SNDIO
// #define HAVE_SOLARIS
// #define HAVE_SSE
#define HAVE_STAT
#define HAVE_STDINT_H
#define HAVE_STRTOF
// #define HAVE_WAVE
// #define HAVE_WINDOWS_H
// #define HAVE_WINMM
// #define HAVE_XMMINTRIN_H
// #define HAVE__ALIGNED_MALLOC
// #define HAVE__CONTROLFP
// #define HAVE___CONTROL87_2
// #define HAVE___INT64

#endif
EOF

for i in OpenAL32/ Alc/ Alc/backends; do cp config.h $i ; done

printf '%s\n' "CFLAGS += $optcflags" >> config.mak

mkdir lib
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

dest="$butch_install_dir""$butch_prefix"
mkdir -p "$dest"/lib/pkgconfig
cp "$K"/openal.pc "$dest"/lib/pkgconfig/
sed -i "s/@prefix@/""$butch_prefix""/" "$dest"/lib/pkgconfig/openal.pc

path: pkg/openal


code:
[mirrors]
http://openbox.org/dist/openbox/openbox-3.5.0.tar.gz

[vars]
filesize=911834
sha512=208d2641e171eca5fae0a2104a9b3c6d685293b4d66a18c0c2900df267453911b8738ef239fd84656b41440a0568279de67b9af798a6457b7716b1aab14704b5
desc='window manager used by the LXDE desktop environment'

[deps]
libx11
libxext
glib
libxml2
pango

[deps.host]
pkgconf

[build]
patch -p1 < "$K"/openbox-git.patch
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/')"
CFLAGS="-D_GNU_SOURCE $optcflags" \
LDFLAGS="-lXext -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib $optldflags" \
  ./configure -C \
  --prefix="$butch_prefix" --disable-nls $xconfflags \
  --disable-imlib2 --disable-startup-notification
echo true > missing

[ -n "$CROSS_COMPILE" ] && "$K"/libtool.cross.gen --sysroot="$butch_root_dir"

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

dest="$butch_install_dir""$butch_prefix"
mkdir -p "$dest"/share/lxde/openbox
cp -f "$dest"/etc/xdg/openbox/menu.xml "$dest"/share/lxde/openbox/

path: pkg/openbox


code:
[mirrors]
http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.1p2.tar.gz
http://ftp.spline.de/pub/OpenBSD/OpenSSH/portable/openssh-7.1p2.tar.gz

[vars]
filesize=1475829
sha512=d5be60f3645ec238b21e1f2dfd801b2136146674bbc086ebdb14be516c613819bc87c84b5089f3a45fe6e137a7458404f79f42572c69d91571e45ebed9d5e3af

[deps]
libressl
sshd-service

[build]
patch -p1 < "$K"/openssh-sys_param.patch

# prevent from installing some things (keysign and maybe others) setuid.
sed -i 's@-m 4711@-m 0750@g' Makefile.in

[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine) \
  --with-sysroot=$butch_root_dir"

CC="$CC -D_BSD_SOURCE -DMISSING_FD_MASK -DMISSING_NFDBITS" CFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" \
  --sbindir="$butch_prefix"/bin --libexecdir="$butch_prefix"/lib/ssh \
  --sysconfdir="$butch_prefix"/etc/ssh \
  --with-privsep-user=nobody \
  --with-xauth="$butch_prefix"/bin/xauth \
  --with-ldflags="$optldflags" \
  --without-stackprotect \
  --with-md5-passwords --with-mantype=man --mandir="$butch_prefix"/share/man \
  --disable-strip --disable-lastlog --disable-utmp --disable-utmpx --disable-btmp \
  --disable-wtmp --disable-wtmpx --disable-pututline --disable-pututxline $xconfflags

mkdir netinet
touch netinet/in_systm.h

sed -i '/USE_BTMP/d' config.h
sed -i '/USE_UTMP/d' config.h
sed -i 's@HAVE_DECL_HOWMANY 1@HAVE_DECL_HOWMANY 0@' config.h

make -j$MAKE_THREADS

#key generation is disabled for packaging
#the sshd service will create the keys on service prereqs
make DESTDIR="$butch_install_dir" install-nokeys

IS="$K"/bin/butch-install-service
"$IS" --down --log --force openssh "$K"/services/openssh

dest="$butch_install_dir""$butch_prefix"

mv "$dest"/etc/ssh/sshd_config "$dest"/etc/ssh/sshd_config.default
cat << 'EOF' > "$dest"/etc/ssh/sshd_config
Port 22
Protocol 2
Ciphers chacha20-poly1305@openssh.com,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr
MACs hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha2-512
HostKey /etc/ssh/ssh_host_ed25519_key
HostKey /etc/ssh/ssh_host_rsa_key
UsePrivilegeSeparation sandbox
AuthorizedKeysFile  .ssh/authorized_keys
#X11Forwarding yes
AcceptEnv LANG LC_*
Subsystem sftp $butch_prefix/lib/ssh/sftp-server
EOF

path: pkg/openssh


code:
[mirrors]
https://github.com/SupSuper/OpenXcom/archive/v1.0.tar.gz

[vars]
filesize=2068640
sha512=597abd2e7160551a3d6020d7c6fec863f86b708910ee582d446f2a5f97be94dc7e2522ede2e7ab4f62a2d21acf07ce441a435f74b530950e2f0b5791c00e06ab
tardir=OpenXcom-1.0
tarball=OpenXcom-1.0.tar.gz

[deps]
ca-certificates
glu
libx11
mesalib
sdl
sdl-gfx
sdl-image
sdl-mixer
timidity
yaml-cpp

[deps.host]
cmake
wget

[build]
mkdir -p build && cd build
for i in ar ld nm objcopy objdump strip ; do
printf '#!/bin/sh\n%s%s "$@"\n' "$CROSS_COMPILE" "$i" > "$CROSS_COMPILE""$i"
chmod +x "$CROSS_COMPILE""$i"
done
[ -n "$CROSS_COMPILE" ] && xconfflags="
-DCMAKE_FIND_ROOT_PATH=$butch_root_dir$butch_prefix \
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
-DCMAKE_AR="$CROSS_COMPILE"ar \
-DCMAKE_LD="$CROSS_COMPILE"ld \
-DCMAKE_NM="$CROSS_COMPILE"nm \
-DCMAKE_OBJCOPY="$CROSS_COMPILE"objcopy \
-DCMAKE_OBJDUMP="$CROSS_COMPILE"objdump \
-DCMAKE_STRIP="$CROSS_COMPILE"strip \
"

CFLAGS="-D_GNU_SOURCE $optcflags" \
LDFLAGS="$optldflags  -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
CXXFLAGS="$optcflags" \
cmake $xconfflags \
  -DCMAKE_INSTALL_PREFIX="$butch_prefix" \
  -DCMAKE_VERBOSE_MAKEFILE=ON \
  ..
make -j$MAKE_THREADS VERBOSE=1
make DESTDIR="$butch_install_dir" install

path: pkg/openxcom


code:
[mirrors]
https://hkn.eecs.berkeley.edu/~mcmartin/ophis/Ophis-1.0.tar.gz

[vars]
filesize=269137
sha512=9b7d7ded3cf449c07b190dd365ea4e0a318fac23bdd4e2f6ced2553167d9790d0a091d4594abc1d02fa9e77bea155543d0cfc479039ba6e3de02a7174f240e14

[deps]
python

[build]
python setup.py install \
   --prefix="$butch_prefix" \
   --root="$butch_install_dir" \
   --optimize=1

path: pkg/ophis


code:
[mirrors]
https://ftp.mozilla.org/pub/mozilla.org/opus/opus-tools-0.1.9.tar.gz

[vars]
filesize=385158
sha512=e2cdc0c9c24297565f9d457893bcc548696b1a9c9b66e4cd48ddbe4dcf865bc50da5ed1b438b2b9ecdcd8be1d7c211d2be199f707cdbcd8a46a75353b0173a4c

[deps]
libflac
libogg
libopus

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" CXXFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" --disable-nls $xconfflags

#[ -n "$CROSS_COMPILE" ] && "$K"/libtool.cross.gen --sysroot="$butch_root_dir"

make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/opus-tools


code:
[mirrors]
https://ftp.mozilla.org/pub/mozilla.org/opus/opusfile-0.6.tar.gz

[vars]
filesize=437980
sha512=6fee48f3da21eeffed1ee5a3852234032aa559335225b07383c1104f5efba2f88aebe41c453ab2de472a69766e0fa9b48bec2f97d2a096b27afa96901802ba02

[deps]
libopus

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" CXXFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" --disable-nls $xconfflags

#[ -n "$CROSS_COMPILE" ] && "$K"/libtool.cross.gen --sysroot="$butch_root_dir"

make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/opusfile


code:
[mirrors]
http://downloads.sourceforge.net/project/p7zip/p7zip/9.38.1/p7zip_9.38.1_src_all.tar.bz2

[vars]
filesize=3917925
sha512=f524ffae54e0d9563a509cc4b243e830d882a925e682eb2e15e2d19cb72c947fddecd72c8507d6c1538b997b240b0827046fc2fb4f5e3f7d49840257c92b9c04
tardir=p7zip_9.38.1
desc='extractor for 7zip compression format'

[deps]

[build]
sed -i 's/-pipe -s//' makefile.machine &&
sed -i -e 's/chmod 555/chmod 755/' -e 's/chmod 444/chmod 644/' install.sh &&
make all3 -j$MAKE_THREADS OPTFLAGS="$optcflags" LDFLAGS="$optldflags"

dest="$butch_install_dir""$butch_prefix"
make DEST_HOME="$dest" \
     DEST_MAN="$dest"/share/man \
     DEST_SHARE_DOC="$dest"/share/doc/p7zip-9.20.1 install


code:
[mirrors]
http://ftp.gnome.org/pub/GNOME/sources/pango/1.36/pango-1.36.8.tar.xz

[vars]
filesize=1033528
sha512=799fad4add3b1ff297bd151a302d6724c5fb0223c9e0f710f97192c024de0175db9a03458e0c18019bdd987b04b5f74737659e113d6b511cf1fc118b9be3c215

[deps]
glib
fontconfig
libstdc++
libx11
libxft
cairo
harfbuzz

[build]
printf "all:\n\ttrue\n\ninstall:\n\ttrue\n\n" > tests/Makefile.in
cp "$K"/pango-querymodules.c pango/querymodules.c
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine) --with-sysroot=$butch_root_dir"
CFLAGS="$optcflags -D_GNU_SOURCE" LDFLAGS="$optldflags" \
CXXFLAGS="$optcflags" \
./configure -C --prefix="$butch_prefix" $xconfflags \
  --enable-introspection=no FREETYPE_LIBS=-lfreetype

[ -n "$CROSS_COMPILE" ] && "$K"/libtool.cross.gen --sysroot="$butch_root_dir"

make -j$MAKE_THREADS V=1
make DESTDIR="$butch_install_dir" install

if [ -z "$CROSS_COMPILE" ] ; then
echo query modules
dest="$butch_install_dir""$butch_prefix"
mkdir -p "$dest"/etc/pango
LD_LIBRARY_PATH="$dest"/lib \
  "$dest"/bin/pango-querymodules prefix="$butch_install_dir" > "$dest"/etc/pango/pango.modules
else
	echo "XXXXXXXXXXX WARNING: you must run pango-querymodules in the target rootfs! XXXXXXXXXX"
fi

path: pkg/pango


code:
[mirrors]
http://ftp.gnome.org/pub/GNOME/sources/pangomm/2.28/pangomm-2.28.4.tar.xz

[vars]
filesize=796212
sha512=85e327f5a85417c209cdffe52e5b776878233762e894d8bc6c353378cae9bec6d7f4181d21cf690c32d15ff7ac87272f1abd75352c3a73af9f98f1551df88a79
desc='C++ bindings for the pango library'

[deps]
pango
glibmm
cairomm

[build]
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"
CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" CXXFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
  ./configure -C --prefix="$butch_prefix" $xconfflags
[ -n "$CROSS_COMPILE" ] && "$K"/libtool.cross.gen --sysroot="$butch_root_dir"
for i in docs ; do
        printf 'all:\n\ttrue\ninstall:\n\ttrue\clean:\n\ttrue\n' > "$i"/Makefile
done
make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/pangomm


code:
[vars]
filesize=1655244
sha512=4e37dbdd6f5032c9ebfec43704f6882379597d038167b9c4d04053efa083c68a705196713864451fa9e11d32777e16c68982877945c5efd9ea5f8252cb20e1c4

[mirrors]
http://ftp.gnu.org/gnu/parted/parted-3.2.tar.xz

[deps]
libdevmapper
libuuid

[build]
patch -p1 < "$K"/parted-3.2-xfs.patch
[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CFLAGS="-D_GNU_SOURCE -Dloff_t=off_t $optcflags" LDFLAGS="$optldflags" \
  ./configure -C --prefix="$butch_prefix" $xconfflags \
  --enable-threads=posix       \
  --disable-shared --disable-nls --without-readline

make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

path: pkg/parted