]> git.donarmstrong.com Git - lilypond.git/commitdiff
Web build: separate weblinks from version.
authorGraham Percival <graham@percival-music.ca>
Sun, 17 Jan 2010 17:58:01 +0000 (17:58 +0000)
committerGraham Percival <graham@percival-music.ca>
Sun, 17 Jan 2010 18:04:37 +0000 (18:04 +0000)
Documentation/web.texi
make/doc-i18n-root-rules.make
scripts/build/create-version-itexi.py
scripts/build/create-weblinks-itexi.py [new file with mode: 0644]
stepmake/stepmake/texinfo-rules.make
website.make

index f56cbde8746b18f9b86ee9c2e46fc11377d3c062..7b4c04922e0505bad9a1af5724b806bd25c48889 100644 (file)
@@ -20,6 +20,7 @@
 @set FDL
 @set web
 @include macros.itexi
+@include weblinks.itexi
 
 @afourpaper
 
index c505bb0c503ee3ef0da45e493357b6ce9a7ee2e2..487b65733be85b97acaa6f7bfb4a6e6036f1d78e 100644 (file)
@@ -10,7 +10,7 @@ $(top-build-dir)/Documentation/$(outdir)/%/index.$(ISOLANG).html: $(outdir)/%.te
 $(top-build-dir)/Documentation/$(outdir)/%-big-page.$(ISOLANG).html: $(outdir)/%.texi $(XREF_MAPS_DIR)/%.$(ISOLANG).xref-map $(TRANSLATION_LILY_IMAGES)
        $(TEXI2HTML) -D bigpage $(TEXI2HTML_FLAGS) --output=$@ $<
 
-$(top-build-dir)/Documentation/$(outdir)/%.$(ISOLANG).html: $(outdir)/%.texi $(XREF_MAPS_DIR)/%.$(ISOLANG).xref-map $(outdir)/version.itexi
+$(top-build-dir)/Documentation/$(outdir)/%.$(ISOLANG).html: $(outdir)/%.texi $(XREF_MAPS_DIR)/%.$(ISOLANG).xref-map $(outdir)/version.itexi $(outdir)/weblinks.itexi
        $(TEXI2HTML) $(TEXI2HTML_FLAGS) --output=$@ $<
 
 $(top-build-dir)/Documentation/$(outdir)/%.$(ISOLANG).pdf: $(outdir)/%.texi
@@ -21,6 +21,9 @@ $(top-build-dir)/Documentation/$(outdir)/%.$(ISOLANG).pdf: $(outdir)/%.texi
 $(outdir)/version.%: $(top-src-dir)/VERSION
        $(PYTHON) $(top-src-dir)/scripts/build/create-version-itexi.py > $@
 
+$(outdir)/weblinks.%: $(top-src-dir)/VERSION
+       $(PYTHON) $(top-src-dir)/scripts/build/create-weblinks-itexi.py > $@
+
 $(outdir)/%.png: $(top-build-dir)/Documentation/$(outdir)/%.png
        ln -f $< $@
 
@@ -37,7 +40,7 @@ $(TRANSLATION_LILY_IMAGES): $(MASTER_TEXI_FILES)
        find $(outdir) \( -name 'lily-*.png' -o -name 'lily-*.ly' \) | sed 's!$(outdir)/!!g' | xargs $(buildscript-dir)/mass-link hard $(outdir) $(top-build-dir)/Documentation/$(outdir)
        touch $@
 
-$(outdir)/lilypond-%.info: $(outdir)/%.texi $(outdir)/$(INFO_IMAGES_DIR).info-images-dir-dep $(outdir)/version.itexi
+$(outdir)/lilypond-%.info: $(outdir)/%.texi $(outdir)/$(INFO_IMAGES_DIR).info-images-dir-dep $(outdir)/version.itexi $(outdir)/weblinks.itexi
        $(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$@ $<
 
 $(outdir)/index.$(ISOLANG).html: TEXI2HTML_INIT = $(WEB_TEXI2HTML_INIT)
index 880126858679aa7c3b20cf96bb234184b8d1752b..e40ff6e79b0868c210c83b24089ba2347b1965ca 100644 (file)
@@ -66,154 +66,9 @@ def make_macro(name, string):
     print "@end macro"
     print ""
 
-def make_download(name, osA, osB, version, revision, text):
-    string = "@uref{http://download.linuxaudio.org/lilypond/binaries/"
-    string += osA + "lilypond-"
-    string += version + "-" + revision
-    string += "." + osB + ",\n"
-    string += text
-    string += ": LilyPond "
-    string += version + "-" + revision
-    string += "}"
-    make_macro(name, string)
-
-def make_download_source(name, vstring, version):
-    string = "@uref{http://download.linuxaudio.org/lilypond/sources/"
-    string += vstring + "/"
-    string += "lilypond-" + version + ".tar.gz"
-    string += ", "
-    string += "Source: lilypond-" + version + ".tar.gz"
-    string += "}"
-    make_macro(name, string)
-
-def make_all_downloads(macroName, version):
-    make_download("download"+macroName+"LinuxNormal", "linux-x86/",
-        "linux-x86.sh",    version, "1", "Linux x86")
-    make_download("download"+macroName+"LinuxBig", "linux-64/",
-        "linux-64.sh", version, "1", "Linux 64")
-    make_download("download"+macroName+"LinuxPPC", "linux-ppc/",
-        "linux-ppc.sh", version, "1", "Linux PPC")
-
-    make_download("download"+macroName+"FreeBSDNormal", "freebsd-x86/",
-        "freebsd-x86.sh", version, "1", "FreeBSD i386")
-    make_download("download"+macroName+"FreeBSDBig", "freebsd-64/",
-        "freebsd-64.sh", version, "1", "FreeBSD amd64")
-
-    make_download("download"+macroName+"DarwinNormal", "darwin-x86/",
-        "darwin-x86.tar.bz2", version, "1", "MacOS X x86")
-    make_download("download"+macroName+"DarwinPPC", "darwin-ppc/",
-        "darwin-ppc.tar.bz2", version, "1", "MacOS X PPC")
-
-    make_download("download"+macroName+"Windows", "mingw/",
-        "mingw.exe", version, "1", "Windows")
-
-def make_ver_link(macroname, version, url, linktext):
-    string = "@uref{"
-    string += url
-    string += ","
-    string += linktext
-    string += "}"
-    make_macro(macroname, string)
-
-# TODO: this kind of thing should really be in a central place for
-# lilypond python build scripts
-def translateNameToUrl(manual, version):
-    ver_split = version.split('.')
-    ver_minor = ver_split[0] + '.' + ver_split[1]
-    url = depth + "doc/v" + ver_minor + "/Documentation/"
-
-    if (ver_minor == '2.13'):
-        return url+manual
-    if (ver_minor == '2.12'):
-        if (manual=='learning'):
-            return url+'user/lilypond-learning'
-        elif (manual=='internals'):
-            return url+'user/lilypond-internals'
-        elif (manual=='notation'):
-            return url+'user/lilypond'
-        elif (manual=='usage'):
-            return url+'user/lilypond-program'
-        elif (manual=='snippets'):
-            return url+'../input/lsr/lilypond-snippets'
-        elif (manual=='changes'):
-            return url+'topdocs/NEWS.html'
-        elif (manual=='music-glossary'):
-            return url+'user/music-glossary'
-        elif (manual=='essay'):
-            return url+'user/lilypond-learning/Background.html'
-        elif (manual=='extending'):
-            return url+'user/lilypond/Interfaces-for-programmers.html'
-        else:
-            return ''
-
-
-def make_manual_links(name, version):
-    for m in manuals:
-        manual = m
-        if (m=='music-glossary'):
-            mshort = 'Glossary'
-        else:
-            mshort = m.capitalize()
-        url = translateNameToUrl(m, version)
-
-        if (url == ''):
-            # can't have a comma here due to texinfo
-            make_ver_link("manual"+name+mshort+'Pdf',
-                version, "http://lilypond.org",
-                mshort+" (did not exist in 2.12)")
-            make_ver_link("manual"+name+mshort+'Split',
-                version, "http://lilypond.org",
-                mshort+" (did not exist in 2.12)")
-            make_ver_link("manual"+name+mshort+'Big',
-                version, "http://lilypond.org",
-                mshort+" (did not exist in 2.12)")
-            make_ver_link("manual"+name+mshort+'SplitNoName',
-                version, "http://lilypond.org",
-                mshort+" (did not exist in 2.12)")
-            continue
-        make_ver_link("manual"+name+mshort+'Pdf',
-                  version,
-                  url + '.pdf',
-                  manual.capitalize() + '.pdf')
-        make_ver_link("manual"+name+mshort+'Split',
-                  version,
-                  url + '/index.html',
-                  manual.capitalize() + ' (split HTML)')
-        make_ver_link("manual"+name+mshort+'Big',
-                  version,
-                  url + '-big-page.html',
-                  manual.capitalize() + ' (big HTML)')
-       # this is stupid and I shouldn't have bothered trying
-       # to support the 2.12 docs and it will be deleted once
-       # 2.14 is out and the website won't be visible to users
-        # until 2.14 is out.  -gp
-        if (url.endswith('.html')):
-            newurl = url
-        else:
-            newurl = url + '/index.html'
-        make_ver_link("manual"+name+mshort+'SplitNoName',
-                  version,
-                  newurl,
-                  manual.capitalize())
-
-
 print "@c ************************ Version numbers ************"
 make_macro("version", VERSION)
 make_macro("versionStable", VERSION_STABLE)
 make_macro("versionDevel", VERSION_DEVEL)
 
-print "@c ************************ Download binaries ************"
-make_all_downloads("Stable", VERSION_STABLE)
-make_all_downloads("Devel", VERSION_DEVEL)
-
-print "@c ************************ Download source ************"
-# FIXME: icky hard-coding!  -gp
-make_download_source("downloadStableSource", "v2.12", VERSION_STABLE)
-make_download_source("downloadDevelSource", "v2.13", VERSION_DEVEL)
-
-print "@c ************************ Manual links ************"
-make_manual_links("Stable", VERSION_STABLE)
-make_manual_links("Devel", VERSION_DEVEL)
-
-
 
diff --git a/scripts/build/create-weblinks-itexi.py b/scripts/build/create-weblinks-itexi.py
new file mode 100644 (file)
index 0000000..f8e1903
--- /dev/null
@@ -0,0 +1,214 @@
+#!@PYTHON@
+# create-version-itexi.py
+
+""" when being called on lilypond.org, pass it the location of the
+top source dir on the command-line. """
+
+import sys
+import os
+import glob
+
+
+
+# FIXME: if the depth depends on the type of build, figure it
+#        out automatically.
+### just like depth in our GNUmakefiles
+# these links are relative from /~graham/web/
+depth = "../../"
+# these links are relative from the v2.13 docs
+#depth = "../../../../"
+
+
+
+VERSION_STABLE = ""
+VERSION_DEVEL = ""
+
+try:
+    topDir = sys.argv[1]
+except:
+    myDir = os.path.dirname(sys.argv[0])
+    # use two abspaths to work around some windows python bug
+    topDir = os.path.join(os.path.abspath(myDir)+os.sep+'..'+os.sep+'..'+os.sep)
+    topDir = os.path.abspath( topDir )
+
+
+# TODO: this might be useful for other scripts; can we make it available?
+manuals = map(lambda x: os.path.splitext(x)[0],
+              map(os.path.basename,
+                  glob.glob(os.path.join(topDir,'Documentation', '*.te??'))))
+#manuals = map(lambda x: 'glossary' if x=='music-glossary' else x, manuals)
+manuals.append('internals')
+
+
+version_file_path = os.path.join(topDir, "VERSION")
+
+version_contents = open(version_file_path).readlines()
+major = 0
+minor = 0
+patch = 0
+for line in version_contents:
+    if (line.startswith('MAJOR_VERSION')):
+        major = line[14:-1]
+    if (line.startswith('MINOR_VERSION')):
+        minor = line[14:-1]
+    if (line.startswith('PATCH_LEVEL')):
+        patch = line[12:-1]
+    if (line.startswith('VERSION_STABLE')):
+        VERSION_STABLE = line[15:-1]
+    if (line.startswith('VERSION_DEVEL')):
+        VERSION_DEVEL = line[14:-1]
+
+VERSION = str(major)+'.'+str(minor)+'.'+str(patch)
+
+def make_macro(name, string):
+    print "@macro", name
+    print string
+    print "@end macro"
+    print ""
+
+def make_download(name, osA, osB, version, revision, text):
+    string = "@uref{http://download.linuxaudio.org/lilypond/binaries/"
+    string += osA + "lilypond-"
+    string += version + "-" + revision
+    string += "." + osB + ",\n"
+    string += text
+    string += ": LilyPond "
+    string += version + "-" + revision
+    string += "}"
+    make_macro(name, string)
+
+def make_download_source(name, vstring, version):
+    string = "@uref{http://download.linuxaudio.org/lilypond/sources/"
+    string += vstring + "/"
+    string += "lilypond-" + version + ".tar.gz"
+    string += ", "
+    string += "Source: lilypond-" + version + ".tar.gz"
+    string += "}"
+    make_macro(name, string)
+
+def make_all_downloads(macroName, version):
+    make_download("download"+macroName+"LinuxNormal", "linux-x86/",
+        "linux-x86.sh",    version, "1", "Linux x86")
+    make_download("download"+macroName+"LinuxBig", "linux-64/",
+        "linux-64.sh", version, "1", "Linux 64")
+    make_download("download"+macroName+"LinuxPPC", "linux-ppc/",
+        "linux-ppc.sh", version, "1", "Linux PPC")
+
+    make_download("download"+macroName+"FreeBSDNormal", "freebsd-x86/",
+        "freebsd-x86.sh", version, "1", "FreeBSD i386")
+    make_download("download"+macroName+"FreeBSDBig", "freebsd-64/",
+        "freebsd-64.sh", version, "1", "FreeBSD amd64")
+
+    make_download("download"+macroName+"DarwinNormal", "darwin-x86/",
+        "darwin-x86.tar.bz2", version, "1", "MacOS X x86")
+    make_download("download"+macroName+"DarwinPPC", "darwin-ppc/",
+        "darwin-ppc.tar.bz2", version, "1", "MacOS X PPC")
+
+    make_download("download"+macroName+"Windows", "mingw/",
+        "mingw.exe", version, "1", "Windows")
+
+def make_ver_link(macroname, version, url, linktext):
+    string = "@uref{"
+    string += url
+    string += ","
+    string += linktext
+    string += "}"
+    make_macro(macroname, string)
+
+# TODO: this kind of thing should really be in a central place for
+# lilypond python build scripts
+def translateNameToUrl(manual, version):
+    ver_split = version.split('.')
+    ver_minor = ver_split[0] + '.' + ver_split[1]
+    url = depth + "doc/v" + ver_minor + "/Documentation/"
+
+    if (ver_minor == '2.13'):
+        return url+manual
+    if (ver_minor == '2.12'):
+        if (manual=='learning'):
+            return url+'user/lilypond-learning'
+        elif (manual=='internals'):
+            return url+'user/lilypond-internals'
+        elif (manual=='notation'):
+            return url+'user/lilypond'
+        elif (manual=='usage'):
+            return url+'user/lilypond-program'
+        elif (manual=='snippets'):
+            return url+'../input/lsr/lilypond-snippets'
+        elif (manual=='changes'):
+            return url+'topdocs/NEWS.html'
+        elif (manual=='music-glossary'):
+            return url+'user/music-glossary'
+        elif (manual=='essay'):
+            return url+'user/lilypond-learning/Background.html'
+        elif (manual=='extending'):
+            return url+'user/lilypond/Interfaces-for-programmers.html'
+        else:
+            return ''
+
+
+def make_manual_links(name, version):
+    for m in manuals:
+        manual = m
+        if (m=='music-glossary'):
+            mshort = 'Glossary'
+        else:
+            mshort = m.capitalize()
+        url = translateNameToUrl(m, version)
+
+        if (url == ''):
+            # can't have a comma here due to texinfo
+            make_ver_link("manual"+name+mshort+'Pdf',
+                version, "http://lilypond.org",
+                mshort+" (did not exist in 2.12)")
+            make_ver_link("manual"+name+mshort+'Split',
+                version, "http://lilypond.org",
+                mshort+" (did not exist in 2.12)")
+            make_ver_link("manual"+name+mshort+'Big',
+                version, "http://lilypond.org",
+                mshort+" (did not exist in 2.12)")
+            make_ver_link("manual"+name+mshort+'SplitNoName',
+                version, "http://lilypond.org",
+                mshort+" (did not exist in 2.12)")
+            continue
+        make_ver_link("manual"+name+mshort+'Pdf',
+                  version,
+                  url + '.pdf',
+                  manual.capitalize() + '.pdf')
+        make_ver_link("manual"+name+mshort+'Split',
+                  version,
+                  url + '/index.html',
+                  manual.capitalize() + ' (split HTML)')
+        make_ver_link("manual"+name+mshort+'Big',
+                  version,
+                  url + '-big-page.html',
+                  manual.capitalize() + ' (big HTML)')
+       # this is stupid and I shouldn't have bothered trying
+       # to support the 2.12 docs and it will be deleted once
+       # 2.14 is out and the website won't be visible to users
+        # until 2.14 is out.  -gp
+        if (url.endswith('.html')):
+            newurl = url
+        else:
+            newurl = url + '/index.html'
+        make_ver_link("manual"+name+mshort+'SplitNoName',
+                  version,
+                  newurl,
+                  manual.capitalize())
+
+
+print "@c ************************ Download binaries ************"
+make_all_downloads("Stable", VERSION_STABLE)
+make_all_downloads("Devel", VERSION_DEVEL)
+
+print "@c ************************ Download source ************"
+# FIXME: icky hard-coding!  -gp
+make_download_source("downloadStableSource", "v2.12", VERSION_STABLE)
+make_download_source("downloadDevelSource", "v2.13", VERSION_DEVEL)
+
+print "@c ************************ Manual links ************"
+make_manual_links("Stable", VERSION_STABLE)
+make_manual_links("Devel", VERSION_DEVEL)
+
+
+
index ef6f83df4ed295bddcbc3c0da12d40c2ca4a5d06..5f2388e2244e71d100aa3b21f844e8334308ae7e 100644 (file)
@@ -26,24 +26,24 @@ endif
 $(outdir)/%.texi: $(src-dir)/%.texi
        cp -p $< $@
 
-$(outdir)/%.info: $(outdir)/%.texi $(outdir)/$(INFO_IMAGES_DIR).info-images-dir-dep $(outdir)/version.itexi
+$(outdir)/%.info: $(outdir)/%.texi $(outdir)/$(INFO_IMAGES_DIR).info-images-dir-dep $(outdir)/version.itexi $(outdir)/weblinks.itexi
 ifeq ($(WEB_VERSION),yes)
        $(MAKEINFO) -I$(src-dir) -I$(outdir) -D web_version --output=$@ $<
 else
        $(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$@ $<
 endif
 
-$(outdir)/%-big-page.html: $(outdir)/%.texi $(XREF_MAPS_DIR)/%.xref-map $(outdir)/version.itexi
+$(outdir)/%-big-page.html: $(outdir)/%.texi $(XREF_MAPS_DIR)/%.xref-map $(outdir)/version.itexi $(outdir)/weblinks.itexi
 ifeq ($(WEB_VERSION),yes)
        $(TEXI2HTML) $(TEXI2HTML_FLAGS) -D bigpage -D web_version --output=$@ $<
 else
        $(TEXI2HTML) $(TEXI2HTML_FLAGS) -D bigpage --output=$@ $<
 endif
 
-$(outdir)/%.html: $(outdir)/%.texi $(XREF_MAPS_DIR)/%.xref-map $(outdir)/version.itexi
+$(outdir)/%.html: $(outdir)/%.texi $(XREF_MAPS_DIR)/%.xref-map $(outdir)/version.itexi $(outdir)/weblinks.itexi
        $(TEXI2HTML) $(TEXI2HTML_FLAGS) --output=$@ $<
 
-$(outdir)/%/index.html: $(outdir)/%.texi $(XREF_MAPS_DIR)/%.xref-map $(outdir)/version.itexi $(outdir)/%.html.omf
+$(outdir)/%/index.html: $(outdir)/%.texi $(XREF_MAPS_DIR)/%.xref-map $(outdir)/version.itexi $(outdir)/weblinks.itexi $(outdir)/%.html.omf
        mkdir -p $(dir $@)
 ifeq ($(WEB_VERSION),yes)
        $(TEXI2HTML) $(TEXI2HTML_SPLIT) $(TEXI2HTML_FLAGS) -D web_version --output=$(dir $@) $<
@@ -55,17 +55,17 @@ endif
 $(XREF_MAPS_DIR)/%.xref-map: $(outdir)/%.texi
        $(buildscript-dir)/extract_texi_filenames $(XREF_MAP_FLAGS) -o $(XREF_MAPS_DIR) $<
 
-$(outdir)/%.info: %.texi $(outdir)/$(INFO_IMAGES_DIR).info-images-dir-dep $(outdir)/version.itexi
+$(outdir)/%.info: %.texi $(outdir)/$(INFO_IMAGES_DIR).info-images-dir-dep $(outdir)/version.itexi $(outdir)/weblinks.itexi
        $(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$@ $<
 
-$(outdir)/%.pdf: $(outdir)/%.texi $(outdir)/version.itexi $(outdir)/%.pdf.omf
+$(outdir)/%.pdf: $(outdir)/%.texi $(outdir)/version.itexi $(outdir)/%.pdf.omf $(outdir)/weblinks.itexi
 ifeq ($(WEB_VERSION),yes)
        cd $(outdir); texi2pdf $(TEXI2PDF_FLAGS) -D web_version -I $(abs-src-dir) --batch $(TEXINFO_PAPERSIZE_OPTION) $(<F)
 else
        cd $(outdir); texi2pdf $(TEXI2PDF_FLAGS) -I $(abs-src-dir) --batch $(TEXINFO_PAPERSIZE_OPTION) $(<F)
 endif
 
-$(outdir)/%.txt: $(outdir)/%.texi $(outdir)/version.itexi
+$(outdir)/%.txt: $(outdir)/%.texi $(outdir)/version.itexi $(outdir)/weblinks.itexi
        $(MAKEINFO) -I$(src-dir) -I$(outdir) --no-split --no-headers --output $@ $<
 
 $(outdir)/%.html.omf: %.texi
@@ -77,6 +77,9 @@ $(outdir)/%.pdf.omf: %.texi
 $(outdir)/version.%: $(top-src-dir)/VERSION
        $(PYTHON) $(top-src-dir)/scripts/build/create-version-itexi.py > $@
 
+$(outdir)/weblinks.%: $(top-src-dir)/VERSION
+       $(PYTHON) $(top-src-dir)/scripts/build/create-weblinks-itexi.py > $@
+
 .SECONDARY: $(outdir)/version.itexi $(outdir)/version.texi \
   $(outdir)/$(INFO_IMAGES_DIR).info-images-dir-dep \
   $(outdir)/*.texi
index 057512308aaeeb3556e341b48e8ca04dadc5904b..b7f70342c4b809d3178e1cdf84492be355b23b49 100644 (file)
@@ -31,6 +31,7 @@ TEXI2HTML = TOP_SRC_DIR=$(top-src-dir) PERL_UNICODE=SD $(TEXI2HTML_PROGRAM)
 
 EXTRACT_TEXI_FILENAMES=python $(script-dir)/extract_texi_filenames.py
 CREATE_VERSION=python $(script-dir)/create-version-itexi.py
+CREATE_WEBLINKS=python $(script-dir)/create-weblinks-itexi.py
 
 
 # don't include web
@@ -43,6 +44,7 @@ website-test:
 website-version:
        mkdir -p $(OUT)
        $(CREATE_VERSION) $(top-src-dir) > $(OUT)/version.itexi
+       $(CREATE_WEBLINKS) $(top-src-dir) > $(OUT)/weblinks.itexi
 
 website-xrefs: website-version
        $(EXTRACT_TEXI_FILENAMES) -I $(top-src-dir)/Documentation/ \