Added support for sdcc 4.0.7 used by https://dmitry.gr projects.

Make path's absolute, renamed scripts, added .gitignore
This commit is contained in:
Skip Hansen
2023-11-04 08:20:51 -07:00
parent a24bccd1af
commit c446452b69
6 changed files with 48 additions and 40 deletions

3
sdcc/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
sdcc-*/
sdcc/

View File

@@ -1,9 +1,9 @@
This subdirectory contains scripts to build the correct version of SDCC 4.2.0 for compiling 8051 based firmware.
This subdirectory contains scripts to build the correct version of SDCC (4.2.0) for compiling 8051 based firmware.
To use simply source setup.sh before building. The first time setup.sh is run proper version of SDCC sources will be checkout from github and built locally.
To use simply source setup_sdcc.sh before building. The first time setup_sdcc.sh is run proper version of SDCC sources will be checkout from github and built locally.
Finally the environment variable CC will be set to 'sdcc' and the path to the local version of sdcc will be added to the beginning of the path.
The script unset.sh can be source to unset the CC environment variable and to restore the path.
The script unset_sdecc.sh can be source to unset the CC environment variable and to restore the path.
For example
@@ -21,14 +21,14 @@ Note: switching to '4.2.0'.
remote: Counting objects: 6% (1371/22838)
remote: Counting objects: 7% (1599/22838)
remote: Counting objects: 8% (1828/22838)
remote: Counting objects: 9% (2056/22838)
remote: Counting objects: 9% (2056/22838)
remote: Counting objects: 10% (2284/22838)
remote: Counting objects: 11% (2513/22838)
remote: Counting objects: 12% (2741/22838)
remote: Counting objects: 13% (2969/22838)
remote: Counting objects: 14% (3198/22838)
remote: Counting objects: 15% (3426/22838)
remote: Counting objects: 16% (3655/22838)
remote: Counting objects: 16% (3655/22838)
remote: Counting objects: 17% (3883/22838)
remote: Counting objects: 18% (4111/22838)
remote: Counting objects: 19% (4340/22838)

View File

@@ -1,7 +1,7 @@
#/bin/sh
# build local version of sdcc 4.2.0 from source
# build local version of sdcc from source
SDCC_VER=4.2.0
SDCC_VER=${1:-4.2.0}
if [ ! -e sdcc ]; then
git clone https://github.com/swegener/sdcc.git
@@ -9,16 +9,20 @@ if [ ! -e sdcc ]; then
echo "Couldn't clone https://github.com/swegener/sdcc.git"
exit 1
fi
cd sdcc
git tag 4.2.0 56dc646f8ba6d37c039c5e0c3e60b1340da65b9f
git tag 4.0.7 6f1f08a07fc7a05b06e7a2594a930d8984ba817a
else
cd sdcc
fi
cd sdcc
git tag 4.2.0 56dc646f8ba6d37c039c5e0c3e60b1340da65b9f
git checkout ${SDCC_VER}
if [ $? -ne 0 ]; then
echo "Couldn't checkout ${SDCC_VER} source from git"
exit 1
fi
./configure --prefix=`pwd`/${SDCC_VER} --disable-z80-port --disable-z180-port --disable-r2k-port --disable-r2ka-port --disable-r3ka-port --disable-sm83-port --disable-tlcs90-port --disable-ez80_z80-port --disable-z80n-port --disable-ds390-port --disable-ds400-port --disable-pic14-port --disable-pic16-port --disable-hc08-port --disable-s08-port --disable-stm8-port --disable-pdk13-port --disable-pdk14-port --disable-pdk15-port --disable-pdk16-port --disable-mos6502-port --disable-mos65c02-port 2>&1 | tee build.log
./configure --prefix=`pwd`/../sdcc-${SDCC_VER} --disable-z80-port --disable-z180-port --disable-r2k-port --disable-r2ka-port --disable-r3ka-port --disable-sm83-port --disable-tlcs90-port --disable-ez80_z80-port --disable-z80n-port --disable-ds390-port --disable-ds400-port --disable-pic14-port --disable-pic16-port --disable-hc08-port --disable-s08-port --disable-stm8-port --disable-pdk13-port --disable-pdk14-port --disable-pdk15-port --disable-pdk16-port --disable-mos6502-port --disable-mos65c02-port 2>&1 | tee build.log
make -j8 2>&1 | tee -a build.log
if [ $? -ne 0 ]; then
echo "sdcc make failed see ./sdcc/build.log for details"
@@ -30,5 +34,8 @@ if [ $? -ne 0 ]; then
echo "sdcc make install failed see ./sdcc/build.log for details"
exit 1
fi
make clean
git reset HEAD --hard
git clean -f -d -x

View File

@@ -1,26 +0,0 @@
#/bin/sh
# set environment variables to use locally built sdcc version 4.2.0
#set -x
SDCC_VER=4.2.0
if [ "${BASH_SOURCE[0]}" -ef "$0" ]; then
echo "This script must be SOURCED, not run directly (source $0)."
exit 1
fi
SDCC_DIR=`dirname ${BASH_SOURCE[0]}`
if [ ! -e ${SDCC_DIR}/sdcc/${SDCC_VER} ]; then
(cd ${SDCC_DIR};./build_sdcc.sh)
fi
export CC=sdcc
SDCC_PATH=${SDCC_DIR}/sdcc/${SDCC_VER}/bin
echo $PATH | grep ${SDCC_PATH} > /dev/null
if [ $? -ne 0 ]; then
export SDCC_PATH_SAVE=$PATH
export PATH=${SDCC_PATH}:$PATH
echo "Added ${SDCC_PATH} to PATH"
fi

28
sdcc/setup_sdcc.sh Executable file
View File

@@ -0,0 +1,28 @@
#/bin/sh
# set environment variables to use locally built sdcc
#set -x
SDCC_VER=${1:-4.2.0}
if [ "${BASH_SOURCE[0]}" -ef "$0" ]; then
echo "This script must be SOURCED, not run directly (source $0)."
exit 1
fi
SETUP_PATH=`readlink -f ${BASH_SOURCE[0]}`
SETUP_DIR=`dirname ${SETUP_PATH}`
SDCC_VER_DIR=${SETUP_DIR}/sdcc-${SDCC_VER}
source ${SETUP_DIR}/unset_sdcc.sh
if [ ! -e ${SDCC_VER_DIR} ]; then
(cd ${SETUP_DIR};./build_sdcc.sh ${SDCC_VER})
fi
SDCC_PATH=${SDCC_VER_DIR}/bin
echo $PATH | grep ${SDCC_PATH} > /dev/null
if [ $? -ne 0 ]; then
export CC=sdcc
export SDCC_PATH_SAVE=$PATH
export PATH=${SDCC_PATH}:$PATH
echo "Added ${SDCC_PATH} to PATH"
fi

View File

@@ -2,15 +2,11 @@
# set environment variables to use locally built sdcc version 4.2.0
#set -x
SDCC_VER=4.2.0
if [ "${BASH_SOURCE[0]}" -ef "$0" ]; then
echo "This script must be SOURCED, not run directly (source $0)."
exit 1
fi
SDCC_DIR=`dirname ${BASH_SOURCE[0]}`
SDCC_PATH=${SDCC_DIR}/sdcc/${SDCC_VER}/bin
echo $PATH | grep ${SDCC_PATH} > /dev/null
if [ ! "${SDCC_PATH_SAVE}x" = "x" ]; then
export PATH=${SDCC_PATH_SAVE}
export SDCC_PATH_SAVE=