From 15318cad33835e4e2dc620d033e43cd930676cdd Mon Sep 17 00:00:00 2001 From: kergoth Date: Fri, 25 Jan 2002 22:14:26 +0000 Subject: Initial revision --- (limited to 'scripts') diff --git a/scripts/README b/scripts/README new file mode 100644 index 0000000..54295bb --- a/dev/null +++ b/scripts/README @@ -0,0 +1,26 @@ + +These scripts are for convienence only. + +Use them at your own risk. + +Especially q_add_variable and q_add_function, +however when used they should leave behind a backup copy of the +header file it has tried to modify. Sometimes those two scripts +find headers that it decides it can't parse and leaves it up to +the user to edit them manually. + +But even still I would highly recommend backing up your files +or using this in conjuction with some kind of CVS like system. + +The script to add a new application is the most useful script +and creates a very basic QPE app from a template with most of +the files you need. + +Currently these scripts don't integrate with a CVS system and +add or edit the created/modified files with the repository, you +have to do that manually, however I have started to make a few +scripts that are generic repository accessing scripts that +could be made to work with either p4 or cvs or something else. + +John + diff --git a/scripts/mkPackages b/scripts/mkPackages new file mode 100755 index 0000000..5734f1c --- a/dev/null +++ b/scripts/mkPackages @@ -0,0 +1,24 @@ +#!/bin/sh + +for i in *.ipk +do + packagename=${i%%_*} + #echo >&2 "$packagename..." + GOOD=y + for other in ${packagename}_* + do + if [ $i != $other -a $other -nt $i ] + then + GOOD= + break + fi + done + if [ -n "$GOOD" ] + then + tar xfOz $i ./control.tar.gz | tar xfOz - ./control + echo + else + echo >&2 "Skipped old file: $i ($other is newer)" + #mv $i old + fi +done >Packages diff --git a/scripts/mkconfigs b/scripts/mkconfigs new file mode 100755 index 0000000..6a2e6a2 --- a/dev/null +++ b/scripts/mkconfigs @@ -0,0 +1,9 @@ +#!/usr/bin/perl + +system('rm -f configs/linux-*'); +for $p ( split /\s+/, `\$QTDIR/util/scripts/mkconfigs -p qws` ) { + system("cp \$QTDIR/$p configs"); + if ( $ARGV[0] eq '-v' ) { + print "$p\n"; + } +} diff --git a/scripts/mkmakefile b/scripts/mkmakefile new file mode 100755 index 0000000..1d21a2e --- a/dev/null +++ b/scripts/mkmakefile @@ -0,0 +1,23 @@ +#!/bin/sh + +if [ $# -lt 1 ] +then + echo "Usage: mkmakefile ..." + exit 1 +fi + +while [ $# -gt 0 ] +do + DIR=`echo $1 | sed -e 's/\/$//'` + echo "Making $DIR/Makefile.in..." + H=`pwd` + cd $DIR + FILE=`basename $DIR` + TMAKEPATH=$QTDIR/tmake:$TMAKEPATH tmake CONFIG+=embedded -t $H/qt/tmake/propagate.t -o Makefile.in $FILE.pro + echo "Done." + shift + cd - +done + +exit 0 + diff --git a/scripts/pack b/scripts/pack new file mode 100755 index 0000000..26a530a --- a/dev/null +++ b/scripts/pack @@ -0,0 +1,58 @@ +#!/usr/bin/perl + +$QTDIR=$ENV{QTDIR}; +$base=`pwd`; + +# Directory structure +system("rm -rf usr-ipaq/lib/qt/*/*"); +system("mkdir -p usr-ipaq/lib/qt/etc/fonts"); +system("mkdir -p usr-ipaq/lib/qt/apps"); +system("mkdir -p usr-ipaq/lib/qt/bin"); +system("mkdir -p usr-ipaq/lib/qt/docs"); +system("mkdir -p usr-ipaq/lib/qt/lib"); +system("mkdir -p usr-ipaq/lib/qt/pics"); +system("mkdir -p usr-ipaq/lib/qt/video"); + +# The app +#system("cp single/qpe usr-ipaq/lib/qt/bin/"); +system("cp -r bin usr-ipaq/lib/qt/"); +system("cp -a $QTDIR/lib/libqte.so* usr-ipaq/lib/"); +system("cp -a $QTDIR/lib/libqpe.so* usr-ipaq/lib/"); + +# Media +system("cp -r apps usr-ipaq/lib/qt"); +system("cp -a docs usr-ipaq/lib/qt"); +system("cp -r pics usr-ipaq/lib/qt"); +system("cp -r i18n usr-ipaq/lib/qt; rm usr-ipaq/lib/qt/i18n/*/*.po"); +system("cp -r video usr-ipaq/lib/qt"); +system("cp -r sounds usr-ipaq/lib/qt"); + +# This is for future use when a library will need to be included +# Library +# system("cd usr-ipaq/lib/qt/lib ; ". +# "cp -r $QTDIR/lib/libqte.so.2.2 ./ ; ". +# "ln -s libqte.so.2.2 libqte.so.2 ; ". +# "ln -s libqte.so.2.2 libqte.so ; ". +# "cd -"); + +# Fonts +system("cp $QTDIR/etc/fonts/fontdir ". + "$QTDIR/etc/fonts/helvetica_* ". + "$QTDIR/etc/fonts/fixed_* ". + "$QTDIR/etc/fonts/micro_* ". + "$QTDIR/etc/fonts/smallsmooth_* ". + "$QTDIR/etc/fonts/cyberbit_120_50_t10.qpf ". + "$QTDIR/etc/fonts/smoothtimes_{170,100}_50*.qpf ". + "usr-ipaq/lib/qt/etc/fonts/"); +system("mkdir -p usr-ipaq/lib/qt/etc/dict/"); + +# IM files +system("cp etc/dict/*dawg* usr-ipaq/lib/qt/etc/dict/"); +system("cp -r etc/qimpen usr-ipaq/lib/qt/etc/"); + +# Themery +system("cp -r etc/colors usr-ipaq/lib/qt/etc/"); + +# Clean +system("find usr-ipaq -name CVS | xargs rm -r"); +system("find usr-ipaq -name '*~' | xargs rm "); diff --git a/scripts/q_add_application b/scripts/q_add_application new file mode 100755 index 0000000..f9d259f --- a/dev/null +++ b/scripts/q_add_application @@ -0,0 +1,49 @@ +#!/bin/sh +# +# Script to add a new application to the Qtopia Environment +# +# Copyright 1999-2000 Trolltech AS. All rights reserved. +# + + +# load the helper functions +. q_functions + + +if [ $# -lt 2 ] +then +echo "Usage: q_add_application NewAppName NewAppsMainClassName [MenuItemName] [Description]" +print_example_usage +exit +fi + + +NEW_APP_NAME=$1 +NEW_CLASS_NAME=$2 +NEW_APP_MENU_NAME=$NEW_CLASS_NAME +NEW_APP_DESCRIPTION=$NEW_CLASS_NAME +[ $# -lt 3 ] || NEW_APP_MENU_NAME=$3 +[ $# -lt 4 ] || NEW_APP_DESCRIPTION=$4 + + +NEW_APP_FOLDER=$NEW_APP_NAME +NEW_APP_PRO_FILE="$NEW_APP_NAME".pro +NEW_APP_DESKTOP_FILE="$NEW_APP_NAME".desktop +NEW_APP_ICON_FILE="$NEW_APP_NAME"_icon.xpm +NEW_APP_MAIN_FILE=main.cpp +NEW_CLASS_HEADER_FILE="$NEW_APP_NAME".h +NEW_CLASS_SOURCE_FILE="$NEW_APP_NAME".cpp +NEW_CLASS_HEADER_DEFINE=__`echo $NEW_APP_NAME | tr [a-z] [A-Z]`_H__ + + +[ -d $NEW_APP_FOLDER ] || mkdir $NEW_APP_FOLDER +print_source_file >> $NEW_APP_FOLDER/$NEW_CLASS_SOURCE_FILE +print_header_file >> $NEW_APP_FOLDER/$NEW_CLASS_HEADER_FILE +print_main_file >> $NEW_APP_FOLDER/$NEW_APP_MAIN_FILE +print_pro_file >> $NEW_APP_FOLDER/$NEW_APP_PRO_FILE +print_desktop_file >> $NEW_APP_FOLDER/$NEW_APP_DESKTOP_FILE +print_icon_file >> $NEW_APP_FOLDER/$NEW_APP_ICON_FILE +print_install_file >> $NEW_APP_FOLDER/install +chmod u+x $NEW_APP_FOLDER/install + + diff --git a/scripts/q_add_class b/scripts/q_add_class new file mode 100755 index 0000000..6146e1e --- a/dev/null +++ b/scripts/q_add_class @@ -0,0 +1,36 @@ +#!/bin/sh +# +# Script to add a new class to an existing application +# +# Copyright 1999-2000 Trolltech AS. All rights reserved. +# + + +# load the helper functions +. q_functions + + +if [ $# -lt 2 ] +then +echo "Usage: q_add_class ExistingAppName NewClassName" +print_example_usage +exit +fi + + +EXISTING_APP_NAME=$1 +NEW_CLASS_NAME=$2 + + +NEW_CLASS_NAME_LOWER=`echo $NEW_CLASS_NAME | tr [A-Z] [a-z]` +NEW_CLASS_HEADER_FILE="$NEW_CLASS_NAME_LOWER".h +NEW_CLASS_SOURCE_FILE="$NEW_CLASS_NAME_LOWER".cpp +NEW_CLASS_HEADER_DEFINE=__`echo $NEW_CLASS_NAME | tr [a-z] [A-Z]`_H__ +EXISTING_PRO_FILE="$EXISTING_APP_NAME".pro + + +print_source_file >> $NEW_CLASS_SOURCE_FILE +print_header_file >> $NEW_CLASS_HEADER_FILE +add_class_to_pro_file >> $EXISTING_PRO_FILE + + diff --git a/scripts/q_add_function b/scripts/q_add_function new file mode 100755 index 0000000..cc14db7 --- a/dev/null +++ b/scripts/q_add_function @@ -0,0 +1,88 @@ +#!/bin/sh +# +# Script to add a new function to an existing class +# +# Copyright 1999-2000 Trolltech AS. All rights reserved. +# + + +# load the helper functions +. q_functions + + +if [ $# -lt 4 ] +then +echo "Usage: q_add_function AccessModifier RetType ExistingClassName NewFunctionName ArgList" +print_example_usage +exit +fi + + +ACCESS_MODIFIER=$1 +RET_TYPE=$2 +EXISTING_CLASS_NAME=`echo $3 | cut -d ":" -f 1` +NEW_FUNCTION_NAME=`echo $3 | cut -d ":" -f 3` +ARG_LIST=$4 + + +EXISTING_CLASS_NAME_LOWER=`echo $EXISTING_CLASS_NAME | tr "[A-Z]" "[a-z]"` +EXISTING_CLASS_HEADER_FILE="$EXISTING_CLASS_NAME_LOWER".h +EXISTING_CLASS_SOURCE_FILE="$EXISTING_CLASS_NAME_LOWER".cpp +ORIGINAL_CLASS_HEADER_FILE="$EXISTING_CLASS_NAME_LOWER".h.orig + + +function print_source_file +{ +cat << END + + +$RET_TYPE $EXISTING_CLASS_NAME::$NEW_FUNCTION_NAME$ARG_LIST +{ +} +END +} + + +function print_function_definition +{ +cat << END +$ACCESS_MODIFIER + $RET_TYPE $NEW_FUNCTION_NAME$ARG_LIST; +END +} + + +function print_new_header_file +{ +get_number_of_lines +get_first_line_of_class_definition +if [ -z "$LINE" ] +then +cat << END +/* + No good, can't find $EXISTING_CLASS_NAME class definition anywhere. + You'll have to manually edit the header file to add the + following function definition to the $EXISTING_CLASS_NAME class: + +END +print_function_definition +echo -e "\n*/" +cat $ORIGINAL_CLASS_HEADER_FILE +else +head -n $LINE $ORIGINAL_CLASS_HEADER_FILE +print_function_definition +tail -n `expr $LINES - $LINE` $ORIGINAL_CLASS_HEADER_FILE +fi +} + + +[ -f $EXISTING_CLASS_HEADER_FILE ] || { echo "file $EXISTING_CLASS_HEADER_FILE not found" ; exit ; } + +# Backup file +mv $EXISTING_CLASS_HEADER_FILE $ORIGINAL_CLASS_HEADER_FILE + + +print_source_file >> $EXISTING_CLASS_SOURCE_FILE +print_new_header_file >> $EXISTING_CLASS_HEADER_FILE + + diff --git a/scripts/q_add_variable b/scripts/q_add_variable new file mode 100755 index 0000000..e35b8de --- a/dev/null +++ b/scripts/q_add_variable @@ -0,0 +1,70 @@ +#!/bin/sh +# +# Script to add a new function to an existing class +# +# Copyright 1999-2000 Trolltech AS. All rights reserved. +# + + +# load the helper functions +. q_functions + + +if [ $# -lt 3 ] +then +echo "Usage: q_add_variable AccessModifier: Type ExistingClassName::NewVariableName" +print_example_usage +exit +fi + + +ACCESS_MODIFIER=$1 +TYPE=$2 +EXISTING_CLASS_NAME=`echo $3 | cut -d ":" -f 1` +NEW_VARIABLE_NAME=`echo $3 | cut -d ":" -f 3` + + +EXISTING_CLASS_NAME_LOWER=`echo $EXISTING_CLASS_NAME | tr "[A-Z]" "[a-z]"` +EXISTING_CLASS_HEADER_FILE="$EXISTING_CLASS_NAME_LOWER".h +ORIGINAL_CLASS_HEADER_FILE="$EXISTING_CLASS_NAME_LOWER".h.orig + + +function print_variable_definition +{ +cat << END +$ACCESS_MODIFIER + $TYPE $NEW_VARIABLE_NAME; +END +} + + +function print_new_header_file +{ +get_number_of_lines +get_first_line_of_class_definition +if [ -z "$LINE" ] +then +cat << END +/* + No good, can't find $EXISTING_CLASS_NAME class definition anywhere. + You'll have to manually edit the header file to add the + following variable definition to the $EXISTING_CLASS_NAME class: + +END +print_variable_definition +echo -e "\n*/" +cat $ORIGINAL_CLASS_HEADER_FILE +else +head -n $LINE $ORIGINAL_CLASS_HEADER_FILE +print_variable_definition +tail -n `expr $LINES - $LINE` $ORIGINAL_CLASS_HEADER_FILE +fi +} + + +[ -f $EXISTING_CLASS_HEADER_FILE ] || { echo "file $EXISTING_CLASS_HEADER_FILE not found" ; exit ; } +# Backup file +mv $EXISTING_CLASS_HEADER_FILE $ORIGINAL_CLASS_HEADER_FILE +print_new_header_file >> $EXISTING_CLASS_HEADER_FILE + + diff --git a/scripts/q_cvs_add b/scripts/q_cvs_add new file mode 100755 index 0000000..693b672 --- a/dev/null +++ b/scripts/q_cvs_add @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Adds a file to which ever repository is appropriate +# +# Copyright 1999-2000 Trolltech AS. All rights reserved. +# + + +if [ $P4PORT = "lupinella:866" ] +then + p4 add $@ +else + echo Need to put some kind of cvs command here in q_cvs_add !! + # cvs add $@ +fi + + diff --git a/scripts/q_cvs_edit b/scripts/q_cvs_edit new file mode 100755 index 0000000..73a04db --- a/dev/null +++ b/scripts/q_cvs_edit @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Adds a file to which ever repository is appropriate +# +# Copyright 1999-2000 Trolltech AS. All rights reserved. +# + + +if [ $P4PORT = "lupinella:866" ] +then + p4 edit $@ +else + echo Need to put some kind of cvs command here in q_cvs_edit !! + # cvs edit $@ +fi + + diff --git a/scripts/q_cvs_submit b/scripts/q_cvs_submit new file mode 100755 index 0000000..6b2b759 --- a/dev/null +++ b/scripts/q_cvs_submit @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Adds a file to which ever repository is appropriate +# +# Copyright 1999-2000 Trolltech AS. All rights reserved. +# + + +if [ $P4PORT = "lupinella:866" ] +then + p4 submit $@ +else + echo Need to put some kind of cvs command here in q_cvs_submit !! + # cvs submit $@ +fi + + diff --git a/scripts/q_functions b/scripts/q_functions new file mode 100755 index 0000000..cf2c2e1 --- a/dev/null +++ b/scripts/q_functions @@ -0,0 +1,232 @@ +#!/bin/sh +# +# Common helper functions used by the other scripts +# +# Copyright 1999-2000 Trolltech AS. All rights reserved. +# + + +function print_example_usage +{ +cat << END +Example of what you do: + ~/qpe$ q_add_application foo Foo MyFooBarApp "A FooBar Application" + ~/qpe$ cd foo + ~/qpe/foo$ q_add_class foo Bar + ~/qpe/foo$ q_add_function public: void Bar::barFoo "( int a, int b )" + ~/qpe/foo$ q_add_variable private: int Bar::fooBarInt +END +} + + +function print_copyright_header +{ +cat << END +/********************************************************************** +** Copyright (C) 2000 Trolltech AS. All rights reserved. +** +** This file is part of Qtopia Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +END +} + + +function print_main_file +{ +print_copyright_header +cat << END +#include +#include +#include "$NEW_CLASS_HEADER_FILE" + + +int main( int argc, char ** argv ) +{ + QPEApplication a( argc, argv ); + + $NEW_CLASS_NAME *m = new $NEW_CLASS_NAME(); + a.setMainWidget( m ); + m->show(); + + return a.exec(); +} +END +} + + +function print_source_file +{ +print_copyright_header +cat << END +#include +#include +#include "$NEW_CLASS_HEADER_FILE" + + +$NEW_CLASS_NAME::$NEW_CLASS_NAME( QWidget *parent=0, const char *name=0, WFlags f = 0) : + QWidget( parent, name, f ) +{ +} + + +void $NEW_CLASS_NAME::exampleFunction( ) +{ +} +END +} + + +function print_header_file +{ +print_copyright_header +cat << END +#ifndef $NEW_CLASS_HEADER_DEFINE +#define $NEW_CLASS_HEADER_DEFINE + + +#include + + +class $NEW_CLASS_NAME : public QWidget +{ +Q_OBJECT +public: + $NEW_CLASS_NAME( QWidget *parent=0, const char *name=0, WFlags f = 0); +protected: + void exampleFunction( ); +private: + int exampleVariable; +}; + + +#endif // $NEW_CLASS_HEADER_DEFINE +END +} + + +function print_pro_file +{ +cat << END +TEMPLATE = app +CONFIG = qt warn_on release +DESTDIR = ../bin +HEADERS = $NEW_CLASS_HEADER_FILE +SOURCES = $NEW_CLASS_SOURCE_FILE $NEW_APP_MAIN_FILE +INTERFACES = +INCLUDEPATH += ../library +DEPENDPATH += ../library +LIBS += -lqpe +TARGET = $NEW_APP_NAME +END +} + + +function print_install_file +{ +cat << END +#!/bin/sh +if [ a\$QPEDIR = a ] +then +echo QPEDIR must be set +exit +fi +[ -f \$QPEDIR/pics/$NEW_APP_ICON_FILE ] || cp $NEW_APP_ICON_FILE \$QPEDIR/pics/ +[ -f \$QPEDIR/apps/$NEW_APP_DESKTOP_FILE ] || cp $NEW_APP_DESKTOP_FILE \$QPEDIR/apps/ +mv \$QPEDIR/Makefile \$QPEDIR/Makefile.orig +sed "s/APPS=/&$NEW_APP_NAME \\\\\\\\ \\\\ + /" \$QPEDIR/Makefile.orig >> \$QPEDIR/Makefile +echo You may wish to move the desktop file in to +echo an appropriate subdirectory of the menus. +END +} + + +function print_desktop_file +{ +cat << END +[Desktop Entry] +Type=Application +Exec=$NEW_APP_NAME +Icon=$NEW_APP_ICON_FILE +Name=$NEW_APP_MENU_NAME +Comment=$NEW_APP_DESCRIPTION +END +} + + +function print_icon_file +{ +XPM_NAME="$NEW_APP_NAME"_xpm +cat << END +/* XPM */ +static char *$XPM_NAME[] = { +"14 14 3 1", +" c None", +". c #000000", +"a c #FFFFFF", +" ", +" aaaaaaaaaaaa ", +" a..........a ", +" a..aaaaaa..a ", +" a.a.aaaa.a.a ", +" a.aa.aa.aa.a ", +" a.aaa..aaa.a ", +" a.aaa..aaa.a ", +" a.aa.aa.aa.a ", +" a.a.aaaa.a.a ", +" a..aaaaaa..a ", +" a..........a ", +" aaaaaaaaaaaa ", +" "}; +END +} + + +function add_class_to_pro_file +{ +cat << END +HEADERS += $NEW_CLASS_HEADER_FILE +SOURCES += $NEW_CLASS_SOURCE_FILE +END +} + + +function get_number_of_lines +{ +# Get the number of lines in the file +LINES=`wc -l $ORIGINAL_CLASS_HEADER_FILE | cut -d " " -f 6` +} + + +function get_first_line_of_class_definition +{ +# First look for class definition with Q_OBJECT a few lines below +LINE=`grep -n -A 3 "class $EXISTING_CLASS_NAME " $ORIGINAL_CLASS_HEADER_FILE | grep "Q_OBJECT" | cut -d "-" -f 1` +if [ -z "$LINE" ] +then +# else look for class definition with open brace on same line +LINE=`grep -n "class $EXISTING_CLASS_NAME.*[{]" $ORIGINAL_CLASS_HEADER_FILE | cut -d ":" -f 1` +#elif doesn't work here +fi;if [ -z "$LINE" ] +then +# else look for class with open brace a few lines below +LINE=`grep -n -A 3 "class $EXISTING_CLASS_NAME " $ORIGINAL_CLASS_HEADER_FILE | grep "\-.*[{]" | cut -d "-" -f 1` +#elif doesn't work here +fi +} + + diff --git a/scripts/updateipks b/scripts/updateipks new file mode 100755 index 0000000..3195f26 --- a/dev/null +++ b/scripts/updateipks @@ -0,0 +1,29 @@ +#!/bin/sh + +RHOST=qpe.sf.net +RDIR=/home/groups/q/qp/qpe/htdocs/packages/ipaq/unstable/ + +NEW="" +rm -f *.ipk +ssh $RHOST -C "cd $RDIR; ls *.ipk" >currentipks & +./mkipks "$@" +wait # for ssh + +for i in *.ipk +do + if grep -q $i currentipks + then + rm $i + else + NEW="$NEW $i"; + fi +done + +if [ -n "$NEW" ] +then + scp $NEW $RHOST:$RDIR + rm $NEW + ssh $RHOST -C "cd $RDIR; chmod g+w *.ipk; ./mkPackages" +fi + +rm currentipks -- cgit v0.9.0.2