From e9b45ff67d32fdc27950a51135b6dabada8334e7 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Sun, 24 Jul 2011 17:57:24 +0100 Subject: initial commit of meta-opie Populate the repository with files from OpenEmbedded at revision 45edf621296daf150c72b876d720861235e5762e - no changes, only rearranged the directory structure to match the new oe-core style and added COPYING.MIT and README. Signed-off-by: Paul Eggleton --- classes/opie.bbclass | 105 +++++++++++++++++++++++++++++ classes/opie_i18n.bbclass | 163 +++++++++++++++++++++++++++++++++++++++++++++ classes/palmtop.bbclass | 26 ++++++++ classes/qmake.bbclass | 15 +++++ classes/qmake_base.bbclass | 105 +++++++++++++++++++++++++++++ classes/qt3e.bbclass | 11 +++ classes/sdl.bbclass | 46 +++++++++++++ 7 files changed, 471 insertions(+) create mode 100644 classes/opie.bbclass create mode 100644 classes/opie_i18n.bbclass create mode 100644 classes/palmtop.bbclass create mode 100644 classes/qmake.bbclass create mode 100644 classes/qmake_base.bbclass create mode 100644 classes/qt3e.bbclass create mode 100644 classes/sdl.bbclass (limited to 'classes') diff --git a/classes/opie.bbclass b/classes/opie.bbclass new file mode 100644 index 0000000..833ea4d --- /dev/null +++ b/classes/opie.bbclass @@ -0,0 +1,105 @@ +# +# This oeclass takes care about some of the itchy details of installing parts +# of Opie applications. Depending on quicklaunch or not, plugin or not, the +# TARGET is either a shared object, a shared object with a link to quicklauncher, +# or a usual binary. +# +# You have to provide two things: 1.) A proper SECTION field, and 2.) a proper APPNAME +# Then opie.oeclass will: +# * create the directory for the binary and install the binary file(s) +# * for applications: create the directory for the .desktop and install the .desktop file +# * for quicklauncher applications: create the startup symlink to the quicklauncher +# You can override the automatic detection of APPTYPE, valid values are 'quicklaunch', 'binary', 'plugin' +# You can override the default location of APPDESKTOP (/apps/
/) +# + +inherit palmtop + +OPIE_CVS_PV ?= "1.2.2+cvs${SRCDATE}" +OPIE_SRCREV ?= "8c3beef263bc9c34443eacfc821e99813e17554f" +OPIE_GIT_PV ?= "1.2.4+gitr${OPIE_SRCREV}" +DEPENDS_prepend = "${@["libopie2 ", ""][(bb.data.getVar('PN', d, 1) == 'libopie2')]}" + +# to be consistent, put all targets into workdir +# NOTE: leave one space at the end, other files are expecting that +EXTRA_QMAKEVARS_POST += " DESTDIR=${S} " + +# Opie standard TAG value +TAG = "${@'v' + bb.data.getVar('PV',d,1).replace('.', '_')}" + +# plan for later: +# add common scopes for opie applications, see qmake-native/common.pro +# qmake should care about all the details then. qmake can do that, i know it :) +# + +python opie_do_opie_install() { + import os, shutil + section = bb.data.getVar( "SECTION", d ).split( '/' )[1] or "Applications" + section = section.title() + if section in ( "Base", "Libs" ): + bb.note( "Section = Base or Libs. Target won't be installed automatically." ) + return + + # SECTION : BINDIR DESKTOPDIR + dirmap = { "Applets" : ( "/plugins/applets", None ), + "Applications" : ( "", "/apps/Applications" ), + "Multimedia" : ( "", "/apps/Applications" ), + "Games" : ( "", "/apps/Games" ), + "Settings" : ( "", "/apps/Settings" ), + "Pim" : ( "", "/apps/1Pim" ), + "Examples" : ( "", "/apps/Examples" ), + "Shell" : ( "/bin", "/apps/Opie-SH" ), + "Codecs" : ( "/plugins/codecs", None ), + "Decorations" : ( "/plugins/decorations", None ), + "Inputmethods" : ( "/plugins/inputmethods", None ), + "Fontfactories" : ( "/plugins/fontfactories", None ), + "Security" : ( "/plugins/security", None ), + "Styles" : ( "/plugins/styles", None ), + "Today" : ( "/plugins/today", None ), + "Datebook" : ( "/plugins/holidays", None ), + "Networksettings" : ( "/plugins/networksettings", None ) } + + if section not in dirmap: + raise ValueError, "Unknown section '%s'. Valid sections are: %s" % ( section, dirmap.keys() ) + + bindir, desktopdir = dirmap[section] + APPNAME = bb.data.getVar( "APPNAME", d, True ) or bb.data.getVar( "PN", d, True ) + APPTYPE = bb.data.getVar( "APPTYPE", d, True ) + if not APPTYPE: + if bindir == "": + APPTYPE = "quicklaunch" + else: + APPTYPE = "plugin" + + appmap = { "binary":"/bin", "quicklaunch":"/plugins/application" } + if bindir == "": bindir = appmap[APPTYPE] + + bb.note( "Section='%s', bindir='%s', desktopdir='%s', name='%s', type='%s'" % + ( section, bindir, desktopdir, APPNAME, APPTYPE ) ) + + S = bb.data.getVar( "S", d, 1 ) + D = "%s/image" % bb.data.getVar( "WORKDIR", d, True ) + WORKDIR = bb.data.getVar( "WORKDIR", d, True ) + palmtopdir = bb.data.getVar( "palmtopdir", d, True ) + gnubindir = bb.data.getVar( "bindir", d, True ) + APPDESKTOP = bb.data.getVar( "APPDESKTOP", d, True ) or "%s/%s" % ( WORKDIR, desktopdir ) + + if desktopdir is not None: + os.system( "install -d %s%s%s/" % ( D, palmtopdir, desktopdir ) ) + os.system( "install -m 0644 %s/%s.desktop %s%s%s/" % ( APPDESKTOP, APPNAME, D, palmtopdir, desktopdir ) ) + + os.system( "install -d %s%s%s/" % ( D, palmtopdir, bindir ) ) + + if APPTYPE == "binary": + os.system( "install -d %s%s/" % ( D, gnubindir ) ) + os.system( "install -m 0755 %s/%s %s%s/" % ( S, APPNAME, D, gnubindir ) ) + elif APPTYPE == "quicklaunch": + os.system( "install -m 0755 %s/lib%s.so %s%s%s/" % ( S, APPNAME, D, palmtopdir, bindir ) ) + os.system( "install -d %s%s/" % ( D, gnubindir ) ) + os.system( "ln -sf %s/quicklauncher %s%s/%s" % ( gnubindir, D, gnubindir, APPNAME ) ) + elif APPTYPE == "plugin": + os.system( "install -m 0755 %s/lib%s.so %s%s%s/" % ( S, APPNAME, D, palmtopdir, bindir ) ) +} + +EXPORT_FUNCTIONS do_opie_install +addtask opie_install after do_compile before do_package diff --git a/classes/opie_i18n.bbclass b/classes/opie_i18n.bbclass new file mode 100644 index 0000000..c9b0134 --- /dev/null +++ b/classes/opie_i18n.bbclass @@ -0,0 +1,163 @@ +# classes/opie_i18n.oeclass Matthias 'CoreDump' Hentges 16-10-2004 +# +# Automatically builds i18n ipks for opie packages. It downloads opie-i18n from opie CVS +# and tries to guess the name of the .ts file based on the package name: +# ${PN}.ts, lib${PN}.ts and opie-${PN}.ts are all valid. The .ts "guessing" can be +# disabled by setting I18N_FILES in the .oe file. +# +# Todo: +# + +I18N_STATS = "1" +SRC_URI += "${OPIE_GIT};protocol=git;subpath=i18n" +DEPENDS += "opie-i18n" + +die () { + printf "opie_18n: ERROR: $1\n" + exit 1 +} + +python do_build_opie_i18n_data() { + + import os, bb, re + workdir = bb.data.getVar("WORKDIR", d, 1) + packages = bb.data.getVar("PACKAGES", d, 1) + files = bb.data.getVar("FILES", d, 1) + section = bb.data.getVar("SECTION", d, 1) + pn = bb.data.getVar("PN", d, 1) + rdepends = bb.data.getVar("RDEPENDS", d, 1) + + if os.path.exists(workdir + "/PACKAGES.tmp"): + fd = open(workdir + "/PACKAGES.tmp", 'r') + lines = fd.readlines() + fd.close() + + bb.data.setVar('PACKAGES', " ".join(lines).lower() + " " + packages, d) + + fd = open(workdir + "/FILES.tmp", 'r') + lines = fd.readlines() + fd.close() + + for l in lines: + x = re.split("\#", l) + bb.data.setVar('FILES_%s' % x[0].lower(), " " + x[1].strip('\n'), d) + bb.data.setVar('SECTION_%s' % x[0].lower(), "opie/translations", d) + bb.data.setVar('RDEPENDS_%s' % x[0].lower(), pn, d) + + bb.data.setVar('SECTION_%s' % pn, section, d) + bb.data.setVar('RDEPENDS', rdepends, d) + else: + bb.note("No translations found for package " + pn) +} + +do_build_opie_i18n () { + + cd "${WORKDIR}/i18n" || die "ERROR:\nCouldn't find Opies i18n sources in ${PN}/i18n\nMake sure that or is *below* !" + + if test -z "${I18N_FILES}" + then + package_name="`echo "${PN}"| sed "s/^opie\-//"`" + package_name2="`echo "${PN}"| sed "s/^opie\-//;s/\-//"`" + test "$package_name" != "$package_name2" && I18N_FILES="${package_name}.ts lib${package_name}.ts opie-${package_name}.ts ${package_name2}.ts lib${package_name2}.ts opie-${package_name2}.ts" + test "$package_name" = "$package_name2" && I18N_FILES="${package_name}.ts lib${package_name}.ts opie-${package_name}.ts" + printf "I18N Datafiles: ${I18N_FILES} (auto-detected)\nYou can overide the auto-detection by setting I18N_FILES in your .oe file\n" + else + echo "I18N Datafiles: ${I18N_FILES} (provided by .bb)" + fi + + rm -f "${WORKDIR}/FILES.tmp" "${WORKDIR}/PACKAGES.tmp" + + printf "\nFILES is set to [${FILES}]\n\n" + + for file in ${I18N_FILES} + do + echo "Working on [$file]" + for ts_file in `ls -1 */*.ts | egrep "/$file"` + do + printf "\tCompiling [$ts_file]\n" + cd "${WORKDIR}/i18n/`dirname $ts_file`" || die "[${WORKDIR}/i18n/`dirname $ts_file`] not found" + opie-lrelease "`basename $ts_file`" || die "lrelease failed! Make sure that or is *below* !" + + # $lang is the language as in de_DE, $lang_sane replaces "_" with "-" + # to allow packaging as "_" is not allowed in a package name + lang="`echo "$ts_file" | sed -n "s#\(.*\)/\(.*\)#\1#p"`" + lang_sane="`echo "$ts_file" | sed -n "s#\(.*\)/\(.*\)#\1#p"|sed s/\_/\-/`" + printf "\tPackaging [`basename $ts_file`] for language [$lang]\n" + + install -d ${D}${palmtopdir}/i18n/$lang + install -m 0644 ${WORKDIR}/i18n/$lang/.directory ${D}${palmtopdir}/i18n/$lang/ + install -m 0644 ${WORKDIR}/i18n/$lang/*.qm "${D}${palmtopdir}/i18n/$lang/" + + # As it is not possible to modify OE vars from within a _shell_ function, + # some major hacking was needed. These two files will be read by the python + # function do_build_opie_i18n_data() which sets the variables FILES_* and + # PACKAGES as needed. + echo -n "${PN}-${lang_sane} " >> "${WORKDIR}/PACKAGES.tmp" + printf "${PN}-${lang_sane}#${palmtopdir}/i18n/$lang" >> "${WORKDIR}/FILES.tmp\n" + + ts_found_something=1 + done + + if test "$ts_found_something" != 1 + then + printf "\tNo translations found\n" + else + ts_found_something="" + ts_found="$ts_found $file" + fi + + # Only used for debugging purposes + test "${I18N_STATS}" = 1 && cd "${WORKDIR}/i18n" + + printf "Completed [$file]\n\n\n" + done + + qt_dirs="apps bin etc lib pics plugins share sounds" + + for dir in $qt_dirs + do + dir_="$dir_ ${palmtopdir}/$dir " + done + + + # If we don't adjust FILES to exclude the i18n directory, we will end up with + # _lots_ of empty i18n/$lang directories in the original .ipk. + if (echo "${FILES}" | egrep "${palmtopdir}/? |${palmtopdir}/?$") &>/dev/null + then + echo "NOTE: FILES was set to ${palmtopdir} which would include the i18n directory" + printf "\n\nI'll remove ${palmtopdir} from FILES and replace it with all directories\n" + echo "below QtPalmtop, except i18n ($qt_dirs). See classes/opie_i18n.oeclass for details" + + # Removes /opt/QtPalmtop from FILES but keeps /opt/QtPalmtop/$some_dir + FILES="`echo "$FILES"| sed "s#${palmtopdir}[/]\?\$\|${palmtopdir}[/]\? ##"`" + + echo "${PN}#$FILES $dir_" >> "${WORKDIR}/FILES.tmp" + fi + + # This is the common case for OPIE apps which are installed by opie.oeclass magic + if test -z "${FILES}" + then + echo "NOTE:" + printf "Since FILES is empty, i'll add all directories below ${palmtopdir} to it,\nexcluding i18n: ( $qt_dirs )\n" + echo "${PN}#$FILES $dir_" >> "${WORKDIR}/FILES.tmp" + fi + + if ! test -e "${WORKDIR}/PACKAGES.tmp" -a "${I18N_STATS}" = 1 + then + echo "No translations for package [${PN}]" >> /tmp/oe-i18n-missing.log + else + echo "Using [$ts_found ] for package [${PN}]" >> /tmp/oe-i18n.log + fi + + # While this might not be very elegant, it safes a _ton_ of space (~30Mb) for + # each opie package. + for file in $(ls */*.ts | egrep -v "`echo "$ts_found"| sed "s/^\ //;s/\ /\|/"`") + do + rm "$file" + done + + return 0 +} + +addtask build_opie_i18n before do_compile +addtask build_opie_i18n_data after do_build_opie_i18n before do_compile diff --git a/classes/palmtop.bbclass b/classes/palmtop.bbclass new file mode 100644 index 0000000..b4ee62c --- /dev/null +++ b/classes/palmtop.bbclass @@ -0,0 +1,26 @@ +# this build class sets up qmake variables to +# * build using the Qt Windowing System (QWS) +# * use qt +# * link against supc++ instead of stdc++ +# * use threads, if requested via PALMTOP_USE_MULTITHREADED_QT = "yes" +# inherit this class to build programs against libqpe +# inherit opie if you want to build programs against libopie2 +# don't override EXTRA_QMAKEVARS_POST, if you use inherit this class + +inherit qmake + +# special case for DISTRO = sharprom +CPP_SUPPORT_LIB = "LIBS-=-lstdc++ LIBS+=-lsupc++" +CPP_SUPPORT_LIB_sharprom-compatible = "LIBS+=-lstdc++" +EXTRA_QMAKEVARS_POST += "DEFINES+=QWS CONFIG+=qt ${CPP_SUPPORT_LIB}" +EXTRA_QMAKEVARS_POST += '${@base_conditional("PALMTOP_USE_MULTITHREADED_QT", "yes", "CONFIG+=thread", "CONFIG-=thread",d)}' +EXTRA_QMAKEVARS_POST += "${@["LIBS+=-lqpe ", ""][(bb.data.getVar('PN', d, 1) == 'libqpe-opie')]}" +DEPENDS_prepend = "${@["virtual/libqpe1 uicmoc-native ", ""][(bb.data.getVar('PN', d, 1) == 'libqpe-opie')]}" +QT_LIBRARY = '${@base_conditional("PALMTOP_USE_MULTITHREADED_QT", "yes", "qte-mt", "qte", d)}' +EXTRA_QMAKEVARS_POST += " DEFINES+=OPIE_BINDIR='\"${bindir}\"' DEFINES+=OPIE_LIBDIR='\"${libdir}/opie/lib\"' DEFINES+=OPIE_QTDIR='\"${libdir}/opie\"' " + +PACKAGES = "${PN}-dbg ${PN}-dev ${PN} ${PN}-doc ${PN}-locale" +FILES_${PN} += " ${palmtopdir} " +FILES_${PN}-dbg += " ${palmtopdir}/lib/.debug \ + ${palmtopdir}/bin/.debug \ + ${palmtopdir}/plugins/*/.debug " diff --git a/classes/qmake.bbclass b/classes/qmake.bbclass new file mode 100644 index 0000000..40fc739 --- /dev/null +++ b/classes/qmake.bbclass @@ -0,0 +1,15 @@ +inherit qmake_base + +DEPENDS_prepend = "qmake-native " + +export QMAKESPEC +export OE_QMAKE_UIC="${STAGING_BINDIR_NATIVE}/uic" +export OE_QMAKE_MOC="${STAGING_BINDIR_NATIVE}/moc" +export OE_QMAKE_QMAKE="${STAGING_BINDIR_NATIVE}/qmake" +export OE_QMAKE_CXXFLAGS="-fno-exceptions -fno-rtti ${CXXFLAGS}" +export OE_QMAKE_LINK="${CCLD}" +export OE_QMAKE_INCDIR_QT="${STAGING_INCDIR}/qte" +export OE_QMAKE_LIBDIR_QT="${STAGING_LIBDIR}" +export OE_QMAKE_LIBS_QT="qte" +export OE_QMAKE_LIBS_X11="" + diff --git a/classes/qmake_base.bbclass b/classes/qmake_base.bbclass new file mode 100644 index 0000000..cc3297c --- /dev/null +++ b/classes/qmake_base.bbclass @@ -0,0 +1,105 @@ + +OE_QMAKE_PLATFORM = "${TARGET_OS}-oe-g++" +QMAKESPEC = "${QMAKE_MKSPEC_PATH}/${OE_QMAKE_PLATFORM}" + +# We override this completely to eliminate the -e normally passed in +EXTRA_OEMAKE = ' MAKEFLAGS= ' + +export OE_QMAKE_CC="${CC}" +export OE_QMAKE_CFLAGS="${CFLAGS}" +export OE_QMAKE_CXX="${CXX}" +export OE_QMAKE_LDFLAGS="${LDFLAGS}" +export OE_QMAKE_AR="${AR}" +export OE_QMAKE_STRIP="echo" +export OE_QMAKE_RPATH="-Wl,-rpath-link," + +# do not export STRIP to the environment +STRIP[unexport] = "1" + +# default to qte2 via bb.conf, inherit qt3x11 to configure for qt3x11 + +oe_qmake_mkspecs () { + mkdir -p mkspecs/${OE_QMAKE_PLATFORM} + for f in ${QMAKE_MKSPEC_PATH}/${OE_QMAKE_PLATFORM}/*; do + if [ -L $f ]; then + lnk=`readlink $f` + if [ -f mkspecs/${OE_QMAKE_PLATFORM}/$lnk ]; then + ln -s $lnk mkspecs/${OE_QMAKE_PLATFORM}/`basename $f` + else + cp $f mkspecs/${OE_QMAKE_PLATFORM}/ + fi + else + cp $f mkspecs/${OE_QMAKE_PLATFORM}/ + fi + done +} + +do_generate_qt_config_file() { + export QT_CONF_PATH=${WORKDIR}/qt.conf + cat > ${WORKDIR}/qt.conf < +# + +DEPENDS += "virtual/libsdl libsdl-mixer libsdl-image" + +APPDESKTOP ?= "${WORKDIR}/${PN}.desktop" +APPNAME ?= "${PN}" +APPIMAGE ?= "${WORKDIR}/${PN}.png" + +export SDL_CONFIG = "${STAGING_BINDIR_CROSS}/sdl-config" + +sdl_do_sdl_install() { + install -d ${D}${datadir}/applications + install -d ${D}${datadir}/pixmaps + + install -m 0644 ${APPIMAGE} ${D}${datadir}/pixmaps/${PN}.png + + if [ -e "${APPDESKTOP}" ] + then + echo ${APPDESKTOP} present, using it... + install -m 0644 ${APPDESKTOP} ${D}${datadir}/applications/ + else + echo ${APPDESKTOP} not present, creating one on-the-fly... + cat >${D}${datadir}/applications/${PN}.desktop <