Skip to content

Instantly share code, notes, and snippets.

@paulwratt
Last active February 6, 2021 02:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulwratt/b401937124906803628cb3a34d3d36f1 to your computer and use it in GitHub Desktop.
Save paulwratt/b401937124906803628cb3a34d3d36f1 to your computer and use it in GitHub Desktop.
non-Ubuntu PPA use of Vincents 'cross-mint' m68k Atari ST GCC 4.6.4 toolchain (build from source)
#!/bin/sh
# install Vincint Riviera Ubuntu PPA repo v1.0.0-20210206
# build from source all packages in right order (DPKG)
# https://gist.github.com/paulwratt/b401937124906803628cb3a34d3d36f1
#
# ARM install only script (works with i386 & amd64 as well):
# https://gist.github.com/paulwratt/98de1ce795b5b355c300e73bdb13af37
#
# you can download the latest versions from command line using this:
# https://gist.github.com/paulwratt/c8199d1e2162a82d475d7777a67d6f13
#
LCL_ARCH=""
LCL_MINTLIB="mintlib-m68k-atari-mint_0.60.1.Git-20200504"
LCL_PML="pml-m68k-atari-mint_2.03-mint-20191013"
PPA_MINTLIB=""
PPA_PML=""
PPA_PKG=""
PPA_URL="http://ppa.launchpad.net/vriviere/ppa/ubuntu"
PPA_ARCH="$1"
PPA_DISTRO="$2"
PPA_BUILD="$3"
get_unpack(){
if [ "$1" = "groovy" ]; then
PPA_MINTLIB="$LCL_MINTLIB-1ppa20201024085137~groovy_all.deb"
PPA_PML="$LCL_PML-3ppa20201024091411~groovy_all.deb"
elif [ "$1" = "focal" ]; then
PPA_MINTLIB="$LCL_MINTLIB-1ppa20200504131343~focal_all.deb"
PPA_PML="$LCL_PML-3ppa20200505192610~focal_all.deb"
elif [ "$1" = "bionic" ]; then
PPA_MINTLIB="$LCL_MINTLIB-1ppa20200504131343~bionic_all.deb"
PPA_PML="$LCL_PML-3ppa20200505192610~bionic_all.deb"
elif [ "$1" = "xenial" ]; then
PPA_MINTLIB="$LCL_MINTLIB-1ppa20200504131343~xenial_all.deb"
PPA_PML="$LCL_PML-3ppa20200505192610~xenial_all.deb"
else
echo "Error: cant find Ubuntu distro in PPA: $1"
echo " mintlib-m68k-atari-mint & pml-m68k-atari-mint"
exit
fi
get_unpack0(){
if [ "$1" = "eoan" ]; then
PPA_MINTLIB="$LCL_MINTLIB-1ppa20200504131343~eoan_$PPA_ARCH.deb"
PPA_PML="$LCL_PML-10ppa20200501093455~eoan_$PPA_ARCH.deb"
elif [ "$1" = "focal" ]; then
PPA_MINTLIB="$LCL_MINTLIB-6ppa20200424190823~focal_$PPA_ARCH.deb"
PPA_PML="$LCL_PML-10ppa20200501093455~focal_$PPA_ARCH.deb"
elif [ "$1" = "disco" ]; then
PPA_MINTLIB="$LCL_MINTLIB-1ppa20200504131343~disco_$PPA_ARCH.deb"
PPA_PML="$LCL_PML-10ppa20200501093455~disco_$PPA_ARCH.deb"
elif [ "$1" = "bionic" ]; then
PPA_MINTLIB="$LCL_MINTLIB-1ppa20200504131343~bionic_$PPA_ARCH.deb"
PPA_PML="$LCL_PML-10ppa20200501093455~bionic_$PPA_ARCH.deb"
elif [ "$1" = "xenial" ]; then
PPA_MINTLIB="$LCL_MINTLIB-1ppa20200504131343~xenial_$PPA_ARCH.deb"
PPA_PML="$LCL_PML-10ppa20200501093455~xenial_$PPA_ARCH.deb"
elif [ "$1" = "trusty" ]; then
PPA_MINTLIB="$LCL_MINTLIB-1ppa20200504131343~xenial_$PPA_ARCH.deb"
PPA_PML="$LCL_PML-10ppa20200501093455~xenial_$PPA_ARCH.deb"
else
echo "Error: cant find Ubuntu distro in PPA: $1"
echo " mintlib-m68k-atari-mint & pml-m68k-atari-mint"
exit
fi
cd ../0-temp
wget "$PPA_URL/pool/main/m/mintlib-m68k-atari-mint/$PPA_MINTLIB"
wget "$PPA_URL/pool/main/p/pml-m68k-atari-mint/$PPA_PML"
cd ../cross-mint-ppa
}
install_fake(){
cd ../0-temp
mkdir -p $LCL_MINTLIB/debian/mintlib-m68k-atari-mint/DEBIAN
dpkg-deb --extract $PPA_MINTLIB ./$LCL_MINTLIB/debian/mintlib-m68k-atari-mint
dpkg-deb --control $PPA_MINTLIB ./$LCL_MINTLIB/debian/mintlib-m68k-atari-mint/DEBIAN
sed -i "s/$PPA_ARCH/$LCL_ARCH/g" ./$LCL_MINTLIB/debian/mintlib-m68k-atari-mint/DEBIAN/control
dpkg-deb --build ./$LCL_MINTLIB/debian/mintlib-m68k-atari-mint $LCL_MINTLIB
sudo dpkg -i ./$LCL_MINTLIB/*.deb
mkdir -p $LCL_PML/debian/pml-m68k-atari-mint/DEBIAN
dpkg-deb --extract $PPA_PML ./$LCL_PML/debian/pml-m68k-atari-mint
dpkg-deb --control $PPA_PML ./$LCL_PML/debian/pml-m68k-atari-mint/DEBIAN
sed -i "s/$PPA_ARCH/$LCL_ARCH/g" ./$LCL_PML/debian/pml-m68k-atari-mint/DEBIAN/control
dpkg-deb --build ./$LCL_PML/debian/pml-m68k-atari-mint $LCL_PML
sudo dpkg -i ./$LCL_PML/*.deb
cd ../cross-mint-ppa
}
install_real(){
cd ../0-temp
PPA_PKG=`curl -s "$PPA_URL/pool/main/m/mintlib-m68k-atari-mint/?C=M;O=D" | grep --max-count=1 "~$PPA_DISTRO_all.deb" | cut -d \" --fields=8`
wget "$PPA_URL/pool/main/m/mintlib-m68k-atari-mint/$PPA_PKG"
PPA_PKG=`curl -s "$PPA_URL/pool/main/p/pml-m68k-atari-mint/?C=M;O=D" | grep --max-count=1 "~$PPA_DISTRO_all.deb" | cut -d \" --fields=8`
wget "$PPA_URL/pool/main/p/pml-m68k-atari-mint/$PPA_PKG"
PPA_PKG=""
sudo dpkg -i *.deb
cd ../cross-mint-ppa
}
show_eg(){
echo " ./cross-mint-ppa-build.sh --apt-only bionic (PC i386 Buster)"
echo " ./cross-mint-ppa-build.sh --apt-only xenial (PC i386 Stretch)"
echo " ./cross-mint-ppa-build.sh amd64 bionic no (RPi aarch64 Buster)"
echo " ./cross-mint-ppa-build.sh i386 xenial (RPi armv7 Stretch)"
echo " ./cross-mint-ppa-build.sh i386 bionic install (RPi armv7 Buster)"
}
show_help(){
echo "build and install Vincent's 'cross-mint' from his Ubuntu PPA"
echo " includes multi-lib libraries for 68000, mc5475, 68020-060"
echo ""
echo "usage: ./cross-mint-ppa-build.sh [--info] | [--apt-only | [architecture]] [release] [no|install]"
echo ""
echo "[release] = * Ubuntu distro name"
echo " Ubuntu Debian"
echo " 20.10 groovy bullseye/ sid *"
echo " 20.04 focal bullseye/ sid - 11"
echo " 19.10 eoan buster / sid - 10 *"
echo " 19.04 disco buster / sid *"
echo " 18.10 cosmic buster / sid"
echo " 18.04 bionic buster / sid *"
echo " 17.10 artful stretch / sid - 9"
echo " 17.04 zesty stretch / sid"
echo " 16.10 yakkety stretch / sid"
echo " 16.04 xenial stretch / sid *"
echo " 15.10 wily jessie / sid - 8"
echo " 15.04 vivid jessie / sid"
echo " 14.10 utopic jessie / sid"
echo " 14.04 trusty jessie / sid *"
echo " 13.10 saucy wheezy / sid - 7"
echo " 13.04 raring wheezy / sid"
echo " 12.10 quantal wheezy / sid"
echo " 12.04 precise wheezy / sid"
echo " 11.10 oneiric wheezy / sid"
echo " 11.04 natty squeeze / sid - 6"
echo " 10.10 maverick squeeze / sid"
echo " 10.04 lucid squeeze / sid"
echo " * Ubuntu distro name in PPA repo"
echo ""
echo "[architecture] = Repo architecture (endian relative)"
echo " Repo Endian RPi"
echo " (no) - 32 bit big endian - armv6"
echo " i386 - 32 bit little endian - armv7"
echo " amd64 - 64 bit little endian - aarch64"
echo ""
echo "no dont build other libraries from source"
echo " just 'cross-mint-essential' dependancies"
echo ""
echo "install all libraries in the PPA repo, not from source"
echo ""
echo "--apt-only [release] install keyring and '.list' files"
echo " into '/etc/apt'"
echo "--info display info required to do it by hand"
echo " packages are build and remain in '~/build/cross-mint-ppa'"
echo " resulting packages will install to '/usr/m68k-atari-mint'"
echo ""
echo "An \"install only\" script for armhf, aarch64, i386 & x86:"
echo " https://gist.github.com/paulwratt/98de1ce795b5b355c300e73bdb13af37"
echo ""
echo "examples:"
show_eg
}
show_info(){
echo "build and install Vincent's 'cross-mint' from his Ubuntu PPA"
echo " includes multi-lib libraries for 68000, mc5475, 68020-060"
echo ""
echo "this script was tested on Raspbian 10 Buster on 4Gb RPi 4,"
echo "Raspbian 9 Stretch RPi 3B+ and BeePi 1.0 (Stretch) on RPi 2B+."
echo ""
echo "on PC Raspbian you only need to write the PPA repo url and"
echo "install the keyring for it (use option '--apt-only'). It is"
echo "is already an i386 distribution, so the PPA binary packages"
echo "will work without building from source. The same should be"
echo "true for any Debian based i386 or x64 (amd64) distribution."
echo " sudo apt-get install *-m68k-atari-mint"
echo ""
echo "the PPA source entries for Buster are:"
echo " deb http://ppa.launchpad.net/vriviere/ppa/ubuntu bionic main"
echo " deb-src http://ppa.launchpad.net/vriviere/ppa/ubuntu bionic main"
echo ""
echo "the PPA key added to trusted sources with:"
echo " sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4AAD3A5DB5690522"
echo ""
echo "This script stores them in:"
echo " /etc/apt/sources.list.d/vincent-m68k-cross.list"
echo " /etc/apt/trusted.gpg.d/vincent-m68k-cross.gpg"
echo " packages are build and remain in '~/build/cross-mint-ppa'"
echo " resulting packages will install to '/usr/m68k-atari-mint'"
echo ""
echo "on i386 and x64 (amd64) RPM distros it should be possible to"
echo "download the package directly, then use 'alien' to convert them."
echo "On the above PPA url, add the packages name (April 2020):"
echo " /pool/main/[1st letter]/[package name]/"
echo " (meta package) (other libraries)"
echo " cross-mint-essential cflib-m68k-atari-mint"
echo " binutils-m68k-atari-mint gemma-m68k-atari-mint"
echo " mintbin-m68k-atari-mint ldg-m68k-atari-mint"
echo " gcc-m68k-atari-mint ncurses-m68k-atari-mint"
echo " mintlib-m68k-atari-mint openssl-m68k-atari-mint"
echo " pml-m68k-atari-mint sdl-m68k-atari-mint"
echo " gemlib-m68k-atari-mint zlib-m68k-atari-mint"
echo " "
echo "eg. in a web browser:"
echo "http://ppa.launchpad.net/vriviere/ppa/ubuntu/pool/main/g/gcc-m68k-atari-mint/"
echo ""
echo "use the [release] table to work out which version to download,"
echo "there is also the '*.tar.gz' source packages as well."
echo ""
echo "read the source of this file to see how to build from sources,"
echo "in particular how to deal with building 'gcc' which has circular"
echo "build dependancies with 'pml' and 'mintlib'."
echo ""
echo "There is another script that does not contain build instructions"
echo "but also adds the (new) ARM repo. Its also works for i386 & x86:"
echo " https://gist.github.com/paulwratt/98de1ce795b5b355c300e73bdb13af37"
echo ""
echo "many thanks to Vincent Riviere for the years of work required"
echo "to maintain these packages. I have previously build from source"
echo "on Raspbian 7 Wheezy using his '*-cygwin-howto.txt's as a base:"
echo " http://vincent.riviere.free.fr/soft/m68k-atari-mint/"
echo ""
}
show_m68k(){
dpkg -l | grep m68k-atari-mint
}
if [ "$1" = "" -o "$1" = "--help" ]; then
show_help
exit
fi
if [ "$1" = "info" -o "$1" = "--info" ]; then
show_info
exit
fi
HAS_VAL="no"
for i in "apt-only" "--apt-only" "i386" "amd64" "all"; do
if [ "$i" = "$PPA_ARCH" ]; then
HAS_VAL="yes"
break
fi
done
if [ "$HAS_VAL" = "no" ]; then
echo "Error: wrong architecture"
show_eg
exit
fi
HAS_VAL="no"
for i in "groovy" "focal" "eoan" "disco" "bionic" "xenial" "trusty"; do
if [ "$i" = "$PPA_DISTRO" ]; then
HAS_VAL="yes"
break
fi
done
#hack
if [ "$PPA_DISTRO" = "eoan" -o "$PPA_DISTRO" = "disco" ]; then
$PPA_DISTRO="bionic"
fi
#hack
if [ "$PPA_DISTRO" = "trusty" ]; then
$PPA_DISTRO="xenial"
fi
if [ "$HAS_VAL" = "no" ]; then
echo "Error: wrong Ubuntu distro name, choose:"
echo " groovy focal eaon disco bionic xenial"
exit
fi
#if [ "$PPA_ARCH" = "i386" -a "$PPA_DISTRO" = "focal" ]; then
# echo "Error: $PPA_ARCH $PPA_DISTRO not available in PPA"
# exit
#fi
if [ "$(which dirmngr)" = "" ]; then
echo "apt-get: adding 'dirmngr', please wait"
sudo apt-get --quiet install dirmngr
fi
sudo rm -f /etc/apt/sources.list.d/vincent-m68k-cross.list
sudo rm -f /etc/apt/trusted.gpg.d/vincent-m68k-cross.gpg
sudo touch /etc/apt/sources.list.d/vincent-m68k-cross.list
sudo echo "# Vincents cross-mint Ubuntu PPA" | sudo tee -a /etc/apt/sources.list.d/vincent-m68k-cross.list > /dev/null
sudo echo "deb $PPA_URL $PPA_DISTRO main" | sudo tee -a /etc/apt/sources.list.d/vincent-m68k-cross.list > /dev/null
sudo echo "deb-src $PPA_URL $PPA_DISTRO main" | sudo tee -a /etc/apt/sources.list.d/vincent-m68k-cross.list > /dev/null
echo "cross-mint PPA: source written to file:"
echo " /etc/apt/sources.list.d/vincent-m68k-cross.list"
sudo touch /etc/apt/trusted.gpg.d/vincent-m68k-cross.gpg
sudo apt-key --keyring /etc/apt/trusted.gpg.d/vincent-m68k-cross.gpg adv --keyserver keyserver.ubuntu.com --recv-keys 4AAD3A5DB5690522
echo "cross-mint PPA: key added to trusted sources:"
echo " /etc/apt/trusted.gpg.d/vincent-m68k-cross.gpg"
echo "cross-mint PPA: updating package list, please wait"
sudo apt-get --quiet update
echo "cross-mint PPA: package list updated"
if [ "$PPA_ARCH" = "apt-only" -o "$PPA_ARCH" = "--apt-only" ]; then
echo "On i386 or x64 (amd64) you can now install 'cross-mint':"
echo " sudo apt-get install cross-mint-essential"
echo "You can now build from source:"
echo " apt source -t $PPA_DISTRO --build binutils-m68k-atari-mint"
exit
fi
sudo apt-get install texinfo wget curl build-essential fakeroot devscripts gawk gperf libmpfr-dev sharutils dejagnu autogen chrpath quilt libmpc-dev
if [ ! -d /usr/share/doc/devscripts/examples -o ! -f /usr/bin/wget ]; then
echo "Error: failed to install build packages:"
echo " wget curl build-essential fakeroot devscripts"
exit
fi
cd ~
mkdir -p build/0-temp
rm -rf build/0-temp/*
mkdir -p build/cross-mint-ppa
cd build/cross-mint-ppa
#get_unpack "$PPA_DISTRO"
apt source -t $PPA_DISTRO --build binutils-m68k-atari-mint
sudo dpkg -i $(ls -1 binutils-m68k-atari-mint_* | grep ".deb")
apt source -t $PPA_DISTRO --build mintbin-m68k-atari-mint
sudo dpkg -i $(ls -1 mintbin-m68k-atari-mint_* | grep ".deb")
# easiest way to get correct package architecture
# (not the same as platfom architecture - 'uname -m' or 'uname -p' )
LCL_ARCH=`dpkg --info $(ls -1 binutils-m68k-atari-mint_* | grep ".deb") | awk '/Architecture/ {printf "%s\n", $2}'`
# to satisfy 'apt' and 'dpkg' we need packages
# (they also provide headers and meta-packages)
#install_fake
install_real
# sudo apt-get --quiet install gawk gperf libmpfr-dev sharutils dejagnu autogen chrpath quilt libmpc-dev
# gcc stage 1 - building gcc depends on the next 2 packages
# (for automation we installed the packages above)
apt source -t $PPA_DISTRO --build gcc-m68k-atari-mint
sudo dpkg -i $(ls -1 gcc-m68k-atari-mint_* | grep ".deb")
# dont build libraries from source
if [ "$PPA_BUILD" = "install" ]; then
sudo apt-get install *-m68k-atari-mint
show_m68k
echo ""
echo "packages for 'cross-mint-essential' were built from"
echo "source and installed. Other library packages were"
echo "installed from the PPA, not build from source."
exit
elif [ "$PPA_BUILD" = "no" ]; then
show_m68k
echo ""
echo "packages for 'cross-mint-essential' were built from"
echo "source and installed. Other library packages were"
echo "not build or installed."
exit
fi
# otherwise build all libraries from source
# (its a good "GCC from source" compiler test)
# also provides 'libc-m68k-atari-mint'
apt source -t $PPA_DISTRO --build mintlib-m68k-atari-mint
sudo dpkg -i $(ls -1 mintlib-m68k-atari-mint_* | grep ".deb")
# also provides 'libm-m68k-atari-mint'
apt source -t $PPA_DISTRO --build pml-m68k-atari-mint
sudo dpkg -i $(ls -1 pml-m68k-atari-mint_* | grep ".deb")
# !!! not needed, the original build GCC version is the same as this new one !!!
# gcc stage 2 - building gcc depends on the previous 2 packages
# (built with the real packages above)
apt source -t $PPA_DISTRO --build gcc-m68k-atari-mint
sudo dpkg -i $(ls -1 gcc-m68k-atari-mint_* | grep ".deb")
# GEM library - Graphical Environment Manager
# (last package provided with 'cross-mint-essential')
apt source -t $PPA_DISTRO --build gemlib-m68k-atari-mint
sudo dpkg -i $(ls -1 gemlib-m68k-atari-mint_* | grep ".deb")
# now we can build the 'cross-mint-essential' meta package
# (dont install it incase there is a bug in any previous packages)
apt source -t $PPA_DISTRO --build cross-mint-essential
# sudo dpkg -i $(ls -1 cross-mint-essential_* | grep ".deb")
# ColdFire Library - allow 68000 code on mc5475/85
apt source -t $PPA_DISTRO --build cflib-m68k-atari-mint
sudo dpkg -i $(ls -1 cflib-m68k-atari-mint_* | grep ".deb")
# compression/decompression library
apt source -t $PPA_DISTRO --build zlib-m68k-atari-mint
sudo dpkg -i $(ls -1 zlib-m68k-atari-mint_* | grep ".deb")
# console text ouput library
apt source -t $PPA_DISTRO --build ncurses-m68k-atari-mint
sudo dpkg -i $(ls -1 ncurses-m68k-atari-mint_* | grep ".deb")
# console input library
apt source -t $PPA_DISTRO --build readline-m68k-atari-mint
sudo dpkg -i $(ls -1 readline-m68k-atari-mint_* | grep ".deb")
# Secure Sockets Layer library (incl. https://)
apt source -t $PPA_DISTRO --build openssl-m68k-atari-mint
dpkg -i $(ls -1 openssl-m68k-atari-mint_* | grep ".deb")
# GEM Dynamic Libraries
apt source -t $PPA_DISTRO --build ldg-m68k-atari-mint
sudo dpkg -i $(ls -1 ldg-m68k-atari-mint_* | grep ".deb")
# SDL1.2 Simple Direct Library
apt source -t $PPA_DISTRO --build sdl-m68k-atari-mint
sudo dpkg -i $(ls -1 sdl-m68k-atari-mint_* | grep ".deb")
# GEMma extends GEMlib
apt source -t $PPA_DISTRO --build gemma-m68k-atari-mint
sudo dpkg -i $(ls -1 gemma-m68k-atari-mint_* | grep ".deb")
show_m68k
echo ""
echo "packages for 'cross-mint-essential' were built from"
echo "source and installed. Other library packages were"
echo "installed after being built from source."
exit
# ARM install only script (works with i386 & amd64 as well):
# https://gist.github.com/paulwratt/98de1ce795b5b355c300e73bdb13af37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment