m681x-newlib stable port information

Package: m681x-newlib
Version: 1.12.0
Revision: 3
Maintainer: Carl van Denzen
Recommends: m681x-binutils,m681x-gcc,m681x-gdb
HomePage: http://m68hc11.serveftp.org/
#Source: mirror:gnu:/gcc/newlib-%v/newlib-%v.tar.gz
Source: ftp://sources.redhat.com/pub/newlib/newlib-%v.tar.gz
Source-MD5: c3f1fbb52a4864cf8356c124584bae72
Source2: http://m68hc11.serveftp.org/m68hc1x-builder-3.1.tar.gz
Source2-MD5: 6c3ee04975e34414acf69dab2d2b1556
DescPort: <<
All files that are not recognizable as m6811 files renamed to m6811-xxx to avoid clashes with other potential toolchains.
--with-as=%p/bin/m6811-elf-as added, I do not know why it is needed when not building into /usr/local, but it solves a problem.
TODO: Find a solution for shared gcc files gccbug and gcov ?
<<
PatchScript: <<
#!/bin/bash -ev
patch -p1 < ../m68hc1x-builder-3.1/newlib-1.12.0-m68hc1x-20040801.diffs
#
# Use getreent() function
#
sed patch.tmp -e '5a\
#define __DYNAMIC_REENT__
'
cp patch.tmp newlib/libc/include/sys/config.h
<<
CompileScript: <<
#!/bin/bash -ev
# Extract TARGET and PROGRAM_PREFIX from the fink package name
# m6811-xxxx -> m6811-elf cq m6811-elf- cq m6811 (machine)
SOURCEDIR=$(pwd)
for x in 1 2 ; do
#
# 681$x
#
MACHINE=%n;MACHINE=${MACHINE%%x-*}$x
TARGET=${MACHINE}-elf;PROGRAM_PREFIX=$TARGET-
echo $TARGET $MACHINE $PROGRAM_PREFIX
#
# gcc does not compile in the source directory. Compile directory will be the current directory with a suffix.
#
cd $SOURCEDIR
BUILDDIR=build.${MACHINE}
mkdir ${BUILDDIR}
cd ${BUILDDIR}
${SOURCEDIR}/configure --target=$TARGET --prefix=%i/share/$MACHINE --bindir=%i/bin --mandir=%i/share/man --infodir=%i/share/info --enable-languages=c --program-prefix=$PROGRAM_PREFIX --with-local-prefix=%i/include/local --with-as=%p/bin/m6811-elf-as --with-ld=%p/bin/m6811-elf-ld --disable-nls
make
done
<<
InstallScript: <<
#!/bin/bash -ev
# Extract TARGET and PROGRAM_PREFIX from the fink package name
# m6811-xxxx -> m6811-elf cq m6811-elf- cq m6811 (machine)
SOURCEDIR=$(pwd)
for x in 1 2 ; do
#
# 681$x
#
MACHINE=%{n};MACHINE=${MACHINE%%x-*}$x
TARGET=${MACHINE}-elf;PROGRAM_PREFIX=$TARGET-
cd $SOURCEDIR
BUILDDIR=build.${MACHINE}
cd ${BUILDDIR}
make install
#/usr/bin/find -E %i -regex ".*/libiberty.a" -exec rm -f {} \;
rm -f %i/share/m68hc1x/lib/libiberty.a
rm -f %i/share/info/standards.info
rm -f %i/share/info/configure.info*
#
# Rename the files xxx.info into m6811-elf-xxx.info cq m6812-elf-xx.info to avoid name clashes with other binutils packages and these two packages (m6811 and m6812)
# The files of the m6811 should not be renamed, hence the inverted grep.
#
for i in $(/usr/bin/find -E %d -regex ".*/.*\.info(-[0-9]+)?" -print|grep --invert-match /${MACHINE%%%%?});do echo $i ${i%%/*} ${i##*/} ;mv $i ${i%%/*}/$PROGRAM_PREFIX${i##*/};done
done
<<
DocFiles:
InfoDocs:
Description: For Motorola 68hc11/12 micro controllers
License: GPL
#Homepage: http://gcc.gnu.org/
BuildDepends: m681x-gcc