Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

#! /bin/sh
#
#	$NetBSD: gcc2gcc.old,v 1.4 2014/02/27 09:08:49 mrg Exp $

# run it like eg:
#
#   % ./gcc2gcc.old /usr/src/external/gpl3/gcc /home/import/gcc

doit=echo
doit=

progname="$(basename "$0")"

usage() {
	echo "Usage: $progname src/external/gpl3/gcc <copy-to-dir>" 1>&2
	echo "Note that copy-to-dir must not exist." 1>&2
	exit 1
}

#set -x
set -e

srcdir="$1"
destdir="$2"

if [ -z "$srcdir" -o -z "$destdir" ]; then
	usage
fi

if [ ! -d "$srcdir" ]; then
	echo "srcdir '$srcdir' is not a directory" 1>&2
	usage
fi
if [ -e "$destdir" ]; then
	echo "destdir '$destdir' is something" 1>&2
	ls -ld "$destdir"
	usage
fi

# Assumes that ../gcc/. == .
cd "$srcdir"/..
if [ ! -d gcc ]; then
	echo "$srcdir/../gcc doesn't exist." 1>&2
	usage
fi

echo "Copying files to $destdir..."
$doit pax -rwpp gcc "$destdir"


# clean the copy
echo "Cleaning CVS turds and ChangeLogs"
$doit find "$destdir" -name .CVS -exec rm -rf {} +
$doit find "$destdir" -name CVS -exec rm -rf {} +
$doit find "$destdir" -name "ChangeLog*" -exec rm -f {} +
$doit rm -f "$destdir"/gcc/gcc2netbsd "$destdir"/gcc/gcc2gcc.old "$destdir"/gcc/difz

date=$(date +%Y%m%d-%H%M)
echo GCC copied to gcc.old.  use these commands to import:
echo cd "$destdir/gcc"
echo cvs import src/external/gpl3/gcc.old NetBSD src-external-gpl3-gcc-$date

exit 0