diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f6cd9f3 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "C_Cpp.default.includePath": [ + "include" + ] +} \ No newline at end of file diff --git a/README.md b/README.md index a77a10b..072c600 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,17 @@ Herein lies the source for *dslibris*, an EPUB reader for the Nintendo DS. Ubuntu 16.04 LTS is known to work as a build platform. Other platforms might, as long as the correct toolchain can be obtained. -* devkitARM r43 +* devkitARM r45 * libnds-1.5.8 * libfat-1.0.12 * a media card and a DLDI patcher, but you knew that. -devkitARM r43 is not easily found. If you need to build it, -clone the r43 branch of devkitPro/buildscripts from GitHub and patch it with the files in tool/buildscripts. Use the installer tarballs there if the source locations have disappeared. +devkitARM r45 is not easily found. If you need to build it, +clone the r45 branch of devkitPro/buildscripts from GitHub +and patch it with the files in tool/buildscripts. +You'll need to obtain the required tarball archives from each +project's release webpage; check out the version numbers in +the main build script. After installing devkitPro/devkitARM, see diff --git a/etc/profile b/etc/profile index e55bbd9..f5723b5 100644 --- a/etc/profile +++ b/etc/profile @@ -1,5 +1,7 @@ # Example environment setup for building devtools and dslibris. -export DEVKITPRO=/usr/local/devkitpro/r35 +export DEVKITPRO=$HOME/Library/devkitpro/r45 export DEVKITARM=$DEVKITPRO/devkitARM +# Needed to point library build processes (in 'tool') +# to the right gcc architecture... export PATH=$DEVKITARM/bin:$PATH diff --git a/tool/buildscripts/README.md b/tool/buildscripts/README.md index 55f0890..36e3b7d 100644 --- a/tool/buildscripts/README.md +++ b/tool/buildscripts/README.md @@ -1,2 +1,3 @@ -Replace corresponding files in your buildscripts repo with these. +Replace corresponding files in your devkitPro +buildscripts repo with these. diff --git a/tool/buildscripts/binutils-2.24.tar.bz2 b/tool/buildscripts/binutils-2.24.tar.bz2 deleted file mode 100644 index 669ac9f..0000000 Binary files a/tool/buildscripts/binutils-2.24.tar.bz2 and /dev/null differ diff --git a/tool/buildscripts/build-crtls.sh b/tool/buildscripts/build-crtls.sh index 0c80aaa..4d8e9b8 100644 --- a/tool/buildscripts/build-crtls.sh +++ b/tool/buildscripts/build-crtls.sh @@ -21,7 +21,7 @@ $MAKE CRT=gp32_gpsdk $MAKE CRT=ds_arm7 $MAKE CRT=ds_arm9 $MAKE CRT=ds_cart -$MAKE CRT=3dsx +$target-gcc -march=armv6k -mfloat-abi=hard -c 3dsx_crt0.s -o armv6k/fpu/3dsx_crt0.o # cd $BUILDDIR/libgba-$LIBGBA_VER # $MAKE || { echo "error building libgba"; exit 1; } @@ -31,9 +31,9 @@ cd $BUILDDIR/libnds-$LIBNDS_VER $MAKE || { echo "error building libnds"; exit 1; } $MAKE install || { echo "error installing libnds"; exit 1; } -#cd $BUILDDIR/dswifi-$DSWIFI_VER -#$MAKE || { echo "error building dswifi"; exit 1; } -#$MAKE install || { echo "error installing dswifi"; exit 1; } +# cd $BUILDDIR/dswifi-$DSWIFI_VER +# $MAKE || { echo "error building dswifi"; exit 1; } +# $MAKE install || { echo "error installing dswifi"; exit 1; } # cd $BUILDDIR/maxmod-$MAXMOD_VER # $MAKE || { echo "error building maxmod"; exit 1; } @@ -45,7 +45,7 @@ $MAKE install || { echo "error installing libnds"; exit 1; } cd $BUILDDIR/libfat-$LIBFAT_VER $MAKE nds-install || { echo "error building nds libfat"; exit 1; } -$MAKE gba-install || { echo "error installing gba libfat"; exit 1; } +#$MAKE gba-install || { echo "error installing gba libfat"; exit 1; } # cd $BUILDDIR/libmirko-$LIBMIRKO_VER # $MAKE || { echo "error building libmirko"; exit 1; } @@ -55,7 +55,7 @@ $MAKE gba-install || { echo "error installing gba libfat"; exit 1; } # $MAKE || { echo "error building libfilesystem"; exit 1; } # $MAKE install || { echo "error installing libfilesystem"; exit 1; } -#cd $BUILDDIR/libctru-$LIBCTRU_VER -#$MAKE || { echo "error building libctru"; exit 1; } -#$MAKE install || { echo "error installing libctru"; exit 1; } +# cd $BUILDDIR/libctru-$LIBCTRU_VER +# $MAKE || { echo "error building libctru"; exit 1; } +# $MAKE install || { echo "error installing libctru"; exit 1; } diff --git a/tool/buildscripts/build-devkit.sh b/tool/buildscripts/build-devkit.sh index f29acd8..3a6d0b7 100755 --- a/tool/buildscripts/build-devkit.sh +++ b/tool/buildscripts/build-devkit.sh @@ -1,7 +1,7 @@ #!/bin/bash #--------------------------------------------------------------------------------- # Build scripts for -# devkitARM release 43 +# devkitARM release 45 # devkitPPC release 27 # devkitPSP release 17 #--------------------------------------------------------------------------------- @@ -25,30 +25,31 @@ echo "https://sourceforge.net/tracker/?group_id=114505&atid=668553" echo LIBOGC_VER=1.8.12 -LIBGBA_VER=0.5.0 -LIBNDS_VER=1.5.8 -LIBCTRU_VER=0.1.0 -DEFAULT_ARM7_VER=0.5.25 -DSWIFI_VER=0.3.16 +LIBGBA_VER=20150106 +LIBNDS_VER=1.5.12 +LIBCTRU_VER=0.6.0 +DEFAULT_ARM7_VER=0.6.0 +DSWIFI_VER=0.3.17 LIBMIRKO_VER=0.9.7 -MAXMOD_VER=1.0.10 -FILESYSTEM_VER=0.9.11 -LIBFAT_VER=1.0.12 +MAXMOD_VER=1.0.9 +FILESYSTEM_VER=0.9.12 +LIBFAT_VER=1.0.14 PSPSDK_VER=20120404 GBATOOLS_VER=1.0.0 -DSTOOLS_VER=1.0.1 -GRIT_VER=0.8.14 -NDSTOOL_VER=2.0.1 +DSTOOLS_VER=1.0.2 +GP32_TOOLS_VER=1.0.1 +GRIT_VER=0.8.13 +NDSTOOL_VER=1.50.3 GENERAL_TOOLS_VER=1.0.0 DLDITOOL_VER=1.24.0 -GXTEXCONV_VER=0.1.9 -GCDSPSUITE_VER=1.4.0 -ELF2DOL_VER=1.0.0 +GAMECUBE_TOOLS_VER=1.0.0 WIILOAD_VER=0.5.1 MMUTIL_VER=1.8.6 -DFU_UTIL_VER=0.7.1 +DFU_UTIL_VER=0.8.1 STLINK_VER=0.5.8 -TOOLS3DS_VER=1.0.0 +TOOLS3DS_VER=1.1.1 +LINK3DS_VER=0.5.1 +PICASSO_VER=2.1.0 #--------------------------------------------------------------------------------- function extract_and_patch { @@ -92,7 +93,7 @@ unset LDFLAGS #--------------------------------------------------------------------------------- # Look for automated configuration file to bypass prompts #--------------------------------------------------------------------------------- - + echo -n "Looking for configuration file... " if [ -f ./config.sh ]; then echo "Found." @@ -191,26 +192,37 @@ DEVKITPRO_URL="http://downloads.sourceforge.net/devkitpro" patchdir=$(pwd)/$basedir/patches scriptdir=$(pwd)/$basedir/scripts -archives="binutils-${BINUTILS_VER}.tar.bz2 gcc-${GCC_VER}.tar.bz2 newlib-${NEWLIB_VER}.tar.gz gdb-${GDB_VER}.tar.bz2" +archives="binutils-${BINUTILS_VER}.tar.bz2 gcc-${GCC_VER}.tar.bz2 newlib-${NEWLIB_VER}.tar.gz gdb-${GDB_VER}.tar.gz" if [ $VERSION -eq 1 ]; then - targetarchives=" - libnds-$LIBNDS_VER.tar.gz - libfat-$LIBFAT_VER.tar.gz - " - hostarchives=" - grit-$GRIT_VER.tar.gz - " + + # targetarchives="libnds-src-${LIBNDS_VER}.tar.bz2 libgba-src-${LIBGBA_VER}.tar.bz2 + # libmirko-src-${LIBMIRKO_VER}.tar.bz2 dswifi-src-${DSWIFI_VER}.tar.bz2 maxmod-src-${MAXMOD_VER}.tar.bz2 + # default_arm7-src-${DEFAULT_ARM7_VER}.tar.bz2 libfilesystem-src-${FILESYSTEM_VER}.tar.bz2 + # libfat-src-${LIBFAT_VER}.tar.bz2 libctru-src-${LIBCTRU_VER}.tar.bz2" + + # hostarchives="gbatools-$GBATOOLS_VER.tar.bz2 gp32tools-$GP32_TOOLS_VER.tar.bz2 + # dstools-$DSTOOLS_VER.tar.bz2 grit-$GRIT_VER.tar.bz2 ndstool-$NDSTOOL_VER.tar.bz2 + # general-tools-$GENERAL_TOOLS_VER.tar.bz2 dlditool-$DLDITOOL_VER.tar.bz2 mmutil-$MMUTIL_VER.tar.bz2 + # dfu-util-$DFU_UTIL_VER.tar.bz2 stlink-$STLINK_VER.tar.bz2 3dstools-$TOOLS3DS_VER.tar.bz2 + # picasso-$PICASSO_VER.tar.bz2 3dslink-$LINK3DS_VER.tar.bz2" + + targetarchives="libnds-src-$LIBNDS_VER.tar.gz libfat-src-$LIBFAT_VER.tar.gz" + #hostarchives="general-tools-$GENERAL_TOOLS_VER.tar.gz" + hostarchives="" fi if [ $VERSION -eq 2 ]; then + targetarchives="libogc-src-${LIBOGC_VER}.tar.bz2 libfat-src-${LIBFAT_VER}.tar.bz2" - hostarchives="gxtexconv-$GXTEXCONV_VER.tar.bz2 gcdspsuite-$GCDSPSUITE_VER.tar.bz2 - wiiload-$WIILOAD_VER.tar.bz2 elf2dol-$ELF2DOL_VER.tar.bz2 general-tools-$GENERAL_TOOLS_VER.tar.bz2" + + hostarchives="gamecube-tools-$GAMECUBE_TOOLS_VER.tar.bz2 wiiload-$WIILOAD_VER.tar.bz2 general-tools-$GENERAL_TOOLS_VER.tar.bz2" fi if [ $VERSION -eq 3 ]; then + targetarchives="pspsdk-src-${PSPSDK_VER}.tar.bz2" + fi if [ ! -z "$BUILD_DKPRO_SRCDIR" ] ; then @@ -221,9 +233,9 @@ fi cd "$SRCDIR" for archive in $archives $targetarchives $hostarchives -do +do echo $archive - if [ ! -f $archive ]; then + if [ ! -f $archive ]; then $FETCH http://downloads.sf.net/devkitpro/$archive || { echo "Error: Failed to download $archive"; exit 1; } fi done @@ -236,16 +248,25 @@ extract_and_patch binutils $BINUTILS_VER bz2 extract_and_patch gcc $GCC_VER bz2 rm -fr gcc-$GCC_VER/zlib extract_and_patch newlib $NEWLIB_VER gz -extract_and_patch gdb $GDB_VER bz2 +extract_and_patch gdb $GDB_VER gz -for archive in $targetarchives $hostarchives +for archive in $targetarchives do - destdir=$(echo $archive | sed -e 's/\(.*\)\-\(.*\)\.tar\.gz/\1-\2/' ) + destdir=$(echo $archive | sed -e 's/\(.*\)-src-\(.*\)\.tar\.(.*)/\1-\2\.3/' ) echo $destdir if [ ! -d $destdir ]; then - #mkdir -p $destdir - #tar -xf "$SRCDIR/$archive" -C $destdir || { echo "Error extracting "$archive; exit 1; } - tar -xf $SRCDIR/$archive + mkdir -p $destdir + # bzip2 -cd "$SRCDIR/$archive" | tar -xf - -C $destdir || { echo "Error extracting "$archive; exit 1; } + tar -xf $SRCDIR/$archive -C $destdir || { echo "Error extracting "$archive; exit 1; } + fi +done + +for archive in $hostarchives +do + destdir=$(echo $archive | sed -e 's/\(.*\)-src-\(.*\)\.tar\.bz2/\1-\2/' ) + if [ ! -d $destdir ]; then + # tar -xjf "$SRCDIR/$archive" + tar -xf "$SRCDIR/$archive" fi done @@ -258,7 +279,7 @@ if [ -f $scriptdir/build-crtls.sh ]; then . $scriptdir/build-crtls.sh || { echo if [ ! -z $CROSSBUILD ]; then if [ $VERSION -ne 3 ]; then - cp -v $CROSSLIBPATH/FreeImage.dll $prefix/bin + cp -v $CROSSBINPATH/FreeImage.dll $prefix/bin fi if [ $VERSION -eq 1 ]; then cp -v $CROSSBINPATH/libusb-1.0.dll $prefix/bin diff --git a/tool/buildscripts/build-tools.sh b/tool/buildscripts/build-tools.sh new file mode 100755 index 0000000..9864f05 --- /dev/null +++ b/tool/buildscripts/build-tools.sh @@ -0,0 +1,22 @@ +#!/bin/bash +cd $BUILDDIR + +for archive in $hostarchives +do + echo $archive + dir=$(echo $archive | sed -e 's/\(.*\)\.tar\..*/\1/' ) + echo $dir + cd $BUILDDIR/$dir + if [ ! -f configured ]; then + CXXFLAGS=$cflags CFLAGS=$cflags LDFLAGS=$ldflags ./configure --prefix=$prefix --disable-dependency-tracking $CROSS_PARAMS || { echo "error configuring $archive"; exit 1; } + touch configured + fi + if [ ! -f built ]; then + $MAKE || { echo "error building $dir"; exit 1; } + touch built + fi + if [ ! -f installed ]; then + $MAKE install || { echo "error installing $dir"; exit 1; } + touch installed + fi +done diff --git a/tool/buildscripts/config.sh b/tool/buildscripts/config.sh index 4e32175..fcf6800 100644 --- a/tool/buildscripts/config.sh +++ b/tool/buildscripts/config.sh @@ -16,18 +16,12 @@ BUILD_DKPRO_PACKAGE=1 #--------------------------------------------------------------------------------- # Toolchain installation directory, comment if not specified #--------------------------------------------------------------------------------- -BUILD_DKPRO_INSTALLDIR=/home/ray/Library/devkitpro/r43 +BUILD_DKPRO_INSTALLDIR=$HOME/Library/devkitpro/r45 #--------------------------------------------------------------------------------- # Path to previously downloaded source packages, comment if not specified #--------------------------------------------------------------------------------- -BUILD_DKPRO_SRCDIR=/home/ray/Documents/r43/archive - -#--------------------------------------------------------------------------------- -# MAKEFLAGS for building - use number of processors for jobs -#--------------------------------------------------------------------------------- -numcores=`getconf _NPROCESSORS_ONLN` -export MAKEFLAGS="$MAKEFLAGS -j${numcores}" +BUILD_DKPRO_SRCDIR=$(realpath $(dirname $0)/../archive) #--------------------------------------------------------------------------------- # Automated script execution diff --git a/tool/buildscripts/gcc-4.9.2.tar.bz2 b/tool/buildscripts/gcc-4.9.2.tar.bz2 deleted file mode 100644 index 531a1b6..0000000 Binary files a/tool/buildscripts/gcc-4.9.2.tar.bz2 and /dev/null differ diff --git a/tool/buildscripts/gdb-7.7.1.tar.bz2 b/tool/buildscripts/gdb-7.7.1.tar.bz2 deleted file mode 100644 index 35c887e..0000000 Binary files a/tool/buildscripts/gdb-7.7.1.tar.bz2 and /dev/null differ diff --git a/tool/buildscripts/libfat-1.0.12.tar.gz b/tool/buildscripts/libfat-1.0.12.tar.gz deleted file mode 100644 index 4329f5e..0000000 Binary files a/tool/buildscripts/libfat-1.0.12.tar.gz and /dev/null differ diff --git a/tool/buildscripts/libnds-1.5.8.tar.gz b/tool/buildscripts/libnds-1.5.8.tar.gz deleted file mode 100644 index f6c4a2a..0000000 Binary files a/tool/buildscripts/libnds-1.5.8.tar.gz and /dev/null differ diff --git a/tool/buildscripts/newlib-2.1.0.tar.gz b/tool/buildscripts/newlib-2.1.0.tar.gz deleted file mode 100644 index 0bf4ca5..0000000 Binary files a/tool/buildscripts/newlib-2.1.0.tar.gz and /dev/null differ diff --git a/tool/buildscripts/select_toolchain.sh b/tool/buildscripts/select_toolchain.sh new file mode 100755 index 0000000..90a4480 --- /dev/null +++ b/tool/buildscripts/select_toolchain.sh @@ -0,0 +1,65 @@ +#!/bin/bash +VERSION=0 +case "$BUILD_DKPRO_PACKAGE" in + "1" ) + VERSION=1 + ;; + "2" ) + VERSION=2 + ;; + "3" ) + VERSION=3 + ;; + "4" ) + VERSION=4 + ;; +esac + +while [ $VERSION -eq 0 ] +do + echo + echo "Please select the toolchain you require" + echo + echo "1: devkitARM (gba gp32 ds)" + echo "2: devkitPPC (gamecube wii)" + echo "3: devkitPSP (PSP)" + read VERSION + + if [ "$VERSION" -ne 1 -a "$VERSION" -ne 2 -a "$VERSION" -ne 3 ] + then + VERSION=0 + fi +done + +case "$VERSION" in + "1" ) + GCC_VER=5.3.0 + BINUTILS_VER=2.25.1 + NEWLIB_VER=2.2.0 + GDB_VER=7.10 + basedir='dkarm-eabi' + package=devkitARM + target=arm-none-eabi + toolchain=DEVKITARM + ;; + "2" ) + GCC_VER=4.8.2 + BINUTILS_VER=2.24 + NEWLIB_VER=2.0.0 + GDB_VER=7.7 + basedir='dkppc' + package=devkitPPC + target=powerpc-eabi + toolchain=DEVKITPPC + ;; + "3" ) + GCC_VER=4.6.3 + BINUTILS_VER=2.22 + NEWLIB_VER=1.20.0 + GDB_VER=7.4 + basedir='dkpsp' + package=devkitPSP + target=psp + toolchain=DEVKITPSP + ;; +esac