lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Linux makefiles update


From: Vaclav Slavik
Subject: Re: [lmi] Linux makefiles update
Date: Fri, 14 Mar 2008 02:58:54 +0100
User-agent: KMail/1.9.9

Greg Chicares wrote:
> (1) I followed your 'ls' recipe instead of the patch, because the
> two differed slightly--same contents, different order. Could you
> and I be using different locales? 

Yes, I had LANG=en_US.UTF-8. I'm surprised the order is different
from POSIX locale, but it is (we get same results if I reset
locale to C):

> $echo "abc\naBc\na.c\na_c\na-c" |sort
> a-c
> a.c
> aBc
> a_c
> abc

$ echo -e "abc\naBc\na.c\na_c\na-c" | sort
abc
aBc
a_c
a-c
a.c
$

> which AFAICT follows LC_COLLATE for the POSIX locale.
>
> (2) Would it be a bad idea to write this, e.g.,
>
>   dist_xrc_DATA = `ls -1 *.xrc *.xpm`

The only problem with that is in fairy obscure case: if you have
other files with .xrc extension in sources directory, they will
be used too.But even if that happened, it wouldn't do any real harm,
while using wildcards here is clearly beneficial. Case in point:
now it's XSL files that are broken. So I think we should go ahead
and replace these two enumerations with the following:

dist_xrc_DATA = $(shell ls -1 $(srcdir)/*.xrc $(srcdir)/*.xpm)
dist_xsl_DATA = $(shell ls -1 $(srcdir)/*.xsl)

("$(shell ...)" is needed because GNU make won't understand
backsticks in dependencies list; $(srcdir) is needed for
out-of-tree builds)

> (3) Nearby I see this comment:
>
> # TODO: we should install them in $(pkgdatadir)/resources or
> something similar #       (but for this the code in main_wx.cpp
> must be modified to allow it) xrcdir = $(bindir)
>
> and I wonder whether we can resolve that issue. All these files
> are assumed to reside wherever this 'getopt' argument specifies:
>
>         {"data_path" ,REQD_ARG ,0 ,'d' ,0 ,"path to data files"},
>
> The path defaults to '.' if it's not specified. That's a
> convenience for msw end users, who keep all files in a single
> directory, e.g., 'C:\lmi-20080224Z\' for the latest release.
> If $(xrcdir) is to be used for 'make distrib', then this recipe:
>
> $<version.hpp sed -e'/LMI_VERSION/!d'
> -e's|^.*"\([0-9A-Z]\{8\}\).*$|/lmi-\1Z|'
>
> reliably gives the POSIX equivalent, as long as we can assume
> gnu 'sed' is being used (I'm not sure '\{' is portable).

It's used by make install and a reasonable default would be
$prefix/share/lmi, that's what people expect on Unix. One way
to do it is to replace xrcdir and xsldir definitions with this:

xrcdir = $(pkgdatadir)
xsldir = $(pkgdatadir)

and then apply this patch:

Index: Makefile.am
===================================================================
RCS file: /sources/lmi/lmi/Makefile.am,v
retrieving revision 1.36
diff -u -u -r1.36 Makefile.am
--- Makefile.am 9 Mar 2008 00:04:34 -0000       1.36
+++ Makefile.am 14 Mar 2008 01:51:52 -0000
@@ -208,6 +134,7 @@
     AM_LDFLAGS=--enable-auto-import
 else
     AM_LDFLAGS=
+    AM_CPPFLAGS=-DLMI_DATADIR=\"$(pkgdatadir)\"
 endif
 
 ##############################################################################
Index: global_settings.cpp
===================================================================
RCS file: /sources/lmi/lmi/global_settings.cpp,v
retrieving revision 1.17
diff -u -u -r1.17 global_settings.cpp
--- global_settings.cpp 19 Feb 2008 16:22:15 -0000      1.17
+++ global_settings.cpp 14 Mar 2008 01:51:52 -0000
@@ -51,7 +51,11 @@
     ,ash_nazg_                  (false)
     ,custom_io_0_               (false)
     ,regression_testing_        (false)
+#ifdef LMI_DATADIR
+    ,data_directory_            (LMI_DATADIR)
+#else
     ,data_directory_            (".")
+#endif
     ,regression_test_directory_ (".")
 {}
 

(Complete patch with all the changes described above is pasted below
for your convenience.)

Regards,
Vaclav


Index: Makefile.am
===================================================================
RCS file: /sources/lmi/lmi/Makefile.am,v
retrieving revision 1.36
diff -u -u -r1.36 Makefile.am
--- Makefile.am 9 Mar 2008 00:04:34 -0000       1.36
+++ Makefile.am 14 Mar 2008 01:58:25 -0000
@@ -57,85 +57,11 @@
     libmain_auxiliary_common.la
 
 # data files
-#
-# TODO: we should install them in $(pkgdatadir)/resources or something similar
-#       (but for this the code in main_wx.cpp must be modified to allow it)
-xrcdir = $(bindir)
-dist_xrc_DATA = \
-    about.xpm \
-    census_view.xpm \
-    close.xpm \
-    database_view.xpm \
-    default_cell.xpm \
-    delete-row.xpm \
-    edit-case.xpm \
-    edit-cell.xpm \
-    edit-class.xpm \
-    exit.xpm \
-    fixed-width.xpm \
-    help.xpm \
-    illustration_view.xpm \
-    insert-rows.xpm \
-    lmi.xpm \
-    menus.xrc \
-    new.xpm \
-    open.xpm \
-    paste-case.xpm \
-    policy_view.xpm \
-    policy_view.xrc \
-    preferences.xpm \
-    preferences_view.xrc \
-    print-case.xpm \
-    print-cell.xpm \
-    print-options.xpm \
-    print-preview.xpm \
-    print.xpm \
-    round_downward.xpm \
-    round_downward_hover.xpm \
-    round_downward_selected.xpm \
-    round_not_at_all.xpm \
-    round_not_at_all_hover.xpm \
-    round_not_at_all_selected.xpm \
-    round_to_nearest.xpm \
-    round_to_nearest_hover.xpm \
-    round_to_nearest_selected.xpm \
-    round_upward.xpm \
-    round_upward_hover.xpm \
-    round_upward_selected.xpm \
-    rounding_view.xpm \
-    rounding_view.xrc \
-    run-case.xpm \
-    run-cell.xpm \
-    save.xpm \
-    saveas.xpm \
-    skin.xrc \
-    skin_coli_boli.xrc \
-    skin_group_carveout.xrc \
-    skin_reg_d.xrc \
-    skin_single_premium.xrc \
-    skin_variable_annuity.xrc \
-    text_view.xpm \
-    tier_view.xpm \
-    toolbar.xrc \
-    varying-width.xpm \
-    write_spreadsheet.xpm \
-
-xsldir = $(bindir)
-dist_xsl_DATA = \
-    calculation_summary_html.xsl \
-    calculation_summary_tsv.xsl \
-    fo_common.xsl \
-    group_private_placement.xsl \
-    illustration_reg.xsl \
-    individual_private_placement.xsl \
-    ledger_common_tsv.xsl \
-    ledger_common.xsl \
-    ledger_formats.xml \
-    microcosm_tsv.xsl \
-    nasd.xsl \
-    offshore_private_placement.xsl \
-    variable_annuity.xsl \
-    xml2to1.xsl
+xrcdir = $(pkgdatadir)
+dist_xrc_DATA = $(shell ls -1 $(srcdir)/*.xrc $(srcdir)/*.xpm)
+
+xsldir = $(pkgdatadir)
+dist_xsl_DATA = $(shell ls -1 $(srcdir)/*.xsl)
 
 # CGI stuff
 if LMI_WITH_CGI
@@ -208,6 +134,7 @@
     AM_LDFLAGS=--enable-auto-import
 else
     AM_LDFLAGS=
+    AM_CPPFLAGS=-DLMI_DATADIR=\"$(pkgdatadir)\"
 endif
 
 ##############################################################################
Index: global_settings.cpp
===================================================================
RCS file: /sources/lmi/lmi/global_settings.cpp,v
retrieving revision 1.17
diff -u -u -r1.17 global_settings.cpp
--- global_settings.cpp 19 Feb 2008 16:22:15 -0000      1.17
+++ global_settings.cpp 14 Mar 2008 01:58:25 -0000
@@ -51,7 +51,11 @@
     ,ash_nazg_                  (false)
     ,custom_io_0_               (false)
     ,regression_testing_        (false)
+#ifdef LMI_DATADIR
+    ,data_directory_            (LMI_DATADIR)
+#else
     ,data_directory_            (".")
+#endif
     ,regression_test_directory_ (".")
 {}
 



-- 
PGP key: 0x465264C9, available from http://pgp.mit.edu/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]