Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
haarer committed May 1, 2024
1 parent 4278da1 commit 5456be7
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 76 deletions.
138 changes: 71 additions & 67 deletions buildtoolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ function conf_compile_source () {
}


#function to install package
#function to install a single package
function install_package () {
make install 2>&1 | tee -a $ROOTDIR/$SOURCEPACKAGE-$TARGETARCHITECTURE-install.log
if [ $? -eq 0 ]; then
Expand All @@ -205,6 +205,7 @@ function install_package () {
fi
}

#remove all intermediate products of a single package
function purge_pkg () {
local PACKAGE=$1
[ -d $ROOTDIR/cross-toolchain/$PACKAGE ] && rm -rf $ROOTDIR/cross-toolchain/$PACKAGE
Expand Down Expand Up @@ -253,13 +254,76 @@ function download_all_pkg () {

prepare_source https://www.multiprecision.org/downloads $MPCVER tar.gz

# prepare_source https://gcc.gnu.org/pub/gcc/infrastructure $ISLVER tar.bz2
prepare_source https://libisl.sourceforge.io $ISLVER tar.bz2

}


#---------------------------------------------------------------------------------
#build pio package
function make_pio_package () {

#works only in bash
PACKAGEVER=${GCCVER/#gcc-}

if [[ $OS = windows* ]]; then
EXECUTEABLESUFFIX=".exe"
echo "on windows, copy msys2 dlls"
for DLLFILE in msys-gcc_s-seh-1.dll msys-2.0.dll
do
cp /usr/bin/$DLLFILE $HOSTINSTALLPATH/bin
done

cat >$HOSTINSTALLPATH/package.json <<EOFWINDOWSVARIANT
{
"description": "$GCCVER $BINUTILS $LIBCVER $GDBVER",
"name": "toolchain-$TARGETARCHITECTURE-current",
"system": [
"windows",
"windows_amd64",
"windows_x86"
],
"url": "https://github.com/haarer/toolchain68k",
"version": "$PACKAGEVER"
}
EOFWINDOWSVARIANT

elif [[ $OS = raspian* ]]; then echo "on raspian"
cat >$HOSTINSTALLPATH/package.json <<EOFRASPIVARIANT
{
"description": "$GCCVER $BINUTILS $LIBCVER $GDBVER",
"name": "toolchain-$TARGETARCHITECTURE-current",
"system": [
"linux_armv6l",
"linux_armv7l",
"linux_armv8l"
],
"url": "https://github.com/haarer/toolchain68k",
"version": "$PACKAGEVER"
}
EOFRASPIVARIANT

else
echo "on linux"
cat >$HOSTINSTALLPATH/package.json <<EOFLINUXVARIANT
{
"description": "$GCCVER $BINUTILS $LIBCVER $GDBVER",
"name": "toolchain-$TARGETARCHITECTURE-current",
"system": [
"linux_x86_64"
],
"url": "https://github.com/haarer/toolchain68k",
"version": "$PACKAGEVER"
}
EOFLINUXVARIANT

fi

log_msg "packaging.."
cd $HOSTINSTALLPATH ;tar czf ../toolchain-$TARGETARCHITECTURE-$OS-$GCCVER.tar.gz * ; cd ..
sha1sum toolchain-$TARGETARCHITECTURE-$OS-$GCCVER.tar.gz

}

if [ "$ACTION" = "purge" ]; then
rm -rf $HOSTINSTALLPATH
Expand All @@ -276,13 +340,15 @@ if [ "$ACTION" = "purge" ]; then
exit 0
fi


if [ "$ACTION" = "download" ]; then
download_all_pkg
exit 0
fi


if [ "$ACTION" = "package" ]; then
make_pio_package
exit 0
fi

export CFLAGS='-O2 -pipe'
export CXXFLAGS='-O2 -pipe'
Expand Down Expand Up @@ -583,69 +649,7 @@ GDBFLAGS+=" --target=$TARGETARCHITECTURE \

conf_compile_source $GDBVER "$HOSTINSTALLPATH/bin/$TARGETARCHITECTURE-gdb$EXECUTEABLESUFFIX" "$GDBFLAGS"

make_pio_package

#---------------------------------------------------------------------------------
#build pio package

#works only in bash
PACKAGEVER=${GCCVER/#gcc-}

if [[ $OS = windows* ]]; then
EXECUTEABLESUFFIX=".exe"
echo "on windows, copy msys2 dlls"
for DLLFILE in msys-gcc_s-seh-1.dll msys-2.0.dll
#for DLLFILE in libgmp-10.dll libiconv-2.dll libintl-8.dll libwinpthread-1.dll libexpat-1.dll libzstd.dll
do
cp /mingw64/bin/$DLLFILE $HOSTINSTALLPATH/bin
done

cat >$HOSTINSTALLPATH/package.json <<EOFWINDOWSVARIANT
{
"description": "$GCCVER $BINUTILS $LIBCVER $GDBVER",
"name": "toolchain-$TARGETARCHITECTURE-current",
"system": [
"windows",
"windows_amd64",
"windows_x86"
],
"url": "https://github.com/haarer/toolchain68k",
"version": "$PACKAGEVER"
}
EOFWINDOWSVARIANT

elif [[ $OS = raspian* ]]; then echo "on raspian"
cat >$HOSTINSTALLPATH/package.json <<EOFRASPIVARIANT
{
"description": "$GCCVER $BINUTILS $LIBCVER $GDBVER",
"name": "toolchain-$TARGETARCHITECTURE-current",
"system": [
"linux_armv6l",
"linux_armv7l",
"linux_armv8l"
],
"url": "https://github.com/haarer/toolchain68k",
"version": "$PACKAGEVER"
}
EOFRASPIVARIANT

else
echo "on linux"
cat >$HOSTINSTALLPATH/package.json <<EOFLINUXVARIANT
{
"description": "$GCCVER $BINUTILS $LIBCVER $GDBVER",
"name": "toolchain-$TARGETARCHITECTURE-current",
"system": [
"linux_x86_64"
],
"url": "https://github.com/haarer/toolchain68k",
"version": "$PACKAGEVER"
}
EOFLINUXVARIANT

fi

log_msg "packaging.."
cd $HOSTINSTALLPATH ;tar czf ../toolchain-$TARGETARCHITECTURE-$OS-$GCCVER.tar.gz * ; cd ..
sha1sum toolchain-$TARGETARCHITECTURE-$OS-$GCCVER.tar.gz


19 changes: 10 additions & 9 deletions install_req_pkg_windows-latest.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
#!/bin/sh

# install MSYS2 package requirements

pacman -S --needed git msys2-runtime unzip make tar flex bison diffutils texinfo patch mingw-w64-x86_64-gcc mingw-w64-x86_64-libmangle-git mingw-w64-x86_64-make mingw-w64-x86_64-pkg-config mingw-w64-x86_64-tools-git mingw-w64-x86_64-winstorecompat-git
# please use the MSYS2 shell, not the UCRT shell.
#
# install MSYS2 package requirement for building the tool chain
pacman -S --needed --noconfirm git msys2-runtime unzip make tar flex bison diffutils texinfo patch mingw-w64-x86_64-gcc mingw-w64-x86_64-libmangle-git mingw-w64-x86_64-make mingw-w64-x86_64-pkg-config mingw-w64-x86_64-tools-git mingw-w64-x86_64-winstorecompat-git

## all after this is only needed if avrdude shall use usb devices

# pull additonal libraries
pacman -S --needed mingw-w64-x86_64-libusb mingw-w64-x86_64-libusb-compat-git mingw-w64-x86_64-libftdi cmake
# pull additonal libraries (avrdude)
#pacman -S --needed mingw-w64-x86_64-libusb mingw-w64-x86_64-libusb-compat-git mingw-w64-x86_64-libftdi cmake

# nomally the avrdude should be updated to use the new libusb-1.0 but ...
#
# quick and dirty hack: patch up msys - there is an usb.h in the include path that shadows the usb.h
# from the libusb compatibility package - we move it out of the way and symlink the needed file..
if grep -q _WDMDDK_ /mingw64/x86_64-w64-mingw32/include/usb.h ; then
mv /mingw64/x86_64-w64-mingw32/include/usb.h /mingw64/x86_64-w64-mingw32/include/usb_go_away.h
fi
ln -s /mingw64/include/libusb-compat/usb.h /mingw64/x86_64-w64-mingw32/include/
#if grep -q _WDMDDK_ /mingw64/x86_64-w64-mingw32/include/usb.h ; then
# mv /mingw64/x86_64-w64-mingw32/include/usb.h /mingw64/x86_64-w64-mingw32/include/usb_go_away.h
#fi
#ln -s /mingw64/include/libusb-compat/usb.h /mingw64/x86_64-w64-mingw32/include/

0 comments on commit 5456be7

Please sign in to comment.