BUILD_HOST=`echo $CROSS_COMPILE | sed s/-$//` function check() { cd ${WORK_SPACE} || exit 1 COMPONENT_NAME="check-0.9.8.tar.gz" COMPONENT_DIR="check-0.9.8" download_component "http://downloads.sourceforge.net/check/check-0.9.8.tar.gz" if [ ${CURRENT_OPTION} = "2" ]; then add_fingerprint 0 ./configure --host=${BUILD_HOST} --prefix=${MY_PREFIX} --sysconfdir=${MY_SYSCONFDIR} --localstatedir=${MY_LOCALSTATEDIR} || exit 1 make || exit 1 make install DESTDIR=${ROOTFS} || exit 1 rm `find ${ROOTFS}${MY_PREFIX}/lib/ -name '*.la'` >& /dev/null add_fingerprint 1 fi echo "check built successfully" } function expat() { cd ${WORK_SPACE} || exit 1 COMPONENT_NAME="expat-2.1.0.tar.gz" COMPONENT_DIR="expat-2.1.0" download_component "http://downloads.sourceforge.net/project/expat/expat/2.1.0/expat-2.1.0.tar.gz" if [ ${CURRENT_OPTION} = "2" ]; then add_fingerprint 0 ./configure --host=${BUILD_HOST} --prefix=${MY_PREFIX} --sysconfdir=${MY_SYSCONFDIR} --localstatedir=${MY_LOCALSTATEDIR} || exit 1 make || exit 1 make install DESTDIR=${ROOTFS} || exit 1 rm `find ${ROOTFS}${MY_PREFIX}/lib/ -name '*.la'` >& /dev/null add_fingerprint 1 fi echo "expat built successfully" } function libIConv() { cd ${WORK_SPACE} || exit 1 COMPONENT_NAME="libiconv-1.14.tar.gz" COMPONENT_DIR="libiconv-1.14" download_component "http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz" if [ ${CURRENT_OPTION} = "2" ]; then add_fingerprint 0 ./configure --host=${BUILD_HOST} --prefix=${MY_PREFIX} --sysconfdir=${MY_SYSCONFDIR} --localstatedir=${MY_LOCALSTATEDIR} || exit 1 make || exit 1 make install DESTDIR=${ROOTFS} || exit 1 rm `find ${ROOTFS}${MY_PREFIX}/lib/ -name '*.la'` >& /dev/null add_fingerprint 1 fi echo "libIConv built successfully" } function zlib() { cd ${WORK_SPACE} || exit 1 COMPONENT_NAME="zlib-1.2.8.tar.gz" COMPONENT_DIR="zlib-1.2.8" download_component "http://zlib.net/zlib-1.2.8.tar.gz" if [ ${CURRENT_OPTION} = "2" ]; then add_fingerprint 0 ./configure --prefix=${MY_PREFIX} --sysconfdir=${MY_SYSCONFDIR} --localstatedir=${MY_LOCALSTATEDIR} || exit 1 make || exit 1 make install DESTDIR=${ROOTFS} || exit 1 add_fingerprint 1 fi echo "zlib built successfully" } function gettext() { cd ${WORK_SPACE} || exit 1 COMPONENT_NAME="gettext-0.18.tar.gz" COMPONENT_DIR="gettext-0.18" download_component "http://ftp.gnu.org/gnu/gettext/gettext-0.18.tar.gz" if [ ${CURRENT_OPTION} = "2" ]; then add_fingerprint 0 echo "ac_cv_func_unsetenv=no" > arm-linux.cache || exit 1 ./configure --host=${BUILD_HOST} --prefix=${MY_PREFIX} --sysconfdir=${MY_SYSCONFDIR} --localstatedir=${MY_LOCALSTATEDIR} --cache-file=arm-linux.cache || exit 1 make || exit 1 make install DESTDIR=${ROOTFS} || exit 1 rm `find ${ROOTFS}${MY_PREFIX}/lib/ -name '*.la'` >& /dev/null add_fingerprint 1 fi echo "gettext built successfully" } function glib() { if [ $# -eq 1 ]; then START_MODULE="glib-2.34.0.tar.xz" fi # dependency section, in here we build the dependencies. We do not want to rebuild them each time libIConv zlib cd ${WORK_SPACE} || exit 1 COMPONENT_NAME="glib-2.41.0.tar.xz" COMPONENT_DIR="glib-2.41.0" download_component "http://ftp.gnome.org/pub/GNOME/sources/glib/2.41/glib-2.41.0.tar.xz" if [ ${CURRENT_OPTION} = "2" ]; then add_fingerprint 0 echo "glib_cv_stack_grows=no glib_cv_have_qsort_r=no glib_cv_uscore=yes ac_cv_func_posix_getpwuid_r=yes ac_cv_func_posix_getgrgid_r=yes ac_cv_func_pipe2=no" > arm-linux.cache || exit 1 ./configure --host=${BUILD_HOST} --prefix=${MY_PREFIX} --sysconfdir=${MY_SYSCONFDIR} --localstatedir=${MY_LOCALSTATEDIR} --cache-file=arm-linux.cache --with-libiconv=gnu || exit 1 sed -i 's/\(^Libs: .*\)/\1 -liconv/g' glib-2.0.pc || exit 1 sed -i 's/\(^Libs: .*\)/\1 -lgmodule-2.0/g' gio-2.0.pc || exit 1 make || exit 1 make install DESTDIR=${ROOTFS} || exit 1 rm `find ${ROOTFS}${MY_PREFIX}/lib/ -name '*.la'` >& /dev/null add_fingerprint 1 fi echo "glib built successfully" } function dbus() { if [ $# -eq 1 ]; then START_MODULE="dbus-1.6.8.tar.gz" fi # dependency section, in here we build the dependencies. We do not want to rebuild them each time expat libffi glib cd ${WORK_SPACE} || exit 1 COMPONENT_NAME="dbus-1.6.8.tar.gz" COMPONENT_DIR="dbus-1.6.8" download_component "http://dbus.freedesktop.org/releases/dbus/dbus-1.6.8.tar.gz" if [ ${CURRENT_OPTION} = "2" ]; then add_fingerprint 0 echo "ac_cv_func_pipe2=no" > arm-linux.cache || exit 1 ./configure --host=${BUILD_HOST} --prefix=${MY_PREFIX} --sysconfdir=${MY_SYSCONFDIR} --localstatedir=${MY_LOCALSTATEDIR} --cache-file=arm-linux.cache --disable-inotify --without-x || exit 1 make LIBS="-lgio-2.0 -lgmodule-2.0 -lgobject-2.0 -lglib-2.0 -liconv -lffi -lz" || exit 1 make install DESTDIR=${ROOTFS} || exit 1 rm `find ${ROOTFS}${MY_PREFIX}/lib/ -name '*.la'` >& /dev/null echo "messagebus:x:102:105::${MY_LOCALSTATEDIR}/run/dbus:/bin/false" >> ${ROOTFS}${MY_SYSCONFDIR}/passwd || exit 1 add_fingerprint 1 fi echo "dbus built successfully" } function dbus-glib() { if [ $# -eq 1 ]; then START_MODULE="dbus-glib-0.86.tar.gz" fi # dependency section, in here we build the dependencies. We do not want to rebuild them each time dbus glib cd ${WORK_SPACE} || exit 1 COMPONENT_NAME="dbus-glib-0.86.tar.gz" COMPONENT_DIR="dbus-glib-0.86" download_component "http://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-0.86.tar.gz" if [ ${CURRENT_OPTION} = "2" ]; then add_fingerprint 0 echo "ac_cv_have_abstract_sockets=yes" > arm-linux.cache || exit 1 ./configure --host=${BUILD_HOST} --prefix=${MY_PREFIX} --sysconfdir=${MY_SYSCONFDIR} --localstatedir=${MY_LOCALSTATEDIR} --cache-file=arm-linux.cache || exit 1 sed -i 's/examples//g' dbus/Makefile || exit 1 sed -i 's/tools test/test/g' Makefile || exit 1 make LIBS="-lffi -lgthread-2.0 -lgobject-2.0 -lglib-2.0 -liconv" || exit 1 make install DESTDIR=${ROOTFS} || exit 1 rm `find ${ROOTFS}${MY_PREFIX}/lib/ -name '*.la'` >& /dev/null add_fingerprint 1 fi echo "dbus-glib built successfully" } function python() { cd ${WORK_SPACE} || exit 1 #dependency section glib COMPONENT_NAME="Python-2.7.3.tgz" COMPONENT_DIR="Python-2.7.3" download_component "http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz" echo "CURRENT_OPTION=$CURRENT_OPTION" if [ ${CURRENT_OPTION} = "2" ]; then add_fingerprint 0 CC=gcc CXX=g++ AR=ar RANLIB=ranlib ./configure || exit 1 make python Parser/pgen || exit 1 mv python hostpython || exit 1 mv Parser/pgen Parser/hostpgen || exit 1 make distclean || exit 1 patch -p1 < ${old_dir}/patches/0001-Python-2.7.3-xcompile.patch || exit 1 ./configure --host=${BUILD_HOST} --build=x86_64-linux-gnu --prefix=${MY_PREFIX} --with-system-expat --enable-unicode=ucs2 --without-wctype-functions || exit 1 make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen BLDSHARED="${CROSS_COMPILE}gcc -shared" CROSS_COMPILE_TARGET=yes HOSTARCH=arm-linux BUILDARCH=x86_64-linux-gnu || exit 1 make install DESTDIR=${ROOTFS} HOSTPYTHON=./hostpython BLDSHARED="${CROSS_COMPILE}gcc -shared" CROSS_COMPILE_TARGET=y || exit 1 add_fingerprint 1 fi echo "python built successfully" } function dbus-python() { cd ${WORK_SPACE} || exit 1 #dependency section glib dbus python COMPONENT_NAME="dbus-python-0.84.0.tar.gz" COMPONENT_DIR="dbus-python-0.84.0" download_component "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-0.84.0.tar.gz" if [ ${CURRENT_OPTION} = "2" ]; then add_fingerprint 0 echo "am_cv_python_pythondir=${MY_PREFIX}/lib/python2.7/site-packages am_cv_python_pyexecdir=${MY_PREFIX}/lib/python2.7/site-packages" > arm-linux.cache || exit 1 PYTHON_INCLUDES="-I${ROOTFS}${MY_PREFIX}/include/python2.7/" PYTHON_LIBS="-L${ROOTFS}/${MY_PREFIX}/lib/python2.7" ./configure --host=${BUILD_HOST} --build=x86_64-linux-gnu --prefix=${MY_PREFIX} --cache-file=arm-linux.cache || exit 1 make PYTHON_INCLUDES="-I${ROOTFS}${MY_PREFIX}/include/python2.7/" || exit 1 make install DESTDIR=${ROOTFS} || exit 1 rm `find ${ROOTFS}${MY_PREFIX}/lib/ -name '*.la'` >& /dev/null add_fingerprint 1 fi echo "dbus-python built successfully" } function pygobject() { cd ${WORK_SPACE} || exit 1 #dependency section glib python COMPONENT_NAME="pygobject-2.21.1.tar.bz2" COMPONENT_DIR="pygobject-2.21.1" download_component "http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.21/pygobject-2.21.1.tar.bz2" if [ ${CURRENT_OPTION} = "2" ]; then add_fingerprint 0 echo "am_cv_python_pyexecdir=${MY_PREFIX}/lib/python2.7/site-packages" > arm-linux.cache || exit 1 CC=gcc CXX=g++ AR=ar RANLIB=ranlib ./configure --disable-glibtest --without-ffi || exit 1 cd ./gobject make generate-constants || exit 1 cd .. cp gobject/generate-constants host-generate-constants || exit 1 patch -p1 -i ${old_dir}/patches/0001-pygobject-python-includes.patch /usr/bin/libtoolize || exit 1 /usr/bin/aclocal -I m4 || exit 1 /usr/bin/autoheader || exit 1 /usr/bin/automake --add-missing || exit 1 /usr/bin/autoconf || exit 1 PYTHON_INCLUDES="-I${ROOTFS}${MY_PREFIX}/include/python2.7/" NM=nm ./configure --host=${BUILD_HOST} --build=x86_64-linux-gnu --prefix=${MY_PREFIX} --cache-file=arm-linux.cache || exit 1 cp host-generate-constants gobject/generate-constants || exit 1 make PYTHON_INCLUDES="-I${ROOTFS}${MY_PREFIX}/include/python2.7/" || exit 1 make || exit 1 make install DESTDIR=${ROOTFS} || exit 1 rm `find ${ROOTFS}${MY_PREFIX}/lib/ -name '*.la'` >& /dev/null add_fingerprint 1 fi echo "pygobject built successfully" } function firmware { cd ${WORK_SPACE} || exit 1 COMPONENT_NAME="bt-firmware" COMPONENT_REV="c17a13b64e7b1bfb1d44658b2473bcbff763befd" COMPONENT_DIR="bt-firmware" download_component "git://github.com/TI-ECS/bt-firmware.git" if [ ${CURRENT_OPTION} = "2" ]; then add_fingerprint 0 mkdir -p ${ROOTFS}/lib/firmware || exit 1 if [ x"$MACHINE_TYPE" = "x" ]; then get_machine_used fi PRINT_STR="Invoking: cp ${MACHINE_TYPE}/TIInit_12.8.32.bts ${ROOTFS}/lib/firmware/" echo ${PRINT_STR} cp ./${MACHINE_TYPE}/TIInit_12.8.32.bts ${ROOTFS}/lib/firmware/ || exit 1 add_fingerprint 1 fi echo "firmware built successfully" } function libffi() { cd ${WORK_SPACE} || exit 1 COMPONENT_REV="70084e70ddb13b29dd05c751b1904de206bbe790" COMPONENT_NAME="libffi" COMPONENT_DIR="libffi" download_component "https://github.com/atgreen/libffi.git" if [ ${CURRENT_OPTION} = "2" ]; then add_fingerprint 0 ./configure --prefix=${MY_PREFIX} CC=${CROSS_COMPILE}gcc LD=${CROSS_COMPILE}ld RANLIB=${CROSS_COMPILE}ranlib --host=${BUILD_HOST} || exit 1 make || exit 1 make install DESTDIR=${ROOTFS} || exit 1 rm `find ${ROOTFS}${MY_PREFIX}/lib/ -name '*.la'` >& /dev/null add_fingerprint 1 fi echo "libffi built successfully" } function add_fingerprint() { if [ x"$1" = "x" ]; then echo "Function add_fingerprint() called with no parameters!!!" exit 1 fi local FILENAME="${FINGURE_PRINT_DIR}/${COMPONENT_NAME##*/}" touch ${FILENAME} || exit 1 echo $1 > ${FILENAME} || exit } function fingerprint() { local FILENAME="${FINGURE_PRINT_DIR}/${COMPONENT_NAME##*/}" # if no file exists if [ ! -e ${FILENAME} ]; then return 0 fi read MAX < ${FILENAME} return ${MAX} } function download_component() { if [ x"$1" = "x" ]; then echo "Function called with no parameters!!!" exit 1 fi if [ ! x"${START_MODULE}" = "x" ]; then # if the START_MODULE is not empty if [ ${START_MODULE} = ${COMPONENT_NAME} ]; then # if we are building the start module CURRENT_OPTION=${USER_OPTION} # take the user option as is else CURRENT_OPTION="1" # else, we are building dependency, so we should only build not rebuild fi else CURRENT_OPTION=${USER_OPTION} # take the user option as is fi # get the extension of the file local EXT=${1/*./} # check the fingerprint value fingerprint case "$?" in 0) # 0 - File not compiled nor installed CURRENT_OPTION="2" # override to "rebuild" option ;; 1) # 1 - File was installed properly # if the option is build and fingerprint OK, nothing to do if [ ${CURRENT_OPTION} = "1" ]; then return fi ;; *) echo "Corrupted fingerprint for component ${COMPONENT_NAME}" exit 1 ;; esac # echo "Decided to rebuild for ${COMPONENT_NAME}" # read # I get here in one situation : USER_OPTION = 2 case "${EXT}" in git) # if git directory exist, do not clone it again if [ ! -d ${COMPONENT_DIR} ]; then git clone $1 || exit 1 fi cd ${COMPONENT_DIR} || exit 1 git reset --hard ${COMPONENT_REV} || exit 1 ;; tgz|gz|bz2|xz|tar) # delete the working directory if exists if [ ! x"${COMPONENT_DIR}" = "x" ]; then rm -rf ${COMPONENT_DIR} || exit 1 fi local TAR_FLAGS="-xavf" # if component doesn't exist, bring it if [ ! -e ${COMPONENT_NAME} ]; then wget $1 || exit 1 fi tar ${TAR_FLAGS} ${COMPONENT_NAME} || exit 1 # move to the directory if not empty if [ ! x"${COMPONENT_DIR}" = "x" ]; then cd ${COMPONENT_DIR} || exit 1 fi; ;; *) echo "Unknown extension of remote package" exit 1 ;; esac } function get_machine_used() { # check if the machine type is already defined if [ ! x"${MACHINE_TYPE}" = "x" ]; then return; fi echo "" echo "Please select the machine you use:" echo "===================================" echo "3. am335x-evm (am335x)" read choice case $choice in 1) MACHINE_TYPE="am335x" ;; *) echo "This is not a valid choice... Exitiing script" exit 1 ;; esac }