mirror of
https://frontier.innolan.net/github/amigaos-cross-toolchain6.git
synced 2024-10-19 10:29:55 +00:00
Preleminary version.
This commit is contained in:
42
README
Normal file
42
README
Normal file
@ -0,0 +1,42 @@
|
||||
info: m68k-amigaos gcc toolchain bootstrap
|
||||
author: Krystian Bacławski <firstname [dot] lastname [at] gmail [dot] com>
|
||||
|
||||
This project enables one to build m68k-amigaos toolchain on your un*x like
|
||||
platform with minimum hassle.
|
||||
|
||||
Tested on:
|
||||
* Ubuntu 10.04 ia32
|
||||
|
||||
Prerequisites (look at bootstrap.conf file):
|
||||
* installed locally:
|
||||
- gcc 3.4.6
|
||||
- flex
|
||||
- make
|
||||
* sources from GNU project:
|
||||
- gcc 2.95.3
|
||||
- binutils 2.9.1
|
||||
- bison 1.28
|
||||
* Amiga specific sources & binaries:
|
||||
- libnix 2.1:
|
||||
http://sourceforge.net/projects/libnix/
|
||||
- AmigaOS NDK 3.9:
|
||||
http://www.haage-partner.de/download/AmigaOS/
|
||||
- fd2inline 1.21:
|
||||
http://ftp.back2roots.org/geekgadgets/amiga/m68k/alpha/fd2inline/
|
||||
- sfdc 1.4:
|
||||
http://aminet.net/package/dev/gcc/sfdc/
|
||||
- libamiga-bin:
|
||||
http://ftp.back2roots.org/geekgadgets/amiga/m68k/snapshots/990529/bin/
|
||||
|
||||
Usage:
|
||||
1) Download sources, and put them into archive directory.
|
||||
2) Run bootstrap script.
|
||||
3) Wait for the result and if something crashes you can try to reach me.
|
||||
|
||||
TODO:
|
||||
* Testing on:
|
||||
- MacOS X 10.7
|
||||
- Cygwin
|
||||
* Remove dependencies:
|
||||
- fd2inline
|
||||
- libamiga-bin
|
||||
33
bootstrap.conf
Normal file
33
bootstrap.conf
Normal file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
readonly GCC="gcc-2.95.3"
|
||||
readonly GCC_VER="2.95.3"
|
||||
readonly GCC_CORE_SRC="../archive/gcc-core-${GCC_VER}.tar.bz2"
|
||||
readonly GCC_CORE_PATCH="../gcc/gcc-core-${GCC_VER}-amiga.diff.gz"
|
||||
readonly GCC_CPP_SRC="../archive/gcc-g++-${GCC_VER}.tar.bz2"
|
||||
readonly GCC_CPP_PATCH="../gcc/gcc-g++-${GCC_VER}-amiga.diff.gz"
|
||||
|
||||
readonly BINUTILS="binutils-2.9.1"
|
||||
readonly BINUTILS_SRC="../archive/${BINUTILS}.tar.bz2"
|
||||
readonly BINUTILS_PATCH="../binutils/${BINUTILS}-amiga.diff.gz"
|
||||
|
||||
readonly IXEMUL_VER="48.2"
|
||||
readonly IXEMUL="ixemul-${IXEMUL_VER}"
|
||||
readonly IXEMUL_SRC="../archive/${IXEMUL}.tar.bz2"
|
||||
|
||||
readonly LIBNIX="libnix-2.1"
|
||||
readonly LIBNIX_SRC="../archive/${LIBNIX}.tar.bz2"
|
||||
|
||||
readonly BISON="bison-1.28"
|
||||
readonly BISON_SRC="../archive/${BISON}.tar.bz2"
|
||||
|
||||
readonly NDK="NDK_3.9"
|
||||
readonly NDK_SRC="../archive/NDK39.lha"
|
||||
|
||||
readonly FD2INLINE="fd2inline-1.21"
|
||||
readonly FD2INLINE_SRC="../archive/${FD2INLINE}.tar.bz2"
|
||||
|
||||
readonly SFDC="sfdc-1.4"
|
||||
readonly SFDC_SRC="../archive/${SFDC}.tar.bz2"
|
||||
|
||||
readonly LIBAMIGA_SRC="../archive/libamiga-bin.tar.bz2"
|
||||
274
bootstrap.sh
Executable file
274
bootstrap.sh
Executable file
@ -0,0 +1,274 @@
|
||||
#!/bin/bash -Eeux
|
||||
|
||||
readonly TOP_DIR="$(pwd)"
|
||||
readonly SRC_DIR="${TOP_DIR}/src"
|
||||
readonly BUILD_DIR="${TOP_DIR}/build"
|
||||
readonly HOST_DIR="${TOP_DIR}/host"
|
||||
readonly TARGET_DIR="${TOP_DIR}/target"
|
||||
readonly STAMP="${TOP_DIR}/stamps"
|
||||
|
||||
source "${TOP_DIR}/bootstrap.conf"
|
||||
|
||||
function prepare_target {
|
||||
mkdir -p "${STAMP}" "${BUILD_DIR}" "${TARGET_DIR}"
|
||||
|
||||
[ -f "${STAMP}/prepare-target" ] && return 0
|
||||
|
||||
pushd "${TARGET_DIR}"
|
||||
mkdir -p "m68k-amigaos" "lib" "os-include" "os-lib"
|
||||
ln -sf "../os-include" "m68k-amigaos/include"
|
||||
ln -sf "../lib" "m68k-amigaos/lib"
|
||||
tar -xjf "${TOP_DIR}/${LIBAMIGA_SRC}"
|
||||
popd
|
||||
|
||||
touch "${STAMP}/prepare-target"
|
||||
}
|
||||
|
||||
function unpack_sources {
|
||||
[ -f "${STAMP}/unpack-sources" ] && return 0
|
||||
|
||||
rm -rf "${SRC_DIR}"
|
||||
mkdir -p "${SRC_DIR}"
|
||||
pushd "${SRC_DIR}"
|
||||
|
||||
rm -rf "${BISON}"
|
||||
tar -xjf "${TOP_DIR}/${BISON_SRC}"
|
||||
|
||||
rm -rf "${BINUTILS}"
|
||||
tar -xjf "${TOP_DIR}/${BINUTILS_SRC}"
|
||||
pushd "${BINUTILS}"
|
||||
zcat "${TOP_DIR}/${BINUTILS_PATCH}" | patch -p1
|
||||
popd
|
||||
|
||||
rm -rf "${GCC}"
|
||||
tar -xjf "${TOP_DIR}/${GCC_CORE_SRC}"
|
||||
tar -xjf "${TOP_DIR}/${GCC_CPP_SRC}"
|
||||
pushd "${GCC}"
|
||||
zcat "${TOP_DIR}/${GCC_CORE_PATCH}" | patch -p1
|
||||
zcat "${TOP_DIR}/${GCC_CPP_PATCH}" | patch -p1
|
||||
popd
|
||||
|
||||
rm -rf "${FD2INLINE}"
|
||||
tar -xjf "${TOP_DIR}/${FD2INLINE_SRC}"
|
||||
|
||||
rm -rf "${SFDC}"
|
||||
tar -xjf "${TOP_DIR}/${SFDC_SRC}"
|
||||
|
||||
rm -rf "${NDK}"
|
||||
lha x "${TOP_DIR}/${NDK_SRC}"
|
||||
rm -rf ndk_* *.info
|
||||
|
||||
rm -rf "${IXEMUL}"
|
||||
tar -xjf "${TOP_DIR}/${IXEMUL_SRC}"
|
||||
chmod a+x "${IXEMUL}/configure"
|
||||
|
||||
rm -rf "${LIBNIX}"
|
||||
tar -xjf "${TOP_DIR}/${LIBNIX_SRC}"
|
||||
chmod a+x "${LIBNIX}/mkinstalldirs"
|
||||
|
||||
popd
|
||||
|
||||
touch "${STAMP}/unpack-sources"
|
||||
}
|
||||
|
||||
function build_tools {
|
||||
[ -f "${STAMP}/build-tools" ] && return 0
|
||||
|
||||
rm -rf "${HOST_DIR}"
|
||||
mkdir -p "${HOST_DIR}"
|
||||
|
||||
pushd "${BUILD_DIR}"
|
||||
rm -rf "${BISON}"
|
||||
mkdir -p "${BISON}"
|
||||
cd "${BISON}"
|
||||
"${SRC_DIR}/${BISON}/configure" \
|
||||
--prefix="${HOST_DIR}"
|
||||
make
|
||||
make install
|
||||
popd
|
||||
|
||||
touch "${STAMP}/build-tools"
|
||||
}
|
||||
|
||||
function build_binutils {
|
||||
[ -f "${STAMP}/build-binutils" ] && return 0
|
||||
|
||||
pushd "${BUILD_DIR}"
|
||||
rm -rf "${BINUTILS}"
|
||||
mkdir -p "${BINUTILS}"
|
||||
cd "${BINUTILS}"
|
||||
"${SRC_DIR}/${BINUTILS}/configure" \
|
||||
--prefix="${TARGET_DIR}" \
|
||||
--target=m68k-amigaos
|
||||
make all
|
||||
make install
|
||||
popd
|
||||
|
||||
touch "${STAMP}/build-binutils"
|
||||
}
|
||||
|
||||
readonly FLAGS_FOR_TARGET=( \
|
||||
"MAKEINFO=makeinfo" \
|
||||
"CFLAGS_FOR_TARGET=-noixemul" \
|
||||
"AR_FOR_TARGET=${TARGET_DIR}/bin/m68k-amigaos-ar" \
|
||||
"AS_FOR_TARGET=${TARGET_DIR}/bin/m68k-amigaos-as" \
|
||||
"LD_FOR_TARGET=${TARGET_DIR}/bin/m68k-amigaos-ld" \
|
||||
"NM_FOR_TARGET=${TARGET_DIR}/bin/m68k-amigaos-nm" \
|
||||
"OBJCOPY_FOR_TARGET=${TARGET_DIR}/bin/m68k-amigaos-objcopy" \
|
||||
"OBJDUMP_FOR_TARGET=${TARGET_DIR}/bin/m68k-amigaos-objdump" \
|
||||
"RANLIB_FOR_TARGET=${TARGET_DIR}/bin/m68k-amigaos-ranlib")
|
||||
|
||||
function build_gcc {
|
||||
[ -f "${STAMP}/build-gcc" ] && return 0
|
||||
|
||||
pushd "${BUILD_DIR}"
|
||||
rm -rf "${GCC}"
|
||||
mkdir -p "${GCC}"
|
||||
cd "${GCC}"
|
||||
"${SRC_DIR}/${GCC}/configure" \
|
||||
--prefix="${TARGET_DIR}" \
|
||||
--target=m68k-amigaos \
|
||||
--enable-languages=c \
|
||||
--with-headers="${SRC_DIR}/${IXEMUL}/include"
|
||||
make all ${FLAGS_FOR_TARGET[*]}
|
||||
make install ${FLAGS_FOR_TARGET[*]}
|
||||
popd
|
||||
|
||||
touch "${STAMP}/build-gcc"
|
||||
}
|
||||
|
||||
function build_gpp {
|
||||
[ -f "${STAMP}/build-gpp" ] && return 0
|
||||
|
||||
pushd "${BUILD_DIR}"
|
||||
rm -rf "${GCC}"
|
||||
mkdir -p "${GCC}"
|
||||
cd "${GCC}"
|
||||
"${SRC_DIR}/${GCC}/configure" \
|
||||
--prefix="${TARGET_DIR}" \
|
||||
--target=m68k-amigaos \
|
||||
--enable-languages=c++ \
|
||||
--with-headers="${SRC_DIR}/${IXEMUL}/include"
|
||||
make all ${FLAGS_FOR_TARGET[*]}
|
||||
make install ${FLAGS_FOR_TARGET[*]}
|
||||
popd
|
||||
|
||||
touch "${STAMP}/build-gpp"
|
||||
}
|
||||
|
||||
function process_headers {
|
||||
[ -f "${STAMP}/process-headers" ] && return 0
|
||||
|
||||
pushd "${BUILD_DIR}"
|
||||
rm -rf "${SFDC}"
|
||||
cp -a "${SRC_DIR}/${SFDC}" "${SFDC}"
|
||||
cd "${SFDC}"
|
||||
./configure \
|
||||
--prefix="${TARGET_DIR}"
|
||||
make
|
||||
make install
|
||||
popd
|
||||
|
||||
pushd "${TARGET_DIR}/include"
|
||||
cp -av "${SRC_DIR}/${NDK}/Include/include_h/"* .
|
||||
mkdir -p clib proto inline
|
||||
patch -d devices -p0 < ${SRC_DIR}/${FD2INLINE}/patches/timer.h.diff
|
||||
cp -v "${SRC_DIR}/${FD2INLINE}/include-src/inline/alib.h" inline/
|
||||
cp -v "${SRC_DIR}/${FD2INLINE}/include-src/inline/macros.h" inline/
|
||||
cp -v "${SRC_DIR}/${FD2INLINE}/include-src/inline/stubs.h" inline/
|
||||
cp -v "${SRC_DIR}/${FD2INLINE}/include-src/proto/alib.h" proto/
|
||||
for file in ${SRC_DIR}/${NDK}/Include/sfd/*.sfd; do
|
||||
base=$(basename ${file%_lib.sfd})
|
||||
|
||||
sfdc --target=m68k-amigaos --mode=clib \
|
||||
--output="clib/${base}_protos.h" $file
|
||||
sfdc --target=m68k-amigaos --mode=proto \
|
||||
--output="proto/${base}.h" $file
|
||||
sfdc --target=m68k-amigaos --mode=macros \
|
||||
--output="inline/${base}.h" $file
|
||||
done
|
||||
popd
|
||||
|
||||
touch "${STAMP}/process-headers"
|
||||
}
|
||||
|
||||
function build_libnix {
|
||||
[ -f "${STAMP}/build-libnix" ] && return 0
|
||||
|
||||
pushd "${BUILD_DIR}"
|
||||
rm -rf "${LIBNIX}"
|
||||
mkdir -p "${LIBNIX}"
|
||||
cd "${LIBNIX}"
|
||||
"${SRC_DIR}/${LIBNIX}/configure" \
|
||||
--prefix="${TARGET_DIR}" \
|
||||
--target=m68k-amigaos
|
||||
make all \
|
||||
CC=m68k-amigaos-gcc \
|
||||
CPP="m68k-amigaos-gcc -E" \
|
||||
AR=m68k-amigaos-ar \
|
||||
AS=m68k-amigaos-as \
|
||||
RANLIB=m68k-amigaos-ranlib \
|
||||
LD=m68k-amigaos-ld \
|
||||
MAKEINFO=:
|
||||
[ -f "${TARGET_DIR}/guide" ] && rm -f "${TARGET_DIR}/guide"
|
||||
make install MAKEINFO=:
|
||||
popd
|
||||
|
||||
touch "${STAMP}/build-libnix"
|
||||
}
|
||||
|
||||
function build_ixemul {
|
||||
[ -f "${STAMP}/build-ixemul" ] && return 0
|
||||
|
||||
pushd "${BUILD_DIR}"
|
||||
rm -rf "${IXEMUL}"
|
||||
mkdir -p "${IXEMUL}"
|
||||
cd "${IXEMUL}"
|
||||
CC=m68k-amigaos-gcc \
|
||||
CFLAGS=-noixemul \
|
||||
AR=m68k-amigaos-ar \
|
||||
RANLIB=m68k-amigaos-ranlib \
|
||||
"${SRC_DIR}/${IXEMUL}/configure" \
|
||||
--prefix=${TARGET_DIR} \
|
||||
--target=m68k-amigaos
|
||||
make MAKEINFO=: all
|
||||
make MAKEINFO=: install
|
||||
popd
|
||||
|
||||
touch "${STAMP}/build-ixemul"
|
||||
}
|
||||
|
||||
function main {
|
||||
local -r action="${1:-build}"
|
||||
|
||||
case "${action}" in
|
||||
"build")
|
||||
prepare_target
|
||||
unpack_sources
|
||||
build_tools
|
||||
|
||||
export PATH="${HOST_DIR}/bin:${PATH}"
|
||||
|
||||
build_binutils
|
||||
build_gcc
|
||||
|
||||
export PATH="${TARGET_DIR}/bin:${PATH}"
|
||||
|
||||
process_headers
|
||||
build_libnix
|
||||
#build_ixemul
|
||||
build_gpp
|
||||
;;
|
||||
"clean")
|
||||
for dir in ${SRC_DIR} ${BUILD_DIR} ${HOST_DIR} ${TARGET_DIR} ${STAMP}; do
|
||||
echo rm -rf "${dir}"
|
||||
done
|
||||
;;
|
||||
*)
|
||||
echo "action '${action}' not supported!"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user