Skip to content

Commit

Permalink
[#36, #52] better support for i18n, streamline Makefiles
Browse files Browse the repository at this point in the history
  • Loading branch information
andy5995 committed Dec 29, 2017
1 parent 2055a4b commit 37918a2
Show file tree
Hide file tree
Showing 22 changed files with 51 additions and 66 deletions.
18 changes: 0 additions & 18 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ EXTRA_DIST = config.rpath m4/ChangeLog .version Makefile.config contrib ABOUT-N

ACLOCAL_AMFLAGS = -I m4

PACKAGE = @PACKAGE@
VERSION = @VERSION@

dist-hook:
find $(distdir) -depth -name CVS -print | xargs rm -fr

Expand All @@ -41,18 +38,3 @@ install-data-hook:
@echo "installed as " $(DESTDIR)$(bindir)/rundig

distdir = $(PACKAGE)-$(VERSION)
dist: Makefile
rm -fr $(distdir)
mkdir $(distdir)
chmod 777 $(distdir)
for file in $(DISTFILES); do \
ln $$file $(distdir) 2>/dev/null || cp -p $$file $(distdir); \
done
for subdir in $(SUBDIRS); do \
mkdir $(distdir)/$$subdir || exit 1; \
chmod 777 $(distdir)/$$subdir; \
(cd $$subdir && $(MAKE) $@) || exit 1; \
done
tar chozf $(distdir).tar.gz $(distdir)
rm -fr $(distdir)

7 changes: 7 additions & 0 deletions Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

AUTOMAKE_OPTIONS = foreign no-dependencies

PACKAGE = @PACKAGE@
VERSION = @VERSION@

AM_CPPFLAGS=-std=c++11 -pedantic \
-DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\" \
-I$(top_srcdir)/include -I$(top_srcdir)/htlib \
Expand All @@ -29,3 +32,7 @@ HTLIBS= $(top_builddir)/htnet/libhtnet.la \
$(top_builddir)/htlib/libht.la \
$(top_builddir)/db/libhtdb.la
localedir = @localedir@
LIBS = @LIBINTL@ @LIBS@
LDADD = $(HTLIBS) @LIBINTL@
17 changes: 2 additions & 15 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBS = @LIBINTL@ @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
Expand Down Expand Up @@ -410,6 +410,7 @@ HTLIBS = $(top_builddir)/htnet/libhtnet.la \
$(top_builddir)/htlib/libht.la \
$(top_builddir)/db/libhtdb.la
LDADD = $(HTLIBS) @LIBINTL@
@TESTS_TRUE@TESTDIR = test
SUBDIRS = db htlib htword htcommon htnet htfuzzy htdb hldig hlsearch httools installdir include $(TESTDIR) po
EXTRA_DIST = config.rpath m4/ChangeLog .version Makefile.config contrib ABOUT-NLS
Expand Down Expand Up @@ -908,20 +909,6 @@ install-data-hook:
@echo "Before you can start searching, you will need to create a"
@echo "search database. A sample script to do this has been"
@echo "installed as " $(DESTDIR)$(bindir)/rundig
dist: Makefile
rm -fr $(distdir)
mkdir $(distdir)
chmod 777 $(distdir)
for file in $(DISTFILES); do \
ln $$file $(distdir) 2>/dev/null || cp -p $$file $(distdir); \
done
for subdir in $(SUBDIRS); do \
mkdir $(distdir)/$$subdir || exit 1; \
chmod 777 $(distdir)/$$subdir; \
(cd $$subdir && $(MAKE) $@) || exit 1; \
done
tar chozf $(distdir).tar.gz $(distdir)
rm -fr $(distdir)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
Expand Down
12 changes: 0 additions & 12 deletions hldig/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,7 @@ noinst_HEADERS = Document.h ExternalParser.h HTML.h \
Parsable.h Plaintext.h Retriever.h Server.h URLRef.h hldig.h \
ExternalTransport.h

PACKAGE = @PACKAGE@
VERSION = @VERSION@

ACLOCAL_AMFLAGS = -I m4

top_srcdir = @top_srcdir@
subdir = @top_srcdir@

datadir = @datadir@
datarootdir= @datarootdir@
localedir = @localedir@
LIBS = @LIBINTL@ @LIBS@

hldig_DEPENDENCIES = $(HTLIBS)
hldig_LDFLAGS = $(PROFILING) ${extra_ldflags}
hldig_LDADD = $(HTLIBS) @LIBINTL@
5 changes: 3 additions & 2 deletions hldig/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = hldig$(EXEEXT)
subdir = hldig
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
Expand All @@ -121,6 +122,7 @@ am_hldig_OBJECTS = Document.$(OBJEXT) HTML.$(OBJEXT) \
Server.$(OBJEXT) ExternalTransport.$(OBJEXT) URLRef.$(OBJEXT) \
hldig.$(OBJEXT) ExternalParser.$(OBJEXT)
hldig_OBJECTS = $(am_hldig_OBJECTS)
hldig_LDADD = $(LDADD)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
Expand Down Expand Up @@ -378,6 +380,7 @@ HTLIBS = $(top_builddir)/htnet/libhtnet.la \
$(top_builddir)/htlib/libht.la \
$(top_builddir)/db/libhtdb.la
LDADD = $(HTLIBS) @LIBINTL@
hldig_SOURCES = Document.cc HTML.cc \
Parsable.cc Plaintext.cc \
Retriever.cc Server.cc ExternalTransport.cc \
Expand All @@ -388,10 +391,8 @@ noinst_HEADERS = Document.h ExternalParser.h HTML.h \
ExternalTransport.h
ACLOCAL_AMFLAGS = -I m4
subdir = @top_srcdir@
hldig_DEPENDENCIES = $(HTLIBS)
hldig_LDFLAGS = $(PROFILING) ${extra_ldflags}
hldig_LDADD = $(HTLIBS) @LIBINTL@
all: all-am
.SUFFIXES:
Expand Down
5 changes: 0 additions & 5 deletions hldig/hldig.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ using namespace std;

#include <stdio.h>

#include "gettext.h"
#define _(String) gettext (String)
#define gettext_noop(String) String
#define N_(String) gettext_noop (String)

extern int debug;
extern DocumentDB docs;
extern HtRegexList limits;
Expand Down
3 changes: 2 additions & 1 deletion hlsearch/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBS = @LIBINTL@ @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
Expand Down Expand Up @@ -393,6 +393,7 @@ HTLIBS = $(top_builddir)/htnet/libhtnet.la \
$(top_builddir)/htlib/libht.la \
$(top_builddir)/db/libhtdb.la
LDADD = $(HTLIBS) @LIBINTL@
LOCAL_DEFINES = -DCONFIG_DIR=\"$(CONFIG_DIR)\" -I$(top_srcdir)/htfuzzy
hlsearch_SOURCES = Display.cc DocMatch.cc ResultList.cc ResultMatch.cc \
Template.cc TemplateList.cc WeightWord.cc hlsearch.cc \
Expand Down
6 changes: 5 additions & 1 deletion hlsearch/hlsearch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ struct
int
main (int ac, char **av)
{
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);

int c;
extern char *optarg;
int override_config = 0;
Expand Down Expand Up @@ -965,7 +969,7 @@ reportError (char *msg)
void
usage ()
{
cout << "usage: hlsearch [-v][-d][-c configfile] [query_string]\n";
cout << _("usage: hlsearch [-v][-d][-c configfile] [query_string]\n");
cout << "This program is part of hl://Dig " << VERSION << "\n\n";
cout << "Options:\n";
cout << "\t-v -d\tVerbose mode. This increases the verbosity of the\n";
Expand Down
3 changes: 2 additions & 1 deletion htcommon/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBS = @LIBINTL@ @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
Expand Down Expand Up @@ -445,6 +445,7 @@ HTLIBS = $(top_builddir)/htnet/libhtnet.la \
$(top_builddir)/htlib/libht.la \
$(top_builddir)/db/libhtdb.la
LDADD = $(HTLIBS) @LIBINTL@
#
# Do not output #line because it confuses the dependencies
Expand Down
3 changes: 2 additions & 1 deletion htdb/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBS = @LIBINTL@ @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
Expand Down Expand Up @@ -386,6 +386,7 @@ HTLIBS = $(top_builddir)/htnet/libhtnet.la \
$(top_builddir)/htlib/libht.la \
$(top_builddir)/db/libhtdb.la
LDADD = $(HTLIBS) @LIBINTL@
htdb_load_SOURCES = htdb_load.cc
htdb_load_DEPENDENCIES = $(HTLIBS)
htdb_load_LDFLAGS = $(PROFILING) ${extra_ldflags}
Expand Down
3 changes: 2 additions & 1 deletion htfuzzy/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBS = @LIBINTL@ @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
Expand Down Expand Up @@ -413,6 +413,7 @@ HTLIBS = $(top_builddir)/htnet/libhtnet.la \
$(top_builddir)/htlib/libht.la \
$(top_builddir)/db/libhtdb.la
LDADD = $(HTLIBS) @LIBINTL@
LOCAL_DEFINES = -DMV=\"$(MV)\"
pkglib_LTLIBRARIES = libfuzzy.la
libfuzzy_la_SOURCES = Endings.cc EndingsDB.cc Exact.cc \
Expand Down
3 changes: 2 additions & 1 deletion htlib/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBS = @LIBINTL@ @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
Expand Down Expand Up @@ -431,6 +431,7 @@ HTLIBS = $(top_builddir)/htnet/libhtnet.la \
$(top_builddir)/htlib/libht.la \
$(top_builddir)/db/libhtdb.la
LDADD = $(HTLIBS) @LIBINTL@
pkglib_LTLIBRARIES = libht.la
libht_la_SOURCES = Configuration.cc Database.cc Dictionary.cc \
DB2_db.cc IntObject.cc List.cc Object.cc \
Expand Down
3 changes: 2 additions & 1 deletion htnet/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBS = @LIBINTL@ @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
Expand Down Expand Up @@ -407,6 +407,7 @@ HTLIBS = $(top_builddir)/htnet/libhtnet.la \
$(top_builddir)/htlib/libht.la \
$(top_builddir)/db/libhtdb.la
LDADD = $(HTLIBS) @LIBINTL@
pkglib_LTLIBRARIES = libhtnet.la
libhtnet_la_SOURCES = Connection.cc Transport.cc HtHTTP.cc HtFile.cc \
HtNNTP.cc HtFTP.cc HtCookie.cc HtCookieJar.cc HtCookieMemJar.cc \
Expand Down
3 changes: 2 additions & 1 deletion httools/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBS = @LIBINTL@ @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
Expand Down Expand Up @@ -401,6 +401,7 @@ HTLIBS = $(top_builddir)/htnet/libhtnet.la \
$(top_builddir)/htlib/libht.la \
$(top_builddir)/db/libhtdb.la
LDADD = $(HTLIBS) @LIBINTL@
LOCAL_DEFINES = -DSENDMAIL=\"$(SENDMAIL)\"
htpurge_SOURCES = htpurge.cc
htpurge_DEPENDENCIES = $(HTLIBS)
Expand Down
3 changes: 2 additions & 1 deletion htword/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBS = @LIBINTL@ @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
Expand Down Expand Up @@ -408,6 +408,7 @@ HTLIBS = $(top_builddir)/htnet/libhtnet.la \
$(top_builddir)/htlib/libht.la \
$(top_builddir)/db/libhtdb.la
LDADD = $(HTLIBS) @LIBINTL@
#
# Part of the ht://Dig package <http://www.htdig.org/>
Expand Down
3 changes: 2 additions & 1 deletion include/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBS = @LIBINTL@ @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
Expand Down Expand Up @@ -373,6 +373,7 @@ HTLIBS = $(top_builddir)/htnet/libhtnet.la \
$(top_builddir)/htlib/libht.la \
$(top_builddir)/db/libhtdb.la
LDADD = $(HTLIBS) @LIBINTL@
EXTRA_DIST = config.h.in stamp-h.in
pkginclude_HEADERS = htconfig.h
all: config.h
Expand Down
File renamed without changes.
7 changes: 6 additions & 1 deletion include/htconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
For copyright details, see the file COPYING in your distribution
or the GNU General Public License version 2 or later
<http://www.gnu.org/copyleft/gpl.html>
*/

#include <config.h>

#include "gettext.h"
#define _(String) gettext (String)
#define gettext_noop(String) String
#define N_(String) gettext_noop (String)

#if HAVE_STDBOOL_H
#include <stdbool.h>
#else
Expand Down
3 changes: 2 additions & 1 deletion installdir/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBS = @LIBINTL@ @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
Expand Down Expand Up @@ -363,6 +363,7 @@ HTLIBS = $(top_builddir)/htnet/libhtnet.la \
$(top_builddir)/htlib/libht.la \
$(top_builddir)/db/libhtdb.la
LDADD = $(HTLIBS) @LIBINTL@
man_MANS = htdig-pdfparser.1 htdig.1 htdump.1 htfuzzy.1 htload.1 htmerge.1 \
htnotify.1 htpurge.1 htsearch.1 htstat.1 rundig.1 htdigconfig.8
Expand Down
1 change: 1 addition & 0 deletions po/POTFILES.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# List of source files which contain translatable strings.

hldig/hldig.cc
hlsearch/hlsearch.cc
6 changes: 5 additions & 1 deletion po/hldig.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: hldig 0.1.01\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2017-12-28 05:00-0600\n"
"POT-Creation-Date: 2017-12-28 23:11-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -172,3 +172,7 @@ msgid ""
"\n"
"Options:\n"
msgstr ""

#: hlsearch/hlsearch.cc:968
msgid "usage: hlsearch [-v][-d][-c configfile] [query_string]\n"
msgstr ""
3 changes: 2 additions & 1 deletion test/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBS = @LIBINTL@ @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
Expand Down Expand Up @@ -611,6 +611,7 @@ HTLIBS = $(top_builddir)/htnet/libhtnet.la \
$(top_builddir)/htlib/libht.la \
$(top_builddir)/db/libhtdb.la
LDADD = $(HTLIBS) @LIBINTL@
#
# Part of the ht://Dig package <http://www.htdig.org/>
Expand Down

0 comments on commit 37918a2

Please sign in to comment.