#
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
#
Description: supply manual page for program that doesn't have one
Author: Jay Berkenbilt <qjb@debian.org>

https://unicode-org.atlassian.net/browse/ICU-7665
https://unicode-org.atlassian.net/browse/ICU-7554

--- /dev/null
+++ icu/source/tools/gennorm2/Makefile.in.orig
@@ -0,0 +1,81 @@
+## Makefile.in for ICU - tools/gennorm2
+## Copyright (C) 2016 and later: Unicode, Inc. and others.
+## License & terms of use: http://www.unicode.org/copyright.html
+## Copyright (c) 2009-2011, International Business Machines Corporation and
+## others. All Rights Reserved.
+## Steven R. Loomis/Markus W. Scherer
+
+## Source directory information
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+
+top_builddir = ../..
+
+include $(top_builddir)/icudefs.mk
+
+## Build directory information
+subdir = tools/gennorm2
+
+TARGET_STUB_NAME = gennorm2
+
+## Extra files to remove for 'make clean'
+CLEANFILES = *~ $(DEPS)
+
+## Target information
+TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT)
+
+CPPFLAGS += -I$(srcdir) -I$(top_srcdir)/common -I$(srcdir)/../toolutil
+LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M)
+
+OBJECTS = gennorm2.o n2builder.o
+
+DEPS = $(OBJECTS:.o=.d)
+
+## List of phony targets
+.PHONY : all all-local install install-local clean clean-local	\
+distclean distclean-local dist dist-local check check-local install-man
+
+## Clear suffix list
+.SUFFIXES :
+
+## List of standard targets
+all: all-local
+install: install-local
+clean: clean-local
+distclean : distclean-local
+dist: dist-local
+check: all check-local
+
+all-local: $(TARGET)
+
+install-local: all-local
+	$(MKINSTALLDIRS) $(DESTDIR)$(sbindir)
+	$(INSTALL) $(TARGET) $(DESTDIR)$(sbindir)
+
+dist-local:
+
+clean-local:
+	test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
+	$(RMV) $(TARGET) $(OBJECTS)
+
+distclean-local: clean-local
+	$(RMV) Makefile
+
+check-local: all-local
+
+Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) \
+	 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+$(TARGET) : $(OBJECTS)
+	$(LINK.cc) $(OUTOPT)$@ $^ $(LIBS)
+	$(POST_BUILD_STEP)
+
+
+ifeq (,$(MAKECMDGOALS))
+-include $(DEPS)
+else
+ifneq ($(patsubst %clean,,$(MAKECMDGOALS)),)
+-include $(DEPS)
+endif
+endif
--- icu/source/tools/gennorm2/Makefile.in.orig
+++ icu/source/tools/gennorm2/Makefile.in
@@ -18,8 +18,13 @@
 
 TARGET_STUB_NAME = gennorm2
 
+SECTION = 8
+
+MAN_FILES = $(TARGET_STUB_NAME).$(SECTION)
+
+
 ## Extra files to remove for 'make clean'
-CLEANFILES = *~ $(DEPS)
+CLEANFILES = *~ $(DEPS) $(MAN_FILES)
 
 ## Target information
 TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT)
@@ -47,12 +52,16 @@
 dist: dist-local
 check: all check-local
 
-all-local: $(TARGET)
+all-local: $(TARGET) $(MAN_FILES)
 
-install-local: all-local
+install-local: all-local install-man
 	$(MKINSTALLDIRS) $(DESTDIR)$(sbindir)
 	$(INSTALL) $(TARGET) $(DESTDIR)$(sbindir)
 
+install-man: $(MAN_FILES)
+	$(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$(SECTION)
+	$(INSTALL_DATA) $? $(DESTDIR)$(mandir)/man$(SECTION)
+
 dist-local:
 
 clean-local:
@@ -73,6 +82,11 @@
 	$(POST_BUILD_STEP)
 
 
+%.$(SECTION): $(srcdir)/%.$(SECTION).in
+	cd $(top_builddir) \
+	 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
 ifeq (,$(MAKECMDGOALS))
 -include $(DEPS)
 else
--- /dev/null
+++ icu/source/tools/gennorm2/gennorm2.8.in
@@ -0,0 +1,71 @@
+.\" Hey, Emacs! This is -*-nroff-*- you know...
+.\"
+.\" gennorm2.8: manual page for the gennorm2 utility
+.\"
+.\" Copyright (C) 2005-2006 International Business Machines Corporation and others
+.\"
+.TH GENNORM2 8 "15 March 2010" "ICU MANPAGE" "ICU @VERSION@ Manual"
+.SH NAME
+.B gennorm2
+\- Builds binary data file with Unicode normalization data.
+.SH SYNOPSIS
+.B gennorm2
+[
+.BR "\-h\fP, \fB\-?\fP, \fB\-\-help"
+]
+[
+.BR "\-V\fP, \fB\-\-version"
+]
+[
+.BR "\-c\fP, \fB\-\-copyright"
+]
+[
+.BR "\-v\fP, \fB\-\-verbose"
+]
+[
+.BI "\-u\fP, \fB\-\-unicode" " unicode\-version\-number"
+]
+[
+.BI "\-s\fP, \fB\-\-sourcedir" " source\-directory"
+]
+[
+.BI "\-o\fP, \fB\-\-output" " output\-filename"
+]
+.BI "\fB\-\-fast"
+.SH DESCRIPTION
+.B gennorm2
+reads text files that define Unicode normalization,
+them, and builds a binary data file.
+.SH OPTIONS
+.TP
+.BR "\-h\fP, \fB\-?\fP, \fB\-\-help"
+Print help about usage and exit.
+.TP
+.BR "\-V\fP, \fB\-\-version"
+Print the version of
+.B gennorm2
+and exit.
+.TP
+.BR "\-c\fP, \fB\-\-copyright"
+Include a copyright notice.
+.TP
+.BR "\-v\fP, \fB\-\-verbose"
+Display extra informative messages during execution.
+.TP
+.BR "\-u\fP, \fB\-\-unicode"
+Specify Unicode version number, such as 5.2.0.
+.TP
+.BI "\-s\fP, \fB\-\-sourcedir" " source\-directory"
+Specify the input directory.
+.TP
+.BI "\-s\fP, \fB\-\-sourcedir" " source\-directory"
+Set the name of the output file.
+.TP
+.BI "\fB\-\-fast"
+optimize the .nrm file for fast normalization,
+which might increase its size  (Writes fully decomposed
+regular mappings instead of delta mappings.
+You should measure the runtime speed to make sure that
+this is a good trade-off.)
+.SH COPYRIGHT
+Copyright (C) 2009-2010 International Business Machines Corporation and others
--- /dev/null
+++ icu/source/tools/icuinfo/Makefile.in.orig
@@ -0,0 +1,115 @@
+## Makefile.in for ICU - tools/icuinfo
+## Copyright (C) 2016 and later: Unicode, Inc. and others.
+## License & terms of use: http://www.unicode.org/copyright.html
+## Copyright (c) 1999-2015, International Business Machines Corporation and
+## others. All Rights Reserved.
+## Madhu Katragadda
+
+## Source directory information
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+
+top_builddir = ../..
+
+include $(top_builddir)/icudefs.mk
+
+## Build directory information
+subdir = tools/icuinfo
+
+## Extra files to remove for 'make clean'
+CLEANFILES = *~ $(DEPS) $(PLUGIN_OBJECTS) $(PLUGINFILE) $(PLUGIN)
+
+## Target information
+TARGET = icuinfo$(EXEEXT)
+
+CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil -I$(top_srcdir)/tools/ctestfw 
+CPPFLAGS+= -I$(top_srcdir)/i18n
+LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M)
+
+OBJECTS = icuinfo.o
+@PLUGINS_TRUE@PLUGIN_OBJECTS = testplug.o
+
+DEPS = $(OBJECTS:.o=.d)
+
+# pass some information
+
+ICUINFO_OPTS=-i ../../data/out/build/$(ICUDATA_PLATFORM_NAME) -x $(top_builddir)/config/icuinfo.xml -v -K
+
+## List of phony targets
+.PHONY : all all-local install install-local clean clean-local		\
+distclean distclean-local dist dist-local check check-local plugin-check
+
+## Clear suffix list
+.SUFFIXES :
+
+## List of standard targets
+all: all-local
+install: install-local
+clean: clean-local
+distclean : distclean-local
+dist: dist-local
+check: all check-local
+
+all-local: $(TARGET) 
+
+install-local: all-local
+	$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
+	$(INSTALL) $(TARGET) $(DESTDIR)$(bindir)
+
+dist-local:
+
+clean-local:
+	test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
+	$(RMV) $(TARGET) $(OBJECTS)
+
+distclean-local: clean-local
+	$(RMV) Makefile
+
+check-local: $(TARGET)
+	$(INVOKE) ./$(TARGET) $(ICUINFO_OPTS)
+
+Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) \
+	 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+-include Makefile.local
+
+$(TARGET) : $(OBJECTS)
+	$(LINK.cc) $(OUTOPT)$@ $^ $(LIBS) 
+	$(POST_BUILD_STEP)
+
+PLUGIN=$(LIBPREFIX)plugin.$(SO)
+SO_TARGET=$(PLUGIN)
+
+PLUGINDIR=$(shell pwd)
+
+PLUGINFILE=$(PLUGINDIR)/icuplugins$(SO_TARGET_VERSION_MAJOR).txt
+
+CFLAGS+=$(SHAREDLIBCFLAGS)
+
+@PLUGINS_TRUE@HAVE_PLUGINS=yes
+
+ifeq ($(HAVE_PLUGINS),yes)
+$(PLUGINFILE): Makefile
+	echo "$(CURR_FULL_DIR)/$(PLUGIN)	myPlugin	x=4" > $@
+
+
+$(PLUGIN): $(PLUGIN_OBJECTS)
+	$(SHLIB.cc) $(SHAREDLIBCFLAGS) $(LD_SONAME) $(OUTOPT)$@ $^ $(LIBS)
+
+plugin: $(PLUGIN)
+
+plugin-check: $(PLUGIN) $(PLUGINFILE)
+	$(INVOKE) ICU_PLUGINS="$(CURR_FULL_DIR)" ./$(TARGET) -v -L
+else
+plugin plugin-check $(PLUGIN):
+	@echo "Plugins are disabled (use --enable-plugins to enable)"
+endif
+
+ifeq (,$(MAKECMDGOALS))
+-include $(DEPS)
+else
+ifneq ($(patsubst %clean,,$(MAKECMDGOALS)),)
+-include $(DEPS)
+endif
+endif
+
--- icu/source/tools/icuinfo/Makefile.in.orig
+++ icu/source/tools/icuinfo/Makefile.in
@@ -16,8 +16,15 @@
 ## Build directory information
 subdir = tools/icuinfo
 
+TARGET_STUB_NAME = icuinfo
+
+SECTION = 1
+
+MAN_FILES = $(TARGET_STUB_NAME).$(SECTION)
+
+
 ## Extra files to remove for 'make clean'
-CLEANFILES = *~ $(DEPS) $(PLUGIN_OBJECTS) $(PLUGINFILE) $(PLUGIN)
+CLEANFILES = *~ $(DEPS) $(PLUGIN_OBJECTS) $(PLUGINFILE) $(PLUGIN) $(MAN_FILES)
 
 ## Target information
 TARGET = icuinfo$(EXEEXT)
@@ -39,7 +46,8 @@
 
 ## List of phony targets
 .PHONY : all all-local install install-local clean clean-local		\
-distclean distclean-local dist dist-local check check-local plugin-check
+distclean distclean-local dist dist-local check check-local plugin-check \
+install-man
 
 ## Clear suffix list
 .SUFFIXES :
@@ -52,12 +60,16 @@
 dist: dist-local
 check: all check-local
 
-all-local: $(TARGET) 
+all-local: $(TARGET) $(MAN_FILES)
 
-install-local: all-local
+install-local: all-local install-man
 	$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
 	$(INSTALL) $(TARGET) $(DESTDIR)$(bindir)
 
+install-man: $(MAN_FILES)
+	$(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$(SECTION)
+	$(INSTALL_DATA) $? $(DESTDIR)$(mandir)/man$(SECTION)
+
 dist-local:
 
 clean-local:
@@ -107,6 +119,9 @@
 	@echo "Plugins are disabled (use --enable-plugins to enable)"
 endif
 
+%.$(SECTION): $(srcdir)/%.$(SECTION).in
+	cd $(top_builddir) \
+	 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
 ifeq (,$(MAKECMDGOALS))
 -include $(DEPS)
 else
--- /dev/null
+++ icu/source/tools/icuinfo/icuinfo.1.in
@@ -0,0 +1,76 @@
+.\" Hey, Emacs! This is -*-nroff-*- you know...
+.\"
+.\" icuinfo.1: manual page for the icuinfo utility
+.\"
+.\" Copyright (C) 2005-2006 International Business Machines Corporation and others
+.\"
+.TH ICUINFO 1 "1 May 2010" "ICU MANPAGE" "ICU @VERSION@ Manual"
+.SH NAME
+.B icuinfo
+\- Shows some basic info about the current ICU
+.SH SYNOPSIS
+.B icuinfo
+[
+.BR "\-h\fP, \fB\-?\fP, \fB\-\-help"
+]
+[
+.BR "\-V\fP, \fB\-\-version"
+]
+[
+.BR "\-c\fP, \fB\-\-copyright"
+]
+[
+.BI "\-i\fP, \fB\-\-icudatadir" " directory"
+]
+[
+.BR "\-v\fP, \fB\-\-verbose"
+]
+[
+.BI "\-L\fP, \fB\-\-list-plugins"
+]
+[
+.BI "\-m\fP, \fB\-\-milisecond-time"
+]
+[
+.BI "\-K\fP, \fB\-\-cleanup"
+]
+.SH DESCRIPTION
+.B icuinfo
+prints basic information about the current version of ICU.
+.SH OPTIONS
+.TP
+.BR "\-h\fP, \fB\-?\fP, \fB\-\-help"
+Print help about usage and exit.
+.TP
+.BR "\-V\fP, \fB\-\-version"
+Print the version of
+.B icuinfo
+and exit.
+.TP
+.BR "\-c\fP, \fB\-\-copyright"
+Embeds the standard ICU copyright into the
+.IR output-file .
+.TP
+.BR "\-v\fP, \fB\-\-verbose"
+Display extra informative messages during execution.
+.TP
+.BI "\-i\fP, \fB\-\-icudatadir" " directory"
+Look for any necessary ICU data files in
+.IR directory .
+For example, the file
+.B pnames.icu
+must be located when ICU's data is not built as a shared library.
+The default ICU data directory is specified by the environment variable
+.BR ICU_DATA .
+Most configurations of ICU do not require this argument.
+.TP
+.BI "\-L\fP, \fB\-\-list-plugins"
+If specified, list and diagnose issues with ICU plugins.
+.TP
+.BI "\-K\fP, \fB\-\-cleanup"
+Attempt to unload plugins before exiting.
+.TP
+.BI "\-m\fP, \fB\-\-milisecond-time"
+Print the current UTC time in milliseconds.
+.SH COPYRIGHT
+Copyright (C) 2010 International Business Machines Corporation and others