Changeset 16861 in niluje


Ignore:
Timestamp:
Feb 12, 2020, 1:15:00 AM (2 weeks ago)
Author:
NiLuJe
Message:

Kindle Hacks:

  • X-TC:
    • Handle the fake PB TC
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Configs/trunk/Kindle/Misc/x-compile.sh

    r16857 r16861  
    109109
    110110        ## And then build every TC one after the other...
    111         for my_tc in kindle kindle5 kindlepw2 kobo remarkable ; do
     111        for my_tc in kindle kindle5 kindlepw2 kobo remarkable pocketbook ; do
    112112                echo ""
    113113                echo "* Building the ${my_tc} ToolChain . . ."
     
    330330                KINDLE_TC="REMARKABLE"
    331331        ;;
     332        pb | PB | pocketbook )
     333                KINDLE_TC="PB"
     334        ;;
    332335        # Or build them?
    333336        tc )
     
    339342        ;;
    340343        * )
    341                 echo "You must choose a ToolChain! (k3, k5, pw2, kobo, mk7, nickel or remarkable)"
     344                echo "You must choose a ToolChain! (k3, k5, pw2, kobo, mk7, nickel, remarkable or pocketbook)"
    342345                echo "Or, alternatively, ask to build them (tc)"
    343346                exit 1
     
    821824
    822825                DEVICE_USERSTORE="/home/root"
     826        ;;
     827        PB )
     828                ARCH_FLAGS="-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb"
     829                CROSS_TC="arm-pocketbook-linux-gnueabi"
     830                TC_BUILD_DIR="${HOME}/Kindle/CrossTool/Build_${KINDLE_TC}"
     831
     832                # Export it for our CMakeCross TC file
     833                export CROSS_TC
     834                export TC_BUILD_DIR
     835
     836                export CROSS_PREFIX="${CROSS_TC}-"
     837                export PATH="${HOME}/x-tools/${CROSS_TC}/bin:${PATH}"
     838
     839                ## NOTE: The new libstdc++ ABI might cause some issues if not handled on GCC >= 5.1 (cf. https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html), so, disable it...
     840                if is_ver_gte "$(${CROSS_TC}-gcc -dumpversion)" "5.1" ; then
     841                        LEGACY_GLIBCXX_ABI="-D_GLIBCXX_USE_CXX11_ABI=0"
     842                        ## NOTE: Like the FORTIFY stuff, this should *really* be in CPPFLAGS, but we have to contend with broken buildsystems that don't honor CPPFLAGS... So we go with the more ubiquitous CFLAGS instead ;/.
     843                fi
     844
     845                BASE_CFLAGS="-O3 -ffast-math ${ARCH_FLAGS} ${LEGACY_GLIBCXX_ABI} -pipe -fomit-frame-pointer -frename-registers -fweb -flto=${AUTO_JOBS} -fuse-linker-plugin"
     846                NOLTO_CFLAGS="-O3 -ffast-math ${ARCH_FLAGS} ${LEGACY_GLIBCXX_ABI} -pipe -fomit-frame-pointer -frename-registers -fweb"
     847                ## Here be dragons!
     848                RICE_CFLAGS="-O3 -ffast-math -ftree-vectorize -funroll-loops ${ARCH_FLAGS} ${LEGACY_GLIBCXX_ABI} -pipe -fomit-frame-pointer -frename-registers -fweb -flto=${AUTO_JOBS} -fuse-linker-plugin"
     849
     850                ## NOTE: Check if LTO still horribly breaks some stuff...
     851                ## NOTE: See https://gcc.gnu.org/gcc-4.9/changes.html for the notes about building LTO-enabled static libraries... (gcc-ar/gcc-ranlib)
     852                ## NOTE: And see https://gcc.gnu.org/gcc-5/changes.html to rejoice because we don't have to care about broken build-systems with mismatched compile/link time flags anymore :).
     853                export AR="${CROSS_TC}-gcc-ar"
     854                export RANLIB="${CROSS_TC}-gcc-ranlib"
     855                export NM="${CROSS_TC}-gcc-nm"
     856                ## NOTE: Also, BOLO for packages thant link with $(CC) $(LDFLAGS) (ie. without CFLAGS). This is BAD. One (dirty) workaround if you can't fix the package is to append CFLAGS to the end of LDFLAGS... :/
     857                ## NOTE: ... although GCC 5 should handle this in a transparent & sane manner, so, yay :).
     858                #BASE_CFLAGS="${NOLTO_CFLAGS}"
     859                export CFLAGS="${BASE_CFLAGS}"
     860                export CXXFLAGS="${BASE_CFLAGS}"
     861                # NOTE: Use -isystem instead of -I to make sure GMP doesn't do crazy stuff... (FIXME: -idirafter sounds more correct for our use-case, though...)
     862                BASE_CPPFLAGS="-isystem${TC_BUILD_DIR}/include"
     863                export CPPFLAGS="${BASE_CPPFLAGS}"
     864                BASE_LDFLAGS="-L${TC_BUILD_DIR}/lib -Wl,-O1 -Wl,--as-needed"
     865                # NOTE: Dirty LTO workaround (cf. earlier). All hell might break loose if we tweak CFLAGS for some packages...
     866                #BASE_LDFLAGS="${BASE_CFLAGS} ${BASE_LDFLAGS}"
     867                export LDFLAGS="${BASE_LDFLAGS}"
     868
     869                # NOTE: We're no longer using the gold linker by default...
     870                # FIXME: Because for some mysterious reason, gold + LTO leads to an unconditional dynamic link against libgcc_s (uless -static-libgcc is passed, of course).
     871                export CTNG_LD_IS="bfd"
     872
     873                ## NOTE: We jump through terrible hoops to counteract libtool's stripping of 'unknown' or 'harmful' FLAGS... (cf. https://www.gnu.org/software/libtool/manual/html_node/Stripped-link-flags.html)
     874                ## That's a questionable behavior that is bound to screw up LTO in fun and interesting ways, at the very least on the performance aspect of things...
     875                ## Store those in the right format here, and apply patches or tricks to anything using libtool, because of course it's a syntax that gcc doesn't know about, so we can't simply put it in the global LDFLAGS.... -_-".
     876                ## And since autotools being autotools, it's used in various completely idiosyncratic ways, we can't always rely on simply overriding AM_LDFLAGS...
     877                ## NOTE: Hopefully, GCC 5's smarter LTO handling means we don't have to care about that anymore... :).
     878                export XC_LINKTOOL_CFLAGS="-Wc,-ffast-math -Wc,-fomit-frame-pointer -Wc,-frename-registers -Wc,-fweb"
     879
     880                BASE_HACKDIR="${SVN_ROOT}/Configs/trunk/Kindle/PB_Hacks"
     881
     882                BASE_PKG_CONFIG_PATH="${TC_BUILD_DIR}/lib/pkgconfig"
     883                BASE_PKG_CONFIG_LIBDIR="${TC_BUILD_DIR}/lib/pkgconfig"
     884                export PKG_CONFIG_DIR=
     885                export PKG_CONFIG_PATH="${BASE_PKG_CONFIG_PATH}"
     886                export PKG_CONFIG_LIBDIR="${BASE_PKG_CONFIG_LIBDIR}"
     887
     888                ## CMake is hell.
     889                export CMAKE="cmake -DCMAKE_TOOLCHAIN_FILE=${SCRIPTS_BASE_DIR}/CMakeCross.txt -DCMAKE_INSTALL_PREFIX=${TC_BUILD_DIR}"
     890
     891                DEVICE_USERSTORE="/mnt/ext1/applications"
    823892        ;;
    824893        * )
Note: See TracChangeset for help on using the changeset viewer.