From: John Darrington Date: Mon, 26 Mar 2007 10:11:01 +0000 (+0000) Subject: Made the code relocatable (using the relocate function from gnulib). X-Git-Tag: v0.6.0~518 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=732b6a86124e89e24d685ed785d2df55728eb01b;p=pspp-builds.git Made the code relocatable (using the relocate function from gnulib). --- diff --git a/.cvsignore b/.cvsignore index 0b023a53..e8294831 100644 --- a/.cvsignore +++ b/.cvsignore @@ -27,3 +27,6 @@ potfiles.tmp pref.h stamp-h1 texinfo.tex +config.libpath +install-reloc +reloc-ldflags diff --git a/Smake b/Smake index c31240a1..8956a743 100644 --- a/Smake +++ b/Smake @@ -35,6 +35,7 @@ GNULIB_MODULES = \ minmax \ mkstemp \ progname \ + relocatable-prog \ snprintf \ stdarg \ stdbool \ diff --git a/po/de.po b/po/de.po index d4dfbc05..0ac19a43 100644 --- a/po/de.po +++ b/po/de.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: PSPP 0.4.2\n" "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" -"POT-Creation-Date: 2007-03-19 13:38-0700\n" +"POT-Creation-Date: 2007-03-25 18:00+0800\n" "PO-Revision-Date: 2006-05-26 17:49+0800\n" "Last-Translator: John Darrington \n" "Language-Team: German \n" @@ -1367,20 +1367,6 @@ msgid "" "Data fields must be listed in order of increasing record number." msgstr "" -#: src/language/data-io/print-space.c:75 src/language/lexer/lexer.c:465 -#: src/language/stats/autorecode.c:153 src/language/xforms/select-if.c:61 -msgid "expecting end of command" -msgstr "" - -#: src/language/data-io/print-space.c:116 -msgid "The expression on PRINT SPACE evaluated to the system-missing value." -msgstr "" - -#: src/language/data-io/print-space.c:119 -#, c-format -msgid "The expression on PRINT SPACE evaluated to %g." -msgstr "" - #: src/language/data-io/print.c:260 #, c-format msgid "Output calls for %d records but %u specified on RECORDS subcommand." @@ -1400,6 +1386,20 @@ msgid_plural "Writing %d records." msgstr[0] "" msgstr[1] "" +#: src/language/data-io/print-space.c:75 src/language/lexer/lexer.c:465 +#: src/language/stats/autorecode.c:153 src/language/xforms/select-if.c:61 +msgid "expecting end of command" +msgstr "" + +#: src/language/data-io/print-space.c:116 +msgid "The expression on PRINT SPACE evaluated to the system-missing value." +msgstr "" + +#: src/language/data-io/print-space.c:119 +#, c-format +msgid "The expression on PRINT SPACE evaluated to %g." +msgstr "" + #: src/language/dictionary/apply-dictionary.c:74 #, c-format msgid "Variable %s is %s in target file, but %s in source file." @@ -3018,22 +3018,6 @@ msgstr "" msgid "TABLES subcommand may not appear more than once." msgstr "" -#: src/language/stats/npar-summary.c:110 -msgid "Descriptive Statistics" -msgstr "" - -#: src/language/stats/npar-summary.c:147 -msgid "25th" -msgstr "" - -#: src/language/stats/npar-summary.c:150 -msgid "50th (Median)" -msgstr "" - -#: src/language/stats/npar-summary.c:153 -msgid "75th" -msgstr "" - #: src/language/stats/npar.q:101 msgid "NPAR subcommand not currently implemented." msgstr "" @@ -3058,6 +3042,22 @@ msgid "" "match the number following (%d)." msgstr "" +#: src/language/stats/npar-summary.c:110 +msgid "Descriptive Statistics" +msgstr "" + +#: src/language/stats/npar-summary.c:147 +msgid "25th" +msgstr "" + +#: src/language/stats/npar-summary.c:150 +msgid "50th (Median)" +msgstr "" + +#: src/language/stats/npar-summary.c:153 +msgid "75th" +msgstr "" + #: src/language/stats/oneway.q:169 msgid "Number of contrast coefficients must equal the number of groups" msgstr "" @@ -4601,18 +4601,6 @@ msgstr "" msgid "%d" msgstr "" -#: src/ui/gui/psppire-var-store.c:470 -msgid "None" -msgstr "Keine" - -#: src/ui/gui/psppire-var-store.c:477 -msgid "Scientific" -msgstr "Wissenschäflich" - -#: src/ui/gui/psppire-var-store.c:480 -msgid "Custom" -msgstr "Spezial" - #: src/ui/gui/psppire.glade:9 #, fuzzy msgid "This is pre-alpha software. Use at your own risk." @@ -4663,6 +4651,18 @@ msgstr "Variableansicht" msgid "Variable(s):" msgstr "Variableansicht" +#: src/ui/gui/psppire-var-store.c:470 +msgid "None" +msgstr "Keine" + +#: src/ui/gui/psppire-var-store.c:477 +msgid "Scientific" +msgstr "Wissenschäflich" + +#: src/ui/gui/psppire-var-store.c:480 +msgid "Custom" +msgstr "Spezial" + #: src/ui/gui/sort-cases-dialog.c:367 msgid "Criteria" msgstr "" @@ -4832,7 +4832,7 @@ msgid "" "Report bugs to <%s>.\n" msgstr "" -#: src/ui/terminal/main.c:132 +#: src/ui/terminal/main.c:133 msgid "" "Stopping syntax file processing here to avoid a cascade of dependent command " "failures." diff --git a/po/pspp.pot b/po/pspp.pot index d970be00..e51a7d0c 100644 --- a/po/pspp.pot +++ b/po/pspp.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" -"POT-Creation-Date: 2007-03-19 13:38-0700\n" +"POT-Creation-Date: 2007-03-25 18:00+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1362,20 +1362,6 @@ msgid "" "Data fields must be listed in order of increasing record number." msgstr "" -#: src/language/data-io/print-space.c:75 src/language/lexer/lexer.c:465 -#: src/language/stats/autorecode.c:153 src/language/xforms/select-if.c:61 -msgid "expecting end of command" -msgstr "" - -#: src/language/data-io/print-space.c:116 -msgid "The expression on PRINT SPACE evaluated to the system-missing value." -msgstr "" - -#: src/language/data-io/print-space.c:119 -#, c-format -msgid "The expression on PRINT SPACE evaluated to %g." -msgstr "" - #: src/language/data-io/print.c:260 #, c-format msgid "Output calls for %d records but %u specified on RECORDS subcommand." @@ -1395,6 +1381,20 @@ msgid_plural "Writing %d records." msgstr[0] "" msgstr[1] "" +#: src/language/data-io/print-space.c:75 src/language/lexer/lexer.c:465 +#: src/language/stats/autorecode.c:153 src/language/xforms/select-if.c:61 +msgid "expecting end of command" +msgstr "" + +#: src/language/data-io/print-space.c:116 +msgid "The expression on PRINT SPACE evaluated to the system-missing value." +msgstr "" + +#: src/language/data-io/print-space.c:119 +#, c-format +msgid "The expression on PRINT SPACE evaluated to %g." +msgstr "" + #: src/language/dictionary/apply-dictionary.c:74 #, c-format msgid "Variable %s is %s in target file, but %s in source file." @@ -3012,22 +3012,6 @@ msgstr "" msgid "TABLES subcommand may not appear more than once." msgstr "" -#: src/language/stats/npar-summary.c:110 -msgid "Descriptive Statistics" -msgstr "" - -#: src/language/stats/npar-summary.c:147 -msgid "25th" -msgstr "" - -#: src/language/stats/npar-summary.c:150 -msgid "50th (Median)" -msgstr "" - -#: src/language/stats/npar-summary.c:153 -msgid "75th" -msgstr "" - #: src/language/stats/npar.q:101 msgid "NPAR subcommand not currently implemented." msgstr "" @@ -3052,6 +3036,22 @@ msgid "" "match the number following (%d)." msgstr "" +#: src/language/stats/npar-summary.c:110 +msgid "Descriptive Statistics" +msgstr "" + +#: src/language/stats/npar-summary.c:147 +msgid "25th" +msgstr "" + +#: src/language/stats/npar-summary.c:150 +msgid "50th (Median)" +msgstr "" + +#: src/language/stats/npar-summary.c:153 +msgid "75th" +msgstr "" + #: src/language/stats/oneway.q:169 msgid "Number of contrast coefficients must equal the number of groups" msgstr "" @@ -4578,18 +4578,6 @@ msgstr "" msgid "%d" msgstr "" -#: src/ui/gui/psppire-var-store.c:470 -msgid "None" -msgstr "" - -#: src/ui/gui/psppire-var-store.c:477 -msgid "Scientific" -msgstr "" - -#: src/ui/gui/psppire-var-store.c:480 -msgid "Custom" -msgstr "" - #: src/ui/gui/psppire.glade:9 msgid "This is pre-alpha software. Use at your own risk." msgstr "" @@ -4636,6 +4624,18 @@ msgstr "" msgid "Variable(s):" msgstr "" +#: src/ui/gui/psppire-var-store.c:470 +msgid "None" +msgstr "" + +#: src/ui/gui/psppire-var-store.c:477 +msgid "Scientific" +msgstr "" + +#: src/ui/gui/psppire-var-store.c:480 +msgid "Custom" +msgstr "" + #: src/ui/gui/sort-cases-dialog.c:367 msgid "Criteria" msgstr "" @@ -4802,7 +4802,7 @@ msgid "" "Report bugs to <%s>.\n" msgstr "" -#: src/ui/terminal/main.c:132 +#: src/ui/terminal/main.c:133 msgid "" "Stopping syntax file processing here to avoid a cascade of dependent command " "failures." diff --git a/src/ui/gui/about.c b/src/ui/gui/about.c index 007cb3d0..91572586 100644 --- a/src/ui/gui/about.c +++ b/src/ui/gui/about.c @@ -30,18 +30,19 @@ void about_new (GtkMenuItem *m, GtkWindow *parent) { - GladeXML *xml = glade_xml_new (PKGDATADIR "/psppire.glade", NULL, NULL); + GladeXML *xml = XML_NEW ("psppire.glade"); GtkWidget *about = get_widget_assert (xml, "aboutdialog1"); GdkPixbuf *pb = - gdk_pixbuf_new_from_file_at_size (PKGDATADIR "/pspplogo.png", 64, 64, 0); + gdk_pixbuf_new_from_file_at_size (relocate (PKGDATADIR "/pspplogo.png"), + 64, 64, 0); gtk_about_dialog_set_logo (GTK_ABOUT_DIALOG (about), pb); gtk_window_set_icon_from_file (GTK_WINDOW (about), - PKGDATADIR "/psppicon.png", 0); + relocate (PKGDATADIR "/psppicon.png"), 0); gtk_about_dialog_set_website (GTK_ABOUT_DIALOG (about), "http://www.gnu.org/software/pspp"); diff --git a/src/ui/gui/automake.mk b/src/ui/gui/automake.mk index 6f6fa3c5..3777672a 100644 --- a/src/ui/gui/automake.mk +++ b/src/ui/gui/automake.mk @@ -4,12 +4,20 @@ bin_PROGRAMS += src/ui/gui/psppire +src_ui_gui_psppire_CFLAGS = $(GTK_CFLAGS) $(GLADE_CFLAGS) -Wall \ + -DINSTALLDIR=\"$(bindir)\" -src_ui_gui_psppire_CFLAGS = $(GTK_CFLAGS) $(GLADE_CFLAGS) -Wall src_ui_gui_psppire_LDFLAGS = \ - -export-dynamic \ - -rpath $(pkglibdir) + -export-dynamic + + +if RELOCATABLE_VIA_LD +src_ui_gui_psppire_LDFLAGS += `$(RELOCATABLE_LDFLAGS) $(bindir)` +else +src_ui_gui_psppire_LDFLAGS += -rpath $(pkglibdir) +endif + pkglib_LTLIBRARIES = src/ui/gui/libpsppire.la @@ -106,3 +114,4 @@ src_ui_gui_psppire_SOURCES = \ src/ui/gui/window-manager.c \ src/ui/gui/window-manager.h + diff --git a/src/ui/gui/data-editor.c b/src/ui/gui/data-editor.c index 3cecdd71..c46cfa7a 100644 --- a/src/ui/gui/data-editor.c +++ b/src/ui/gui/data-editor.c @@ -129,8 +129,7 @@ new_data_editor (void) e = (struct editor_window *) de; - de->xml = glade_xml_new (PKGDATADIR "/data-editor.glade", NULL, NULL); - + de->xml = XML_NEW ("data-editor.glade"); var_sheet = GTK_SHEET (get_widget_assert (de->xml, "variable_sheet")); diff --git a/src/ui/gui/helper.h b/src/ui/gui/helper.h index a0c36bd6..079f6d92 100644 --- a/src/ui/gui/helper.h +++ b/src/ui/gui/helper.h @@ -21,6 +21,8 @@ #ifndef __MISC_H__ #define __MISC_H__ +#include "relocatable.h" + #include #include @@ -49,4 +51,9 @@ struct getl_interface; gboolean execute_syntax (struct getl_interface *sss); +#define XML_NEW(FILE) \ + glade_xml_new (relocate(PKGDATADIR "/" FILE), NULL, NULL) + + + #endif diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c index fe2bf09e..557130d3 100644 --- a/src/ui/gui/psppire.c +++ b/src/ui/gui/psppire.c @@ -22,8 +22,11 @@ #include #include +#include "progname.h" +#include "relocatable.h" #include "data-editor.h" + #include #include #include @@ -100,7 +103,9 @@ main (int argc, char *argv[]) GError *err = 0; gchar *vers; - if ( ! gtk_parse_args (&argc, &argv) ) + set_program_name (argv[0]); + + if ( ! gtk_parse_args (&argc, &argv) ) { perror ("Error parsing arguments"); exit (1); @@ -222,6 +227,8 @@ parse_command_line (int *argc, char ***argv, gchar **filename, GError **err) return true; } +#define PIXBUF_NEW_FROM_FILE(FILE) \ + gdk_pixbuf_new_from_file (relocate (PKGDATADIR "/" FILE), 0) void @@ -233,37 +240,37 @@ create_icon_factory (void) GdkPixbuf *pixbuf; - pixbuf = gdk_pixbuf_new_from_file (PKGDATADIR "/value-labels.png", 0); + pixbuf = PIXBUF_NEW_FROM_FILE ("value-labels.png"); icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); g_object_unref (pixbuf); gtk_icon_factory_add ( factory, "pspp-value-labels", icon_set); - pixbuf = gdk_pixbuf_new_from_file (PKGDATADIR "/weight-cases.png", 0); + pixbuf = PIXBUF_NEW_FROM_FILE ("weight-cases.png"); icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); g_object_unref (pixbuf); gtk_icon_factory_add ( factory, "pspp-weight-cases", icon_set); - pixbuf = gdk_pixbuf_new_from_file (PKGDATADIR "/goto-variable.png", 0); + pixbuf = PIXBUF_NEW_FROM_FILE ("goto-variable.png"); icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); g_object_unref (pixbuf); gtk_icon_factory_add ( factory, "pspp-goto-variable", icon_set); - pixbuf = gdk_pixbuf_new_from_file (PKGDATADIR "/insert-variable.png", 0); + pixbuf = PIXBUF_NEW_FROM_FILE ("insert-variable.png"); icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); g_object_unref (pixbuf); gtk_icon_factory_add ( factory, "pspp-insert-variable", icon_set); - pixbuf = gdk_pixbuf_new_from_file (PKGDATADIR "/insert-case.png", 0); + pixbuf = PIXBUF_NEW_FROM_FILE ("insert-case.png"); icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); g_object_unref (pixbuf); gtk_icon_factory_add ( factory, "pspp-insert-case", icon_set); - pixbuf = gdk_pixbuf_new_from_file (PKGDATADIR "/split-file.png", 0); + pixbuf = PIXBUF_NEW_FROM_FILE ("split-file.png"); icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); g_object_unref (pixbuf); gtk_icon_factory_add ( factory, "pspp-split-file", icon_set); - pixbuf = gdk_pixbuf_new_from_file (PKGDATADIR "/select-cases.png", 0); + pixbuf = PIXBUF_NEW_FROM_FILE ("select-cases.png"); icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); g_object_unref (pixbuf); gtk_icon_factory_add ( factory, "pspp-select-cases", icon_set); diff --git a/src/ui/gui/syntax-editor.c b/src/ui/gui/syntax-editor.c index 4ca3dfe7..024181e6 100644 --- a/src/ui/gui/syntax-editor.c +++ b/src/ui/gui/syntax-editor.c @@ -308,8 +308,7 @@ on_run_to_end (GtkMenuItem *menuitem, gpointer user_data) struct syntax_editor * new_syntax_editor (void) { - GladeXML *xml = - glade_xml_new (PKGDATADIR "/syntax-editor.glade", NULL, NULL); + GladeXML *xml = XML_NEW ("syntax-editor.glade"); GtkWidget *text_view; struct syntax_editor *se ; diff --git a/src/ui/gui/transpose-dialog.c b/src/ui/gui/transpose-dialog.c index 4691fff7..4a89ace5 100644 --- a/src/ui/gui/transpose-dialog.c +++ b/src/ui/gui/transpose-dialog.c @@ -96,8 +96,7 @@ transpose_dialog (GObject *o, gpointer data) gint response ; struct data_editor *de = data; - GladeXML *xml = glade_xml_new (PKGDATADIR "/psppire.glade", - "transpose-dialog", NULL); + GladeXML *xml = XML_NEW ("psppire.glade"); GtkSheet *var_sheet = GTK_SHEET (get_widget_assert (de->xml, "variable_sheet")); diff --git a/src/ui/gui/var-sheet.c b/src/ui/gui/var-sheet.c index 79361449..7d5b4465 100644 --- a/src/ui/gui/var-sheet.c +++ b/src/ui/gui/var-sheet.c @@ -222,7 +222,7 @@ var_sheet_cell_entry_enter (GtkSheet * sheet, gint row, gint column, if ( row >= psppire_var_store_get_var_cnt (var_store)) return TRUE; - xml = glade_xml_new (PKGDATADIR "/data-editor.glade", NULL, NULL); + xml = XML_NEW ("data-editor.glade"); gtk_sheet_get_attributes (sheet, row, column, &attributes); diff --git a/src/ui/gui/weight-cases-dialog.c b/src/ui/gui/weight-cases-dialog.c index 3eb1808d..31907a15 100644 --- a/src/ui/gui/weight-cases-dialog.c +++ b/src/ui/gui/weight-cases-dialog.c @@ -75,8 +75,7 @@ weight_cases_dialog (GObject *o, gpointer data) PsppireDict *dict; struct variable *var; - GladeXML *xml = glade_xml_new (PKGDATADIR "/psppire.glade", - "weight-cases-dialog", NULL); + GladeXML *xml = XML_NEW ("psppire.glade"); GtkWidget *dialog = get_widget_assert (xml, "weight-cases-dialog"); GtkWidget *source = get_widget_assert (xml, "weight-cases-treeview"); diff --git a/src/ui/gui/window-manager.c b/src/ui/gui/window-manager.c index 0bdc2390..b78a341a 100644 --- a/src/ui/gui/window-manager.c +++ b/src/ui/gui/window-manager.c @@ -20,6 +20,8 @@ #include +#include "relocatable.h" + #include #include "syntax-editor.h" #include "data-editor.h" @@ -100,7 +102,7 @@ window_create (enum window_type type, const gchar *name) gtk_window_set_icon_from_file (GTK_WINDOW (e->window), - PKGDATADIR "/psppicon.png", 0); + relocate (PKGDATADIR "/psppicon.png"), 0); g_signal_connect (e->window, "destroy", G_CALLBACK (deregister_window), e); diff --git a/src/ui/terminal/automake.mk b/src/ui/terminal/automake.mk index cfc06bf1..fd426acd 100644 --- a/src/ui/terminal/automake.mk +++ b/src/ui/terminal/automake.mk @@ -11,13 +11,14 @@ src_ui_terminal_libui_a_SOURCES = \ src/ui/terminal/msg-ui.c \ src/ui/terminal/msg-ui.h +src_ui_terminal_libui_a_CFLAGS = -DINSTALLDIR=\"$(bindir)\" bin_PROGRAMS += src/ui/terminal/pspp src_ui_terminal_pspp_SOURCES = -src_ui_terminal_pspp_LDADD = \ +src_ui_terminal_pspp_LDFLAGS = \ src/ui/terminal/libui.a \ src/language/liblanguage.a \ src/output/charts/libcharts.a \ @@ -33,3 +34,9 @@ src_ui_terminal_pspp_LDADD = \ gl/libgl.la \ @LIBINTL@ @LIBREADLINE@ + + + +if RELOCATABLE_VIA_LD +src_ui_terminal_pspp_LDFLAGS += `$(RELOCATABLE_LDFLAGS) $(bindir)` +endif diff --git a/src/ui/terminal/main.c b/src/ui/terminal/main.c index e2cd180d..b95ae2e3 100644 --- a/src/ui/terminal/main.c +++ b/src/ui/terminal/main.c @@ -92,7 +92,8 @@ main (int argc, char **argv) signal (SIGFPE, bug_handler); signal (SIGINT, interrupt_handler); - set_program_name ("pspp"); + set_program_name (argv[0]); + i18n_init (); fpu_init (); gsl_set_error_handler_off ();