Hi Alexander, For many years I've continued to use Chuck Wilson's old run-1.1.4 because it included a version that was linked without Cygwin (run-native.exe, built with VC). Although it doesn't have all the features of the Cygwin version (eg. it can't translate Cygwin mount points), it does allow one to start applications without needing cygwin1.dll in the path. I know that's often not much of an issue (at least if run.exe is in C:\cygwin\bin), but it is sometimes handy to have a stand-alone version.
The latest version of run, run-1.1.10-1 included in the Cygwin setup, has some nice improvements (and is easier to find than the old run-1.1.4!). I have made some small fixes to allow the new version to also build run-native.exe, with gcc -mno-cygwin (it also builds the Cygwin run.exe as before). Would you consider adopting this improvement, in the attached patch (see the top for build instructions)? You might have a better idea for where the non-Cygwin version should go - I just put it in /usr/bin/run-native.exe. Thanks, Tim. =========================== cut here ============================ Tim Adye [EMAIL PROTECTED] http://hepunx.rl.ac.uk/~adye BaBar/Atlas Groups, Particle Physics Dept, Rutherford Appleton Lab
Build Instructions ================== cd /usr/src wget http://mirrors.kernel.org/sourceware/cygwin/release/run/run-1.1.10-1-src.tar.bz2 tar jxf run-1.1.10-1-src.tar.bz2 ./run-1.1.10-1.sh prep patch -Z -p0 < run-1.1.10-1-native.patch ./run-1.1.10-1.sh conf build install strip pkg This creates run-1.1.10-1.tar.bz2 with an extra file /usr/bin/run-native.exe . That file should be renamed to run.exe and moved elsewhere. It is build without the Cygwin DLL, so can be run without the Cygwin bin directory in the PATH. diff -urN -x .build -x .inst -x .sinst -x .buildlogs run-1.1.10-orig/compile run-1.1.10/compile --- run-1.1.10-orig/compile 1970-01-01 00:00:00.000000000 +0000 +++ run-1.1.10/compile 2006-11-12 07:52:54.000000000 +0000 @@ -0,0 +1,142 @@ +#! /bin/sh +# Wrapper for compilers which do not understand `-c -o'. + +scriptversion=2005-05-14.22 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. +# Written by Tom Tromey <[EMAIL PROTECTED]>. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to <bug-automake@gnu.org> or send patches to +# <automake-patches@gnu.org>. + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand `-c -o'. +Remove `-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file `INSTALL'. + +Report bugs to <bug-automake@gnu.org>. +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; +esac + +ofile= +cfile= +eat= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we strip `-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no `-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # `.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` + +# Create the lock directory. +# Note: use `[/.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff -urN -x .build -x .inst -x .sinst -x .buildlogs run-1.1.10-orig/src/Makefile.am run-1.1.10/src/Makefile.am --- run-1.1.10-orig/src/Makefile.am 2005-11-09 12:41:13.000000000 +0000 +++ run-1.1.10/src/Makefile.am 2007-04-08 22:06:25.000000000 +0100 @@ -1,6 +1,6 @@ ## Makefile.am -- Process this file with automake to produce Makefile.in -bin_PROGRAMS = run +bin_PROGRAMS = run run-native man1_MANS = run.1 ## Build rule for resource files @@ -14,3 +14,7 @@ run_SOURCES = run.c run.h resource.rc $(ICONS) run_LDFLAGS = -mwindows -e_mainCRTStartup +run_native_SOURCES = run.c run.h resource.rc $(ICONS) +run_native_CFLAGS = -mno-cygwin +run_native_LDFLAGS = -mno-cygwin -mwindows + diff -urN -x .build -x .inst -x .sinst -x .buildlogs run-1.1.10-orig/src/Makefile.in run-1.1.10/src/Makefile.in --- run-1.1.10-orig/src/Makefile.in 2006-05-22 13:37:15.000000000 +0100 +++ run-1.1.10/src/Makefile.in 2007-04-08 22:10:56.000000000 +0100 @@ -35,7 +35,7 @@ PRE_UNINSTALL = : POST_UNINSTALL = : LIBOBJDIR = -bin_PROGRAMS = run$(EXEEXT) +bin_PROGRAMS = run$(EXEEXT) run-native$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/resource.rc.in $(srcdir)/run.1.in @@ -52,6 +52,10 @@ am_run_OBJECTS = run.$(OBJEXT) resource.$(OBJEXT) $(am__objects_1) run_OBJECTS = $(am_run_OBJECTS) run_LDADD = $(LDADD) +am_run_native_OBJECTS = run_native-run.$(OBJEXT) resource.$(OBJEXT) \ + $(am__objects_1) +run_native_OBJECTS = $(am_run_native_OBJECTS) +run_native_LDADD = $(LDADD) DEFAULT_INCLUDES = -I. -I$(srcdir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -59,8 +63,8 @@ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(run_SOURCES) -DIST_SOURCES = $(run_SOURCES) +SOURCES = $(run_SOURCES) $(run_native_SOURCES) +DIST_SOURCES = $(run_SOURCES) $(run_native_SOURCES) man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man1_MANS) @@ -112,7 +116,6 @@ VERSION_PATCH = @VERSION_PATCH@ WINDRES = @WINDRES@ ac_ct_CC = @ac_ct_CC@ -ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ @@ -123,19 +126,26 @@ bindir = @bindir@ build_alias = @build_alias@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ @@ -144,6 +154,9 @@ ICONS = run.ico X.ico X-boxed.ico rxvt.ico xemacs.ico file.ico lisp.ico vim.ico run_SOURCES = run.c run.h resource.rc $(ICONS) run_LDFLAGS = -mwindows -e_mainCRTStartup +run_native_SOURCES = run.c run.h resource.rc $(ICONS) +run_native_CFLAGS = -mno-cygwin +run_native_LDFLAGS = -mno-cygwin -mwindows all: all-am .SUFFIXES: @@ -207,6 +220,9 @@ run$(EXEEXT): $(run_OBJECTS) $(run_DEPENDENCIES) @rm -f run$(EXEEXT) $(LINK) $(run_LDFLAGS) $(run_OBJECTS) $(run_LDADD) $(LIBS) +run-native$(EXEEXT): $(run_native_OBJECTS) $(run_native_DEPENDENCIES) + @rm -f run-native$(EXEEXT) + $(LINK) $(run_native_LDFLAGS) $(run_native_OBJECTS) $(run_native_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -215,6 +231,7 @@ -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@ [EMAIL PROTECTED]@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @@ -229,6 +246,20 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +run_native-run.o: run.c [EMAIL PROTECTED]@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(run_native_CFLAGS) $(CFLAGS) -MT run_native-run.o -MD -MP -MF "$(DEPDIR)/run_native-run.Tpo" -c -o run_native-run.o `test -f 'run.c' || echo '$(srcdir)/'`run.c; \ [EMAIL PROTECTED]@ then mv -f "$(DEPDIR)/run_native-run.Tpo" "$(DEPDIR)/run_native-run.Po"; else rm -f "$(DEPDIR)/run_native-run.Tpo"; exit 1; fi [EMAIL PROTECTED]@@am__fastdepCC_FALSE@ source='run.c' object='run_native-run.o' libtool=no @AMDEPBACKSLASH@ [EMAIL PROTECTED]@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ [EMAIL PROTECTED]@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(run_native_CFLAGS) $(CFLAGS) -c -o run_native-run.o `test -f 'run.c' || echo '$(srcdir)/'`run.c + +run_native-run.obj: run.c [EMAIL PROTECTED]@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(run_native_CFLAGS) $(CFLAGS) -MT run_native-run.obj -MD -MP -MF "$(DEPDIR)/run_native-run.Tpo" -c -o run_native-run.obj `if test -f 'run.c'; then $(CYGPATH_W) 'run.c'; else $(CYGPATH_W) '$(srcdir)/run.c'; fi`; \ [EMAIL PROTECTED]@ then mv -f "$(DEPDIR)/run_native-run.Tpo" "$(DEPDIR)/run_native-run.Po"; else rm -f "$(DEPDIR)/run_native-run.Tpo"; exit 1; fi [EMAIL PROTECTED]@@am__fastdepCC_FALSE@ source='run.c' object='run_native-run.obj' libtool=no @AMDEPBACKSLASH@ [EMAIL PROTECTED]@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ [EMAIL PROTECTED]@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(run_native_CFLAGS) $(CFLAGS) -c -o run_native-run.obj `if test -f 'run.c'; then $(CYGPATH_W) 'run.c'; else $(CYGPATH_W) '$(srcdir)/run.c'; fi` uninstall-info-am: install-man1: $(man1_MANS) $(man_MANS) @$(NORMAL_INSTALL) diff -urN -x .build -x .inst -x .sinst -x .buildlogs run-1.1.10-orig/src/run.c run-1.1.10/src/run.c --- run-1.1.10-orig/src/run.c 2006-05-22 13:32:43.000000000 +0100 +++ run-1.1.10/src/run.c 2007-04-08 22:15:42.000000000 +0100 @@ -29,7 +29,9 @@ */ +#ifndef WIN32 #define WIN32 +#endif #include <windows.h> #include <winuser.h> @@ -55,6 +57,7 @@ char buffer[1024]; +char *saved_path = NULL; int WINAPI WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow) @@ -599,7 +602,7 @@ */ else { - orig_pathlist = getenv("PATH"); + orig_pathlist = saved_path ? saved_path : getenv("PATH"); if ((pathlist = malloc (strlen(orig_pathlist) + strlen(".") + strlen(execpath)+ 3)) == NULL) @@ -634,6 +637,11 @@ "extensions: \n%s",execname,buf); } } + + if (saved_path) { + free (saved_path); + saved_path= NULL; + } /* * At this point, we know that exec_tmp2 contains a filename * and we know that exec_tmp2 exists. @@ -860,15 +868,20 @@ /* NOTREACHED */ } -#ifdef __CYGWIN__ void addPathCygwin(const char *str) { char wstr[MAX_PATH]; DWORD envsize; size_t slen; - char *buffer; + char *buffer, *p; +#if defined(__CYGWIN__) CYGWIN_CONV_TO_FULL_WIN32_PATH((str,wstr)); +#else + strncpy(wstr,str,MAX_PATH); + for (p = wstr; *p; p++) + if (*p == '\\') *p = '/'; +#endif slen = strlen(wstr); envsize = GetEnvironmentVariable("PATH", NULL, 0); @@ -897,25 +910,30 @@ free(buffer); } -#endif void addPath(const char *str) { - const char *path = getenv("PATH"); + const char *path = saved_path ? saved_path : getenv("PATH"); if (path == NULL) { - setenv("PATH", str, 0); + saved_path = malloc(strlen(str) + 1); + strcpy(saved_path, str); } else { char *buffer = malloc(strlen(path) + strlen(str) + 2); strcpy(buffer, path); - strcat(buffer, ":"); + if (saved_path) free(saved_path); + strcat(buffer, SEP_CHARS); strcat(buffer, str); - setenv("PATH" , buffer, 1); - free(buffer); + saved_path = buffer; } -#ifdef __CYGWIN__ - addPathCygwin(str); +#ifdef DEBUG + sprintf (buffer, "PATH='%s' (added '%s')",saved_path,str); + Trace((buffer)); #endif +#if defined(__CYGWIN__) + setenv("PATH" , saved_path, (path!=NULL)); +#endif + addPathCygwin(str); }
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/