From 9879bd7a67e4f72c6fa7f30eb355f2dc56f9a4bc Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 12 May 2005 11:32:49 +0000 Subject: [PATCH] * flower/string.cc (substitute): Take two strings or two characters. Update callers. * flower/file-name.cc (File_name): Slashify. * scm/lily.scm: Use gui-main iso lilypond-main on MINGW. * scripts/GNUmakefile (SEXECUTABLES): Add lilypond-invoke-editor. * stepmake/aclocal.m4 (STEPMAKE_WINDOWS): New function. * configure.in (gui_b): Use it. * lily/lilypond.rc.in: New file. * lily/GNUmakefile[PLATFROM_WINDOWS]: Compile it into executable. --- ChangeLog | 22 +++++++ Documentation/user/point-and-click.itely | 9 +++ config.hh.in | 3 + config.make.in | 2 + configure.in | 2 + flower/file-name.cc | 9 ++- flower/include/string.hh | 3 +- flower/string.cc | 14 ++++- lily/GNUmakefile | 13 ++++- lily/font-metric.cc | 2 +- lily/main.cc | 6 +- make/stepmake.make | 2 + make/substitute.make | 7 +++ scm/lily.scm | 27 +++++++-- scripts/GNUmakefile | 2 +- stepmake/aclocal.m4 | 74 ++++++++++++++---------- stepmake/stepmake/c++-rules.make | 3 + stepmake/stepmake/c-rules.make | 2 + 18 files changed, 156 insertions(+), 46 deletions(-) diff --git a/ChangeLog b/ChangeLog index d2a7ca4a69..8dcbd8eaad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2005-05-12 Jan Nieuwenhuizen + + * flower/string.cc (substitute): Take two strings or two + characters. Update callers. + +2005-05-11 Jan Nieuwenhuizen + + * flower/file-name.cc (File_name): Slashify. + + * scm/lily.scm: Use gui-main iso lilypond-main on MINGW. + + * scripts/GNUmakefile (SEXECUTABLES): Add lilypond-invoke-editor. + + * stepmake/aclocal.m4 (STEPMAKE_WINDOWS): New function. + + * configure.in (gui_b): Use it. + + * lily/lilypond.rc.in: New file. + + * lily/GNUmakefile[PLATFROM_WINDOWS]: Compile it into executable. + 2005-05-12 Graham Percival * Documentation/user/advanced-notation.itely: edit of Text @@ -32,6 +53,7 @@ * input/test/volta-chord-names.ly: Bring the explanation up to date. +>>>>>>> 1.3600 2005-05-11 Heikki Junes * Documentation/topdocs/{AUTHORS.texi,INSTALL.texi,README.texi}: diff --git a/Documentation/user/point-and-click.itely b/Documentation/user/point-and-click.itely index 5db84e7c7c..663797d7d3 100644 --- a/Documentation/user/point-and-click.itely +++ b/Documentation/user/point-and-click.itely @@ -35,6 +35,15 @@ lines to the @file{prefs.js}@footnote{On a typical unix system, this file is found in your home-directory under @file{.mozilla/firefox/default.trn/prefs.js}.} +@ignore +mozilla wants us do store this in user.js: +http://www.mozilla.org/support/firefox/edit#user + +location on different systems: +http://www.mozilla.org/support/firefox/edit#profile + +@end ignore + @example user_pref("network.protocol-handler.app.textedit", "lilypond-pdfpc-helper"); user_pref("network.protocol-handler.warn-external.textedit", false); diff --git a/config.hh.in b/config.hh.in index a0c9473de6..fbf7d512bb 100644 --- a/config.hh.in +++ b/config.hh.in @@ -74,6 +74,9 @@ #define DIRSEP '@DIRSEP@' #define PATHSEP '@PATHSEP@' +/* define if you have some kind of windows platform */ +#define PLATFORM_WINDOWS 0 + /* define if you have assert.h */ #define HAVE_ASSERT_H 0 diff --git a/config.make.in b/config.make.in index ec381e6fc4..7a56d7bdc3 100644 --- a/config.make.in +++ b/config.make.in @@ -100,6 +100,7 @@ MSGFMT = @MSGFMT@ PAPERSIZE=a4 PATHSEP = @PATHSEP@ PERL = @PERL@ +PLATFORM_WINDOWS = @PLATFORM_WINDOWS@ PYTHON = @PYTHON@ RANLIB = @RANLIB@ ROOTSEP = @ROOTSEP@ @@ -107,5 +108,6 @@ SHELL = @SHELL@ SPLITTING_MAKEINFO = @SPLITTING_MAKEINFO@ TAR = @TAR@ TTFTOOL_ENDIAN = @TTFTOOL_ENDIAN@ +WINDRES = @WINDRES@ YACC = @YACC@ ZIP = @ZIP@ diff --git a/configure.in b/configure.in index a3ca5b74af..2f68128636 100644 --- a/configure.in +++ b/configure.in @@ -85,6 +85,8 @@ AC_C_BIGENDIAN(TTFTOOL_ENDIAN="-DBIGENDIAN", TTFTOOL_ENDIAN="-DSMALLENDIAN") AC_SUBST(TTFTOOL_ENDIAN) +STEPMAKE_WINDOWS + ## Optional tools for building documentation, website, extra fonts. # guile executable for some scripts diff --git a/flower/file-name.cc b/flower/file-name.cc index 12a63ba694..dd83ac68fc 100644 --- a/flower/file-name.cc +++ b/flower/file-name.cc @@ -72,11 +72,14 @@ File_name::to_str0 () const File_name::File_name (String file_name) { #ifdef __CYGWIN__ - /* All system functions would work, even if we don't convert to - posix file_name, but we'd think that \foe\bar\baz.ly is in the cwd. - On by default. */ + /* All system functions would work, even if we do not convert to + posix file_name, but we would think that \foe\bar\baz.ly is in + the cwd. */ file_name = dos_to_posix (file_name); #endif +#ifdef __MINGW32__ + file_name.substitute ('\\', '/'); +#endif int i = file_name.index (ROOTSEP); if (i >= 0) diff --git a/flower/include/string.hh b/flower/include/string.hh index d4787b3a7a..dbe289b3ea 100644 --- a/flower/include/string.hh +++ b/flower/include/string.hh @@ -144,7 +144,8 @@ public: /// convert to a double double to_double () const; - void substitute_char (char text, String sub); + void substitute (String find, String replace); + void substitute (char find, char replace); }; /* diff --git a/flower/string.cc b/flower/string.cc index fb270dd30d..0280508d67 100644 --- a/flower/string.cc +++ b/flower/string.cc @@ -383,8 +383,16 @@ String::print_on (ostream &os) const #endif void -String::substitute_char (char chr, String sub) +String::substitute (String find, String replace) { - for (int i = index (chr); i > -1; i = index (chr)) - *this = left_string (i) + sub + right_string (length () - i - 1); + int n = replace.length (); + for (int i = index (find); i > - 1; i = index (find)) + *this = left_string (i) + find + right_string (length () - i - n); +} + +void +String::substitute (char find, char replace) +{ + for (int i = index (find); i > - 1; i = index (find)) + (*this)[i] = replace; } diff --git a/lily/GNUmakefile b/lily/GNUmakefile index 257a416756..8d3fb024a0 100644 --- a/lily/GNUmakefile +++ b/lily/GNUmakefile @@ -9,7 +9,7 @@ MODULE_INCLUDES= $(depth)/flower/include $(depth)/ttftool/include MODULE_CXXFLAGS= HELP2MAN_EXECS = lilypond -STEPMAKE_TEMPLATES= c++ executable po help2man +STEPMAKE_TEMPLATES=c c++ executable po help2man OUT_DIST_FILES=$(addprefix $(outdir)/,parser.cc parser.hh) @@ -25,6 +25,16 @@ endif # USER_LDFLAGS += -static -lltdl -ldl # +ifeq ($(PLATFORM_WINDOWS),yes) +WINDRES_FLAGS += -DLilyPond=1 +O_FILES += $(outdir)/lilypond.rc.o +$(outdir)/lilypond: $(outdir)/lilypond.rc.o + +$(outdir)/lilypond.rc.o: $(outdir)/lilypond.ico +$(outdir)/lilypond.ico: $(abs-srcdir)/Documentation/pictures/lelie-logo.xpm + convert $< $@ +endif + ETAGS_FLAGS += --regex='{c++}/^LY_DEFINE *(\([^,]+\)/\1/' ETAGS_FLAGS += --regex='{c++}/^LY_DEFINE *([^"]*"\([^"]+\)"/\1/' @@ -48,3 +58,4 @@ local-po: $(outdir)/parser.cc ifneq ($(srcdir), .) .PRECIOUS: $(outdir)/lexer.cc $(outdir)/parser.cc endif + diff --git a/lily/font-metric.cc b/lily/font-metric.cc index a08589fe81..a3acc19d88 100644 --- a/lily/font-metric.cc +++ b/lily/font-metric.cc @@ -31,7 +31,7 @@ Font_metric::design_size () const Stencil Font_metric::find_by_name (String s) const { - s.substitute_char ('-', "M"); + s.substitute ('-', 'M'); int idx = name_to_index (s); Box b; diff --git a/lily/main.cc b/lily/main.cc index 05cc5a9e82..093a8a69d6 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -596,12 +596,12 @@ main (int argc, char **argv) setup_localisation (); setup_paths (); parse_argv (argc, argv); + /* FIXME: this still needs a terminal even when using gui-main after + booting guile. Maybe use a --quiet command line switch? */ identify (stderr); scm_boot_guile (argc, argv, main_with_guile, 0); - /* - If we get here, GUILE exited. This is an error. - */ + /* Only reachable if GUILE exits. That is an error. */ return 1; } diff --git a/make/stepmake.make b/make/stepmake.make index 71dde6f7f8..9b1767fa06 100644 --- a/make/stepmake.make +++ b/make/stepmake.make @@ -35,6 +35,8 @@ endif endif include $(depth)/make/toplevel-version.make +MICRO_VERSION=$(PATCH_LEVEL) +BUILD_VERSION=1 # Use alternate configurations alongside eachother: # diff --git a/make/substitute.make b/make/substitute.make index e45f57c72e..289856b0f2 100644 --- a/make/substitute.make +++ b/make/substitute.make @@ -6,10 +6,15 @@ include $(stepdir)/substitute-rules.make ATVARIABLES = \ BASH\ + BUILD_VERSION\ DATE\ FONTFORGE\ GUILE\ + MICRO_VERSION\ + MAJOR_VERSION\ + MINOR_VERSION\ PACKAGE\ + PATCH_LEVEL\ PATHSEP\ PERL\ PYTHON\ @@ -23,9 +28,11 @@ ATVARIABLES = \ local_lilypond_datadir\ local_lilypond_libdir\ localedir\ + outdir\ package\ prefix\ program_prefix\ program_suffix\ sharedstatedir\ + srcdir\ step-bindir\ diff --git a/scm/lily.scm b/scm/lily.scm index 31d482a17e..7a7e47cc56 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -15,8 +15,9 @@ (ice-9 safe) (ice-9 optargs) (oop goops) - (srfi srfi-1) ;; lists - (srfi srfi-13)) ;; strings + (srfi srfi-1) + (srfi srfi-13) + (srfi srfi-14)) ;; my display @@ -343,6 +344,7 @@ The syntax is the same as `define*-public'." (log-file (open-file log-name "w"))) (display "# -*-compilation-*-" log-file) (newline log-file) + ;; Ugh, this opens a terminal (ly:message (_ "Redirecting output to ~a...") log-name) (ly:port-move (fileno (current-error-port)) log-file) (if (null? (lilypond-all files)) @@ -361,5 +363,22 @@ The syntax is the same as `define*-public'." (cmd (get-editor-command ly 0 0))) (system cmd))) -;; FIXME -;; (define lilypond-main gui-main) + +;; Mingw +;; #(Windows XP HOSTNAME build 2600 5.01 Service Pack 1 i686) + +;; Cygwin +;; #(CYGWIN_NT-5.1 Hostname 1.5.12(0.116/4/2) 2004-11-10 08:34 i686) + +;; Debian +;; #(Linux hostname 2.4.27-1-686 #1 Fri Sep 3 06:28:00 UTC 2004 i686) + +(case (string->symbol + (string-downcase + (car (string-tokenize (vector-ref (uname) 0) char-set:letter)))) + ((linux) #t) + ;; On mingw, use gui-main + ((windows) (define lilypond-main gui-main))) + +;;(if (ly:get-option 'quiet) +;; (define lilypond-main gui-main)) diff --git a/scripts/GNUmakefile b/scripts/GNUmakefile index 90ff74929c..30ffc7f870 100644 --- a/scripts/GNUmakefile +++ b/scripts/GNUmakefile @@ -1,6 +1,6 @@ depth = .. -SEXECUTABLES=convert-ly lilypond-book abc2ly etf2ly mup2ly midi2ly lilypond-ps2png lilypond-pdfpc-helper +SEXECUTABLES=convert-ly lilypond-book abc2ly etf2ly mup2ly midi2ly lilypond-ps2png lilypond-pdfpc-helper lilypond-invoke-editor STEPMAKE_TEMPLATES=script help2man po LOCALSTEPMAKE_TEMPLATES = lilypond diff --git a/stepmake/aclocal.m4 b/stepmake/aclocal.m4 index fbd6dbc19e..3d25be295d 100644 --- a/stepmake/aclocal.m4 +++ b/stepmake/aclocal.m4 @@ -25,8 +25,7 @@ AC_DEFUN(STEPMAKE_GET_VERSION, [ ## ## -V: Workaround for python - changequote(<<, >>)dnl - ##set -x + changequote(<<, >>)#dnl ## Assume and hunt for dotted version multiplet. ## use eval trickery, because we cannot use multi-level $() instead of `` ## for compatibility reasons. @@ -42,8 +41,7 @@ AC_DEFUN(STEPMAKE_GET_VERSION, [ | sed -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\" fi echo "$_ver" - ##set +x - changequote([, ])dnl + changequote([, ])#dnl ]) # Calculate simplistic numeric version from version string ($1) @@ -519,11 +517,11 @@ AC_DEFUN(STEPMAKE_GUILE_DEVEL, [ AC_SUBST(GUILE_CONFIG) guile_version="$ver" - changequote(<<, >>)dnl + changequote(<<, >>)#dnl GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'` GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'` GUILE_PATCH_LEVEL=`expr $guile_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'` - changequote([, ])dnl + changequote([, ])#dnl STEPMAKE_GUILE_FLAGS save_CPPFLAGS="$CPPFLAGS" save_LIBS="$LIBS" @@ -570,10 +568,10 @@ AC_DEFUN(STEPMAKE_INIT, [ fi export MAJOR_VERSION MINOR_VERSION PATCH_LEVEL # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:] - changequote(<<, >>)dnl + changequote(<<, >>)#dnl PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'` package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'` - changequote([, ])dnl + changequote([, ])#dnl # No versioning on directory names of sub-packages # urg, urg @@ -708,26 +706,16 @@ AC_DEFUN(STEPMAKE_INIT, [ # STEPMAKE_WARN($warn) STEPMAKE_ADD_ENTRY(REQUIRED, $warn) fi - fi - - if test "$OSTYPE" = "cygwin" -o "$OSTYPE" = "cygwin32" -o "$OSTYPE" = "Windows_NT"; then - LN=cp # hard link does not work under cygnus-nt - LN_S='cp -r' # symbolic link does not work for native nt - ZIP="zip -r -9" # - program_suffix=.exe - ROOTSEP=':' - DIRSEP='/' - PATHSEP=':' - INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c" - else - ROOTSEP=':' - DIRSEP='/' - PATHSEP=':' - LN=ln - LN_S='ln -s' - ZIP="zip -r -9" - INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c" fi + + ROOTSEP=':' + DIRSEP='/' + PATHSEP=':' + LN=ln + LN_S='ln -s' + ZIP="zip -r -9" + INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c" + AC_SUBST(program_prefix) AC_SUBST(program_suffix) AC_SUBST(ZIP) @@ -971,11 +959,11 @@ AC_DEFUN(STEPMAKE_PYTHON, [ AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [ unset PYTHON_HEADER PYTHON_INCLUDE if test -n "$PYTHON"; then - changequote(<<, >>)dnl + changequote(<<, >>)#dnl # alternatively, for python >= 2.0 # 'import sys, distutils.sysconfig; sys.stdout.write (distutils.sysconfig.get_python_inc ())' PYTHON_INCLUDE=`$PYTHON -c 'import sys; sys.stdout.write ("%s/include/python%s" % (sys.prefix, sys.version[:3]))'` - changequote([, ])dnl + changequote([, ])#dnl fi ##AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes]) @@ -1178,3 +1166,31 @@ AC_DEFUN(STEPMAKE_FONTCONFIG, [ STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"]) fi ]) + +AC_DEFUN(STEPMAKE_WINDOWS, [ + AC_CYGWIN + AC_MINGW32 + + if test "$CYGWIN" == "yes"; then + LN_S='cp -r' # Cygwin symbolic links do not work for native apps. + program_suffix=.exe + INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c" + elif test "$MINGW" == "yes"; then + LN='cp -r' + LN_S='cp -r' + program_suffix=.exe + INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c" + PATHSEP=';' + fi + + AC_MSG_CHECKING([for some flavor of Windows]) + if test "$CYGWIN$MINGW32" == "nono"; then + PLATFORM_WINDOWS=no + else + PLATFORM_WINDOWS=yes + fi + AC_MSG_RESULT([$PLATFORM_WINDOWS]) + AC_SUBST(PLATFORM_WINDOWS) + STEPMAKE_PROGS(WINDRES, $target-windres windres, x) + AC_SUBST(WINDRES) +]) diff --git a/stepmake/stepmake/c++-rules.make b/stepmake/stepmake/c++-rules.make index 2f561180c9..061f6305d8 100644 --- a/stepmake/stepmake/c++-rules.make +++ b/stepmake/stepmake/c++-rules.make @@ -26,3 +26,6 @@ $(outdir)/%.hh: %.yy $(outdir)/%.cc: %.ll $(FLEX) -Cfe -p -p -o$@ $< + +$(outdir)/%-rc.o: $(outdir)/%.rc + $(WINDRES) $(WINDRES_FLAGS) -o$@ $< diff --git a/stepmake/stepmake/c-rules.make b/stepmake/stepmake/c-rules.make index 289e6c2485..d6d6a9b36d 100644 --- a/stepmake/stepmake/c-rules.make +++ b/stepmake/stepmake/c-rules.make @@ -26,3 +26,5 @@ $(outdir)/%.c: %.l # could be faster: # $(FLEX) -8 -Cf -o$@ $< +$(outdir)/%.rc.o: $(outdir)/%.rc + $(WINDRES) $(WINDRES_FLAGS) -o$@ $< -- 2.39.5