pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Add kodi 17.3 (Krypton), incomplete



Module Name:	pkgsrc-wip
Committed By:	coypu <coypu%sdf.org@localhost>
Pushed By:	coypu
Date:		Sat May 27 21:30:22 2017 +0300
Changeset:	d3544e563a83da77956a9368e73fb6121e27493f

Added Files:
	kodi/DESCR
	kodi/Makefile
	kodi/PLIST
	kodi/TODO
	kodi/distinfo
	kodi/files/project_cmake_platform_netbsd_defines.txt
	kodi/files/project_cmake_scripts_netbsd/ArchSetup.cmake
	kodi/files/project_cmake_scripts_netbsd/ExtraTargets.cmake
	kodi/files/project_cmake_scripts_netbsd/Install.cmake
	kodi/files/project_cmake_scripts_netbsd/Macros.cmake
	kodi/files/project_cmake_scripts_netbsd/PathSetup.cmake
	kodi/files/project_cmake_treedata_netbsd_subdirs.txt
	kodi/patches/patch-project_cmake_scripts_common_AddonsHelpers.cmake
	kodi/patches/patch-xbmc_GUIInfoManager.cpp
	kodi/patches/patch-xbmc_Util.cpp
	kodi/patches/patch-xbmc_addons_Addon.cpp
	kodi/patches/patch-xbmc_addons_AddonManager.cpp
	kodi/patches/patch-xbmc_cores_AudioEngine_AESinkFactory.cpp
	kodi/patches/patch-xbmc_cores_AudioEngine_Sinks_AESinkOSS.cpp
	kodi/patches/patch-xbmc_cores_DllLoader_CMakeLists.txt
	kodi/patches/patch-xbmc_cores_DllLoader_coffldr.h
	kodi/patches/patch-xbmc_cores_DllLoader_exports_emu__msvcrt.cpp
	kodi/patches/patch-xbmc_cores_DllLoader_exports_emu__msvcrt.h
	kodi/patches/patch-xbmc_cores_DllLoader_exports_util_EmuFileWrapper.h
	kodi/patches/patch-xbmc_cores_DllLoader_exports_wrapper.c
	kodi/patches/patch-xbmc_dialogs_GUIDialogMediaFilter.cpp
	kodi/patches/patch-xbmc_dialogs_GUIDialogNumeric.cpp
	kodi/patches/patch-xbmc_guilib_XBTFReader.cpp
	kodi/patches/patch-xbmc_interfaces_python_XBPython.cpp
	kodi/patches/patch-xbmc_linux_LinuxTimezone.cpp
	kodi/patches/patch-xbmc_linux_PlatformDefs.h
	kodi/patches/patch-xbmc_linux_XFileUtils.cpp
	kodi/patches/patch-xbmc_linux_XMemUtils.cpp
	kodi/patches/patch-xbmc_network_linux_NetworkLinux.cpp
	kodi/patches/patch-xbmc_peripherals_bus_PeripheralBusUSB.h
	kodi/patches/patch-xbmc_peripherals_bus_linux_PeripheralBusUSBLibUSB.cpp
	kodi/patches/patch-xbmc_settings_Settings.cpp
	kodi/patches/patch-xbmc_storage_DetectDVDType.cpp
	kodi/patches/patch-xbmc_storage_IoSupport.cpp
	kodi/patches/patch-xbmc_storage_MediaManager.cpp
	kodi/patches/patch-xbmc_storage_linux_DeviceKitDisksProvider.cpp
	kodi/patches/patch-xbmc_storage_linux_UDisksProvider.cpp
	kodi/patches/patch-xbmc_system.h
	kodi/patches/patch-xbmc_system__gl.h
	kodi/patches/patch-xbmc_threads_platform_pthreads_ThreadImpl.cpp
	kodi/patches/patch-xbmc_utils_CPUInfo.cpp
	kodi/patches/patch-xbmc_utils_CharsetConverter.cpp
	kodi/patches/patch-xbmc_utils_RssReader.cpp
	kodi/patches/patch-xbmc_utils_Stopwatch.cpp
	kodi/patches/patch-xbmc_utils_SystemInfo.cpp
	kodi/patches/patch-xbmc_utils_test_TestSystemInfo.cpp
	kodi/patches/patch-xbmc_windowing_WinEvents.cpp
	kodi/patches/patch-xbmc_windowing_WinEventsX11.cpp
	kodi/patches/patch-xbmc_windowing_WindowingFactory.h
	kodi/patches/patch-xbmc_windowing_X11_XRandR.cpp

Log Message:
Add kodi 17.3 (Krypton), incomplete

- still dying on undefined reference
- still fetching dvdread and others from the internet
- redundant dependencies

- no working install
- tested only on amd64 (ARM is very important)

- missing joerg's patch of "stuff is UB" because I'm lazy and nobody
upstreamed it

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=d3544e563a83da77956a9368e73fb6121e27493f

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 kodi/DESCR                                         |   6 +
 kodi/Makefile                                      | 134 ++++++++
 kodi/PLIST                                         |   0
 kodi/TODO                                          |   5 +
 kodi/distinfo                                      |  49 +++
 .../project_cmake_platform_netbsd_defines.txt      |   1 +
 .../project_cmake_scripts_netbsd/ArchSetup.cmake   |  29 ++
 .../ExtraTargets.cmake                             |   7 +
 .../project_cmake_scripts_netbsd/Install.cmake     | 353 +++++++++++++++++++++
 .../project_cmake_scripts_netbsd/Macros.cmake      |  95 ++++++
 .../project_cmake_scripts_netbsd/PathSetup.cmake   |  40 +++
 .../project_cmake_treedata_netbsd_subdirs.txt      |  13 +
 ...roject_cmake_scripts_common_AddonsHelpers.cmake |  15 +
 kodi/patches/patch-xbmc_GUIInfoManager.cpp         |  13 +
 kodi/patches/patch-xbmc_Util.cpp                   |  46 +++
 kodi/patches/patch-xbmc_addons_Addon.cpp           |  13 +
 kodi/patches/patch-xbmc_addons_AddonManager.cpp    |  13 +
 .../patch-xbmc_cores_AudioEngine_AESinkFactory.cpp |  40 +++
 ...atch-xbmc_cores_AudioEngine_Sinks_AESinkOSS.cpp | 106 +++++++
 .../patch-xbmc_cores_DllLoader_CMakeLists.txt      |  18 ++
 kodi/patches/patch-xbmc_cores_DllLoader_coffldr.h  |  26 ++
 ...ch-xbmc_cores_DllLoader_exports_emu__msvcrt.cpp | 110 +++++++
 ...atch-xbmc_cores_DllLoader_exports_emu__msvcrt.h |  13 +
 ...c_cores_DllLoader_exports_util_EmuFileWrapper.h |  13 +
 .../patch-xbmc_cores_DllLoader_exports_wrapper.c   |  13 +
 .../patch-xbmc_dialogs_GUIDialogMediaFilter.cpp    |  13 +
 .../patch-xbmc_dialogs_GUIDialogNumeric.cpp        |  12 +
 kodi/patches/patch-xbmc_guilib_XBTFReader.cpp      |  13 +
 .../patch-xbmc_interfaces_python_XBPython.cpp      |  13 +
 kodi/patches/patch-xbmc_linux_LinuxTimezone.cpp    |  13 +
 kodi/patches/patch-xbmc_linux_PlatformDefs.h       |  52 +++
 kodi/patches/patch-xbmc_linux_XFileUtils.cpp       |  40 +++
 kodi/patches/patch-xbmc_linux_XMemUtils.cpp        |  54 ++++
 .../patch-xbmc_network_linux_NetworkLinux.cpp      | 126 ++++++++
 .../patch-xbmc_peripherals_bus_PeripheralBusUSB.h  |  14 +
 ...eripherals_bus_linux_PeripheralBusUSBLibUSB.cpp |  13 +
 kodi/patches/patch-xbmc_settings_Settings.cpp      |  14 +
 kodi/patches/patch-xbmc_storage_DetectDVDType.cpp  |  13 +
 kodi/patches/patch-xbmc_storage_IoSupport.cpp      |  22 ++
 kodi/patches/patch-xbmc_storage_MediaManager.cpp   |  22 ++
 ...h-xbmc_storage_linux_DeviceKitDisksProvider.cpp |  12 +
 .../patch-xbmc_storage_linux_UDisksProvider.cpp    |  12 +
 kodi/patches/patch-xbmc_system.h                   |  13 +
 kodi/patches/patch-xbmc_system__gl.h               |  15 +
 ...h-xbmc_threads_platform_pthreads_ThreadImpl.cpp |  58 ++++
 kodi/patches/patch-xbmc_utils_CPUInfo.cpp          | 107 +++++++
 kodi/patches/patch-xbmc_utils_CharsetConverter.cpp |  13 +
 kodi/patches/patch-xbmc_utils_RssReader.cpp        |  18 ++
 kodi/patches/patch-xbmc_utils_Stopwatch.cpp        |  13 +
 kodi/patches/patch-xbmc_utils_SystemInfo.cpp       |  88 +++++
 .../patch-xbmc_utils_test_TestSystemInfo.cpp       |  33 ++
 kodi/patches/patch-xbmc_windowing_WinEvents.cpp    |  18 ++
 kodi/patches/patch-xbmc_windowing_WinEventsX11.cpp |  13 +
 .../patch-xbmc_windowing_WindowingFactory.h        |  56 ++++
 kodi/patches/patch-xbmc_windowing_X11_XRandR.cpp   |  13 +
 55 files changed, 2087 insertions(+)

diffs:
diff --git a/kodi/DESCR b/kodi/DESCR
new file mode 100644
index 0000000000..7d33221d1e
--- /dev/null
+++ b/kodi/DESCR
@@ -0,0 +1,6 @@
+Kodi (formerly known as XBMC) is an award-winning free and open source (GPL)
+software media center for playing videos, music, pictures, games, and more.
+Kodi features a 10-foot user interface for use with televisions and remote
+controls. It allows users to play and view most videos, music, podcasts, and
+other digital media files from local and network storage media and the
+internet.
diff --git a/kodi/Makefile b/kodi/Makefile
new file mode 100644
index 0000000000..6470afa5c0
--- /dev/null
+++ b/kodi/Makefile
@@ -0,0 +1,134 @@
+# $NetBSD: Makefile,v 1.24 2017/04/30 01:21:55 ryoon Exp $
+
+PKGNAME=	kodi-17.3
+DISTNAME=	17.3-Krypton
+CATEGORIES=	multimedia
+MASTER_SITES=	http://mirrors.kodi.tv/releases/source/
+
+MAINTAINER=	jmcneill%invisible.ca@localhost
+HOMEPAGE=	http://kodi.tv/
+COMMENT=	Open source software media center
+LICENSE=	gnu-gpl-v2
+
+DEPENDS+=	unzip-[0-9]*:../../archivers/unzip
+DEPENDS+=	zip-[0-9]*:../../archivers/zip
+BUILD_DEPENDS+=	gettext-tools-[0-9]*:../../devel/gettext-tools
+BUILD_DEPENDS+=	cmake-[0-9]*:../../devel/cmake
+BUILD_DEPENDS+=	gperf-[0-9]*:../../devel/gperf
+
+EXTRACT_USING=	gtar
+
+WRKSRC=			${WRKDIR}/xbmc-xbmc-147cec4
+USE_LIBTOOL=		yes
+USE_TOOLS+=		pkg-config automake autoconf autoreconf gawk cmake bash gmake
+USE_LANGUAGES=		c c++
+USE_JAVA=		build
+USE_JAVA2=		yes
+
+CMAKE_ARGS+=		-DJava_JAVA_EXECUTABLE=${JAVA_BINPREFIX}-java
+CMAKE_ARGS+=		-DENABLE_INTERNAL_CROSSGUID=no
+
+# internet download, problematic dependency for pkgsrc
+CMAKE_ARGS+=		-DENABLE_DVDCSS=no
+
+# XXX does not work?
+CMAKE_ARGS+=		-DKODI_DEPENDSBUILD=0
+
+PYTHON_VERSIONS_INCOMPATIBLE=	34 35 36 # insists on < 3.0 as of 15.2
+
+PLIST_SUBST+=		MACHINE_CPU=${MACHINE_CPU}
+
+post-patch:
+	${CP} -R ${FILESDIR}/project_cmake_scripts_netbsd/ \
+		${WRKSRC}/project/cmake/scripts/netbsd
+	${MKDIR} ${WRKSRC}/project/cmake/platform/netbsd
+	${MKDIR} ${WRKSRC}/project/cmake/treedata/netbsd
+	${CP} ${FILESDIR}/project_cmake_platform_netbsd_defines.txt \
+		${WRKSRC}/project/cmake/platform/netbsd/defines.txt
+	${CP} ${FILESDIR}/project_cmake_treedata_netbsd_subdirs.txt \
+		${WRKSRC}/project/cmake/treedata/netbsd/subdirs.txt
+
+do-build:
+	${MKDIR} ${WRKDIR}/kodi-build
+	cd ${WRKDIR}/kodi-build ; \
+	${CMAKE} ${WRKSRC}/project/cmake ${CMAKE_ARGS} ; \
+	${GMAKE}
+
+.include "../../archivers/bzip2/buildlink3.mk"
+.include "../../archivers/lzo/buildlink3.mk"
+.include "../../audio/libao/buildlink3.mk"
+.include "../../audio/libmodplug/buildlink3.mk"
+.include "../../audio/libmpcdec/buildlink3.mk"
+.include "../../audio/libvorbis/buildlink3.mk"
+#.include "../../audio/pulseaudio/buildlink3.mk"
+.include "../../audio/taglib/buildlink3.mk"
+.include "../../converters/fribidi/buildlink3.mk"
+.include "../../databases/sqlite3/buildlink3.mk"
+.include "../../databases/mysql55-client/buildlink3.mk"
+#.include "../../devel/SDL2/buildlink3.mk"
+.include "../../devel/boost-libs/buildlink3.mk"
+.include "../../wip/crossguid/buildlink3.mk"
+.include "../../devel/libltdl/buildlink3.mk"
+.include "../../devel/libusb/buildlink3.mk"
+.include "../../devel/pcre/buildlink3.mk"
+.include "../../devel/swig2/buildlink3.mk"
+.include "../../devel/yajl/buildlink3.mk"
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../fonts/fontconfig/buildlink3.mk"
+.include "../../graphics/MesaLib/buildlink3.mk"
+.include "../../graphics/freetype2/buildlink3.mk"
+.include "../../graphics/giflib/buildlink3.mk"
+.include "../../graphics/glew/buildlink3.mk"
+.include "../../graphics/glu/buildlink3.mk"
+.include "../../graphics/hicolor-icon-theme/buildlink3.mk"
+.include "../../graphics/jasper/buildlink3.mk"
+.include "../../graphics/png/buildlink3.mk"
+.include "../../graphics/tiff/buildlink3.mk"
+.include "../../lang/python/application.mk"
+.include "../../misc/libcdio/buildlink3.mk"
+.include "../../misc/libcec/buildlink3.mk"
+.include "../../mk/java-vm.mk"
+.include "../../mk/jpeg.buildlink3.mk"
+.include "../../mk/oss.buildlink3.mk"
+
+.include "../../multimedia/ffmpeg2/buildlink3.mk"
+.include "../../multimedia/ffmpeg3/buildlink3.mk"
+
+
+.include "../../multimedia/libass/buildlink3.mk"
+.include "../../multimedia/libbluray/buildlink3.mk"
+.include "../../multimedia/libmpeg2/buildlink3.mk"
+.include "../../multimedia/libogg/buildlink3.mk"
+.include "../../multimedia/libva/available.mk"
+.if ${VAAPI_AVAILABLE} == "yes"
+.include "../../multimedia/libva/buildlink3.mk"
+.endif
+.include "../../multimedia/libvdpau/available.mk"
+.if ${VDPAU_AVAILABLE} == "yes"
+.include "../../multimedia/libvdpau/buildlink3.mk"
+.endif
+.include "../../net/avahi/buildlink3.mk"
+# builtin for now
+#.include "../../net/libupnp/buildlink3.mk"
+.include "../../archivers/libunrar/buildlink3.mk" # XXX new bl3
+.include "../../multimedia/libdvdread/buildlink3.mk"
+
+# XXX still builtin, still undefined reference
+.include "../../wip/cpluff/buildlink3.mk"
+
+.include "../../net/samba/buildlink3.mk"
+.include "../../security/libssh/buildlink3.mk"
+.include "../../security/openssl/buildlink3.mk"
+.include "../../sysutils/dbus/buildlink3.mk"
+.include "../../sysutils/desktop-file-utils/desktopdb.mk"
+.include "../../textproc/libplist/buildlink3.mk"
+.include "../../textproc/tinyxml/buildlink3.mk"
+.include "../../textproc/libxml2/buildlink3.mk"
+.include "../../textproc/libxslt/buildlink3.mk"
+.include "../../www/curl/buildlink3.mk"
+.include "../../www/libmicrohttpd/buildlink3.mk"
+.include "../../x11/libXinerama/buildlink3.mk"
+.include "../../x11/libXmu/buildlink3.mk"
+.include "../../x11/libXrandr/buildlink3.mk"
+.include "../../x11/libXt/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/kodi/PLIST b/kodi/PLIST
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/kodi/TODO b/kodi/TODO
new file mode 100644
index 0000000000..2bd7695605
--- /dev/null
+++ b/kodi/TODO
@@ -0,0 +1,5 @@
+- kodi.bin dying on undefined reference to dllmalloc(?)
+- install
+- test that ARM still works
+- remove redundant dependencies
+- stop downloading things from the internet
diff --git a/kodi/distinfo b/kodi/distinfo
new file mode 100644
index 0000000000..84e1d0902c
--- /dev/null
+++ b/kodi/distinfo
@@ -0,0 +1,49 @@
+$NetBSD: distinfo,v 1.13 2017/02/21 16:03:21 joerg Exp $
+
+SHA1 (17.3-Krypton.tar.gz) = b76cd67f2cb32537a107664837a89d93209dd568
+RMD160 (17.3-Krypton.tar.gz) = 2b7d17470fb4e0fd3f9e76a9b2b5b0af4950ba33
+SHA512 (17.3-Krypton.tar.gz) = f071278892b9b241662ac03c415d4ad23b7abbbe59cad7c0602799bcbe85757faf9bf7e4ff262c81d5da7bb6ce5de17c9c9cd2628cd7995f51528db5b5f2fc4b
+Size (17.3-Krypton.tar.gz) = 58461624 bytes
+SHA1 (patch-project_cmake_scripts_common_AddonsHelpers.cmake) = a8556567e7caaeedf65d169f08d7e00776a9f5aa
+SHA1 (patch-xbmc_GUIInfoManager.cpp) = 8ffd619dfc7f611da927422e9be295d8fa5fb71c
+SHA1 (patch-xbmc_Util.cpp) = 220eff4deb87516674f663ac056b04928a60a885
+SHA1 (patch-xbmc_addons_Addon.cpp) = c8d46450fd204dbd91146a65d43a7cc9eeaa1a10
+SHA1 (patch-xbmc_addons_AddonManager.cpp) = 373e48056ee18d67bace126cf79b639fa01f876a
+SHA1 (patch-xbmc_cores_AudioEngine_AESinkFactory.cpp) = 5437865b90130d7a0dc780fc1d542e6cfc8cc309
+SHA1 (patch-xbmc_cores_AudioEngine_Sinks_AESinkOSS.cpp) = eb359844589ca8575fe0c1841506d715513ea092
+SHA1 (patch-xbmc_cores_DllLoader_CMakeLists.txt) = eecf6f216cfa6a2327ee9b63d19b4b3b5d7d600b
+SHA1 (patch-xbmc_cores_DllLoader_coffldr.h) = eef5a51aaf084db69ffe90315f063f82f9bcab8a
+SHA1 (patch-xbmc_cores_DllLoader_exports_emu__msvcrt.cpp) = 3cbb79110b40320de919c808f798185f57924dc7
+SHA1 (patch-xbmc_cores_DllLoader_exports_emu__msvcrt.h) = 6047438509663af2826bd5e6c181d9018f86b27c
+SHA1 (patch-xbmc_cores_DllLoader_exports_util_EmuFileWrapper.h) = a4d62050c1efb96a0b1e6ccb2d9529f6ae3a1135
+SHA1 (patch-xbmc_cores_DllLoader_exports_wrapper.c) = 275e8e9fed74e0a97c9c138ab37d21cff62d4e33
+SHA1 (patch-xbmc_dialogs_GUIDialogMediaFilter.cpp) = 3e468c187236281ae6ebdcd08a2fd13e6a7e4eb2
+SHA1 (patch-xbmc_dialogs_GUIDialogNumeric.cpp) = cbc6cfc83bd8855d6d8ab62029c6f5a930f00a1a
+SHA1 (patch-xbmc_guilib_XBTFReader.cpp) = cdfee3436c28da1475a577d1d9c6fe81237a2f95
+SHA1 (patch-xbmc_interfaces_python_XBPython.cpp) = 0ad33ef736f12b6aca8667da5d50998d69c90ea7
+SHA1 (patch-xbmc_linux_LinuxTimezone.cpp) = 9efe9ff8851c4bc38bd975b1b532d03a9cffc3bf
+SHA1 (patch-xbmc_linux_PlatformDefs.h) = 56d70fce18807b10cb8d42ac0feca94d0c113c57
+SHA1 (patch-xbmc_linux_XFileUtils.cpp) = ebd8b2caf5bd930757dae6764bc14adfea785e22
+SHA1 (patch-xbmc_linux_XMemUtils.cpp) = 2c8fb8f80feb4d5f50518d9bd6fcc69519674658
+SHA1 (patch-xbmc_network_linux_NetworkLinux.cpp) = cfdd3c76ba4f562e8f11141fe9e825912630faf6
+SHA1 (patch-xbmc_peripherals_bus_PeripheralBusUSB.h) = e3682d8fbfad9bca11a706c2ca3a77f0a7751e3a
+SHA1 (patch-xbmc_peripherals_bus_linux_PeripheralBusUSBLibUSB.cpp) = 040678e8379f6797e8276d9787d60fcdb24e17c9
+SHA1 (patch-xbmc_settings_Settings.cpp) = aa2426fcd69652bc656dba0b7d92341235309a8f
+SHA1 (patch-xbmc_storage_DetectDVDType.cpp) = 7414b122a2787dfe8a4753b50445b16230262d92
+SHA1 (patch-xbmc_storage_IoSupport.cpp) = d15ff91f76f0ce063dc6dda104a595f33bbdc01e
+SHA1 (patch-xbmc_storage_MediaManager.cpp) = 5a816d5c6b060a99aa498f6f9b62571873d23970
+SHA1 (patch-xbmc_storage_linux_DeviceKitDisksProvider.cpp) = d3fdb7286528878f53d83a2ce98ebfc5e1032d19
+SHA1 (patch-xbmc_storage_linux_UDisksProvider.cpp) = 4f4c31fec090f23c5b05e8b6f52ef720d2da7101
+SHA1 (patch-xbmc_system.h) = 10738c487ed6c2de066483cc077ad05037132da8
+SHA1 (patch-xbmc_system__gl.h) = ac85116c9a78e2671052402c9823c6172200b808
+SHA1 (patch-xbmc_threads_platform_pthreads_ThreadImpl.cpp) = f8853a8ace422d9ab088be89b5562da552edcc7a
+SHA1 (patch-xbmc_utils_CPUInfo.cpp) = 236c72c5895b11ce87648bdf0e7a5b17fffcfa31
+SHA1 (patch-xbmc_utils_CharsetConverter.cpp) = 1241e65d89c2e02d6b6d0b6eb0957b8a3018b9ec
+SHA1 (patch-xbmc_utils_RssReader.cpp) = f4edccaa464376761baca4808c2ecbeabba6ad7b
+SHA1 (patch-xbmc_utils_Stopwatch.cpp) = fd2b8f7112e89ce164a0329ea3ee389f85705d1f
+SHA1 (patch-xbmc_utils_SystemInfo.cpp) = 4bb08a5e90309163bd0321b40a8bfd7c309fe96e
+SHA1 (patch-xbmc_utils_test_TestSystemInfo.cpp) = eeca9e097346f9f2c7f047f5906d6ffb75fd393b
+SHA1 (patch-xbmc_windowing_WinEvents.cpp) = 5e1c202214cd95671cc8bb503dd49080efd828f2
+SHA1 (patch-xbmc_windowing_WinEventsX11.cpp) = bca8536bdeb09c7396c8a917074e71fe3045dec6
+SHA1 (patch-xbmc_windowing_WindowingFactory.h) = 765e545100588b2d5acd05e4d4314bbd3cb4096f
+SHA1 (patch-xbmc_windowing_X11_XRandR.cpp) = e0d03f225704019fb162022020d1d9ed72ed480a
diff --git a/kodi/files/project_cmake_platform_netbsd_defines.txt b/kodi/files/project_cmake_platform_netbsd_defines.txt
new file mode 100644
index 0000000000..db95f700f4
--- /dev/null
+++ b/kodi/files/project_cmake_platform_netbsd_defines.txt
@@ -0,0 +1 @@
+-DTARGET_POSIX -DTARGET_NETBSD -D_LINUX
diff --git a/kodi/files/project_cmake_scripts_netbsd/ArchSetup.cmake b/kodi/files/project_cmake_scripts_netbsd/ArchSetup.cmake
new file mode 100644
index 0000000000..a6df976587
--- /dev/null
+++ b/kodi/files/project_cmake_scripts_netbsd/ArchSetup.cmake
@@ -0,0 +1,29 @@
+set(ARCH_DEFINES -D_NETBSD -DTARGET_POSIX -DTARGET_NETBSD)
+set(SYSTEM_DEFINES)
+set(PLATFORM_DIR linux)
+set(CMAKE_SYSTEM_NAME NetBSD)
+if(WITH_ARCH)
+  set(ARCH ${WITH_ARCH})
+else()
+  if(CPU STREQUAL x86_64)
+    set(ARCH x86_64-netbsd)
+    set(NEON False)
+  elseif(CPU MATCHES "i386")
+    set(ARCH i486-netbsd)
+    set(NEON False)
+    add_options(CXX ALL_BUILDS "-msse")
+  elseif(CPU MATCHES arm) # XXX non-neon
+    set(ARCH arm)
+    set(NEON True)
+    set(NEON_FLAGS "-mfpu=neon -mvectorize-with-neon-quad")
+  else()
+    message(SEND_ERROR "Unknown CPU: ${CPU}")
+  endif()
+endif()
+
+# Make sure we strip binaries in Release build
+if(CMAKE_BUILD_TYPE STREQUAL Release AND CMAKE_COMPILER_IS_GNUCXX)
+  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
+endif()
+
+find_package(CXX11 REQUIRED)
diff --git a/kodi/files/project_cmake_scripts_netbsd/ExtraTargets.cmake b/kodi/files/project_cmake_scripts_netbsd/ExtraTargets.cmake
new file mode 100644
index 0000000000..f3bafbb339
--- /dev/null
+++ b/kodi/files/project_cmake_scripts_netbsd/ExtraTargets.cmake
@@ -0,0 +1,7 @@
+# xrandr
+if(ENABLE_X11 AND X_FOUND AND XRANDR_FOUND)
+  find_package(X QUIET)
+  find_package(XRandR QUIET)
+  add_executable(${APP_NAME_LC}-xrandr ${CORE_SOURCE_DIR}/xbmc-xrandr.c)
+  target_link_libraries(${APP_NAME_LC}-xrandr ${SYSTEM_LDFLAGS} ${X_LIBRARIES} m ${XRANDR_LIBRARIES})
+endif()
diff --git a/kodi/files/project_cmake_scripts_netbsd/Install.cmake b/kodi/files/project_cmake_scripts_netbsd/Install.cmake
new file mode 100644
index 0000000000..b6c1707b96
--- /dev/null
+++ b/kodi/files/project_cmake_scripts_netbsd/Install.cmake
@@ -0,0 +1,353 @@
+if(X_FOUND)
+  set(USE_X11 1)
+else()
+  set(USE_X11 0)
+endif()
+if(OPENGL_FOUND)
+  set(USE_OPENGL 1)
+else()
+  set(USE_OPENGL 0)
+endif()
+if(OPENGLES_FOUND)
+  set(USE_OPENGLES 1)
+else()
+  set(USE_OPENGLES 0)
+endif()
+
+# CMake config
+set(APP_PREFIX ${prefix})
+set(APP_LIB_DIR ${libdir}/${APP_NAME_LC})
+set(APP_DATA_DIR ${datarootdir}/${APP_NAME_LC})
+set(APP_INCLUDE_DIR ${includedir}/${APP_NAME_LC})
+set(CXX11_SWITCH "-std=c++11")
+
+# Configure startup scripts
+configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi.sh.in
+               ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC} @ONLY)
+configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.in
+               ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}-standalone @ONLY)
+
+# Configure cmake files
+configure_file(${PROJECT_SOURCE_DIR}/KodiConfig.cmake.in
+               ${CORE_BUILD_DIR}/scripts/${APP_NAME}Config.cmake @ONLY)
+
+# Configure xsession entry
+configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi-xsession.desktop.in
+               ${CORE_BUILD_DIR}/${APP_NAME_LC}-xsession.desktop @ONLY)
+
+# Configure desktop entry
+configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi.desktop.in
+               ${CORE_BUILD_DIR}/${APP_NAME_LC}.desktop @ONLY)
+
+# Install app
+install(TARGETS ${APP_NAME_LC}
+        DESTINATION ${libdir}/${APP_NAME_LC}
+        COMPONENT kodi-bin)
+if(ENABLE_X11 AND XRANDR_FOUND)
+  install(TARGETS ${APP_NAME_LC}-xrandr
+          DESTINATION ${libdir}/${APP_NAME_LC}
+          COMPONENT kodi-bin)
+endif()
+
+# Install scripts
+install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}
+                 ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}-standalone
+        DESTINATION ${bindir}
+        COMPONENT kodi-bin)
+
+# Install libraries
+foreach(library ${LIBRARY_FILES})
+  get_filename_component(dir ${library} DIRECTORY)
+  string(REPLACE "${CMAKE_BINARY_DIR}/" "" dir ${dir})
+  install(PROGRAMS ${library}
+          DESTINATION ${libdir}/${APP_NAME_LC}/${dir}
+          COMPONENT kodi-bin)
+endforeach()
+
+# Install add-ons, fonts, icons, keyboard maps, keymaps, etc
+# (addons, media, system, userdata folders in share/kodi/)
+foreach(file ${install_data})
+  get_filename_component(dir ${file} DIRECTORY)
+  install(FILES ${CMAKE_BINARY_DIR}/${file}
+          DESTINATION ${datarootdir}/${APP_NAME_LC}/${dir}
+          COMPONENT kodi)
+endforeach()
+
+# Install xsession entry
+install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${APP_NAME_LC}-xsession.desktop
+        RENAME ${APP_NAME_LC}.desktop
+        DESTINATION ${datarootdir}/xsessions
+        COMPONENT kodi)
+
+# Install desktop entry
+install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${APP_NAME_LC}.desktop
+        DESTINATION ${datarootdir}/applications
+        COMPONENT kodi)
+
+# Install icons
+install(FILES ${CORE_SOURCE_DIR}/tools/Linux/packaging/media/icon16x16.png
+        RENAME ${APP_NAME_LC}.png
+        DESTINATION ${datarootdir}/icons/hicolor/16x16/apps
+        COMPONENT kodi)
+install(FILES ${CORE_SOURCE_DIR}/tools/Linux/packaging/media/icon22x22.png
+        RENAME ${APP_NAME_LC}.png
+        DESTINATION ${datarootdir}/icons/hicolor/22x22/apps
+        COMPONENT kodi)
+install(FILES ${CORE_SOURCE_DIR}/tools/Linux/packaging/media/icon24x24.png
+        RENAME ${APP_NAME_LC}.png
+        DESTINATION ${datarootdir}/icons/hicolor/24x24/apps
+        COMPONENT kodi)
+install(FILES ${CORE_SOURCE_DIR}/tools/Linux/packaging/media/icon32x32.png
+        RENAME ${APP_NAME_LC}.png
+        DESTINATION ${datarootdir}/icons/hicolor/32x32/apps
+        COMPONENT kodi)
+install(FILES ${CORE_SOURCE_DIR}/tools/Linux/packaging/media/icon48x48.png
+        RENAME ${APP_NAME_LC}.png
+        DESTINATION ${datarootdir}/icons/hicolor/48x48/apps
+        COMPONENT kodi)
+install(FILES ${CORE_SOURCE_DIR}/tools/Linux/packaging/media/icon64x64.png
+        RENAME ${APP_NAME_LC}.png
+        DESTINATION ${datarootdir}/icons/hicolor/64x64/apps
+        COMPONENT kodi)
+install(FILES ${CORE_SOURCE_DIR}/tools/Linux/packaging/media/icon128x128.png
+        RENAME ${APP_NAME_LC}.png
+        DESTINATION ${datarootdir}/icons/hicolor/128x128/apps
+        COMPONENT kodi)
+install(FILES ${CORE_SOURCE_DIR}/tools/Linux/packaging/media/icon256x256.png
+        RENAME ${APP_NAME_LC}.png
+        DESTINATION ${datarootdir}/icons/hicolor/256x256/apps
+        COMPONENT kodi)
+
+# Install docs
+install(FILES ${CORE_SOURCE_DIR}/copying.txt
+              ${CORE_SOURCE_DIR}/LICENSE.GPL
+              ${CORE_SOURCE_DIR}/version.txt
+              ${CORE_SOURCE_DIR}/docs/README.linux
+        DESTINATION ${docdir}
+        COMPONENT kodi)
+
+install(FILES ${CORE_SOURCE_DIR}/privacy-policy.txt
+        DESTINATION ${datarootdir}/${APP_NAME_LC}
+        COMPONENT kodi)
+
+# Install kodi-tools-texturepacker
+if(NOT WITH_TEXTUREPACKER)
+  install(PROGRAMS $<TARGET_FILE:TexturePacker::TexturePacker>
+          DESTINATION ${bindir}
+          COMPONENT kodi-tools-texturepacker)
+endif()
+
+# Install kodi-addon-dev headers
+install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_types.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_utils.hpp
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h
+              ${CORE_SOURCE_DIR}/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h
+              ${CORE_SOURCE_DIR}/xbmc/filesystem/IFileTypes.h
+        DESTINATION ${includedir}/${APP_NAME_LC}
+        COMPONENT kodi-addon-dev)
+
+# Install kodi-addon-dev add-on bindings
+install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME}Config.cmake
+              ${CORE_SOURCE_DIR}/project/cmake/scripts/common/AddonHelpers.cmake
+              ${CORE_SOURCE_DIR}/project/cmake/scripts/common/AddOptions.cmake
+              ${CORE_SOURCE_DIR}/project/cmake/scripts/common/ArchSetup.cmake
+              ${CORE_SOURCE_DIR}/project/cmake/scripts/common/CheckCommits.cmake
+              ${CORE_SOURCE_DIR}/project/cmake/scripts/common/CheckTargetPlatform.cmake
+              ${CORE_SOURCE_DIR}/project/cmake/scripts/common/GenerateVersionedFiles.cmake
+              ${CORE_SOURCE_DIR}/project/cmake/scripts/common/GeneratorSetup.cmake
+              ${CORE_SOURCE_DIR}/project/cmake/scripts/common/HandleDepends.cmake
+              ${CORE_SOURCE_DIR}/project/cmake/scripts/common/Macros.cmake
+              ${CORE_SOURCE_DIR}/project/cmake/scripts/common/PrepareEnv.cmake
+              ${CORE_SOURCE_DIR}/project/cmake/scripts/common/ProjectMacros.cmake
+              ${CORE_SOURCE_DIR}/project/cmake/scripts/linux/PathSetup.cmake
+        DESTINATION ${datarootdir}/${APP_NAME_LC}/cmake
+        COMPONENT kodi-addon-dev)
+
+# Install kodi-audio-dev
+install(FILES ${CORE_SOURCE_DIR}/xbmc/cores/AudioEngine/Utils/AEChannelData.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h
+        DESTINATION ${includedir}/${APP_NAME_LC}
+        COMPONENT kodi-audio-dev)
+
+if(ENABLE_EVENTCLIENTS)
+  # Install kodi-eventclients-common BT python files
+  install(PROGRAMS ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/bt/__init__.py
+                   ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/bt/bt.py
+                   ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/bt/hid.py
+          DESTINATION lib/python2.7/dist-packages/${APP_NAME_LC}/bt
+          COMPONENT kodi-eventclients-common)
+
+  # Install kodi-eventclients-common PS3 python files
+  install(PROGRAMS ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/__init__.py
+                   ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/keymaps.py
+                   ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/sixaxis.py
+                   ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/sixpair.py
+                   ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/sixwatch.py
+          DESTINATION lib/python2.7/dist-packages/${APP_NAME_LC}/ps3
+          COMPONENT kodi-eventclients-common)
+
+  # Install kodi-eventclients-common python files
+  file(WRITE ${CMAKE_BINARY_DIR}/packages/deb/defs.py ICON_PATH="usr/share/pixmaps/${APP_NAME_LC}/")
+  install(PROGRAMS ${CMAKE_BINARY_DIR}/packages/deb/defs.py
+                   ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/__init__.py
+                   "${CORE_SOURCE_DIR}/tools/EventClients/Clients/PS3 BD Remote/ps3_remote.py"
+                   ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/xbmcclient.py
+                   ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/zeroconf.py
+          DESTINATION lib/python2.7/dist-packages/${APP_NAME_LC}
+          COMPONENT kodi-eventclients-common)
+
+  # Install kodi-eventclients-common icons
+  install(FILES ${CORE_SOURCE_DIR}/tools/EventClients/icons/bluetooth.png
+                ${CORE_SOURCE_DIR}/tools/EventClients/icons/phone.png
+                ${CORE_SOURCE_DIR}/tools/EventClients/icons/mail.png
+                ${CORE_SOURCE_DIR}/tools/EventClients/icons/mouse.png
+          DESTINATION ${datarootdir}/pixmaps/${APP_NAME_LC}
+          COMPONENT kodi-eventclients-common)
+
+  # Install kodi-eventclients-dev headers
+  install(FILES ${CORE_SOURCE_DIR}/tools/EventClients/lib/c++/xbmcclient.h
+          DESTINATION ${includedir}/${APP_NAME_LC}
+          COMPONENT kodi-eventclients-dev)
+
+  # Install kodi-eventclients-dev C# examples
+  install(FILES "${CORE_SOURCE_DIR}/tools/EventClients/examples/c#/XBMCDemoClient1.cs"
+          DESTINATION "${docdir}/${APP_NAME_LC}-eventclients-dev/examples/C#"
+          COMPONENT kodi-eventclients-dev)
+
+  # Install kodi-eventclients-dev C++ examples
+  install(FILES ${CORE_SOURCE_DIR}/tools/EventClients/examples/c++/example_notification.cpp
+                ${CORE_SOURCE_DIR}/tools/EventClients/examples/c++/example_log.cpp
+                ${CORE_SOURCE_DIR}/tools/EventClients/examples/c++/example_button1.cpp
+                ${CORE_SOURCE_DIR}/tools/EventClients/examples/c++/example_mouse.cpp
+                ${CORE_SOURCE_DIR}/tools/EventClients/examples/c++/example_button2.cpp
+          DESTINATION ${docdir}/${APP_NAME_LC}-eventclients-dev/examples/C++
+          COMPONENT kodi-eventclients-dev)
+
+  # Install kodi-eventclients-dev java examples
+  install(FILES ${CORE_SOURCE_DIR}/tools/EventClients/examples/java/XBMCDemoClient1.java
+          DESTINATION ${docdir}/${APP_NAME_LC}-eventclients-dev/examples/java
+          COMPONENT kodi-eventclients-dev)
+
+  # Install kodi-eventclients-dev python examples
+  install(PROGRAMS ${CORE_SOURCE_DIR}/tools/EventClients/examples/python/example_mouse.py
+                   ${CORE_SOURCE_DIR}/tools/EventClients/examples/python/example_button1.py
+                   ${CORE_SOURCE_DIR}/tools/EventClients/examples/python/example_notification.py
+                   ${CORE_SOURCE_DIR}/tools/EventClients/examples/python/example_action.py
+                   ${CORE_SOURCE_DIR}/tools/EventClients/examples/python/example_button2.py
+                   ${CORE_SOURCE_DIR}/tools/EventClients/examples/python/example_simple.py
+          DESTINATION ${docdir}/${APP_NAME_LC}-eventclients-dev/examples/python
+          COMPONENT kodi-eventclients-dev)
+
+  # Install kodi-eventclients-ps3
+  install(PROGRAMS "${CORE_SOURCE_DIR}/tools/EventClients/Clients/PS3 BD Remote/ps3_remote.py"
+          RENAME ${APP_NAME_LC}-ps3remote
+          DESTINATION ${bindir}
+          COMPONENT kodi-eventclients-ps3)
+
+  if(BLUETOOTH_FOUND AND CWIID_FOUND)
+    # Install kodi-eventclients-wiiremote
+    install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/WiiRemote/${APP_NAME_LC}-wiiremote
+            DESTINATION ${bindir}
+            COMPONENT kodi-eventclients-wiiremote)
+  endif()
+
+  # Install kodi-eventclients-xbmc-send
+  install(PROGRAMS "${CORE_SOURCE_DIR}/tools/EventClients/Clients/Kodi Send/kodi-send.py"
+          RENAME ${APP_NAME_LC}-send
+          DESTINATION ${bindir}
+          COMPONENT kodi-eventclients-xbmc-send)
+endif()
+
+# Install kodi-inputstream-dev
+install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h
+        DESTINATION ${includedir}/${APP_NAME_LC}
+        COMPONENT kodi-inputstream-dev)
+
+# Install kodi-pvr-dev
+install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h
+        DESTINATION ${includedir}/${APP_NAME_LC}
+        COMPONENT kodi-pvr-dev)
+
+# Install kodi-screensaver-dev
+install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_types.h
+        DESTINATION ${includedir}/${APP_NAME_LC}
+        COMPONENT kodi-screensaver-dev)
+
+# Install kodi-visualization-dev
+install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h
+        DESTINATION ${includedir}/${APP_NAME_LC}
+        COMPONENT kodi-visualization-dev)
+
+# Install kodi-peripheral-dev
+install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_callbacks.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h
+              ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_utils.hpp
+        DESTINATION ${includedir}/${APP_NAME_LC}
+        COMPONENT kodi-peripheral-dev)
+
+# Install XBT skin files
+foreach(texture ${XBT_FILES})
+  string(REPLACE "${CMAKE_BINARY_DIR}/" "" dir ${texture})
+  get_filename_component(dir ${dir} DIRECTORY)
+  install(FILES ${texture}
+          DESTINATION ${datarootdir}/${APP_NAME_LC}/${dir}
+          COMPONENT kodi)
+endforeach()
+
+# Install extra stuff if it exists
+if(EXISTS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs)
+  install(CODE "file(STRINGS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs dirs)
+              foreach(dir \${dirs})
+                file(GLOB_RECURSE FILES RELATIVE ${CMAKE_BINARY_DIR} \${dir}/*)
+                foreach(file \${FILES})
+                  get_filename_component(dir \${file} DIRECTORY)
+                  file(INSTALL \${file} DESTINATION ${datarootdir}/${APP_NAME_LC}/\${dir})
+                endforeach()
+              endforeach()")
+endif()
+
+if(NOT "$ENV{DESTDIR}" STREQUAL "")
+  set(DESTDIR ${CMAKE_BINARY_DIR}/$ENV{DESTDIR})
+endif()
+foreach(subdir ${build_dirs})
+  if(NOT subdir MATCHES kodi-platform)
+    string(REPLACE " " ";" subdir ${subdir})
+    list(GET subdir 0 id)
+    install(CODE "execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${id}/src/${id}-build install DESTDIR=${DESTDIR})")
+  endif()
+endforeach()
+
+# generate packages? yes please, if everything checks out
+if(CPACK_GENERATOR)
+  if(CPACK_GENERATOR STREQUAL DEB AND ( CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL rbpi ) )
+    if(CMAKE_BUILD_TYPE STREQUAL Debug)
+      message(STATUS "DEB Generator: Build type is set to 'Debug'. Packaged binaries will be unstripped.")
+    endif()
+    include(${PROJECT_SOURCE_DIR}/cpack/CPackConfigDEB.cmake)
+  else()
+    message(FATAL_ERROR "DEB Generator: Can't configure CPack to generate Debian packages on non-linux systems.")
+  endif()
+endif()
diff --git a/kodi/files/project_cmake_scripts_netbsd/Macros.cmake b/kodi/files/project_cmake_scripts_netbsd/Macros.cmake
new file mode 100644
index 0000000000..b07b17f748
--- /dev/null
+++ b/kodi/files/project_cmake_scripts_netbsd/Macros.cmake
@@ -0,0 +1,95 @@
+function(core_link_library lib wraplib)
+  set(export -Wl,--unresolved-symbols=ignore-all
+             `cat ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/wrapper.def`
+             ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/CMakeFiles/wrapper.dir/wrapper.c.o)
+  set(check_arg "")
+  if(TARGET ${lib})
+    set(target ${lib})
+    set(link_lib $<TARGET_FILE:${lib}>)
+    set(check_arg ${ARGV2})
+    set(data_arg  ${ARGV3})
+  else()
+    set(target ${ARGV2})
+    set(link_lib ${lib})
+    set(check_arg ${ARGV3})
+    set(data_arg ${ARGV4})
+  endif()
+
+  # wrapper has to be adapted in order to support coverage.
+  if(CMAKE_BUILD_TYPE STREQUAL Coverage)
+    set(export "")
+  endif()
+
+  if(check_arg STREQUAL export)
+    set(export ${export}
+        -Wl,--version-script=${ARGV3})
+  elseif(check_arg STREQUAL extras)
+    foreach(arg ${data_arg})
+      list(APPEND export ${arg})
+    endforeach()
+  elseif(check_arg STREQUAL archives)
+    set(extra_libs ${data_arg})
+  endif()
+
+  string(REGEX REPLACE "[ ]+" ";" _flags "${CMAKE_SHARED_LINKER_FLAGS}")
+  get_filename_component(dir ${wraplib} DIRECTORY)
+  add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}
+                     COMMAND ${CMAKE_COMMAND} -E make_directory ${dir}
+                     COMMAND ${CMAKE_C_COMPILER}
+                     ARGS    ${_flags} -Wl,--whole-archive
+                             "${link_lib}" ${extra_libs}
+                             -Wl,--no-whole-archive -lm
+                             -Wl,-soname,${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}
+                             -shared -o ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}
+                             ${export}
+                     DEPENDS ${target} wrapper.def wrapper)
+
+  get_filename_component(libname ${wraplib} NAME_WE)
+  add_custom_target(wrap_${libname} ALL DEPENDS ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX})
+  set_target_properties(wrap_${libname} PROPERTIES FOLDER lib/wrapped)
+  add_dependencies(${APP_NAME_LC}-libraries wrap_${libname})
+
+  set(LIBRARY_FILES ${LIBRARY_FILES} ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} CACHE STRING "" FORCE)
+endfunction()
+
+function(find_soname lib)
+  cmake_parse_arguments(arg "REQUIRED" "" "" ${ARGN})
+
+  string(TOLOWER ${lib} liblow)
+  if(${lib}_LDFLAGS)
+    set(link_lib "${${lib}_LDFLAGS}")
+  else()
+    if(IS_ABSOLUTE "${${lib}_LIBRARIES}")
+      set(link_lib "${${lib}_LIBRARIES}")
+    else()
+      set(link_lib -l${${lib}_LIBRARIES})
+    endif()
+  endif()
+  execute_process(COMMAND ${CMAKE_C_COMPILER} -nostdlib -o /dev/null -Wl,-M ${link_lib} 
+                  COMMAND grep LOAD.*${liblow}
+                  ERROR_QUIET
+                  OUTPUT_VARIABLE ${lib}_FILENAME)
+  string(REPLACE "LOAD " "" ${lib}_FILENAME "${${lib}_FILENAME}")
+  string(STRIP "${${lib}_FILENAME}" ${lib}_FILENAME)
+  if(NOT ${lib}_FILENAME)
+    execute_process(COMMAND ${CMAKE_C_COMPILER} -nostdlib -o /dev/null -Wl,-t ${link_lib}
+                    OUTPUT_QUIET
+                    ERROR_VARIABLE _TMP_FILENAME)
+    string(REGEX MATCH ".*lib${liblow}.so" ${lib}_FILENAME ${_TMP_FILENAME})
+  endif()
+  if(${lib}_FILENAME)
+    execute_process(COMMAND objdump -p ${${lib}_FILENAME}
+                    COMMAND grep SONAME.*${liblow}
+                    ERROR_QUIET
+                    OUTPUT_VARIABLE ${lib}_SONAME)
+    string(REPLACE "SONAME " "" ${lib}_SONAME ${${lib}_SONAME})
+    string(STRIP ${${lib}_SONAME} ${lib}_SONAME)
+    if(VERBOSE)
+      message(STATUS "${lib} soname: ${${lib}_SONAME}")
+    endif()
+    set(${lib}_SONAME ${${lib}_SONAME} PARENT_SCOPE)
+  endif()
+  if(arg_REQUIRED AND NOT ${lib}_SONAME)
+    message(FATAL_ERROR "Could not find dynamically loadable library ${lib}")
+  endif()
+endfunction()
diff --git a/kodi/files/project_cmake_scripts_netbsd/PathSetup.cmake b/kodi/files/project_cmake_scripts_netbsd/PathSetup.cmake
new file mode 100644
index 0000000000..f9f78ba622
--- /dev/null
+++ b/kodi/files/project_cmake_scripts_netbsd/PathSetup.cmake
@@ -0,0 +1,40 @@
+include(GNUInstallDirs)
+
+if(NOT prefix)
+  set(prefix ${CMAKE_INSTALL_PREFIX})
+else()
+  set(CMAKE_INSTALL_PREFIX ${prefix})
+endif()
+if(NOT exec_prefix)
+  set(exec_prefix ${prefix})
+endif()
+if(NOT libdir)
+  set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
+endif()
+if(NOT bindir)
+  set(bindir ${CMAKE_INSTALL_FULL_BINDIR})
+endif()
+if(NOT includedir)
+  set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
+endif()
+if(NOT datarootdir)
+  set(datarootdir ${CMAKE_INSTALL_FULL_DATAROOTDIR})
+endif()
+if(NOT datadir)
+  set(datadir ${CMAKE_INSTALL_FULL_DATADIR})
+endif()
+if(NOT docdir)
+  set(docdir ${CMAKE_INSTALL_FULL_DOCDIR})
+endif()
+
+list(APPEND final_message "-- PATH config --")
+list(APPEND final_message "Prefix: ${prefix}")
+list(APPEND final_message "Libdir: ${libdir}")
+list(APPEND final_message "Bindir: ${bindir}")
+list(APPEND final_message "Includedir: ${includedir}")
+list(APPEND final_message "Datarootdir: ${datarootdir}")
+list(APPEND final_message "Datadir: ${datadir}")
+list(APPEND final_message "Docdir: ${docdir}")
+
+set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/${APP_NAME_LC}\"
+                   -DINSTALL_PATH=\"${datarootdir}/${APP_NAME_LC}\")
diff --git a/kodi/files/project_cmake_treedata_netbsd_subdirs.txt b/kodi/files/project_cmake_treedata_netbsd_subdirs.txt
new file mode 100644
index 0000000000..df2fa76da9
--- /dev/null
+++ b/kodi/files/project_cmake_treedata_netbsd_subdirs.txt
@@ -0,0 +1,13 @@
+xbmc/linux                 linuxsupport
+xbmc/linux/sse4            sse4
+xbmc/input/linux           input/linux
+xbmc/input/touch           input/touch
+xbmc/input/touch/generic   input/touch/generic
+xbmc/network/linux         network/linux
+xbmc/peripherals/bus/linux peripherals/bus/linux
+xbmc/powermanagement/linux powermanagement/linux
+xbmc/storage/linux         storage/linux
+xbmc/filesystem/posix      filesystem/posix
+xbmc/utils/posix           utils_posix
+xbmc/platform/posix        posix
+xbmc/freebsd               freebsdsupport
diff --git a/kodi/patches/patch-project_cmake_scripts_common_AddonsHelpers.cmake b/kodi/patches/patch-project_cmake_scripts_common_AddonsHelpers.cmake
new file mode 100644
index 0000000000..d3927feaeb
--- /dev/null
+++ b/kodi/patches/patch-project_cmake_scripts_common_AddonsHelpers.cmake
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Whack-a-mole adding netbsd
+
+--- project/cmake/scripts/common/AddonHelpers.cmake.orig	2017-05-24 20:49:32.000000000 +0000
++++ project/cmake/scripts/common/AddonHelpers.cmake
+@@ -169,7 +169,7 @@ macro (build_addon target prefix libs)
+     endif()
+     add_cpack_workaround(${target} ${${prefix}_VERSION} ${ext})
+   else()
+-    if(CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL rbpi OR CORE_SYSTEM_NAME STREQUAL freebsd)
++    if(CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL rbpi OR CORE_SYSTEM_NAME STREQUAL freebsd OR CORE_SYSTEM_NAME STREQUAL netbsd)
+       if(NOT OVERRIDE_PATHS)
+         if(CMAKE_INSTALL_PREFIX AND NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND NOT CMAKE_INSTALL_PREFIX STREQUAL "${${APP_NAME_UC}_PREFIX}")
+           message(WARNING "CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} differs from ${APP_NAME} prefix, changing to ${${APP_NAME_UC}_PREFIX}. Please pass -DOVERRIDE_PATHS=1 to skip this check")
diff --git a/kodi/patches/patch-xbmc_GUIInfoManager.cpp b/kodi/patches/patch-xbmc_GUIInfoManager.cpp
new file mode 100644
index 0000000000..82adb19a93
--- /dev/null
+++ b/kodi/patches/patch-xbmc_GUIInfoManager.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_GUIInfoManager.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/GUIInfoManager.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/GUIInfoManager.cpp
+@@ -2289,7 +2289,7 @@ bool CGUIInfoManager::GetBool(int condit
+     bReturn = g_application.IsMusicScanning();
+   }
+   else if (condition == SYSTEM_PLATFORM_LINUX)
+-#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
++#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+     bReturn = true;
+ #else
+     bReturn = false;
diff --git a/kodi/patches/patch-xbmc_Util.cpp b/kodi/patches/patch-xbmc_Util.cpp
new file mode 100644
index 0000000000..820f8dafb5
--- /dev/null
+++ b/kodi/patches/patch-xbmc_Util.cpp
@@ -0,0 +1,46 @@
+$NetBSD: patch-xbmc_Util.cpp,v 1.2 2016/11/20 22:12:44 joerg Exp $
+
+avoiding procfs
+
+--- xbmc/Util.cpp.orig	2017-05-24 20:49:32.000000000 +0000
++++ xbmc/Util.cpp
+@@ -26,7 +26,7 @@
+ #include <mach-o/dyld.h>
+ #endif
+ 
+-#if defined(TARGET_FREEBSD)
++#if defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+ #include <sys/param.h>
+ #include <sys/sysctl.h>
+ #endif
+@@ -1769,7 +1769,7 @@ std::string CUtil::ResolveExecutablePath
+ 
+   CDarwinUtils::GetExecutablePath(given_path, &path_size);
+   strExecutablePath = given_path;
+-#elif defined(TARGET_FREEBSD)                                                                                                                                                                   
++#elif defined(TARGET_FREEBSD)
+   char buf[PATH_MAX];
+   size_t buflen;
+   int mib[4];
+@@ -1784,6 +1784,21 @@ std::string CUtil::ResolveExecutablePath
+     strExecutablePath = "";
+   else
+     strExecutablePath = buf;
++#elif defined(TARGET_NETBSD) && defined(KERN_PROC_PATHNAME)
++  char buf[PATH_MAX];
++  size_t buflen;
++  int mib[4];
++
++  mib[0] = CTL_KERN;
++  mib[1] = KERN_PROC_ARGS;
++  mib[2] = getpid();
++  mib[3] = KERN_PROC_PATHNAME;
++
++  buflen = sizeof(buf) - 1;
++  if(sysctl(mib, 4, buf, &buflen, NULL, 0) < 0)
++    strExecutablePath = "";
++  else
++    strExecutablePath = buf;
+ #elif defined(TARGET_ANDROID)
+   strExecutablePath = CXBMCApp::getApplicationInfo().nativeLibraryDir;
+ 
diff --git a/kodi/patches/patch-xbmc_addons_Addon.cpp b/kodi/patches/patch-xbmc_addons_Addon.cpp
new file mode 100644
index 0000000000..a7f53cd6fc
--- /dev/null
+++ b/kodi/patches/patch-xbmc_addons_Addon.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_addons_Addon.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/addons/Addon.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/addons/Addon.cpp
+@@ -47,7 +47,7 @@
+ #if defined(TARGET_DARWIN)
+ #include "../platform/darwin/OSXGNUReplacements.h"
+ #endif
+-#ifdef TARGET_FREEBSD
++#if defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+ #include "freebsd/FreeBSDGNUReplacements.h"
+ #endif
+ 
diff --git a/kodi/patches/patch-xbmc_addons_AddonManager.cpp b/kodi/patches/patch-xbmc_addons_AddonManager.cpp
new file mode 100644
index 0000000000..7c3f907683
--- /dev/null
+++ b/kodi/patches/patch-xbmc_addons_AddonManager.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_addons_AddonManager.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/addons/AddonManager.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/addons/AddonManager.cpp
+@@ -1009,7 +1009,7 @@ std::string CAddonMgr::GetPlatformLibrar
+   std::string libraryName;
+ #if defined(TARGET_ANDROID)
+   libraryName = GetExtValue(base, "@library_android");
+-#elif defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
++#elif defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+ #if defined(TARGET_FREEBSD)
+   libraryName = GetExtValue(base, "@library_freebsd");
+   if (libraryName.empty())
diff --git a/kodi/patches/patch-xbmc_cores_AudioEngine_AESinkFactory.cpp b/kodi/patches/patch-xbmc_cores_AudioEngine_AESinkFactory.cpp
new file mode 100644
index 0000000000..68905ed78b
--- /dev/null
+++ b/kodi/patches/patch-xbmc_cores_AudioEngine_AESinkFactory.cpp
@@ -0,0 +1,40 @@
+$NetBSD: patch-xbmc_cores_AudioEngine_AESinkFactory.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/cores/AudioEngine/AESinkFactory.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/cores/AudioEngine/AESinkFactory.cpp
+@@ -32,7 +32,7 @@
+   #include "Sinks/AESinkDARWINIOS.h"
+ #elif defined(TARGET_DARWIN_OSX)
+   #include "Sinks/AESinkDARWINOSX.h"
+-#elif defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
++#elif defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+   #if defined(HAS_ALSA)
+     #include "Sinks/AESinkALSA.h"
+   #endif
+@@ -71,7 +71,7 @@ void CAESinkFactory::ParseDevice(std::st
+         driver == "DARWINIOS"  ||
+ #elif defined(TARGET_DARWIN_OSX)
+         driver == "DARWINOSX"  ||
+-#elif defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
++#elif defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+   #if defined(HAS_ALSA)
+         driver == "ALSA"        ||
+   #endif
+@@ -116,7 +116,7 @@ IAESink *CAESinkFactory::TrySink(std::st
+     sink = new CAESinkDARWINIOS();
+ #elif defined(TARGET_DARWIN_OSX)
+     sink = new CAESinkDARWINOSX();
+-#elif defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
++#elif defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+  #if defined(HAS_PULSEAUDIO)
+     if (driver == "PULSE")
+       sink = new CAESinkPULSE();
+@@ -225,7 +225,7 @@ void CAESinkFactory::EnumerateEx(AESinkI
+   if(!info.m_deviceInfoList.empty())
+     list.push_back(info);
+ 
+-#elif defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
++#elif defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+   // check if user wants us to do something specific
+   if (getenv("AE_SINK"))
+   {
diff --git a/kodi/patches/patch-xbmc_cores_AudioEngine_Sinks_AESinkOSS.cpp b/kodi/patches/patch-xbmc_cores_AudioEngine_Sinks_AESinkOSS.cpp
new file mode 100644
index 0000000000..3d38a94be5
--- /dev/null
+++ b/kodi/patches/patch-xbmc_cores_AudioEngine_Sinks_AESinkOSS.cpp
@@ -0,0 +1,106 @@
+$NetBSD: patch-xbmc_cores_AudioEngine_Sinks_AESinkOSS.cpp,v 1.2 2015/11/19 02:31:47 jmcneill Exp $
+
+--- xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp
+@@ -32,6 +32,9 @@
+ 
+ #if defined(OSS4) || defined(TARGET_FREEBSD)
+   #include <sys/soundcard.h>
++#elif defined(TARGET_NETBSD)
++  #include <sys/soundcard.h>
++  #include <sys/audioio.h>
+ #else
+   #include <linux/soundcard.h>
+ #endif
+@@ -41,7 +44,7 @@
+ static enum AEChannel OSSChannelMap[9] =
+   {AE_CH_FL, AE_CH_FR, AE_CH_BL, AE_CH_BR, AE_CH_FC, AE_CH_LFE, AE_CH_SL, AE_CH_SR, AE_CH_NULL};
+ 
+-#if defined(SNDCTL_SYSINFO) && defined(SNDCTL_CARDINFO)
++#if defined(SNDCTL_SYSINFO) && (defined(SNDCTL_CARDINFO) || defined(TARGET_NETBSD))
+ static int OSSSampleRateList[] =
+ {
+   5512,
+@@ -84,6 +87,9 @@ std::string CAESinkOSS::GetDeviceUse(con
+ 
+   if (device.find_first_of('/') != 0)
+     return "/dev/dsp_multich";
++#elif defined(TARGET_NETBSD)
++  if (device.find_first_of('/') != 0)
++    return "/dev/sound";
+ #else
+   if (device.find_first_of('/') != 0)
+     return "/dev/dsp";
+@@ -422,6 +428,65 @@ void CAESinkOSS::Drain()
+ 
+ void CAESinkOSS::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
+ {
++#if defined(TARGET_NETBSD)
++  for (int i = 0; i < 32; i++)
++  {
++    std::stringstream audioctlpath;
++    std::stringstream devicepath;
++    std::stringstream devicename;
++    CAEDeviceInfo info;
++    audio_device_t adev;
++
++    audioctlpath << "/dev/audioctl" << i;
++    int audioctlfd = open(audioctlpath.str().c_str(), O_RDONLY, 0);
++    if (audioctlfd == -1)
++    {
++      if (errno == ENOENT)
++        break;
++      else
++        continue;
++    }
++
++    if (ioctl(audioctlfd, AUDIO_GETDEV, &adev) == -1)
++    {
++      close(audioctlfd);
++      continue;
++    }
++
++    devicepath << "/dev/sound" << i;
++    info.m_deviceName = devicepath.str();
++    devicename << adev.name;
++    if (strlen(adev.version) > 0)
++      devicename << " " << adev.version;
++    info.m_displayName = devicename.str();
++
++    info.m_dataFormats.push_back(AE_FMT_S16NE);
++    info.m_deviceType = AE_DEVTYPE_PCM;
++
++    oss_audioinfo ainfo;
++    memset(&ainfo, 0, sizeof(ainfo));
++    ainfo.dev = i;
++    if (ioctl(audioctlfd, SNDCTL_AUDIOINFO, &ainfo) != -1) {
++#if 0
++      if (ainfo.oformats & AFMT_S32_LE)
++        info.m_dataFormats.push_back(AE_FMT_S32LE);
++      if (ainfo.oformats & AFMT_S16_LE)
++        info.m_dataFormats.push_back(AE_FMT_S16LE);
++#endif
++      for (int j = 0;
++        j < ainfo.max_channels && AE_CH_NULL != OSSChannelMap[j];
++        ++j)
++          info.m_channels += OSSChannelMap[j];
++
++      for (int *rate = OSSSampleRateList; *rate != 0; ++rate)
++        if (*rate >= ainfo.min_rate && *rate <= ainfo.max_rate)
++          info.m_sampleRates.push_back(*rate);
++    }
++    list.push_back(info);
++
++    close(audioctlfd);
++  }
++#else
+   int mixerfd;
+   const char * mixerdev = "/dev/mixer";
+ 
+@@ -505,5 +570,6 @@ void CAESinkOSS::EnumerateDevicesEx(AEDe
+   }
+ #endif
+   close(mixerfd);
++#endif
+ }
+ 
diff --git a/kodi/patches/patch-xbmc_cores_DllLoader_CMakeLists.txt b/kodi/patches/patch-xbmc_cores_DllLoader_CMakeLists.txt
new file mode 100644
index 0000000000..ab9bd49b86
--- /dev/null
+++ b/kodi/patches/patch-xbmc_cores_DllLoader_CMakeLists.txt
@@ -0,0 +1,18 @@
+$NetBSD$
+
+ldt stuff only on linux. it doesn't work well enough on netbsd
+and building 32bit.
+
+--- xbmc/cores/DllLoader/CMakeLists.txt.orig	2017-05-24 20:49:32.000000000 +0000
++++ xbmc/cores/DllLoader/CMakeLists.txt
+@@ -24,8 +24,8 @@ if(NOT CORE_SYSTEM_NAME STREQUAL windows
+                       SoLoader.cpp)
+   list(APPEND HEADERS mmap_anon.h
+                       SoLoader.h)
+-  if(NOT CORE_SYSTEM_NAME STREQUAL freebsd)
+-    list(APPEND SOURCES ldt_keeper.c) 
++  if(CORE_SYSTEM_NAME STREQUAL linux)
++    list(APPEND SOURCES ldt_keeper.c)
+     list(APPEND HEADERS ldt_keeper.h)
+   endif()
+ else()
diff --git a/kodi/patches/patch-xbmc_cores_DllLoader_coffldr.h b/kodi/patches/patch-xbmc_cores_DllLoader_coffldr.h
new file mode 100644
index 0000000000..b47bcbb1df
--- /dev/null
+++ b/kodi/patches/patch-xbmc_cores_DllLoader_coffldr.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+--- /usr/pkgsrc/multimedia/kodi/work/xbmc-xbmc-147cec4/xbmc/cores/DllLoader/coffldr.h.orig	2017-05-24 20:49:32.000000000 +0000
++++ /usr/pkgsrc/multimedia/kodi/work/xbmc-xbmc-147cec4/xbmc/cores/DllLoader/coffldr.h
+@@ -25,21 +25,6 @@
+ 
+ #include <stdio.h>
+ 
+-#ifndef _FILE_DEFINED
+-struct _iobuf {
+-        char *_ptr;
+-        int   _cnt;
+-        char *_base;
+-        int   _flag;
+-        int   _file;
+-        int   _charbuf;
+-        int   _bufsiz;
+-        char *_tmpfname;
+-        };
+-typedef struct _iobuf FILE;
+-#define _FILE_DEFINED
+-#endif
+-
+ class CoffLoader
+ {
+ public:
diff --git a/kodi/patches/patch-xbmc_cores_DllLoader_exports_emu__msvcrt.cpp b/kodi/patches/patch-xbmc_cores_DllLoader_exports_emu__msvcrt.cpp
new file mode 100644
index 0000000000..ec30eacde2
--- /dev/null
+++ b/kodi/patches/patch-xbmc_cores_DllLoader_exports_emu__msvcrt.cpp
@@ -0,0 +1,110 @@
+$NetBSD: patch-xbmc_cores_DllLoader_exports_emu__msvcrt.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/cores/DllLoader/exports/emu_msvcrt.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
+@@ -28,13 +28,13 @@
+ #include <process.h>
+ #include <errno.h>
+ #else
+-#if !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD)
++#if !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD) && !defined(TARGET_NETBSD)
+ #include <mntent.h>
+ #endif
+ #endif
+ #include <sys/stat.h>
+ #include <sys/types.h>
+-#if !defined(TARGET_FREEBSD) && (!defined(TARGET_ANDROID) && defined(__LP64__))
++#if !defined(TARGET_FREEBSD) && !defined(TARGET_NETBSD) && (!defined(TARGET_ANDROID) && defined(__LP64__))
+ #include <sys/timeb.h>
+ #endif
+ #include "system.h" // for HAS_DVD_DRIVE
+@@ -43,7 +43,7 @@
+     #include <sys/ioctl.h>
+     #if defined(TARGET_DARWIN)
+       #include <IOKit/storage/IODVDMediaBSDClient.h>
+-    #elif !defined(TARGET_FREEBSD)
++    #elif !defined(TARGET_FREEBSD) && !defined(TARGET_NETBSD)
+       #include <linux/cdrom.h>
+     #endif
+   #endif
+@@ -1333,7 +1333,7 @@ extern "C"
+     {
+       // it might be something else than a file, or the file is not emulated
+       // let the operating system handle it
+-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD) || defined(TARGET_ANDROID)
+       return fseek(stream, offset, origin);
+ #else
+       return fseeko64(stream, offset, origin);
+@@ -1398,7 +1398,7 @@ extern "C"
+     {
+       // it might be something else than a file, or the file is not emulated
+       // let the operating system handle it
+-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD) || defined(TARGET_ANDROID)
+       return ftello(stream);
+ #else
+       return ftello64(stream);
+@@ -1444,7 +1444,7 @@ extern "C"
+       CLog::Log(LOGWARNING, "msvcrt.dll: dll_telli64 called, TODO: add 'int64 -> long' type checking");      //warning
+ #ifndef TARGET_POSIX
+       return (__int64)tell(fd);
+-#elif defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++#elif defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD) || defined(TARGET_ANDROID)
+       return lseek(fd, 0, SEEK_CUR);
+ #else
+       return lseek64(fd, 0, SEEK_CUR);
+@@ -1622,7 +1622,7 @@ extern "C"
+     int ret;
+ 
+     ret = dll_fgetpos64(stream, &tmpPos);
+-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD) || defined(TARGET_ANDROID)
+     *pos = (fpos_t)tmpPos;
+ #else
+     pos->__pos = (off_t)tmpPos.__pos;
+@@ -1637,6 +1637,8 @@ extern "C"
+     {
+ #if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+       *pos = pFile->GetPosition();
++#elif defined(TARGET_NETBSD)
++      pos->_pos = pFile->GetPosition();
+ #else
+       pos->__pos = pFile->GetPosition();
+ #endif
+@@ -1659,6 +1661,8 @@ extern "C"
+     {
+ #if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+       if (dll_lseeki64(fd, *pos, SEEK_SET) >= 0)
++#elif defined(TARGET_NETBSD)
++      if (dll_lseeki64(fd, (__off64_t)pos->_pos, SEEK_SET) >= 0)
+ #else
+       if (dll_lseeki64(fd, (__off64_t)pos->__pos, SEEK_SET) >= 0)
+ #endif
+@@ -1674,7 +1678,7 @@ extern "C"
+     {
+       // it might be something else than a file, or the file is not emulated
+       // let the operating system handle it
+-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD) || defined(TARGET_ANDROID)
+       return fsetpos(stream, pos);
+ #else
+       return fsetpos64(stream, pos);
+@@ -1690,7 +1694,7 @@ extern "C"
+     if (fd >= 0)
+     {
+       fpos64_t tmpPos;
+-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD) || defined(TARGET_ANDROID)
+       tmpPos= *pos;
+ #else
+       tmpPos.__pos = (off64_t)(pos->__pos);
+@@ -2160,7 +2164,7 @@ extern "C"
+      if (!pFile)
+        return -1;
+ 
+-#if defined(HAS_DVD_DRIVE) && !defined(TARGET_FREEBSD)
++#if defined(HAS_DVD_DRIVE) && !defined(TARGET_FREEBSD) && !defined(TARGET_NETBSD)
+ #if !defined(TARGET_DARWIN)
+     if(request == DVD_READ_STRUCT || request == DVD_AUTH)
+ #else
diff --git a/kodi/patches/patch-xbmc_cores_DllLoader_exports_emu__msvcrt.h b/kodi/patches/patch-xbmc_cores_DllLoader_exports_emu__msvcrt.h
new file mode 100644
index 0000000000..ffbc1b15e1
--- /dev/null
+++ b/kodi/patches/patch-xbmc_cores_DllLoader_exports_emu__msvcrt.h
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_cores_DllLoader_exports_emu__msvcrt.h,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/cores/DllLoader/exports/emu_msvcrt.h.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/cores/DllLoader/exports/emu_msvcrt.h
+@@ -26,7 +26,7 @@
+ #define _onexit_t void*
+ #endif
+ 
+-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD) || defined(TARGET_ANDROID)
+ typedef off_t __off_t;
+ typedef int64_t off64_t;
+ typedef off64_t __off64_t;
diff --git a/kodi/patches/patch-xbmc_cores_DllLoader_exports_util_EmuFileWrapper.h b/kodi/patches/patch-xbmc_cores_DllLoader_exports_util_EmuFileWrapper.h
new file mode 100644
index 0000000000..7085a2901c
--- /dev/null
+++ b/kodi/patches/patch-xbmc_cores_DllLoader_exports_util_EmuFileWrapper.h
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_cores_DllLoader_exports_util_EmuFileWrapper.h,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h
+@@ -27,7 +27,7 @@
+ #include "system.h"
+ #include "threads/CriticalSection.h"
+ 
+-#if defined(TARGET_POSIX) && !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD) && !defined(TARGET_ANDROID) && !defined(__UCLIBC__)
++#if defined(TARGET_POSIX) && !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD) && !defined(TARGET_NETBSD) && !defined(TARGET_ANDROID) && !defined(__UCLIBC__)
+ #define _file _fileno
+ #elif defined(__UCLIBC__)
+ #define _file __filedes
diff --git a/kodi/patches/patch-xbmc_cores_DllLoader_exports_wrapper.c b/kodi/patches/patch-xbmc_cores_DllLoader_exports_wrapper.c
new file mode 100644
index 0000000000..507985b583
--- /dev/null
+++ b/kodi/patches/patch-xbmc_cores_DllLoader_exports_wrapper.c
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_cores_DllLoader_exports_wrapper.c,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/cores/DllLoader/exports/wrapper.c.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/cores/DllLoader/exports/wrapper.c
+@@ -39,7 +39,7 @@
+ #endif
+ #include <dlfcn.h>
+ 
+-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD) || defined(TARGET_ANDROID)
+ typedef off_t     __off_t;
+ typedef int64_t   off64_t;
+ typedef off64_t   __off64_t;
diff --git a/kodi/patches/patch-xbmc_dialogs_GUIDialogMediaFilter.cpp b/kodi/patches/patch-xbmc_dialogs_GUIDialogMediaFilter.cpp
new file mode 100644
index 0000000000..23e9b40856
--- /dev/null
+++ b/kodi/patches/patch-xbmc_dialogs_GUIDialogMediaFilter.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_dialogs_GUIDialogMediaFilter.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/dialogs/GUIDialogMediaFilter.cpp.orig	2015-12-22 17:56:43.000000000 +0000
++++ xbmc/dialogs/GUIDialogMediaFilter.cpp
+@@ -888,7 +888,7 @@ bool CGUIDialogMediaFilter::GetMinMax(co
+     return false;
+   }
+ 
+-  std::string strSQL = "SELECT %s FROM %s ";
++  const char *strSQL = "SELECT %s FROM %s ";
+ 
+   min = static_cast<int>(strtol(db->GetSingleValue(db->PrepareSQL(strSQL, std::string("MIN(" + field + ")").c_str(), table.c_str()) + strSQLExtra).c_str(), NULL, 0));
+   max = static_cast<int>(strtol(db->GetSingleValue(db->PrepareSQL(strSQL, std::string("MAX(" + field + ")").c_str(), table.c_str()) + strSQLExtra).c_str(), NULL, 0));
diff --git a/kodi/patches/patch-xbmc_dialogs_GUIDialogNumeric.cpp b/kodi/patches/patch-xbmc_dialogs_GUIDialogNumeric.cpp
new file mode 100644
index 0000000000..98cdc923c4
--- /dev/null
+++ b/kodi/patches/patch-xbmc_dialogs_GUIDialogNumeric.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-xbmc_dialogs_GUIDialogNumeric.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/dialogs/GUIDialogNumeric.cpp.orig	2015-12-22 17:57:34.000000000 +0000
++++ xbmc/dialogs/GUIDialogNumeric.cpp
+@@ -28,6 +28,7 @@
+ #include "input/Key.h"
+ #include "guilib/LocalizeStrings.h"
+ #include "interfaces/AnnouncementManager.h"
++#include <cstdlib>
+ 
+ #define CONTROL_HEADING_LABEL  1
+ #define CONTROL_INPUT_LABEL    4
diff --git a/kodi/patches/patch-xbmc_guilib_XBTFReader.cpp b/kodi/patches/patch-xbmc_guilib_XBTFReader.cpp
new file mode 100644
index 0000000000..999b95dc87
--- /dev/null
+++ b/kodi/patches/patch-xbmc_guilib_XBTFReader.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_guilib_XBTFReader.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/guilib/XBTFReader.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/guilib/XBTFReader.cpp
+@@ -214,7 +214,7 @@ bool CXBTFReader::Load(const CXBTFFrame&
+   if (m_file == nullptr)
+     return false;
+ 
+-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
++#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD) || defined(TARGET_ANDROID)
+   if (fseeko(m_file, static_cast<off_t>(frame.GetOffset()), SEEK_SET) == -1)
+ #else
+   if (fseeko64(m_file, static_cast<off_t>(frame.GetOffset()), SEEK_SET) == -1)
diff --git a/kodi/patches/patch-xbmc_interfaces_python_XBPython.cpp b/kodi/patches/patch-xbmc_interfaces_python_XBPython.cpp
new file mode 100644
index 0000000000..dc48e3ec3c
--- /dev/null
+++ b/kodi/patches/patch-xbmc_interfaces_python_XBPython.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_interfaces_python_XBPython.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/interfaces/python/XBPython.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/interfaces/python/XBPython.cpp
+@@ -475,7 +475,7 @@ void XBPython::Finalize()
+ #if !(defined(TARGET_DARWIN) || defined(TARGET_WINDOWS))
+     DllLoaderContainer::UnloadPythonDlls();
+ #endif
+-#if defined(TARGET_POSIX) && !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD)
++#if defined(TARGET_POSIX) && !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD) && !defined(TARGET_NETBSD)
+     // we can't release it on windows, as this is done in UnloadPythonDlls() for win32 (see above).
+     // The implementation for linux needs looking at - UnloadPythonDlls() currently only searches for "python26.dll"
+     // The implementation for osx can never unload the python dylib.
diff --git a/kodi/patches/patch-xbmc_linux_LinuxTimezone.cpp b/kodi/patches/patch-xbmc_linux_LinuxTimezone.cpp
new file mode 100644
index 0000000000..2a25993e5b
--- /dev/null
+++ b/kodi/patches/patch-xbmc_linux_LinuxTimezone.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_linux_LinuxTimezone.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/linux/LinuxTimezone.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/linux/LinuxTimezone.cpp
+@@ -29,7 +29,7 @@
+ #if defined(TARGET_DARWIN)
+ #include "platform/darwin/OSXGNUReplacements.h"
+ #endif
+-#ifdef TARGET_FREEBSD
++#if defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+ #include "freebsd/FreeBSDGNUReplacements.h"
+ #endif
+ 
diff --git a/kodi/patches/patch-xbmc_linux_PlatformDefs.h b/kodi/patches/patch-xbmc_linux_PlatformDefs.h
new file mode 100644
index 0000000000..b9591cfa4c
--- /dev/null
+++ b/kodi/patches/patch-xbmc_linux_PlatformDefs.h
@@ -0,0 +1,52 @@
+$NetBSD: patch-xbmc_linux_PlatformDefs.h,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/linux/PlatformDefs.h.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/linux/PlatformDefs.h
+@@ -51,7 +51,7 @@
+ #if defined(TARGET_DARWIN_OSX)
+ #include <libkern/OSTypes.h>
+ #endif
+-#elif defined(TARGET_FREEBSD)
++#elif defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+ #include <stdio.h>
+ #include <sys/sysctl.h>
+ #include <sys/types.h>
+@@ -172,7 +172,7 @@
+ #define CALLBACK    __stdcall
+ #define WINAPI      __stdcall
+ #define WINAPIV     __cdecl
+-#if !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD)
++#if !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD) && !defined(TARGET_NETBSD)
+ #define APIENTRY    WINAPI
+ #else
+ #define APIENTRY
+@@ -355,13 +355,15 @@ typedef int (*LPTHREAD_START_ROUTINE)(vo
+ #define _O_RDONLY O_RDONLY
+ #define _O_WRONLY O_WRONLY
+ 
+-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD)
++#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+   #define stat64 stat
+   #define __stat64 stat
+   #define fstat64 fstat
+   typedef int64_t off64_t;
+   #if defined(TARGET_FREEBSD)
+     #define statfs64 statfs
++  #elif defined(TARGET_NETBSD)
++    #define statfs64 statvfs
+   #endif
+ #else
+   #define __stat64 stat64
+@@ -415,8 +417,12 @@ typedef struct _SECURITY_ATTRIBUTES {
+ #define FILE_CURRENT            1
+ #define FILE_END                2
+ 
++#ifndef _S_IFREG
+ #define _S_IFREG  S_IFREG
++#endif
++#ifndef _S_IFDIR
+ #define _S_IFDIR  S_IFDIR
++#endif
+ #define MAX_PATH PATH_MAX
+ 
+ #define _stat stat
diff --git a/kodi/patches/patch-xbmc_linux_XFileUtils.cpp b/kodi/patches/patch-xbmc_linux_XFileUtils.cpp
new file mode 100644
index 0000000000..ad106eea6d
--- /dev/null
+++ b/kodi/patches/patch-xbmc_linux_XFileUtils.cpp
@@ -0,0 +1,40 @@
+$NetBSD: patch-xbmc_linux_XFileUtils.cpp,v 1.2 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/linux/XFileUtils.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/linux/XFileUtils.cpp
+@@ -29,7 +29,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <stdlib.h>
+-#if !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD) && !defined(TARGET_ANDROID)
++#if !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD) && !defined(TARGET_NETBSD) && !defined(TARGET_ANDROID)
+ #include <sys/vfs.h>
+ #else
+ #include <sys/param.h>
+@@ -148,7 +148,7 @@ HANDLE CreateFile(LPCTSTR lpFileName, DW
+   HANDLE result = new CXHandle(CXHandle::HND_FILE);
+   result->fd = fd;
+ 
+-#if (defined(TARGET_LINUX) || defined(TARGET_FREEBSD)) && defined(HAS_DVD_DRIVE) 
++#if (defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)) && defined(HAS_DVD_DRIVE) 
+   // special case for opening the cdrom device
+   if (strcmp(lpFileName, MEDIA_DETECT::CLibcdio::GetInstance()->GetDeviceFileName())==0)
+     result->m_bCDROM = true;
+@@ -224,7 +224,7 @@ DWORD  SetFilePointer(HANDLE hFile, int3
+     nMode = SEEK_END;
+ 
+   off64_t currOff;
+-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD)
++#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+   currOff = lseek(hFile->fd, offset, nMode);
+ #else
+   currOff = lseek64(hFile->fd, offset, nMode);
+@@ -302,7 +302,7 @@ BOOL SetFilePointerEx(  HANDLE hFile,
+ 
+   off64_t toMove = liDistanceToMove.QuadPart;
+ 
+-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD)
++#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+   off64_t currOff = lseek(hFile->fd, toMove, nMode);
+ #else
+   off64_t currOff = lseek64(hFile->fd, toMove, nMode);
diff --git a/kodi/patches/patch-xbmc_linux_XMemUtils.cpp b/kodi/patches/patch-xbmc_linux_XMemUtils.cpp
new file mode 100644
index 0000000000..199f16b6e4
--- /dev/null
+++ b/kodi/patches/patch-xbmc_linux_XMemUtils.cpp
@@ -0,0 +1,54 @@
+$NetBSD: patch-xbmc_linux_XMemUtils.cpp,v 1.2 2015/11/18 23:27:23 jmcneill Exp $
+
+--- xbmc/linux/XMemUtils.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/linux/XMemUtils.cpp
+@@ -29,6 +29,10 @@
+ #include <mach/mach.h>
+ #endif
+ 
++#if defined(TARGET_NETBSD)
++#include <uvm/uvm_extern.h>
++#endif
++
+ #undef ALIGN
+ #define ALIGN(value, alignment) (((value)+(alignment-1))&~(alignment-1))
+ 
+@@ -55,7 +59,7 @@ void _aligned_free(void *p) {
+ 
+ #ifndef TARGET_WINDOWS
+ 
+-#if defined(TARGET_POSIX) && !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD)
++#if defined(TARGET_POSIX) && !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD) && !defined(TARGET_NETBSD)
+ static FILE* procMeminfoFP = NULL;
+ #endif
+ 
+@@ -139,6 +143,29 @@ void GlobalMemoryStatusEx(LPMEMORYSTATUS
+ 
+   if (sysctlbyname("vm.stats.vm.v_swappgsout", &swap_free, &len, NULL, 0) == 0)
+     lpBuffer->ullAvailPageFile = swap_free * pagesize;
++#elif defined(TARGET_NETBSD)
++  struct uvmexp_sysctl uvmexp;
++  int64_t filemin = 0;
++  int filemin_pct;
++  size_t len;
++
++  /* sysctl vm.filemin */
++  len = sizeof(filemin_pct);
++  if (sysctlbyname("vm.filemin", &filemin_pct, &len, NULL, 0) == 0)
++  {
++    /* sysctl vm.uvmexp2 */
++    len = sizeof(uvmexp);
++    if (sysctlbyname("vm.uvmexp2", &uvmexp, &len, NULL, 0) == 0)
++    {
++      lpBuffer->ullTotalPhys = (uvmexp.active + uvmexp.inactive + uvmexp.free) * uvmexp.pagesize;
++      lpBuffer->ullTotalVirtual = (uvmexp.active + uvmexp.inactive + uvmexp.free) * uvmexp.pagesize;
++      filemin = MIN(uvmexp.filepages, ((uvmexp.active + uvmexp.inactive + uvmexp.free) * filemin_pct) / 100);
++      lpBuffer->ullAvailPhys = (uvmexp.free + uvmexp.filepages - filemin) * uvmexp.pagesize;
++      lpBuffer->ullAvailVirtual = (uvmexp.free + uvmexp.filepages - filemin) * uvmexp.pagesize;
++      lpBuffer->ullAvailPageFile = (uvmexp.swpages - uvmexp.swpginuse) * uvmexp.pagesize;
++    }
++  }
++
+ #else
+   struct sysinfo info;
+   char name[32];
diff --git a/kodi/patches/patch-xbmc_network_linux_NetworkLinux.cpp b/kodi/patches/patch-xbmc_network_linux_NetworkLinux.cpp
new file mode 100644
index 0000000000..25244f9dd4
--- /dev/null
+++ b/kodi/patches/patch-xbmc_network_linux_NetworkLinux.cpp
@@ -0,0 +1,126 @@
+$NetBSD: patch-xbmc_network_linux_NetworkLinux.cpp,v 1.3 2016/10/23 19:56:18 christos Exp $
+
+We don't have RTF_LLINFO anymore, use getifaddrs()
+
+--- xbmc/network/linux/NetworkLinux.cpp.orig	2015-10-19 02:31:15.000000000 -0400
++++ xbmc/network/linux/NetworkLinux.cpp	2016-10-23 15:49:24.032410793 -0400
+@@ -48,7 +48,7 @@
+   #include "network/osx/ioshacks.h"
+ #endif
+   #include <ifaddrs.h>
+-#elif defined(TARGET_FREEBSD)
++#elif defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+   #include <sys/sockio.h>
+   #include <sys/wait.h>
+   #include <net/if.h>
+@@ -94,7 +94,7 @@
+ 
+ bool CNetworkInterfaceLinux::IsWireless()
+ {
+-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD)
++#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+   return false;
+ #else
+   struct iwreq wrq;
+@@ -218,7 +218,7 @@
+   }
+   if (result.empty())
+     CLog::Log(LOGWARNING, "Unable to determine gateway");
+-#elif defined(TARGET_FREEBSD)
++#elif defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+    size_t needed;
+    int mib[6];
+    char *buf, *next, *lim;
+@@ -248,7 +248,9 @@
+    for (next = buf; next < lim; next += rtm->rtm_msglen) {
+       rtm = (struct rt_msghdr *)next;
+       sa = (struct sockaddr *)(rtm + 1);
++#if !defined(TARGET_NETBSD)
+       sa = (struct sockaddr *)(SA_SIZE(sa) + (char *)sa);	
++#endif
+       sockin = (struct sockaddr_in *)sa;
+       if (inet_ntop(AF_INET, &sockin->sin_addr.s_addr,
+          line, sizeof(line)) == NULL) {
+@@ -359,7 +361,7 @@
+ void CNetworkLinux::GetMacAddress(const std::string& interfaceName, char rawMac[6])
+ {
+   memset(rawMac, 0, 6);
+-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD)
++#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+ 
+ #if !defined(IFT_ETHER)
+ #define IFT_ETHER 0x6/* Ethernet CSMACD */
+@@ -411,7 +413,7 @@
+   char macAddrRaw[6];
+   m_interfaces.clear();
+ 
+-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD)
++#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+ 
+    // Query the list of interfaces.
+    struct ifaddrs *list;
+@@ -507,6 +509,16 @@
+ 
+   if (!result.size())
+        CLog::Log(LOGWARNING, "Unable to determine nameserver");
++#elif defined(TARGET_NETBSD)
++   struct __res_state state;
++   memset(&state, 0, sizeof(state));
++   res_ninit(&state);
++   
++   for (int i = 0; i < state.nscount; i ++)
++   {
++      std::string ns = inet_ntoa(((struct sockaddr_in *)&state.nsaddr_list[i])->sin_addr);
++      result.push_back(ns);
++   }
+ #else
+    res_init();
+ 
+@@ -547,7 +559,7 @@
+ 
+ #if defined (TARGET_DARWIN_IOS) // no timeout option available
+   sprintf(cmd_line, "ping -c 1 %s", inet_ntoa(host_ip));
+-#elif defined (TARGET_DARWIN) || defined (TARGET_FREEBSD)
++#elif defined (TARGET_DARWIN) || defined (TARGET_FREEBSD) || defined(TARGET_NETBSD)
+   sprintf(cmd_line, "ping -c 1 -t %d %s", timeout_ms / 1000 + (timeout_ms % 1000) != 0, inet_ntoa(host_ip));
+ #else
+   sprintf(cmd_line, "ping -c 1 -w %d %s", timeout_ms / 1000 + (timeout_ms % 1000) != 0, inet_ntoa(host_ip));
+@@ -618,6 +630,38 @@
+   }
+   return ret;
+ }
++#elif defined(TARGET_NETBSD)
++#include <netdb.h>
++#include <ifaddrs.h>
++#include <cstring>
++
++bool CNetworkInterfaceLinux::GetHostMacAddress(unsigned long host_ip, std::string& mac)
++{
++	const char *iface = m_interfaceName.c_str();
++	struct ifaddrs *ifas, *ifa;
++	int r;
++	char buf[1024];
++
++	if (getifaddrs(&ifas) == -1) {
++		mac = strerror(errno);
++		return false;
++	}
++	for (ifa = ifas; ifa; ifa = ifa->ifa_next) {
++		if (ifa->ifa_addr->sa_family != AF_LINK)
++			continue;
++		if (strcmp(iface, ifa->ifa_name) != 0)
++			continue;
++		if ((r = getnameinfo(ifa->ifa_addr, ifa->ifa_addr->sa_len, buf,
++			sizeof(buf), NULL, 0, NI_NUMERICHOST)) != 0) {
++			mac = gai_strerror(r);
++			return false;
++		}
++		mac = buf;
++		break;
++	}
++	freeifaddrs(ifas);
++	return true;
++}
+ #else
+ bool CNetworkInterfaceLinux::GetHostMacAddress(unsigned long host_ip, std::string& mac)
+ {
diff --git a/kodi/patches/patch-xbmc_peripherals_bus_PeripheralBusUSB.h b/kodi/patches/patch-xbmc_peripherals_bus_PeripheralBusUSB.h
new file mode 100644
index 0000000000..0295eac75e
--- /dev/null
+++ b/kodi/patches/patch-xbmc_peripherals_bus_PeripheralBusUSB.h
@@ -0,0 +1,14 @@
+$NetBSD: patch-xbmc_peripherals_bus_PeripheralBusUSB.h,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/peripherals/bus/PeripheralBusUSB.h.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/peripherals/bus/PeripheralBusUSB.h
+@@ -31,6 +31,9 @@
+ #elif defined(TARGET_FREEBSD) && defined(HAVE_LIBUSB)
+ #define HAVE_PERIPHERAL_BUS_USB 1
+ #include "linux/PeripheralBusUSBLibUSB.h"
++#elif defined(TARGET_NETBSD) && defined(HAVE_LIBUSB)
++#define HAVE_PERIPHERAL_BUS_USB 1
++#include "linux/PeripheralBusUSBLibUSB.h"
+ #elif defined(TARGET_DARWIN)
+ #define HAVE_PERIPHERAL_BUS_USB 1
+ #include "osx/PeripheralBusUSB.h"
diff --git a/kodi/patches/patch-xbmc_peripherals_bus_linux_PeripheralBusUSBLibUSB.cpp b/kodi/patches/patch-xbmc_peripherals_bus_linux_PeripheralBusUSBLibUSB.cpp
new file mode 100644
index 0000000000..a8c8f86782
--- /dev/null
+++ b/kodi/patches/patch-xbmc_peripherals_bus_linux_PeripheralBusUSBLibUSB.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_peripherals_bus_linux_PeripheralBusUSBLibUSB.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/peripherals/bus/linux/PeripheralBusUSBLibUSB.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/peripherals/bus/linux/PeripheralBusUSBLibUSB.cpp
+@@ -51,7 +51,7 @@ bool CPeripheralBusUSB::PerformDeviceSca
+                              dev->config[0].bNumInterfaces > 0 && dev->config[0].interface[0].num_altsetting > 0) ?
+                                  GetType(dev->config[0].interface[0].altsetting[0].bInterfaceClass) :
+                                  GetType(dev->descriptor.bDeviceClass);
+-#ifdef TARGET_FREEBSD
++#if defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+       result.m_strLocation = StringUtils::Format("%s", dev->filename);
+ #else
+       result.m_strLocation = StringUtils::Format("/bus%s/dev%s", bus->dirname, dev->filename);
diff --git a/kodi/patches/patch-xbmc_settings_Settings.cpp b/kodi/patches/patch-xbmc_settings_Settings.cpp
new file mode 100644
index 0000000000..79e536460d
--- /dev/null
+++ b/kodi/patches/patch-xbmc_settings_Settings.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-xbmc_settings_Settings.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/settings/Settings.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/settings/Settings.cpp
+@@ -468,6 +468,9 @@ bool CSettings::InitializeDefinitions()
+ #elif defined(TARGET_FREEBSD)
+   if (CFile::Exists(SETTINGS_XML_FOLDER "freebsd.xml") && !Initialize(SETTINGS_XML_FOLDER "freebsd.xml"))
+     CLog::Log(LOGFATAL, "Unable to load freebsd-specific settings definitions");
++#elif defined(TARGET_NETBSD)
++  if (CFile::Exists(SETTINGS_XML_FOLDER "netbsd.xml") && !Initialize(SETTINGS_XML_FOLDER "netbsd.xml"))
++    CLog::Log(LOGFATAL, "Unable to load netbsd-specific settings definitions");
+ #elif defined(HAS_IMXVPU)
+   if (CFile::Exists(SETTINGS_XML_FOLDER "imx6.xml") && !Initialize(SETTINGS_XML_FOLDER "imx6.xml"))
+     CLog::Log(LOGFATAL, "Unable to load imx6-specific settings definitions");
diff --git a/kodi/patches/patch-xbmc_storage_DetectDVDType.cpp b/kodi/patches/patch-xbmc_storage_DetectDVDType.cpp
new file mode 100644
index 0000000000..a8c0654afd
--- /dev/null
+++ b/kodi/patches/patch-xbmc_storage_DetectDVDType.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_storage_DetectDVDType.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/storage/DetectDVDType.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/storage/DetectDVDType.cpp
+@@ -34,7 +34,7 @@
+ #include <sys/types.h>
+ #include <sys/ioctl.h>
+ #include <fcntl.h>
+-#if !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD)
++#if !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD) && !defined(TARGET_NETBSD)
+ #include <linux/cdrom.h>
+ #endif
+ #endif
diff --git a/kodi/patches/patch-xbmc_storage_IoSupport.cpp b/kodi/patches/patch-xbmc_storage_IoSupport.cpp
new file mode 100644
index 0000000000..d10ecdaec4
--- /dev/null
+++ b/kodi/patches/patch-xbmc_storage_IoSupport.cpp
@@ -0,0 +1,22 @@
+$NetBSD: patch-xbmc_storage_IoSupport.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/storage/IoSupport.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/storage/IoSupport.cpp
+@@ -54,7 +54,7 @@
+ #include <IOKit/storage/IOStorageDeviceCharacteristics.h>
+ #endif
+ #endif
+-#ifdef TARGET_FREEBSD
++#if defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+ #include <sys/syslimits.h>
+ #endif
+ #include "cdioSupport.h"
+@@ -204,7 +204,7 @@ INT CIoSupport::ReadSectorMode2(HANDLE h
+     return -1;
+   }
+   return MODE2_DATA_SIZE;
+-#elif defined(TARGET_FREEBSD)
++#elif defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+   // NYI
+ #elif defined(TARGET_POSIX)
+   if (hDevice->m_bCDROM)
diff --git a/kodi/patches/patch-xbmc_storage_MediaManager.cpp b/kodi/patches/patch-xbmc_storage_MediaManager.cpp
new file mode 100644
index 0000000000..78ce927c77
--- /dev/null
+++ b/kodi/patches/patch-xbmc_storage_MediaManager.cpp
@@ -0,0 +1,22 @@
+$NetBSD: patch-xbmc_storage_MediaManager.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/storage/MediaManager.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/storage/MediaManager.cpp
+@@ -57,6 +57,8 @@
+ #include "android/AndroidStorageProvider.h"
+ #elif defined(TARGET_FREEBSD)
+ #include "linux/LinuxStorageProvider.h"
++#elif defined(TARGET_NETBSD)
++#include "linux/LinuxStorageProvider.h"
+ #elif defined(TARGET_POSIX)
+ #include "linux/LinuxStorageProvider.h"
+ #include <sys/ioctl.h>
+@@ -614,7 +616,7 @@ void CMediaManager::CloseTray(const char
+ #ifdef HAS_DVD_DRIVE
+ #if defined(TARGET_DARWIN)
+   // FIXME...
+-#elif defined(TARGET_FREEBSD)
++#elif defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+   // NYI
+ #elif defined(TARGET_POSIX)
+   char* dvdDevice = CLibcdio::GetInstance()->GetDeviceFileName();
diff --git a/kodi/patches/patch-xbmc_storage_linux_DeviceKitDisksProvider.cpp b/kodi/patches/patch-xbmc_storage_linux_DeviceKitDisksProvider.cpp
new file mode 100644
index 0000000000..e2a07c65d5
--- /dev/null
+++ b/kodi/patches/patch-xbmc_storage_linux_DeviceKitDisksProvider.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-xbmc_storage_linux_DeviceKitDisksProvider.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/storage/linux/DeviceKitDisksProvider.cpp.orig	2015-12-22 18:20:08.000000000 +0000
++++ xbmc/storage/linux/DeviceKitDisksProvider.cpp
+@@ -17,6 +17,7 @@
+  *  <http://www.gnu.org/licenses/>.
+  *
+  */
++#include <cstdlib>
+ #include "DeviceKitDisksProvider.h"
+ #ifdef HAS_DBUS
+ #include "settings/AdvancedSettings.h"
diff --git a/kodi/patches/patch-xbmc_storage_linux_UDisksProvider.cpp b/kodi/patches/patch-xbmc_storage_linux_UDisksProvider.cpp
new file mode 100644
index 0000000000..50defcdb7c
--- /dev/null
+++ b/kodi/patches/patch-xbmc_storage_linux_UDisksProvider.cpp
@@ -0,0 +1,12 @@
+$NetBSD: patch-xbmc_storage_linux_UDisksProvider.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/storage/linux/UDisksProvider.cpp.orig	2015-12-22 18:21:00.000000000 +0000
++++ xbmc/storage/linux/UDisksProvider.cpp
+@@ -17,6 +17,7 @@
+  *  <http://www.gnu.org/licenses/>.
+  *
+  */
++#include <cstdlib>
+ #include "UDisksProvider.h"
+ #ifdef HAS_DBUS
+ #include "settings/AdvancedSettings.h"
diff --git a/kodi/patches/patch-xbmc_system.h b/kodi/patches/patch-xbmc_system.h
new file mode 100644
index 0000000000..6dc732832f
--- /dev/null
+++ b/kodi/patches/patch-xbmc_system.h
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_system.h,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/system.h.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/system.h
+@@ -146,7 +146,7 @@
+  * Linux Specific
+  *****************/
+ 
+-#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
++#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+ #if defined(HAVE_LIBAVAHI_COMMON) && defined(HAVE_LIBAVAHI_CLIENT)
+ #define HAS_ZEROCONF
+ #define HAS_AVAHI
diff --git a/kodi/patches/patch-xbmc_system__gl.h b/kodi/patches/patch-xbmc_system__gl.h
new file mode 100644
index 0000000000..9b6b12d442
--- /dev/null
+++ b/kodi/patches/patch-xbmc_system__gl.h
@@ -0,0 +1,15 @@
+$NetBSD: patch-xbmc_system__gl.h,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+NetBSD needs GL includes, too.
+
+--- xbmc/system_gl.h.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/system_gl.h
+@@ -30,7 +30,7 @@
+   #if defined(TARGET_WINDOWS)
+     #include <GL/gl.h>
+     #include <GL/glu.h>
+-  #elif defined(TARGET_LINUX)
++  #elif defined(TARGET_LINUX) || defined(TARGET_NETBSD)
+     #include <GL/gl.h>
+     #include <GL/glu.h>
+     #include <GL/glext.h>
diff --git a/kodi/patches/patch-xbmc_threads_platform_pthreads_ThreadImpl.cpp b/kodi/patches/patch-xbmc_threads_platform_pthreads_ThreadImpl.cpp
new file mode 100644
index 0000000000..b3dfa049e1
--- /dev/null
+++ b/kodi/patches/patch-xbmc_threads_platform_pthreads_ThreadImpl.cpp
@@ -0,0 +1,58 @@
+$NetBSD: patch-xbmc_threads_platform_pthreads_ThreadImpl.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/threads/platform/pthreads/ThreadImpl.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/threads/platform/pthreads/ThreadImpl.cpp
+@@ -35,6 +35,10 @@
+ #include <pthread_np.h>
+ #endif
+ #endif
++#if defined(TARGET_NETBSD)
++#include <unistd.h>
++#include <lwp.h>
++#endif
+ 
+ #include <signal.h>
+ 
+@@ -42,7 +46,11 @@ void CThread::SpawnThread(unsigned stack
+ {
+   pthread_attr_t attr;
+   pthread_attr_init(&attr);
+-#if !defined(TARGET_ANDROID) // http://code.google.com/p/android/issues/detail?id=7808
++#if defined(TARGET_NETBSD)
++  const long stack_min = sysconf(_SC_THREAD_STACK_MIN);
++  if (stack_min != -1 && stacksize > (unsigned)stack_min)
++    pthread_attr_setstacksize(&attr, stacksize);
++#elif !defined(TARGET_ANDROID) // http://code.google.com/p/android/issues/detail?id=7808
+   if (stacksize > PTHREAD_STACK_MIN)
+     pthread_attr_setstacksize(&attr, stacksize);
+ #endif
+@@ -66,6 +74,8 @@ void CThread::SetThreadInfo()
+ #else
+   m_ThreadOpaque.LwpId = pthread_getthreadid_np();
+ #endif
++#elif defined(TARGET_NETBSD)
++  m_ThreadOpaque.LwpId = _lwp_self();
+ #elif defined(TARGET_ANDROID)
+   m_ThreadOpaque.LwpId = gettid();
+ #else
+@@ -77,6 +87,8 @@ void CThread::SetThreadInfo()
+ #if(__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 30200)
+   pthread_setname_np(m_ThreadName.c_str());
+ #endif
++#elif defined(TARGET_NETBSD)
++  pthread_setname_np(m_ThreadId, "%s", (void *)(intptr_t)m_ThreadName.c_str());
+ #else
+   pthread_setname_np(m_ThreadId, m_ThreadName.c_str());
+ #endif
+@@ -243,7 +255,10 @@ int64_t CThread::GetAbsoluteUsage()
+     // System time.
+     time += (((int64_t)threadInfo.system_time.seconds * 10000000L) + threadInfo.system_time.microseconds*10L);
+   }
+-
++#elif defined(TARGET_NETBSD)
++  struct timespec tp;
++  clock_gettime(CLOCK_VIRTUAL, &tp);
++  time = (int64_t)tp.tv_sec * 10000000 + tp.tv_nsec/100;
+ #else
+   clockid_t clock;
+   if (pthread_getcpuclockid(m_ThreadId, &clock) == 0)
diff --git a/kodi/patches/patch-xbmc_utils_CPUInfo.cpp b/kodi/patches/patch-xbmc_utils_CPUInfo.cpp
new file mode 100644
index 0000000000..048964414d
--- /dev/null
+++ b/kodi/patches/patch-xbmc_utils_CPUInfo.cpp
@@ -0,0 +1,107 @@
+$NetBSD: patch-xbmc_utils_CPUInfo.cpp,v 1.4 2015/11/18 23:27:23 jmcneill Exp $
+
+--- xbmc/utils/CPUInfo.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/utils/CPUInfo.cpp
+@@ -37,7 +37,7 @@
+ #include "linux/LinuxResourceCounter.h"
+ #endif
+ 
+-#if defined(TARGET_FREEBSD)
++#if defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+ #include <sys/types.h>
+ #include <sys/sysctl.h>
+ #include <sys/resource.h>
+@@ -237,7 +237,7 @@ CCPUInfo::CCPUInfo(void)
+   }
+   else
+     m_cpuQueryLoad = nullptr;
+-#elif defined(TARGET_FREEBSD)
++#elif defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+   size_t len;
+   int i;
+   char cpumodel[512];
+@@ -564,6 +564,12 @@ float CCPUInfo::getCPUFrequency()
+   if (sysctlbyname("dev.cpu.0.freq", &hz, &len, NULL, 0) != 0)
+     hz = 0;
+   return (float)hz;
++#elif defined(TARGET_NETBSD)
++  int hz = 0;
++  size_t len = sizeof(hz);
++  if (sysctlbyname("machdep.cpu.frequency.current", &hz, &len, NULL, 0) != 0)
++    hz = 0;
++  return (float)hz;
+ #else
+   int value = 0;
+   if (m_fCPUFreq && !m_cpuInfoForFreq)
+@@ -725,7 +731,8 @@ bool CCPUInfo::readProcStat(unsigned lon
+   else
+     for (std::map<int, CoreInfo>::iterator it = m_cores.begin(); it != m_cores.end(); ++it)
+       it->second.m_fPct = double(m_lastUsedPercentage); // use CPU average as fallback
+-#elif defined(TARGET_FREEBSD)
++#elif defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
++#if defined(TARGET_FREEBSD)
+   long *cptimes;
+   size_t len;
+   int i;
+@@ -741,6 +748,19 @@ bool CCPUInfo::readProcStat(unsigned lon
+     free(cptimes);
+     return false;
+   }
++#elif defined(TARGET_NETBSD)
++  uint64_t *cptimes;
++  size_t len;
++  int i;
++
++  len = sizeof(*cptimes) * m_cpuCount * CPUSTATES;
++  cptimes = (uint64_t*)malloc(len);
++  if (sysctlbyname("kern.cp_time", cptimes, &len, NULL, 0) != 0)
++  {
++    free(cptimes);
++    return false;
++  }
++#endif
+   user = 0;
+   nice = 0;
+   system = 0;
+@@ -748,7 +768,11 @@ bool CCPUInfo::readProcStat(unsigned lon
+   io = 0;
+   for (i = 0; i < m_cpuCount; i++)
+   {
++#if defined(TARGET_NETBSD)
++    int64_t coreUser, coreNice, coreSystem, coreIdle, coreIO;
++#else
+     long coreUser, coreNice, coreSystem, coreIdle, coreIO;
++#endif
+     double total;
+ 
+     coreUser   = cptimes[i * CPUSTATES + CP_USER];
+@@ -767,7 +791,9 @@ bool CCPUInfo::readProcStat(unsigned lon
+       coreIO -= iter->second.m_io;
+ 
+       total = (double)(coreUser + coreNice + coreSystem + coreIdle + coreIO);
+-      if(total != 0.0f)
++      if(total == 0.0f)
++        iter->second.m_fPct = 0.0f;
++      else
+         iter->second.m_fPct = ((double)(coreUser + coreNice + coreSystem) * 100.0) / total;
+ 
+       iter->second.m_user += coreUser;
+@@ -957,6 +983,18 @@ bool CCPUInfo::HasNeon()
+ #elif defined(TARGET_DARWIN_IOS)
+   has_neon = 1;
+ 
++#elif defined(TARGET_NETBSD) && defined(__ARM_NEON__)
++  if (has_neon == -1)
++  {
++    has_neon = 0;
++    int flag;
++    size_t len = sizeof(flag);
++    if (sysctlbyname("machdep.neon_present", &flag, &len, NULL, 0) == 0)
++    {
++      has_neon = 1;
++    }
++  }
++
+ #elif defined(TARGET_LINUX) && defined(__ARM_NEON__)
+   if (has_neon == -1)
+   {
diff --git a/kodi/patches/patch-xbmc_utils_CharsetConverter.cpp b/kodi/patches/patch-xbmc_utils_CharsetConverter.cpp
new file mode 100644
index 0000000000..1baa51e2a1
--- /dev/null
+++ b/kodi/patches/patch-xbmc_utils_CharsetConverter.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_utils_CharsetConverter.cpp,v 1.1 2015/11/17 16:14:21 jmcneill Exp $
+
+--- xbmc/utils/CharsetConverter.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/utils/CharsetConverter.cpp
+@@ -65,7 +65,7 @@
+   #pragma comment(lib, "libfribidi.lib")
+   #pragma comment(lib, "libiconv.lib")
+ #endif
+-#elif defined(TARGET_ANDROID)
++#elif defined(TARGET_ANDROID) || defined(TARGET_NETBSD)
+   #define WCHAR_IS_UCS_4 1
+   #define UTF16_CHARSET "UTF-16" ENDIAN_SUFFIX
+   #define UTF32_CHARSET "UTF-32" ENDIAN_SUFFIX
diff --git a/kodi/patches/patch-xbmc_utils_RssReader.cpp b/kodi/patches/patch-xbmc_utils_RssReader.cpp
new file mode 100644
index 0000000000..94fdb6ea1c
--- /dev/null
+++ b/kodi/patches/patch-xbmc_utils_RssReader.cpp
@@ -0,0 +1,18 @@
+$NetBSD: patch-xbmc_utils_RssReader.cpp,v 1.1 2017/02/21 16:03:21 joerg Exp $
+
+--- xbmc/utils/RssReader.cpp.orig	2017-02-19 13:57:42.233006487 +0000
++++ xbmc/utils/RssReader.cpp
+@@ -267,11 +267,11 @@ void CRssReader::GetNewsItems(TiXmlEleme
+   if (m_tagSet.empty())
+     AddTag("title");
+ 
+-  while (itemNode > 0)
++  while (itemNode)
+   {
+     TiXmlNode* childNode = itemNode->FirstChild();
+     mTagElements.clear();
+-    while (childNode > 0)
++    while (childNode)
+     {
+       std::string strName = childNode->ValueStr();
+ 
diff --git a/kodi/patches/patch-xbmc_utils_Stopwatch.cpp b/kodi/patches/patch-xbmc_utils_Stopwatch.cpp
new file mode 100644
index 0000000000..78ea0783e0
--- /dev/null
+++ b/kodi/patches/patch-xbmc_utils_Stopwatch.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_utils_Stopwatch.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/utils/Stopwatch.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/utils/Stopwatch.cpp
+@@ -21,7 +21,7 @@
+ #include "Stopwatch.h"
+ #if defined(TARGET_POSIX)
+ #include "threads/SystemClock.h" 
+-#if !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD)
++#if !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD) && !defined(TARGET_NETBSD)
+ #include <sys/sysinfo.h>
+ #endif
+ #endif
diff --git a/kodi/patches/patch-xbmc_utils_SystemInfo.cpp b/kodi/patches/patch-xbmc_utils_SystemInfo.cpp
new file mode 100644
index 0000000000..b7723676a3
--- /dev/null
+++ b/kodi/patches/patch-xbmc_utils_SystemInfo.cpp
@@ -0,0 +1,88 @@
+$NetBSD: patch-xbmc_utils_SystemInfo.cpp,v 1.2 2015/11/18 23:27:23 jmcneill Exp $
+
+--- xbmc/utils/SystemInfo.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/utils/SystemInfo.cpp
+@@ -71,7 +71,7 @@
+ #elif defined(TARGET_ANDROID)
+ #include <android/api-level.h>
+ #include <sys/system_properties.h>
+-#elif defined(TARGET_FREEBSD)
++#elif defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+ #include <sys/param.h>
+ #elif defined(TARGET_LINUX)
+ #include <linux/version.h>
+@@ -615,8 +615,8 @@ std::string CSysInfo::GetOsName(bool emp
+   {
+ #if defined (TARGET_WINDOWS)
+     osName = GetKernelName() + "-based OS";
+-#elif defined(TARGET_FREEBSD)
+-    osName = GetKernelName(true); // FIXME: for FreeBSD OS name is a kernel name
++#elif defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
++    osName = GetKernelName(true); // FIXME: for FreeBSD and NetBSD OS name is a kernel name
+ #elif defined(TARGET_DARWIN_IOS)
+     osName = "iOS";
+ #elif defined(TARGET_DARWIN_OSX)
+@@ -647,8 +647,8 @@ std::string CSysInfo::GetOsVersion(void)
+   if (!osVersion.empty())
+     return osVersion;
+ 
+-#if defined(TARGET_WINDOWS) || defined(TARGET_FREEBSD)
+-  osVersion = GetKernelVersion(); // FIXME: for Win32 and FreeBSD OS version is a kernel version
++#if defined(TARGET_WINDOWS) || defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
++  osVersion = GetKernelVersion(); // FIXME: for Win32, FreeBSD, and NetBSD OS version is a kernel version
+ #elif defined(TARGET_DARWIN_IOS)
+   osVersion = CDarwinUtils::GetIOSVersionString();
+ #elif defined(TARGET_DARWIN_OSX)
+@@ -744,7 +744,7 @@ std::string CSysInfo::GetOsPrettyNameWit
+   }
+   else
+     osNameVer.append(" unknown");
+-#elif defined(TARGET_FREEBSD) || defined(TARGET_DARWIN_IOS) || defined(TARGET_DARWIN_OSX)
++#elif defined(TARGET_FREEBSD) || defined(TARGET_NETBSD) || defined(TARGET_DARWIN_IOS) || defined(TARGET_DARWIN_OSX)
+   osNameVer = GetOsName() + " " + GetOsVersion();
+ #elif defined(TARGET_ANDROID)
+   osNameVer = GetOsName() + " " + GetOsVersion() + " API level " +   StringUtils::Format("%d", CJNIBuild::SDK_INT);
+@@ -1002,6 +1002,10 @@ const std::string& CSysInfo::GetKernelCp
+       std::string machine(un.machine);
+       if (machine.compare(0, 3, "arm", 3) == 0 || machine.compare(0, 7, "aarch64", 7) == 0)
+         kernelCpuFamily = "ARM";
++#if defined(TARGET_NETBSD)
++      else if (machine.compare(0, 6, "evbarm", 6) == 0)
++        kernelCpuFamily = "ARM";
++#endif
+       else if (machine.compare(0, 4, "mips", 4) == 0)
+         kernelCpuFamily = "MIPS";
+       else if (machine.compare(0, 4, "i686", 4) == 0 || machine == "i386" || machine == "amd64" ||  machine.compare(0, 3, "x86", 3) == 0)
+@@ -1276,6 +1280,8 @@ std::string CSysInfo::GetBuildTargetPlat
+   return "iOS";
+ #elif defined(TARGET_FREEBSD)
+   return "FreeBSD";
++#elif defined(TARGET_NETBSD)
++  return "NetBSD";
+ #elif defined(TARGET_ANDROID)
+   return "Android";
+ #elif defined(TARGET_LINUX)
+@@ -1299,6 +1305,8 @@ std::string CSysInfo::GetBuildTargetPlat
+   return XSTR_MACRO(__IPHONE_OS_VERSION_MIN_REQUIRED);
+ #elif defined(TARGET_FREEBSD)
+   return XSTR_MACRO(__FreeBSD_version);
++#elif defined(TARGET_NETBSD)
++  return XSTR_MACRO(__NetBSD_Version__);
+ #elif defined(TARGET_ANDROID)
+   return "API level " XSTR_MACRO(__ANDROID_API__);
+ #elif defined(TARGET_LINUX)
+@@ -1345,6 +1353,14 @@ std::string CSysInfo::GetBuildTargetPlat
+     return StringUtils::Format("version %d.%d-STABLE", major, minor);
+ 
+   return StringUtils::Format("version %d.%d-CURRENT", major, minor);
++#elif defined(TARGET_NETBSD)
++  static const int major = (__NetBSD_Version__ / 100000000) % 100;
++  static const int minor = (__NetBSD_Version__ / 1000000) % 100;
++  static const int patch = (__NetBSD_Version__ / 100) % 100;
++  if (patch != 0)
++    return StringUtils::Format("version %d.%d.%d", major, minor, patch);
++  else
++    return StringUtils::Format("version %d.%d", major, minor);
+ #elif defined(TARGET_ANDROID)
+   return "API level " XSTR_MACRO(__ANDROID_API__);
+ #elif defined(TARGET_LINUX)
diff --git a/kodi/patches/patch-xbmc_utils_test_TestSystemInfo.cpp b/kodi/patches/patch-xbmc_utils_test_TestSystemInfo.cpp
new file mode 100644
index 0000000000..a31ddfac48
--- /dev/null
+++ b/kodi/patches/patch-xbmc_utils_test_TestSystemInfo.cpp
@@ -0,0 +1,33 @@
+$NetBSD: patch-xbmc_utils_test_TestSystemInfo.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/utils/test/TestSystemInfo.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/utils/test/TestSystemInfo.cpp
+@@ -73,6 +73,9 @@ TEST_F(TestSystemInfo, GetKernelName)
+ #elif defined(TARGET_FREEBSD)
+   EXPECT_STREQ("FreeBSD", g_sysinfo.GetKernelName(true).c_str()) << "'GetKernelName(true)' must return 'FreeBSD'";
+   EXPECT_STREQ("FreeBSD", g_sysinfo.GetKernelName(false).c_str()) << "'GetKernelName(false)' must return 'FreeBSD'";
++#elif defined(TARGET_NETBSD)
++  EXPECT_STREQ("NetBSD", g_sysinfo.GetKernelName(true).c_str()) << "'GetKernelName(true)' must return 'NetBSD'";
++  EXPECT_STREQ("NetBSD", g_sysinfo.GetKernelName(false).c_str()) << "'GetKernelName(false)' must return 'NetBSD'";
+ #elif defined(TARGET_DARWIN)
+   EXPECT_STREQ("Darwin", g_sysinfo.GetKernelName(true).c_str()) << "'GetKernelName(true)' must return 'Darwin'";
+   EXPECT_STREQ("Darwin", g_sysinfo.GetKernelName(false).c_str()) << "'GetKernelName(false)' must return 'Darwin'";
+@@ -111,6 +114,9 @@ TEST_F(TestSystemInfo, GetOsName)
+ #elif defined(TARGET_FREEBSD)
+   EXPECT_STREQ("FreeBSD", g_sysinfo.GetOsName(true).c_str()) << "'GetOsName(true)' must return 'FreeBSD'";
+   EXPECT_STREQ("FreeBSD", g_sysinfo.GetOsName(false).c_str()) << "'GetOsName(false)' must return 'FreeBSD'";
++#elif defined(TARGET_NETBSD)
++  EXPECT_STREQ("NetBSD", g_sysinfo.GetOsName(true).c_str()) << "'GetOsName(true)' must return 'NetBSD'";
++  EXPECT_STREQ("NetBSD", g_sysinfo.GetOsName(false).c_str()) << "'GetOsName(false)' must return 'NetBSD'";
+ #elif defined(TARGET_DARWIN_IOS)
+   EXPECT_STREQ("iOS", g_sysinfo.GetOsName(true).c_str()) << "'GetOsName(true)' must return 'iOS'";
+   EXPECT_STREQ("iOS", g_sysinfo.GetOsName(false).c_str()) << "'GetOsName(false)' must return 'iOS'";
+@@ -241,6 +247,8 @@ TEST_F(TestSystemInfo, GetUserAgent)
+   EXPECT_EQ(g_sysinfo.GetUserAgent().find('('), g_sysinfo.GetUserAgent().find("(X11; ")) << "Second parameter in 'GetUserAgent()' string must start from 'X11; '";
+ #if defined(TARGET_FREEBSD)
+   EXPECT_EQ(g_sysinfo.GetUserAgent().find('('), g_sysinfo.GetUserAgent().find("(X11; FreeBSD ")) << "Second parameter in 'GetUserAgent()' string must start from 'X11; FreeBSD '";
++#if defined(TARGET_NETBSD)
++  EXPECT_EQ(g_sysinfo.GetUserAgent().find('('), g_sysinfo.GetUserAgent().find("(X11; NetBSD ")) << "Second parameter in 'GetUserAgent()' string must start from 'X11; NetBSD '";
+ #elif defined(TARGET_LINUX)
+   EXPECT_EQ(g_sysinfo.GetUserAgent().find('('), g_sysinfo.GetUserAgent().find("(X11; Linux ")) << "Second parameter in 'GetUserAgent()' string must start from 'X11; Linux '";
+ #endif // defined(TARGET_LINUX)
diff --git a/kodi/patches/patch-xbmc_windowing_WinEvents.cpp b/kodi/patches/patch-xbmc_windowing_WinEvents.cpp
new file mode 100644
index 0000000000..ece2c736b1
--- /dev/null
+++ b/kodi/patches/patch-xbmc_windowing_WinEvents.cpp
@@ -0,0 +1,18 @@
+$NetBSD: patch-xbmc_windowing_WinEvents.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/windowing/WinEvents.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/windowing/WinEvents.cpp
+@@ -38,11 +38,11 @@
+ #include "android/WinEventsAndroid.h"
+ #define WinEventsType CWinEventsAndroid
+ 
+-#elif (defined(TARGET_FREEBSD) || defined(TARGET_LINUX)) && defined(HAS_SDL_WIN_EVENTS)
++#elif (defined(TARGET_FREEBSD) || defined(TARGET_NETBSD) || defined(TARGET_LINUX)) && defined(HAS_SDL_WIN_EVENTS)
+ #include "WinEventsSDL.h"
+ #define WinEventsType CWinEventsSDL
+ 
+-#elif (defined(TARGET_FREEBSD) || defined(TARGET_LINUX)) && defined(HAS_X11_WIN_EVENTS)
++#elif (defined(TARGET_FREEBSD) || defined(TARGET_NETBSD) || defined(TARGET_LINUX)) && defined(HAS_X11_WIN_EVENTS)
+ #include "WinEventsX11.h"
+ #define WinEventsType CWinEventsX11
+ 
diff --git a/kodi/patches/patch-xbmc_windowing_WinEventsX11.cpp b/kodi/patches/patch-xbmc_windowing_WinEventsX11.cpp
new file mode 100644
index 0000000000..a8d6b353c1
--- /dev/null
+++ b/kodi/patches/patch-xbmc_windowing_WinEventsX11.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_windowing_WinEventsX11.cpp,v 1.1 2015/12/23 12:43:25 joerg Exp $
+
+--- xbmc/windowing/WinEventsX11.cpp.orig	2015-12-22 18:16:12.000000000 +0000
++++ xbmc/windowing/WinEventsX11.cpp
+@@ -19,6 +19,8 @@
+ *
+ */
+ 
++#include <locale.h>
++#include <cstdlib>
+ #include "system.h"
+ 
+ #ifdef HAS_X11_WIN_EVENTS
diff --git a/kodi/patches/patch-xbmc_windowing_WindowingFactory.h b/kodi/patches/patch-xbmc_windowing_WindowingFactory.h
new file mode 100644
index 0000000000..9210738a90
--- /dev/null
+++ b/kodi/patches/patch-xbmc_windowing_WindowingFactory.h
@@ -0,0 +1,56 @@
+$NetBSD: patch-xbmc_windowing_WindowingFactory.h,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+Add NetBSD & FreeBSD sanely
+
+--- xbmc/windowing/WindowingFactory.h.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/windowing/WindowingFactory.h
+@@ -23,32 +23,27 @@
+ 
+ #include "system.h"
+ 
+-#if   defined(TARGET_WINDOWS) && defined(HAS_GL)
+-#include "windows/WinSystemWin32GL.h"
+-
+-#elif defined(TARGET_WINDOWS) && defined(HAS_DX)
+-#include "windows/WinSystemWin32DX.h"
+-
+-#elif defined(TARGET_LINUX)   && defined(HAVE_X11)   && defined(HAS_GLES)
+-#include "X11/WinSystemX11GLESContext.h"
+-
+-#elif defined(TARGET_LINUX)   && defined(HAVE_X11)   && defined(HAS_GL)
+-#include "X11/WinSystemX11GLContext.h"
+-
+-#elif defined(TARGET_LINUX)   && defined(HAS_GLES) && defined(HAS_EGL) && !defined(HAVE_X11)
+-#include "egl/WinSystemEGL.h"
+-
+-#elif defined(TARGET_FREEBSD)   && defined(HAS_GL)   && defined(HAVE_X11)
+-#include "X11/WinSystemX11GL.h"
+-
+-#elif defined(TARGET_FREEBSD) && defined(HAS_GLES) && defined(HAS_EGL)
+-#include "egl/WinSystemGLES.h"
++#if defined(TARGET_WINDOWS)
++#  if defined(HAS_GL)
++#    include "windows/WinSystemWin32GL.h"
++#  elif defined(HAS_DX)
++#    include "windows/WinSystemWin32DX.h"
++#  endif
++
++#elif defined(TARGET_LINUX) || defined(TARGET_NETBSD) || defined(TARGET_FREEBSD)
++#  if defined(HAVE_X11)   && defined(HAS_GLES)
++#    include "X11/WinSystemX11GLESContext.h"
++#  elif defined(HAVE_X11) && defined(HAS_GL)
++#    include "X11/WinSystemX11GLContext.h"
++#  elif !defined(HAVE_X11) && defined(HAS_GLES) && defined(HAS_EGL)
++#    include "egl/WinSystemEGL.h"
++#  endif
+ 
+ #elif defined(TARGET_DARWIN_OSX)
+-#include "osx/WinSystemOSXGL.h"
++#  include "osx/WinSystemOSXGL.h"
+ 
+ #elif defined(TARGET_DARWIN_IOS)
+-#include "osx/WinSystemIOS.h"
++#  include "osx/WinSystemIOS.h"
+ 
+ #endif
+ 
diff --git a/kodi/patches/patch-xbmc_windowing_X11_XRandR.cpp b/kodi/patches/patch-xbmc_windowing_X11_XRandR.cpp
new file mode 100644
index 0000000000..2ac38eafc3
--- /dev/null
+++ b/kodi/patches/patch-xbmc_windowing_X11_XRandR.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_windowing_X11_XRandR.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+
+--- xbmc/windowing/X11/XRandR.cpp.orig	2015-10-19 06:31:15.000000000 +0000
++++ xbmc/windowing/X11/XRandR.cpp
+@@ -32,7 +32,7 @@
+ #include "threads/SystemClock.h"
+ #include "CompileInfo.h"
+ 
+-#if defined(TARGET_FREEBSD)
++#if defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
+ #include <sys/types.h>
+ #include <sys/wait.h>
+ #endif


Home | Main Index | Thread Index | Old Index