Cody Schafer avatar Cody Schafer committed 17a138b

build latest everything without patching.

Comments (0)

Files changed (3)

 #!/bin/bash
 
 # BEGIN CONFIGURATION
-BINUTILS_VERSION=2.22
-GCC_VERSION=4.6.3
-MPFR_VERSION=3.1.0
-GMP_VERSION=5.0.2
-MPC_VERSION=0.9
+BINUTILS_VERSION=2.23.1
+#http://www.netgull.com/gcc/snapshots/4.8-20130210/gcc-4.8-20130210.tar.bz2
+GCC_VERSION="4.8-20130210"
+GCC_TYPE=snapshot
+MPFR_VERSION=3.1.1
+GMP_VERSION=5.1.1
+MPC_VERSION=1.0.1
 JOBS=4
 
 export CFLAGS="-O2 -ggdb"
 }
 
 make_or_die() {
-	make -C "$BUILD/$1" -j "$JOBS" || die "** $1 build failed"
-	make -C "$BUILD/$1" -j "$JOBS" install || die "** $1 install failed"
+	name=$1
+	shift
+	make -C "$BUILD/$name" -j "$JOBS" "$@" || die "** $name build failed"
+	make -C "$BUILD/$name" -j "$JOBS" "$@" install || die "** $name install failed"
 }
 
 download()
 SKIP="${5:-}"
 
 # Must be absolute path as it is used in "conf", where we change directory.
+# Note that gcc's configure copies the headers out of this directory, so it is
+# not needed after building.
+# FIXME: build fails (xgcc can't build executables) if this is unexported
 export WIND_BASE=$(realpath -m "$SRC/gccdist/WindRiver/vxworks-6.3")
 
 export PATH="$(realpath -m "$PREFIX/bin"):$PATH"
 [ -d "$SRC"    ] || mkdir "$SRC"    || exit
 [ -d "$PREFIX" ] || mkdir "$PREFIX" || exit
 [ -d "$BUILD"  ] || mkdir "$BUILD"  || exit
-for d in gccdist binutils gcc libstdc++; do
+for d in gccdist binutils gcc; do
 	if ! skip_has "$d"; then
 		df="$BUILD/$d"
 		[ -d "$df" ] && rm -rf "$df"
 	download "gccdist.zip" \
 		"ftp://ftp.ni.com/pub/devzone/tut/updated_vxworks63gccdist.zip"
 	extract gccdist.zip
-	patch -l -d "$SRC/gccdist" -p1 < wrs_headers-regsPpc.patch || exit
-	patch -l -d "$SRC/gccdist" -p1 < wrs_headers-unistd.patch || exit
-	patch -l -d "$SRC/gccdist" -p1 < wrs_headers-ioLib.patch  || exit
-	patch -l -d "$SRC/gccdist" -p1 < wrs_headers-uio.patch  || exit
-	patch -l -d "$SRC/gccdist" -p1 < wrs_headers-cdefs.patch  || exit
+	#patch -l -d "$SRC/gccdist" -p1 < wrs_headers-regsPpc.patch || exit
+	#patch -l -d "$SRC/gccdist" -p1 < wrs_headers-unistd.patch || exit
+	#patch -l -d "$SRC/gccdist" -p1 < wrs_headers-ioLib.patch  || exit
+	#patch -l -d "$SRC/gccdist" -p1 < wrs_headers-uio.patch  || exit
+	#patch -l -d "$SRC/gccdist" -p1 < wrs_headers-cdefs.patch  || exit
 }
 run wrs_headers
 
+apply_to_gcc () {
+	patch -l -d "$SRC/gcc-$GCC_VERSION" -p1 < "$1" || exit
+}
+
 prep_gcc ()
 {
-	patch -l -d "$SRC/gcc-$GCC_VERSION" -p1 < gcc.patch || exit 1
-	patch -l -d "$SRC/gcc-$GCC_VERSION" -p1 < gcc-4.6.2-vxworks-libstdcxx.patch || exit 1
-	patch -l -d "$SRC/gcc-$GCC_VERSION" -p1 < gcc-vxworks-libstdcxx-nominmax.patch || exit 1
+	#apply_to_gcc gcc.patch
+	#apply_to_gcc gcc-4.8-20130210-libgcc-return.patch
+	#apply_to_gcc gcc-gcov-mkdir.patch
+	#apply_to_gcc gcc-gcov-open.patch
+
 	#( cd "$SRC/gcc-$GCC_VERSION" && ./contrib/download_prerequisites ) || exit
+	:
 }
 
 conf_gcc ()
 	    --with-float=hard \
 	    --enable-languages=c,c++ \
 	    --enable-threads=vxworks \
-	    --without-gconv \
 	    --disable-libgomp \
 	    --disable-nls \
 	    --disable-libmudflap \
 }
 
 do_gcc () {
-	download "gcc-$GCC_VERSION.tar.bz2" \
-		"http://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.bz2"
+	if [ $GCC_TYPE = "release" ]; then
+		download "gcc-$GCC_VERSION.tar.bz2" \
+			"http://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.bz2"
+	elif [ $GCC_TYPE = "snapshot" ]; then
+		SITE="http://www.netgull.com/gcc"
+		download "gcc-$GCC_VERSION.tar.bz2" \
+			"$SITE/snapshots/$GCC_VERSION/gcc-$GCC_VERSION.tar.bz2"
+	else
+		die "Invalid GCC_TYPE"
+	fi
+
 	download "mpfr-$MPFR_VERSION.tar.bz2" \
 		"http://www.mpfr.org/mpfr-current/mpfr-$MPFR_VERSION.tar.bz2"
 	download "gmp-$GMP_VERSION.tar.bz2" \
 
 	prep_gcc
 	conf gcc
-	make_or_die gcc
+
+	# XXX: inhibit_libc is a hack to avoid building gcov in gcc
+	#      gcov breaks due to mkdir issues.
+	make_or_die gcc inhibit_libc=true
 }
 run gcc
 

gcc-gcov-mkdir.patch

+diff -durp a/gcc/libgcov.c b/gcc/libgcov.c
+--- a/gcc/libgcov.c
++++ b/gcc/libgcov.c
+@@ -114,7 +114,7 @@ create_file_directory (char *filename)
+ 
+         /* Try to make directory if it doesn't already exist.  */
+         if (access (filename, F_OK) == -1
+-#ifdef TARGET_POSIX_IO
++#if defined(TARGET_POSIX_IO) && !defined(__VXWORKS__)
+             && mkdir (filename, 0755) == -1
+ #else
+             && mkdir (filename) == -1

gcc.patch

-diff -durp -x '*~' gcc-4.6.2/gcc/gcov-io.c gcc-4.6.2-r1/gcc/gcov-io.c
---- gcc-4.6.2/gcc/gcov-io.c	2011-04-06 11:05:18.000000000 -0500
-+++ gcc-4.6.2-r1/gcc/gcov-io.c	2012-01-15 21:27:41.407688488 -0500
-@@ -92,7 +92,11 @@ gcov_open (const char *name, int mode)
-     {
-       /* Read-only mode - acquire a read-lock.  */
-       s_flock.l_type = F_RDLCK;
-+#ifdef __VXWORKS__
-+      fd = open (name, O_RDONLY, 0666);
-+#else
-       fd = open (name, O_RDONLY);
-+#endif
-     }
-   else
-     {
-diff -durp -x '*~' gcc-4.6.2/gcc/libgcov.c gcc-4.6.2-r1/gcc/libgcov.c
---- gcc-4.6.2/gcc/libgcov.c	2011-01-04 13:05:06.000000000 -0500
-+++ gcc-4.6.2-r1/gcc/libgcov.c	2012-01-15 17:54:11.566928799 -0500
-@@ -114,7 +114,7 @@ create_file_directory (char *filename)
- 
-         /* Try to make directory if it doesn't already exist.  */
-         if (access (filename, F_OK) == -1
--#ifdef TARGET_POSIX_IO
-+#if defined(TARGET_POSIX_IO) && !defined(__VXWORKS__)
-             && mkdir (filename, 0755) == -1
- #else
-             && mkdir (filename) == -1
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.