From 00aa10a96d8125eb43e386352dfc33ae17f56139 Mon Sep 17 00:00:00 2001 From: "sgehani%netscape.com" Date: Fri, 18 Aug 2000 22:09:26 +0000 Subject: [PATCH] Building standalone libjar for installer use. [nsbeta3+ b=48109; r=ssu] --- modules/libjar/Makefile.in | 8 +++- modules/libjar/nsZipArchive.cpp | 4 +- modules/libjar/nsZipArchive.h | 8 ++-- modules/libjar/standalone/.cvsignore | 1 + modules/libjar/standalone/Makefile.in | 62 +++++++++++++++++++++++++++ modules/libjar/zipstub.h | 12 +++++- 6 files changed, 84 insertions(+), 11 deletions(-) create mode 100644 modules/libjar/standalone/Makefile.in diff --git a/modules/libjar/Makefile.in b/modules/libjar/Makefile.in index c8ac694e5e7f..a49de9855fea 100644 --- a/modules/libjar/Makefile.in +++ b/modules/libjar/Makefile.in @@ -17,6 +17,7 @@ # Rights Reserved. # # Contributor(s): +# Samir Gehani # DEPTH = ../.. @@ -26,12 +27,14 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk +DIRS = standalone + MODULE = jar LIBRARY_NAME = jar$(VERSION_NUMBER) IS_COMPONENT = 1 CPPSRCS = \ - nsJARInputStream.cpp \ + nsJARInputStream.cpp \ nsZipArchive.cpp \ nsJAR.cpp \ nsJARFactory.cpp \ @@ -39,7 +42,8 @@ CPPSRCS = \ $(NULL) EXPORTS = zipfile.h \ - $(NULL) + zipstub.h \ + $(NULL) EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp index 7a168e9e5cc6..3c5e2d54ddcd 100644 --- a/modules/libjar/nsZipArchive.cpp +++ b/modules/libjar/nsZipArchive.cpp @@ -234,7 +234,7 @@ PR_PUBLIC_API(PRInt32) ZIP_FindNext( void* hFind, char * outbuf, PRUint16 bufsiz /*--- return next filename file ---*/ nsZipItem* item; - status = find->mArchive->FindNext( find, &item ); + status = find->GetArchive()->FindNext( find, &item ); if ( status == ZIP_OK ) { if ( bufsize > item->namelen ) @@ -268,7 +268,7 @@ PR_PUBLIC_API(PRInt32) ZIP_FindFree( void* hFind ) return ZIP_ERR_PARAM; /* whatever it is isn't one of ours! */ /* free the find structure */ - return find->mArchive->FindFree( find ); + return find->GetArchive()->FindFree( find ); } #endif /* STANDALONE */ diff --git a/modules/libjar/nsZipArchive.h b/modules/libjar/nsZipArchive.h index fe229ae86742..49c7d9f40872 100644 --- a/modules/libjar/nsZipArchive.h +++ b/modules/libjar/nsZipArchive.h @@ -32,7 +32,9 @@ #define ZIP_TABSIZE 256 #define ZIP_BUFLEN 32767 - +#ifdef STANDALONE +#define nsZipArchive nsZipArchiveStandalone +#endif class nsZipFind; class nsZipRead; @@ -254,10 +256,6 @@ private: class nsZipFind { friend class nsZipArchive; -#ifdef STANDALONE - friend PRInt32 ZIP_FindNext( void*, char*, PRUint16 ); - friend PRInt32 ZIP_FindFree( void* ); -#endif public: const PRInt32 kMagic; diff --git a/modules/libjar/standalone/.cvsignore b/modules/libjar/standalone/.cvsignore index f9c1c3ca8e49..feb82eda32e2 100644 --- a/modules/libjar/standalone/.cvsignore +++ b/modules/libjar/standalone/.cvsignore @@ -1,3 +1,4 @@ +Makefile nsZipArchive.cpp nsZipArchive.h zipfile.h diff --git a/modules/libjar/standalone/Makefile.in b/modules/libjar/standalone/Makefile.in new file mode 100644 index 000000000000..0869bd09ff6d --- /dev/null +++ b/modules/libjar/standalone/Makefile.in @@ -0,0 +1,62 @@ +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# Samir Gehani +# + +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = jar +LIBRARY_NAME = jar$(VERSION_NUMBER)_s + +CPPSRCS = \ + nsJARInputStream.cpp \ + nsZipArchive.cpp \ + nsJAR.cpp \ + nsJARFactory.cpp \ + nsWildCard.cpp \ + $(NULL) + +override NO_SHARED_LIB=1 +override NO_STATIC_LIB= + +SHARED_LIBRARY_LIBS = $(DIST)/lib/libzlib.a + +include $(topsrcdir)/config/rules.mk + +DEFINES += -DSTANDALONE + +export:: copysrcs + +copysrcs:: + cp ../*.cpp . + cp ../*.h . + +clean:: + $(RM) -f *.cpp *.h *.o *.a + +clobber:: clean + +clobber_all:: clean + diff --git a/modules/libjar/zipstub.h b/modules/libjar/zipstub.h index d65cb64e2406..6ad30a1d587e 100644 --- a/modules/libjar/zipstub.h +++ b/modules/libjar/zipstub.h @@ -46,15 +46,23 @@ #define PR_Seek fseek #define PR_Delete remove +#ifdef __cplusplus #define PR_BEGIN_EXTERN_C extern "C" { #define PR_END_EXTERN_C } +#else +#define PR_BEGIN_EXTERN_C +#define PR_END_EXTERN_C +#endif -#ifdef XP_MAC +#if defined(XP_MAC) #define PR_EXTERN(__type) extern __declspec(export) __type #define PR_PUBLIC_API(__type) __declspec(export) __type -#else +#elif defined(XP_PC) #define PR_EXTERN(__type) extern _declspec(dllexport) __type #define PR_PUBLIC_API(__type) _declspec(dllexport) __type +#else /* XP_UNIX */ +#define PR_EXTERN(__type) extern __type +#define PR_PUBLIC_API(__type) __type #endif #define NS_STATIC_CAST(__type, __ptr) ((__type)(__ptr))