libdisplaymigration-0.28/0042755000175000017500000000000010022640327013277 5ustar pbpblibdisplaymigration-0.28/Makefile0100644000175000017500000000226310022640327014735 0ustar pbpbPREFIX = /usr/local PACKAGE = libdisplaymigration DEBUG = yes CVSBUILD = no VERSION = 0.28 LINGUAS = MEMBERS = migrate auth crypt SONAME = $(PACKAGE).so.0 PACKAGE_CFLAGS += $(STANDARD_CFLAGS) $(GTKCFLAGS) -fPIC PACKAGE_CPPFLAGS += -DPREFIX=\"$(PREFIX)\" -DPACKAGE=\"$(PACKAGE)\" PACKAGE_LDFLAGS += $(GTKLIBS) -lgcrypt HEADERS = libdisplaymigration/displaymigration.h libdisplaymigration/auth.h libdisplaymigration/crypt.h OBJS = $(patsubst %,%.o,$(MEMBERS)) DEPS = $(patsubst %,%.d,$(MEMBERS)) SOURCES = $(patsubst %,%.c,$(MEMBERS)) ifeq ($(CVSBUILD),yes) BUILD = ../build else BUILD = build endif all: $(PACKAGE).so $(PACKAGE).so: $(SONAME) ln -sf $^ $@ $(SONAME): $(OBJS) $(CC) -nostartfiles -shared -o $@ $^ -Wl,-soname -Wl,$(SONAME) $(LDFLAGS) $(PACKAGE_LDFLAGS) install-program: $(SONAME) install -d $(DESTDIR)$(PREFIX)/lib install -s $(SONAME) $(DESTDIR)$(PREFIX)/lib/$(SONAME) install-devel: for i in $(HEADERS); do install -m 644 -D $$i $(DESTDIR)$(PREFIX)/include/$$i; done ln -s $(SONAME) $(DESTDIR)$(PREFIX)/lib/$(PACKAGE).so clean: rm -f $(OBJS) $(SONAME) $(PACKAGE).so $(DEPS) include $(BUILD)/Makefile.translation include $(BUILD)/Makefile.dpkg_ipkg -include $(DEPS) libdisplaymigration-0.28/auth.c0100644000175000017500000000606010022640044014375 0ustar pbpb/* * Copyright (C) 2003 Philip Blundell * * 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. */ #include #include #include #include #include "libdisplaymigration/auth.h" #include "libdisplaymigration/crypt.h" #define CHALLENGE_LEN 64 gchar *displaymigration_auth_challenge_string; static unsigned char challenge_bytes[CHALLENGE_LEN]; static unsigned long challenge_seq; #define hexbyte(x) ((x) >= 10 ? (x) + 'a' - 10 : (x) + '0') void displaymigration_auth_update_challenge (void) { int i; unsigned char *p; if (displaymigration_auth_challenge_string == NULL) displaymigration_auth_challenge_string = g_malloc ((CHALLENGE_LEN * 2) + 9); p = displaymigration_auth_challenge_string; for (i = 0; i < CHALLENGE_LEN; i++) { *p++ = hexbyte (challenge_bytes[i] >> 4); *p++ = hexbyte (challenge_bytes[i] & 15); } sprintf (p, "%08lx", challenge_seq++); } void displaymigration_auth_generate_challenge (void) { gcry_randomize (challenge_bytes, sizeof (challenge_bytes), GCRY_STRONG_RANDOM); displaymigration_auth_update_challenge (); } static struct rsa_key * parse_pubkey (char *s) { struct rsa_key *r; gcry_mpi_t n, e; gchar *sp; sp = strtok (s, " \n"); gcry_mpi_scan (&e, GCRYMPI_FMT_HEX, sp, 0, NULL); sp = strtok (NULL, " \n"); gcry_mpi_scan (&n, GCRYMPI_FMT_HEX, sp, 0, NULL); r = g_malloc0 (sizeof (struct rsa_key)); r->e = e; r->n = n; return r; } static struct rsa_key * lookup_pubkey (u_int32_t id) { const gchar *home_dir = g_get_home_dir (); gchar *filename = g_strdup_printf ("%s/.gpe/migrate/public", home_dir); FILE *fp = fopen (filename, "r"); struct rsa_key *r = NULL; if (fp) { while (!feof (fp)) { char buffer[4096]; if (fgets (buffer, 4096, fp)) { char *p; u_int32_t this_id = strtoul (buffer, &p, 16); if (p != buffer && *p == ' ') { #ifdef DEBUG fprintf (stderr, "found id %x\n", this_id); #endif if (this_id == id) { r = parse_pubkey (++p); break; } } } } fclose (fp); } g_free (filename); return r; } static void free_pubkey (struct rsa_key *k) { gcry_mpi_release (k->n); gcry_mpi_release (k->e); g_free (k); } gboolean displaymigration_auth_validate_request (char *display, char *data) { u_int32_t key_id; char *ep; char *p; struct rsa_key *k; char hash[20]; gboolean rc; p = strchr (data, ' '); if (p == NULL) return FALSE; *p++ = 0; key_id = strtoul (data, &ep, 16); if (*ep) return FALSE; k = lookup_pubkey (key_id); if (k == NULL) return FALSE; displaymigration_crypt_create_hash (display, displaymigration_auth_challenge_string, strlen (displaymigration_auth_challenge_string), hash); rc = displaymigration_crypt_check_signature (k, hash, p); free_pubkey (k); return rc; } libdisplaymigration-0.28/crypt.c0100644000175000017500000000722310022640224014577 0ustar pbpb/* * Copyright (C) 2003 Philip Blundell * * 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. */ #include #include #include #include #include "libdisplaymigration/auth.h" #include "libdisplaymigration/crypt.h" static gcry_mpi_t mpi_from_sexp (gcry_sexp_t r, char *tag) { gcry_sexp_t s = gcry_sexp_find_token (r, tag, 0); return gcry_sexp_nth_mpi (s, 1, GCRYMPI_FMT_USG); } static char * hex_from_mpi (gcry_mpi_t m) { char *buf; gcry_mpi_aprint (GCRYMPI_FMT_HEX, (void *)&buf, NULL, m); return buf; } void displaymigration_crypt_create_hash (char *display, char *challenge, size_t len, char *result) { size_t dlen = strlen (display); gchar *buf = g_malloc (dlen + 1 + len); strcpy (buf, display); memcpy (buf + dlen + 1, challenge, len); gcry_md_hash_buffer (GCRY_MD_SHA1, result, buf, len + dlen + 1); g_free (buf); } static int do_encode_md (const unsigned char *digest, size_t digestlen, int algo, unsigned int nbits, gcry_mpi_t *r_val) { int nframe = (nbits+7) / 8; unsigned char *frame; int i, n; unsigned char asn[100]; size_t asnlen; asnlen = sizeof(asn); if (gcry_md_algo_info (algo, GCRYCTL_GET_ASNOID, asn, &asnlen)) return -1; if (digestlen + asnlen + 4 > nframe ) return -1; /* We encode the MD in this way: * * 0 1 PAD(n bytes) 0 ASN(asnlen bytes) MD(len bytes) * * PAD consists of FF bytes. */ frame = g_malloc (nframe); n = 0; frame[n++] = 0; frame[n++] = 1; /* block type */ i = nframe - digestlen - asnlen -3 ; assert ( i > 1 ); memset ( frame+n, 0xff, i ); n += i; frame[n++] = 0; memcpy ( frame+n, asn, asnlen ); n += asnlen; memcpy ( frame+n, digest, digestlen ); n += digestlen; assert ( n == nframe ); gcry_mpi_scan (r_val, GCRYMPI_FMT_USG, frame, nframe, &nframe); g_free (frame); return 0; } gboolean displaymigration_crypt_sign_hash (struct rsa_key *k, char *hash, gchar **result) { gcry_mpi_t mpi; gcry_sexp_t data, sig, key; int rc; char *hex; do_encode_md (hash, 20, GCRY_MD_SHA1, 1024, &mpi); if (gcry_sexp_build (&data, NULL, "(data (value %m))", mpi)) return FALSE; gcry_mpi_release (mpi); if (gcry_sexp_build (&key, NULL, "(private-key (rsa (n %m) (e %m) (d %m) (p %m) (q %m) (u %m)))", k->n, k->e, k->d, k->p, k->q, k->u)) { gcry_sexp_release (data); return FALSE; } rc = gcry_pk_sign (&sig, data, key); gcry_sexp_release (data); gcry_sexp_release (key); if (rc) return FALSE; mpi = mpi_from_sexp (sig, "s"); hex = hex_from_mpi (mpi); *result = g_strdup (hex); gcry_free (hex); gcry_mpi_release (mpi); gcry_sexp_release (sig); return TRUE; } gboolean displaymigration_crypt_check_signature (struct rsa_key *k, char *hash, char *sigbuf) { gcry_mpi_t mpi, mpi2; gcry_sexp_t data, sig, key; int rc; do_encode_md (hash, 20, GCRY_MD_SHA1, 1024, &mpi); gcry_sexp_build (&data, NULL, "(data (value %m))", mpi); gcry_mpi_release (mpi); gcry_sexp_build (&key, NULL, "(public-key (rsa (n %m) (e %m)))", k->n, k->e); if (gcry_mpi_scan (&mpi2, GCRYMPI_FMT_HEX, sigbuf, 0, NULL)) { gcry_sexp_release (data); return FALSE; } gcry_sexp_build (&sig, NULL, "(sig-val (rsa (s %m)))", mpi2); rc = gcry_pk_verify (sig, data, key); gcry_sexp_release (data); gcry_sexp_release (key); gcry_sexp_release (sig); gcry_mpi_release (mpi2); if (rc) return FALSE; return TRUE; } libdisplaymigration-0.28/familiar/0042755000175000017500000000000007704325331015073 5ustar pbpblibdisplaymigration-0.28/familiar/postinst0100755000175000017500000000002507606124116016673 0ustar pbpb#!/bin/sh ldconfig libdisplaymigration-0.28/familiar/control0100644000175000017500000000036110022640300016450 0ustar pbpbPackage: libdisplaymigration0 Section: base Priority: optional Version: VERSION Source: SOURE Architecture: arm Maintainer: Phil Blundell Depends: libc6, libgtk2.0-0, libgcrypt7 Description: Display migration support for GTK libdisplaymigration-0.28/familiar/postrm0100755000175000017500000000002507606124116016334 0ustar pbpb#!/bin/sh ldconfig libdisplaymigration-0.28/libdisplaymigration/0042755000175000017500000000000010022637574017357 5ustar pbpblibdisplaymigration-0.28/libdisplaymigration/auth.h0100644000175000017500000000126107704217161020463 0ustar pbpb/* * Copyright (C) 2003 Philip Blundell * * 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. */ #ifndef DISPLAYMIGRATION_AUTH_H #define DISPLAYMIGRATION_AUTH_H #include #include extern void displaymigration_auth_update_challenge (void); extern void displaymigration_auth_generate_challenge (void); extern gboolean displaymigration_auth_validate_request (char *display, char *data); extern gchar *displaymigration_auth_challenge_string; #endif libdisplaymigration-0.28/libdisplaymigration/crypt.h0100644000175000017500000000066210022637574020670 0ustar pbpb#ifndef DISPLAYMIGRATION_CRYPT_H #define DISPLAYMIGRATION_CRYPT_H struct rsa_key { gcry_mpi_t n, e, d, p, q, u; }; extern void displaymigration_crypt_create_hash (char *display, char *challenge, size_t len, char *result); extern gboolean displaymigration_crypt_sign_hash (struct rsa_key *k, char *hash, gchar **result); extern gboolean displaymigration_crypt_check_signature (struct rsa_key *k, char *hash, char *sigbuf); #endif libdisplaymigration-0.28/libdisplaymigration/displaymigration.h0100644000175000017500000000073607704216471023112 0ustar pbpb/* * Copyright (C) 2003 Philip Blundell * * 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. */ #ifndef DISPLAYMIGRATION_H #define DISPLAYMIGRATION_H extern void displaymigration_init (void); extern void displaymigration_mark_window (GtkWidget *); #endif libdisplaymigration-0.28/migrate.c0100644000175000017500000001503107704217160015076 0ustar pbpb/* * Copyright (C) 2003 Philip Blundell * * 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. */ #include #include #include #include #include #include #include #include #include #include #include "libdisplaymigration/auth.h" #include "libdisplaymigration/displaymigration.h" #define _(x) gettext(x) static GdkAtom string_gdkatom, display_change_gdkatom; static GdkAtom rsa_challenge_gdkatom; #define DISPLAY_CHANGE_SUCCESS 0 #define DISPLAY_CHANGE_UNABLE_TO_CONNECT 1 #define DISPLAY_CHANGE_NO_SUCH_SCREEN 2 #define DISPLAY_CHANGE_AUTHENTICATION_BAD 3 #define DISPLAY_CHANGE_INDETERMINATE_ERROR 4 static gboolean no_auth; static GSList *all_widgets; static gboolean displaymigration_initialised; static int do_change_display (GtkWidget *w, char *display_name) { GdkDisplay *newdisplay; guint screen_nr = 1; guint i; if (display_name[0] == 0) return DISPLAY_CHANGE_INDETERMINATE_ERROR; i = strlen (display_name) - 1; while (i > 0 && isdigit (display_name[i])) i--; if (display_name[i] == '.') { screen_nr = atoi (display_name + i + 1); display_name[i] = 0; } newdisplay = gdk_display_open (display_name); if (newdisplay) { GdkScreen *screen = gdk_display_get_screen (newdisplay, screen_nr); if (screen) { gtk_window_set_screen (GTK_WINDOW (w), screen); gdk_display_manager_set_default_display (gdk_display_manager_get (), newdisplay); return DISPLAY_CHANGE_SUCCESS; } else return DISPLAY_CHANGE_NO_SUCH_SCREEN; } return DISPLAY_CHANGE_UNABLE_TO_CONNECT; } static void set_challenge_on_window (GdkWindow *window) { gdk_property_change (window, rsa_challenge_gdkatom, string_gdkatom, 8, GDK_PROP_MODE_REPLACE, displaymigration_auth_challenge_string, strlen (displaymigration_auth_challenge_string)); } static void update_challenge_on_windows (void) { GSList *i; displaymigration_auth_update_challenge (); for (i = all_widgets; i; i = i->next) { GtkWidget *w = GTK_WIDGET (i->data); if (w->window) set_challenge_on_window (w->window); } } static void reset_state (GdkWindow *window) { gdk_property_change (window, display_change_gdkatom, string_gdkatom, 8, GDK_PROP_MODE_REPLACE, NULL, 0); } static void generate_response (GdkDisplay *gdisplay, Display *dpy, Window window, int code) { XClientMessageEvent ev; Atom atom = gdk_x11_atom_to_xatom_for_display (gdisplay, display_change_gdkatom); memset (&ev, 0, sizeof (ev)); ev.type = ClientMessage; ev.window = window; ev.message_type = atom; ev.format = 32; ev.data.l[0] = window; ev.data.l[1] = code; XSendEvent (dpy, DefaultRootWindow (dpy), False, SubstructureNotifyMask, (XEvent *)&ev); } static int handle_request (GdkWindow *gwindow, char *prop) { GtkWidget *widget; char *target, *auth_method, *auth_data; char *p; target = prop; auth_method = "NULL"; auth_data = NULL; p = strchr (prop, ' '); if (p) { *p = 0; auth_method = ++p; p = strchr (p, ' '); if (p) { *p = 0; auth_data = ++p; } } if (no_auth == FALSE) { if (!strcasecmp (auth_method, "null")) return DISPLAY_CHANGE_AUTHENTICATION_BAD; else if (!strcasecmp (auth_method, "rsa-sig")) { if (displaymigration_auth_validate_request (target, auth_data) == FALSE) return DISPLAY_CHANGE_AUTHENTICATION_BAD; } else return DISPLAY_CHANGE_AUTHENTICATION_BAD; } gdk_window_get_user_data (gwindow, (gpointer*) &widget); if (widget) return do_change_display (widget, target); return DISPLAY_CHANGE_INDETERMINATE_ERROR; } static GdkFilterReturn filter_func (GdkXEvent *xevp, GdkEvent *ev, gpointer p) { XPropertyEvent *xev = (XPropertyEvent *)xevp; if (xev->type == PropertyNotify) { GdkDisplay *gdisplay; Atom atom; gdisplay = gdk_x11_lookup_xdisplay (xev->display); if (gdisplay) { atom = gdk_x11_atom_to_xatom_for_display (gdisplay, display_change_gdkatom); if (xev->atom == atom) { GdkWindow *gwindow; gwindow = gdk_window_lookup_for_display (gdisplay, xev->window); if (gwindow) { GdkAtom actual_type; gint actual_format; gint actual_length; unsigned char *prop = NULL; if (gdk_property_get (gwindow, display_change_gdkatom, string_gdkatom, 0, G_MAXLONG, FALSE, &actual_type, &actual_format, &actual_length, &prop)) { if (actual_length != 0) { if (actual_type == string_gdkatom && actual_length > 8) { gchar *buf = g_malloc (actual_length + 1); int rc; memcpy (buf, prop, actual_length); buf[actual_length] = 0; rc = handle_request (gwindow, buf); g_free (buf); generate_response (gdisplay, xev->display, xev->window, rc); if (rc == DISPLAY_CHANGE_SUCCESS) update_challenge_on_windows (); } reset_state (gwindow); } } if (prop) g_free (prop); } } return GDK_FILTER_REMOVE; } } return GDK_FILTER_CONTINUE; } static void unrealize_window (GtkWidget *w) { all_widgets = g_slist_remove (all_widgets, w); } void displaymigration_mark_window (GtkWidget *w) { if (! displaymigration_initialised) { g_warning ("displaymigration not initialised yet"); return; } if (GTK_WIDGET_REALIZED (w)) { GdkWindow *window = w->window; gdk_window_add_filter (window, filter_func, NULL); reset_state (window); set_challenge_on_window (window); all_widgets = g_slist_append (all_widgets, w); g_signal_connect (G_OBJECT (w), "unrealize", G_CALLBACK (unrealize_window), NULL); } else g_signal_connect (G_OBJECT (w), "realize", G_CALLBACK (displaymigration_mark_window), NULL); } void displaymigration_init (void) { if (getenv ("GPE_DISPLAY_MIGRATION_NO_AUTH") != NULL) no_auth = TRUE; string_gdkatom = gdk_atom_intern ("STRING", FALSE); display_change_gdkatom = gdk_atom_intern ("_GPE_DISPLAY_CHANGE", FALSE); rsa_challenge_gdkatom = gdk_atom_intern ("_GPE_DISPLAY_CHANGE_RSA_CHALLENGE", FALSE); displaymigration_auth_generate_challenge (); displaymigration_initialised = TRUE; } libdisplaymigration-0.28/po/0042755000175000017500000000000007730401042013716 5ustar pbpblibdisplaymigration-0.28/spec.txt0100644000175000017500000000370507641645212015005 0ustar pbpbA window capable of migration sets a property _GPE_DISPLAY_CHANGE on itself. Its type is STRING and it is initially set to zero length. Changing this property to a non-empty value signals a request for the application to migrate. The property has the format "TARGET-DISPLAY AUTH-TYPE AUTH-DATA", where TARGET-DISPLAY is the desired destination in "host:display.screen" notation; AUTH-TYPE is the authentication method in use (see below); and AUTH-DATA is the appropriate authentication information. Prior to setting this property on a window, the requesting application should inspect its current value. Anything other than zero length indicates that the migration attempt has collided with one made by another requestor, and should be aborted. Once a migration request has been processed, the migrated window should reset its _GPE_DISPLAY_CHANGE property to zero length, indicating readiness to receive further requests. The outcome of a migration attempt is signalled by sending a ClientMessage of type _GPE_DISPLAY_CHANGE to the original display's root window with event mask SubstructureNotify and payload as follows: l[0] window handle for which status is being reported l[1] status code, one of: 0 success 1 unable to connect to display 2 requested screen does not exist 3 invalid authentication 4 indeterminate failure Only one authentication scheme, RSA-SIG, is currently defined. In this scheme, the requestor reads a challenge string from the _GPE_DISPLAY_CHANGE_RSA_CHALLENGE property on the window to be migrated and computes the PKCS-1 signature of the target display name, followed by a NUL delimeter, followed by the challenge string. The authentication data string consists of the key ID used for signature, followed by a space, followed by the signature text. -- Should all windows owned by one application be migrated together? If so, does this need specific protocol support, or should the requesting application simply deal with each one individually? libdisplaymigration-0.28/build/0042755000175000017500000000000010022640327014376 5ustar pbpblibdisplaymigration-0.28/build/Makefile.dpkg_ipkg0100644000175000017500000001122610022640327017771 0ustar pbpb## Please read the README in this directory to see how to use this ## Makefile snippet # Let's use whatever clean target the specific app provides CONTROL = `if test -e familiar/control1; then echo control1; else echo control; fi` # URL to source tarball SOURCE = ftp://gpe.handhelds.org/gpe/source/$(PACKAGE)-$(VERSION).tar.gz # can change this to e.g. /var/tmp/deb DEB_PATH = ../deb ifeq ($(CVSBUILD),yes) LIBGPEWIDGET_PC = libgpewidget-uninstalled PC_EXTRA=PKG_CONFIG_PATH=../../base/libgpewidget else LIBGPEWIDGET_PC = libgpewidget endif ifeq ($(IN_LIBGPEWIDGET),) GPECFLAGS = $(shell $(PC_EXTRA) pkg-config --cflags $(LIBGPEWIDGET_PC)) GPELIBS = $(shell $(PC_EXTRA) pkg-config --libs $(LIBGPEWIDGET_PC)) endif GTKCFLAGS = $(shell pkg-config --cflags gtk+-2.0) GTKLIBS = $(shell pkg-config --libs gtk+-2.0) STANDARD_CPPFLAGS = -D_GNU_SOURCE -DPACKAGE=\"$(PACKAGE)\" -DPREFIX=\"$(PREFIX)\" -DPACKAGE_LOCALE_DIR=\"$(PREFIX)/share/locale\" STANDARD_CFLAGS = -MD -Wall ifeq ($(DEBUG),yes) CFLAGS += -O2 -g LDFLAGS = -g else CFLAGS += -Os -fomit-frame-pointer endif dist: check-source clean dist-prep rm -rf ../$(PACKAGE)-$(VERSION) mkdir ../$(PACKAGE)-$(VERSION) ( tar cf - --exclude "*/CVS" --exclude CVS --exclude "*~" --exclude "#*#" --exclude "debian" --exclude ".*" --exclude "*.ipk" --exclude "*.ipk.*" --exclude "*.mo" --exclude "*.d" --exclude "*.batch" --exclude "translation-ipkgs.txt" * ) | (cd ../$(PACKAGE)-$(VERSION); tar xf -) ( cd ../$(PACKAGE)-$(VERSION); mkdir build; cp $(BUILD)/Makefile.dpkg_ipkg $(BUILD)/Makefile.translation build/ ; sed 's:^CVSBUILD.*:CVSBUILD = no:' < Makefile > Makefile.new; mv Makefile.new Makefile ) ( cd .. ; tar cf - $(PACKAGE)-$(VERSION) | gzip -9 >$(PACKAGE)-$(VERSION).tar.gz ) rm -rf ../$(PACKAGE)-$(VERSION) $(MAKE) printinfo dist-upload: dist scp ../$(PACKAGE)-$(VERSION).tar.gz $(USER)@handhelds.org:/home/ftp/pub/projects/gpe/source/ dist-prep: ipkg-prep: install-mo: # empty, can be filled in Makefile.translation install: install-program install-mo clean-dist: rm -rf familiar/dist familiar/dist.list clean: clean-dist check-source: @if ! grep -q '^Source:' familiar/$(CONTROL); then echo -e "\nNo Source: field in control file. Aborting.\n"; exit 1; fi ipkg: check-source ipkg-prep clean rm -rf familiar/dist mkdir -p familiar/dist/CONTROL sed 's:VERSION:$(VERSION):;s$$SOURCE$$$(SOURCE)$$' < familiar/$(CONTROL) > familiar/dist/CONTROL/control if test -e familiar/conffiles; then install -m 644 familiar/conffiles familiar/dist/CONTROL; fi if test -e familiar/preinst; then install familiar/preinst familiar/dist/CONTROL; fi if test -e familiar/postinst; then install familiar/postinst familiar/dist/CONTROL; fi if test -e familiar/prerm; then install familiar/prerm familiar/dist/CONTROL; fi if test -e familiar/postrm; then install familiar/postrm familiar/dist/CONTROL; fi $(MAKE) DESTDIR=`pwd`/familiar/dist PREFIX=/usr prefix=/usr DEBUG=no install-program rm -rf familiar/dist.list ipkg-build -o 0 -g 0 familiar/dist | sed 's/^Packaged .*into //; t 1; d; : 1; s:.*/::' >> familiar/dist.list if [ "x$(LINGUAS)" != "x" ]; then make translation-ipkg; tr ' ' '\n' < translation-ipkgs.txt >> familiar/dist.list; fi md5sum `cat familiar/dist.list` > $(PACKAGE)_$(VERSION).batch rm -rf familiar/dist familiar/dist.list $(MAKE) printinfo dpkg: dist mkdir -p $(DEB_PATH) ( olddir=`pwd`; cd $(DEB_PATH); rm -rf $(PACKAGE)-$(VERSION); ln -s $$olddir/../$(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)_$(VERSION).orig.tar.gz ; tar xzf $(PACKAGE)_$(VERSION).orig.tar.gz ) mkdir -p $(DEB_PATH)/$(PACKAGE)-$(VERSION)/debian for i in debian/*; do if test -f $$i; then cp $$i $(DEB_PATH)/$(PACKAGE)-$(VERSION)/debian/; fi; done CVSTAG := $(shell echo $(PACKAGE)-$(VERSION) | tr [a-z.] [A-Z_]) printinfo: @printf '-------------------------------------------------------------------------------\n' @printf "If this becomes a package release, please add a CVS tag.\n" @printf "You can use 'make tag' for that, it will execute\n" @printf " cvs tag %s\n" $(CVSTAG) @printf "Please upload a tarball (created with 'make dist') to\n" @printf " ftp://ftp.handhelds.org/pub/projects/gpe/\n" @printf " (handhelds.org:~ftp/pub/projects/gpe/source)\n" @printf "You can use 'make dist-upload' to do that.\n" @printf "You are currently known as USER %s.\n" $(USER) @printf '-------------------------------------------------------------------------------\n' tag: check-source cvs tag $(CVSTAG) retag: check-source cvs tag -F $(CVSTAG) source: tag dist-upload %.pc: %.pc.in sed 's:PREFIX:$(PREFIX):;s:BUILDDIR:$(shell pwd):;s:VERSION:$(VERSION):' < $< > $@ .c.o:; $(CC) $(CFLAGS) $(CPPFLAGS) $(PACKAGE_CFLAGS) $(PACKAGE_CPPFLAGS) -c $< -o $@ libdisplaymigration-0.28/build/Makefile.translation0100644000175000017500000000711610022640327020373 0ustar pbpb.SUFFIXES: .mo .po .pot .po8 CONTROL = `if test -e familiar/control1; then echo control1; else echo control; fi` # use ipkg-build or ipkg-deb-build IPKG_BUILD := ipkg-build TRANSLATION_SITE := http://www.iro.umontreal.ca/~gnutra/maint ifeq ($(DIR_PO),) DIR_PO := po endif ifeq ($(BINPACKAGE),) BINPACKAGE := $(PACKAGE) endif mo-files = $(patsubst %,$(DIR_PO)/%.mo,$(LINGUAS)) po-files = $(patsubst %,$(DIR_PO)/%.po,$(LINGUAS)) ifeq ($(shell if [ -f $(PACKAGE).desktop.in ]; then echo present; fi;),present) desktop-files += $(PACKAGE).desktop endif ifneq ($(EXTRA_DESKTOPS),) desktop-files += $(patsubst %.desktop.in,%.desktop,$(EXTRA_DESKTOPS)) endif all-mo: $(mo-files) all-desktop: $(desktop-files) install-mo: all-mo if [ "x$(LINGUAS)" != "x" ]; then \ for i in $(LINGUAS); do mkdir -p $(DESTDIR)$(PREFIX)/share/locale/$$i/LC_MESSAGES; install -m 644 $(DIR_PO)/$$i.mo $(DESTDIR)$(PREFIX)/share/locale/$$i/LC_MESSAGES/$(PACKAGE).mo; done \ fi; .po8.mo:; msgfmt -o $@ $< .po.po8:; CTYPE=`grep "^\"Content-Type:" $< | sed 's/^.*charset=//;s/\\\\.*//'`; sed "s/\(Content-Type: .*=\)$$CTYPE/\1UTF-8/" < $< | iconv -f $${CTYPE} -t UTF-8 >$@ update-po: $(po-files) extract-po dist-prep: update-po freshen-po # empty ifeq ($(CVSBUILD),yes) ipkg-prep: freshen-po # empty endif extract-po: mkdir -p $(DIR_PO) ( SOURCES="$(SOURCES)"; for DESK in $(PACKAGE).desktop.in $(EXTRA_DESKTOPS); do if [ -f $$DESK ]; then intltool-extract --type=gettext/ini $$DESK; SOURCES="$$SOURCES $${DESK}.h"; fi; done; if [ "x$$SOURCES" != "x" ]; then xgettext --add-comments=TRANSLATORS: -k_ -kN_ -o $(DIR_PO)/$(PACKAGE).pot.new $$SOURCES; fi ) if [ -f $(DIR_PO)/$(PACKAGE).pot.new ]; then if cmp -s $(DIR_PO)/$(PACKAGE).pot.new $(PACKAGE).pot; then rm $(DIR_PO)/$(PACKAGE).pot.new; else mv $(DIR_PO)/$(PACKAGE).pot.new $(DIR_PO)/$(PACKAGE).pot; fi; fi clean: clean-po clean-dist-translation clean-po: rm -rf $(DIR_PO)/*.mo for i in $(desktop-files); do if [ -f $$i.in ]; then rm -f $$i; rm -f $$i.in.h; fi; done %.desktop: %.desktop.in $(patsubst %,$(DIR_PO)/%.po,$(LINGUAS)) intltool-merge -u -d $(DIR_PO) $< $@ freshen-po: rm -rf tmp-po mkdir tmp-po cd tmp-po; for LANG in $(LINGUAS); do wget $(TRANSLATION_SITE)/$(PACKAGE)/$$LANG.po; done for LANG in $(LINGUAS); do if [ ! -f $(DIR_PO)/$$LANG.po ] || ! cmp -s $(DIR_PO)/$$LANG.po tmp-po/$$LANG.po ; then mv tmp-po/$$LANG.po $(DIR_PO)/$$LANG.po; echo "Updated $$LANG translation"; fi; done rm -rf tmp-po # ------------------------------------------------------------------------ MAINTAINER = $(shell grep 'Maintainer: ' familiar/$(CONTROL) | cut -d ' ' -f 2-) ifndef BUILD BUILD = ../build endif transdist := familiar/dist-translation templates := $(BUILD)/familiar ipkglist := translation-ipkgs.txt clean-dist-translation: rm -rf $(transdist) $(ipkglist) real-translation-package: all-mo rm -rf $(transdist) $(ipkglist) for LINGUA in $(LINGUAS); do \ i=$$(echo $$LINGUA | tr '[A-Z_]' '[a-z+]'); \ mkdir -p $(transdist)/$$i/CONTROL; \ mkdir -p $(transdist)/$$i$(PREFIX)/share/locale/$$LINGUA/LC_MESSAGES; \ install -m 644 po/$$LINGUA.mo $(transdist)/$$i$(PREFIX)/share/locale/$$LINGUA/LC_MESSAGES/$(PACKAGE).mo; \ sed -e "s//$(MAINTAINER)/;s//$(BINPACKAGE)/;s//$(VERSION)/;s//$$i/;s!!$(SOURCE)!" $(templates)/control.translation > $(transdist)/$$i/CONTROL/control; \ install $(templates)/postinst.translation $(transdist)/$$i/CONTROL/postinst; \ $(IPKG_BUILD) -g 0 -o 0 $(transdist)/$$i | sed 's/^Packaged .*into //; t 1; d; : 1; s:.*/::' >> $(ipkglist); \ done translation-ipkg: make PREFIX=/usr real-translation-package