Building Rockbox on NetBSD
From Wikistix
As at 2013-06-10, Rockbox needed a few patches to build under NetBSD.
First, building tools broke here:
ksh$ export RBDEV_DOWNLOAD=/usr/pkgsrc/distfiles
ksh$ export RBDEV_PREFIX=${HOME}/src/rb/xc
ksh$ export PATH=${PATH}:${RBDEV_PREFIX}/bin
ksh$ cd rockbox/tools
ksh$ ./rockboxdev.sh
…
mkdir build-x86_64-unknown-netbsd6.0.
mkdir build-x86_64-unknown-netbsd6.0./libiberty
Configuring in build-x86_64-unknown-netbsd6.0./libiberty
configure: error: cannot find sources (xmalloc.c) in ../../gcc-4.4.4/libiberty
gmake[1]: *** [configure-build-libiberty] Error 1
gmake[1]: Leaving directory `/tmp/rbdev-build/build-gcc'
gmake: *** [all] Error 2
The following patch fixed this step:
ksh$ cd /tmp/rbdev-build
ksh$ diff -u build-gcc/Makefile build-gcc.fixed/Makefile
--- build-gcc/Makefile 2013-06-04 12:15:56.000000000 +1000
+++ build-gcc.fixed/Makefile 2013-06-04 13:00:32.000000000 +1000
@@ -2737,7 +2737,7 @@
case $(srcdir) in \
/* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
*) topdir=`echo $(BUILD_SUBDIR)/libiberty/ | \
- sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+ sed -e 's,\./,,g' -e 's,[^/]*/,../../,g' `$(srcdir) ;; \
esac; \
srcdiroption="--srcdir=$${topdir}/libiberty"; \
libsrcdir="$$s/libiberty"; \
@@ -2853,7 +2853,7 @@
case $(srcdir) in \
/* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
*) topdir=`echo $(BUILD_SUBDIR)/fixincludes/ | \
- sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+ sed -e 's,\./,,g' -e 's,[^/]*/,../../,g' `$(srcdir) ;; \
esac; \
srcdiroption="--srcdir=$${topdir}/fixincludes"; \
libsrcdir="$$s/fixincludes"; \
@@ -4248,7 +4248,7 @@
case $(srcdir) in \
/* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
*) topdir=`echo $(HOST_SUBDIR)/fixincludes/ | \
- sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+ sed -e 's,\./,,g' -e 's,[^/]*/,../../,g' `$(srcdir) ;; \
esac; \
srcdiroption="--srcdir=$${topdir}/fixincludes"; \
libsrcdir="$$s/fixincludes"; \
@@ -4816,7 +4816,7 @@
case $(srcdir) in \
/* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
*) topdir=`echo $(HOST_SUBDIR)/gcc/ | \
- sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+ sed -e 's,\./,,g' -e 's,[^/]*/,../../,g' `$(srcdir) ;; \
esac; \
srcdiroption="--srcdir=$${topdir}/gcc"; \
libsrcdir="$$s/gcc"; \
@@ -5386,7 +5386,7 @@
case $(srcdir) in \
/* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
*) topdir=`echo $(HOST_SUBDIR)/gmp/ | \
- sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+ sed -e 's,\./,,g' -e 's,[^/]*/,../../,g' `$(srcdir) ;; \
esac; \
srcdiroption="--srcdir=$${topdir}/gmp"; \
libsrcdir="$$s/gmp"; \
@@ -5826,7 +5826,7 @@
case $(srcdir) in \
/* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
*) topdir=`echo $(HOST_SUBDIR)/mpfr/ | \
- sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+ sed -e 's,\./,,g' -e 's,[^/]*/,../../,g' `$(srcdir) ;; \
esac; \
srcdiroption="--srcdir=$${topdir}/mpfr"; \
libsrcdir="$$s/mpfr"; \
@@ -6990,7 +6990,7 @@
case $(srcdir) in \
/* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
*) topdir=`echo $(HOST_SUBDIR)/intl/ | \
- sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+ sed -e 's,\./,,g' -e 's,[^/]*/,../../,g' `$(srcdir) ;; \
esac; \
srcdiroption="--srcdir=$${topdir}/intl"; \
libsrcdir="$$s/intl"; \
@@ -8652,7 +8652,7 @@
case $(srcdir) in \
/* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
*) topdir=`echo $(HOST_SUBDIR)/libiberty/ | \
- sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+ sed -e 's,\./,,g' -e 's,[^/]*/,../../,g' `$(srcdir) ;; \
esac; \
srcdiroption="--srcdir=$${topdir}/libiberty"; \
libsrcdir="$$s/libiberty"; \
Next is a bug in the Rockbox sources assuming GNU Linux, which generates the build error:
ksh$ gmake zip
…
GEN buttons.lua
In file included from <stdin>:1:0:
/home/stix/src/rb/rockbox/firmware/libc/include/stdio.h:36:57: error: expected declaration specifiers or '...' before '__gnuc_va_list'
gmake: *** [/home/stix/src/rb/rockbox/build/apps/plugins/lua/buttons.lua] Error 1
Easily fixed, with the following patch:
--- a/firmware/libc/include/stdio.h
+++ b/firmware/libc/include/stdio.h
@@ -28,6 +28,7 @@
#define TMP_MAX 26
#ifdef __GNUC__
+typedef __builtin_va_list __gnuc_va_list;
#define __VALIST __gnuc_va_list
#else
#define __VALIST char*