From afd2d451096c70ef5f9dd130d8bcacda71e74f28 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 4 Jan 2011 19:17:02 +0000 Subject: Add Infozip to toolchain (patches shamelessly stolen from the GCCSDK autobuilder) svn path=/toolchains/; revision=11194 --- arm-unknown-riscos/Makefile | 20 ++- .../recipes/patches/infozip/globals.p | 13 ++ arm-unknown-riscos/recipes/patches/infozip/zip.p | 58 ++++++++ arm-unknown-riscos/recipes/patches/infozip/zipup.p | 162 +++++++++++++++++++++ 4 files changed, 252 insertions(+), 1 deletion(-) create mode 100644 arm-unknown-riscos/recipes/patches/infozip/globals.p create mode 100644 arm-unknown-riscos/recipes/patches/infozip/zip.p create mode 100644 arm-unknown-riscos/recipes/patches/infozip/zipup.p (limited to 'arm-unknown-riscos') diff --git a/arm-unknown-riscos/Makefile b/arm-unknown-riscos/Makefile index 1afaabd..7b34b4e 100644 --- a/arm-unknown-riscos/Makefile +++ b/arm-unknown-riscos/Makefile @@ -18,6 +18,11 @@ UPSTREAM_MAKERUN_VERSION := 11186 UPSTREAM_MAKERUN_TARBALL := makerun UPSTREAM_MAKERUN_URI := svn://svn.netsurf-browser.org/trunk/tools/makerun@$(UPSTREAM_MAKERUN_VERSION) +# Infozip +UPSTREAM_INFOZIP_VERSION := 30 +UPSTREAM_INFOZIP_TARBALL := zip$(UPSTREAM_INFOZIP_VERSION).tgz +UPSTREAM_INFOZIP_URI := ftp://ftp.info-zip.org/pub/infozip/src/$(UPSTREAM_INFOZIP_TARBALL) + TOP := $(CURDIR) RECIPES := $(TOP)/recipes BUILDSTEPS := $(TOP)/build-steps @@ -28,7 +33,7 @@ PREFIX ?= /opt/netsurf/$(TARGET_NAME) .PHONY: all clean distclean all: $(BUILDSTEPS)/buildsteps.d $(BUILDSTEPS)/gcc.d $(BUILDSTEPS)/oslib.d \ - $(BUILDSTEPS)/ccres.d $(BUILDSTEPS)/makerun.d + $(BUILDSTEPS)/ccres.d $(BUILDSTEPS)/makerun.d $(BUILDSTEPS)/infozip.d clean: cd gcc4 && make clean @@ -37,6 +42,7 @@ distclean: clean rm -fr $(UPSTREAM_GCCSDK_TARBALL) rm -fr $(UPSTREAM_OSLIB_TARBALL) rm -fr $(UPSTREAM_CCRES_TARBALL) + rm -fr $(UPSTREAM_INFOZIP_TARBALL) zip$(UPSTREAM_INFOZIP_VERSION) rm -fr $(BUILDSTEPS) # Buildsteps @@ -67,6 +73,15 @@ $(BUILDSTEPS)/makerun.d: $(BUILDSTEPS)/buildsteps.d $(UPSTREAM_MAKERUN_TARBALL) cd $(UPSTREAM_MAKERUN_TARBALL) && GCCSDK_INSTALL_CROSSBIN=$(PREFIX)/cross/bin make install touch $@ +# Infozip +$(BUILDSTEPS)/infozip.d: $(BUILDSTEPS)/buildsteps.d $(UPSTREAM_INFOZIP_TARBALL) + tar xzf $(UPSTREAM_INFOZIP_TARBALL) + for p in `ls $(RECIPES)/patches/infozip/*.p` ; do patch -d zip$(UPSTREAM_INFOZIP_VERSION) -p0 <$$p ; done + cd zip$(UPSTREAM_INFOZIP_VERSION) && make -f unix/Makefile generic LOCAL_ZIP=-DFORRISCOS + cp zip$(UPSTREAM_INFOZIP_VERSION)/zip $(PREFIX)/cross/bin/zip + ln -fs $(PREFIX)/cross/bin/zip $(PREFIX)/env/bin/zip + touch $@ + ### # Rules to fetch upstream sources ### @@ -82,3 +97,6 @@ $(UPSTREAM_CCRES_TARBALL): $(UPSTREAM_MAKERUN_TARBALL): svn co $(UPSTREAM_MAKERUN_URI) $@ + +$(UPSTREAM_INFOZIP_TARBALL): + wget -q -O $@ $(UPSTREAM_INFOZIP_URI) diff --git a/arm-unknown-riscos/recipes/patches/infozip/globals.p b/arm-unknown-riscos/recipes/patches/infozip/globals.p new file mode 100644 index 0000000..c10adfa --- /dev/null +++ b/arm-unknown-riscos/recipes/patches/infozip/globals.p @@ -0,0 +1,13 @@ +--- globals.c.orig 2005-03-20 12:32:02.000000000 -0800 ++++ globals.c 2008-01-12 22:45:07.000000000 -0800 +@@ -30,6 +30,10 @@ + int pathput = 1; /* 1=store path with name */ + #ifdef RISCOS + int scanimage = 1; /* 1=scan through image files */ ++#else ++#ifdef FORRISCOS ++int decomma = 0; ++#endif + #endif + int method = BEST; /* one of BEST, DEFLATE (only), or STORE (only) */ + int dosify = 0; /* 1=make new entries look like MSDOS */ diff --git a/arm-unknown-riscos/recipes/patches/infozip/zip.p b/arm-unknown-riscos/recipes/patches/infozip/zip.p new file mode 100644 index 0000000..aee2b24 --- /dev/null +++ b/arm-unknown-riscos/recipes/patches/infozip/zip.p @@ -0,0 +1,58 @@ +--- zip.c.orig 2009-05-07 11:54:09.000000000 +0100 ++++ zip.c 2009-05-07 11:53:08.000000000 +0100 +@@ -668,6 +668,9 @@ + ," -h2 show more help -I don't scan thru Image files" + #else + ," -h2 show more help" ++#ifdef FORRISCOS ++," -, strip ,xxx from filename and convert to RISCOS filetype encoding" ++#endif + #endif + #endif /* ?MACOS */ + #ifdef VMS +@@ -1144,6 +1147,9 @@ + #if CRYPT && defined(PASSWD_FROM_STDIN) + "PASSWD_FROM_STDIN", + #endif /* CRYPT & PASSWD_FROM_STDIN */ ++#ifdef FORRISCOS ++ "FORRISCOS", ++#endif + NULL + }; + +@@ -2109,6 +2115,9 @@ + #ifdef RISCOS + {"/", "exts-to-swap", o_REQUIRED_VALUE, o_NOT_NEGATABLE, '/', "override Zip$Exts"}, + #endif ++#ifdef FORRISCOS ++ {",", "strip-type", o_NO_VALUE, o_NOT_NEGATABLE, ',', "strip ,xxx extension"}, ++#endif + /* the end of the list */ + {NULL, NULL, o_NO_VALUE, o_NOT_NEGATABLE, 0, NULL} /* end has option_ID = 0 */ + }; +@@ -2847,6 +2856,12 @@ + case 'I': /* Don't scan through Image files */ + scanimage = 0; + break; ++#else ++#ifdef FORRISCOS ++ case ',': /* Convert ,xxx to RISC OS extended filetype info */ ++ decomma = 1; ++ break; ++#endif + #endif + #ifdef MACOS + case o_jj: /* store absolute path including volname */ +--- zip.h.org 2008-01-12 22:56:51.000000000 -0800 ++++ zip.h 2008-01-12 23:00:05.000000000 -0800 +@@ -323,6 +323,10 @@ + + #ifdef RISCOS + extern int scanimage; /* Scan through image files */ ++#else ++#ifdef FORRISCOS ++extern int decomma; /* Convert ,xxx filename to RISC OS filetype info */ ++#endif + #endif + + #define BEST -1 /* Use best method (deflation or store) */ diff --git a/arm-unknown-riscos/recipes/patches/infozip/zipup.p b/arm-unknown-riscos/recipes/patches/infozip/zipup.p new file mode 100644 index 0000000..f4d43d0 --- /dev/null +++ b/arm-unknown-riscos/recipes/patches/infozip/zipup.p @@ -0,0 +1,162 @@ +--- zipup.c.orig 2008-01-12 22:29:14.000000000 -0800 ++++ zipup.c 2008-01-12 22:36:00.000000000 -0800 +@@ -139,6 +139,9 @@ + #else + local int filetypes OF((char *, char *)); + #endif ++#ifdef FORRISCOS ++ local int set_extra_field_forriscos OF((struct zlist far *z, iztimes *z_utim)); ++#endif + local unsigned file_read OF((char *buf, unsigned size)); + #ifdef USE_ZLIB + local int zl_deflate_init OF((int pack_level)); +@@ -379,7 +382,133 @@ + } + #endif /* ?RISCOS */ + ++#ifdef FORRISCOS ++ ++int set_extra_field_forriscos(z, z_utim) ++ struct zlist far *z; ++ iztimes *z_utim; ++{ ++#ifdef USE_EF_UT_TIME ++ char *eb_ptr; ++#endif /* USE_EF_UT_TIME */ ++ char *cptr; ++ char *extra_block; ++ unsigned int addr; ++ unsigned int ftype = 0xfff; /* Untyped files default to 'text' */ ++ unsigned timlo; /* 3 lower bytes of acorn file-time plus carry byte */ ++ unsigned timhi; /* 2 high bytes of acorn file-time */ ++ ++#define EB_SPARK_LEN 20 ++#define EB_SPARK_SIZE (EB_HEADSIZE+EB_SPARK_LEN) ++#ifdef USE_EF_UT_TIME ++# ifdef IZ_CHECK_TZ ++# define EB_UTTIME_SIZE (zp_tz_is_valid ? EB_HEADSIZE+EB_UT_LEN(1) : 0) ++# else ++# define EB_UTTIME_SIZE (EB_HEADSIZE+EB_UT_LEN(1)) ++# endif ++#else ++# define EB_UTTIME_SIZE 0 ++#endif ++#define EF_SPARK_TOTALSIZE (EB_SPARK_SIZE + EB_UTTIME_SIZE) ++ ++ cptr=strrchr(z->iname, (int) ','); ++ if (cptr) ++ if ((cptr - z->iname) != (int)(strlen(z->iname)-4)) ++ cptr = NULL; /* There was a comma, but it wasn't a ,xxx at the end! */ ++ ++ if (cptr) ++ { ++ *cptr='\0'; /* Chop the filename at the comma */ ++ ++ ftype = strtol(cptr+1, NULL, 16); /* read the ,xxx as hex filetype */ ++ } ++ else ++ { ++ /* When there is no given filetype, but there is a full stop in the name, ++ then it is better to let the unzip utility in RISC OS do a MimeMap lookup ++ instead, and therefore do nothing here */ ++ if (strchr(z->iname, '.')) ++ return ZE_OK; ++ } ++ ++ z->extra=(char *)malloc(EF_SPARK_TOTALSIZE); ++ if (z->extra==NULL) { ++ fprintf(stderr," set_extra_field_forriscos: not enough memory\n"); ++ return ZE_MEM; ++ } ++ z->cextra = z->extra; ++ z->cext = z->ext = EF_SPARK_TOTALSIZE; ++ ++ timlo = ((unsigned)z_utim->mtime & 0x00ffffffU) * 100 + 0x00996a00U; ++ timhi = ((unsigned)z_utim->mtime >> 24); ++ timhi = timhi * 100 + 0x0000336eU + (timlo >> 24); ++ ++ extra_block=z->extra; ++ /* ID */ ++ extra_block[0]='A'; ++ extra_block[1]='C'; ++ ++ /* size */ ++ extra_block[2]=(char)(EB_SPARK_LEN); ++ extra_block[3]=(char)(EB_SPARK_LEN)>>8; ++ ++ /* ID_2 */ ++ extra_block[4]='A'; ++ extra_block[5]='R'; ++ extra_block[6]='C'; ++ extra_block[7]='0'; ++ ++ /* Load address */ ++ addr=0xfff00000 | (ftype << 8); /* This file is typed, and has filetype 'ftype' */ ++ addr|= ((timhi >> 8) & 0xffU); ++ extra_block[8]=(char)(addr); ++ extra_block[9]=(char)(addr>>8); ++ extra_block[10]=(char)(addr>>16); ++ extra_block[11]=(char)(addr>>24); ++ ++ /* Exec address */ ++ addr=(timlo & 0x00ffffffU) | ((timhi & 0x000000ffU) << 24); ++ extra_block[12]=(char)(addr); ++ extra_block[13]=(char)(addr>>8); ++ extra_block[14]=(char)(addr>>16); ++ extra_block[15]=(char)(addr>>24); ++ ++ /* Attributes */ ++ extra_block[16]=0x13; /* Private read/write, no public access, unlocked */ ++ extra_block[17]=0; ++ extra_block[18]=0; ++ extra_block[19]=0; ++ ++ /* Zero */ ++ extra_block[20]=0; ++ extra_block[21]=0; ++ extra_block[22]=0; ++ extra_block[23]=0; ++ ++#ifdef USE_EF_UT_TIME ++# ifdef IZ_CHECK_TZ ++ if (zp_tz_is_valid) { ++# endif ++ eb_ptr = z->extra + EB_SPARK_SIZE; ++ ++ eb_ptr[0] = 'U'; ++ eb_ptr[1] = 'T'; ++ eb_ptr[2] = EB_UT_LEN(1); /* length of data part of e.f. */ ++ eb_ptr[3] = 0; ++ eb_ptr[4] = EB_UT_FL_MTIME; ++ eb_ptr[5] = (char)(z_utim->mtime); ++ eb_ptr[6] = (char)(z_utim->mtime >> 8); ++ eb_ptr[7] = (char)(z_utim->mtime >> 16); ++ eb_ptr[8] = (char)(z_utim->mtime >> 24); ++# ifdef IZ_CHECK_TZ ++ } ++# endif ++#endif /* USE_EF_UT_TIME */ ++ ++ return ZE_OK; ++} + ++#endif /* FORRISCOS */ + + /* Note: a zip "entry" includes a local header (which includes the file + name), an encryption header if encrypting, the compressed data +@@ -552,6 +681,15 @@ + #if !(defined(VMS) && defined(VMS_PK_EXTRA)) + if (extra_fields) { + /* create extra field and change z->att and z->atx if desired */ ++#ifdef FORRISCOS ++ if (decomma) ++ { ++ /* If we're making a zip for RISC OS, we don't bother with any other */ ++ /* OS-Specific info (although we could - but there's no point!) */ ++ set_extra_field_forriscos(z, &f_utim); ++ } ++ else ++#endif + set_extra_field(z, &f_utim); + # ifdef QLZIP + if(qlflag) -- cgit v1.2.3