From a4992991028b90b7080ad53a942bdb6c268e9a3c Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sun, 18 Mar 2007 23:32:27 -0300 Subject: [PATCH] Fix backend-svg.ly for ubuntu 6.06 -Invoke external program with ly:start-environment -Make mf/out/fonts.conf, and use it during invocation --- GNUmakefile.in | 3 +++ input/regression/backend-svg.ly | 10 +++++++--- mf/GNUmakefile | 8 +++++++- scm/backend-library.scm | 26 +++++++++++++++++++++++--- 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/GNUmakefile.in b/GNUmakefile.in index 13e0f75b71..40e50d542b 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -178,10 +178,13 @@ $(tree-share-prefix)/lilypond-force link-tree: GNUmakefile $(outdir)/VERSION $(tree-share-prefix)/mf-link-tree link-mf-tree: $(tree-share-prefix)/lilypond-force -rm -f $(tree-share-prefix)/fonts/otf/* && \ rm -f $(tree-share-prefix)/fonts/svg/* && \ + rm -f $(tree-share-prefix)/fonts/fonts.conf && \ rm -f $(tree-share-prefix)/fonts/tfm/* && \ rm -f $(tree-share-prefix)/fonts/type1/* && \ cd $(tree-share-prefix)/fonts/otf && \ ln -s ../../../../../../mf/$(outconfbase)/*.otf . + -cd $(tree-share-prefix)/fonts/ && \ + ln -s ../../../../../mf/$(outconfbase)/fonts.conf . -cd $(tree-share-prefix)/fonts/svg && \ ln -s ../../../../../../mf/$(outconfbase)/*.svg . -cd $(tree-share-prefix)/fonts/tfm && \ diff --git a/input/regression/backend-svg.ly b/input/regression/backend-svg.ly index f9d9ffe3a5..83f40500c5 100644 --- a/input/regression/backend-svg.ly +++ b/input/regression/backend-svg.ly @@ -15,7 +15,11 @@ #(display "Invoking inkscape...\n") %% LD_LIBRARY_PATH is necesssary, otherwise, it doesn't build in GUB. -#(system (format #f "LD_LIBRARY_PATH= inkscape -T -E ~a-1.eps ~a-1.svg" outname outname)) +#(ly:system (format #f "inkscape -T -E ~a-inkscape.eps ~a-1.svg" outname outname) + (cons + (format #f "FONTCONFIG_FILE=~a/fonts/fonts.conf" (ly:effective-prefix)) + (ly:start-environment))) + #(set! output-count 0) #(set-default-paper-size "a5") @@ -28,9 +32,9 @@ \score { \lyrics { \markup { - \epsfile #X #30.0 #(format #f "~a-1.eps" outname) + \epsfile #X #30.0 #(format #f "~a-inkscape.eps" outname) } - x x x + bla bla bla } } } diff --git a/mf/GNUmakefile b/mf/GNUmakefile index 1492d1790b..170bbb13eb 100644 --- a/mf/GNUmakefile +++ b/mf/GNUmakefile @@ -121,7 +121,7 @@ export MFINPUTS:=.:$(MFINPUTS) -default: $(ALL_GEN_FILES) $(outdir)/emmentaler-20.otf tree-regen +default: $(ALL_GEN_FILES) $(outdir)/emmentaler-20.otf tree-regen $(outdir)/fonts.conf .PHONY: tree-regen @@ -138,11 +138,17 @@ local-clean: rm -f mfplain.mem mfplain.log rm -f *.tfm *.log + +## fixme: why is this necessary? $(outdir)/%.enc.in: %.enc cp $< $@ +$(outdir)/fonts.conf: + echo ''$(shell cd $(outdir); pwd)'' > $@ + $(NCSB_OTFS): $(NCSB_SOURCE_FILES) $(buildscript-dir)/pfx2ttf.fontforge $(foreach i, $(basename $(NCSB_SOURCE_FILES)), \ $(FONTFORGE) -script $(buildscript-dir)/pfx2ttf.fontforge \ $(i).pfb $(i).afm $(outdir)/ && ) true + diff --git a/scm/backend-library.scm b/scm/backend-library.scm index eaefaf7867..c09e7572d5 100644 --- a/scm/backend-library.scm +++ b/scm/backend-library.scm @@ -8,7 +8,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; backend helpers. -(define-public (ly:system command) +(define-public (ly:system command . rest) (let* ((status 0) (dev-null "/dev/null") (silenced (if (or (ly:get-option 'verbose) @@ -17,8 +17,12 @@ (format #f "~a > ~a 2>&1 " command dev-null)))) (if (ly:get-option 'verbose) (ly:message (_ "Invoking `~a'...") command)) - - (set! status (system silenced)) + + (set! status + (if (pair? rest) + (system-with-env silenced (car rest)) + (system silenced))) + (if (> status 0) (begin (ly:message (_ "`~a' failed (~a)") command status) @@ -26,6 +30,22 @@ ;; hmmm. what's the best failure option? (throw 'ly-file-failed))))) +(define-public (system-with-env cmd env) + + "Execute CMD in fork, with ENV (a list of strings) as the environment" + (let* + ;; laziness: should use execle? + + ((pid (primitive-fork))) + (if (= 0 pid) + ;; child + (begin + (environ env) + (system cmd)) + + ;; parent + (cdr (waitpid pid))))) + (define-public (sanitize-command-option str) "Kill dubious shell quoting" -- 2.39.2