Make the MSVC++ port relocatable, i.e. the installation path is not hardcoded in ECL. Also, suport for NSI under MSVC++.

This commit is contained in:
jjgarcia 2004-10-29 13:50:26 +00:00
parent 2b6e16ad98
commit 1b87eaae01
13 changed files with 102 additions and 47 deletions

View file

@ -17,6 +17,8 @@ SOFTWARE_TYPE = NT
SOFTWARE_VERSION = 5.0
THEHOST = win32
TAR_DIR = %%CD%%\ecl-$(ECL_VERSION)
# Programs used by "make":
#
@ -31,6 +33,7 @@ EXE = .exe
CP = copy /Y
MV = move /Y
MSDEV = msdev
MKNSI = makensis.exe
# ==================== Where To Install Things ====================
@ -102,9 +105,9 @@ compile.lsp: bare.lsp $(srcdir)/compile.lsp.in Makefile.msvc6
-e "s,@true_srcdir@,$(srcdir:\=/),g" \
-e "s,@true_builddir@,$(MAKEDIR:\=/),g" \
-e "s,@CFLAGS@,$(CFLAGS),g" \
-e "s,@ECL_CFLAGS@,-I$(libdir:\=/)/h,g" \
-e "s,@ECL_CFLAGS@,,g" \
-e "s,@LDRPATH@,,g" \
-e "s,@LDFLAGS@,/link /LIBPATH:$(libdir:\=/),g" \
-e "s,@LDFLAGS@,/link /LIBPATH:~S,g" \
-e "s,@SHARED_LDFLAGS@,/LD,g" \
-e "s,@BUNDLE_LDFLAGS@,/LD,g" \
-e "s,@CLIBS@,user32.lib ws2_32.lib,g" \
@ -131,9 +134,9 @@ cmp/load.lsp: $(srcdir)/cmp/load.lsp.in
cmp/cmpcfg.lsp: $(srcdir)/cmp/cmpcfg.lsp.in Makefile.msvc6
sed -e "s,@ECL_CC@,$(CC),g" \
-e "s,@CFLAGS@,$(CFLAGS),g" \
-e "s,@ECL_CFLAGS@,-I$(libdir:\=/)/h,g" \
-e "s,@ECL_CFLAGS@,,g" \
-e "s,@LDRPATH@,,g" \
-e "s,@LDFLAGS@,/link /LIBPATH:$(libdir:\=/),g" \
-e "s,@LDFLAGS@,/link /LIBPATH:~S,g" \
-e "s,@SHARED_LDFLAGS@,/LD,g" \
-e "s,@BUNDLE_LDFLAGS@,/LD,g" \
-e "s,@CLIBS@,user32.lib ws2_32.lib,g" \
@ -187,15 +190,27 @@ install: install-base
$(MAKE) -f Makefile.msvc6 install "prefix=$(prefix)"
install-base:
IF NOT EXIST $(bindir) $(MKDIR) $(bindir)
IF NOT EXIST $(libdir) $(MKDIR) $(libdir)\h
IF NOT EXIST $(libdir)\h $(MKDIR) $(libdir)\h
for %i in ($(TARGETS) ecl.dll) do $(CP) %i $(bindir)\%i
$(CP) ecl-config.bat $(bindir)\ecl-config.bat
for %i in ($(LSP_LIBRARIES) $(LIBRARIES) c\dpp.exe help.doc ecl.lib) do $(CP) %i $(libdir)
$(CP) h\config.h $(libdir)\h
flatinstall: BUILD-STAMP
$(MAKE) bindir=$(prefix) libdir=$(prefix) install-base
cd c; $(MAKE) prefix=$(prefix) flatinstall
cd doc; $(MAKE) prefix=$(prefix) flatinstall
flatinstall:
$(MAKE) -f Makefile.msvc6 bindir=$(prefix) libdir=$(prefix) install-base
cd c
$(MAKE) -f Makefile.msvc6 prefix=$(prefix) flatinstall
cd ..\doc
$(MAKE) -f Makefile.msvc6 prefix=$(prefix) flatinstall
cd ..
windows-nsi:
IF EXIST $(TAR_DIR) $(RMDIR) $(TAR_DIR)
$(MKDIR) $(TAR_DIR)
$(MAKE) -f Makefile.msvc6 flatinstall prefix=$(TAR_DIR)
util\ecl_nsi.bat %%CD%%\$(srcdir)\util\ecl.nsi $(TAR_DIR)
$(MKNSI) $(TAR_DIR)/ecl.nsi
$(MV) $(TAR_DIR)\Setup.exe ecl-$(ECL_VERSION).exe
$(RMDIR) $(TAR_DIR)
uninstall:
for i in $(TARGETS) ecl-config; do rm -rf $(bindir)/$$i; done
@ -228,10 +243,6 @@ clean_ecl:
cd c
-$(MAKE) -f Makefile.msvc6 clean
cd ..
# for i in $(SUBDIR); do (cd $$i; $(MAKE) clean); done
# $(RM) ecl_min$(EXE) ecl$(EXE) help.doc core a.out
# $(RM) config.version config.log config.cache
# $(RM) *.c *.o *.a *.h *.data
clean_lisp:
-for %i in (lsp cmp clos clx tk) do for %k in (%i.lib %i.fas %i.ilk %i.c %i.obj %i.pdb) do $(RM) %k
-for %i in (lsp cmp clos clx tk) do $(RMDIR) %i

View file

@ -77,12 +77,12 @@ install: $(HFILES)
$(RM) $(libdir)\h\config.h
$(MV) $(libdir)\h\config-install.h $(libdir)\h\config.h
flatinstal: $(HFILES)
for i in $(HFILES); do $(INSTALL_DATA) $$i $(prefix)/h/; done
sed '/-CUT-/,$$d' ../h/config.h > ../h/config-install.h
$(INSTALL_DATA) ../h/*.h $(prefix)/h/
rm $(prefix)/h/config.h
mv $(prefix)/h/config-install.h $(prefix)/h/config.h
flatinstall: $(HFILES)
for %i in ($(HFILES)) do $(CP) %i $(prefix)\h\
sed -e "/-CUT-/,$$d" ..\h\config.h > $(prefix)\h\config-install.h
for %h in (..\h\*.h) do $(CP) %h $(prefix)\h\
$(RM) $(prefix)\h\config.h
$(MV) $(prefix)\h\config-install.h $(prefix)\h\config.h
..\eclmin.lib: $(OBJS:.obj=.c) $(OBJS)
-$(RM) $@

View file

@ -57,24 +57,15 @@ install: all
IF NOT EXIST $(docdir)\clx $(MKDIR) $(docdir)\clx
for %i in (clx\*) do $(CP) %i $(docdir)\clx
flatinstall: all
$(mkinstalldirs) $(docdir)
for k in $(INFO_FILES); do $(INSTALL_DATA) $$k $(docdir); done
if [ -f user.html ]; then \
$(INSTALL_DATA) $$i $(docdir)/; \
else \
$(mkinstalldirs) $(docdir)/ecl; \
for i in ecl/*; do $(INSTALL_DATA) $$i $(docdir)/ecl/; done; \
fi
if [ -f devel.html ]; then \
$(INSTALL_DATA) devel.html $(docdir)/; \
else \
$(mkinstalldirs) $(docdir)/ecldev; \
for i in ecldev/*; do $(INSTALL_DATA) $$i $(docdir)/ecldev/; done; \
fi
for i in Copyright LGPL; do \
$(INSTALL_DATA) $(top_srcdir)/../$$i $(docdir); \
done
for i in *.html; do $(INSTALL_DATA) $$i $(docdir)/; done
IF NOT EXIST $(docdir) $(MKDIR) $(docdir)
for %i in (Copyright LGPL) do $(CP) $(top_srcdir)\..\%i $(docdir)
for %i in ($(HTML_FILES)) do $(CP) %i $(docdir)
IF NOT EXIST $(docdir)\ecldev $(MKDIR) $(docdir)\ecldev
for %i in (ecldev\*) do $(CP) %i $(docdir)\ecldev
IF NOT EXIST $(docdir)\ecl $(MKDIR) $(docdir)\ecl
for %i in (ecl\*) do $(CP) %i $(docdir)\ecl
IF NOT EXIST $(docdir)\clx $(MKDIR) $(docdir)\clx
for %i in (clx\*) do $(CP) %i $(docdir)\clx
uninstall:
for k in $(INFO_FILES); do \

View file

@ -1115,6 +1115,7 @@ EXPORTS
cl_file_author
si_file_kind
si_getcwd
si_get_library_pathname
si_chdir
si_mkdir
cl_directory

23
msvc/util/ecl_nsi.bat Normal file
View file

@ -0,0 +1,23 @@
@ECHO off
REM Converted from ecl_nsi.sh
SETLOCAL
SET source=%1
SET where=%2
CD %where%
SET dest=ecl.nsi
SET where=%CD%
ECHO %where%
REM set -x
sed -e "/!@INSTALLFILES@/,$d" -e "s,@ECLDIR@,%where:\=\\%," %source% > %dest%
DIR /B /A:-D | sed -e "/^.*ecl.exe.*$/d" -e "/^.*ecl.nsi.*$/d" -e "s,^%where:\=\\%\\,,g" -e "s,^\(.*\)$, File \"${ECLDIR}\\\1\",g" >> %dest%
DIR /B /A:D | sed -e "s,^%where:\=\\%\\,,g" -e "s,^\(.*\)$, File /r \"${ECLDIR}\\\1\",g" >> %dest%
sed -e "1,/!@INSTALLFILES@/d;/!@DELETEFILES@/,$d" %source% >> %dest%
DIR /B /A:-D | sed -e "/^.*ecl.exe.*$/d" -e "/^.*ecl.nsi.*$/d" -e "s,^%where:\=\\%\\,,g" -e "s,^\(.*\)$, Delete \"$INSTDIR\\\1\",g" >> %dest%
DIR /B /A:D | sed -e "s,^%where:\=\\%\\,,g" -e "s,^\(.*\)$, RMDir /r \"$INSTDIR\\\1\",g" >> %dest%
sed -e "1,/!@DELETEFILES@/d" %source% >> %dest%
ENDLOCAL

View file

@ -1096,6 +1096,9 @@ cl_symbols[] = {
{SYS_ "GET-STRING-INPUT-STREAM-INDEX", SI_ORDINARY, si_get_string_input_stream_index, 1, OBJNULL},
{SYS_ "GETENV", SI_ORDINARY, si_getenv, 1, OBJNULL},
{SYS_ "GETCWD", SI_ORDINARY, si_getcwd, 0, OBJNULL},
#ifdef _MSC_VER
{SYS_ "GET-LIBRARY-PATHNAME", SI_ORDINARY, si_get_library_pathname, 0, OBJNULL},
#endif
{SYS_ "HASH-SET", SI_ORDINARY, si_hash_set, 3, OBJNULL},
{SYS_ "HASH-TABLE-ITERATOR", SI_ORDINARY, si_hash_table_iterator, 1, OBJNULL},
{SYS_ "IHS-ENV", SI_ORDINARY, si_ihs_env, 1, OBJNULL},

View file

@ -398,9 +398,9 @@ homedir_pathname(cl_object user)
FEerror("Unknown user ~S.", 1, p);
}
i = namestring->string.fillp;
if (namestring->string.self[i-1] != '/')
if (!IS_DIR_SEPARATOR(namestring->string.self[i-1]))
namestring = si_string_concatenate(2, namestring,
make_constant_string("/"));
CODE_CHAR(DIR_SEPARATOR));
return cl_parse_namestring(3, namestring, Cnil, Cnil);
}
@ -704,6 +704,19 @@ si_getcwd(void)
return cl_parse_namestring(3, current_dir(), Cnil, Cnil);
}
#ifdef _MSC_VER
cl_object
si_get_library_pathname(void)
{
char buffer[MAXPATHLEN];
HMODULE hnd = GetModuleHandle( "ecl.dll" );
cl_index len, ep;
if ((len = GetModuleFileName(hnd, buffer, MAXPATHLEN-1)) == 0)
FEerror("GetModuleFileName failed (last error = ~S)", 1, MAKE_FIXNUM(GetLastError()));
return parse_namestring(buffer, 0, len, &ep, Cnil);
}
#endif
@(defun si::chdir (directory &optional change_d_p_d)
cl_object previous = si_getcwd();
cl_object namestring;

View file

@ -869,8 +869,8 @@ by every function, which attempts to generate RENDER requests."
;; $Log$
;; Revision 1.5 2004-10-25 16:34:21 jjgarcia
;; Port to Microsoft VC++ by Goffioul Michael <goffioul@imec.be>
;; Revision 1.6 2004-10-29 13:50:27 jjgarcia
;; Make the MSVC++ port relocatable, i.e. the installation path is not hardcoded in ECL. Also, suport for NSI under MSVC++.
;;
;; Revision 1.1 2004/06/10 07:59:31 jlr
;; Portable CLX library imported

View file

@ -8,7 +8,7 @@
(setq *cc-optimize* #-msvc "-O"
#+msvc "-O2")
(setq *ld-format* #-msvc "~A -o ~S -L~S ~{~S ~} ~@?"
#+msvc "~A -Zi -Fe~S ~{~S ~} ~@?")
#+msvc "~A -Zi -Fe~S~* ~{~S ~} ~@?")
(setq *cc-format* #-msvc "~A ~A ~:[~*~;~A~] \"-I~A/h\" -w -c \"~A\" -o \"~A\""
#+msvc "~A ~A ~:[~*~;~A~] -I\"~A/h\" -Zi -W3 -c \"~A\" -Fo\"~A\"")
#-dlopen

View file

@ -73,7 +73,7 @@ coprocessor).")
*ld-format*
*cc*
(si::coerce-to-filename o-pathname)
#-msvc (namestring (translate-logical-pathname "SYS:"))
(namestring (translate-logical-pathname "SYS:"))
options
*ld-flags* (namestring (translate-logical-pathname "SYS:")))))
@ -85,7 +85,7 @@ coprocessor).")
*ld-format*
*cc*
(si::coerce-to-filename o-pathname)
#-msvc (namestring (translate-logical-pathname "SYS:"))
(namestring (translate-logical-pathname "SYS:"))
options
*ld-shared-flags*
(namestring (translate-logical-pathname "SYS:"))))
@ -108,7 +108,7 @@ coprocessor).")
*ld-format*
*cc*
(si::coerce-to-filename o-pathname)
#-msvc (namestring (translate-logical-pathname "SYS:"))
(namestring (translate-logical-pathname "SYS:"))
options
#-msvc *ld-bundle-flags*
#+msvc (concatenate 'string *ld-bundle-flags* " /EXPORT:init_CODE")

View file

@ -43,7 +43,7 @@
#+msvc "~A ~A ~:[~*~;~A~] -I\"@true_builddir@\"/h~* -Zi -W3 -c ~S -Fo~S"
c::*ld-format*
#-msvc "~A -o ~S -L\"@true_builddir@\"~* ~{~S ~} ~@?"
#+msvc "~A -Zi -Fe~S ~{~S ~} ~@?")
#+msvc "~A -Zi -Fe~S~* ~{~S ~} ~@?")
#-dlopen
(setf c::*ld-flags*
"@LDFLAGS@ @LDRPATH@ @LIBPREFIX@ecl.@LIBEXT@ @STATICLIBS@ @CLIBS@")

View file

@ -98,6 +98,9 @@ struct cl_env_struct {
int interrupt_pending;
};
#ifndef __GNUC__
#define __attribute__(x)
#endif
#if defined(ECL_THREADS)
#define cl_env (*ecl_process_env())
extern struct cl_env_struct *ecl_process_env(void) __attribute__((const));
@ -1429,6 +1432,9 @@ extern cl_object cl_file_write_date(cl_object file);
extern cl_object cl_file_author(cl_object file);
extern cl_object si_file_kind(cl_object pathname, cl_object follow_links);
extern cl_object si_getcwd(void);
#ifdef _MSC_VER
extern cl_object si_get_library_pathname(void);
#endif
extern cl_object si_chdir _ARGS((cl_narg narg, cl_object directory, ...));
extern cl_object si_mkdir(cl_object directory, cl_object mode);
extern cl_object cl_directory _ARGS((cl_narg narg, cl_object directory, ...));

View file

@ -67,9 +67,16 @@ Returns, as a string, the version of the software under which ECL runs."
;; * Set configuration pathnames. Notice the trailing slash!
;; Otherwise it would not be a directory.
;;
#-mingw32
#-(and mingw32 msvc)
(si::pathname-translations "SYS" '(("**;*.*" "@ecldir@/**/*.*")))
#+mingw32
(si::pathname-translations "SYS"
`(("**;*.*" ,(merge-pathnames "**/*.*" (si::argv 0)))))
#+msvc
(si::pathname-translations "SYS"
`(("**;*.*" ,(merge-pathnames "**/*.*" (si::get-library-pathname)))))
#-msvc
(si::pathname-translations "HOME" '(("**;*.*" "~/**/*.*")))
#+msvc
(si::pathname-translations "HOME"
`(("**;*.*" ,(merge-pathnames "**/*.*" (user-homedir-pathname)))))