summaryrefslogtreecommitdiff
path: root/java/jdk15
diff options
context:
space:
mode:
authorGreg Lewis <glewis@FreeBSD.org>2007-06-09 05:14:56 +0000
committerGreg Lewis <glewis@FreeBSD.org>2007-06-09 05:14:56 +0000
commit01790521d1f58b3814db40f9bcc340faf54e9c9f (patch)
treeb9d63b3a22d203c194324a9704a910badab47a40 /java/jdk15
parent- Fix dependencies (diff)
. Update to patchset 5, based on the 1.5.0_11 JRL source code.
Notes
Notes: svn path=/head/; revision=193076
Diffstat (limited to 'java/jdk15')
-rw-r--r--java/jdk15/Makefile88
-rw-r--r--java/jdk15/distinfo18
-rw-r--r--java/jdk15/files/patch-hotspot::amd64::vm::amd64.ad13
-rw-r--r--java/jdk15/files/patch-hotspot::amd64::vm::frame_amd64.hpp9
-rw-r--r--java/jdk15/files/patch-hotspot::amd64::vm::interpreter_amd64.hpp16
-rw-r--r--java/jdk15/files/patch-hotspot::amd64::vm::register_amd64.hpp38
-rw-r--r--java/jdk15/files/patch-hotspot::amd64::vm::templateTable_amd64.cpp11
-rw-r--r--java/jdk15/files/patch-hotspot::bsd::vm::jvm_bsd.h15
-rw-r--r--java/jdk15/files/patch-hotspot::bsd::vm::osThread_bsd.hpp11
-rw-r--r--java/jdk15/files/patch-hotspot::bsd_amd64::vm::os_bsd_amd64.cpp22
-rw-r--r--java/jdk15/files/patch-hotspot::bsd_amd64::vm::threadLS_bsd_amd64.hpp11
-rw-r--r--java/jdk15/files/patch-hotspot::bsd_i486::vm::threadLS_bsd_i486.hpp11
-rw-r--r--java/jdk15/files/patch-hotspot::i486::vm::templateTable_i486.cpp11
-rw-r--r--java/jdk15/files/patch-hotspot::share::vm::bytecodeTracer.cpp26
-rw-r--r--java/jdk15/files/patch-j2se::common::Defs-bsd.gmk14
-rw-r--r--java/jdk15/files/patch-j2se::jar::main.cpp14
-rw-r--r--java/jdk15/files/patch-j2se::jdbc::Makefile15
-rw-r--r--java/jdk15/files/patch-j2se::nio::genCharsetProvider.sh12
-rw-r--r--java/jdk15/files/patch-vm::os_bsd.cpp10
-rw-r--r--java/jdk15/files/pkg-install.in194
-rw-r--r--java/jdk15/files/x_x2zip.c117
21 files changed, 388 insertions, 288 deletions
diff --git a/java/jdk15/Makefile b/java/jdk15/Makefile
index 14b922ac8d97..2d5b7dfe8658 100644
--- a/java/jdk15/Makefile
+++ b/java/jdk15/Makefile
@@ -6,14 +6,14 @@
#
PORTNAME= jdk
-PORTVERSION= ${JDK_VERSION}p${JDK_PATCHSET_VERSION}
-PORTREVISION= 3
+PORTVERSION= ${JDK_VERSION}.${JDK_UPDATE_VERSION}p${JDK_PATCHSET_VERSION}
+PORTEPOCH= 1
CATEGORIES= java devel
-MASTER_SITES= # http://www.sun.com/software/java2/download.html
+MASTER_SITES= # http://download.java.net/tiger/
# http://www.eyesbeyond.com/freebsddom/java/jdk15.html
# http://java.sun.com/javase/downloads/index.jsp
-DISTFILES= ${SCSL_SRCFILE} ${SCSL_BINFILE} ${PATCHSETFILE}
-EXTRACT_ONLY= ${SCSL_SRCFILE} ${SCSL_BINFILE}
+DISTFILES= ${JRL_SRCFILE} ${JRL_BINFILE} ${PATCHSETFILE}
+EXTRACT_ONLY= ${JRL_SRCFILE} ${JRL_BINFILE}
MAINTAINER= glewis@FreeBSD.org
COMMENT= Java Development Kit 1.5.0
@@ -46,20 +46,23 @@ WRKSRC= ${WRKDIR}/control/make
USE_ZIP= YES
-SCSL_SRCFILE= jdk-${JDK_VERSION:S/./_/g}-src-scsl.zip
-SCSL_BINFILE= jdk-${JDK_VERSION:S/./_/g}-bin-scsl.zip
+JRL_SRCFILE= jdk-${JDK_VERSION:S/./_/g}_${JDK_UPDATE_VERSION}-fcs-src-b${JDK_BUILD_NUMBER}-jrl-${JDK_BUILD_DATE}.jar
+JRL_BINFILE= jdk-${JDK_VERSION:S/./_/g}_${JDK_UPDATE_VERSION}-fcs-bin-b${JDK_BUILD_NUMBER}-jrl-${JDK_BUILD_DATE}.jar
PATCHSETFILE= bsd-jdk15-patches-${JDK_PATCHSET_VERSION}.tar.bz2
POLICYFILE= jce_policy-${JDK_VERSION:S/./_/g}.zip
TZUPDATEFILE= tzupdater-${TZUPDATE_VERSION:S/./_/g}-${TZUPDATE_TZVERSION}.zip
JDK_VERSION= 1.5.0
-JDK_PATCHSET_VERSION= 4
+JDK_UPDATE_VERSION= 11
+JDK_PATCHSET_VERSION= 5
+JDK_BUILD_NUMBER= 03
+JDK_BUILD_DATE= 15_dec_2006
LATEST_LINK= jdk15
TZUPDATE_VERSION= 1.2.1
TZUPDATE_TZVERSION= 2007f
-SUN_LINUX_JDK_VERSION= 1.4.2
+SUN_LINUX_JDK_VERSION= 1.5.0
.if !defined(WITH_LINUX_BOOTSTRAP)
NATIVE_BOOTSTRAP_JDKS+= ${LOCALBASE}/diablo-jdk1.5.0 \
@@ -67,7 +70,8 @@ NATIVE_BOOTSTRAP_JDKS+= ${LOCALBASE}/diablo-jdk1.5.0 \
${LOCALBASE}/jdk1.4.2
.endif
-LINUX_BOOTSTRAP_JDKS= ${LOCALBASE}/linux-sun-jdk1.4.2
+LINUX_BOOTSTRAP_JDKS= ${LOCALBASE}/linux-sun-jdk1.5.0 \
+ ${LOCALBASE}/linux-sun-jdk1.4.2
.include <bsd.port.pre.mk>
@@ -88,28 +92,28 @@ EXTRACT_ONLY+= ${TZUPDATEFILE}
# do we have valid native jdk installed?
.if !defined(WITH_LINUX_BOOTSTRAP)
.for CJDK in ${NATIVE_BOOTSTRAP_JDKS}
-. if !defined(JDK14DIR) && exists(${CJDK}/bin/javac)
-JDK14DIR= ${CJDK}
+. if !defined(BOOTSTRAPJDKDIR) && exists(${CJDK}/bin/javac)
+BOOTSTRAPJDKDIR= ${CJDK}
. endif
.endfor
.endif
# do we have valid linux jdk installed?
-.if !defined(JDK14DIR)
+.if !defined(BOOTSTRAPJDKDIR)
.for CJDK in ${LINUX_BOOTSTRAP_JDKS}
-. if !defined(JDK14DIR) && exists(${CJDK}/bin/javac)
-JDK14DIR= ${CJDK}
+. if !defined(BOOTSTRAPJDKDIR) && exists(${CJDK}/bin/javac)
+BOOTSTRAPJDKDIR= ${CJDK}
WITH_LINUX_BOOTSTRAP= YES
. endif
.endfor
.endif
# if no valid jdk found, set dependency
-.if !defined(JDK14DIR)
-JDK14DIR?= ${LOCALBASE}/linux-sun-jdk${SUN_LINUX_JDK_VERSION}
+.if !defined(BOOTSTRAPJDKDIR)
+BOOTSTRAPJDKDIR?= ${LOCALBASE}/linux-sun-jdk${SUN_LINUX_JDK_VERSION}
.endif
-BUILD_DEPENDS+= ${JDK14DIR}/bin/javac:${PORTSDIR}/java/linux-sun-jdk14
+BUILD_DEPENDS+= ${BOOTSTRAPJDKDIR}/bin/javac:${PORTSDIR}/java/linux-sun-jdk15
.if defined(WITHOUT_WEB)
MAKE_ENV+= DONT_BUILD_DEPLOY="YES"
@@ -124,7 +128,7 @@ USE_ICONV= YES
RESTRICTED= "Redistribution of pre-compiled binaries is not permitted"
NO_CDROM= "Redistribution of pre-compiled binaries is not permitted"
-MAKE_ENV+= ALT_BOOTDIR="${JDK14DIR}" \
+MAKE_ENV+= ALT_BOOTDIR="${BOOTSTRAPJDKDIR}" \
ALT_MOTIF_DIR="${X11BASE}" \
SYS_CFLAGS="${CFLAGS}" \
LANG="C" \
@@ -175,24 +179,21 @@ X11_FILES= ../../j2se/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFe
../../j2se/src/solaris/native/sun/awt/fontpath.c
# Check for JDK sources and patch file
-.if !defined(PACKAGE_BUILDING) && (!exists(${DISTDIR}/${SCSL_SRCFILE}) || !exists(${DISTDIR}/${SCSL_BINFILE}) || (defined(WITH_POLICY) && !exists(${DISTDIR}/${POLICYFILE})) || (defined(WITH_TZUPDATE) && !exists(${DISTDIR}/${TZUPDATEFILE})) || !exists(${DISTDIR}/${PATCHSETFILE}))#{
+.if !defined(PACKAGE_BUILDING) && (!exists(${DISTDIR}/${JRL_SRCFILE}) || !exists(${DISTDIR}/${JRL_BINFILE}) || (defined(WITH_POLICY) && !exists(${DISTDIR}/${POLICYFILE})) || (defined(WITH_TZUPDATE) && !exists(${DISTDIR}/${TZUPDATEFILE})) || !exists(${DISTDIR}/${PATCHSETFILE}))#{
ECHO_MSG=/usr/bin/printf
IGNORE= :\n\
Due to licensing restrictions, certain files must be fetched manually.\n\n
-.if !exists(${DISTDIR}/${SCSL_SRCFILE}) || !exists(${DISTDIR}/${SCSL_BINFILE})#{
-IGNORE += Please open http://www.sun.com/software/java2/download.html\n\
-in a web browser and follow the \"Download\" link for the\n\
-\"JDK ${JDK_VERSION:S/1.//}\". You will be required to log in and register,\n\
-but you can create an account on this page. After registration and\n\
-accepting the Sun Community Source License, download the\n
-.if !exists(${DISTDIR}/${SCSL_SRCFILE})#{
-IGNORE += SCSL Source file, ${SCSL_SRCFILE}
+.if !exists(${DISTDIR}/${JRL_SRCFILE}) || !exists(${DISTDIR}/${JRL_BINFILE})#{
+IGNORE += Please open http://download.java.net/tiger/archive/tiger_u${JDK_UPDATE_VERSION}/index.csp\n\
+in a web browser. Download the\n
+.if !exists(${DISTDIR}/${JRL_SRCFILE})#{
+IGNORE += Update ${JDK_UPDATE_VERSION} Source, ${JRL_SRCFILE}
.endif#}
-.if !exists(${DISTDIR}/${SCSL_BINFILE})#{
-.if !exists(${DISTDIR}/${SCSL_SRCFILE})#{
+.if !exists(${DISTDIR}/${JRL_BINFILE})#{
+.if !exists(${DISTDIR}/${JRL_SRCFILE})#{
IGNORE += and the\n
.endif#}
-IGNORE += SCSL Binaries file, ${SCSL_BINFILE}
+IGNORE += Source Binaries, ${JRL_BINFILE}
.endif#}
IGNORE += .\n\n
.endif#}
@@ -227,6 +228,31 @@ pre-fetch:
@${ECHO_MSG}
.endif
+# Get JRL agreement
+.if !defined(PACKAGE_BUILDING)
+pre-extract:
+ ${SH} ${FILESDIR}/pkg-install.in ${PKGNAME} PRE-INSTALL
+.endif
+
+# Extract the files
+do-extract:
+ @${RM} -rf ${WRKDIR}
+ @${MKDIR} ${WRKDIR}
+ @${CC} ${CFLAGS} -o ${WRKDIR}/x_x2zip ${FILESDIR}/x_x2zip.c
+ @for file in ${EXTRACT_ONLY}; do \
+ if ! (cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} "${DISTDIR}/$$file" ${EXTRACT_AFTER_ARGS}); \
+ then \
+ exit 1; \
+ fi; \
+ if [ `basename $$file .jar` != $$file ]; \
+ then \
+ if ! (cd ${WRKDIR} && ${WRKDIR}/x_x2zip 'YES I ACCEPT THE CLICK THROUGH LICENSE. ' X_X && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${WRKDIR}/X_X.zip ${EXTRACT_AFTER_ARGS}); \
+ then \
+ exit 1; \
+ fi; \
+ fi \
+ done
+
pre-patch:
@cd ${WRKDIR} && \
${BZIP2_CMD} -dc ${DISTDIR}/${PATCHSETFILE} | ${TAR} -xf - && \
diff --git a/java/jdk15/distinfo b/java/jdk15/distinfo
index 77fa51c54dfc..3835cd69417f 100644
--- a/java/jdk15/distinfo
+++ b/java/jdk15/distinfo
@@ -1,12 +1,12 @@
-MD5 (jdk-1_5_0-src-scsl.zip) = 7802831198068c9a0df727c3ea6617a9
-SHA256 (jdk-1_5_0-src-scsl.zip) = d11e35f2f0b8f6e2e71bf19e423d553179f980105d877bfefac88e5e494173bd
-SIZE (jdk-1_5_0-src-scsl.zip) = 58338869
-MD5 (jdk-1_5_0-bin-scsl.zip) = 3c3b2c079628141fa28f5f0f1cde5bf0
-SHA256 (jdk-1_5_0-bin-scsl.zip) = f7be15e4478165c361d011f39c02fea558dba442aeb3556357f4c7771db763f1
-SIZE (jdk-1_5_0-bin-scsl.zip) = 2219433
-MD5 (bsd-jdk15-patches-4.tar.bz2) = b142cdef325de437bdaa4a63443fe950
-SHA256 (bsd-jdk15-patches-4.tar.bz2) = 01c18d3ea32dba3cba1b4c53a437935ffae524d1fba636cf733d66aaa697d503
-SIZE (bsd-jdk15-patches-4.tar.bz2) = 746062
+MD5 (jdk-1_5_0_11-fcs-src-b03-jrl-15_dec_2006.jar) = e6661cce9c94009e2fa909a151c0160c
+SHA256 (jdk-1_5_0_11-fcs-src-b03-jrl-15_dec_2006.jar) = f2dd285070a1c4d71077cbc28420e39628fc577ac4fb02e8617ebffeab8120eb
+SIZE (jdk-1_5_0_11-fcs-src-b03-jrl-15_dec_2006.jar) = 57703958
+MD5 (jdk-1_5_0_11-fcs-bin-b03-jrl-15_dec_2006.jar) = 7c952fba37101c154f1636dc401aa093
+SHA256 (jdk-1_5_0_11-fcs-bin-b03-jrl-15_dec_2006.jar) = c5cd6d195c1cb213546cd598da0c6d5295e1cf5fd5748e924628035b45874780
+SIZE (jdk-1_5_0_11-fcs-bin-b03-jrl-15_dec_2006.jar) = 2211688
+MD5 (bsd-jdk15-patches-5.tar.bz2) = bc6339e072fabb20097eebbec0e5060f
+SHA256 (bsd-jdk15-patches-5.tar.bz2) = b996f0bc530e2c21c83598e5b3e2f86a264d50d755cb5037ee5cc38a88be9993
+SIZE (bsd-jdk15-patches-5.tar.bz2) = 772184
MD5 (jce_policy-1_5_0.zip) = 169441bba1ca95e84e030e116f258d79
SHA256 (jce_policy-1_5_0.zip) = 4de78da737c6d66b74eb6caebf6bdb0648825a95e2909e815678a0d306bf6d8b
SIZE (jce_policy-1_5_0.zip) = 8826
diff --git a/java/jdk15/files/patch-hotspot::amd64::vm::amd64.ad b/java/jdk15/files/patch-hotspot::amd64::vm::amd64.ad
deleted file mode 100644
index dbf43fe16d5e..000000000000
--- a/java/jdk15/files/patch-hotspot::amd64::vm::amd64.ad
+++ /dev/null
@@ -1,13 +0,0 @@
---- ../../hotspot/src/cpu/amd64/vm/amd64.ad.orig Thu May 24 15:27:42 2007
-+++ ../../hotspot/src/cpu/amd64/vm/amd64.ad Thu May 24 17:15:10 2007
-@@ -662,8 +662,8 @@
- {
- #ifdef ASSERT
- if (rspec.reloc()->type() == relocInfo::oop_type &&
-- d32 != 0 && d32 != (int) Universe::non_oop_word()) {
-- assert(oop(d32)->is_oop() && oop(d32)->is_perm(), "cannot embed non-perm oops in code");
-+ d32 != 0 && d32 != (intptr_t) Universe::non_oop_word()) {
-+ assert(oop((intptr_t)d32)->is_oop() && oop((intptr_t)d32)->is_perm(), "cannot embed non-perm oops in code");
- }
- #endif
- cbuf.relocate(cbuf.mark(), rspec, format);
diff --git a/java/jdk15/files/patch-hotspot::amd64::vm::frame_amd64.hpp b/java/jdk15/files/patch-hotspot::amd64::vm::frame_amd64.hpp
deleted file mode 100644
index 77bd14b2ea9e..000000000000
--- a/java/jdk15/files/patch-hotspot::amd64::vm::frame_amd64.hpp
+++ /dev/null
@@ -1,9 +0,0 @@
---- ../../hotspot/src/cpu/amd64/vm/frame_amd64.hpp.orig Tue Oct 19 14:41:26 2004
-+++ ../../hotspot/src/cpu/amd64/vm/frame_amd64.hpp Thu May 24 15:55:55 2007
-@@ -125,5 +125,5 @@
- inline address* sender_pc_addr() const;
-
- // return address of param, zero origin index.
-- inline address* frame::native_param_addr(int idx) const;
-+ inline address* native_param_addr(int idx) const;
-
diff --git a/java/jdk15/files/patch-hotspot::amd64::vm::interpreter_amd64.hpp b/java/jdk15/files/patch-hotspot::amd64::vm::interpreter_amd64.hpp
deleted file mode 100644
index 0bd8ed438688..000000000000
--- a/java/jdk15/files/patch-hotspot::amd64::vm::interpreter_amd64.hpp
+++ /dev/null
@@ -1,16 +0,0 @@
---- ../../hotspot/src/cpu/amd64/vm/interpreter_amd64.hpp.orig Tue Oct 19 14:41:27 2004
-+++ ../../hotspot/src/cpu/amd64/vm/interpreter_amd64.hpp Thu May 24 16:11:07 2007
-@@ -53,11 +53,11 @@
- void generate_stack_overflow_check(void);
-
- #ifndef CORE
-- void InterpreterGenerator::generate_counter_incr(
-+ void generate_counter_incr(
- Label* overflow,
- Label* profile_method,
- Label* profile_method_continue);
-- void InterpreterGenerator::generate_counter_overflow(address entry_point);
-+ void generate_counter_overflow(address entry_point);
- void generate_run_compiled_code(void);
- void check_for_compiled_code(Label & run_compiled_code);
- #endif
diff --git a/java/jdk15/files/patch-hotspot::amd64::vm::register_amd64.hpp b/java/jdk15/files/patch-hotspot::amd64::vm::register_amd64.hpp
deleted file mode 100644
index f4ebe6b17e62..000000000000
--- a/java/jdk15/files/patch-hotspot::amd64::vm::register_amd64.hpp
+++ /dev/null
@@ -1,38 +0,0 @@
---- ../../hotspot/src/cpu/amd64/vm/register_amd64.hpp.orig Tue Oct 19 14:41:27 2004
-+++ ../../hotspot/src/cpu/amd64/vm/register_amd64.hpp Thu May 24 15:50:42 2007
-@@ -28,17 +28,17 @@
- int encoding() const
- {
- assert(is_valid(), "invalid register");
-- return (int) this;
-+ return value();
- }
-
- bool is_valid() const
- {
-- return 0 <= (int) this && (int) this < number_of_registers;
-+ return 0 <= value() && value() < number_of_registers;
- }
-
- bool has_byte_register() const
- {
-- return 0 <= (int) this && (int)this < number_of_byte_registers;
-+ return 0 <= value() && value() < number_of_byte_registers;
- }
-
- const char* name() const;
-@@ -92,12 +92,12 @@
- int encoding() const
- {
- assert(is_valid(), "invalid fp register");
-- return (int) this;
-+ return value();
- }
-
- bool is_valid() const
- {
-- return 0 <= (int) this && (int) this < number_of_registers;
-+ return 0 <= value() && value() < number_of_registers;
- }
-
- const char* name() const;
diff --git a/java/jdk15/files/patch-hotspot::amd64::vm::templateTable_amd64.cpp b/java/jdk15/files/patch-hotspot::amd64::vm::templateTable_amd64.cpp
deleted file mode 100644
index 9e975618a271..000000000000
--- a/java/jdk15/files/patch-hotspot::amd64::vm::templateTable_amd64.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
---- ../../hotspot/src/cpu/amd64/vm/templateTable_amd64.cpp.orig Tue Oct 19 14:41:28 2004
-+++ ../../hotspot/src/cpu/amd64/vm/templateTable_amd64.cpp Thu May 24 16:34:33 2007
-@@ -3266,7 +3266,7 @@
- // initialize object header only.
- __ bind(initialize_header);
- __ movq(Address(rax, oopDesc::mark_offset_in_bytes()),
-- (int) markOopDesc::prototype()); // header (address 0x1)
-+ (intptr_t) markOopDesc::prototype()); // header (address 0x1)
- __ movq(Address(rax, oopDesc::klass_offset_in_bytes()), rarg1); // klass
- __ jmp(done);
-
diff --git a/java/jdk15/files/patch-hotspot::bsd::vm::jvm_bsd.h b/java/jdk15/files/patch-hotspot::bsd::vm::jvm_bsd.h
deleted file mode 100644
index b5c3ea0695c6..000000000000
--- a/java/jdk15/files/patch-hotspot::bsd::vm::jvm_bsd.h
+++ /dev/null
@@ -1,15 +0,0 @@
---- ../../hotspot/src/os/bsd/vm/jvm_bsd.h.orig Fri May 25 14:04:51 2007
-+++ ../../hotspot/src/os/bsd/vm/jvm_bsd.h Fri May 25 14:04:14 2007
-@@ -78,8 +78,12 @@
- #define ALT_ASYNC_SIGNAL ALT_INTERRUPT_SIGNAL+1 /* alternate async signal */
-
- /* XXXBSD: compat? */
-+#ifndef SIGRTMIN
- #define SIGRTMIN 33
-+#endif
-+#ifndef SIGRTMAX
- #define SIGRTMAX 63
-+#endif
-
- /* With 1.4.1 libjsig added versioning: used in os_bsd.cpp and jsig.c */
- #define JSIG_VERSION_1_4_1 0x30140100
diff --git a/java/jdk15/files/patch-hotspot::bsd::vm::osThread_bsd.hpp b/java/jdk15/files/patch-hotspot::bsd::vm::osThread_bsd.hpp
deleted file mode 100644
index ae78d2f6f45b..000000000000
--- a/java/jdk15/files/patch-hotspot::bsd::vm::osThread_bsd.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
---- ../../hotspot/src/os/bsd/vm/osThread_bsd.hpp.orig Thu May 24 16:50:49 2007
-+++ ../../hotspot/src/os/bsd/vm/osThread_bsd.hpp Thu May 24 16:51:16 2007
-@@ -28,7 +28,7 @@
-
- #ifndef PRODUCT
- // Used for debugging, return a unique integer for each thread.
-- int thread_identifier() const { return (int)_thread_id; }
-+ int thread_identifier() const { return (int)(intptr_t)_thread_id; }
- #endif
- #ifdef ASSERT
- // On solaris reposition can fail in two ways:
diff --git a/java/jdk15/files/patch-hotspot::bsd_amd64::vm::os_bsd_amd64.cpp b/java/jdk15/files/patch-hotspot::bsd_amd64::vm::os_bsd_amd64.cpp
deleted file mode 100644
index ec8870613cd0..000000000000
--- a/java/jdk15/files/patch-hotspot::bsd_amd64::vm::os_bsd_amd64.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
---- ../../hotspot/src/os_cpu/bsd_amd64/vm/os_bsd_amd64.cpp.orig Thu May 24 15:27:42 2007
-+++ ../../hotspot/src/os_cpu/bsd_amd64/vm/os_bsd_amd64.cpp Thu May 24 16:26:52 2007
-@@ -255,15 +255,15 @@
- // success, if not we return failure and the caller can retry.
- //
- _result = false;
-- if (uc->context_rip == (int)_old_addr.pc() ) {
-- uc->context_rip = (int)_new_addr.pc();
-+ if (uc->context_rip == (intptr_t)_old_addr.pc() ) {
-+ uc->context_rip = (intptr_t)_new_addr.pc();
- _result = true;
- #ifndef __OpenBSD__
- } else if (uc->uc_link != NULL) {
- // Check (and validate) one level of stacked ucontext
- ucontext_t* linked_uc = uc->uc_link;
-- if (os::Bsd::valid_ucontext(thread, uc, linked_uc) && linked_uc->context_rip == (int)_old_addr.pc()) {
-- linked_uc->context_rip = (int)_new_addr.pc();
-+ if (os::Bsd::valid_ucontext(thread, uc, linked_uc) && linked_uc->context_rip == (intptr_t)_old_addr.pc()) {
-+ linked_uc->context_rip = (intptr_t)_new_addr.pc();
- _result = true;
- }
- #endif
diff --git a/java/jdk15/files/patch-hotspot::bsd_amd64::vm::threadLS_bsd_amd64.hpp b/java/jdk15/files/patch-hotspot::bsd_amd64::vm::threadLS_bsd_amd64.hpp
deleted file mode 100644
index b0b0338a23cd..000000000000
--- a/java/jdk15/files/patch-hotspot::bsd_amd64::vm::threadLS_bsd_amd64.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
---- ../../hotspot/src/os_cpu/bsd_amd64/vm/threadLS_bsd_amd64.hpp.orig Thu May 24 15:27:42 2007
-+++ ../../hotspot/src/os_cpu/bsd_amd64/vm/threadLS_bsd_amd64.hpp Thu May 24 16:01:24 2007
-@@ -33,7 +33,7 @@
-
- static uintptr_t pd_raw_thread_id() {
- address sp = pd_sp_address();
-- return (unsigned int)sp / _pd_min_page_size;
-+ return (uintptr_t) sp / _pd_min_page_size;
- }
-
- static int pd_cache_index(uintptr_t sp_page) {
diff --git a/java/jdk15/files/patch-hotspot::bsd_i486::vm::threadLS_bsd_i486.hpp b/java/jdk15/files/patch-hotspot::bsd_i486::vm::threadLS_bsd_i486.hpp
deleted file mode 100644
index 318514b0dd80..000000000000
--- a/java/jdk15/files/patch-hotspot::bsd_i486::vm::threadLS_bsd_i486.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
---- ../../hotspot/src/os_cpu/bsd_i486/vm/threadLS_bsd_i486.hpp.orig Thu May 24 15:27:43 2007
-+++ ../../hotspot/src/os_cpu/bsd_i486/vm/threadLS_bsd_i486.hpp Thu May 24 19:43:59 2007
-@@ -33,7 +33,7 @@
-
- static uintptr_t pd_raw_thread_id() {
- address sp = pd_sp_address();
-- return (unsigned int)sp / _pd_min_page_size;
-+ return (uintptr_t) sp / _pd_min_page_size;
- }
-
- static int pd_cache_index(uintptr_t sp_page) {
diff --git a/java/jdk15/files/patch-hotspot::i486::vm::templateTable_i486.cpp b/java/jdk15/files/patch-hotspot::i486::vm::templateTable_i486.cpp
deleted file mode 100644
index 5dbc0e85eb84..000000000000
--- a/java/jdk15/files/patch-hotspot::i486::vm::templateTable_i486.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
---- ../../hotspot/src/cpu/i486/vm/templateTable_i486.cpp.orig Tue Oct 19 14:41:33 2004
-+++ ../../hotspot/src/cpu/i486/vm/templateTable_i486.cpp Thu May 24 19:53:09 2007
-@@ -2987,7 +2987,7 @@
- // initialize object header only.
- __ bind(initialize_header);
- __ movl(Address(eax, oopDesc::mark_offset_in_bytes ()),
-- (int)markOopDesc::prototype()); // header
-+ (intptr_t) markOopDesc::prototype()); // header
- __ popl(ecx); // get saved klass back in the register.
- __ movl(Address(eax, oopDesc::klass_offset_in_bytes()), ecx); // klass
- __ jmp(done);
diff --git a/java/jdk15/files/patch-hotspot::share::vm::bytecodeTracer.cpp b/java/jdk15/files/patch-hotspot::share::vm::bytecodeTracer.cpp
deleted file mode 100644
index e98f0b8563ae..000000000000
--- a/java/jdk15/files/patch-hotspot::share::vm::bytecodeTracer.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
---- ../../hotspot/src/share/vm/interpreter/bytecodeTracer.cpp.orig Tue Oct 19 14:42:10 2004
-+++ ../../hotspot/src/share/vm/interpreter/bytecodeTracer.cpp Thu May 24 17:28:49 2007
-@@ -51,7 +51,11 @@
- // Note 1: This code will not work as expected with true MT/MP.
- // Need an explicit lock or a different solution.
- tty->cr();
-+#if defined(_ALLBSD_SOURCE)
-+ tty->print("[%ld] ", (intptr_t) Thread::current()->osthread()->thread_id());
-+#else
- tty->print("[%d] ", (int) Thread::current()->osthread()->thread_id());
-+#endif
- method->print_name(tty);
- tty->cr();
- _current_method = method();
-@@ -64,7 +68,11 @@
- code = Bytecodes::cast(*bcp);
- }
- int bci = bcp - method->code_base();
-+#if defined(_ALLBSD_SOURCE)
-+ tty->print("[%ld] ", (intptr_t) Thread::current()->osthread()->thread_id());
-+#else
- tty->print("[%d] ", (int) Thread::current()->osthread()->thread_id());
-+#endif
- if (Verbose) {
- tty->print("%8d %4d " INTPTR_FORMAT " " INTPTR_FORMAT " %s",
- BytecodeCounter::counter_value(), bci, tos, tos2, Bytecodes::name(code));
diff --git a/java/jdk15/files/patch-j2se::common::Defs-bsd.gmk b/java/jdk15/files/patch-j2se::common::Defs-bsd.gmk
index c7530004bd26..772486e9dbf2 100644
--- a/java/jdk15/files/patch-j2se::common::Defs-bsd.gmk
+++ b/java/jdk15/files/patch-j2se::common::Defs-bsd.gmk
@@ -20,17 +20,3 @@ $FreeBSD$
override OPENWIN_LIB = $(OPENWIN_HOME)/lib
override OTHER_M4FLAGS = -DGNU_ASSEMBLER
override SUN_CMM_SUBDIR =
-@@ -463,10 +463,10 @@
- # Motif settings
- #
- # XXX: OpenBSD confirm static motif still causes issues - truk
--ifeq ($(TRUE_PLATFORM), OpenBSD)
--STATIC_MOTIF=false
--else
-+ifeq ($(TRUE_PLATFORM), NetBSD)
- STATIC_MOTIF=true
-+else
-+STATIC_MOTIF=false
- endif
- LIBM=-lm
-
diff --git a/java/jdk15/files/patch-j2se::jar::main.cpp b/java/jdk15/files/patch-j2se::jar::main.cpp
deleted file mode 100644
index 99b0ae464f9e..000000000000
--- a/java/jdk15/files/patch-j2se::jar::main.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
---- ../../j2se/src/share/native/com/sun/java/util/jar/pack/main.cpp.orig Tue Oct 19 14:59:48 2004
-+++ ../../j2se/src/share/native/com/sun/java/util/jar/pack/main.cpp Thu May 24 18:46:10 2007
-@@ -17,7 +17,11 @@
-
- #if defined(unix) && !defined(PRODUCT)
- #include "pthread.h"
-+#if defined(_ALLBSD_SOURCE)
-+#define THREAD_SELF ((jlong)pthread_self())
-+#else
- #define THREAD_SELF ((int)pthread_self())
-+#endif
- #endif
-
- #include "defines.h"
diff --git a/java/jdk15/files/patch-j2se::jdbc::Makefile b/java/jdk15/files/patch-j2se::jdbc::Makefile
deleted file mode 100644
index 030e39449e8b..000000000000
--- a/java/jdk15/files/patch-j2se::jdbc::Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
---- ../../j2se/make/sun/jdbc/Makefile.orig Thu May 24 15:27:43 2007
-+++ ../../j2se/make/sun/jdbc/Makefile Thu May 24 18:28:12 2007
-@@ -89,10 +89,10 @@
- make_libs: $(TMPDIR)/libodbcinst.so $(TMPDIR)/libodbc.so
-
- $(TMPDIR)/libodbcinst.so: dummyodbc.c $(TMPDIR)
-- $(CC) -shared -o $@ $<
-+ $(CC) -shared -fPIC -o $@ $<
-
- $(TMPDIR)/libodbc.so: dummyodbc.c $(TMPDIR)
-- $(CC) -shared -o $@ $<
-+ $(CC) -shared -fPIC -o $@ $<
-
- clean::
- $(RM) -f $(TMPDIR)/libodbcinst.so $(TMPDIR)/libodbc.so
diff --git a/java/jdk15/files/patch-j2se::nio::genCharsetProvider.sh b/java/jdk15/files/patch-j2se::nio::genCharsetProvider.sh
index fd6137cab922..abee9b6194fe 100644
--- a/java/jdk15/files/patch-j2se::nio::genCharsetProvider.sh
+++ b/java/jdk15/files/patch-j2se::nio::genCharsetProvider.sh
@@ -6,12 +6,12 @@ $FreeBSD$
}
'
--$JAVA -cp $TMPDIR Hasher -i Aliases <$TMPDIR/aliases >>$OUT
--$JAVA -cp $TMPDIR Hasher -i Classes <$TMPDIR/classes >>$OUT
--$JAVA -cp $TMPDIR Hasher -i -e Cache -t Charset <$TMPDIR/classes >>$OUT
-+$JAVA -cp $TMPDIR Hasher -i Aliases <$TMPDIR/aliases | egrep -v '^Java Hotspot' >>$OUT
-+$JAVA -cp $TMPDIR Hasher -i Classes <$TMPDIR/classes | egrep -v '^Java Hotspot' >>$OUT
-+$JAVA -cp $TMPDIR Hasher -i -e Cache -t Charset <$TMPDIR/classes | egrep -v '^Java Hotspot' >>$OUT
+-$JAVA -cp $NIO_TMPDIR Hasher -i Aliases <$NIO_TMPDIR/aliases >>$OUT
+-$JAVA -cp $NIO_TMPDIR Hasher -i Classes <$NIO_TMPDIR/classes >>$OUT
+-$JAVA -cp $NIO_TMPDIR Hasher -i -e Cache -t Charset <$NIO_TMPDIR/classes >>$OUT
++$JAVA -cp $NIO_TMPDIR Hasher -i Aliases <$NIO_TMPDIR/aliases | egrep -v '^Java Hotspot' >>$OUT
++$JAVA -cp $NIO_TMPDIR Hasher -i Classes <$NIO_TMPDIR/classes | egrep -v '^Java Hotspot' >>$OUT
++$JAVA -cp $NIO_TMPDIR Hasher -i -e Cache -t Charset <$NIO_TMPDIR/classes | egrep -v '^Java Hotspot' >>$OUT
# Constructor
diff --git a/java/jdk15/files/patch-vm::os_bsd.cpp b/java/jdk15/files/patch-vm::os_bsd.cpp
index 25bd71db866c..1add61fe9496 100644
--- a/java/jdk15/files/patch-vm::os_bsd.cpp
+++ b/java/jdk15/files/patch-vm::os_bsd.cpp
@@ -1,13 +1,13 @@
$FreeBSD$
---- ../../hotspot/src/os/bsd/vm/os_bsd.cpp.orig Tue Jan 27 17:54:28 2004
-+++ ../../hotspot/src/os/bsd/vm/os_bsd.cpp Tue Jan 27 17:55:21 2004
-@@ -333,7 +333,7 @@
- #define malloc(n) (char*)NEW_C_HEAP_ARRAY(char, (n))
+--- ../../hotspot/src/os/bsd/vm/os_bsd.cpp Sun Jun 3 18:46:31 2007
++++ ../../hotspot/src/os/bsd/vm/os_bsd.cpp.orig Sun Jun 3 18:47:28 2007
+@@ -499,7 +499,7 @@
#define getenv(n) ::getenv(n)
+ #ifndef DEFAULT_LD_LIBRARY_PATH
-#define DEFAULT_LD_LIBRARY_PATH "/usr/lib" /* See ld.so.1(1) */
+#define DEFAULT_LD_LIBRARY_PATH "/usr/lib:%%LOCALBASE%%/lib" /* See ld.so.1(1) */
+ #endif
#define EXTENSIONS_DIR "/lib/ext"
#define ENDORSED_DIR "/lib/endorsed"
-
diff --git a/java/jdk15/files/pkg-install.in b/java/jdk15/files/pkg-install.in
index c5f4a70db1df..919b658cf5e8 100644
--- a/java/jdk15/files/pkg-install.in
+++ b/java/jdk15/files/pkg-install.in
@@ -55,3 +55,197 @@ if [ "$2" = "POST-INSTALL" ]; then
exit 0
fi
+
+# Pre-install section
+
+# License agreement
+more << EOF_LICENSE
+JAVA RESEARCH LICENSE
+Version 1.6
+
+
+I. DEFINITIONS.
+
+"Licensee" means You and any other party that has entered into and has
+in effect a version of this License.
+
+"Modifications" means any change or addition to the Technology.
+
+"Sun" means Sun Microsystems, Inc. and its successors and assignees.
+
+"Research Use" means research, evaluation, or development for the
+purpose of advancing knowledge, teaching, learning, or customizing the
+Technology or Modifications for personal use. Research Use expressly
+excludes use or distribution for direct or indirect commercial
+(including strategic) gain or advantage.
+
+"Technology" means the source code and object code of the technology
+made available by Sun pursuant to this License.
+
+"Technology Site" means the website designated by Sun for accessing
+the Technology.
+
+"You" means the individual executing this License or the legal entity
+or entities represented by the individual executing this License.
+
+II. PURPOSE.
+
+Sun is licensing the Technology under this Java Research License (the
+"License") to promote research, education, innovation, and development
+using the Technology. This License is not intended to permit or
+enable access to the Technology for active consultation as part of
+creating an independent implementation of the Technology.
+
+COMMERCIAL USE AND DISTRIBUTION OF TECHNOLOGY AND MODIFICATIONS IS
+PERMITTED ONLY UNDER A SUN COMMERCIAL LICENSE.
+
+III. RESEARCH USE RIGHTS.
+
+A. License Grant. Subject to the conditions contained herein, Sun
+grants to You a non-exclusive, non-transferable, worldwide, and
+royalty-free license to do the following for Your Research Use only:
+
+1. Reproduce, create Modifications of, and use the Technology
+alone, or with Modifications;
+
+2. Share source code of the Technology alone, or with
+Modifications, with other Licensees; and
+
+3. Distribute object code of the Technology, alone, or with
+Modifications, to any third parties for Research Use only, under a
+license of Your choice that is consistent with this License; and
+publish papers and books discussing the Technology which may include
+relevant excerpts that do not in the aggregate constitute a
+significant portion of the Technology.
+
+B. Residual Rights. If You examine the Technology after accepting
+this License and remember anything about it later, You are not
+"tainted" in a way that would prevent You from creating or
+contributing to an independent implementation, but this License grants
+You no rights to Sun's copyrights or patents for use in such an
+implementation.
+
+C. No Implied Licenses. Other than the rights granted herein, Sun
+retains all rights, title, and interest in Technology, and You retain
+all rights, title, and interest in Your Modifications and associated
+specifications, subject to the terms of this License.
+
+D. Third Party Software. Portions of the Technology may be
+provided with licenses or other notices from third parties that govern
+the use of those portions. Any licenses granted hereunder do not alter
+any rights and obligations You may have under such licenses, however,
+the disclaimer of warranty and limitation of liability provisions in
+this License will apply to all Technology in this distribution.
+
+IV. INTELLECTUAL PROPERTY REQUIREMENTS
+
+As a condition to Your License, You agree to comply with the following
+restrictions and responsibilities:
+
+A. License and Copyright Notices. You must include a copy of this
+Java Research License in a Readme file for any Technology or
+Modifications you distribute. You must also include the following
+statement, "Use and distribution of this technology is subject to the
+Java Research License included herein", (a) once prominently in the
+source code tree and/or specifications for Your source code
+distributions, and (b) once in the same file as Your copyright or
+proprietary notices for Your binary code distributions. You must cause
+any files containing Your Modification to carry prominent notice
+stating that You changed the files. You must not remove or alter any
+copyright or other proprietary notices in the Technology.
+
+B. Licensee Exchanges. Any Technology and Modifications You
+receive from any Licensee are governed by this License.
+
+V. GENERAL TERMS.
+
+A. Disclaimer Of Warranties.
+
+THE TECHNOLOGY IS PROVIDED "AS IS", WITHOUT WARRANTIES OF ANY KIND,
+EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, WARRANTIES
+THAT THE TECHNOLOGY IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A
+PARTICULAR PURPOSE, OR NON-INFRINGING OF THIRD PARTY RIGHTS. YOU
+AGREE THAT YOU BEAR THE ENTIRE RISK IN CONNECTION WITH YOUR USE AND
+DISTRIBUTION OF ANY AND ALL TECHNOLOGY UNDER THIS LICENSE.
+
+B. Infringement; Limitation Of Liability.
+
+1. If any portion of, or functionality implemented by, the
+Technology becomes the subject of a claim or threatened claim of
+infringement ("Affected Materials"), Sun may, in its unrestricted
+discretion, suspend Your rights to use and distribute the Affected
+Materials under this License. Such suspension of rights will be
+effective immediately upon Sun's posting of notice of suspension on
+the Technology Site.
+
+2. IN NO EVENT WILL SUN BE LIABLE FOR ANY DIRECT, INDIRECT,
+PUNITIVE, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES IN CONNECTION
+WITH OR ARISING OUT OF THIS LICENSE (INCLUDING, WITHOUT LIMITATION,
+LOSS OF PROFITS, USE, DATA, OR ECONOMIC ADVANTAGE OF ANY SORT),
+HOWEVER IT ARISES AND ON ANY THEORY OF LIABILITY (including
+negligence), WHETHER OR NOT SUN HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE. LIABILITY UNDER THIS SECTION V.B.2 SHALL BE SO LIMITED
+AND EXCLUDED, NOTWITHSTANDING FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+REMEDY.
+
+C. Termination.
+
+1. You may terminate this License at any time by notifying Sun in a
+writing addressed to Sun Microsystems, Inc., 4150 Network Circle,
+Santa Clara, California 95054, Attn.: Legal Department/Products and
+Technology Law.
+
+2. All Your rights will terminate under this License if You fail to
+comply with any of its material terms or conditions and do not cure
+such failure within thirty (30) days after becoming aware of such
+noncompliance.
+
+3. Upon termination, You must discontinue all uses and distribution
+under this agreement, and all provisions of this Section V ("General
+Terms") shall survive termination.
+
+D. Miscellaneous.
+
+
+1. Trademark. You agree to comply with Sun's Trademark & Logo
+Usage Requirements, as modified from time to time, available at
+http://www.sun.com/policies/trademarks/. Except as expressly provided
+in this License, You are granted no rights in or to any Sun trademarks
+now or hereafter used or licensed by Sun.
+
+2. Integration. This License represents the complete agreement of
+the parties concerning the subject matter hereof.
+
+3. Severability. If any provision of this License is held
+unenforceable, such provision shall be reformed to the extent
+necessary to make it enforceable unless to do so would defeat the
+intent of the parties, in which case, this License shall terminate.
+
+4. Governing Law. This License is governed by the laws of the
+United States and the State of California, as applied to contracts
+entered into and performed in California between California residents.
+In no event shall this License be construed against the drafter.
+
+5. Export Control. As further described at
+http://www.sun.com/its, you agree to comply with the U.S. export
+controls and trade laws of other countries that apply to Technology
+and Modifications.
+
+EOF_LICENSE
+
+agreed=
+while [ x$agreed = x ]; do
+ echo
+ echo "Do you agree to the above license terms? [yes or no] "
+ read reply leftover
+ case $reply in
+ y* | Y*)
+ agreed=1
+ ;;
+ n* | n*)
+ echo
+ echo "If you don't agree to the license you can't build this software"
+ exit 1
+ ;;
+ esac
+done
diff --git a/java/jdk15/files/x_x2zip.c b/java/jdk15/files/x_x2zip.c
new file mode 100644
index 000000000000..a57be47fc9bf
--- /dev/null
+++ b/java/jdk15/files/x_x2zip.c
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2007 Greg Lewis. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#ifndef BUFSIZ
+#define BUFSIZ 0x10000
+#endif
+
+int
+main(int argc, char* argv[]) {
+ char *key;
+ char *oname;
+ char buf[BUFSIZ];
+ size_t keylen, olen;
+ int ifd, ofd, i, fileoff = 0, bufoff = 0, buflen = 0, eof = 0;
+ ssize_t bytes;
+
+ if (argc < 3) {
+ errx(1, "Usage: x_x2zip <key> <file>");
+ }
+
+ // Key
+ key = argv[1];
+ keylen = strlen(key);
+
+ // Open input file
+ if ((ifd = open(argv[2], O_RDONLY)) == -1) {
+ err(1, "Can't open input file %s", argv[2]);
+ }
+
+ // Open output file
+ olen = strlen(argv[2]) + 5;
+ if ((oname = (char *) malloc(olen)) == NULL) {
+ err(1, "Can't create output file name");
+ }
+ if (strlcpy(oname, argv[2], olen) >= olen) {
+ err(1, "Can't create output file name");
+ }
+ if (strlcat(oname, ".zip", olen) >= olen) {
+ err(1, "Can't create output file name");
+ }
+ if ((ofd = open(oname,
+ O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR)) == -1) {
+ err(1, "Can't open output file %s", oname);
+ }
+ free(oname);
+
+ while (!eof) {
+ // Read into the buffer
+ bufoff = 0;
+ buflen = 0;
+ while (1) {
+ if (buflen >= BUFSIZ) {
+ break;
+ }
+ if ((bytes = read(ifd, buf, BUFSIZ - buflen)) == -1) {
+ err(1, "Error reading input file");
+ }
+ if (!bytes) {
+ eof = 1;
+ break;
+ }
+ buflen += bytes;
+ }
+
+ // Decrypt
+ for (i = 0; i < buflen; i++) {
+ buf[i] = buf[i] ^ key[(fileoff + i) % keylen];
+ }
+
+ // Update file offset
+ fileoff += buflen;
+
+ // Output the buffer
+ bufoff = 0;
+ while (bufoff < buflen) {
+ if ((bytes = write(ofd, buf + bufoff, buflen - bufoff)) == -1) {
+ err(1, "Error writing output file");
+ }
+ bufoff += bytes;
+ }
+ }
+
+ return 0;
+}