diff --git a/packages/x11/driver/xf86-video-nvidia/build b/packages/x11/driver/xf86-video-nvidia/build
deleted file mode 100755
index 16a07eb429..0000000000
--- a/packages/x11/driver/xf86-video-nvidia/build
+++ /dev/null
@@ -1,28 +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
-
-cd $PKG_BUILD/kernel
- LDFLAGS="" make module CC=$CC SYSSRC=$(kernel_path) SYSOUT=$(kernel_path)
-
-cd ..
-# linking libnvidia-ml.so.$PKG_VERSION to libnvidia-ml.so.1
- ln -sf libnvidia-ml.so.$PKG_VERSION libnvidia-ml.so.1
\ No newline at end of file
diff --git a/packages/x11/driver/xf86-video-nvidia/install b/packages/x11/driver/xf86-video-nvidia/install
deleted file mode 100755
index d56b6e270c..0000000000
--- a/packages/x11/driver/xf86-video-nvidia/install
+++ /dev/null
@@ -1,52 +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
-
-mkdir -p $INSTALL/$XORG_PATH_MODULES/drivers
- cp -P $PKG_BUILD/nvidia_drv.so $INSTALL/$XORG_PATH_MODULES/drivers
-
-mkdir -p $INSTALL/$XORG_PATH_MODULES/extensions
-# rename to not conflicting with Mesa libGL.so
- cp -P $PKG_BUILD/libglx.so* $INSTALL/$XORG_PATH_MODULES/extensions/libglx_nvidia.so
-
-mkdir -p $INSTALL/etc/X11
- cp $PKG_DIR/config/*.conf $INSTALL/etc/X11
-
-mkdir -p $INSTALL/usr/lib
- cp -P $PKG_BUILD/libnvidia-glcore.so* $INSTALL/usr/lib
- cp -P $PKG_BUILD/libnvidia-ml.so* $INSTALL/usr/lib
- cp -P $PKG_BUILD/tls/libnvidia-tls.so* $INSTALL/usr/lib
-# rename to not conflicting with Mesa libGL.so
- cp -P $PKG_BUILD/libGL.so* $INSTALL/usr/lib/libGL_nvidia.so.1
-
-mkdir -p $INSTALL/lib/modules/`kernel_version`/nvidia
- cp $PKG_BUILD/kernel/nvidia.ko $INSTALL/lib/modules/`kernel_version`/nvidia
-
-mkdir -p $INSTALL/usr/bin
- cp $PKG_BUILD/nvidia-smi $INSTALL/usr/bin
-
-if [ "$VDPAU" = yes ]; then
- $SCRIPTS/install libvdpau
-
- mkdir -p $INSTALL/usr/lib/vdpau
- cp $PKG_BUILD/libvdpau_nvidia.so* $INSTALL/usr/lib/vdpau/libvdpau_nvidia.so.1
- ln -sf libvdpau_nvidia.so.1 $INSTALL/usr/lib/vdpau/libvdpau_nvidia.so
-fi
diff --git a/packages/x11/driver/xf86-video-nvidia/meta b/packages/x11/driver/xf86-video-nvidia/package.mk
similarity index 52%
rename from packages/x11/driver/xf86-video-nvidia/meta
rename to packages/x11/driver/xf86-video-nvidia/package.mk
index dcec41ade7..e0f03f5009 100644
--- a/packages/x11/driver/xf86-video-nvidia/meta
+++ b/packages/x11/driver/xf86-video-nvidia/package.mk
@@ -24,13 +24,64 @@ PKG_LICENSE="nonfree"
PKG_SITE="http://www.nvidia.com/"
[ "$TARGET_ARCH" = "i386" ] && PKG_URL="http://us.download.nvidia.com/XFree86/Linux-x86/$PKG_VERSION/NVIDIA-Linux-x86-$PKG_VERSION.run"
[ "$TARGET_ARCH" = "x86_64" ] && PKG_URL="http://us.download.nvidia.com/XFree86/Linux-x86_64/$PKG_VERSION/NVIDIA-Linux-x86_64-$PKG_VERSION-no-compat32.run"
-PKG_DEPENDS="linux libXinerama"
-PKG_BUILD_DEPENDS="toolchain util-macros linux xorg-server"
+PKG_DEPENDS_TARGET="linux libXinerama"
+PKG_BUILD_DEPENDS_TARGET="toolchain util-macros linux xorg-server"
PKG_NEED_UNPACK="$LINUX_DEPENDS"
PKG_PRIORITY="optional"
PKG_SECTION="x11/driver"
PKG_SHORTDESC="xf86-video-nvidia: The Xorg driver for NVIDIA video chips"
PKG_LONGDESC="These binary drivers provide optimized hardware acceleration of OpenGL applications via a direct-rendering X Server. AGP, PCIe, SLI, TV-out and flat panel displays are also supported. This version only supports GeForce 8xxx and higher of the Geforce GPUs plus complimentary Quadros and nforce."
-PKG_IS_ADDON="no"
+PKG_IS_ADDON="no"
PKG_AUTORECONF="no"
+
+if [ "$VDPAU" = yes ]; then
+ PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libvdpau"
+fi
+
+unpack() {
+ NV_PKG="`echo $PKG_URL | sed 's%.*/\(.*\)$%\1%'`"
+ [ -d $PKG_BUILD ] && rm -rf $PKG_BUILD
+
+ sh $SOURCES/$PKG_NAME/$NV_PKG --extract-only --target $BUILD/$PKG_NAME-$PKG_VERSION
+}
+
+make_target() {
+ unset LDFLAGS
+
+ cd kernel
+ make module CC=$CC SYSSRC=$(kernel_path) SYSOUT=$(kernel_path)
+ cd ..
+}
+
+makeinstall_target() {
+ mkdir -p $INSTALL/$XORG_PATH_MODULES/drivers
+ cp -P nvidia_drv.so $INSTALL/$XORG_PATH_MODULES/drivers
+
+ mkdir -p $INSTALL/$XORG_PATH_MODULES/extensions
+ # rename to not conflicting with Mesa libGL.so
+ cp -P libglx.so* $INSTALL/$XORG_PATH_MODULES/extensions/libglx_nvidia.so
+
+ mkdir -p $INSTALL/etc/X11
+ cp $PKG_DIR/config/*.conf $INSTALL/etc/X11
+
+ mkdir -p $INSTALL/usr/lib
+ cp -P libnvidia-glcore.so.$PKG_VERSION $INSTALL/usr/lib
+ cp -P libnvidia-ml.so.$PKG_VERSION $INSTALL/usr/lib
+ ln -sf libnvidia-ml.so.$PKG_VERSION $INSTALL/usr/lib/libnvidia-ml.so.1
+ cp -P tls/libnvidia-tls.so.$PKG_VERSION $INSTALL/usr/lib
+ # rename to not conflicting with Mesa libGL.so
+ cp -P libGL.so* $INSTALL/usr/lib/libGL_nvidia.so.1
+
+ mkdir -p $INSTALL/lib/modules/`kernel_version`/nvidia
+ cp kernel/nvidia.ko $INSTALL/lib/modules/`kernel_version`/nvidia
+
+ mkdir -p $INSTALL/usr/bin
+ cp nvidia-smi $INSTALL/usr/bin
+
+ if [ "$VDPAU" = yes ]; then
+ mkdir -p $INSTALL/usr/lib/vdpau
+ cp libvdpau_nvidia.so* $INSTALL/usr/lib/vdpau/libvdpau_nvidia.so.1
+ ln -sf libvdpau_nvidia.so.1 $INSTALL/usr/lib/vdpau/libvdpau_nvidia.so
+ fi
+}
diff --git a/packages/x11/driver/xf86-video-nvidia/unpack b/packages/x11/driver/xf86-video-nvidia/unpack
deleted file mode 100755
index 7bfc9597f5..0000000000
--- a/packages/x11/driver/xf86-video-nvidia/unpack
+++ /dev/null
@@ -1,31 +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
-
-require_eglibc $1
-
-NV_ARCH=x86
-[ "$TARGET_ARCH" = x86_64 ] && NV_ARCH=x86_64
-
-NV_PKG="`echo $PKG_URL | sed 's%.*/\(.*\)$%\1%'`"
-[ -d $PKG_BUILD ] && rm -rf $PKG_BUILD
-
-sh $SOURCES/$1/$NV_PKG --extract-only --target $BUILD/$PKG_NAME-$PKG_VERSION