Subject: Automate the build of ja-dic.el

From: Paul Eggert <[email-masked]>
Date: Fri, 15 Mar 2013 23:13:50 -0700

Tags: patch
Severity: wishlist

Currently the procedure for building ja-dic.el is semiautomated
and it's installed by hand into the bzr repository.  Here's a patch
to automate the build, so that the bzr repository need not contain
this file.  The file is still part of the Emacs tarball, so ordinary
builds are unchanged; the patch should affect only bootstrap builds.

I'm CC'ing this to Mr. Handa to give him a heads-up.

The full patch (gzipped) is attached.  Most of the
patch consists of removing or updating catalogs and so it's
pretty boring.  The key part of the patch is copied below.

# Begin patch
=== modified file '.bzrignore'
--- .bzrignore	2013-02-21 22:42:56 +0000
+++ .bzrignore	2013-03-16 06:03:12 +0000
@@ -80,6 +80,7 @@
 build-aux/depcomp
 build-aux/install-sh
 build-aux/missing
+leim/SKK-DIC/SKK-JISYO.L.unannotated
 leim/leim-list.el
 leim/quail/*.el
 leim/changed.misc

=== modified file 'ChangeLog'
--- ChangeLog	2013-03-13 18:42:22 +0000
+++ ChangeLog	2013-03-16 06:03:12 +0000
@@ -1,3 +1,10 @@
+2013-03-15  Paul Eggert  <[email-masked]>
+
+	Automate the build of ja-dic.el.
+	* .bzrignore: Add leim/SKK-DIC/SKK-JISYO.L.unannotated.
+	* configure.ac (AC_PROG_AWK): Mention in a comment.
+	* make-dist (files): Distribute new file leim/SKK-DIC/unannotation.awk.
+
 2013-03-13  Paul Eggert  <[email-masked]>

 	File synchronization fixes (Bug#13944).

=== modified file 'configure.ac'
--- configure.ac	2013-03-13 18:42:22 +0000
+++ configure.ac	2013-03-16 06:03:12 +0000
@@ -789,7 +789,8 @@

 dnl Some other nice autoconf tests.
-dnl These are commented out, since gl_EARLY and/or Autoconf already does them.
+dnl Commented out, since gl_EARLY, gl_INIT and/or Autoconf already does them.
+dnl AC_PROG_AWK
 dnl AC_PROG_INSTALL
 dnl AC_PROG_MKDIR_P
 dnl if test "x$RANLIB" = x; then

=== modified file 'leim/ChangeLog'
--- leim/ChangeLog	2013-03-11 16:31:55 +0000
+++ leim/ChangeLog	2013-03-16 06:03:12 +0000
@@ -1,3 +1,20 @@
+2013-03-15  Paul Eggert  <[email-masked]>
+
+	Automate the build of ja-dic.el.
+	ja-dic.el no longer needs to be in the repository: it's now
+	generated as part of the bootstrap.  Also, update SKK-JISYO.L to
+	match the upstream source exactly.
+	* ja-dic/ja-dic.el: Remove from repository.  It is still distributed
+	as part of the Emacs tarball.
+	* Makefile.in (AWK): New macro.
+	($(srcdir)/ja-dic/ja-dic.el): New rule.
+	(compile-main): Depend on it.
+	(clean): Remove SKK-DIC/SKK-JISYO.L.unannotated.
+	* SKK-DIC/README: Update to reflect new build procedure.
+	* SKK-DIC/SKK-JISYO.L: Update to match source exactly.
+	This is now the annotated version, to match the upstream file name;
+	the unannotated one is built from it automatically.
+
 2013-02-08  Stefan Monnier  <[email-masked]>

 	* quail/latin-ltx.el: Add greek superscripts.

=== modified file 'leim/Makefile.in'
--- leim/Makefile.in	2013-01-01 09:11:05 +0000
+++ leim/Makefile.in	2013-03-16 06:03:12 +0000
@@ -39,6 +39,7 @@
 RUN_EMACS = EMACSLOADPATH=$(buildlisppath) LC_ALL=C \
 	${EMACS} -batch --no-site-file --no-site-lisp

+AWK = @AWK@
 MKDIR_P = @MKDIR_P@

 # Files generated from TIT dictionaries for Chinese GB character set.
@@ -144,6 +145,15 @@
 	fi
 	sed -n '/^[^;]/ p' < ${srcdir}/leim-ext.el >> $@

+$(srcdir)/ja-dic/ja-dic.el: $(srcdir)/SKK-DIC/SKK-JISYO.L \
+  $(srcdir)/SKK-DIC/unannotation.awk
+	@$(MKDIR_P) $(srcdir)/ja-dic SKK-DIC
+	$(AWK) -f $(srcdir)/SKK-DIC/unannotation.awk \
+	  $(srcdir)/SKK-DIC/SKK-JISYO.L \
+	  > SKK-DIC/SKK-JISYO.L.unannotated
+	$(RUN_EMACS) -l $(buildlisppath)/international/ja-dic-cnv \
+	  --eval '(skkdic-convert "SKK-DIC/SKK-JISYO.L.unannotated" "$(srcdir)/ja-dic")'
+
 ## Following adapted from lisp/Makefile.in.
 setwins=wins="${srcdir}/ja-dic quail"; \
 	[ `cd ${srcdir} && /bin/pwd` != `/bin/pwd` ] && \
@@ -156,7 +166,7 @@
 # Compile all the Elisp files that need it.  Beware: it approximates
 # `no-byte-compile', so watch out for false-positives!
 .PHONY: compile-main
-compile-main: ${TIT_MISC}
+compile-main: ${TIT_MISC} $(srcdir)/ja-dic/ja-dic.el
 	@($(setwins); \
 	els=`echo "$$wins " | sed -e 's| |/*.el |g'`; \
 	for el in $$els; do \
@@ -172,6 +182,7 @@

 clean mostlyclean:
 	rm -f ${TIT_MISC} ${TIT_MISC:.el=.elc} \
+		SKK-DIC/SKK-JISYO.L.unannotated \
 		leim-list.el changed.tit changed.misc

 # The following target is needed because the `clean' target only removes

=== modified file 'leim/SKK-DIC/README'
--- leim/SKK-DIC/README	2010-02-16 06:58:32 +0000
+++ leim/SKK-DIC/README	2013-03-16 06:03:12 +0000
@@ -1,4 +1,7 @@
-The file SKK-JISYO.L is renamed from SKK-JISYO.L.unannotated which is
-distributed at http://openlab.ring.gr.jp/skk/skk/dic/.
-SKK-JISYO.L.unannotated is free software distributed under the terms
+This directory contains a copy of the following files:
+
+http://openlab.ring.gr.jp/skk/skk/dic/SKK-JISYO.L
+http://openlab.ring.gr.jp/skk/skk/tools/unannotation.awk
+
+These files are free software distributed under the terms
 of the GNU General Public License.

=== modified file 'leim/SKK-DIC/SKK-JISYO.L'
[see full patch]

=== added file 'leim/SKK-DIC/unannotation.awk'
[see full patch]

=== removed directory 'leim/ja-dic'
=== removed file 'leim/ja-dic/ja-dic.el'
[see full patch]

=== modified file 'make-dist'
--- make-dist	2013-03-03 02:43:30 +0000
+++ make-dist	2013-03-16 06:03:12 +0000
@@ -324,7 +324,8 @@
  ln makefile.w32-in ../${tempdir}/leim
  ln ChangeLog README ../${tempdir}/leim
  ln CXTERM-DIC/README CXTERM-DIC/*.tit ../${tempdir}/leim/CXTERM-DIC
- ln SKK-DIC/README SKK-DIC/SKK-JISYO.L ../${tempdir}/leim/SKK-DIC
+ ln SKK-DIC/README SKK-DIC/SKK-JISYO.L SKK-DIC/unannotation.awk \
+   ../${tempdir}/leim/SKK-DIC
  ln MISC-DIC/README MISC-DIC/*.* ../${tempdir}/leim/MISC-DIC
  ln ja-dic/*.el ja-dic/*.elc ../${tempdir}/leim/ja-dic
  ln Makefile.in ../${tempdir}/leim/Makefile.in