diff --git a/packages/graphics/libpng-host/build b/packages/graphics/libpng-host/build
deleted file mode 100755
index 19109a0687..0000000000
--- a/packages/graphics/libpng-host/build
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-
-################################################################################
-# This file is part of OpenELEC - http://www.openelec.tv
-# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
-#
-# OpenELEC is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# OpenELEC is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OpenELEC. If not, see .
-################################################################################
-
-. config/options $1
-
-$SCRIPTS/unpack libpng
-
-LIBPNG_DIR=`ls -d $BUILD/libpng-[0-9]*`
-
-setup_toolchain host
-
-export CPPFLAGS="$CPPFLAGS -I$ROOT/$TOOLCHAIN/include"
-
-cd $LIBPNG_DIR
-
-mkdir -p .build-host && cd .build-host
-../configure --host=$HOST_NAME \
- --build=$HOST_NAME \
- --prefix=$ROOT/$TOOLCHAIN \
- --sysconfdir=$ROOT/$TOOLCHAIN/etc \
- --disable-static \
- --enable-shared \
-
-make
-make install
diff --git a/packages/graphics/libpng-host/meta b/packages/graphics/libpng-host/meta
deleted file mode 100644
index b51a759e71..0000000000
--- a/packages/graphics/libpng-host/meta
+++ /dev/null
@@ -1,34 +0,0 @@
-################################################################################
-# This file is part of OpenELEC - http://www.openelec.tv
-# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
-#
-# OpenELEC is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# OpenELEC is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OpenELEC. If not, see .
-################################################################################
-
-PKG_NAME="libpng"
-PKG_VERSION=""
-PKG_REV="1"
-PKG_ARCH="any"
-PKG_LICENSE="OSS"
-PKG_SITE="http://www.libpng.org/"
-PKG_URL=""
-PKG_DEPENDS=""
-PKG_BUILD_DEPENDS="toolchain zlib:host"
-PKG_PRIORITY="optional"
-PKG_SECTION="graphics"
-PKG_SHORTDESC="libpng: Portable Network Graphics (PNG) Reference Library"
-PKG_LONGDESC="PNG (Portable Network Graphics) is an extensible file format for the lossless, portable, well-compressed storage of raster images. PNG provides a patent-free replacement for GIF and can also replace many common uses of TIFF. Indexed-color, grayscale, and truecolor images are supported, plus an optional alpha channel. Sample depths range from 1 to 16 bits."
-PKG_IS_ADDON="no"
-
-PKG_AUTORECONF="no"
diff --git a/packages/graphics/libpng/build b/packages/graphics/libpng/build
deleted file mode 100755
index 82098963a8..0000000000
--- a/packages/graphics/libpng/build
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-
-################################################################################
-# This file is part of OpenELEC - http://www.openelec.tv
-# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
-#
-# OpenELEC is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# OpenELEC is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OpenELEC. If not, see .
-################################################################################
-
-. config/options $1
-
-CFLAGS="$CFLAGS -fPIC -DPIC"
-export CPPFLAGS="$CPPFLAGS -I$SYSROOT_PREFIX/usr/include"
-
-cd $PKG_BUILD
-mkdir -p .build-target && cd .build-target
-
-ac_cv_lib_z_zlibVersion=yes \
-../configure --host=$TARGET_NAME \
- --build=$HOST_NAME \
- --prefix=/usr \
- --sysconfdir=/etc \
- --enable-static \
- --disable-shared \
-
-make
-
-$MAKEINSTALL
-
-$SED "s:\([\"'= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" \
- $SYSROOT_PREFIX/usr/bin/libpng*-config
-
-$SED "s:libs=\"-lpng15\":libs=\"-lpng15 -lz\":g" \
- $SYSROOT_PREFIX/usr/bin/libpng*-config
-
-cp -P $SYSROOT_PREFIX/usr/bin/libpng*-config $ROOT/$TOOLCHAIN/bin
diff --git a/packages/graphics/libpng/meta b/packages/graphics/libpng/package.mk
similarity index 67%
rename from packages/graphics/libpng/meta
rename to packages/graphics/libpng/package.mk
index 02e3232013..22d224cb29 100644
--- a/packages/graphics/libpng/meta
+++ b/packages/graphics/libpng/package.mk
@@ -23,12 +23,37 @@ PKG_ARCH="any"
PKG_LICENSE="OSS"
PKG_SITE="http://www.libpng.org/"
PKG_URL="$SOURCEFORGE_SRC/libpng/$PKG_NAME-$PKG_VERSION.tar.xz"
-PKG_DEPENDS="zlib"
-PKG_BUILD_DEPENDS="toolchain zlib"
+PKG_DEPENDS_HOST=""
+PKG_DEPENDS_TARGET="zlib"
+PKG_BUILD_DEPENDS_HOST="toolchain zlib:host"
+PKG_BUILD_DEPENDS_TARGET="toolchain zlib"
PKG_PRIORITY="optional"
PKG_SECTION="graphics"
PKG_SHORTDESC="libpng: Portable Network Graphics (PNG) Reference Library"
PKG_LONGDESC="PNG (Portable Network Graphics) is an extensible file format for the lossless, portable, well-compressed storage of raster images. PNG provides a patent-free replacement for GIF and can also replace many common uses of TIFF. Indexed-color, grayscale, and truecolor images are supported, plus an optional alpha channel. Sample depths range from 1 to 16 bits."
-PKG_IS_ADDON="no"
+PKG_IS_ADDON="no"
PKG_AUTORECONF="yes"
+
+PKG_CONFIGURE_OPTS_TARGET="ac_cv_lib_z_zlibVersion=yes \
+ --enable-static \
+ --disable-shared"
+
+pre_configure_host() {
+ export CPPFLAGS="$CPPFLAGS -I$ROOT/$TOOLCHAIN/include"
+}
+
+pre_configure_target() {
+ export CFLAGS="$CFLAGS -fPIC -DPIC"
+ export CPPFLAGS="$CPPFLAGS -I$SYSROOT_PREFIX/usr/include"
+}
+
+post_makeinstall_target() {
+ sed -e "s:\([\"'= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" \
+ -e "s:libs=\"-lpng15\":libs=\"-lpng15 -lz\":g" \
+ -i $SYSROOT_PREFIX/usr/bin/libpng*-config
+
+ cp -P $SYSROOT_PREFIX/usr/bin/libpng*-config $ROOT/$TOOLCHAIN/bin
+
+ rm -rf $INSTALL/usr/bin
+}
diff --git a/packages/multimedia/SDL_image-host/meta b/packages/multimedia/SDL_image-host/meta
index ec9a34647b..820c78fcca 100644
--- a/packages/multimedia/SDL_image-host/meta
+++ b/packages/multimedia/SDL_image-host/meta
@@ -24,7 +24,7 @@ PKG_LICENSE="GPL"
PKG_SITE="http://www.libsdl.org/"
PKG_URL=""
PKG_DEPENDS=""
-PKG_BUILD_DEPENDS="toolchain SDL-host libpng-host libjpeg-turbo-host"
+PKG_BUILD_DEPENDS="toolchain SDL-host libpng:host libjpeg-turbo-host"
PKG_PRIORITY="optional"
PKG_SECTION="multimedia"
PKG_SHORTDESC="libsdl_image: A cross-platform Graphic API"