3 # openpandora_toolchain.sh:
4 # Script for installing a crosscompiler toolchain that allows building binaries
8 # * Rather easy to setup toolchain that allows compiling binaries for the
9 # pandora on a linux host.
10 # * Should support x86 as well as amd64 with multilib support.
11 # * Installable inside a users $HOME without root priviledges.
12 # * Completely based upon the packages that are also used on the pandora. It
13 # should use exactly the versions as shipped with the pandora and just those.
14 # * Includes all libs and headers that are also found on the pandora (might
15 # even include some useless things) but only a small number of binaries that
16 # can't be run on the host architecture.
17 # * Should be rather easy to keep in sync with upsteam (aka openpandora.org)
20 # The latest version of this script should be available in this forum thread:
21 # http://www.gp32x.com/board/index.php?/topic/58443-crosscompiler-toolchain-based-on-openpandora-org-ipks/
23 # This script was initially based upon the scripts provided in these threads:
24 # http://www.gp32x.com/board/index.php?/topic/52343-pandora-sdk-installer/
25 # http://www.gp32x.com/board/index.php?/topic/55453-pandora-sdk-installer-with-opkg/
27 # Copyright (C) 2011 by Nils Kneuper <crazy-ivanovic@gmx.net>
31 # * Adjust the variable "PNDSDK_DIR" so that it shows a valid path for your
32 # system. The folder you give it there should have write permissions for your
33 # current user. Otherwise things will not work!
34 # * If you downloaded the script from a pastebin site you should apply
35 # "dos2unix" on it to make sure that it works!
36 # * Run the script without root priviledges. If you run it with root privs it
37 # might hurt your system. Don't blame me if you destroy your system with this
38 # script, you have been warned!
40 # Required dependencies:
41 # * You need a working compile environment on your host system to process
42 # several of the steps. This has to be created before running the script.
43 # Besides you will need some additional programs like eg wget and some
44 # others. Existance of those inside $PATH will be checked and you will get an
45 # error message if they don't exist.
46 # * You need about 2.0GB for the toolchain plus about 700MB for temporary
47 # files. Those 700MB will be downloaded using your internetconnection.
50 # * This toolchain won't work on a pure 64bit system.
51 # * Whitespaces as well as quotes won't work inside the path to your PNDSDK_DIR.
52 # * It will not automagically install the deps you need later on to run it, some
53 # hints what might be required are at the end of this comment section.
54 # * The files installed by this script (mainly the codesourcery based toolchain
55 # will be owned by the current user. Because of this and depending on your
56 # system setup the toolchain might only work for this very user (not 100% sure
57 # since it all depends on your system setup...).
58 # * Some things like eg the gettext tools (for generation of translations used
59 # in the programs you compile with your toolchain) will have to be provided by
60 # your system. Stuff like msgfmt is *not* included!
61 # * This toolchain can most likely not be used to build complete pandora (NAND)
62 # images. For this you still have to get an OpenEmbedded toolchain.
65 # Getting some of the required dependencies in "Debian" style (usable by
66 # debian derivates like Ubuntu, too!):
67 # apt-get install libcurl4-openssl-dev libgpgme11-dev libtool build-essential
69 # Getting the deps for Gentoo:
70 # * If you are using amd64 make sure that the useflag "multilib" is selected.
71 # * All required dependencies for this script to work should already be
76 # * Allow calling the script with parameters, so that just specific parts are
77 # executed (and add stuff like --help as well as defining the PNDSDK_DIR as
79 # * Make it possible to continue the script in case it had to be aborted before
80 # * Add some more useful files like eg some "set environment vars" script
81 # * Make fix_libs() nicer, currently it is not as clean as it could/should be
82 # * Fix any issues reported ;)
85 # This script is free software; you can redistribute it and/or modify
86 # it under the terms of the GNU General Public License version 2 or,
87 # at your option any later version. This program is distributed in the
88 # hope that it will be useful, but WITHOUT ANY WARRANTY. See
89 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html for more details.
92 # Edit the following line so that it matches the place where you want the SDK
94 PNDSDK_DIR=$HOME/pandora-dev
97 # Don't edit the line below, it depends on the codesourcery toolchain!
98 #PNDSDK=$PNDSDK_DIR/arm-2009q3
99 #PNDSDK=$PNDSDK_DIR/arm-2010.09
100 PNDSDK=$PNDSDK_DIR/arm-2011.03
101 USEFUL_TOOLS_DIR=$PNDSDK_DIR/sdk_utils
103 TARGET_SYS=arm-none-linux-gnueabi
105 # Programs to download and their checksums.
106 #TOOLCHAIN_URL=http://www.codesourcery.com/sgpp/lite/arm/portal/package5383/public/arm-none-linux-gnueabi/arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
107 #TOOLCHAIN_TARBALL_NAME=arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
108 #TOOLCHAIN_MD5=2c2b324f0a84916afd9920029286eb10
109 #TOOLCHAIN_URL=http://www.codesourcery.com/sgpp/lite/arm/portal/package7851/public/arm-none-linux-gnueabi/arm-2010.09-50-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
110 #TOOLCHAIN_TARBALL_NAME=arm-2010.09-50-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
111 #TOOLCHAIN_MD5=f9dbd7a2daf20724e013cc4b5b64d62f
112 TOOLCHAIN_URL=http://www.codesourcery.com/sgpp/lite/arm/portal/package8739/public/arm-none-linux-gnueabi/arm-2011.03-41-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
113 TOOLCHAIN_TARBALL_NAME=arm-2011.03-41-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
114 TOOLCHAIN_MD5=63d93a9f7fe9ff007bc69adfadc7c4ab
115 OPKG_VERSION=opkg-0.1.8
116 OPKG_ARCHIVE_MD5=c714ce0e4863bf1315e3b6913ffe3299
117 OPKG_ARCHIVE=$OPKG_VERSION.tar.gz
118 #PKGCONFIG_VERSION=pkg-config-0.25
119 #PKGCONFIG_ARCHIVE_MD5=a3270bab3f4b69b7dc6dbdacbcae9745
120 PKGCONFIG_VERSION=pkg-config-0.26
121 PKGCONFIG_ARCHIVE_MD5=47525c26a9ba7ba14bf85e01509a7234
122 PKGCONFIG_ARCHIVE=$PKGCONFIG_VERSION.tar.gz
126 # As default the temporary directory is always a subdir of the current folder,
127 # not sure if this should be move further to the top and be "userdefinable"...
130 REQUIRED_PROGS="wget md5sum tar make cut grep sed find awk xargs chmod"
132 # useful functions ...
143 cecho () # Color-echo. Argument $1 = message, Argument $2 = color
145 local default_msg="No message passed." # Doesn't really need to be a local variable.
146 message=${1:-$default_msg} # Defaults to default message.
147 color=${2:-$black} # Defaults to black, if not specified.
148 echo -e "$color $message"
149 tput sgr0 # Reset to normal.
158 cecho "ERROR: Sorry, wget failed. The download url seems to not work. Please retry later." $red
169 cecho "Verifying the integrity of $LOCAL_ARCHIV" $green
170 md5=$(md5sum $TMPDIR/$LOCAL_ARCHIV |cut -d' ' -f1)
171 if [ "$md5" != "$LOCAL_MD5" ]
173 cecho "ERROR: $TMPDIR/$LOCAL_ARCHIV is corrupted, please fix" $red
181 cecho "ERROR: $1 is not present in PATH. $(basename ${0}) requires it in order to work properly." $red
186 download_codesourcery_toolchain()
188 # Check if codesourcery TOOLCHAIN is available, download it if needed
190 cecho "Checking if codesourcery toolchain is available, download it if needed" $green
191 if [ ! -f "$TMPDIR/$TOOLCHAIN_TARBALL_NAME" ]
193 #slow url directly at codesourcery
194 #wget -O $TMPDIR/$TOOLCHAIN http://www.codesourcery.com/sgpp/lite/arm/portal/package5383/public/arm-none-linux-gnueabi/$TOOLCHAIN
195 #working url for the 2009q3 toolchain using the google servers that tend to be faster...
196 #wget -O $TMPDIR/$TOOLCHAIN http://smp-on-qemu.googlecode.com/files/$TOOLCHAIN
197 #working url for the 2010.09 toolchain
198 wget -O $TMPDIR/$TOOLCHAIN_TARBALL_NAME $TOOLCHAIN_URL
204 install_codesourcery_toolchain()
206 # Verify the codesourcery toolchain integrity
207 check_md5sum $TOOLCHAIN_TARBALL_NAME $TOOLCHAIN_MD5
209 # Create the pandora sdk directory
211 cecho "Creating the pandora sdk directory ($PNDSDK_DIR)" $green
212 if [ ! -d $PNDSDK_DIR ]
215 chown -R $USER $PNDSDK_DIR
217 chown -R $USER $PNDSDK_DIR
220 # Extract codesourcery toolchain
222 cecho "Extracting codesourcery toolchain to $PNDSDK_DIR" $green
223 tar -xjf $TMPDIR/$TOOLCHAIN_TARBALL_NAME -C $PNDSDK_DIR
225 #move libstdc++ files that are going to just hurt to some place where they should not be a bother...
226 #the version later on installed by the libstdc++ package should be perfectly fine!
228 cecho "Moving the broken (in case of the pandora!) libstdc++.so files out of the way" $green
229 for i in $(find $PNDSDK/arm-none-linux-gnueabi/ -name 'libstdc++.so*'); do mv $i $i.backup; done
236 cecho "Checking if opkg is available, download it if needed" $green
237 if [ ! -f "$TMPDIR/$OPKG_ARCHIVE" ]
239 wget -O $TMPDIR/$OPKG_ARCHIVE http://opkg.googlecode.com/files/$OPKG_ARCHIVE
247 # Verify the opkg integrity
248 check_md5sum $OPKG_ARCHIVE $OPKG_ARCHIVE_MD5
251 cecho "Extracting opkg source tarball to $TMPDIR/$OPKG_VERSION" $green
252 # First remove the old compile dir since it might clash with the new one if
253 # some things (paths!) are changed!
254 if [ -d "$TMPDIR/$OPKG_VERSION" ]
256 rm -rf $TMPDIR/$OPKG_VERSION
258 tar -xzf $TMPDIR/$OPKG_ARCHIVE -C $TMPDIR/
261 cecho "Configuring, compiling and installing opkg into your SDK" $green
262 cd $TMPDIR/$OPKG_VERSION
263 ./configure --prefix=$PNDSDK --with-opkglockfile=/tmp/opkg_lock --with-opkgetcdir=$PNDSDK/
266 cecho "ERROR: Configure for opkg failed, please check the output above" $red
272 cecho "ERROR: make && make install for opkg failed, please check the output above" $red
278 cecho "Creating config files and folders required for opkg" $green
280 mkdir -p $PNDSDK/lists_dir
284 cat > $PNDSDK/opkg.conf <<_END_
295 arch omap3-pandora 51
297 # Must have one or more source entries of the form:
299 # src <src-name> <source-url>
301 # and one or more destination entries of the form:
303 # dest <dest-name> <target-path>
305 # where <src-name> and <dest-names> are identifiers that
306 # should match [a-zA-Z0-9._-]+, <source-url> should be a
307 # URL that points to a directory containing a Familiar
308 # Packages file, and <target-path> should be a directory
309 # that exists on the target system.
312 #option http_proxy http://proxy.tld:3128
313 #option ftp_proxy http://proxy.tld:3128
314 #option proxy_username <username>
315 #option proxy_password <password>
317 # Enable GPGME signature
318 # option check_signature 1
320 # Offline mode (for use in constructing flash images offline)
321 #option offline_root target
324 lists_dir ext $PNDSDK/lists_dir
328 src/gz base http://www.openpandora.org/feeds/unstable/armv7a/
330 src/gz no-arch http://www.openpandora.org/feeds/unstable/all
332 src/gz omap3-pandora http://www.openpandora.org/feeds/unstable/omap3-pandora
338 cecho "Installation of opkg completed" $green
345 cecho "Checking if pkg-config is available, download it if needed" $green
346 if [ ! -f "$TMPDIR/$PKGCONFIG_ARCHIVE" ]
348 wget -O $TMPDIR/$PKGCONFIG_ARCHIVE http://pkgconfig.freedesktop.org/releases/$PKGCONFIG_ARCHIVE
356 # Verify the opkg integrity
357 check_md5sum $PKGCONFIG_ARCHIVE $PKGCONFIG_ARCHIVE_MD5
360 cecho "Extracting pkg-config source tarball to $TMPDIR/$PKGCONFIG_VERSION" $green
361 # First remove the old compile dir since it might clash with the new one if
362 # some things (paths!) are changed!
363 if [ -d "$TMPDIR/$PKGCONFIG_VERSION" ]
365 rm -rf $TMPDIR/$PKGCONFIG_VERSION
367 tar -xzf $TMPDIR/$PKGCONFIG_ARCHIVE -C $TMPDIR/
370 cecho "Configuring, compiling and installing pkg-config into your SDK" $green
371 cd $TMPDIR/$PKGCONFIG_VERSION
372 ./configure --libdir=$PNDSDK/usr/lib --program-prefix=arm-none-linux-gnueabi- --prefix=$PNDSDK
375 cecho "ERROR: Configure for pkg-config failed, please check the output above" $red
381 cecho "ERROR: make && make install for pkg-config failed, please check the output above" $red
388 gather_package_list()
391 cecho "Fetching a package list to use for installing the libs" $green
392 # General idea in this section:
393 # 1) Get a list with *all* feeds that openpandora.org does have.
394 # 2) Get the plain package names from those lists. Those package names will
395 # be used as input for opkg later on.
396 # 3) remove some "known to be useless" entries trying to only keep all
397 # devel related packages as well as the static packages.
399 # Get stamp files from all relevant folders. If new feeds are added, this
400 # section has to be extended.
401 wget --output-document=$TMPDIR/Packages.stamps.all http://www.openpandora.org/feeds/unstable/all/Packages.stamps
402 wget --output-document=$TMPDIR/Packages.stamps.armv7a http://www.openpandora.org/feeds/unstable/armv7a/Packages.stamps
403 wget --output-document=$TMPDIR/Packages.stamps.omap3-pandora http://www.openpandora.org/feeds/unstable/omap3-pandora/Packages.stamps
405 # Transform the list into package names only and sort the list alphabetically.
406 cat $TMPDIR/Packages.stamps.* | cut -f 2 -d " " | cut -f 1 -d "_" | sort > $TMPDIR/packages.txt.tmp1
407 # Remove duplicate entries.
408 awk '!x[$0]++' $TMPDIR/packages.txt.tmp1 > $TMPDIR/packages.txt.tmp2
410 # Remove lots of useless stuff (useless for the sdk!) as well as missing
411 # things. If more packages should be removed, extend the list of "grep -v"
413 cat $TMPDIR/packages.txt.tmp2 | grep -E "\-dev$|\-devel$|\-dev\-|\-static$" | \
414 grep -v "^abiword" | \
415 grep -v "^libgoffice" | \
416 grep -v "^claws-mail" | \
417 grep -v "^gnumeric" | \
418 grep -v "^pidgin" | \
419 grep -v "^xfwm4-theme" | \
420 grep -v "^u-boot-omap3pandora-dev" | \
421 grep -v "^asio-dev" | \
422 grep -v "^dhcp-dev" | \
423 grep -v "^libnet-dev" | \
424 grep -v "^dropbear-dev" | \
425 grep -v "^libstdc++-dev" | \
426 grep -v "^angstrom-feed-configs-dev" | \
427 grep -v "^coreutils-dev" | \
429 > $TMPDIR/packages.txt
432 rm $TMPDIR/packages.txt.tmp* $TMPDIR/Packages.stamps.*
435 cecho "Finished creation of $TMPDIR/packages.txt" $green
439 install_libs_via_opkg()
442 cecho "Updating opkg package feeds" $green
443 #update repository against latest version
444 $PNDSDK/bin/opkg-cl --conf=$PNDSDK/opkg.conf --offline-root=$PNDSDK update
447 cecho "Installing all libs, based on $TMPDIR/packages.txt" $green
448 cecho "Error messages from opkg about missing dependencies can be ignored!" $cyan
449 #install all possible dev packages adding their deps, too
450 $PNDSDK/bin/opkg-cl --conf=$PNDSDK/opkg.conf --cache=$TMPDIR --offline-root=$PNDSDK install `cat $TMPDIR/packages.txt | cut -f 1 -d " " | xargs echo`
451 cecho "The error messages from opkg about missing dependencies can be ignored!" $cyan
454 cecho "Removing packages that break the toolchain otherwise" $green
455 #"libstdc++-dev" does always get installed but it will break things, so directly remove it again...
456 $PNDSDK/bin/opkg-cl --conf=$PNDSDK/opkg.conf --offline-root=$PNDSDK remove libstdc++-dev
459 cecho "Removing ARM binaries from the host" $green
460 # After installing all those lovely programs, remove all files that are
461 # inside a "bin/" folder and belong to arm architecture.
462 # Steps taken for this:
463 # 1) find all files inside the installed sdk with "bin/" in their path
464 # 2) call "file" on each file
465 # 3) get all files that include ", ARM," in the output, those only run on
466 # the target arch, not on the host system
467 # 4) filter out things that are part of the codesourcery sdk, no idea what
468 # those files with ARM arch are included, but it might have a reason
469 # 5) only use the filename of the output
470 # 6) get rid of the offending files using rm via xargs
471 find $PNDSDK -wholename "*/bin/*" -exec file '{}' \; | grep ", ARM," | grep -v "arm-none-linux-gnueabi" | cut -f1 -d ":" | xargs rm
474 cecho "Removing broken symlinks" $green
475 # Find broken symlinks and remove them; since the sdk works and the links
476 # *are* not working, removing them should not cause further issues...
477 # Based upon http://www.zulustips.com/2007/01/26/how-to-find-broken-symlinks.html
478 for i in `find $PNDSDK/ -type l`; do [ -e $i ] || rm $i; done
482 cecho "Completed installation of libraries via opkg" $green
489 cecho "Fixing libs and symlinks" $green
491 # In case the libpng-config is missing (this is currently the case!) create
493 if [ ! -f "$PNDSDK/usr/bin/libpng-config" ]
495 cecho "No $PNDSDK/usr/bin/libpng-config found, creating one" $green
496 cat > $PNDSDK/usr/bin/libpng-config <<_END_
500 # provides configuration info for libpng.
502 # Copyright (C) 2002, 2004, 2006, 2007 Glenn Randers-Pehrson
504 # This code is released under the libpng license.
505 # For conditions of distribution and use, see the disclaimer
506 # and license in png.h
508 # Modeled after libxml-config.
512 exec_prefix="\${prefix}"
513 libdir="$PNDSDK/usr/lib"
514 includedir="\${prefix}/include/libpng12"
516 all_libs="-lpng12 -lz -lm "
517 I_opts="-I\${includedir}"
518 L_opts="-L\${libdir}"
527 Usage: \$0 [OPTION] ...
529 Known values for OPTION are:
531 --prefix print libpng prefix
532 --libdir print path to directory containing library
533 --libs print library linking information
534 --ccopts print compiler options
535 --cppflags print pre-processor flags
536 --cflags print preprocessor flags, I_opts, and compiler options
537 --I_opts print "-I" include options
538 --L_opts print linker "-L" flags for dynamic linking
539 --R_opts print dynamic linker "-R" or "-rpath" flags
540 --ldopts print linker options
541 --ldflags print linker flags (ldopts, L_opts, R_opts, and libs)
542 --static revise subsequent outputs for static linking
543 --help print this help and exit
544 --version print version information
550 if test \$# -eq 0; then
554 while test \$# -gt 0; do
579 echo \${I_opts} \${cppflags} \${ccopts}
607 echo \${ldopts} \${L_opts} \${R_opts} \${libs}
626 chmod +x $PNDSDK/usr/bin/libpng-config
627 ln -s $PNDSDK/usr/bin/libpng-config $PNDSDK/usr/bin/libpng12-config
630 # In case the lua5.1.pc is missing (this is currently the case!) create
632 if [ ! -f "$PNDSDK/usr/lib/pkgconfig/lua5.1.pc" ]
634 cecho "No $PNDSDK/usr/lib/pkgconfig/lua5.1.pc found, creating one" $green
635 cat > $PNDSDK/usr/lib/pkgconfig/lua5.1.pc <<_END_
636 # lua.pc -- pkg-config data for Lua
638 # vars from install Makefile
640 # grep '^V=' ../Makefile
643 # grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/'
645 INSTALL_BIN= \${prefix}/bin
646 INSTALL_INC= \${prefix}/include
647 INSTALL_LIB= \${prefix}/lib
648 INSTALL_MAN= \${prefix}/man/man1
649 INSTALL_LMOD= \${prefix}/share/lua/\${V}
650 INSTALL_CMOD= \${prefix}/lib/lua/\${V}
652 exec_prefix=\${prefix}
653 libdir=\${exec_prefix}/lib
654 includedir=\${prefix}/include
657 Description: An Extensible Extension Language
660 Libs: -L\${libdir} -llua -lm
661 Cflags: -I\${includedir}
666 # update library/include paths
667 ln -s $PNDSDK/usr/bin/sdl-config $PNDSDK/usr/bin/arm-none-linux-gnueabi-sdl-config
668 ln -s $PNDSDK/usr/bin/libpng-config $PNDSDK/usr/bin/arm-none-linux-gnueabi-libpng-config
669 ln -s $PNDSDK/usr/bin/freetype-config $PNDSDK/usr/bin/arm-none-linux-gnueabi-freetype-config
671 # add some symlinks so that the compiler can eg be called as "pandora-gcc"
672 # (requested by JayFoxRox in #openpandora)
673 for i in $(find $PNDSDK -wholename "*bin/$TARGET_SYS*")
676 ln -s $i `echo $i|sed "s,$TARGET_SYS,pandora,g"`
680 # For compilation using qmake "plain" .so files are required for qt4, by
681 # default only libQT*.so.4 (and more precise version numbers) are
682 # installed. Adding symlinks to work around this problem.
683 for i in $(find $PNDSDK -name "libQt*.so.4")
685 ln -s $i `echo $i | sed "s#\.so\.4#\.so#g"`
688 SEDCMD="s#/usr/local/pandora#$PNDSDK_DIR#g;s#prefix=\/.*#prefix=$PNDSDK/usr#g;s#includedir=\/.*#includedir=$PNDSDK/usr/include#g;s#libdir=\/.*#libdir='$PNDSDK/usr/lib'#;s# /usr/lib/lib\([A-Z0-9a-z.-]*\).la# $PNDSDK/usr/lib/lib\1.la#g;s# /usr/lib# $PNDSDK/usr/lib#g;s#-L/usr/lib#-L$PNDSDK/usr/lib#g;s#-R/usr/lib#-R$PNDSDK/usr/lib#g;s#-I/usr/include#-I$PNDSDK/usr/include#g;s#-isystem\/.*\b##g"
690 cecho "Fixing paths inside *la, *pc and files in usr/bin/" $green
691 for i in $(find $PNDSDK/usr/lib -name '*la'; find $PNDSDK/usr/lib/pkgconfig -name '*pc';find $PNDSDK/usr/bin -type f);do
697 for list in libc libpthread
699 sed -e 's#\/usr\/lib\/##g' $PNDSDK/usr/lib/$list.so > $PNDSDK/usr/lib/$list.so.new
700 mv $PNDSDK/usr/lib/$list.so.new $PNDSDK/usr/lib/$list.so
702 sed -e 's#\/lib\/##g' $PNDSDK/usr/lib/$list.so > $PNDSDK/usr/lib/$list.so.new
703 mv $PNDSDK/usr/lib/$list.so.new $PNDSDK/usr/lib/$list.so
706 # add some symlinks for include files that were placed in subfolders
707 # a recommended step from sebt3 to make sure that headers can be found
708 cd $PNDSDK/usr/include
722 cecho "Applied known fixes, things should work now..." $green
729 cecho "Creating additional files in $USEFUL_TOOLS_DIR" $green
730 if [ ! -d "$USEFUL_TOOLS_DIR" ]
732 cecho "Creating dir those additional files" $green
733 mkdir -p $USEFUL_TOOLS_DIR
736 cecho "Creating $USEFUL_TOOLS_DIR/PandoraToolchain.cmake" $green
737 # Create default cmake toolchain file.
738 cat > $USEFUL_TOOLS_DIR/PandoraToolchain.cmake <<_END_
739 # this one is important
740 SET(CMAKE_SYSTEM_NAME Linux)
742 # specify the cross compiler
743 SET(CMAKE_C_COMPILER $PNDSDK/bin/arm-none-linux-gnueabi-gcc)
744 SET(CMAKE_CXX_COMPILER $PNDSDK/bin/arm-none-linux-gnueabi-g++)
746 # where is the target environment
747 SET(CMAKE_FIND_ROOT_PATH $PNDSDK/)
749 # search for programs in the build host directories
750 SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
751 # for libraries and headers in the target directories
752 SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
753 SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
755 #usage sample with the sample case "wesnoth":
757 #PATH=$PNDSDK/usr/bin:\$PATH CFLAGS="-DPANDORA -O2 -pipe -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=soft -ffast-math -fsingle-precision-constant -fno-inline-functions" CXXFLAGS="-DPANDORA -O2 -pipe -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=soft -ffast-math -fsingle-precision-constant -fno-inline-functions" cmake -DCMAKE_BUILD_TYPE=release -DENABLE_STRICT_COMPILATION=off -DCMAKE_TOOLCHAIN_FILE=$USEFUL_TOOLS_DIR/PandoraToolchain.cmake -DPKG_CONFIG_EXECUTABLE=$PNDSDK/bin/arm-none-linux-gnueabi-pkg-config -DSDL_CONFIG=$PNDSDK/usr/bin/sdl-config -DLUA_MATH_LIBRARY=$PNDSDK/arm-none-linux-gnueabi/libc/usr/lib/libm.so -DPREFERENCES_DIR=wesnoth-1.8_userdata ../wesnoth-1.8.x
760 #PATH=$PNDSDK/usr/bin:\$PATH CFLAGS="-DPANDORA -O2 -pipe -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=soft -ffast-math -fsingle-precision-constant -fno-inline-functions" CXXFLAGS="-DPANDORA -O2 -pipe -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=soft -ffast-math -fsingle-precision-constant -fno-inline-functions" cmake -DCMAKE_BUILD_TYPE=release -DENABLE_STRICT_COMPILATION=off -DCMAKE_TOOLCHAIN_FILE=$USEFUL_TOOLS_DIR/PandoraToolchain.cmake -DPKG_CONFIG_EXECUTABLE=$PNDSDK/bin/arm-none-linux-gnueabi-pkg-config -DSDL_CONFIG=$PNDSDK/usr/bin/sdl-config -DLIBINTL_INCLUDE_DIR=$PNDSDK/arm-none-linux-gnueabi/libc/usr/include/ -DPREFERENCES_DIR=wesnoth-1.9_userdata ../wesnoth-1.9.x
763 cecho "Creating $USEFUL_TOOLS_DIR/pandora_configure.sh" $green
764 # Create a script that makes using autotool based build systems easier.
765 cat > $USEFUL_TOOLS_DIR/pandora_configure.sh <<_END_
768 # This script is supposed to ease using the crosscompiler toolchain for the
769 # pandora with configure based build systems.
772 # from inside the dir where you normally run a commandline like the following:
773 # ./configure --prefix=\$HOME/pandora-dev/testcase --disable-strict-compilation
774 # run this instead to have everything setup for cross compilation:
775 # $USEFUL_TOOLS_DIR/pandora_configure.sh --prefix=\$HOME/pandora-dev/testcase --disable-strict-compilation
776 # afterwards call 'make' and 'make install', as you are used to. For
777 # 'make install' you should define a '--prefix=' or you might get problems with
778 # your normal system.
781 TARGET_SYS=$TARGET_SYS
782 CROSSTOOL="\$PNDSDK/bin/\$TARGET_SYS"
784 #on single long line with all the env vars that make sense to have...
785 PATH=\$PNDSDK/bin:\$PNDSDK/usr/bin:\$PATH \\
786 LIBTOOL_SYSROOT_PATH=\$PNDSDK \\
787 PKG_CONFIG_PATH=\$PNDSDK/usr/lib/pkgconfig \\
788 PKG_CONFIG=\$PNDSDK/bin/arm-none-linux-gnueabi-pkg-config \\
789 CPATH="\$PNDSDK/usr/include:\$CPATH" \\
790 CFLAGS="-DPANDORA -Os -pipe -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant" \\
791 CPPFLAGS="-DPANDORA -Os -pipe -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant" \\
792 CXXFLAGS="-I\$PNDSDK/usr/include" \\
793 LDFLAGS="-L\$PNDSDK/usr/lib -Wl,-rpath,\$PNDSDK/usr/lib" \\
794 CXX=\$CROSSTOOL-g++ \\
795 CC=\$CROSSTOOL-gcc \\
798 RANLIB=\$CROSSTOOL-ranlib \\
799 STRIP=\$CROSSTOOL-strip \\
802 ./configure --host=\$TARGET_SYS --with-gnu-ld \$*
804 if [ "\$?" -eq "0" ];
808 echo "Running ./configure was completed. You can now run 'make'. In case you see any"
809 echo "problems with your systems include dir being used when running 'make', please"
810 echo "betry to export the changed CPATH value. This export will likely be problematic"
811 echo "if you want to build non crosscompiled programs in the shell. General advice is"
812 echo "to close the current shell after you are done, so that the changed CPATH"
813 echo "environment variable is discarded. The export should look like this:"
814 echo "export CPATH=\"\$PNDSDK/usr/include:\\\$CPATH\""
815 echo "After exporting you can run 'make' just as you are used to."
818 chmod +x $USEFUL_TOOLS_DIR/pandora_configure.sh
820 cecho "Creating $USEFUL_TOOLS_DIR/opkg-pandora.sh" $green
821 # Create a script that makes running opkg easier.
822 cat > $USEFUL_TOOLS_DIR/opkg-pandora.sh <<_END_
825 # This script is supposed to ease using the opkg package manager with the sdk.
828 # to get a list of installed packages you would normally run
829 # opkg-cl list-installed
830 # With the sdk this is not possible because you have to provide many
831 # parameters. Instead use this script which will directly provide the params:
832 # $USEFUL_TOOLS_DIR/opkg-pandora.sh list-installed
833 # This script does act as if it would be opkg. Be aware that with using the
834 # script you will likely create some problems and should rerun the script for
835 # fixing libs and various config files!
840 \$PNDSDK/bin/opkg-cl --conf=\$PNDSDK/opkg.conf --offline-root=\$PNDSDK \$*
842 chmod +x $USEFUL_TOOLS_DIR/opkg-pandora.sh
844 cecho "Creating $USEFUL_TOOLS_DIR/fix-libs.sh" $green
845 # Create a script that fixes lib entries.
846 cat > $USEFUL_TOOLS_DIR/fix-libs.sh <<_END_
849 # This script will fix your libs after running opkg tasks. You should always
850 # after using opkg to make sure that your libs are working.
852 PNDSDK_DIR=$PNDSDK_DIR
855 SEDCMD="s#/usr/local/pandora#\$PNDSDK_DIR#g;s#prefix=\/.*#prefix=\$PNDSDK/usr#g;s#includedir=\/.*#includedir=\$PNDSDK/usr/include#g;s#libdir=\/.*#libdir='\$PNDSDK/usr/lib'#;s# /usr/lib/lib\([A-Z0-9a-z.-]*\).la# \$PNDSDK/usr/lib/lib\1.la#g;s# /usr/lib# \$PNDSDK/usr/lib#g;s#-L/usr/lib#-L\$PNDSDK/usr/lib#g;s#-R/usr/lib#-R\$PNDSDK/usr/lib#g;s#-I/usr/include#-I\$PNDSDK/usr/include#g;s#-isystem\/.*\b##g"
857 echo "Fixing paths inside *la, *pc and files in usr/bin/"
858 for i in \$(find \$PNDSDK/usr/lib -name '*la'; find \$PNDSDK/usr/lib/pkgconfig -name '*pc';find \$PNDSDK/usr/bin -type f);do
860 sed -i "\$SEDCMD" \$i
864 for list in libc libpthread
866 sed -e 's#\/usr\/lib\/##g' \$PNDSDK/usr/lib/\$list.so > \$PNDSDK/usr/lib/\$list.so.new
867 mv \$PNDSDK/usr/lib/\$list.so.new \$PNDSDK/usr/lib/\$list.so
869 sed -e 's#\/lib\/##g' \$PNDSDK/usr/lib/\$list.so > \$PNDSDK/usr/lib/\$list.so.new
870 mv \$PNDSDK/usr/lib/\$list.so.new \$PNDSDK/usr/lib/\$list.so
873 # add some symlinks for include files that were placed in subfolders
874 # a recommended step from sebt3 to make sure that headers can be found
875 cd \$PNDSDK/usr/include
878 for j in \$(ls -1 \$i)
887 chmod +x $USEFUL_TOOLS_DIR/fix-libs.sh
889 cecho "Creating $USEFUL_TOOLS_DIR/PXML_schema.xsd" $green
890 # Create the PXML schema file
891 cat > $USEFUL_TOOLS_DIR/PXML_schema.xsd <<_END_
892 <?xml version="1.0" encoding="utf-8"?>
893 <xs:schema targetNamespace="http://openpandora.org/namespaces/PXML" xmlns="http://openpandora.org/namespaces/PXML" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
896 <!-- declare some simpleTypes for later usage -->
898 <!-- Specify params allows with the 'x11' entry in exec -->
899 <xs:simpleType name="x11Param">
900 <xs:restriction base="xs:string">
901 <xs:enumeration value="req" />
902 <xs:enumeration value="stop" />
903 <xs:enumeration value="ignore" />
907 <!-- Specify the valid documentation formats in the <info> block -->
908 <xs:simpleType name="docType">
909 <xs:restriction base="xs:string">
910 <xs:enumeration value="text/html" />
911 <xs:enumeration value="text/plain" />
915 <!-- Make sure that version numbers only consist of letters, numbers and + as well as - -->
916 <xs:simpleType name="versionNumber">
917 <xs:restriction base="xs:string">
918 <xs:minLength value="1"/>
919 <xs:pattern value="[a-zA-Z0-9+-]*" />
923 <!-- Specify what is valid as release type -->
924 <xs:simpleType name="releaseType">
925 <xs:restriction base="xs:string">
926 <xs:enumeration value="alpha" />
927 <xs:enumeration value="beta" />
928 <xs:enumeration value="release" />
932 <!-- Specify what makes an email address "valid" -->
933 <xs:simpleType name="emailAddress">
934 <xs:restriction base="xs:string">
935 <xs:pattern value="[^@]+@[^\.]+\..+"/>
939 <!-- some restrictions regarding file names that are eg not allowed/possible when using sd cards formated as fat32 -->
940 <xs:simpleType name="dumbPath">
941 <xs:restriction base="xs:normalizedString">
942 <xs:pattern value="[^?>:]+" />
945 <xs:simpleType name="dumbFolderName">
946 <xs:restriction base="xs:normalizedString">
947 <xs:pattern value="[^?>:/]+" />
951 <!-- Specify lang codes -->
952 <xs:simpleType name="isoLangcode">
953 <xs:restriction base="xs:string">
954 <xs:minLength value="2"/>
955 <xs:pattern value="[a-zA-Z]{2,3}(_[a-zA-Z0-9]{2,3})*" />
958 <xs:simpleType name="isoLangcode_en_US">
959 <xs:restriction base="xs:string">
960 <xs:enumeration value="en_US" />
964 <!-- Definition of all allowed categories following the FDO specs -->
965 <xs:simpleType name="fdoCategory">
966 <xs:restriction base="xs:string">
967 <xs:pattern value="AudioVideo|Audio|Video|Development|Education|Game|Graphics|Network|Office|Settings|System|Utility"/>
970 <!-- Definition of all allowed subcategories following the FDO specs (should be based upon the given main categories, but would significantly increase complexity of the schema) -->
971 <xs:simpleType name="fdoSubCategory">
972 <xs:restriction base="xs:string">
973 <xs:pattern value="Building|Debugger|IDE|GUIDesigner|Profiling|RevisionControl|Translation|Calendar|ContactManagement|Database|Dictionary|Chart|Email|Finance|FlowChart|PDA|ProjectManagement|Presentation|Spreadsheet|WordProcessor|2DGraphics|VectorGraphics|RasterGraphics|3DGraphics|Scanning|OCR|Photography|Publishing|Viewer|TextTools|DesktopSettings|HardwareSettings|Printing|PackageManager|Dialup|InstantMessaging|Chat|IRCClient|FileTransfer|HamRadio|News|P2P|RemoteAccess|Telephony|TelephonyTools|VideoConference|WebBrowser|WebDevelopment|Midi|Mixer|Sequencer|Tuner|TV|AudioVideoEditing|Player|Recorder|DiscBurning|ActionGame|AdventureGame|ArcadeGame|BoardGame|BlocksGame|CardGame|KidsGame|LogicGame|RolePlaying|Simulation|SportsGame|StrategyGame|Art|Construction|Music|Languages|Science|ArtificialIntelligence|Astronomy|Biology|Chemistry|ComputerScience|DataVisualization|Economy|Electricity|Geography|Geology|Geoscience|History|ImageProcessing|Literature|Math|NumericalAnalysis|MedicalSoftware|Physics|Robotics|Sports|ParallelComputing|Amusement|Archiving|Compression|Electronics|Emulator|Engineering|FileTools|FileManager|TerminalEmulator|Filesystem|Monitor|Security|Accessibility|Calculator|Clock|TextEditor|Documentation|Core|KDE|GNOME|GTK|Qt|Motif|Java|ConsoleOnly"/>
977 <!-- Create some way to enforce entries to be nonempty -->
978 <xs:simpleType name="nonempty_token">
979 <xs:restriction base="xs:token">
980 <xs:minLength value="1"/>
983 <xs:simpleType name="nonempty_string">
984 <xs:restriction base="xs:string">
985 <xs:minLength value="1"/>
988 <xs:simpleType name="nonempty_normalizedString">
989 <xs:restriction base="xs:string">
990 <xs:minLength value="1"/>
996 <!-- declare some complexTypes for later usage -->
998 <!-- type used for file associations -->
999 <xs:complexType name="association_data">
1000 <xs:attribute name="name" use="required" type="nonempty_normalizedString" />
1001 <xs:attribute name="filetype" use="required" type="nonempty_token" />
1002 <xs:attribute name="exec" use="required" type="nonempty_token" />
1005 <!-- type used for author info -->
1006 <xs:complexType name="author_data">
1007 <xs:attribute name="name" use="required" type="nonempty_normalizedString" />
1008 <xs:attribute name="website" use="optional" type="xs:anyURI" />
1009 <xs:attribute name="email" use="optional" type="emailAddress" />
1012 <!-- type used for version informations (full entry as well as os version) -->
1013 <xs:complexType name="app_version_info">
1014 <xs:attribute name="major" use="required" type="versionNumber" />
1015 <xs:attribute name="minor" use="required" type="versionNumber" />
1016 <xs:attribute name="release" use="required" type="versionNumber" />
1017 <xs:attribute name="build" use="required" type="versionNumber" />
1018 <xs:attribute name="type" use="optional" type="releaseType" />
1020 <xs:complexType name="os_version_info">
1021 <xs:attribute name="major" use="required" type="versionNumber" />
1022 <xs:attribute name="minor" use="required" type="versionNumber" />
1023 <xs:attribute name="release" use="required" type="versionNumber" />
1024 <xs:attribute name="build" use="required" type="versionNumber" />
1027 <!-- type used for exec entries -->
1028 <xs:complexType name="exec_params">
1029 <xs:attribute name="command" use="required" type="nonempty_token" />
1030 <xs:attribute name="arguments" use="optional" type="nonempty_token" />
1031 <xs:attribute name="background" use="optional" type="xs:boolean" />
1032 <xs:attribute name="startdir" use="optional" type="dumbPath" />
1033 <xs:attribute name="standalone" use="optional" type="xs:boolean" />
1034 <xs:attribute name="x11" use="optional" type="x11Param" />
1037 <!-- type used for tiles or descriptions, once in 'normal' version, once enforcing usage of en_US -->
1038 <xs:complexType name="title_or_description">
1040 <xs:extension base="nonempty_string">
1041 <xs:attribute name="lang" use="required" type="isoLangcode" />
1045 <xs:complexType name="title_or_description_enUS">
1047 <xs:extension base="nonempty_string">
1048 <xs:attribute name="lang" use="required" type="isoLangcode_en_US" />
1053 <!-- type used for referencing images -->
1054 <xs:complexType name="image_entry">
1055 <xs:attribute name="src" use="required" type="dumbPath" />
1058 <!-- type for referencing manuals/readme docs -->
1059 <xs:complexType name="information_entry">
1060 <xs:attribute name="name" use="required" type="nonempty_normalizedString" />
1061 <xs:attribute name="type" use="required" type="docType" />
1062 <xs:attribute name="src" use="required" type="dumbPath" />
1065 <!-- type used for the license information -->
1066 <xs:complexType name="license_info">
1067 <xs:attribute name="name" use="required" type="nonempty_normalizedString" />
1068 <xs:attribute name="url" use="optional" type="xs:anyURI" />
1069 <xs:attribute name="sourcecodeurl" use="optional" type="xs:anyURI" />
1074 <!-- Combine the symple and complex types into the "real" PXML specification -->
1076 <xs:element name="PXML">
1079 <!-- specify the <package> tag with info about the complete package, information providable:
1086 <xs:element name="package" minOccurs="1" maxOccurs="1">
1090 <xs:element name="author" type="author_data" minOccurs="1" />
1091 <!--App version info-->
1092 <xs:element name="version" type="app_version_info" minOccurs="1" />
1094 <xs:element name="titles" minOccurs="1">
1097 <xs:element name="title" type="title_or_description_enUS" minOccurs="1" maxOccurs="1" />
1098 <xs:element name="title" type="title_or_description" minOccurs="0" maxOccurs="unbounded" />
1103 <xs:element name="descriptions" minOccurs="0">
1106 <xs:element name="title" type="title_or_description_enUS" minOccurs="0" maxOccurs="1" />
1107 <xs:element name="description" type="title_or_description" minOccurs="0" maxOccurs="unbounded" />
1112 <xs:element name="icon" type="image_entry" minOccurs="0" />
1115 <xs:attribute name="id" use="required" type="dumbFolderName" />
1118 <!-- specify the <application> tag with info about a single program
1121 version (of the application)
1122 osversion (min OS version supported)
1123 title(s) (allowing compatibility to <HF6, too!)
1124 description(s) (allowing compatibility to <HF6, too!)
1128 info/manual/readme entry
1130 associations to file types
1133 <xs:element name="application" minOccurs="1" maxOccurs="unbounded">
1136 <!--Execution params -->
1137 <xs:element name="exec" type="exec_params" minOccurs="1" />
1139 <xs:element name="author" type="author_data" minOccurs="1" />
1140 <!--App version info-->
1141 <xs:element name="version" type="app_version_info" minOccurs="1" />
1142 <!--OS Version info-->
1143 <xs:element name="osversion" type="os_version_info" minOccurs="0" />
1145 <!-- via <titles> element, used for HF6+ -->
1146 <xs:element name="titles" minOccurs="1">
1149 <xs:element name="title" type="title_or_description_enUS" minOccurs="1" maxOccurs="1" />
1150 <xs:element name="title" type="title_or_description" minOccurs="0" maxOccurs="unbounded" />
1155 <!-- via <title> element, only one for en_US allowed, meant for backwards compatibility with libpnd from <HF6 -->
1156 <xs:element name="title" type="title_or_description_enUS" minOccurs="0" />
1158 <!-- via <descriptions> element, used for HF6+ -->
1159 <xs:element name="descriptions" minOccurs="0">
1162 <xs:element name="description" type="title_or_description_enUS" minOccurs="1" maxOccurs="1" />
1163 <xs:element name="description" type="title_or_description" minOccurs="0" maxOccurs="unbounded" />
1168 <!-- via <description> element, only one for en_US allowed, meant for backwards compatibility with libpnd from <HF6 -->
1169 <xs:element name="description" type="title_or_description_enUS" minOccurs="0" />
1171 <xs:element name="icon" type="image_entry" minOccurs="0" />
1173 <xs:element name="licenses" minOccurs="1">
1176 <xs:element name="license" type="license_info" minOccurs="1" maxOccurs="unbounded" />
1181 <xs:element name="previewpics" minOccurs="0">
1184 <xs:element name="pic" type="image_entry" minOccurs="0" maxOccurs="unbounded" />
1188 <!--Info (aka manual or readme entry)-->
1189 <xs:element name="info" type="information_entry" minOccurs="0" />
1191 <xs:element name="categories" minOccurs="1">
1194 <xs:element name="category" minOccurs="1" maxOccurs="unbounded">
1197 <xs:element name="subcategory" minOccurs="0" maxOccurs="unbounded">
1199 <xs:attribute name="name" type="fdoSubCategory" />
1203 <xs:attribute name="name" use="required" type="fdoCategory" />
1210 <xs:element name="associations" minOccurs="0">
1213 <xs:element name="association" type="association_data" maxOccurs="unbounded" />
1218 <xs:element name="clockspeed" minOccurs="0">
1220 <xs:attribute name="frequency" use="required" type="xs:positiveInteger" />
1225 <xs:attribute name="id" use="required" type="dumbFolderName" />
1226 <xs:attribute name="appdata" use="optional" type="dumbFolderName" />
1235 cecho "Creating $USEFUL_TOOLS_DIR/pnd_make.sh" $green
1236 # Create a script for creating pnd packages.
1237 cat > $USEFUL_TOOLS_DIR/pnd_make.sh <<_END_
1242 # This script is meant to ease generation of a pnd file. Please consult the output
1243 # when running --help for a list of available parameters and an explaination of
1246 # Required tools when running the script:
1249 # mkisofs or mksquashfs (the latter when using the -c param!)
1250 # xmllint (optional, only for validation of the PXML against the schema)
1253 PXML_schema=\$(dirname \${0})/PXML_schema.xsd
1254 GENPXML_PATH=\$(dirname \${0})/genpxml.sh
1256 # useful functions ...
1268 which \$1 &> /dev/null
1269 if [ "\$?" -ne "0" ];
1271 cecho "ERROR: Could not find the program '\$1'. Please make sure
1272 that it is available in your PATH since it is required to complete your request." \$red
1277 cecho () # Color-echo. Argument \$1 = message, Argument \$2 = color
1279 local default_msg="No message passed." # Doesn't really need to be a local variable.
1280 message=\${1:-\$default_msg} # Defaults to default message.
1281 color=\${2:-\$black} # Defaults to black, if not specified.
1282 echo -e "\$color\$message"
1283 tput sgr0 # Reset to normal.
1291 pnd_make.sh - A script to package "something" into a PND.
1294 \$(basename \${0}) {--directory|-d} <folder> {--pndname|-p} <file> [{--compress-squashfs|-c}]
1295 [{--genpxml} <file>] [{--icon|-i} <file>] [{--pxml|-x} <file>]
1296 [{--schema|-s} <file>] [{--help|-h}]
1300 --compress-squashfs / -c Define whether or not the pnd should be compressed using
1301 squashfs. If this parameter is selected, a compressed pnd
1304 --directory / -d Sets the folder that is to be used for the resulting pnd
1305 to <folder>. This option is mandatory for the script to
1308 --genpxml Sets the script used for generating a PXML file (if none
1309 is available already) to <file>. Please make sure to either
1310 provide a full path or prefix a script in the current folder
1311 with './' so that the script can actually be executed. If
1312 this variable is not specified, \$GENPXML_PATH
1315 --help / -h Displays this help text.
1317 --icon / -i Sets the icon that will be appended in the pnd to <file>.
1319 --pndname / -p Sets the output filename of the resulting pnd to <file>.
1320 This option is mandatory for the script to function
1323 --pxml / -x Sets the PXML file that is to be used to <file>. If you
1324 neither provide a PXML file or set this entry to 'guess',
1325 an existing 'PXML.xml' in your selected '--directory'
1326 will be used, or the script \$GENPXML_PATH
1327 will be called to try to generate a basic PXML file for you.
1329 --schema / -s Sets the schema file, that is to be used for validation,
1330 to <file. If this is not defined, the script will try to
1331 use the file '\$PXML_schema'. If this fails,
1332 a warning is issued.
1334 If you select the option to create a compressed squashfs, a version >=4.0 of squashfs
1335 is required to be available in your PATH.
1340 # Parse command line parameters
1341 while [ "\${1}" != "" ]; do
1342 if [ "\${1}" = "--compress-squashfs" ] || [ "\${1}" = "-c" ];
1346 elif [ "\${1}" = "--directory" ] || [ "\${1}" = "-d" ];
1350 elif [ "\${1}" = "--genpxml" ];
1354 elif [ "\${1}" = "--help" ] || [ "\${1}" = "-h" ];
1358 elif [ "\${1}" = "--icon" ] || [ "\${1}" = "-i" ];
1362 elif [ "\${1}" = "--pndname" ] || [ "\${1}" = "-p" ];
1366 elif [ "\${1}" = "--pxml" ] || [ "\${1}" = "-x" ];
1370 elif [ "\${1}" = "--schema" ] || [ "\${1}" = "-f" ]
1375 cecho "ERROR: '\$1' is not a known argument. Printing --help and aborting." \$red
1382 # Generate a PXML if the param is set to Guess or it is empty.
1383 if [ ! \$PXML ] || [ \$PXML = "guess" ] && [ \$PNDNAME ] && [ \$FOLDER ];
1385 if [ -f \$FOLDER/PXML.xml ]; # use the already existing PXML.xml file if there is one...
1387 PXML=\$FOLDER/PXML.xml
1388 PXML_ALREADY_EXISTING="true"
1390 if [ -f \$GENPXML_PATH ];
1392 \$GENPXML_PATH --src \$FOLDER --dest \$FOLDER --author \$USER
1393 if [ -f \$FOLDER/PXML.xml ];
1395 PXML_GENERATED="true"
1397 cecho "ERROR: Generating a PXML file using '\$GENPXML_PATH' failed.
1398 Please generate a PXML file manually." \$red
1402 cecho "ERROR: Could not find '\$GENPXML_PATH' for generating a PXML file." \$red
1409 # Probe if required variables were set
1411 cecho "Checking if all required variables were set." \$green
1412 if [ ! \$PNDNAME ] || [ ! \$FOLDER ] || [ ! \$PXML ];
1415 cecho "ERROR: Not all required options were set! Please see the --help information below." \$red
1420 echo "PNDNAME set to '\$PNDNAME'."
1422 # Check if the selected folder actually exists
1423 if [ ! -d \$FOLDER ];
1426 cecho "ERROR: '\$FOLDER' doesn't exist or is not a folder." \$red
1429 echo "FOLDER set to '\$FOLDER'."
1431 # Check if the selected PXML file actually exists
1435 cecho "ERROR: '\$PXML' doesn't exist or is not a file." \$red
1438 if [ \$PXML_ALREADY_EXISTING ];
1440 echo "You have not explicitly specified a PXML to use, but an existing file was
1441 found. Will be using this one."
1442 elif [ \$PXML_GENERATED ];
1444 echo "A PXML file was generated for you using '\$GENPXML_PATH'. This file will
1445 not be removed at the end of this script because you might want to review it, adjust
1446 single entries and rerun the script to generate a pnd with a PXML file with all the
1447 information you want to have listed."
1449 echo "PXML set to '\$PXML'."
1452 # Print the other variables:
1457 cecho "WARNING: '\$ICON' doesn't exist, will not append the selected icon to the pnd." \$red
1459 echo "ICON set to '\$ICON'."
1465 echo "Will use a squashfs for '\$PNDNAME'."
1469 # Validate the PXML file (if xmllint is available)
1470 # Errors and problems in this section will be shown but are not fatal.
1472 cecho "Trying to validate '\$PXML' now. Will be using '\$PXML_schema' to do so." \$green
1473 which xmllint &> /dev/null
1474 if [ "\$?" -ne "0" ];
1477 cecho "WARNING: Could not find 'xmllint'. Validity check of '\$PXML' is not possible!" \$red
1479 if [ ! -f "\$PXML_schema" ];
1482 cecho "WARNING: Could not find '\$PXML_schema'. If you want to validate your
1483 PXML file please make sure to provide a schema using the --schema option." \$red
1485 xmllint --noout --schema \$PXML_schema \$PXML
1486 if [ "\$?" -ne "0" ]; then VALIDATED=false; else VALIDATED=true; fi
1489 # Print some message at the end about the validation in case the user missed the output above
1490 if [ \$VALIDATED = "false" ]
1492 cecho "WARNING: Could not successfully validate '\$PXML'. Please check the output
1493 above. This does not mean that your pnd will be broken. Either you are not following the strict
1494 syntax required for validation or you don't have all files/programs required for validating." \$red
1496 cecho "Your file '\$PXML' was validated successfully. The resulting pnd should
1497 work nicely with libpnd." \$green
1501 # Make iso from folder
1503 cecho "Creating an iso file based on '\$FOLDER'." \$green
1506 check_for_tool mksquashfs
1507 if [ \$(mksquashfs -version | awk 'BEGIN{r=0} \$3>=4{r=1} END{print r}') -eq 0 ];
1509 cecho "ERROR: Your squashfs version is older then version 4, please upgrade to 4.0 or later" \$red
1512 mksquashfs \$FOLDER \$PNDNAME.iso -nopad -no-recovery
1514 check_for_tool mkisofs
1515 mkisofs -o \$PNDNAME.iso -R \$FOLDER
1518 # Check that the iso file was actually created before continuing
1519 if [ ! -f \$PNDNAME.iso ];
1521 cecho "ERROR: The temporary file '\$PNDNAME.iso' could not be created.
1522 Please check the output above for any errors and retry after fixing them. Aborting." \$red
1527 # Append pxml to iso
1529 cecho "Appending '\$PXML' to the created iso file." \$green
1530 cat \$PNDNAME.iso \$PXML > \$PNDNAME
1531 rm \$PNDNAME.iso #cleanup
1534 # Append icon if specified and available
1538 cecho "Appending the icon '\$ICON' to the pnd." \$green
1539 mv \$PNDNAME \$PNDNAME.tmp
1540 cat \$PNDNAME.tmp \$ICON > \$PNDNAME # append icon
1541 rm \$PNDNAME.tmp #cleanup
1547 if [ -f \$PNDNAME ];
1549 cecho "Successfully finished creating the pnd '\$PNDNAME'." \$green
1551 cecho "There seems to have been a problem and '\$PNDNAME' was not created. Please check
1552 the output above for any error messages. A possible cause for this is that there was
1553 not enough space available." \$red
1558 #if [ \$PXML = "guess" ];then rm \$FOLDER/PXML.xml; fi #cleanup
1560 chmod +x $USEFUL_TOOLS_DIR/pnd_make.sh
1562 cecho "Creating $USEFUL_TOOLS_DIR/genpxml.sh" $green
1563 # Create a script that generates a basic PXML.xml file.
1564 cat > $USEFUL_TOOLS_DIR/genpxml.sh <<_END_
1570 -s|--src <src dir> : Define source directory (default: \$SRCDIR)
1571 -n|--name <name> : Define the pnd base name (default: \$PND_NAME)
1572 -d|--dest <dest dir> : Define destination directory (default: \$DESTDIR)
1573 -a|--author <name> : programmers names (default: \$AUTHOR)
1574 -v|--version <version> : Define the version (default: \$VERSION)
1575 -w|--website <url> : Define the url (default: \$WEBSITE)
1576 -b|--build <build id> : Define the build number (default: \$BUILD)
1577 -f|--force : overide PXML.xml file if found
1578 -h|--help : show this screen
1586 buildApplicationList(){
1587 #output "<appname> [<desktopfile>]" lines
1589 DESTLST=\$(find \$SRCDIR -name "*desktop";find \$DESTDIR -name "*desktop")
1590 if [ ! -z "\$DESTLST" ];then
1592 for d in \$DESTLST;do
1593 EXE=\$(awk -F= '/Exec/{print \$2}'<\$d|awk '{print \$1}'|head -1)
1594 if [[ "x\$EXE" != "x" ]];then
1595 BIN=\$(find . -executable -type f -name \$(basename \$EXE)|head -1)
1596 echo \${BIN:-\$EXE} \$d
1599 }|sort|awk 'BEGIN{P=""}\$1!=P{print}{P=\$1}'
1601 find . -executable -type f \! -name "*sh"
1607 L=\$(find . -type d -name bin)
1608 echo \$L|sed "s#\./#\$(pwd)/#g;s# #:#g"
1612 L=\$(find . -type d -name lib)
1613 echo \$L|sed "s#\./#\$(pwd)/#g;s# #:#g"
1617 S="\$DESTDIR/scripts/\$(basename \$1).sh"
1623 export PATH="\$(getPATH):\\${PATH:-"/usr/bin:/bin:/usr/local/bin"}"
1624 export LD_LIBRARY_PATH="\$(getLIBPATH):\\${LD_LIBRARY_PATH:-"/usr/lib:/lib"}"
1625 export HOME="/mnt/utmp/\$PND_NAME" XDG_CONFIG_HOME="/mnt/utmp/\$PND_NAME"
1627 if [ -d /mnt/utmp/\$PND_NAME/share ];then
1628 export XDG_DATA_DIRS=/mnt/utmp/\$PND_NAME/share:\\$XDG_DATA_DIRS:/usr/share
1630 export SDL_AUDIODRIVER="alsa"
1632 [ -e "\\$HOME/scripts/pre_script.sh" ] && . \\$HOME/scripts/pre_script.sh
1633 if [ -e "\\$HOME/scripts/post_script.sh" ];then
1635 . \\$HOME/scripts/post_script.sh
1643 desktop2application(){ #generate PXML application info out of a desktop file passed as parameter
1645 if [ ! -z "\$DESK" ];then
1646 DVERSION=\$(awk -F= '\$1=="Version"{print \$2}'<\$1)
1647 if [ -z "\$DVERSION" ] || [[ "\$DVERSION" = "1.0" ]];then
1653 MAJOR=\$(echo \$DVERSION|awk -F. '{print \$1}')
1654 MINOR=\$(echo \$DVERSION|awk -F. '{print \$2}')
1655 REL=\$(echo \$DVERSION|awk -F. '{print \$3}')
1656 MINOR=\${MINOR:-"0"}
1659 # Exec --------------------------
1660 echo " <exec command=\"scripts/\${BASEB}.sh\"/>"
1662 # title -------------------------
1663 if [ ! -z "\$DESK" ];then
1664 #awk -F= '(\$1~/^Name/)||\$1=="Name"{print \$1" "\$2}'<\$1|while read DN DNV;do
1665 awk -F= '(\$1~/^Name/&&/en_US/)||\$1=="Name"{print \$1" "\$2}'<\$1|while read DN DNV;do
1666 l=\$(echo \$DN|sed 's/Name//;s/\[//;s/\]//')
1667 echo " <title lang=\"\${l:-"en_US"}\">\$DNV</title>"
1670 echo " <title lang=\"en_US\">\$PND_NAME</title>"
1674 # Author ------------------------
1675 echo " <author name=\"\$AUTHOR\" website=\"\$WEBSITE\"/>"
1677 # Version -----------------------
1678 echo " <version major=\"\$MAJOR\" minor=\"\$MINOR\" release=\"\$REL\" build=\"\$BUILD\"/> <!--This programs version-->"
1680 # OS Version --------------------
1681 echo " <osversion major=\"1\" minor=\"0\" release=\"0\" build=\"0\"/> <!--The minimum OS version required-->"
1684 # Description -------------------
1685 if [ ! -z "\$DESK" ];then
1686 #awk -F= '(\$1~/^Comment/)||\$1=="Comment"{print \$1" "\$2}'<\$1|while read DN DNV;do
1687 awk -F= '(\$1~/^Comment/&&/en_US/)||\$1=="Comment"{print \$1" "\$2}'<\$1|while read DN DNV;do
1688 l=\$(echo \$DN|sed 's/Comment//;s/\[//;s/\]//')
1689 echo " <description lang=\"\${l:-"en_US"}\">\$DNV</description>"
1692 echo " <description lang=\"en_US\">Automatically generated description from \$(pwd) for PND=\$PND_NAME</description>"
1696 # Icon --------------------------
1698 if [ ! -z "\$DESK" ];then
1699 ICON=\$(awk -F= '\$1~/^Icon/{print \$2}'<\$1)
1701 if [ ! -z "\$ICON" ];then
1702 F=\$(find \$DESTDIR -name \${ICON}.png|head -1)
1703 if [ -z "\$F" ];then
1704 F=\$DESTDIR/icon.png
1706 echo " <icon src="'"'\$F'"/>'
1707 if [ ! -e "\$DESTDIR/icon.png" ] && [ ! -z "\$(find \$DESTDIR -name \${ICON}.png|head -1)" ];then
1708 cp \$(find \$DESTDIR -name \${ICON}.png|head -1) \$DESTDIR/icon.png
1710 elif [ -e "\$DESTDIR/icon.png" ];then
1711 echo " <icon src=\"\$DESTDIR/icon.png\"/>"
1713 echo " <!--<icon src=\"path/to/icon.pnd\"/>-->"
1717 # Preview pics ------------------
1718 if [ ! -z "\$(find \$DESTDIR/previews -name "\$BASEB*")" ];then
1719 echo " <previewpics>"
1720 for i in \$(find \$DESTDIR/previews -name "\$BASEB*");do
1721 echo " <pic src=\"previews/\$(basename \$i)\"/>"
1723 echo " </previewpics>"
1728 <pic src="previews/\${BASEB}.png"/>
1735 # Documentation -----------------
1736 HTML=\$(find \$DESTDIR -type d -name index.html|head -1)
1737 DOC=\$DESTDIR/readme.txt
1738 if [ ! -z "\$HTML" ];then
1739 for i in \$(find \$DESTDIR -type d -name index.html);do
1740 echo " <info name=\"\${BASEB} documentation\" type=\"text/html\" src=\"\$i\"/>"
1742 elif [ -e "\$DOC" ];then
1743 echo " <info name=\"\${BASEB} documentation\" type=\"text/plain\" src=\"\$DOC\"/>"
1745 echo " <!--<info name=\"\${BASEB} documentation\" type=\"text/plain\" src=\"\$DOC\"/>-->"
1748 # Categories --------------------
1752 <!-- http://standards.freedesktop.org/menu-spec/latest/apa.html -->
1755 if [ ! -z "\$DESK" ];then
1756 DCAT=\$(awk -F= '\$1=="Categories"{print \$2}'<\$1)
1760 CATCNT=\$((\$(echo \$DCAT|sed "s/;/ /g"|wc -w) / 2))
1761 if [ \$CATCNT -gt 0 ];then
1762 for i in \$(seq 1 \$CATCNT);do
1763 DCATMAJ=\$(echo \$DCAT|awk -F\; "{print \\$\$((\$i*2-1))}")
1764 DCATMIN=\$(echo \$DCAT|awk -F\; "{print \\$\$((\$i*2))}")
1766 <category name="\$DCATMAJ">
1767 <subcategory name="\$DCATMIN"/>
1773 <category name="Game">
1774 <subcategory name="ArcadeGame"/>
1783 # Associations ------------------
1787 <association name="Deinterlaced Bitmap Image" filetype="image/bmp" exec="-f %s"/>
1788 <association name="Style sheet system crasher" filetype="text/css" exec="-f %s"/>
1793 # ClockSpeed --------------------
1794 echo " <!--<clockspeed frequency=\"600\"/>-->"
1798 # output the PXML.xml file
1799 if [ -e \$DESTDIR/PXML.xml ];then
1800 mv \$DESTDIR/PXML.xml \$DESTDIR/PXML.xml.old
1802 cat >\$DESTDIR/PXML.xml <<ENDHEAD
1803 <?xml version="1.0" encoding="UTF-8"?>
1804 <PXML xmlns="http://openpandora.org/namespaces/PXML">
1805 <!-- please see http://pandorawiki.org/PXML_specification for more information before editing, and remember the order does matter -->
1808 if [ ! -d \$DESTDIR/previews ];then
1809 mkdir -p \$DESTDIR/previews
1811 if [ ! -d \$DESTDIR/scripts ];then
1812 mkdir \$DESTDIR/scripts
1814 buildApplicationList|while read BIN DESK;do
1815 BASEB=\$(basename \$BIN)
1816 genLaunchScript \$BIN
1817 cat >>\$DESTDIR/PXML.xml <<ENDAPP
1818 <application id="\$PND_NAME-\$(basename \$BIN)-\$RND" appdata="\$PND_NAME">
1820 desktop2application \$DESK >>\$DESTDIR/PXML.xml
1821 cat >>\$DESTDIR/PXML.xml <<ENDINFO
1826 echo "</PXML>" >>\$DESTDIR/PXML.xml
1830 #####################
1837 WEBSITE=\${WEBSITE:-"http://www..openpandora.org"}
1838 SRCDIR=\${SRCDIR:-\$(pwd)}
1840 PND_NAME=\${PND_NAME:-\$(basename \$SRCDIR|awk -F- '{print \$1}')}
1841 VERSION=\${VERSION:-\$(basename \$SRCDIR|awk -F- '{print \$2}')}
1842 DESTDIR=\${DESTDIR:-"/mnt/utmp/\$PND_NAME"}
1845 while [ \$# -gt 0 ];do
1847 -s|--src) SRCDIR=\$2;shift;;
1848 -d|--dest) DESTDIR=\$2;shift;;
1849 -b|--build) BUILD=\$2;shift;;
1850 -a|--author) AUTHOR=\$2;shift;;
1851 -n|--name) PND_NAME=\$2;shift;;
1852 -v|--version) VERSION=\$2;shift;;
1853 -w|--website) WEBSITE=\$2;shift;;
1854 -f|--force) FORCE=1;;
1855 -h|--help) help;exit 1;;
1856 *) echo "'\$1' unknown argument">&2;help;exit 2;;
1861 # Validate arguments
1862 if [ ! -d \$SRCDIR ];then
1863 echo "\$SRCDIR don't exist" >&2
1867 if [ ! -d \$DESTDIR ] && [ \$FORCE -eq 0 ];then
1868 echo "\$DESTDIR don't exist" >&2
1871 elif [ ! -d \$DESTDIR ];then
1873 if [ \$? -ne 0 ];then
1874 echo "\$DESTDIR don\'t exist and cannot be created" >&2
1879 if [ \$(buildApplicationList|wc -l) -le 0 ];then
1880 echo "No applications found">&2
1884 if [ -e \$DESTDIR/PXML.xml ] && [ \$FORCE -eq 0 ];then
1885 echo "PXML file exist and force disabled." >&2
1892 chmod +x $USEFUL_TOOLS_DIR/genpxml.sh
1894 mkdir -p $USEFUL_TOOLS_DIR/qmake_linux-pandora-g++
1895 # Some binaries from the users $PATH are used, those have a suffix on some
1896 # Distributions. If no version is found, use the -qt4 verison. Lets find
1897 # out which version to use...
1898 which moc &> /dev/null
1899 if [ "$?" -eq "0" ];
1905 which uic &> /dev/null
1906 if [ "$?" -eq "0" ];
1912 cecho "Creating $USEFUL_TOOLS_DIR/qmake_linux-pandora-g++/qmake.conf" $green
1913 # Create a file that allows using qmake with the SDK
1914 cat > $USEFUL_TOOLS_DIR/qmake_linux-pandora-g++/qmake.conf <<_END_
1915 MAKEFILE_GENERATOR = UNIX
1917 CONFIG += qt warn_on release incremental link_prl
1918 DEFINES += QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH=1024
1919 DEFINES += QT_GL_NO_SCISSOR_TEST
1920 DEFINES += NO_DEBUG_ON_CONSOLE
1921 QT_INSTALL_BINS = /usr/bin
1922 QMAKE_AR = $PNDSDK/bin/arm-none-linux-gnueabi-ar cqs
1923 QMAKE_CC = $PNDSDK/bin/arm-none-linux-gnueabi-gcc
1924 QMAKE_CFLAGS_DEPS += -M
1925 #QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden
1926 QMAKE_CFLAGS += -pipe
1927 QMAKE_CFLAGS_RELEASE += -fno-omit-frame-pointer -fno-optimize-sibling-calls
1928 QMAKE_CFLAGS_RELEASE += -DPANDORA -Os -pipe -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant
1929 QMAKE_CFLAGS_SHLIB += -fPIC
1930 QMAKE_CFLAGS_STATIC_LIB += -fPIC
1931 QMAKE_CFLAGS_THREAD += -D_REENTRANT
1932 QMAKE_CFLAGS_WARN_OFF += -w
1933 QMAKE_CFLAGS_WARN_ON += -Wall -W
1934 QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses
1935 QMAKE_CHK_DIR_EXISTS = test -d
1937 QMAKE_COPY_DIR = \$(COPY) -r
1938 QMAKE_COPY_FILE = \$(COPY)
1939 QMAKE_CXXFLAGS_DEBUG += \$\$QMAKE_CFLAGS_DEBUG
1940 QMAKE_CXXFLAGS_DEPS += \$\$QMAKE_CFLAGS_DEPS
1941 #QMAKE_CXXFLAGS_HIDESYMS += \$\$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden
1942 QMAKE_CXXFLAGS_HIDESYMS += \$\$QMAKE_CFLAGS_HIDESYMS
1943 QMAKE_CXXFLAGS += \$\$QMAKE_CFLAGS
1944 QMAKE_CXXFLAGS_RELEASE += -g -fno-omit-frame-pointer -fno-optimize-sibling-calls
1945 QMAKE_CXXFLAGS_RELEASE += \$\$QMAKE_CFLAGS_RELEASE
1946 QMAKE_CXXFLAGS_SHLIB += \$\$QMAKE_CFLAGS_SHLIB
1947 QMAKE_CXXFLAGS_STATIC_LIB += \$\$QMAKE_CFLAGS_STATIC_LIB
1948 QMAKE_CXXFLAGS_THREAD += \$\$QMAKE_CFLAGS_THREAD
1949 QMAKE_CXXFLAGS_USE_PRECOMPILE = \$\$QMAKE_CFLAGS_USE_PRECOMPILE
1950 QMAKE_CXXFLAGS_WARN_OFF += \$\$QMAKE_CFLAGS_WARN_OFF
1951 QMAKE_CXXFLAGS_WARN_ON += \$\$QMAKE_CFLAGS_WARN_ON
1952 QMAKE_CXXFLAGS_YACC += \$\$QMAKE_CFLAGS_YACC
1953 QMAKE_CXX = $PNDSDK/bin/arm-none-linux-gnueabi-g++
1954 QMAKE_DEL_DIR = rmdir
1955 QMAKE_DEL_FILE = rm -f
1956 QMAKE_GZIP = gzip -9f
1957 QMAKE_INCDIR = $PNDSDK/usr/include
1958 QMAKE_INCDIR_OPENGL = $PNDSDK/usr/include
1959 QMAKE_INCDIR_OPENGL_ES1CL = \$\$QMAKE_INCDIR_OPENGL
1960 QMAKE_INCDIR_OPENGL_ES1 = \$\$QMAKE_INCDIR_OPENGL
1961 QMAKE_INCDIR_OPENGL_ES2 = \$\$QMAKE_INCDIR_OPENGL
1962 QMAKE_INCDIR_EGL = $PNDSDK/include
1963 QMAKE_INCDIR_OPENVG = $PNDSDK/usr/include/VG
1964 QMAKE_INCDIR_QT = $PNDSDK/usr/include/qt4
1965 QMAKE_INCDIR_X11 = $PNDSDK/usr/include/X11
1966 QMAKE_INCREMENTAL_STYLE = sublib
1967 QMAKE_INSTALL_FILE = install -m 644 -p
1968 QMAKE_INSTALL_PROGRAM = install -m 755 -p
1971 QMAKE_LFLAGS += -L$PNDSDK/usr/lib -Wl,-rpath-link=$PNDSDK/usr/lib
1972 QMAKE_LFLAGS += -L$PNDSDK/lib -Wl,-rpath-link=$PNDSDK/lib
1974 QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions
1975 QMAKE_LFLAGS_DEBUG +=
1976 QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list,
1977 QMAKE_LFLAGS_NOUNDEF += -Wl,--no-undefined
1978 QMAKE_LFLAGS_RELEASE += -Wl,-Os
1979 QMAKE_LFLAGS_SHLIB += -shared
1980 QMAKE_LFLAGS_PLUGIN += \$\$QMAKE_LFLAGS_SHLIB
1981 QMAKE_LFLAGS_SONAME += -Wl,-soname,
1982 QMAKE_LFLAGS_THREAD +=
1984 QMAKE_LIBDIR_OPENGL = $PNDSDK/usr/lib
1985 QMAKE_LIBDIR_OPENGL_ES1CL = \$\$QMAKE_LIBDIR_OPENGL
1986 QMAKE_LIBDIR_OPENGL_ES1 = \$\$QMAKE_LIBDIR_OPENGL
1987 QMAKE_LIBDIR_OPENGL_ES2 = \$\$QMAKE_LIBDIR_OPENGL
1988 QMAKE_LIBDIR_EGL = $PNDSDK/usr/lib
1989 QMAKE_LIBDIR_OPENVG =
1990 QMAKE_LIBDIR_QT = $PNDSDK/usr/lib
1991 QMAKE_LIBDIR_X11 = $PNDSDK/usr/lib
1993 QMAKE_LIBS_DYNLOAD = -ldl
1994 QMAKE_LIBS_EGL = -lEGL
1995 QMAKE_LIBS_NIS = -lnsl
1996 QMAKE_LIBS_OPENGL_ES1CL = -lGLES_CL
1997 QMAKE_LIBS_OPENGL_ES1 = -lGLES_CM
1998 QMAKE_LIBS_OPENGL_ES2 = -lGLESv2
1999 QMAKE_LIBS_OPENGL = -lGLU -lGL
2000 QMAKE_LIBS_OPENGL_QT = -lGL
2001 QMAKE_LIBS_OPENVG = -lOpenVG
2002 QMAKE_LIBS_THREAD = -lpthread
2003 QMAKE_LIBS_X11 = -lXext -lX11 -lm
2004 QMAKE_LIBS_X11SM = -lSM -lICE
2005 QMAKE_LINK_C_SHLIB = $PNDSDK/bin/arm-none-linux-gnueabi-gcc
2006 QMAKE_LINK_C = $PNDSDK/bin/arm-none-linux-gnueabi-gcc
2007 QMAKE_LINK_SHLIB = $PNDSDK/bin/arm-none-linux-gnueabi-g++
2008 QMAKE_LINK = $PNDSDK/bin/arm-none-linux-gnueabi-g++
2009 QMAKE_MKDIR = mkdir -p
2010 QMAKE_MOC = \$\$[QT_INSTALL_BINS]/$MOC_NAME
2012 QMAKE_OBJCOPY = objcopy
2013 QMAKE_PCH_OUTPUT_EXT = .gch
2014 QMAKE_CFLAGS_PRECOMPILE += -x c-header -c \${QMAKE_PCH_INPUT} -o \${QMAKE_PCH_OUTPUT}
2015 QMAKE_CFLAGS_USE_PRECOMPILE += -include \${QMAKE_PCH_OUTPUT_BASE}
2016 QMAKE_CXXFLAGS_PRECOMPILE += -x c++-header -c \${QMAKE_PCH_INPUT} -o \${QMAKE_PCH_OUTPUT}
2018 QMAKE_LFLAGS_RPATH = -Wl,-rpath,
2019 QMAKE_STRIPFLAGS_LIB += --strip-unneeded
2022 QMAKE_UIC = \$\$[QT_INSTALL_BINS]/$UIC_NAME
2023 QMAKE_YACCFLAGS += -d
2024 QMAKE_YACCFLAGS_MANGLE += -p \$base -b \$base
2025 QMAKE_YACC_HEADER = \$base.tab.h
2026 QMAKE_YACC_SOURCE = \$base.tab.c
2031 QMAKE_PREFIX_STATICLIB = lib
2032 QMAKE_EXTENSION_STATICLIB = a
2036 # example for using qmake with smplayer:
2037 #make QMAKE="qmake -spec \$PNDSDK/../sdk_utils/qmake_linux-pandora-g++"
2040 cecho "Creating $USEFUL_TOOLS_DIR/qmake_linux-pandora-g++/qplatformdefs.h" $green
2041 # Create include required for qmake stuff
2042 cat > $USEFUL_TOOLS_DIR/qmake_linux-pandora-g++/qplatformdefs.h <<_END_
2043 /****************************************************************************
2045 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
2046 ** All rights reserved.
2047 ** Contact: Nokia Corporation (qt-info@nokia.com)
2049 ** This file is part of the qmake spec of the Qt Toolkit.
2051 ** \$QT_BEGIN_LICENSE:LGPL\$
2053 ** Licensees holding valid Qt Commercial licenses may use this file in
2054 ** accordance with the Qt Commercial License Agreement provided with the
2055 ** Software or, alternatively, in accordance with the terms contained in
2056 ** a written agreement between you and Nokia.
2058 ** GNU Lesser General Public License Usage
2059 ** Alternatively, this file may be used under the terms of the GNU Lesser
2060 ** General Public License version 2.1 as published by the Free Software
2061 ** Foundation and appearing in the file LICENSE.LGPL included in the
2062 ** packaging of this file. Please review the following information to
2063 ** ensure the GNU Lesser General Public License version 2.1 requirements
2064 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
2066 ** In addition, as a special exception, Nokia gives you certain additional
2067 ** rights. These rights are described in the Nokia Qt LGPL Exception
2068 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
2070 ** GNU General Public License Usage
2071 ** Alternatively, this file may be used under the terms of the GNU
2072 ** General Public License version 3.0 as published by the Free Software
2073 ** Foundation and appearing in the file LICENSE.GPL included in the
2074 ** packaging of this file. Please review the following information to
2075 ** ensure the GNU General Public License version 3.0 requirements will be
2076 ** met: http://www.gnu.org/copyleft/gpl.html.
2078 ** If you have questions regarding the use of this file, please contact
2079 ** Nokia at qt-info@nokia.com.
2080 ** \$QT_END_LICENSE\$
2082 ****************************************************************************/
2084 #include "/usr/share/qt4/mkspecs/linux-g++/qplatformdefs.h"
2086 #define QT_GUI_DOUBLE_CLICK_RADIUS 20
2090 cecho "Created all additional files" $green
2095 # Start of the "active" part of the script, everything above are just functions that will be called later on...
2100 cecho "Checking if all required programs are available in PATH" $green
2101 for i in $REQUIRED_PROGS; do which $i &> /dev/null || report_absent_tool $i; done
2103 cecho "Found the following progs in PATH:" $green
2104 cecho "$REQUIRED_PROGS" $green
2106 # Creating temporary directory
2108 cecho "Creating temporary directory: $TMPDIR" $green
2109 if [ ! -d "$TMPDIR" ]
2114 # basic codesourcery toolchain stuff
2115 download_codesourcery_toolchain
2116 install_codesourcery_toolchain
2118 # get opkg up and running
2122 # create the list of packages that should be installed next
2125 # install all the stuff that makes the SDK...
2126 install_libs_via_opkg
2127 # Crude hack around some packages (like eg libqtcore4) not being
2128 # known/installed: just rerun the complete opkg part...
2129 install_libs_via_opkg
2131 # get pkg-config up and running
2135 # fix some paths and such inside libraries and pkgconfig files
2138 # provide some additional files
2141 # make sure that we are back where we started...
2144 # Add some things to $HOME/.bashrc if it is not available so far
2145 grep -q "export PNDSDK=\"$PNDSDK\"" ~/.bashrc
2146 if [ "$?" -ne "0" ];
2149 cecho "The following lines have been added to your login script (~/.bashrc):" $green
2150 # Add a default variable that allows to access the crosscompiler more
2151 # easily. Just use $PNDSDK/bin/pandora-gcc for calling the gcc!
2152 echo "export PNDSDK=\"$PNDSDK\""
2153 echo "export PNDSDK=\"$PNDSDK\"" >> ~/.bashrc
2154 # Append the binary paths from the sdk to the $PATH.
2155 #echo "export PATH=\"\$PATH:\$PNDSDK/bin:\$PNDSDK/usr/bin\""
2156 #echo "export PATH=\"\$PATH:\$PNDSDK/bin:\$PNDSDK/usr/bin\"" >> ~/.bashrc
2162 cecho "All done, your Pandora SDK is located here : $PNDSDK" $green
2163 cecho "If you want to you can now remove the temporary directory ($TMPDIR). The files are only required if you plan to rerun this script to eg install a new version of the toolchain." $green
2166 # this line is what is created as "opkg-target" by the openembedded toolchain(s)
2167 # by now it is irrelevant, just access opkg using "$PNDSDK/../sdk_utils/opkg-pandora.sh" and be done!
2168 # alias opkg-target='LD_LIBRARY_PATH=/usr/local/angstrom/arm/lib /usr/local/angstrom/arm/bin/opkg-cl -f /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf -o /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi'