r3536 - in developers: . john_lee john_lee/toolkit john_lee/toolkit/myapp john_lee/toolkit/scripts

john_lee at sita.openmoko.org john_lee at sita.openmoko.org
Fri Nov 30 06:42:39 CET 2007


Author: john_lee
Date: 2007-11-30 06:42:31 +0100 (Fri, 30 Nov 2007)
New Revision: 3536

Added:
   developers/john_lee/
   developers/john_lee/toolkit/
   developers/john_lee/toolkit/README
   developers/john_lee/toolkit/build/
   developers/john_lee/toolkit/conf.sh
   developers/john_lee/toolkit/ipkg-build.sh
   developers/john_lee/toolkit/myapp/
   developers/john_lee/toolkit/myapp/Makefile.am
   developers/john_lee/toolkit/myapp/configure.ac
   developers/john_lee/toolkit/myapp/example.c
   developers/john_lee/toolkit/scripts/
   developers/john_lee/toolkit/scripts/ipkg-build
   developers/john_lee/toolkit/scripts/ipkg-unbuild
   developers/john_lee/toolkit/scripts/script-env
   developers/john_lee/toolkit/setup-env
Log:
The initial version of openmoko toolkit
must be used with openmoko toolchain.


Added: developers/john_lee/toolkit/README
===================================================================
--- developers/john_lee/toolkit/README	2007-11-30 00:38:12 UTC (rev 3535)
+++ developers/john_lee/toolkit/README	2007-11-30 05:42:31 UTC (rev 3536)
@@ -0,0 +1,55 @@
+Introduction
+============
+
+This kit is meant to be used with the prebuilt openmoko toolchain to
+ease the effort to develop on openmoko platform.
+
+
+Prerequisites
+=============
+
+Must install openmoko toolchain in absolute path /usr/local/openmoko
+For instructions about how to get/install it, please refer to
+
+http://wiki.openmoko.org/wiki/Toolchain
+
+
+Quick start
+===========
+
+Put your own application with autotools (configure.ac or configure,
+etc) under this directory, e.g. `myapp', then do the following:
+
+$ ./conf.sh myapp
+$ . setup-env
+$ cd myapp
+<do the editing>
+$ make
+$ cd ..
+$ ./ipkg-build.sh
+
+You got ipkg under directory `build'.
+
+
+User configuraion
+=================
+
+May edit variables in scripts/script-env
+
+If the application need extra configure or autoreconf arguments, they
+could be specified when executing `conf.sh':
+
+EXTRA_OECONF=" --without-foo --enable-bar" ./conf.sh myapp
+
+
+Document
+========
+
+Please refer to http://wiki.openmoko.org/wiki/Toolchain
+
+
+Feedback
+========
+
+Direct your question to openmoko-devel at lists.openmoko.org (preferred)
+or john_lee at openmoko.com

Added: developers/john_lee/toolkit/conf.sh
===================================================================
--- developers/john_lee/toolkit/conf.sh	2007-11-30 00:38:12 UTC (rev 3535)
+++ developers/john_lee/toolkit/conf.sh	2007-11-30 05:42:31 UTC (rev 3536)
@@ -0,0 +1,146 @@
+#!/bin/sh
+
+set -ex
+
+# extract/modified from OE autotools.bbclass
+# this scripts will call native autoconf tools.  if it's not installed
+# we're in trouble.
+
+# FIXME: this requires glib native installed, which is not in the toolchain yet.
+# FIXME: this requires intltool native installed, which is not in the toolchain yet.
+
+absolute_path () {
+	local S D B
+	S=$1
+	D=$(dirname $S)
+	B=$(basename $S)
+	echo "`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`/$B"
+}
+
+error_exit () {
+	echo usage: $(basename $0) [app_dir_name]
+	exit 1
+}
+
+abspath=$(dirname $(absolute_path $0))
+
+. ${abspath}/setup-env
+. ${abspath}/scripts/script-env
+
+test -z $1 && error_exit
+S=$(absolute_path $1)
+test ! -d $S && error_exit
+
+#EXTRA_OECONF=
+#EXTRA_OEMAKE=
+#EXTRA_AUTORECONF=
+
+acpaths="default"
+
+oefatal() {
+	echo "FATAL:" "$*"
+	exit 1
+
+}
+
+oenote() {
+	echo "NOTE:" "$*"
+
+}
+
+oe_runconf () {
+	if [ -x ${S}/configure ] ; then
+		cfgcmd="${S}/configure \
+		    --build=${BUILD_SYS} \
+		    --host=${HOST_SYS} \
+		    --target=${TARGET_SYS} \
+		    --prefix=${prefix} \
+		    --exec_prefix=${exec_prefix} \
+		    --bindir=${bindir} \
+		    --sbindir=${sbindir} \
+		    --libexecdir=${libexecdir} \
+		    --datadir=${datadir} \
+		    --sysconfdir=${sysconfdir} \
+		    --sharedstatedir=${sharedstatedir} \
+		    --localstatedir=${localstatedir} \
+		    --libdir=${libdir} \
+		    --includedir=${includedir} \
+		    --oldincludedir=${oldincludedir} \
+		    --infodir=${infodir} \
+		    --mandir=${mandir} \
+			${EXTRA_OECONF} \
+		    $@"
+		oenote "Running $cfgcmd..."
+		$cfgcmd || oefatal "oe_runconf failed" 
+	else
+		oefatal "no configure script found"
+	fi
+}
+
+autotools_do_configure() {
+	# WARNING: gross hack follows:
+	# An autotools built package generally needs these scripts, however only
+	# automake or libtoolize actually install the current versions of them.
+	# This is a problem in builds that do not use libtool or automake, in the case
+	# where we -need- the latest version of these scripts.  e.g. running a build
+	# for a package whose autotools are old, on an x86_64 machine, which the old
+	# config.sub does not support.  Work around this by installing them manually
+	# regardless.
+	( for ac in `find ${S} -name configure.in -o -name configure.ac`; do
+			rm -f `dirname $ac`/configure
+			done )
+	if [ -e ${S}/configure.in -o -e ${S}/configure.ac ]; then
+		olddir=`pwd`
+		cd ${S}
+		if [ x"${acpaths}" = xdefault ]; then
+			acpaths=
+			for i in `find ${S} -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
+				grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do
+				acpaths="$acpaths -I $i"
+			done
+		else
+			acpaths="${acpaths}"
+		fi
+		AUTOV=`automake --version |head -n 1 |sed "s/.* //;s/\.[0-9]\+$//"`
+		automake --version
+		echo "AUTOV is $AUTOV"
+		#install -d ${STAGING_DATADIR}/aclocal
+		#install -d ${STAGING_DATADIR}/aclocal-$AUTOV
+		acpaths="$acpaths -I${STAGING_DATADIR}/aclocal-$AUTOV -I ${STAGING_DATADIR}/aclocal"
+		# autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
+		# like it was auto-generated.  Work around this by blowing it away
+		# by hand, unless the package specifically asked not to run aclocal.
+		if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then
+			rm -f aclocal.m4
+		fi
+		if [ -e configure.in ]; then
+			CONFIGURE_AC=configure.in
+		else
+			CONFIGURE_AC=configure.ac
+		fi
+		if grep "^AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
+			if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then
+				: do nothing -- we still have an old unmodified configure.ac
+			else
+				oenote Executing glib-gettextize --force --copy
+				echo "no" | glib-gettextize --force --copy
+			fi
+		fi
+		if grep "^[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then
+			oenote Executing intltoolize --copy --force --automake
+			intltoolize --copy --force --automake
+		fi
+		oenote Executing autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths
+		mkdir -p m4
+		autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || oefatal "autoreconf execution failed."
+		cd $olddir
+	fi
+	if [ -e ${S}/configure ]; then
+		oe_runconf
+	else
+		oenote "nothing to configure"
+	fi
+}
+
+cd ${S}
+autotools_do_configure ${S}


Property changes on: developers/john_lee/toolkit/conf.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: developers/john_lee/toolkit/ipkg-build.sh
===================================================================
--- developers/john_lee/toolkit/ipkg-build.sh	2007-11-30 00:38:12 UTC (rev 3535)
+++ developers/john_lee/toolkit/ipkg-build.sh	2007-11-30 05:42:31 UTC (rev 3536)
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+set -ex
+
+absolute_path () {
+	local S D B
+	S=$1
+	D=$(dirname $S)
+	B=$(basename $S)
+	echo "`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`/$B"
+}
+
+error_exit () {
+	echo usage: $(basename $0) [app_dir_name]
+	exit 1
+}
+
+abspath=$(dirname $(absolute_path $0))
+
+. ${abspath}/setup-env
+
+test -z $1 && error_exit
+S=$(absolute_path $1)
+test ! -d $S && error_exit
+
+appname=$(basename ${S})
+tmpdir=${abspath}/build/tmp/${appname}
+
+if test -e "${tmpdir}"
+then
+    rm -rf "${tmpdir}"/*
+else
+    mkdir -p ${tmpdir}
+fi
+
+cd ${S}
+make install DESTDIR="${tmpdir}"
+cd ${tmpdir}
+mkdir CONTROL
+cat >CONTROL/control <<EOF
+Package: $appname
+Version: 0.1
+Description: package built by openmoko toolchain
+Section: openmoko/applications
+Priority: optional
+Maintainer: $USER
+Architecture: armv4t
+Homepage: http://www.openmoko.org
+Depends: 
+Source: ${S}
+EOF
+cd ../../
+${abspath}/scripts/ipkg-build -o 0 -g 0 ${tmpdir}


Property changes on: developers/john_lee/toolkit/ipkg-build.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: developers/john_lee/toolkit/myapp/Makefile.am
===================================================================
--- developers/john_lee/toolkit/myapp/Makefile.am	2007-11-30 00:38:12 UTC (rev 3535)
+++ developers/john_lee/toolkit/myapp/Makefile.am	2007-11-30 05:42:31 UTC (rev 3536)
@@ -0,0 +1,6 @@
+AUTOMAKE_OPTIONS = foreign
+bin_PROGRAMS = example
+example_SOURCES = example.c
+
+AM_CFLAGS = @GTK_CFLAGS@
+AM_LDFLAGS = @GTK_LIBS@

Added: developers/john_lee/toolkit/myapp/configure.ac
===================================================================
--- developers/john_lee/toolkit/myapp/configure.ac	2007-11-30 00:38:12 UTC (rev 3535)
+++ developers/john_lee/toolkit/myapp/configure.ac	2007-11-30 05:42:31 UTC (rev 3536)
@@ -0,0 +1,23 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.61)
+AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
+AM_INIT_AUTOMAKE()
+AC_CONFIG_SRCDIR([example.c])
+AC_CONFIG_HEADER([config.h])
+
+# Checks for programs.
+AC_PROG_CC
+
+# Checks for libraries.
+PKG_CHECK_MODULES(GTK, gtk+-2.0)
+
+# Checks for header files.
+
+# Checks for typedefs, structures, and compiler characteristics.
+
+# Checks for library functions.
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT

Added: developers/john_lee/toolkit/myapp/example.c
===================================================================
--- developers/john_lee/toolkit/myapp/example.c	2007-11-30 00:38:12 UTC (rev 3535)
+++ developers/john_lee/toolkit/myapp/example.c	2007-11-30 05:42:31 UTC (rev 3536)
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2007 OpenedHand Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <gtk/gtk.h>
+
+
+/* type definitions */
+
+typedef struct
+{
+  GtkWidget *search_entry;
+  GtkWidget *filter_combo;
+} ApplicationData;
+
+/* signal callbacks */
+
+static void search_toggle_cb (GtkWidget * button, ApplicationData * data);
+
+int
+main (int argc, char **argv)
+{
+  GtkWidget *window, *notebook, *icon;
+  GtkWidget *box, *hbox, *toolbar, *details, *navigation, *w;
+  GtkTreeViewColumn *column;
+  GtkWidget *widget;
+  GtkToolItem *toolitem;
+  GtkListStore *liststore;
+  GtkTreeIter it;
+  ApplicationData *data;
+
+  gtk_init (&argc, &argv);
+
+  data = g_new0 (ApplicationData, 1);
+
+  /* main window */
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  g_signal_connect (G_OBJECT (window), "delete-event",
+                    (GCallback) gtk_main_quit, NULL);
+  gtk_window_set_title (GTK_WINDOW (window), "Example");
+
+  /* main notebook */
+  notebook = gtk_notebook_new ();
+  gtk_container_add (GTK_CONTAINER (window), notebook);
+  gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_BOTTOM);
+
+  /* navigation */
+  box = gtk_vbox_new (FALSE, 0);
+  gtk_notebook_append_page (GTK_NOTEBOOK (notebook), box,
+                            gtk_image_new_from_stock (GTK_STOCK_INDEX,
+                                                      GTK_ICON_SIZE_LARGE_TOOLBAR));
+  gtk_container_child_set (GTK_CONTAINER (notebook), box, "tab-expand",
+                           TRUE, NULL);
+
+  /* toolbar */
+  toolbar = gtk_toolbar_new ();
+  gtk_box_pack_start (GTK_BOX (box), toolbar, FALSE, FALSE, 0);
+
+  toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_NEW);
+  gtk_tool_item_set_expand (toolitem, TRUE);
+  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, 0);
+
+  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), gtk_separator_tool_item_new (),
+                      1);
+
+  toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_DELETE);
+  gtk_tool_item_set_expand (toolitem, TRUE);
+  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, 2);
+
+  /* search/filter bar */
+  hbox = gtk_hbox_new (FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0);
+
+  w = gtk_toggle_button_new ();
+  gtk_widget_set_name (w, "mokosearchbutton");
+  g_signal_connect (G_OBJECT (w), "toggled", (GCallback) search_toggle_cb,
+                    data);
+  gtk_button_set_image (GTK_BUTTON (w),
+                        gtk_image_new_from_stock (GTK_STOCK_FIND,
+                                                  GTK_ICON_SIZE_SMALL_TOOLBAR));
+  gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
+
+  data->search_entry = gtk_entry_new ();
+  gtk_widget_set_name (data->search_entry, "mokosearchentry");
+  g_object_set (G_OBJECT (data->search_entry), "no-show-all", TRUE, NULL);
+  gtk_box_pack_start (GTK_BOX (hbox), data->search_entry, TRUE, TRUE, 0);
+
+  data->filter_combo = gtk_combo_box_new_text ();
+  gtk_combo_box_append_text (GTK_COMBO_BOX (data->filter_combo),
+                             "Filter Menu");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (data->filter_combo), "Small");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (data->filter_combo), "Medium");
+  gtk_combo_box_append_text (GTK_COMBO_BOX (data->filter_combo), "Large");
+  gtk_combo_box_set_active (GTK_COMBO_BOX (data->filter_combo), 0);
+  gtk_box_pack_start (GTK_BOX (hbox), data->filter_combo, TRUE, TRUE, 0);
+
+
+  /* list */
+  w = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (w),
+                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+  gtk_box_pack_start (GTK_BOX (box), w, TRUE, TRUE, 0);
+
+
+  liststore = gtk_list_store_new (1, G_TYPE_STRING);
+  gtk_list_store_insert_with_values (liststore, &it, 0, 0, "One", -1);
+  gtk_list_store_insert_with_values (liststore, &it, 1, 0, "Two", -1);
+  gtk_list_store_insert_with_values (liststore, &it, 2, 0, "Skip a few", -1);
+  gtk_list_store_insert_with_values (liststore, &it, 3, 0, "Ninety Nine", -1);
+  gtk_list_store_insert_with_values (liststore, &it, 4, 0, "One Hundred", -1);
+
+  navigation = gtk_tree_view_new_with_model (GTK_TREE_MODEL (liststore));
+  column = gtk_tree_view_column_new_with_attributes ("Counting",
+                                                     gtk_cell_renderer_text_new
+                                                     (), "text", 0, NULL);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (navigation), column);
+  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (navigation), FALSE);
+  gtk_container_add (GTK_CONTAINER (w), navigation);
+
+
+  /* details */
+  details = gtk_vbox_new (FALSE, 6);
+  
+  widget = gtk_entry_new ();
+  gtk_entry_set_text (GTK_ENTRY (widget), "Hello, I am an entry");
+  gtk_box_pack_start (GTK_BOX (details), widget, FALSE, FALSE, 0);
+
+  widget = gtk_button_new_from_stock (GTK_STOCK_ADD);
+  gtk_box_pack_start (GTK_BOX (details), widget, FALSE, FALSE, 0);
+
+  widget = gtk_check_button_new_with_label ("Checkbutton");
+  gtk_box_pack_start (GTK_BOX (details), widget, FALSE, FALSE, 0);
+
+  widget = gtk_spin_button_new_with_range (0, 100, 1);
+  gtk_box_pack_start (GTK_BOX (details), widget, FALSE, FALSE, 0);
+  
+  widget = gtk_radio_button_new_with_label (NULL, "RadioButton 1");
+  gtk_box_pack_start (GTK_BOX (details), widget, FALSE, FALSE, 0);
+
+  widget = gtk_radio_button_new_with_label_from_widget (
+                                                     GTK_RADIO_BUTTON (widget), 
+                                                        "RadioButton 2");
+  gtk_box_pack_start (GTK_BOX (details), widget, FALSE, FALSE, 0);
+
+  widget = gtk_radio_button_new_with_label (NULL, "RadioButton 3");
+  gtk_widget_set_state (widget, GTK_STATE_INSENSITIVE);
+  gtk_box_pack_start (GTK_BOX (details), widget, FALSE, FALSE, 0);
+
+  gtk_notebook_append_page (GTK_NOTEBOOK (notebook), details,
+                            gtk_image_new_from_stock (GTK_STOCK_EDIT,
+                                                      GTK_ICON_SIZE_LARGE_TOOLBAR));
+  gtk_container_child_set (GTK_CONTAINER (notebook), details, "tab-expand",
+                           TRUE, NULL);
+
+
+  /* let's go! */
+  gtk_widget_show_all (window);
+  gtk_main ();
+
+  g_free (data);
+  return 0;
+}
+
+/* signal callbacks */
+
+static void
+search_toggle_cb (GtkWidget * button, ApplicationData * data)
+{
+/*  gboolean search;
+
+  search = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+
+  if (search)
+    {
+      gtk_widget_show (data->search_entry);
+      gtk_widget_hide (data->filter_combo);
+    }
+  else
+    {
+      gtk_widget_show (data->filter_combo);
+      gtk_widget_hide (data->search_entry);
+    }*/
+  g_object_set (G_OBJECT (data->search_entry), "visible",
+    !GTK_WIDGET_VISIBLE (data->search_entry), NULL);
+  g_object_set (G_OBJECT (data->filter_combo), "visible",
+    !GTK_WIDGET_VISIBLE (data->filter_combo), NULL);
+}
+

Added: developers/john_lee/toolkit/scripts/ipkg-build
===================================================================
--- developers/john_lee/toolkit/scripts/ipkg-build	2007-11-30 00:38:12 UTC (rev 3535)
+++ developers/john_lee/toolkit/scripts/ipkg-build	2007-11-30 05:42:31 UTC (rev 3536)
@@ -0,0 +1,246 @@
+#!/bin/sh
+
+# ipkg-build -- construct a .ipk from a directory
+# Carl Worth <cworth at east.isi.edu>
+# based on a script by Steve Redler IV, steve at sr-tech.com 5-21-2001
+# 2003-04-25 rea at sr.unh.edu
+#   Updated to work on Familiar Pre0.7rc1, with busybox tar.
+#   Note it Requires: binutils-ar (since the busybox ar can't create)
+#   For UID debugging it needs a better "find".
+set -e
+
+version=1.0
+
+ipkg_extract_value() {
+	sed -e "s/^[^:]*:[[:space:]]*//"
+}
+
+required_field() {
+	field=$1
+
+	value=`grep "^$field:" < $CONTROL/control | ipkg_extract_value`
+	if [ -z "$value" ]; then
+		echo "*** Error: $CONTROL/control is missing field $field" >&2
+		return 1
+	fi
+	echo $value
+	return 0
+}
+
+disallowed_field() {
+	field=$1
+
+	value=`grep "^$field:" < $CONTROL/control | ipkg_extract_value`
+	if [ -n "$value" ]; then
+		echo "*** Error: $CONTROL/control contains disallowed field $field" >&2
+		return 1
+	fi
+	echo $value
+	return 0
+}
+
+pkg_appears_sane() {
+	local pkg_dir=$1
+
+	local owd=`pwd`
+	cd $pkg_dir
+
+	PKG_ERROR=0
+
+	tilde_files=`find . -name '*~'`
+	if [ -n "$tilde_files" ]; then
+	    if [ "$noclean" = "1" ]; then
+		echo "*** Warning: The following files have names ending in '~'.
+You probably want to remove them: " >&2
+		ls -ld $tilde_files
+		echo >&2
+	    else
+		echo "*** Removing the following files: $tilde_files"
+		rm -f "$tilde_files"
+	    fi
+	fi
+
+	large_uid_files=`find . -uid +99 || true`
+
+	if [ "$ogargs" = "" ]  && [ -n "$large_uid_files" ]; then
+		echo "*** Warning: The following files have a UID greater than 99.
+You probably want to chown these to a system user: " >&2
+		ls -ld $large_uid_files
+		echo >&2
+	fi
+	    
+
+	if [ ! -f "$CONTROL/control" ]; then
+		echo "*** Error: Control file $pkg_dir/$CONTROL/control not found." >&2
+		cd $owd
+		return 1
+	fi
+
+	pkg=`required_field Package`
+	[ "$?" -ne 0 ] && PKG_ERROR=1
+
+	version=`required_field Version | sed 's/Version://; s/^.://g;'`
+	[ "$?" -ne 0 ] && PKG_ERROR=1
+
+	arch=`required_field Architecture`
+	[ "$?" -ne 0 ] && PKG_ERROR=1
+
+	required_field Maintainer >/dev/null
+	[ "$?" -ne 0 ] && PKG_ERROR=1
+
+	required_field Description >/dev/null
+	[ "$?" -ne 0 ] && PKG_ERROR=1
+
+	section=`required_field Section`
+	[ "$?" -ne 0 ] && PKG_ERROR=1
+	if [ -z "$section" ]; then
+	    echo "The Section field should have one of the following values:" >&2
+	    echo "admin, base, comm, editors, extras, games, graphics, kernel, libs, misc, net, text, web, x11" >&2
+	fi
+
+	priority=`required_field Priority`
+	[ "$?" -ne 0 ] && PKG_ERROR=1
+	if [ -z "$priority" ]; then
+	    echo "The Priority field should have one of the following values:" >&2
+	    echo "required, important, standard, optional, extra." >&2
+	    echo "If you don't know which priority value you should be using, then use \`optional'" >&2
+	fi
+
+	source=`required_field Source`
+	[ "$?" -ne 0 ] && PKG_ERROR=1
+	if [ -z "$source" ]; then
+	    echo "The Source field contain the URL's or filenames of the source code and any patches" 
+	    echo "used to build this package.  Either gnu-style tarballs or Debian source packages "
+	    echo "are acceptable.  Relative filenames may be used if they are distributed in the same"
+	    echo "directory as the .ipk file."
+	fi
+
+	disallowed_filename=`disallowed_field Filename`
+	[ "$?" -ne 0 ] && PKG_ERROR=1
+
+	if echo $pkg | grep '[^a-z0-9.+-]'; then
+		echo "*** Error: Package name $name contains illegal characters, (other than [a-z0-9.+-])" >&2
+		PKG_ERROR=1;
+	fi
+
+	local bad_fields=`sed -ne 's/^\([^[:space:]][^:[:space:]]\+[[:space:]]\+\)[^:].*/\1/p' < $CONTROL/control | sed -e 's/\\n//'`
+	if [ -n "$bad_fields" ]; then
+		bad_fields=`echo $bad_fields`
+		echo "*** Error: The following fields in $CONTROL/control are missing a ':'" >&2
+		echo "	$bad_fields" >&2
+		echo "ipkg-build: This may be due to a missing initial space for a multi-line field value" >&2
+		PKG_ERROR=1
+	fi
+
+	for script in $CONTROL/preinst $CONTROL/postinst $CONTROL/prerm $CONTROL/postrm; do
+		if [ -f $script -a ! -x $script ]; then
+			echo "*** Error: package script $script is not executable" >&2
+			PKG_ERROR=1
+		fi
+	done
+
+	if [ -f $CONTROL/conffiles ]; then
+		for cf in `cat $CONTROL/conffiles`; do
+			if [ ! -f ./$cf ]; then
+				echo "*** Error: $CONTROL/conffiles mentions conffile $cf which does not exist" >&2
+				PKG_ERROR=1
+			fi
+		done
+	fi
+
+	cd $owd
+	return $PKG_ERROR
+}
+
+###
+# ipkg-build "main"
+###
+ogargs=""
+outer=ar
+noclean=0
+usage="Usage: $0 [-c] [-C] [-o owner] [-g group] <pkg_directory> [<destination_directory>]"
+while getopts "cg:ho:v" opt; do
+    case $opt in
+	o ) owner=$OPTARG
+	    ogargs="--owner=$owner"
+	    ;;
+	g ) group=$OPTARG
+	    ogargs="$ogargs --group=$group"
+	    ;;
+        c ) outer=tar
+            ;;
+        C ) noclean=1
+            ;;
+	v ) echo $version
+	    exit 0
+	    ;;
+	h ) 	echo $usage  >&2 ;;
+	\? ) 	echo $usage  >&2
+	esac
+done
+
+
+shift $(($OPTIND - 1))
+
+# continue on to process additional arguments
+
+case $# in
+1)
+	dest_dir=$PWD
+	;;
+2)
+	dest_dir=$2
+	if [ "$dest_dir" = "." -o "$dest_dir" = "./" ] ; then
+	    dest_dir=$PWD
+	fi
+	;;
+*)
+	echo $usage >&2
+	exit 1 
+	;;
+esac
+
+pkg_dir=$1
+
+if [ ! -d $pkg_dir ]; then
+	echo "*** Error: Directory $pkg_dir does not exist" >&2
+	exit 1
+fi
+
+# CONTROL is second so that it takes precedence
+CONTROL=
+[ -d $pkg_dir/DEBIAN ] && CONTROL=DEBIAN
+[ -d $pkg_dir/CONTROL ] && CONTROL=CONTROL
+if [ -z "$CONTROL" ]; then
+	echo "*** Error: Directory $pkg_dir has no CONTROL subdirectory." >&2
+	exit 1
+fi
+
+if ! pkg_appears_sane $pkg_dir; then
+	echo >&2
+	echo "ipkg-build: Please fix the above errors and try again." >&2
+	exit 1
+fi
+
+tmp_dir=$dest_dir/IPKG_BUILD.$$
+mkdir $tmp_dir
+
+echo $CONTROL > $tmp_dir/tarX
+( cd $pkg_dir && tar $ogargs -X $tmp_dir/tarX -czf $tmp_dir/data.tar.gz . )
+( cd $pkg_dir/$CONTROL && tar $ogargs -czf $tmp_dir/control.tar.gz . )
+rm $tmp_dir/tarX
+
+echo "2.0" > $tmp_dir/debian-binary
+
+pkg_file=$dest_dir/${pkg}_${version}_${arch}.ipk
+rm -f $pkg_file
+if [ "$outer" = "ar" ] ; then
+  ( cd $tmp_dir && ar -crf $pkg_file ./debian-binary ./data.tar.gz ./control.tar.gz )
+else
+  ( cd $tmp_dir && tar -zcf $pkg_file ./debian-binary ./data.tar.gz ./control.tar.gz )
+fi
+
+rm $tmp_dir/debian-binary $tmp_dir/data.tar.gz $tmp_dir/control.tar.gz
+rmdir $tmp_dir
+
+echo "Packaged contents of $pkg_dir into $pkg_file"


Property changes on: developers/john_lee/toolkit/scripts/ipkg-build
___________________________________________________________________
Name: svn:executable
   + *

Added: developers/john_lee/toolkit/scripts/ipkg-unbuild
===================================================================
--- developers/john_lee/toolkit/scripts/ipkg-unbuild	2007-11-30 00:38:12 UTC (rev 3535)
+++ developers/john_lee/toolkit/scripts/ipkg-unbuild	2007-11-30 05:42:31 UTC (rev 3536)
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+
+import sys, os, re
+
+if (len(sys.argv) == 0):
+    print 'usage: %s: package.ipk' % sys.argv[0]
+    sys.exit(1)
+
+for filename in sys.argv[1:]:
+    m = re.match('((.*/)*)(.*)', filename)
+    pkg = m.group(3)
+    m = re.match('(.*)((.ipk)|(.deb))', filename)
+    if m:
+        pkg = m.group(1)
+
+    os.system('rm -fr %s' % pkg)
+    os.mkdir(pkg)
+    os.mkdir(pkg + '/CONTROL')
+
+    os.system('cd %s; (ar x ../%s || tar zxf ../%s) >& /dev/null' % (pkg, filename, filename))
+
+    os.system('tar xzf %s/data.tar.gz -C %s' % (pkg, pkg))
+    os.system('tar xzf %s/control.tar.gz -C %s/CONTROL' % (pkg, pkg))
+    os.system('rm -f %s/control.tar.gz %s/data.tar.gz %s/debian-binary' % (pkg, pkg, pkg))


Property changes on: developers/john_lee/toolkit/scripts/ipkg-unbuild
___________________________________________________________________
Name: svn:executable
   + *

Added: developers/john_lee/toolkit/scripts/script-env
===================================================================
--- developers/john_lee/toolkit/scripts/script-env	2007-11-30 00:38:12 UTC (rev 3535)
+++ developers/john_lee/toolkit/scripts/script-env	2007-11-30 05:42:31 UTC (rev 3536)
@@ -0,0 +1,158 @@
+
+# put extra configure arguments here.
+EXTRA_OECONF=
+
+# put extra autoreconf arguments here.
+EXTRA_AUTORECONF=
+
+# do not modify anything below.
+EXTRA_OEMAKE=
+
+STAGING_DATADIR=${OMTOOL_DIR}/arm-angstrom-linux-gnueabi/share/aclocal
+BUILD_SYS="x86_64-linux"
+HOST_SYS="arm-angstrom-linux-gnueabi"
+TARGET_SYS="arm-angstrom-linux-gnueabi"
+
+export localstatedir="/var"
+
+export prefix="/usr"
+
+export STRIP="arm-angstrom-linux-gnueabi-strip"
+
+#export STAGING_SIPDIR="/home/john/moko/build/openmoko/staging/x86_64-linux/share/sip"
+
+export libexecdir="/usr/libexec"
+
+export datadir="/usr/share"
+
+#export BUILD_CXX="ccache g++"
+
+export LD="arm-angstrom-linux-gnueabi-ld"
+
+export bindir="/usr/bin"
+
+#export TARGET_CXXFLAGS="-isystem/home/john/moko/build/openmoko/staging/arm-angstrom-linux-gnueabi/include -fexpensive-optimizations -fomit-frame-pointer -frename-registers -Os -fpermissive"
+
+export includedir="/usr/include"
+
+#export MANIFEST="/home/john/moko/openembedded/packages/openmoko2/./manifest"
+
+#export BUILD_CC="ccache gcc"
+
+#export BUILD_LDFLAGS="-L/home/john/moko/build/openmoko/staging/x86_64-linux/lib -Wl,-rpath-link,/home/john/moko/build/openmoko/staging/x86_64-linux/lib -Wl,-rpath,/home/john/moko/build/openmoko/staging/x86_64-linux/lib -Wl,-O1"
+
+#export BUILD_LD="ld"
+
+export oldincludedir="/usr/include"
+
+#export BUILD_CCLD="gcc"
+
+#export palmtopdir="/usr/lib/opie"
+
+export CC="ccache arm-angstrom-linux-gnueabi-gcc -march=armv4t -mtune=arm920t"
+
+export PATH="${OMTOOL_DIR}/arm/bin:${PATH}"
+
+#export TARGET_CFLAGS="-isystem/home/john/moko/build/openmoko/staging/arm-angstrom-linux-gnueabi/include -fexpensive-optimizations -fomit-frame-pointer -frename-registers -Os"
+
+export CPPFLAGS="-isystem/home/john/moko/build/openmoko/staging/arm-angstrom-linux-gnueabi/include"
+
+export RANLIB="arm-angstrom-linux-gnueabi-ranlib"
+
+export CXX="ccache arm-angstrom-linux-gnueabi-g++ -march=armv4t -mtune=arm920t"
+
+#export BUILD_RANLIB="ranlib"
+
+export mandir="/usr/share/man"
+
+export sharedstatedir="/usr/com"
+
+export OBJCOPY="arm-angstrom-linux-gnueabi-objcopy"
+
+#export base_libdir="/lib"
+
+#export servicedir="/srv"
+
+export PKG_CONFIG_DIR="${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib/pkgconfig"
+
+export LDFLAGS="-L/home/john/moko/build/openmoko/staging/arm-angstrom-linux-gnueabi/lib -Wl,-rpath-link,/home/john/moko/build/openmoko/staging/arm-angstrom-linux-gnueabi/lib -Wl,-O1"
+
+export sysconfdir="/etc"
+
+export CCLD="ccache arm-angstrom-linux-gnueabi-gcc -march=armv4t -mtune=arm920t"
+
+export MAKE="make"
+
+#export base_bindir="/bin"
+
+export sbindir="/usr/sbin"
+
+export CFLAGS="-isystem${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/include -fexpensive-optimizations -fomit-frame-pointer -frename-registers -Os"
+
+#export TARGET_LDFLAGS="-L/home/john/moko/build/openmoko/staging/arm-angstrom-linux-gnueabi/lib -Wl,-rpath-link,/home/john/moko/build/openmoko/staging/arm-angstrom-linux-gnueabi/lib -Wl,-O1"
+
+export libdir="/usr/lib"
+
+export PKG_CONFIG_DISABLE_UNINSTALLED="yes"
+
+#export OPIEDIR="/home/john/moko/build/openmoko/staging/arm-angstrom-linux-gnueabi"
+
+#export BUILD_F77="ccache g77"
+
+#export PATCH_GET="0"
+
+export CXXFLAGS="-isystem${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/include -fexpensive-optimizations -fomit-frame-pointer -frename-registers -Os -fpermissive -fvisibility-inlines-hidden"
+
+#export QMAKE_MKSPEC_PATH="/home/john/moko/build/openmoko/staging/x86_64-linux/share/qmake"
+
+export F77="ccache arm-angstrom-linux-gnueabi-g77 -march=armv4t -mtune=arm920t"
+
+#export QTDIR="/home/john/moko/build/openmoko/staging/arm-angstrom-linux-gnueabi/qt2"
+
+#export QPEDIR="/home/john/moko/build/openmoko/staging/arm-angstrom-linux-gnueabi"
+
+#export BUILD_CXXFLAGS="-isystem/home/john/moko/build/openmoko/staging/x86_64-linux/include -Os -fpermissive"
+
+#export SHELLCMDS="bash --rcfile $TERMRCFILE"
+
+#export BBPATH="/home/john/moko/openembedded/packages/openmoko2:/home/john/moko/openembedded/conf/distro/include:/home/john/moko/openembedded/conf/distro/include:/home/john/moko/openembedded/conf/distro/include:/home/john/moko/openembedded/conf/distro/include:/home/john/moko/openembedded/conf/distro/include:/home/john/moko/openembedded/conf/distro/include:/home/john/moko/openembedded/conf/distro/include:/home/john/moko/openembedded/conf/distro/include:/home/john/moko/openembedded/conf/distro/include:/home/john/moko/openembedded/conf/machine/include:/home/john/moko/build:/home/john/moko/openembedded"
+
+#export BUILD_CPP="cpp"
+
+#export BUILD_CFLAGS="-isystem/home/john/moko/build/openmoko/staging/x86_64-linux/include -Os"
+
+#export docdir="/usr/share/doc"
+
+export infodir="/usr/share/info"
+
+#export base_sbindir="/sbin"
+
+export PKG_CONFIG_PATH="${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib/pkgconfig"
+
+export AS="arm-angstrom-linux-gnueabi-as"
+
+export AR="arm-angstrom-linux-gnueabi-ar"
+
+#export BUILD_CPPFLAGS="-isystem/home/john/moko/build/openmoko/staging/x86_64-linux/include"
+
+export CPP="arm-angstrom-linux-gnueabi-gcc -E"
+
+#export CONFIG_SITE="/home/john/moko/openembedded/site/endian-little /home/john/moko/openembedded/site/common-glibc /home/john/moko/openembedded/site/arm-common /home/john/moko/openembedded/site/arm-linux /home/john/moko/openembedded/site/common /home/john/moko/openembedded/site/common"
+
+#export TARGET_CPPFLAGS="-isystem/home/john/moko/build/openmoko/staging/arm-angstrom-linux-gnueabi/include"
+
+export exec_prefix="/usr"
+
+#export STAGING_IDLDIR="/home/john/moko/build/openmoko/staging/arm-angstrom-linux-gnueabi/share/idl"
+
+unset MACHINE
+
+#export BUILD_AR="ar"
+
+export OBJDUMP="arm-angstrom-linux-gnueabi-objdump"
+
+unset DISTRO
+
+#export palmqtdir="/usr/lib/opie"
+
+#export BUILD_STRIP="strip"

Added: developers/john_lee/toolkit/setup-env
===================================================================
--- developers/john_lee/toolkit/setup-env	2007-11-30 00:38:12 UTC (rev 3535)
+++ developers/john_lee/toolkit/setup-env	2007-11-30 05:42:31 UTC (rev 3536)
@@ -0,0 +1,22 @@
+OMTOOL_DIR="/usr/local/openmoko"
+(echo "$PATH" | grep -q "${OMTOOL_DIR}/arm/bin") || export PATH="${OMTOOL_DIR}/arm/bin:${PATH}"
+export STRIP="arm-angstrom-linux-gnueabi-strip"
+export LD="arm-angstrom-linux-gnueabi-ld"
+export CC="ccache arm-angstrom-linux-gnueabi-gcc -march=armv4t -mtune=arm920t"
+export CPPFLAGS="-isystem/home/john/moko/build/openmoko/staging/arm-angstrom-linux-gnueabi/include"
+export RANLIB="arm-angstrom-linux-gnueabi-ranlib"
+export CXX="ccache arm-angstrom-linux-gnueabi-g++ -march=armv4t -mtune=arm920t"
+export OBJCOPY="arm-angstrom-linux-gnueabi-objcopy"
+export PKG_CONFIG_DIR="${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib/pkgconfig"
+export PKG_CONFIG_PATH="${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib/pkgconfig"
+export LDFLAGS="-L/home/john/moko/build/openmoko/staging/arm-angstrom-linux-gnueabi/lib -Wl,-rpath-link,/home/john/moko/build/openmoko/staging/arm-angstrom-linux-gnueabi/lib -Wl,-O1"
+export CCLD="ccache arm-angstrom-linux-gnueabi-gcc -march=armv4t -mtune=arm920t"
+export MAKE="make"
+export CFLAGS="-isystem${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/include -fexpensive-optimizations -fomit-frame-pointer -frename-registers -Os"
+export PKG_CONFIG_DISABLE_UNINSTALLED="yes"
+export CXXFLAGS="-isystem${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/include -fexpensive-optimizations -fomit-frame-pointer -frename-registers -Os -fpermissive -fvisibility-inlines-hidden"
+export F77="ccache arm-angstrom-linux-gnueabi-g77 -march=armv4t -mtune=arm920t"
+export AS="arm-angstrom-linux-gnueabi-as"
+export AR="arm-angstrom-linux-gnueabi-ar"
+export CPP="arm-angstrom-linux-gnueabi-gcc -E"
+export OBJDUMP="arm-angstrom-linux-gnueabi-objdump"





More information about the commitlog mailing list