diff options
author | Waldemar Brodkorb <wbx@openadk.org> | 2014-04-13 17:18:15 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2014-04-13 17:18:15 +0200 |
commit | 64d6047788b6201a9b026a6841dd25f8d0a0d00b (patch) | |
tree | 95aafc346b70447f7dd2829f83f59d8df15d4d58 /package | |
parent | d5aed1c97f81f422af91c1bd4d7994dc54beabe1 (diff) | |
parent | 7297ef1c47935fb17e49cac8379908e631763566 (diff) |
Merge branch 'master' of git+ssh://openadk.org/git/openadk
Diffstat (limited to 'package')
521 files changed, 30065 insertions, 2681 deletions
diff --git a/package/Makefile b/package/Makefile index 1b8cc97f3..c2b7d5285 100644 --- a/package/Makefile +++ b/package/Makefile @@ -28,11 +28,13 @@ include $(TOPDIR)/package/Depends.mk DOWNLOAD:=$(patsubst %,%-download,$(package-y) $(package-m)) REBUILD_PACKAGES:=$(patsubst %,%-rebuild,$(package-y) $(package-m)) COMPILE_PACKAGES:=$(patsubst %,%-compile,$(package-y) $(package-m)) +HOST_COMPILE_PACKAGES:=$(patsubst %,%-host-compile,$(hostpackage-y)) INSTALL_PACKAGES:=$(patsubst %,%-install,$(package-y)) all: compile download: $(DOWNLOAD) clean: $(patsubst %,%-clean,$(package-) $(package-y) $(package-m) base-files) +hostcompile: $(HOST_COMPILE_PACKAGES) ifeq ($(ADK_TOOLCHAIN_ONLY),y) compile: $(REBUILD_PACKAGES) $(COMPILE_PACKAGES) install: $(INSTALL_PACKAGES) diff --git a/package/adk-helper/Makefile b/package/adk-helper/Makefile new file mode 100644 index 000000000..d386bd508 --- /dev/null +++ b/package/adk-helper/Makefile @@ -0,0 +1,33 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include ${TOPDIR}/rules.mk + +PKG_NAME:= adk-helper +PKG_VERSION:= 1.0 +PKG_RELEASE:= 1 +PKG_DESCR:= adk helper utilities +PKG_SECTION:= misc + +PKG_CFLINE_ADK_HELPER:= depends on ADK_HOST_ONLY + +NO_DISTFILES:= 1 + +include ${TOPDIR}/mk/host.mk +include ${TOPDIR}/mk/package.mk + +$(eval $(call HOST_template,ADK_HELPER,adk-helper,${PKG_VERSION}-${PKG_RELEASE})) + +HOST_STYLE:= manual + +host-build: + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o ${WRKBUILD}/mkcrypt ${WRKBUILD}/mkcrypt.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o ${WRKBUILD}/dkgetsz ${WRKBUILD}/dkgetsz.c + +adk-helper-hostinstall: + ${INSTALL_DIR} ${STAGING_HOST_DIR}/usr/bin + ${INSTALL_BIN} ${WRKBUILD}/mkcrypt ${STAGING_HOST_DIR}/usr/bin + ${INSTALL_BIN} ${WRKBUILD}/dkgetsz ${STAGING_HOST_DIR}/usr/bin + +include ${TOPDIR}/mk/host-bottom.mk +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/adk-helper/src/dkgetsz.c b/package/adk-helper/src/dkgetsz.c new file mode 100644 index 000000000..b8315be70 --- /dev/null +++ b/package/adk-helper/src/dkgetsz.c @@ -0,0 +1,95 @@ +/*- + * Copyright © 2010 + * Waldemar Brodkorb <wbx@openadk.org> + * Thorsten Glaser <tg@mirbsd.org> + * + * Provided that these terms and disclaimer and all copyright notices + * are retained or reproduced in an accompanying document, permission + * is granted to deal in this work without restriction, including un‐ + * limited rights to use, publicly perform, distribute, sell, modify, + * merge, give away, or sublicence. + * + * This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to + * the utmost extent permitted by applicable law, neither express nor + * implied; without malicious intent or gross negligence. In no event + * may a licensor, author or contributor be held liable for indirect, + * direct, other damage, loss, or other issues arising in any way out + * of dealing in the work, even if advised of the possibility of such + * damage or existence of a defect, except proven that it results out + * of said person’s immediate fault when using the work as intended. + * + * Alternatively, this work may be distributed under the terms of the + * General Public License, any version, as published by the Free Soft- + * ware Foundation. + *- + * Display the size of a block device (e.g. USB stick, CF/SF/MMC card + * or hard disc) in 512-byte sectors. + */ + +#define _FILE_OFFSET_BITS 64 + +#include <sys/param.h> +#include <sys/types.h> +#include <sys/ioctl.h> +#include <sys/mount.h> + +#if defined(__APPLE__) +#include <sys/disk.h> +#endif + +#if defined(DIOCGDINFO) +#include <sys/disklabel.h> +#endif + +#include <err.h> +#include <fcntl.h> +#include <stdio.h> +#include <unistd.h> + +unsigned long long numsecs(int); + +int +main(int argc, char *argv[]) { + int fd; + + if (argc != 2) + errx(255, "Syntax: dkgetsz /dev/sda"); + + if ((fd = open(argv[1], O_RDONLY)) == -1) + err(1, "open"); + printf("%llu\n", numsecs(fd)); + close(fd); + return (0); +} + +unsigned long long +numsecs(int fd) +{ +#if defined(BLKGETSIZE) || defined(DKIOCGETBLOCKCOUNT) +/* + * note: BLKGETSIZE64 returns bytes, not sectors, but the return + * type is size_t which is 32 bits on an ILP32 platform, so it + * fails interestingly here… thus we use BLKGETSIZE instead. + */ +#if defined(DKIOCGETBLOCKCOUNT) + uint64_t nsecs; +#define THEIOCTL DKIOCGETBLOCKCOUNT +#define STRIOCTL "DKIOCGETBLOCKCOUNT" +#else + unsigned long nsecs; +#define THEIOCTL BLKGETSIZE +#define STRIOCTL "BLKGETSIZE" +#endif + if (ioctl(fd, THEIOCTL, &nsecs) == -1) + err(1, "ioctl %s", STRIOCTL); + return ((unsigned long long)nsecs); +#elif defined(DIOCGDINFO) + struct disklabel dl; + + if (ioctl(fd, DIOCGDINFO, &dl) == -1) + err(1, "ioctl DIOCGDINFO"); + return ((unsigned long long)dl.d_secperunit); +#else +#warning PLEASE DO IMPLEMENT numsecs FOR THIS PLATFORM. +#endif +} diff --git a/package/adk-helper/src/mkcrypt.c b/package/adk-helper/src/mkcrypt.c new file mode 100644 index 000000000..a856759df --- /dev/null +++ b/package/adk-helper/src/mkcrypt.c @@ -0,0 +1,441 @@ +/*- + * Copyright (c) 2007 + * Thorsten Glaser <tg@mirbsd.de> + * + * Provided that these terms and disclaimer and all copyright notices + * are retained or reproduced in an accompanying document, permission + * is granted to deal in this work without restriction, including un- + * limited rights to use, publicly perform, distribute, sell, modify, + * merge, give away, or sublicence. + * + * Advertising materials mentioning features or use of this work must + * display the following acknowledgement: + * This product includes material provided by Thorsten Glaser. + * This product includes software developed by Niels Provos. + * + * This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to + * the utmost extent permitted by applicable law, neither express nor + * implied; without malicious intent or gross negligence. In no event + * may a licensor, author or contributor be held liable for indirect, + * direct, other damage, loss, or other issues arising in any way out + * of dealing in the work, even if advised of the possibility of such + * damage or existence of a defect, except proven that it results out + * of said person's immediate fault when using the work as intended. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/types.h> + +#define MD5_BLOCK_LENGTH 64 +#define MD5_DIGEST_LENGTH 16 +#define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_LENGTH * 2 + 1) + +typedef struct MD5Context { + u_int32_t state[4]; + u_int64_t count; + u_int8_t buffer[MD5_BLOCK_LENGTH]; +} MD5_CTX; + +/* low-level MD5 functions from md5c.c */ +void MD5Init(MD5_CTX *); +void MD5Update(MD5_CTX *, const u_int8_t *, size_t); +void MD5Pad(MD5_CTX *); +void MD5Final(u_int8_t [MD5_DIGEST_LENGTH], MD5_CTX *); +void MD5Transform(u_int32_t [4], const u_int8_t [MD5_BLOCK_LENGTH]); + +/* high-level functions from mdXhl.c */ +char *MD5End(MD5_CTX *, char *); +char *MD5File(const char *, char *); +char *MD5FileChunk(const char *, char *, off_t, off_t); +char *MD5Data(const u_int8_t *, size_t, char *); + +void to64(char *, u_int32_t, int); +char *md5crypt(const char *pw, const char *salt); +int pwd_gensalt(char *, int); + +static unsigned char itoa64[] = /* 0 ... 63 => ascii - 64 */ + "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + +void +to64(char *s, u_int32_t v, int n) +{ + while (--n >= 0) { + *s++ = itoa64[v&0x3f]; + v >>= 6; + } +} + +#define PUT_64BIT_LE(cp, value) do { \ + (cp)[7] = (value) >> 56; \ + (cp)[6] = (value) >> 48; \ + (cp)[5] = (value) >> 40; \ + (cp)[4] = (value) >> 32; \ + (cp)[3] = (value) >> 24; \ + (cp)[2] = (value) >> 16; \ + (cp)[1] = (value) >> 8; \ + (cp)[0] = (value); } while (0) + +#define PUT_32BIT_LE(cp, value) do { \ + (cp)[3] = (value) >> 24; \ + (cp)[2] = (value) >> 16; \ + (cp)[1] = (value) >> 8; \ + (cp)[0] = (value); } while (0) + +static u_int8_t PADDING[MD5_BLOCK_LENGTH] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* + * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious + * initialization constants. + */ +void +MD5Init(MD5_CTX *ctx) +{ + ctx->count = 0; + ctx->state[0] = 0x67452301; + ctx->state[1] = 0xefcdab89; + ctx->state[2] = 0x98badcfe; + ctx->state[3] = 0x10325476; +} + +/* + * Update context to reflect the concatenation of another buffer full + * of bytes. + */ +void +MD5Update(MD5_CTX *ctx, const unsigned char *input, size_t len) +{ + size_t have, need; + + /* Check how many bytes we already have and how many more we need. */ + have = (size_t)((ctx->count >> 3) & (MD5_BLOCK_LENGTH - 1)); + need = MD5_BLOCK_LENGTH - have; + + /* Update bitcount */ + ctx->count += (u_int64_t)len << 3; + + if (len >= need) { + if (have != 0) { + memcpy(ctx->buffer + have, input, need); + MD5Transform(ctx->state, ctx->buffer); + input += need; + len -= need; + have = 0; + } + + /* Process data in MD5_BLOCK_LENGTH-byte chunks. */ + while (len >= MD5_BLOCK_LENGTH) { + MD5Transform(ctx->state, input); + input += MD5_BLOCK_LENGTH; + len -= MD5_BLOCK_LENGTH; + } + } + + /* Handle any remaining bytes of data. */ + if (len != 0) + memcpy(ctx->buffer + have, input, len); +} + +/* + * Pad pad to 64-byte boundary with the bit pattern + * 1 0* (64-bit count of bits processed, MSB-first) + */ +void +MD5Pad(MD5_CTX *ctx) +{ + u_int8_t count[8]; + size_t padlen; + + /* Convert count to 8 bytes in little endian order. */ + PUT_64BIT_LE(count, ctx->count); + + /* Pad out to 56 mod 64. */ + padlen = MD5_BLOCK_LENGTH - + ((ctx->count >> 3) & (MD5_BLOCK_LENGTH - 1)); + if (padlen < 1 + 8) + padlen += MD5_BLOCK_LENGTH; + MD5Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */ + MD5Update(ctx, count, 8); +} + +/* + * Final wrapup--call MD5Pad, fill in digest and zero out ctx. + */ +void +MD5Final(unsigned char digest[MD5_DIGEST_LENGTH], MD5_CTX *ctx) +{ + int i; + + MD5Pad(ctx); + if (digest != NULL) { + for (i = 0; i < 4; i++) + PUT_32BIT_LE(digest + i * 4, ctx->state[i]); + memset(ctx, 0, sizeof(*ctx)); + } +} + + +/* The four core functions - F1 is optimized somewhat */ + +/* #define F1(x, y, z) (x & y | ~x & z) */ +#define F1(x, y, z) (z ^ (x & (y ^ z))) +#define F2(x, y, z) F1(z, x, y) +#define F3(x, y, z) (x ^ y ^ z) +#define F4(x, y, z) (y ^ (x | ~z)) + +/* This is the central step in the MD5 algorithm. */ +#define MD5STEP(f, w, x, y, z, data, s) \ + ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x ) + +/* + * The core of the MD5 algorithm, this alters an existing MD5 hash to + * reflect the addition of 16 longwords of new data. MD5Update blocks + * the data and converts bytes into longwords for this routine. + */ +void +MD5Transform(u_int32_t state[4], const u_int8_t block[MD5_BLOCK_LENGTH]) +{ + u_int32_t a, b, c, d, in[MD5_BLOCK_LENGTH / 4]; + +#if BYTE_ORDER == LITTLE_ENDIAN + memcpy(in, block, sizeof(in)); +#else + for (a = 0; a < MD5_BLOCK_LENGTH / 4; a++) { + in[a] = (u_int32_t)( + (u_int32_t)(block[a * 4 + 0]) | + (u_int32_t)(block[a * 4 + 1]) << 8 | + (u_int32_t)(block[a * 4 + 2]) << 16 | + (u_int32_t)(block[a * 4 + 3]) << 24); + } +#endif + + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + + MD5STEP(F1, a, b, c, d, in[ 0] + 0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, in[ 1] + 0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, in[ 2] + 0x242070db, 17); + MD5STEP(F1, b, c, d, a, in[ 3] + 0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, in[ 4] + 0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, in[ 5] + 0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, in[ 6] + 0xa8304613, 17); + MD5STEP(F1, b, c, d, a, in[ 7] + 0xfd469501, 22); + MD5STEP(F1, a, b, c, d, in[ 8] + 0x698098d8, 7); + MD5STEP(F1, d, a, b, c, in[ 9] + 0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); + MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); + MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); + MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); + + MD5STEP(F2, a, b, c, d, in[ 1] + 0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, in[ 6] + 0xc040b340, 9); + MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, in[ 0] + 0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, in[ 5] + 0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); + MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, in[ 4] + 0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, in[ 9] + 0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, in[ 3] + 0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, in[ 8] + 0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, in[ 2] + 0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, in[ 7] + 0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); + + MD5STEP(F3, a, b, c, d, in[ 5] + 0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, in[ 8] + 0x8771f681, 11); + MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, in[ 1] + 0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, in[ 4] + 0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, in[ 7] + 0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, in[ 0] + 0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, in[ 3] + 0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, in[ 6] + 0x04881d05, 23); + MD5STEP(F3, a, b, c, d, in[ 9] + 0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, in[2 ] + 0xc4ac5665, 23); + + MD5STEP(F4, a, b, c, d, in[ 0] + 0xf4292244, 6); + MD5STEP(F4, d, a, b, c, in[7 ] + 0x432aff97, 10); + MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, in[5 ] + 0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, in[3 ] + 0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, in[1 ] + 0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, in[8 ] + 0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, in[6 ] + 0xa3014314, 15); + MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, in[4 ] + 0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, in[2 ] + 0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, in[9 ] + 0xeb86d391, 21); + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; +} + +/* + * UNIX password + * + * Use MD5 for what it is best at... + */ + +char * +md5crypt(const char *pw, const char *salt) +{ + /* + * This string is magic for this algorithm. Having + * it this way, we can get get better later on + */ + static const unsigned char *magic = (const unsigned char *)"$1$"; + + static char passwd[120], *p; + static const unsigned char *sp,*ep; + unsigned char final[16]; + int sl,pl,i; + MD5_CTX ctx,ctx1; + u_int32_t l; + + /* Refine the Salt first */ + sp = (const unsigned char *)salt; + + /* If it starts with the magic string, then skip that */ + if(!strncmp((const char *)sp,(const char *)magic,strlen((const char *)magic))) + sp += strlen((const char *)magic); + + /* It stops at the first '$', max 8 chars */ + for(ep=sp;*ep && *ep != '$' && ep < (sp+8);ep++) + continue; + + /* get the length of the true salt */ + sl = ep - sp; + + MD5Init(&ctx); + + /* The password first, since that is what is most unknown */ + MD5Update(&ctx,(const unsigned char *)pw,strlen(pw)); + + /* Then our magic string */ + MD5Update(&ctx,magic,strlen((const char *)magic)); + + /* Then the raw salt */ + MD5Update(&ctx,sp,sl); + + /* Then just as many characters of the MD5(pw,salt,pw) */ + MD5Init(&ctx1); + MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw)); + MD5Update(&ctx1,sp,sl); + MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw)); + MD5Final(final,&ctx1); + for(pl = strlen(pw); pl > 0; pl -= 16) + MD5Update(&ctx,final,pl>16 ? 16 : pl); + + /* Don't leave anything around in vm they could use. */ + memset(final,0,sizeof final); + + /* Then something really weird... */ + for (i = strlen(pw); i ; i >>= 1) + if(i&1) + MD5Update(&ctx, final, 1); + else + MD5Update(&ctx, (const unsigned char *)pw, 1); + + /* Now make the output string */ + snprintf(passwd, sizeof(passwd), "%s%.*s$", magic, + sl, (const char *)sp); + + MD5Final(final,&ctx); + + /* + * and now, just to make sure things don't run too fast + * On a 60 Mhz Pentium this takes 34 msec, so you would + * need 30 seconds to build a 1000 entry dictionary... + */ + for(i=0;i<1000;i++) { + MD5Init(&ctx1); + if(i & 1) + MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw)); + else + MD5Update(&ctx1,final,16); + + if(i % 3) + MD5Update(&ctx1,sp,sl); + + if(i % 7) + MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw)); + + if(i & 1) + MD5Update(&ctx1,final,16); + else + MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw)); + MD5Final(final,&ctx1); + } + + p = passwd + strlen(passwd); + + l = (final[ 0]<<16) | (final[ 6]<<8) | final[12]; to64(p,l,4); p += 4; + l = (final[ 1]<<16) | (final[ 7]<<8) | final[13]; to64(p,l,4); p += 4; + l = (final[ 2]<<16) | (final[ 8]<<8) | final[14]; to64(p,l,4); p += 4; + l = (final[ 3]<<16) | (final[ 9]<<8) | final[15]; to64(p,l,4); p += 4; + l = (final[ 4]<<16) | (final[10]<<8) | final[ 5]; to64(p,l,4); p += 4; + l = final[11] ; to64(p,l,2); p += 2; + *p = '\0'; + + /* Don't leave anything around in vm they could use. */ + memset(final, 0, sizeof final); + + return passwd; +} + +int pwd_gensalt(char *salt, int saltlen) { + + *salt = '\0'; + + if (saltlen < 13) { /* $1$8salt$\0 */ + return 0; + } + + strcpy(salt, "$1$"); + to64(&salt[3], random(), 4); + to64(&salt[7], random(), 4); + strcpy(&salt[11], "$"); + return 1; +} + +int main(int argc, char *argv[]) { + char salt[16]; + char *pw; + + if (!argv[1]) { + fprintf(stderr, "Syntax Error!\n"); + return (1); + } + if (!pwd_gensalt(salt, sizeof (salt))) + return (255); + if ((pw = md5crypt(argv[1], salt)) == NULL) { + fprintf(stderr, "Error generating password!\n"); + return (1); + } + printf("%s\n", pw); + return (0); +} diff --git a/package/adk-test-tools/Makefile b/package/adk-test-tools/Makefile index 0a60c5056..80be5a41b 100644 --- a/package/adk-test-tools/Makefile +++ b/package/adk-test-tools/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:= adk-test-tools PKG_VERSION:= 0.1 -PKG_RELEASE:= 3 +PKG_RELEASE:= 6 PKG_DESCR:= helper tools and scripts for adk-test-framework PKG_SECTION:= misc PKG_URL:= http://openadk.org/ diff --git a/package/adk-test-tools/files/test.init b/package/adk-test-tools/files/test.init index bb8fca527..773986dca 100755 --- a/package/adk-test-tools/files/test.init +++ b/package/adk-test-tools/files/test.init @@ -2,7 +2,13 @@ #PKG adk-test-tools #INIT 90 [[ $1 = autostart ]] || exit 0 +echo "Setting time via network ..." +rdate -nv pool.ntp.org echo "Starting test script ..." +grep shell /proc/cmdline > /dev/null 2&>1 +if [ $? -eq 0 ];then + exit 0 +fi if [ -x /run.sh ];then /run.sh quit diff --git a/package/asterisk/Makefile b/package/asterisk/Makefile index 051ad3ea3..e43b4d275 100644 --- a/package/asterisk/Makefile +++ b/package/asterisk/Makefile @@ -105,7 +105,7 @@ TARGET_LDFLAGS+= -lm -ltinfo -ldl -lpthread MAKE_ENV= ASTCFLAGS="${TARGET_CPPFLAGS} -DHAVE_STRTOQ" \ ASTLDFLAGS="${TARGET_LDFLAGS}" MAKE_FLAGS+= DESTDIR="$(WRKINST)" \ - OPTIMIZE="${TARGET_OPTIMIZATION}" \ + OPTIMIZE="${TARGET_CFLAGS}" \ NOISY_BUILD=1 ALL_TARGET:= all install samples diff --git a/package/avahi/Makefile b/package/avahi/Makefile index bd203e79e..a79afbb20 100644 --- a/package/avahi/Makefile +++ b/package/avahi/Makefile @@ -61,7 +61,7 @@ CONFIGURE_ARGS+= --enable-glib \ --with-avahi-user=avahi \ --with-avahi-group=avahi -ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y) +ifeq ($(ADK_TOOLCHAIN_USE_SSP),y) CONFIGURE_ARGS+= --enable-stack-protector else CONFIGURE_ARGS+= --disable-stack-protector diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 0dee1aa94..c9a343d59 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -6,10 +6,9 @@ include $(TOPDIR)/mk/rootfs.mk PKG_NAME:= base-files PKG_VERSION:= 1.0 -PKG_RELEASE:= 74 +PKG_RELEASE:= 82 PKG_SECTION:= base PKG_DESCR:= basic files and scripts -PKG_BUILDDEP:= pkgconf-host file-host WRKDIST= ${WRKDIR}/base-files NO_DISTFILES:= 1 @@ -27,11 +26,19 @@ do-install: ifeq (${ADK_TARGET_ROOTFS_NFSROOT},y) @echo "#" > $(IDIR_BASE_FILES)/etc/network/interfaces endif +ifeq (${ADK_TARGET_PACKAGE_IPKG},y) $(SED) 's,@ARCH@,$(ADK_TARGET_CPU_ARCH),g' $(IDIR_BASE_FILES)/etc/ipkg.conf $(SED) 's,@SYSTEM@,$(ADK_TARGET_SYSTEM),g' $(IDIR_BASE_FILES)/etc/ipkg.conf $(SED) 's,@LIBC@,$(ADK_TARGET_LIBC),g' $(IDIR_BASE_FILES)/etc/ipkg.conf +ifneq ($(ADK_TARGET_ABI),) + $(SED) 's,@ABI@,_$(ADK_TARGET_ABI),g' $(IDIR_BASE_FILES)/etc/ipkg.conf +else + $(SED) 's,@ABI@,,g' $(IDIR_BASE_FILES)/etc/ipkg.conf +endif $(SED) 's,@HOST@,$(ADK_HOST),g' $(IDIR_BASE_FILES)/etc/ipkg.conf $(SED) 's,@VENDOR@,$(ADK_VENDOR),g' $(IDIR_BASE_FILES)/etc/ipkg.conf + mkdir -p $(IDIR_BASE_FILES)/usr/lib/ipkg/lists +endif echo /bin/sh >${IDIR_BASE_FILES}/etc/shells echo /bin/mksh >>${IDIR_BASE_FILES}/etc/shells ifneq (${ADK_PACKAGE_ASH},) @@ -43,14 +50,13 @@ endif ifneq (${ADK_PACKAGE_ZSH},) echo /bin/zsh >>${IDIR_BASE_FILES}/etc/shells endif - mkdir -p $(IDIR_BASE_FILES)/usr/lib/ipkg/lists mkdir -p $(IDIR_BASE_FILES)/etc/crontabs mkdir -p $(IDIR_BASE_FILES)/{dev,boot,root,sys,proc,tmp,mnt} mkdir -p $(IDIR_BASE_FILES)/etc/network/{if-pre-up.d,if-up.d,if-down.d,if-post-down.d} mkdir -p $(IDIR_BASE_FILES)/usr/{lib,bin} - chmod 755 $(IDIR_BASE_FILES)/lib/mdev/init chmod 600 $(IDIR_BASE_FILES)/etc/shadow chmod 600 $(IDIR_BASE_FILES)/etc/network/interfaces + (cd $(IDIR_BASE_FILES)/etc; ln -sf ../tmp/resolv.conf .) chmod 1777 ${IDIR_BASE_FILES}/tmp ln -sf ../proc/mounts $(IDIR_BASE_FILES)/etc/mtab rm -rf $(IDIR_BASE_FILES)/var @@ -61,7 +67,7 @@ endif cat ./files/inittab.vga >> $(IDIR_BASE_FILES)/etc/inittab test -z $(ADK_RUNTIME_GETTY_SERIAL) || \ cat ./files/inittab.serial >> $(IDIR_BASE_FILES)/etc/inittab - $(SED) 's#@DEVICE@#$(ADK_RUNTIME_CONSOLE_SERIAL_DEVICE)#' $(IDIR_BASE_FILES)/etc/inittab + $(SED) 's#@DEVICE@#$(ADK_RUNTIME_CONSOLE_SERIAL_DEVICE)#g' $(IDIR_BASE_FILES)/etc/inittab $(SED) 's#@SPEED@#$(ADK_RUNTIME_CONSOLE_SERIAL_SPEED)#' $(IDIR_BASE_FILES)/etc/inittab test -z $(ADK_RUNTIME_HOSTNAME) || \ echo $(ADK_RUNTIME_HOSTNAME) > $(IDIR_BASE_FILES)/etc/hostname; \ @@ -71,7 +77,8 @@ endif test -z $(ADK_RUNTIME_PASSWORD) || \ $(SED) 's,\*NP\*,'"$$($(STAGING_HOST_DIR)/usr/bin/mkcrypt \ ${ADK_RUNTIME_PASSWORD}),g" $(IDIR_BASE_FILES)/etc/shadow - git log -1|head -1|sed -e 's#commit ##' \ + test -z $(GIT) || \ + $(GIT) log -1|head -1|sed -e 's#commit ##' \ > $(IDIR_BASE_FILES)/etc/adkversion test -z $(ADK_TARGET_SYSTEM) || \ echo $(ADK_TARGET_SYSTEM) > $(IDIR_BASE_FILES)/etc/adktarget @@ -80,23 +87,20 @@ ifneq (${ADK_PACKAGE_CONFIG_IN_ETC},) gzip -9c ${TOPDIR}/.config >$(IDIR_BASE_FILES)/etc/adkconfig.gz chmod 600 $(IDIR_BASE_FILES)/etc/adkconfig.gz endif -ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y) - echo 'export LD_LIBRARY_PATH=/opt/vc/lib' >> $(IDIR_BASE_FILES)/etc/profile -ifneq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI)$(ADK_TARGET_SYSTEM_IBM_X40)$(ADK_TARGET_SYSTEM_LEMOTE_YEELONG),) +ifeq ($(ADK_TARGET_WITH_ROOT_RW),y) echo 'export IPKGTMPDIR=/root/.ipkg' >> $(IDIR_BASE_FILES)/etc/profile else - echo 'export IPKGTMPDIR=/tmp >> $(IDIR_BASE_FILES)/etc/profile + echo 'export IPKGTMPDIR=/tmp' >> $(IDIR_BASE_FILES)/etc/profile endif - +ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y) + echo 'export LD_LIBRARY_PATH=/opt/vc/lib' >> $(IDIR_BASE_FILES)/etc/profile endif # simple network configuration ifneq (${ADK_SIMPLE_NETWORK_CONFIG},) ${INSTALL_DIR} ${IDIR_BASE_FILES}/etc/network - # network config local echo -e "auto lo\niface lo inet loopback" > ${IDIR_BASE_FILES}/etc/network/interfaces - # network config eth0 # configure nic with dhcp ifeq (${SIMPLE_NETWORK_CONFIG_ETH0_TYPE_NIC},y) @@ -123,12 +127,10 @@ ifeq (${SIMPLE_NETWORK_CONFIG_ETH0_TYPE_BRIDGE_IP},y) echo -e " broadcast ${SIMPLE_NETWORK_CONFIG_ETH0_BC}" >> ${IDIR_BASE_FILES}/etc/network/interfaces echo -e " bridge-ports ${SIMPLE_NETWORK_CONFIG_ETH0_BRIDGE}" >> ${IDIR_BASE_FILES}/etc/network/interfaces endif - # network config wlan0 ifeq (${SIMPLE_NETWORK_CONFIG_WLAN0_TYPE_NIC},y) echo -e "\nauto wlan0\niface wlan0 inet dhcp" >> ${IDIR_BASE_FILES}/etc/network/interfaces endif - # network config eth1 # configure nic with dhcp ifeq (${SIMPLE_NETWORK_CONFIG_ETH1_TYPE_NIC},y) @@ -155,13 +157,11 @@ ifeq (${SIMPLE_NETWORK_CONFIG_ETH1_TYPE_BRIDGE_IP},y) echo -e " broadcast ${SIMPLE_NETWORK_CONFIG_ETH1_BC}" >> ${IDIR_BASE_FILES}/etc/network/interfaces echo -e " bridge-ports ${SIMPLE_NETWORK_CONFIG_ETH1_BRIDGE}" >> ${IDIR_BASE_FILES}/etc/network/interfaces endif - # newline at the end of interfaces file echo -en "\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces - # resolver config + rm ${IDIR_BASE_FILES}/etc/resolv.conf echo -e "nameserver ${SIMPLE_NETWORK_CONFIG_RESOLV}" > ${IDIR_BASE_FILES}/etc/resolv.conf endif - include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/base-files/files/inittab.shell b/package/base-files/files/inittab.shell index 55e5e429f..d12593ca1 100644 --- a/package/base-files/files/inittab.shell +++ b/package/base-files/files/inittab.shell @@ -1 +1 @@ -::askfirst:/bin/sh +::askfirst:-/bin/sh diff --git a/package/base-files/src/etc/init.d/boot b/package/base-files/src/etc/init.d/boot index f52e8dc78..291bf6ab4 100644 --- a/package/base-files/src/etc/init.d/boot +++ b/package/base-files/src/etc/init.d/boot @@ -4,10 +4,6 @@ . /etc/functions.sh -if [ -f /proc/sys/kernel/printk ];then - echo 0 > /proc/sys/kernel/printk -fi - # remount /dev with smaller size mount -o remount,nosuid,size=128k,mode=0755 -t tmpfs mdev /dev @@ -19,6 +15,8 @@ mount -o remount,nosuid,nodev,mode=1777,size=${size}k -t tmpfs tmpfs /tmp # start mdev dynamic device node management echo >/dev/mdev.seq echo "/sbin/mdev" >/proc/sys/kernel/hotplug +# creates f.e. /dev/root +mdev -s # seed some random cat /etc/.rnd >/dev/urandom 2>&1 @@ -29,9 +27,9 @@ cat /etc/.rnd >/dev/urandom 2>&1 # create some useful directories in tmpfs mkdir -p /var/log mkdir -p /var/run +mkdir -p /var/tmp touch /var/log/lastlog touch /var/log/wtmp -ln -s /tmp /var/tmp HOSTNAME= [[ -s /etc/hostname ]] && HOSTNAME=$(cat /etc/hostname) diff --git a/package/base-files/src/etc/init.d/fs b/package/base-files/src/etc/init.d/fs index 8f4397897..e995422ee 100644 --- a/package/base-files/src/etc/init.d/fs +++ b/package/base-files/src/etc/init.d/fs @@ -8,46 +8,26 @@ # activate any logical volumes [ -x /usr/sbin/lvm ] && { lvm vgscan; lvm vgchange -ay; } +fstypes="ext2 ext3 ext4 xfs" + # filesystem checks -[ -x /sbin/fsck.ext2 ] && { - for i in $(grep -v "^#" /etc/fstab|grep ext2|awk '{ print $1}');do fsck.ext2 $i;done; -} -[ -x /sbin/fsck.ext3 ] && { - for i in $(grep -v "^#" /etc/fstab|grep ext3|awk '{ print $1}');do fsck.ext3 $i;done; -} -[ -x /sbin/fsck.ext4 ] && { - for i in $(grep -v "^#" /etc/fstab|grep ext4|awk '{ print $1}');do fsck.ext4 $i;done; -} -[ -x /sbin/fsck.xfs ] && { - for i in $(grep -v "^#" /etc/fstab|grep xfs|awk '{ print $1}');do xfs_repair $i;done; -} -# local filesystems -grep ext2 /proc/filesystems >/dev/null 2>&1 -if [ $? -eq 0 ];then - grep -v "^#" /etc/fstab |grep ext2 >/dev/null 2>&1 - if [ $? -eq 0 ];then - mount -a -t ext2 - fi -fi -grep ext3 /proc/filesystems >/dev/null 2>&1 -if [ $? -eq 0 ];then - grep -v "^#" /etc/fstab |grep ext3 >/dev/null 2>&1 - if [ $? -eq 0 ];then - mount -a -t ext3 - fi -fi -grep ext4 /proc/filesystems >/dev/null 2>&1 -if [ $? -eq 0 ];then - grep -v "^#" /etc/fstab |grep ext4 >/dev/null 2>&1 - if [ $? -eq 0 ];then - mount -a -t ext4 - fi -fi -grep xfs /proc/filesystems >/dev/null 2>&1 -if [ $? -eq 0 ];then - grep -v "^#" /etc/fstab |grep xfs >/dev/null 2>&1 +for fs in $fstypes; do + [ -x /usr/sbin/fsck.$fs ] && { + for i in $(grep -v "^#" /etc/fstab|grep $fs|awk '{ print $1}');do + echo "Checking filesystem on $i with $fs" + fsck -p -t $fs $i + done + } +done + +# mount local filesystems +for fs in $fstypes; do + grep $fs /proc/filesystems >/dev/null 2>&1 if [ $? -eq 0 ];then - mount -a -t xfs + grep -v "^#" /etc/fstab |grep $fs >/dev/null 2>&1 + if [ $? -eq 0 ];then + mount -a -t $fs + fi fi -fi +done exit 0 diff --git a/package/base-files/src/etc/inittab b/package/base-files/src/etc/inittab index f6183798e..e2ad18156 100644 --- a/package/base-files/src/etc/inittab +++ b/package/base-files/src/etc/inittab @@ -6,5 +6,5 @@ null::sysinit:/bin/mount -a -t devpts null::sysinit:/bin/mount -a -t tmpfs ::sysinit:/etc/init.d/rcS ::shutdown:/etc/init.d/rcK -null::shutdown:/bin/umount -a -r +null::shutdown:/bin/umount -a -t ext4 null::shutdown:/sbin/swapoff -a diff --git a/package/base-files/src/etc/ipkg.conf b/package/base-files/src/etc/ipkg.conf index cef6d2845..9c5ae17d3 100644 --- a/package/base-files/src/etc/ipkg.conf +++ b/package/base-files/src/etc/ipkg.conf @@ -1,3 +1,3 @@ -src @VENDOR@ http://@HOST@/@SYSTEM@_@ARCH@_@LIBC@/packages +src @VENDOR@ http://@HOST@/pkg/@SYSTEM@_@ARCH@_@LIBC@@ABI@/packages dest root / dest ram /tmp diff --git a/package/base-files/src/etc/mdev.conf b/package/base-files/src/etc/mdev.conf index fc63d80d9..0a24ef04b 100644 --- a/package/base-files/src/etc/mdev.conf +++ b/package/base-files/src/etc/mdev.conf @@ -15,4 +15,3 @@ snd/controlC0 root:audio 660 snd/pcmC0D0c root:audio 660 snd/pcmC0D0p root:audio 660 msr0 root:root 660 @(mkdir -p /dev/cpu/0 && ln -sf /dev/msr0 /dev/cpu/0/msr) -.* 0:0 644 @/lib/mdev/init diff --git a/package/base-files/src/lib/mdev/init b/package/base-files/src/lib/mdev/init deleted file mode 100644 index a478abecd..000000000 --- a/package/base-files/src/lib/mdev/init +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -if [ "$SUBSYSTEM" == "pcmcia_socket" ];then - logger "Setting up PCMCIA socket resource database" - if [ "$ACTION" == "add" ];then - /usr/sbin/pcmcia-socket-startup - fi -fi -if [ "$SUBSYSTEM" == "usb" ];then - if [ "$ACTION" == "add" ];then - if [ "$DEVTYPE" == "usb_device" ];then - if [ "$PRODUCT" == "12d1/1003/0" ];then - if [ ! -f /tmp/.huawei ];then - logger "USB device added with: $PRODUCT" - usbmods=$(lsmod|grep ^usbserial|awk '{ print $4 }'|sed -e 's/,/ /g') - for i in $usbmods;do rmmod $i;done - rmmod usbserial - lsmod >> /tmp/debug - test -x /sbin/huawei && /sbin/huawei >> /tmp/debug - insmod /lib/modules/$(uname -r)/usbserial.ko product=0x1003 vendor=0x12d1 - for i in $usbmods;do insmod /lib/modules/$(uname -r)/$i.ko; done - - touch /tmp/.huawei - fi - fi - fi - fi -fi diff --git a/package/base-files/src/usr/share/udhcpc/default.script b/package/base-files/src/usr/share/udhcpc/default.script index 3744dfb09..55a6655ab 100755 --- a/package/base-files/src/usr/share/udhcpc/default.script +++ b/package/base-files/src/usr/share/udhcpc/default.script @@ -23,16 +23,12 @@ case $1 in ip route add to default via $i done fi - - touch /tmp/resolv.conf - ln -sf /tmp/resolv.conf $RESOLV_CONF echo -n >$RESOLV_CONF ${domain:+echo search $domain} >>$RESOLV_CONF for i in $dns; do echo "adding dns $i" echo "nameserver $i" >>$RESOLV_CONF done - # user rules [ -f /etc/udhcpc.user ] && . /etc/udhcpc.user ;; diff --git a/package/bash/Makefile b/package/bash/Makefile index dc5c5b911..801d5920a 100644 --- a/package/bash/Makefile +++ b/package/bash/Makefile @@ -4,9 +4,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:= bash -PKG_VERSION:= 4.2 -PKG_RELEASE:= 2 -PKG_MD5SUM:= 3fb927c7c33022f1c327f14a81c0d4b0 +PKG_VERSION:= 4.3 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 81348932d5da294953e15d4814c74dd1 PKG_DESCR:= Bourne-Again SHell PKG_SECTION:= shells PKG_URL:= http://www.gnu.org/software/bash/ diff --git a/package/bash/patches/patch-Makefile_in b/package/bash/patches/patch-Makefile_in deleted file mode 100644 index 8e6cfb1ac..000000000 --- a/package/bash/patches/patch-Makefile_in +++ /dev/null @@ -1,13 +0,0 @@ ---- bash-4.2.orig/Makefile.in 2010-12-01 01:22:42.000000000 +0100 -+++ bash-4.2/Makefile.in 2011-03-09 20:03:07.163370779 +0100 -@@ -710,8 +710,8 @@ pathnames.h: Makefile $(srcdir)/pathnam - @${RM} pathnames.tmp - - # comment out for distribution --$(srcdir)/configure: $(srcdir)/configure.in $(srcdir)/aclocal.m4 $(srcdir)/config.h.in -- cd $(srcdir) && autoconf -+#$(srcdir)/configure: $(srcdir)/configure.in $(srcdir)/aclocal.m4 $(srcdir)/config.h.in -+# cd $(srcdir) && autoconf - - # for chet - reconfig: force diff --git a/package/bash/patches/patch-builtins_Makefile_in b/package/bash/patches/patch-builtins_Makefile_in deleted file mode 100644 index 69c175663..000000000 --- a/package/bash/patches/patch-builtins_Makefile_in +++ /dev/null @@ -1,11 +0,0 @@ ---- bash-4.0.orig/builtins/Makefile.in 2009-01-04 20:32:22.000000000 +0100 -+++ bash-4.0/builtins/Makefile.in 2009-10-21 13:17:04.681674304 +0200 -@@ -56,7 +56,7 @@ LIBBUILD = ${BUILD_DIR}/lib - - PROFILE_FLAGS = @PROFILE_FLAGS@ - CFLAGS = @CFLAGS@ --CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ @CROSS_COMPILE@ -+CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ - CPPFLAGS = @CPPFLAGS@ - CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ - LOCAL_CFLAGS = @LOCAL_CFLAGS@ ${DEBUG} diff --git a/package/bc/Makefile b/package/bc/Makefile index 2a5c59900..d35659ed8 100644 --- a/package/bc/Makefile +++ b/package/bc/Makefile @@ -7,7 +7,7 @@ PKG_NAME:= bc PKG_VERSION:= 1.06 PKG_RELEASE:= 1 PKG_MD5SUM:= d44b5dddebd8a7a7309aea6c36fda117 -PKG_DESCR:= An arbitrary precision calculator language +PKG_DESCR:= arbitrary precision calculator language PKG_SECTION:= utils PKG_BUILDDEP:= m4-host flex-host PKG_URL:= http://www.gnu.org/software/bc/ @@ -15,11 +15,15 @@ PKG_SITES:= http://ftp.gnu.org/pub/gnu/bc/ PKG_SUBPKGS:= BC DC +include ${TOPDIR}/mk/host.mk include ${TOPDIR}/mk/package.mk +$(eval $(call HOST_template,BC,bc,${PKG_VERSION}-${PKG_RELEASE})) $(eval $(call PKG_template,BC,bc,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,DC,dc,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +HOST_STYLE:= auto + bc-install: ${INSTALL_DIR} ${IDIR_BC}/usr/bin ${INSTALL_BIN} ${WRKBUILD}/bc/bc ${IDIR_BC}/usr/bin/bc @@ -28,4 +32,5 @@ dc-install: ${INSTALL_DIR} ${IDIR_DC}/usr/bin ${INSTALL_BIN} ${WRKBUILD}/dc/dc ${IDIR_DC}/usr/bin/dc +include ${TOPDIR}/mk/host-bottom.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/bcm2835-bootloader/Makefile b/package/bcm2835-bootloader/Makefile index 8cd28cdd3..b88cd7f08 100644 --- a/package/bcm2835-bootloader/Makefile +++ b/package/bcm2835-bootloader/Makefile @@ -4,11 +4,11 @@ include ${TOPDIR}/rules.mk PKG_NAME:= bcm2835-bootloader -# actually f46e6d9cb9a6bf419fe2a428a8a586239e93aa2d from 07.01.2014 +# actually 9953ce0847c04b587b694c79c5b5a4ac63f5c369 from 25.03.2014 # https://github.com/raspberrypi/firmware -PKG_VERSION:= 0.6 +PKG_VERSION:= 0.7 PKG_RELEASE:= 1 -PKG_MD5SUM:= dba84ce20fc8a8c1bf473758d9350e19 +PKG_MD5SUM:= 7ad7e5d3ad311d88d1e82fc729042d87 PKG_DESCR:= bootloader for raspberry pi (bcm2835) PKG_SECTION:= boot PKG_SITES:= http://openadk.org/distfiles/ diff --git a/package/bcm2835-vc/Makefile b/package/bcm2835-vc/Makefile index e6405bf38..12655228c 100644 --- a/package/bcm2835-vc/Makefile +++ b/package/bcm2835-vc/Makefile @@ -4,11 +4,12 @@ include ${TOPDIR}/rules.mk PKG_NAME:= bcm2835-vc -# actually f65a4eef05ee436976f9be219d3db841d3d6b8ec from 05.10.2013 -PKG_VERSION:= 0.3 -PKG_RELEASE:= 3 -PKG_MD5SUM:= 027d42d1ba803fabdc6bc4ec78d52e67 -PKG_DESCR:= vc tools for raspberry pi (bcm2835) +# actually a8fbe2cd6a3d4455344295809f2e663373ad25cb from 25.03.2014 +# https://github.com/raspberrypi/userland +PKG_VERSION:= 0.4 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 091ae422e05a59ffc2b8908256047b7d +PKG_DESCR:= vc tools and libraries for raspberry pi PKG_SECTION:= base PKG_DEPENDS:= libpthread PKG_BUILDDEP:= cmake-host diff --git a/package/binutils/Makefile b/package/binutils/Makefile index 5734e198d..1a6014607 100644 --- a/package/binutils/Makefile +++ b/package/binutils/Makefile @@ -39,8 +39,8 @@ CONFIGURE_ARGS+= --disable-werror \ # disable honour cflags stuff XAKE_FLAGS+= GCC_HONOUR_COPTS=s -post-build: - $(CP) ${WRKBUILD}/libiberty/libiberty.a $(STAGING_TARGET_DIR)/usr/lib +pre-build: + @-rm $(STAGING_TARGET_DIR)/usr/lib/libiberty.a libbfd-install: ${INSTALL_DIR} ${IDIR_LIBBFD}/usr/lib diff --git a/package/bison/Makefile b/package/bison/Makefile index 02c3ca31f..bae66f25b 100644 --- a/package/bison/Makefile +++ b/package/bison/Makefile @@ -4,18 +4,16 @@ include ${TOPDIR}/rules.mk PKG_NAME:= bison -PKG_VERSION:= 3.0.1 +PKG_VERSION:= 3.0.2 PKG_RELEASE:= 1 -PKG_MD5SUM:= 032a7b7b9f1a6e278ccde73f82cec5c2 -PKG_DESCR:= GNU parser generator +PKG_MD5SUM:= 72c66879187c128d04f4ab7422e8072d +PKG_DESCR:= parser generator PKG_SECTION:= lang PKG_BUILDDEP:= m4-host flex-host bison-host HOST_BUILDDEP:= m4-host flex-host PKG_URL:= http://www.gnu.org/software/bison/ PKG_SITES:= ${MASTER_SITE_GNU:=${PKG_NAME}/} -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.xz - include ${TOPDIR}/mk/host.mk include ${TOPDIR}/mk/package.mk diff --git a/package/busybox/Makefile b/package/busybox/Makefile index c1923708e..6b07623b0 100644 --- a/package/busybox/Makefile +++ b/package/busybox/Makefile @@ -5,10 +5,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:= busybox PKG_VERSION:= 1.21.1 -PKG_RELEASE:= 5 +PKG_RELEASE:= 6 PKG_MD5SUM:= 795394f83903b5eec6567d51eebb417e PKG_DESCR:= core utilities for embedded systems PKG_SECTION:= base +PKG_BUILDDEP:= bzip2-host PKG_URL:= http://www.busybox.net/ PKG_SITES:= http://www.busybox.net/downloads/ @@ -59,6 +60,10 @@ do-build: do-install: $(MAKE) ${BB_MAKE_FLAGS} install $(MAKE_TRACE) $(CP) $(WRKINST)/* $(IDIR_BUSYBOX)/ +ifeq ($(BUSYBOX_IFUPDOWN),y) + $(INSTALL_DIR) $(IDIR_BUSYBOX)/etc/init.d + $(INSTALL_BIN) ./files/network $(IDIR_BUSYBOX)/etc/init.d +endif ifeq ($(ADK_DEBUG),y) ${INSTALL_BIN} $(WRKBUILD)/busybox_unstripped \ $(IDIR_BUSYBOX)/bin/busybox diff --git a/package/busybox/config/miscutils/Config.in b/package/busybox/config/miscutils/Config.in index 4c05e5dae..f13267eac 100644 --- a/package/busybox/config/miscutils/Config.in +++ b/package/busybox/config/miscutils/Config.in @@ -281,7 +281,7 @@ config BUSYBOX_CHRT config BUSYBOX_CROND bool "crond" - default y + default n select BUSYBOX_FEATURE_SYSLOG help Crond is a background daemon that parses individual crontab @@ -301,7 +301,7 @@ config BUSYBOX_FEATURE_CROND_D config BUSYBOX_FEATURE_CROND_CALL_SENDMAIL bool "Report command output via email (using sendmail)" - default y + default n depends on BUSYBOX_CROND help Command output will be sent to corresponding user via email. @@ -747,7 +747,7 @@ config BUSYBOX_WALL config BUSYBOX_WATCHDOG bool "watchdog" - default y + default n depends on !BUSYBOX_DISABLE_WATCHDOG select BUSYBOX_PLATFORM_LINUX help diff --git a/package/busybox/config/networking/Config.in b/package/busybox/config/networking/Config.in index e350a1b16..fa5a7cd47 100644 --- a/package/busybox/config/networking/Config.in +++ b/package/busybox/config/networking/Config.in @@ -748,7 +748,7 @@ config BUSYBOX_NSLOOKUP config BUSYBOX_NTPD bool "ntpd" depends on !BUSYBOX_DISABLE_NTPD - default y + default n select BUSYBOX_PLATFORM_LINUX help The NTP client/server daemon. diff --git a/package/busybox/config/networking/udhcp/Config.in b/package/busybox/config/networking/udhcp/Config.in index 6ece73097..e0f20fc49 100644 --- a/package/busybox/config/networking/udhcp/Config.in +++ b/package/busybox/config/networking/udhcp/Config.in @@ -12,7 +12,7 @@ config BUSYBOX_UDHCPC6 config BUSYBOX_UDHCPD bool "udhcp server (udhcpd)" - default y + default n select BUSYBOX_PLATFORM_LINUX help udhcpd is a DHCP server geared primarily toward embedded systems, diff --git a/package/busybox/files/busybox.postinst b/package/busybox/files/busybox.postinst index c71a536ce..d403ff481 100644 --- a/package/busybox/files/busybox.postinst +++ b/package/busybox/files/busybox.postinst @@ -5,7 +5,8 @@ add_rcconf network network YES add_rcconf crond crond NO add_rcconf watchdog watchdog NO add_rcconf watchdog_flags watchdog_flags '-t 10 -T 20' -add_rcconf 'use "-C32" normally, "NO" to disable' syslogd_flags '-C32' +add_rcconf syslogd NO +add_rcconf 'use "-C32" normally' syslogd_flags '-C32' add_rcconf inetd inetd NO add_rcconf ntpd ntpd NO add_rcconf ntpd_flags ntpd_flags '-p time.fu-berlin.de' diff --git a/package/busybox/files/network.init b/package/busybox/files/network index 4989fcbcb..4989fcbcb 100644 --- a/package/busybox/files/network.init +++ b/package/busybox/files/network diff --git a/package/busybox/files/syslog.init b/package/busybox/files/syslogd.init index 7a85430ca..7a85430ca 100644 --- a/package/busybox/files/syslog.init +++ b/package/busybox/files/syslogd.init diff --git a/package/busybox/files/udhcpd.init b/package/busybox/files/udhcpd.init index f626fb732..edec3ac91 100644 --- a/package/busybox/files/udhcpd.init +++ b/package/busybox/files/udhcpd.init @@ -1,5 +1,5 @@ #!/bin/sh -#PKG udhcpd +#PKG busybox #INIT 50 . /etc/rc.conf diff --git a/package/busybox/patches/001-ipkg.patch b/package/busybox/patches/001-ipkg.patch index 5f392d06b..1b65a5c90 100644 --- a/package/busybox/patches/001-ipkg.patch +++ b/package/busybox/patches/001-ipkg.patch @@ -1,6 +1,6 @@ diff -Nur busybox-1.21.1.orig/archival/Config.src busybox-1.21.1/archival/Config.src --- busybox-1.21.1.orig/archival/Config.src 2013-05-12 01:30:43.000000000 +0200 -+++ busybox-1.21.1/archival/Config.src 2014-02-17 14:25:39.802534016 +0100 ++++ busybox-1.21.1/archival/Config.src 2014-04-07 12:36:32.391575261 +0200 @@ -214,6 +214,12 @@ are actually slower than gzip at equivalent compression ratios and take up 3.2K of code. @@ -16,7 +16,7 @@ diff -Nur busybox-1.21.1.orig/archival/Config.src busybox-1.21.1/archival/Config default y diff -Nur busybox-1.21.1.orig/archival/ipkg.c busybox-1.21.1/archival/ipkg.c --- busybox-1.21.1.orig/archival/ipkg.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/ipkg.c 2014-02-17 14:25:39.802534016 +0100 ++++ busybox-1.21.1/archival/ipkg.c 2014-04-07 12:36:32.391575261 +0200 @@ -0,0 +1,28 @@ +/* ipkg.c - the itsy package management system + @@ -48,7 +48,7 @@ diff -Nur busybox-1.21.1.orig/archival/ipkg.c busybox-1.21.1/archival/ipkg.c +} diff -Nur busybox-1.21.1.orig/archival/Kbuild.src busybox-1.21.1/archival/Kbuild.src --- busybox-1.21.1.orig/archival/Kbuild.src 2013-05-12 01:30:43.000000000 +0200 -+++ busybox-1.21.1/archival/Kbuild.src 2014-02-17 14:25:39.802534016 +0100 ++++ busybox-1.21.1/archival/Kbuild.src 2014-04-07 12:36:32.391575261 +0200 @@ -22,6 +22,7 @@ lib-$(CONFIG_LZOP) += lzop.o bbunzip.o lib-$(CONFIG_GZIP) += gzip.o bbunzip.o @@ -59,7 +59,7 @@ diff -Nur busybox-1.21.1.orig/archival/Kbuild.src busybox-1.21.1/archival/Kbuild lib-$(CONFIG_UNLZMA) += bbunzip.o diff -Nur busybox-1.21.1.orig/archival/libarchive/Kbuild.src busybox-1.21.1/archival/libarchive/Kbuild.src --- busybox-1.21.1.orig/archival/libarchive/Kbuild.src 2013-06-29 16:58:06.000000000 +0200 -+++ busybox-1.21.1/archival/libarchive/Kbuild.src 2014-02-17 14:25:39.802534016 +0100 ++++ busybox-1.21.1/archival/libarchive/Kbuild.src 2014-04-07 12:36:32.391575261 +0200 @@ -25,14 +25,14 @@ \ data_align.o \ @@ -79,7 +79,7 @@ diff -Nur busybox-1.21.1.orig/archival/libarchive/Kbuild.src busybox-1.21.1/arch diff -Nur busybox-1.21.1.orig/archival/libipkg/args.c busybox-1.21.1/archival/libipkg/args.c --- busybox-1.21.1.orig/archival/libipkg/args.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/args.c 2014-02-17 14:25:39.826534090 +0100 ++++ busybox-1.21.1/archival/libipkg/args.c 2014-04-07 12:36:32.391575261 +0200 @@ -0,0 +1,242 @@ +/* args.c - parse command-line args + @@ -325,7 +325,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/args.c busybox-1.21.1/archival/li +} diff -Nur busybox-1.21.1.orig/archival/libipkg/args.h busybox-1.21.1/archival/libipkg/args.h --- busybox-1.21.1.orig/archival/libipkg/args.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/args.h 2014-02-17 14:25:39.826534090 +0100 ++++ busybox-1.21.1/archival/libipkg/args.h 2014-04-07 12:36:32.391575261 +0200 @@ -0,0 +1,72 @@ +/* args.h - parse command-line args + @@ -401,7 +401,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/args.h busybox-1.21.1/archival/li +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/conffile.c busybox-1.21.1/archival/libipkg/conffile.c --- busybox-1.21.1.orig/archival/libipkg/conffile.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/conffile.c 2014-02-17 14:25:39.826534090 +0100 ++++ busybox-1.21.1/archival/libipkg/conffile.c 2014-04-07 12:36:32.391575261 +0200 @@ -0,0 +1,65 @@ +/* conffile.c - the itsy package management system + @@ -470,7 +470,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/conffile.c busybox-1.21.1/archiva +} diff -Nur busybox-1.21.1.orig/archival/libipkg/conffile.h busybox-1.21.1/archival/libipkg/conffile.h --- busybox-1.21.1.orig/archival/libipkg/conffile.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/conffile.h 2014-02-17 14:25:39.826534090 +0100 ++++ busybox-1.21.1/archival/libipkg/conffile.h 2014-04-07 12:36:32.391575261 +0200 @@ -0,0 +1,30 @@ +/* conffile.h - the itsy package management system + @@ -504,7 +504,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/conffile.h busybox-1.21.1/archiva + diff -Nur busybox-1.21.1.orig/archival/libipkg/conffile_list.c busybox-1.21.1/archival/libipkg/conffile_list.c --- busybox-1.21.1.orig/archival/libipkg/conffile_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/conffile_list.c 2014-02-17 14:25:39.850534164 +0100 ++++ busybox-1.21.1/archival/libipkg/conffile_list.c 2014-04-07 12:36:32.391575261 +0200 @@ -0,0 +1,47 @@ +/* conffile_list.c - the itsy package management system + @@ -555,7 +555,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/conffile_list.c busybox-1.21.1/ar + diff -Nur busybox-1.21.1.orig/archival/libipkg/conffile_list.h busybox-1.21.1/archival/libipkg/conffile_list.h --- busybox-1.21.1.orig/archival/libipkg/conffile_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/conffile_list.h 2014-02-17 14:25:39.850534164 +0100 ++++ busybox-1.21.1/archival/libipkg/conffile_list.h 2014-04-07 12:36:32.391575261 +0200 @@ -0,0 +1,36 @@ +/* conffile_list.h - the itsy package management system + @@ -595,7 +595,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/conffile_list.h busybox-1.21.1/ar + diff -Nur busybox-1.21.1.orig/archival/libipkg/file_util.c busybox-1.21.1/archival/libipkg/file_util.c --- busybox-1.21.1.orig/archival/libipkg/file_util.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/file_util.c 2014-02-17 14:25:39.850534164 +0100 ++++ busybox-1.21.1/archival/libipkg/file_util.c 2014-04-07 12:36:32.391575261 +0200 @@ -0,0 +1,186 @@ +/* file_util.c - convenience routines for common stat operations + @@ -785,7 +785,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/file_util.c busybox-1.21.1/archiv + diff -Nur busybox-1.21.1.orig/archival/libipkg/file_util.h busybox-1.21.1/archival/libipkg/file_util.h --- busybox-1.21.1.orig/archival/libipkg/file_util.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/file_util.h 2014-02-17 14:25:39.850534164 +0100 ++++ busybox-1.21.1/archival/libipkg/file_util.h 2014-04-07 12:36:32.391575261 +0200 @@ -0,0 +1,29 @@ +/* file_util.h - convenience routines for common file operations + @@ -818,7 +818,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/file_util.h busybox-1.21.1/archiv +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/hash_table.c busybox-1.21.1/archival/libipkg/hash_table.c --- busybox-1.21.1.orig/archival/libipkg/hash_table.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/hash_table.c 2014-02-17 14:25:39.850534164 +0100 ++++ busybox-1.21.1/archival/libipkg/hash_table.c 2014-04-07 12:36:32.391575261 +0200 @@ -0,0 +1,155 @@ +/* hash.c - hash tables for ipkg + @@ -977,7 +977,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/hash_table.c busybox-1.21.1/archi + diff -Nur busybox-1.21.1.orig/archival/libipkg/hash_table.h busybox-1.21.1/archival/libipkg/hash_table.h --- busybox-1.21.1.orig/archival/libipkg/hash_table.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/hash_table.h 2014-02-17 14:25:39.854534176 +0100 ++++ busybox-1.21.1/archival/libipkg/hash_table.h 2014-04-07 12:36:32.391575261 +0200 @@ -0,0 +1,44 @@ +/* hash.h - hash tables for ipkg + @@ -1025,7 +1025,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/hash_table.h busybox-1.21.1/archi +#endif /* _HASH_TABLE_H_ */ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_cmd.c busybox-1.21.1/archival/libipkg/ipkg_cmd.c --- busybox-1.21.1.orig/archival/libipkg/ipkg_cmd.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_cmd.c 2014-02-17 14:25:39.858534188 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_cmd.c 2014-04-07 12:36:32.411575387 +0200 @@ -0,0 +1,1367 @@ +/* ipkg_cmd.c - the itsy package management system + @@ -2396,7 +2396,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_cmd.c busybox-1.21.1/archiva + diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_cmd.h busybox-1.21.1/archival/libipkg/ipkg_cmd.h --- busybox-1.21.1.orig/archival/libipkg/ipkg_cmd.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_cmd.h 2014-02-17 14:25:39.858534188 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_cmd.h 2014-04-07 12:36:32.411575387 +0200 @@ -0,0 +1,41 @@ +/* ipkg_cmd.h - the itsy package management system + @@ -2441,7 +2441,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_cmd.h busybox-1.21.1/archiva +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_conf.c busybox-1.21.1/archival/libipkg/ipkg_conf.c --- busybox-1.21.1.orig/archival/libipkg/ipkg_conf.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_conf.c 2014-02-17 19:29:30.303924578 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_conf.c 2014-04-07 12:36:32.411575387 +0200 @@ -0,0 +1,739 @@ +/* ipkg_conf.c - the itsy package management system + @@ -3184,7 +3184,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_conf.c busybox-1.21.1/archiv +} diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_conf.h busybox-1.21.1/archival/libipkg/ipkg_conf.h --- busybox-1.21.1.orig/archival/libipkg/ipkg_conf.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_conf.h 2014-02-17 14:25:39.858534188 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_conf.h 2014-04-07 12:36:32.411575387 +0200 @@ -0,0 +1,107 @@ +/* ipkg_conf.h - the itsy package management system + @@ -3295,7 +3295,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_conf.h busybox-1.21.1/archiv +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_configure.c busybox-1.21.1/archival/libipkg/ipkg_configure.c --- busybox-1.21.1.orig/archival/libipkg/ipkg_configure.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_configure.c 2014-02-17 14:25:39.858534188 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_configure.c 2014-04-07 12:36:32.411575387 +0200 @@ -0,0 +1,40 @@ +/* ipkg_configure.c - the itsy package management system + @@ -3339,7 +3339,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_configure.c busybox-1.21.1/a + diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_configure.h busybox-1.21.1/archival/libipkg/ipkg_configure.h --- busybox-1.21.1.orig/archival/libipkg/ipkg_configure.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_configure.h 2014-02-17 14:25:39.858534188 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_configure.h 2014-04-07 12:36:32.411575387 +0200 @@ -0,0 +1,25 @@ +/* ipkg_configure.h - the itsy package management system + @@ -3368,7 +3368,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_configure.h busybox-1.21.1/a +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_download.c busybox-1.21.1/archival/libipkg/ipkg_download.c --- busybox-1.21.1.orig/archival/libipkg/ipkg_download.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_download.c 2014-02-17 14:25:39.858534188 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_download.c 2014-04-07 12:36:32.411575387 +0200 @@ -0,0 +1,195 @@ +/* ipkg_download.c - the itsy package management system + @@ -3567,7 +3567,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_download.c busybox-1.21.1/ar +} diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_download.h busybox-1.21.1/archival/libipkg/ipkg_download.h --- busybox-1.21.1.orig/archival/libipkg/ipkg_download.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_download.h 2014-02-17 14:25:39.858534188 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_download.h 2014-04-07 12:36:32.411575387 +0200 @@ -0,0 +1,30 @@ +/* ipkg_download.h - the itsy package management system + @@ -3601,7 +3601,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_download.h busybox-1.21.1/ar +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg.h busybox-1.21.1/archival/libipkg/ipkg.h --- busybox-1.21.1.orig/archival/libipkg/ipkg.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg.h 2014-02-17 14:25:39.858534188 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg.h 2014-04-07 12:36:32.411575387 +0200 @@ -0,0 +1,68 @@ +/* ipkg.h - the itsy package management system + @@ -3673,7 +3673,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg.h busybox-1.21.1/archival/li +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_includes.h busybox-1.21.1/archival/libipkg/ipkg_includes.h --- busybox-1.21.1.orig/archival/libipkg/ipkg_includes.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_includes.h 2014-02-17 14:25:39.858534188 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_includes.h 2014-04-07 12:36:32.411575387 +0200 @@ -0,0 +1,82 @@ +#ifndef IPKG_INCLUDES_H +#define IPKG_INCLUDES_H @@ -3759,7 +3759,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_includes.h busybox-1.21.1/ar +#endif /* IPKG_INCLUDES_H */ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_install.c busybox-1.21.1/archival/libipkg/ipkg_install.c --- busybox-1.21.1.orig/archival/libipkg/ipkg_install.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_install.c 2014-02-17 14:25:39.858534188 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_install.c 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,1982 @@ +/* ipkg_install.c - the itsy package management system + @@ -5745,7 +5745,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_install.c busybox-1.21.1/arc +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_install.h busybox-1.21.1/archival/libipkg/ipkg_install.h --- busybox-1.21.1.orig/archival/libipkg/ipkg_install.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_install.h 2014-02-17 14:25:39.858534188 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_install.h 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,35 @@ +/* ipkg_install.h - the itsy package management system + @@ -5784,7 +5784,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_install.h busybox-1.21.1/arc +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_message.c busybox-1.21.1/archival/libipkg/ipkg_message.c --- busybox-1.21.1.orig/archival/libipkg/ipkg_message.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_message.c 2014-02-17 14:25:39.858534188 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_message.c 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,35 @@ +/* ipkg_message.c - the itsy package management system + @@ -5823,7 +5823,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_message.c busybox-1.21.1/arc +} diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_message.h busybox-1.21.1/archival/libipkg/ipkg_message.h --- busybox-1.21.1.orig/archival/libipkg/ipkg_message.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_message.h 2014-02-17 14:25:39.858534188 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_message.h 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,32 @@ +/* ipkg_message.h - the itsy package management system + @@ -5859,7 +5859,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_message.h busybox-1.21.1/arc +#endif /* _IPKG_MESSAGE_H_ */ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_remove.c busybox-1.21.1/archival/libipkg/ipkg_remove.c --- busybox-1.21.1.orig/archival/libipkg/ipkg_remove.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_remove.c 2014-02-17 14:25:39.858534188 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_remove.c 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,385 @@ +/* ipkg_remove.c - the itsy package management system + @@ -6248,7 +6248,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_remove.c busybox-1.21.1/arch +} diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_remove.h busybox-1.21.1/archival/libipkg/ipkg_remove.h --- busybox-1.21.1.orig/archival/libipkg/ipkg_remove.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_remove.h 2014-02-17 14:25:39.858534188 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_remove.h 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,33 @@ +/* ipkg_remove.h - the itsy package management system + @@ -6285,7 +6285,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_remove.h busybox-1.21.1/arch +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_upgrade.c busybox-1.21.1/archival/libipkg/ipkg_upgrade.c --- busybox-1.21.1.orig/archival/libipkg/ipkg_upgrade.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_upgrade.c 2014-02-17 14:25:39.858534188 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_upgrade.c 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,79 @@ +/* ipkg_upgrade.c - the itsy package management system + @@ -6368,7 +6368,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_upgrade.c busybox-1.21.1/arc +} diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_upgrade.h busybox-1.21.1/archival/libipkg/ipkg_upgrade.h --- busybox-1.21.1.orig/archival/libipkg/ipkg_upgrade.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_upgrade.h 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_upgrade.h 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,18 @@ +/* ipkg_upgrade.c - the itsy package management system + @@ -6390,7 +6390,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_upgrade.h busybox-1.21.1/arc +int ipkg_upgrade_pkg(ipkg_conf_t *conf, pkg_t *old); diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_utils.c busybox-1.21.1/archival/libipkg/ipkg_utils.c --- busybox-1.21.1.orig/archival/libipkg/ipkg_utils.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_utils.c 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_utils.c 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,185 @@ +/* ipkg_utils.c - the itsy package management system + @@ -6579,7 +6579,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_utils.c busybox-1.21.1/archi + diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_utils.h busybox-1.21.1/archival/libipkg/ipkg_utils.h --- busybox-1.21.1.orig/archival/libipkg/ipkg_utils.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/ipkg_utils.h 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/ipkg_utils.h 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,29 @@ +/* ipkg_utils.h - the itsy package management system + @@ -6612,7 +6612,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/ipkg_utils.h busybox-1.21.1/archi +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/Kbuild busybox-1.21.1/archival/libipkg/Kbuild --- busybox-1.21.1.orig/archival/libipkg/Kbuild 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/Kbuild 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/Kbuild 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,60 @@ +# Makefile for busybox +# @@ -6676,7 +6676,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/Kbuild busybox-1.21.1/archival/li +CFLAGS += -DIPKGLIBDIR="\"/usr/lib\"" -DHOST_CPU_STR="\"$(IPKG_ARCH)\"" diff -Nur busybox-1.21.1.orig/archival/libipkg/libipkg.c busybox-1.21.1/archival/libipkg/libipkg.c --- busybox-1.21.1.orig/archival/libipkg/libipkg.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/libipkg.c 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/libipkg.c 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,583 @@ +/* ipkglib.c - the itsy package management system + @@ -7263,7 +7263,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/libipkg.c busybox-1.21.1/archival +} diff -Nur busybox-1.21.1.orig/archival/libipkg/libipkg.h busybox-1.21.1/archival/libipkg/libipkg.h --- busybox-1.21.1.orig/archival/libipkg/libipkg.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/libipkg.h 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/libipkg.h 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,78 @@ +/* ipkglib.h - the itsy package management system + @@ -7345,7 +7345,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/libipkg.h busybox-1.21.1/archival +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/nv_pair.c busybox-1.21.1/archival/libipkg/nv_pair.c --- busybox-1.21.1.orig/archival/libipkg/nv_pair.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/nv_pair.c 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/nv_pair.c 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,40 @@ +/* nv_pair.c - the itsy package management system + @@ -7389,7 +7389,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/nv_pair.c busybox-1.21.1/archival + diff -Nur busybox-1.21.1.orig/archival/libipkg/nv_pair.h busybox-1.21.1/archival/libipkg/nv_pair.h --- busybox-1.21.1.orig/archival/libipkg/nv_pair.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/nv_pair.h 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/nv_pair.h 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,32 @@ +/* nv_pair.h - the itsy package management system + @@ -7425,7 +7425,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/nv_pair.h busybox-1.21.1/archival + diff -Nur busybox-1.21.1.orig/archival/libipkg/nv_pair_list.c busybox-1.21.1/archival/libipkg/nv_pair_list.c --- busybox-1.21.1.orig/archival/libipkg/nv_pair_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/nv_pair_list.c 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/nv_pair_list.c 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,98 @@ +/* nv_pair_list.c - the itsy package management system + @@ -7527,7 +7527,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/nv_pair_list.c busybox-1.21.1/arc +} diff -Nur busybox-1.21.1.orig/archival/libipkg/nv_pair_list.h busybox-1.21.1/archival/libipkg/nv_pair_list.h --- busybox-1.21.1.orig/archival/libipkg/nv_pair_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/nv_pair_list.h 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/nv_pair_list.h 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,60 @@ +/* nv_pair_list.h - the itsy package management system + @@ -7591,7 +7591,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/nv_pair_list.h busybox-1.21.1/arc + diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg.c busybox-1.21.1/archival/libipkg/pkg.c --- busybox-1.21.1.orig/archival/libipkg/pkg.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg.c 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg.c 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,1757 @@ +/* pkg.c - the itsy package management system + @@ -9352,7 +9352,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg.c busybox-1.21.1/archival/lib +} diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_depends.c busybox-1.21.1/archival/libipkg/pkg_depends.c --- busybox-1.21.1.orig/archival/libipkg/pkg_depends.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_depends.c 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_depends.c 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,1032 @@ +/* pkg_depends.c - the itsy package management system + @@ -10388,7 +10388,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_depends.c busybox-1.21.1/arch +} diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_depends.h busybox-1.21.1/archival/libipkg/pkg_depends.h --- busybox-1.21.1.orig/archival/libipkg/pkg_depends.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_depends.h 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_depends.h 2014-04-07 12:36:32.415575413 +0200 @@ -0,0 +1,105 @@ +/* pkg_depends.h - the itsy package management system + @@ -10497,7 +10497,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_depends.h busybox-1.21.1/arch +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_dest.c busybox-1.21.1/archival/libipkg/pkg_dest.c --- busybox-1.21.1.orig/archival/libipkg/pkg_dest.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_dest.c 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_dest.c 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,92 @@ +/* pkg_dest.c - the itsy package management system + @@ -10593,7 +10593,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_dest.c busybox-1.21.1/archiva +} diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_dest.h busybox-1.21.1/archival/libipkg/pkg_dest.h --- busybox-1.21.1.orig/archival/libipkg/pkg_dest.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_dest.h 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_dest.h 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,38 @@ +/* pkg_dest.h - the itsy package management system + @@ -10635,7 +10635,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_dest.h busybox-1.21.1/archiva + diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_dest_list.c busybox-1.21.1/archival/libipkg/pkg_dest_list.c --- busybox-1.21.1.orig/archival/libipkg/pkg_dest_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_dest_list.c 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_dest_list.c 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,85 @@ +/* pkg_dest_list.c - the itsy package management system + @@ -10724,7 +10724,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_dest_list.c busybox-1.21.1/ar +} diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_dest_list.h busybox-1.21.1/archival/libipkg/pkg_dest_list.h --- busybox-1.21.1.orig/archival/libipkg/pkg_dest_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_dest_list.h 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_dest_list.h 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,50 @@ +/* pkg_dest_list.h - the itsy package management system + @@ -10778,7 +10778,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_dest_list.h busybox-1.21.1/ar + diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_extract.c busybox-1.21.1/archival/libipkg/pkg_extract.c --- busybox-1.21.1.orig/archival/libipkg/pkg_extract.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_extract.c 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_extract.c 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,255 @@ +/* pkg_extract.c - the itsy package management system + @@ -11037,7 +11037,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_extract.c busybox-1.21.1/arch +} diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_extract.h busybox-1.21.1/archival/libipkg/pkg_extract.h --- busybox-1.21.1.orig/archival/libipkg/pkg_extract.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_extract.h 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_extract.h 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,32 @@ +/* pkg_extract.c - the itsy package management system + @@ -11073,7 +11073,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_extract.h busybox-1.21.1/arch +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg.h busybox-1.21.1/archival/libipkg/pkg.h --- busybox-1.21.1.orig/archival/libipkg/pkg.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg.h 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg.h 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,229 @@ +/* pkg.h - the itsy package management system + @@ -11306,7 +11306,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg.h busybox-1.21.1/archival/lib +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_hash.c busybox-1.21.1/archival/libipkg/pkg_hash.c --- busybox-1.21.1.orig/archival/libipkg/pkg_hash.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_hash.c 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_hash.c 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,623 @@ +/* ipkg_hash.c - the itsy package management system + @@ -11933,7 +11933,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_hash.c busybox-1.21.1/archiva + diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_hash.h busybox-1.21.1/archival/libipkg/pkg_hash.h --- busybox-1.21.1.orig/archival/libipkg/pkg_hash.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_hash.h 2014-02-17 14:25:39.862534201 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_hash.h 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,61 @@ +/* pkg_hash.h - the itsy package management system + @@ -11998,7 +11998,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_hash.h busybox-1.21.1/archiva + diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_parse.c busybox-1.21.1/archival/libipkg/pkg_parse.c --- busybox-1.21.1.orig/archival/libipkg/pkg_parse.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_parse.c 2014-02-17 14:25:39.866534213 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_parse.c 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,368 @@ +/* pkg_parse.c - the itsy package management system + @@ -12370,7 +12370,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_parse.c busybox-1.21.1/archiv +} diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_parse.h busybox-1.21.1/archival/libipkg/pkg_parse.h --- busybox-1.21.1.orig/archival/libipkg/pkg_parse.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_parse.h 2014-02-17 14:25:39.866534213 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_parse.h 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,31 @@ +/* pkg_parse.h - the itsy package management system + @@ -12405,7 +12405,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_parse.h busybox-1.21.1/archiv +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_src.c busybox-1.21.1/archival/libipkg/pkg_src.c --- busybox-1.21.1.orig/archival/libipkg/pkg_src.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_src.c 2014-02-17 14:25:39.866534213 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_src.c 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,43 @@ +/* pkg_src.c - the itsy package management system + @@ -12452,7 +12452,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_src.c busybox-1.21.1/archival + diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_src.h busybox-1.21.1/archival/libipkg/pkg_src.h --- busybox-1.21.1.orig/archival/libipkg/pkg_src.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_src.h 2014-02-17 14:25:39.866534213 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_src.h 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,34 @@ +/* pkg_src.h - the itsy package management system + @@ -12490,7 +12490,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_src.h busybox-1.21.1/archival +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_src_list.c busybox-1.21.1/archival/libipkg/pkg_src_list.c --- busybox-1.21.1.orig/archival/libipkg/pkg_src_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_src_list.c 2014-02-17 14:25:39.866534213 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_src_list.c 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,75 @@ +/* pkg_src_list.c - the itsy package management system + @@ -12569,7 +12569,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_src_list.c busybox-1.21.1/arc +} diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_src_list.h busybox-1.21.1/archival/libipkg/pkg_src_list.h --- busybox-1.21.1.orig/archival/libipkg/pkg_src_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_src_list.h 2014-02-17 14:25:39.866534213 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_src_list.h 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,57 @@ +/* pkg_src_list.h - the itsy package management system + @@ -12630,7 +12630,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_src_list.h busybox-1.21.1/arc + diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_vec.c busybox-1.21.1/archival/libipkg/pkg_vec.c --- busybox-1.21.1.orig/archival/libipkg/pkg_vec.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_vec.c 2014-02-17 14:25:39.866534213 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_vec.c 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,231 @@ +/* pkg_vec.c - the itsy package management system + @@ -12865,7 +12865,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_vec.c busybox-1.21.1/archival + diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_vec.h busybox-1.21.1/archival/libipkg/pkg_vec.h --- busybox-1.21.1.orig/archival/libipkg/pkg_vec.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/pkg_vec.h 2014-02-17 14:25:39.866534213 +0100 ++++ busybox-1.21.1/archival/libipkg/pkg_vec.h 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,62 @@ +/* pkg_vec.h - the itsy package management system + @@ -12931,7 +12931,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/pkg_vec.h busybox-1.21.1/archival + diff -Nur busybox-1.21.1.orig/archival/libipkg/sprintf_alloc.h busybox-1.21.1/archival/libipkg/sprintf_alloc.h --- busybox-1.21.1.orig/archival/libipkg/sprintf_alloc.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/sprintf_alloc.h 2014-02-17 14:25:39.866534213 +0100 ++++ busybox-1.21.1/archival/libipkg/sprintf_alloc.h 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,25 @@ +/* sprintf_alloca.c -- like sprintf with memory allocation + @@ -12960,7 +12960,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/sprintf_alloc.h busybox-1.21.1/ar +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/str_list.c busybox-1.21.1/archival/libipkg/str_list.c --- busybox-1.21.1.orig/archival/libipkg/str_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/str_list.c 2014-02-17 14:25:39.866534213 +0100 ++++ busybox-1.21.1/archival/libipkg/str_list.c 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,76 @@ +/* str_list.c - the itsy package management system + @@ -13040,7 +13040,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/str_list.c busybox-1.21.1/archiva +} diff -Nur busybox-1.21.1.orig/archival/libipkg/str_list.h busybox-1.21.1/archival/libipkg/str_list.h --- busybox-1.21.1.orig/archival/libipkg/str_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/str_list.h 2014-02-17 14:25:39.866534213 +0100 ++++ busybox-1.21.1/archival/libipkg/str_list.h 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,51 @@ +/* str_list.h - the itsy package management system + @@ -13095,7 +13095,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/str_list.h busybox-1.21.1/archiva +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/str_util.c busybox-1.21.1/archival/libipkg/str_util.c --- busybox-1.21.1.orig/archival/libipkg/str_util.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/str_util.c 2014-02-17 14:25:39.866534213 +0100 ++++ busybox-1.21.1/archival/libipkg/str_util.c 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,69 @@ +/* str_utils.c - the itsy package management system + @@ -13168,7 +13168,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/str_util.c busybox-1.21.1/archiva + diff -Nur busybox-1.21.1.orig/archival/libipkg/str_util.h busybox-1.21.1/archival/libipkg/str_util.h --- busybox-1.21.1.orig/archival/libipkg/str_util.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/str_util.h 2014-02-17 14:25:39.866534213 +0100 ++++ busybox-1.21.1/archival/libipkg/str_util.h 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,27 @@ +/* str_utils.h - the itsy package management system + @@ -13199,7 +13199,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/str_util.h busybox-1.21.1/archiva +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/user.c busybox-1.21.1/archival/libipkg/user.c --- busybox-1.21.1.orig/archival/libipkg/user.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/user.c 2014-02-17 14:25:39.866534213 +0100 ++++ busybox-1.21.1/archival/libipkg/user.c 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,49 @@ +/* user.c - the itsy package management system + @@ -13252,7 +13252,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/user.c busybox-1.21.1/archival/li +} diff -Nur busybox-1.21.1.orig/archival/libipkg/user.h busybox-1.21.1/archival/libipkg/user.h --- busybox-1.21.1.orig/archival/libipkg/user.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/user.h 2014-02-17 14:25:39.866534213 +0100 ++++ busybox-1.21.1/archival/libipkg/user.h 2014-04-07 12:36:32.419575442 +0200 @@ -0,0 +1,23 @@ +/* user.c - the itsy package management system + @@ -13279,7 +13279,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/user.h busybox-1.21.1/archival/li + diff -Nur busybox-1.21.1.orig/archival/libipkg/void_list.c busybox-1.21.1/archival/libipkg/void_list.c --- busybox-1.21.1.orig/archival/libipkg/void_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/void_list.c 2014-02-17 14:25:39.886534275 +0100 ++++ busybox-1.21.1/archival/libipkg/void_list.c 2014-04-07 12:36:32.423575470 +0200 @@ -0,0 +1,194 @@ +/* void_list.c - the itsy package management system + @@ -13477,7 +13477,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/void_list.c busybox-1.21.1/archiv +} diff -Nur busybox-1.21.1.orig/archival/libipkg/void_list.h busybox-1.21.1/archival/libipkg/void_list.h --- busybox-1.21.1.orig/archival/libipkg/void_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/void_list.h 2014-02-17 14:25:39.886534275 +0100 ++++ busybox-1.21.1/archival/libipkg/void_list.h 2014-04-07 12:36:32.423575470 +0200 @@ -0,0 +1,59 @@ +/* void_list.h - the itsy package management system + @@ -13540,7 +13540,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/void_list.h busybox-1.21.1/archiv +#endif diff -Nur busybox-1.21.1.orig/archival/libipkg/xsystem.c busybox-1.21.1/archival/libipkg/xsystem.c --- busybox-1.21.1.orig/archival/libipkg/xsystem.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/xsystem.c 2014-02-17 14:25:39.886534275 +0100 ++++ busybox-1.21.1/archival/libipkg/xsystem.c 2014-04-07 12:36:32.423575470 +0200 @@ -0,0 +1,64 @@ +/* xsystem.c - system(3) with error messages + @@ -13608,7 +13608,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/xsystem.c busybox-1.21.1/archival + diff -Nur busybox-1.21.1.orig/archival/libipkg/xsystem.h busybox-1.21.1/archival/libipkg/xsystem.h --- busybox-1.21.1.orig/archival/libipkg/xsystem.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.21.1/archival/libipkg/xsystem.h 2014-02-17 14:25:39.890534287 +0100 ++++ busybox-1.21.1/archival/libipkg/xsystem.h 2014-04-07 12:36:32.423575470 +0200 @@ -0,0 +1,34 @@ +/* xsystem.h - system(3) with error messages + @@ -13646,7 +13646,7 @@ diff -Nur busybox-1.21.1.orig/archival/libipkg/xsystem.h busybox-1.21.1/archival + diff -Nur busybox-1.21.1.orig/include/applets.src.h busybox-1.21.1/include/applets.src.h --- busybox-1.21.1.orig/include/applets.src.h 2013-06-29 16:58:06.000000000 +0200 -+++ busybox-1.21.1/include/applets.src.h 2014-02-17 14:25:39.890534287 +0100 ++++ busybox-1.21.1/include/applets.src.h 2014-04-07 12:36:32.423575470 +0200 @@ -199,6 +199,7 @@ IF_IPCALC(APPLET(ipcalc, BB_DIR_BIN, BB_SUID_DROP)) IF_IPCRM(APPLET(ipcrm, BB_DIR_USR_BIN, BB_SUID_DROP)) @@ -13657,17 +13657,22 @@ diff -Nur busybox-1.21.1.orig/include/applets.src.h busybox-1.21.1/include/apple IF_IPRULE(APPLET(iprule, BB_DIR_SBIN, BB_SUID_DROP)) diff -Nur busybox-1.21.1.orig/include/bb_archive.h busybox-1.21.1/include/bb_archive.h --- busybox-1.21.1.orig/include/bb_archive.h 2013-06-29 16:58:06.000000000 +0200 -+++ busybox-1.21.1/include/bb_archive.h 2014-02-17 14:25:39.890534287 +0100 -@@ -79,7 +79,7 @@ ++++ busybox-1.21.1/include/bb_archive.h 2014-04-07 12:37:05.279788781 +0200 +@@ -79,7 +79,6 @@ /* Archiver specific. Can make it a union if it ever gets big */ #define PAX_NEXT_FILE 0 #define PAX_GLOBAL 1 -#if ENABLE_TAR || ENABLE_DPKG || ENABLE_DPKG_DEB -+#if ENABLE_TAR || ENABLE_DPKG || ENABLE_DPKG_DEB || ENABLE_IPKG smallint tar__end; # if ENABLE_FEATURE_TAR_GNU_EXTENSIONS char* tar__longname; -@@ -98,7 +98,7 @@ +@@ -92,13 +91,12 @@ + # if ENABLE_FEATURE_TAR_SELINUX + char* tar__sctx[2]; + # endif +-#endif + #if ENABLE_CPIO || ENABLE_RPM2CPIO || ENABLE_RPM + uoff_t cpio__blocks; struct hardlinks_t *cpio__hardlinks_to_create; struct hardlinks_t *cpio__created_hardlinks; #endif @@ -13678,7 +13683,7 @@ diff -Nur busybox-1.21.1.orig/include/bb_archive.h busybox-1.21.1/include/bb_arc /* How to process any sub archive, e.g. get_header_tar_gz */ diff -Nur busybox-1.21.1.orig/include/usage.src.h busybox-1.21.1/include/usage.src.h --- busybox-1.21.1.orig/include/usage.src.h 2013-05-12 01:30:43.000000000 +0200 -+++ busybox-1.21.1/include/usage.src.h 2014-02-17 14:25:39.890534287 +0100 ++++ busybox-1.21.1/include/usage.src.h 2014-04-07 12:36:32.423575470 +0200 @@ -19,4 +19,80 @@ #define busybox_notes_usage \ "Hello world!\n" @@ -13762,7 +13767,7 @@ diff -Nur busybox-1.21.1.orig/include/usage.src.h busybox-1.21.1/include/usage.s #endif diff -Nur busybox-1.21.1.orig/Makefile busybox-1.21.1/Makefile --- busybox-1.21.1.orig/Makefile 2013-06-29 17:00:18.000000000 +0200 -+++ busybox-1.21.1/Makefile 2014-02-17 14:25:39.890534287 +0100 ++++ busybox-1.21.1/Makefile 2014-04-07 12:36:32.423575470 +0200 @@ -466,6 +466,7 @@ libs-y := \ archival/ \ diff --git a/package/bzip2/Makefile b/package/bzip2/Makefile index 5585ae0c1..c4b6ebe48 100644 --- a/package/bzip2/Makefile +++ b/package/bzip2/Makefile @@ -32,6 +32,7 @@ $(eval $(call PKG_template,BZIP2,bzip2,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPEN $(eval $(call PKG_template,LIBBZ2,libbz2,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_LIBBZ2},${PKGSC_LIBBZ2},${PKG_OPTS})) HOST_STYLE:= manual +HOST_MAKE_FILE:= Makefile MAKE_FILE:= Makefile-libbz2_so CONFIG_STYLE:= manual TARGET_CFLAGS+= -fPIC @@ -39,16 +40,12 @@ XAKE_FLAGS+= PREFIX=${WRKINST}/usr CROSS_COMPILE=1 INSTALL_STYLE:= manual host-build: - (cd ${WRKBUILD} && env ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \ + (cd ${WRKBUILD} && env ${HOST_MAKE_ENV} ${MAKE} -f ${HOST_MAKE_FILE} \ PREFIX=${HOST_WRKINST}/usr ${HOST_ALL_TARGET}) bzip2-hostinstall: - ${INSTALL_DIR} ${STAGING_HOST_DIR}/usr/lib - ${INSTALL_DIR} $(STAGING_HOST_DIR)/usr/include - $(CP) ${WRKBUILD}/libbz2.so* \ - ${STAGING_HOST_DIR}/usr/lib - (cd ${STAGING_HOST_DIR}/usr/lib; ln -sf libbz2.so.1.0.6 libbz2.so) - $(CP) $(WRKBUILD)/bzlib.h $(STAGING_HOST_DIR)/usr/include + ${INSTALL_DIR} ${STAGING_HOST_DIR}/usr/bin + $(INSTALL_BIN) ${WRKBUILD}/bzip2 ${STAGING_HOST_DIR}/usr/bin/bzip2 libbz2-install: ${INSTALL_DIR} ${IDIR_LIBBZ2}/usr/lib diff --git a/package/ccache/Makefile b/package/ccache/Makefile new file mode 100644 index 000000000..c61f1c4d9 --- /dev/null +++ b/package/ccache/Makefile @@ -0,0 +1,24 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include $(TOPDIR)/rules.mk + +PKG_NAME:= ccache +PKG_VERSION:= 3.1.9 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 367916e4ecba4968f77f59a378e61458 +PKG_DESCR:= ccache utility +PKG_SECTION:= misc +PKG_SITES:= http://samba.org/ftp/ccache/ + +PKG_CFLINE_CCACHE:= depends on ADK_HOST_ONLY + +include $(TOPDIR)/mk/host.mk +include $(TOPDIR)/mk/package.mk + +$(eval $(call HOST_template,CCACHE,ccache,$(PKG_VERSION)-${PKG_RELEASE})) + +HOST_STYLE:= auto + +include ${TOPDIR}/mk/host-bottom.mk +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/cdrtools/Makefile b/package/cdrtools/Makefile index 6bf16ab17..612a553bc 100644 --- a/package/cdrtools/Makefile +++ b/package/cdrtools/Makefile @@ -8,28 +8,27 @@ PKG_VERSION:= 3.01 PKG_RELEASE:= 1 PKG_MD5SUM:= afd4563e335a614a11e042c7b6734d66 PKG_DESCR:= cdrtools -PKG_SECTION:= misc +PKG_SECTION:= fs PKG_URL:= http://cdrecord.berlios.de/private/cdrecord.html -PKG_SITES:= http://openadk.org/ +PKG_SITES:= ftp://ftp.berlios.de/pub/cdrecord/ -PKG_CFLINE_CDRTOOLS:= depends on ADK_BROKEN +PKG_CFLINE_CDRTOOLS:= depends on ADK_HOST_ONLY +include $(TOPDIR)/mk/host.mk include $(TOPDIR)/mk/package.mk -$(eval $(call PKG_template,CDRTOOLS,cdrtools,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call HOST_template,CDRTOOLS,cdrtools,$(PKG_VERSION)-${PKG_RELEASE})) -CONFIG_STYLE:= manual -XAKE_FLAGS+= GCC_HONOUR_COPTS=s +HOST_STYLE:= manual -cdrtools-install: - $(INSTALL_DIR) $(IDIR_CDRTOOLS)/usr/bin - $(INSTALL_BIN) $(WRKINST)/opt/schily/bin/cdrecord \ - $(IDIR_CDRTOOLS)/usr/bin - $(INSTALL_BIN) $(WRKINST)/opt/schily/bin/readcd \ - $(IDIR_CDRTOOLS)/usr/bin - $(INSTALL_BIN) $(WRKINST)/opt/schily/bin/mkisofs \ - $(IDIR_CDRTOOLS)/usr/bin - $(INSTALL_BIN) $(WRKINST)/opt/schily/bin/cdda2wav \ - $(IDIR_CDRTOOLS)/usr/bin +host-build: + (cd ${WRKBUILD} && env ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \ + ${HOST_MAKE_FLAGS} ${HOST_ALL_TARGET}) +cdrtools-hostinstall: + $(INSTALL_DIR) $(STAGING_HOST_DIR)/usr/bin + $(INSTALL_BIN) $(WRKBUILD)/mkisofs/OBJ/*/mkisofs \ + $(STAGING_HOST_DIR)/usr/bin + +include ${TOPDIR}/mk/host-bottom.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/cfgfs/Makefile b/package/cfgfs/Makefile index 70b323a76..3d1d41410 100644 --- a/package/cfgfs/Makefile +++ b/package/cfgfs/Makefile @@ -15,7 +15,7 @@ PKG_CFLINE_CFGFS:= select BUSYBOX_DIFF@ PKG_CFLINE_CFGFS+= select BUSYBOX_MD5SUM@ PKG_CFLINE_CFGFS+= select BUSYBOX_XARGS@ PKG_CFLINE_CFGFS+= select BUSYBOX_FEATURE_SORT_BIG@ -PKG_CFLINE_CFGFS+= depends on !ADK_TARGET_ROOTFS_NFSROOT && !ADK_TARGET_ROOTFS_INITRAMFS_PIGGYBACK && !ADK_TARGET_ROOTFS_INITRAMFS && !ADK_TARGET_ROOTFS_JFFS2 && !ADK_TARGET_ROOTFS_SQUASHFS +PKG_CFLINE_CFGFS+= depends on !ADK_TARGET_ROOTFS_NFSROOT && !ADK_TARGET_ROOTFS_INITRAMFS_PIGGYBACK && !ADK_TARGET_ROOTFS_INITRAMFS && !ADK_TARGET_ROOTFS_JFFS2 && !ADK_TARGET_ROOTFS_SQUASHFS && !ADK_TARGET_ROOTFS_ISO PKG_DFLT_CFGFS:= y if !(ADK_TOOLCHAIN_ONLY || ADK_TOOLCHAIN_ARCHIVE || ADK_PKG_TEST) WRKDIST= ${WRKDIR}/${PKG_NAME}-${PKG_VERSION} diff --git a/package/check/Makefile b/package/check/Makefile new file mode 100644 index 000000000..3d7c2fb2b --- /dev/null +++ b/package/check/Makefile @@ -0,0 +1,26 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include $(TOPDIR)/rules.mk + +PKG_NAME:= check +PKG_VERSION:= 0.9.12 +PKG_RELEASE:= 2 +PKG_MD5SUM:= 46fe540d1a03714c7a1967dbc6d484e7 +PKG_DESCR:= unit testing framework for C +PKG_SECTION:= libs +PKG_URL:= http://check.sourceforge.net/ +PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=check/} +PKG_LIBNAME:= libcheck +PKG_OPTS:= dev + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,LIBCHECK,libcheck,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) + +libcheck-install: + $(INSTALL_DIR) $(IDIR_LIBCHECK)/usr/lib + $(CP) $(WRKINST)/usr/lib/libcheck*.so* \ + $(IDIR_LIBCHECK)/usr/lib + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/collectd/Makefile b/package/collectd/Makefile index d37bb30ea..4203aace3 100644 --- a/package/collectd/Makefile +++ b/package/collectd/Makefile @@ -4,10 +4,10 @@ include ${TOPDIR}/rules.mk PKG_NAME:= collectd -PKG_VERSION:= 5.4.0 +PKG_VERSION:= 5.4.1 PKG_RELEASE:= 1 -PKG_MD5SUM:= d4176b3066f3b85d85343d3648ea43f6 -PKG_DESCR:= System statistics collection daemon +PKG_MD5SUM:= 6514ab3f7fd2135d2713f1ab25068841 +PKG_DESCR:= system statistics collection daemon PKG_SECTION:= misc PKG_BUILDDEP:= libtool PKG_DEPENDS:= libpthread libltdl @@ -15,7 +15,7 @@ PKG_URL:= http://collectd.org/ PKG_SITES:= http://collectd.org/files/ PKG_FLAVOURS_COLLECTD:= WITH_CPU WITH_LOAD WITH_MEMORY WITH_PING -PKG_FLAVOURS_COLLECTD+= WITH_RRD +PKG_FLAVOURS_COLLECTD+= WITH_RRD WITH_NETWORK WITH_UPTIME PKGFD_WITH_RRD:= enable RRD output PKGFB_WITH_RRD:= rrdtool PKGFS_WITH_RRD:= librrd @@ -23,6 +23,8 @@ PKGFD_WITH_CPU:= collect CPU statistics PKGFD_WITH_LOAD:= collect system load statistics PKGFD_WITH_MEMORY:= collect memory usage statistics PKGFD_WITH_PING:= enable ping statistic plugin +PKGFD_WITH_NETWORK:= enable network statistic plugin +PKGFD_WITH_UPTIME:= enable uptime statistic plugin include ${TOPDIR}/mk/package.mk @@ -40,6 +42,12 @@ endif ifneq (${ADK_PACKAGE_COLLECTD_WITH_PING},y) DISABLE_PING:=--disable-ping endif +ifneq (${ADK_PACKAGE_COLLECTD_WITH_NETWORK},y) +DISABLE_NETWORK:=--disable-network +endif +ifneq (${ADK_PACKAGE_COLLECTD_WITH_UPTIME},y) +DISABLE_UPTIME:=--disable-uptime +endif CONFIGURE_ARGS+= --disable-aggregation \ --disable-apache \ @@ -75,7 +83,7 @@ CONFIGURE_ARGS+= --disable-aggregation \ ${DISABLE_MEMORY} \ --disable-multimeter \ --disable-mysql \ - --disable-network \ + ${DISABLE_NETWORK} \ --disable-nginx \ --disable-nfs \ --disable-ntpd \ @@ -106,7 +114,7 @@ CONFIGURE_ARGS+= --disable-aggregation \ --disable-thermal \ --disable-unixsock \ --disable-users \ - --disable-uptime \ + ${DISABLE_UPTIME} \ --disable-uuid \ --disable-vserver \ --disable-wireless \ @@ -118,7 +126,6 @@ CONFIGURE_ARGS+= --disable-aggregation \ --without-libiptc \ --with-nan-emulation -TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) XAKE_FLAGS+= LIBS='-lm -lltdl' collectd-install: diff --git a/package/collectd/patches/patch-configure b/package/collectd/patches/patch-configure new file mode 100644 index 000000000..41e8e65c7 --- /dev/null +++ b/package/collectd/patches/patch-configure @@ -0,0 +1,29 @@ +--- collectd-5.4.1.orig/configure 2014-01-26 09:10:00.000000000 +0100 ++++ collectd-5.4.1/configure 2014-04-10 16:56:47.000000000 +0200 +@@ -16812,7 +16812,7 @@ SAVE_CFLAGS="$CFLAGS" + # Emulate behavior of src/Makefile.am + if test "x$GCC" = "xyes" + then +- CFLAGS="$CFLAGS -Wall -Werror" ++ CFLAGS="$CFLAGS -Wall" + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strtok_r" >&5 +@@ -17388,7 +17388,7 @@ done + if test "x$GCC" = "xyes" + then + SAVE_CFLAGS="$CFLAGS" +- CFLAGS="$CFLAGS -Wall -Wextra -Werror" ++ CFLAGS="$CFLAGS -Wall -Wextra" + fi + + for ac_func in strptime +@@ -23057,7 +23057,7 @@ then + SAVE_LDFLAGS="$LDFLAGS" + # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3) + # (see issues #41 and #42) +- CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror" ++ CFLAGS="$CFLAGS $PERL_CFLAGS -Wall" + LDFLAGS="$LDFLAGS $PERL_LDFLAGS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken Perl_load_module()" >&5 diff --git a/package/collectd/patches/patch-src_Makefile_in b/package/collectd/patches/patch-src_Makefile_in new file mode 100644 index 000000000..e35859cfb --- /dev/null +++ b/package/collectd/patches/patch-src_Makefile_in @@ -0,0 +1,11 @@ +--- collectd-5.4.1.orig/src/Makefile.in 2014-01-26 09:09:56.000000000 +0100 ++++ collectd-5.4.1/src/Makefile.in 2014-04-10 19:13:47.000000000 +0200 +@@ -2235,7 +2235,7 @@ top_build_prefix = @top_build_prefix@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + SUBDIRS = libcollectdclient $(am__append_1) +-@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall -Werror ++@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall + AM_CPPFLAGS = -DPREFIX='"${prefix}"' \ + -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"' \ + -DLOCALSTATEDIR='"${localstatedir}"' \ diff --git a/package/conntrack-tools/Makefile b/package/conntrack-tools/Makefile index 1341e8c5b..a33a8c115 100644 --- a/package/conntrack-tools/Makefile +++ b/package/conntrack-tools/Makefile @@ -4,28 +4,35 @@ include $(TOPDIR)/rules.mk PKG_NAME:= conntrack-tools -PKG_VERSION:= 1.4.1 +PKG_VERSION:= 1.4.2 PKG_RELEASE:= 1 -PKG_MD5SUM:= 3cc4703d883c6f07085e29bdc993222b -PKG_DESCR:= Connection tracking userspace tools +PKG_MD5SUM:= b1f9d006e7bf000a77395ff7cd3fac16 +PKG_DESCR:= connection tracking userspace tools PKG_SECTION:= firewall PKG_DEPENDS:= libtirpc libnetfilter_queue libnetfilter-conntrack libnetfilter-cttimeout libnetfilter-cthelper libmnl PKG_BUILDDEP:= libtirpc libnetfilter_queue libnetfilter_conntrack libnetfilter_cttimeout libnetfilter_cthelper libmnl PKG_URL:= http://conntrack-tools.netfilter.org/ PKG_SITES:= http://www.netfilter.org/projects/conntrack-tools/files/ -PKG_LIBC_DEPENDS:= uclibc glibc +PKG_SUBPKGS:= CONNTRACK CONNTRACKD +PKGSD_CONNTRACK:= client utility +PKGSD_CONNTRACKD:= daemon DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 include $(TOPDIR)/mk/package.mk -TARGET_CPPFLAGS+= -I$(STAGING_TARGET_DIR)/usr/include/tirpc +TARGET_CPPFLAGS+= -I$(STAGING_TARGET_DIR)/usr/include/tirpc -D_GNU_SOURCE -$(eval $(call PKG_template,CONNTRACK_TOOLS,conntrack-tools,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call PKG_template,CONNTRACK,conntrack,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_CONNTRACK},${PKG_SECTION})) +$(eval $(call PKG_template,CONNTRACKD,conntrackd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_CONNTRACKD},${PKG_SECTION})) -conntrack-tools-install: - $(INSTALL_DIR) $(IDIR_CONNTRACK_TOOLS)/usr/sbin - $(INSTALL_BIN) $(WRKINST)/usr/sbin/conntrack{,d} $(IDIR_CONNTRACK_TOOLS)/usr/sbin +conntrack-install: + $(INSTALL_DIR) $(IDIR_CONNTRACK)/usr/sbin + $(INSTALL_BIN) $(WRKINST)/usr/sbin/conntrack $(IDIR_CONNTRACK)/usr/sbin + +conntrackd-install: + $(INSTALL_DIR) $(IDIR_CONNTRACKD)/usr/sbin + $(INSTALL_BIN) $(WRKINST)/usr/sbin/conntrackd $(IDIR_CONNTRACKD)/usr/sbin include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/conntrack-tools/patches/patch-include_bitops_h b/package/conntrack-tools/patches/patch-include_bitops_h new file mode 100644 index 000000000..9dfb08e1e --- /dev/null +++ b/package/conntrack-tools/patches/patch-include_bitops_h @@ -0,0 +1,41 @@ +--- conntrack-tools-1.4.2.orig/include/bitops.h 2013-02-24 23:23:57.000000000 +0100 ++++ conntrack-tools-1.4.2/include/bitops.h 2014-04-05 09:39:37.219463608 +0200 +@@ -3,32 +3,32 @@ + + #include <stdlib.h> + +-static inline void set_bit_u32(int nr, u_int32_t *addr) ++static inline void set_bit_u32(int nr, uint32_t *addr) + { + addr[nr >> 5] |= (1UL << (nr & 31)); + } + +-static inline void unset_bit_u32(int nr, u_int32_t *addr) ++static inline void unset_bit_u32(int nr, uint32_t *addr) + { + addr[nr >> 5] &= ~(1UL << (nr & 31)); + } + +-static inline int test_bit_u32(int nr, const u_int32_t *addr) ++static inline int test_bit_u32(int nr, const uint32_t *addr) + { + return ((1UL << (nr & 31)) & (addr[nr >> 5])) != 0; + } + +-static inline void set_bit_u16(int nr, u_int16_t *addr) ++static inline void set_bit_u16(int nr, uint16_t *addr) + { + addr[nr >> 4] |= (1UL << (nr & 15)); + } + +-static inline void unset_bit_u16(int nr, u_int16_t *addr) ++static inline void unset_bit_u16(int nr, uint16_t *addr) + { + addr[nr >> 4] &= ~(1UL << (nr & 15)); + } + +-static inline int test_bit_u16(int nr, const u_int16_t *addr) ++static inline int test_bit_u16(int nr, const uint16_t *addr) + { + return ((1UL << (nr & 15)) & (addr[nr >> 4])) != 0; + } diff --git a/package/conntrack-tools/patches/patch-include_mcast_h b/package/conntrack-tools/patches/patch-include_mcast_h new file mode 100644 index 000000000..0f352ce0c --- /dev/null +++ b/package/conntrack-tools/patches/patch-include_mcast_h @@ -0,0 +1,10 @@ +--- conntrack-tools-1.4.2.orig/include/mcast.h 2013-02-24 23:23:57.000000000 +0100 ++++ conntrack-tools-1.4.2/include/mcast.h 2014-04-05 09:37:11.363340860 +0200 +@@ -2,6 +2,7 @@ + #define _MCAST_H_ + + #include <stdint.h> ++#include <sys/select.h> + #include <netinet/in.h> + #include <net/if.h> + diff --git a/package/conntrack-tools/patches/patch-include_tcp_h b/package/conntrack-tools/patches/patch-include_tcp_h new file mode 100644 index 000000000..4dd4d3202 --- /dev/null +++ b/package/conntrack-tools/patches/patch-include_tcp_h @@ -0,0 +1,10 @@ +--- conntrack-tools-1.4.2.orig/include/tcp.h 2013-02-24 23:23:57.000000000 +0100 ++++ conntrack-tools-1.4.2/include/tcp.h 2014-04-05 09:40:10.923493847 +0200 +@@ -2,6 +2,7 @@ + #define _TCP_H_ + + #include <stdint.h> ++#include <sys/select.h> + #include <netinet/in.h> + + struct tcp_conf { diff --git a/package/conntrack-tools/patches/patch-include_udp_h b/package/conntrack-tools/patches/patch-include_udp_h new file mode 100644 index 000000000..1f28a87fa --- /dev/null +++ b/package/conntrack-tools/patches/patch-include_udp_h @@ -0,0 +1,10 @@ +--- conntrack-tools-1.4.2.orig/include/udp.h 2013-02-24 23:23:57.000000000 +0100 ++++ conntrack-tools-1.4.2/include/udp.h 2014-04-05 09:38:04.015383617 +0200 +@@ -2,6 +2,7 @@ + #define _UDP_H_ + + #include <stdint.h> ++#include <sys/select.h> + #include <netinet/in.h> + + struct udp_conf { diff --git a/package/curl/Makefile b/package/curl/Makefile index 7a03fcd9e..e2661d148 100644 --- a/package/curl/Makefile +++ b/package/curl/Makefile @@ -4,10 +4,10 @@ include ${TOPDIR}/rules.mk PKG_NAME:= curl -PKG_VERSION:= 7.28.0 -PKG_RELEASE:= 2 -PKG_MD5SUM:= cbdc0a79bdf6e657dd387c3d88d802e3 -PKG_DESCR:= a client-side URL transfer tool +PKG_VERSION:= 7.36.0 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 643a7030b27449e76413d501d4b8eb57 +PKG_DESCR:= client-side URL transfer tool PKG_SECTION:= www PKG_DEPENDS:= libcurl PKG_BUILDDEP:= zlib @@ -58,7 +58,6 @@ CONFIGURE_ARGS+= --with-gnutls="${STAGING_TARGET_DIR}/usr" \ --without-axtls endif -TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ENV+= curl_typeof_curl_socklen_t=socklen_t CONFIGURE_ARGS+= --disable-thread \ --enable-cookies \ @@ -67,17 +66,24 @@ CONFIGURE_ARGS+= --disable-thread \ --enable-file \ --enable-ftp \ --enable-http \ + --enable-proxy \ + --disable-symbol-hiding \ --disable-ares \ --disable-dict \ --disable-gopher \ --disable-ldap \ + --disable-smtp \ + --disable-imap \ + --disable-ldaps \ --disable-manual \ --disable-sspi \ --disable-telnet \ --disable-verbose \ + --without-libssh2 \ + --without-librtmp \ + --without-libidn \ --with-random="/dev/urandom" \ - --with-ca-bundle="/etc/ssl/cert.pem" \ - --without-libidn + --with-ca-bundle="/etc/ssl/cert.pem" ifneq (${ADK_PACKAGE_CURL_WITH_IPV6},) CONFIGURE_ARGS+= --enable-ipv6 diff --git a/package/curl/patches/patch-ltmain_sh b/package/curl/patches/patch-ltmain_sh deleted file mode 100644 index 07db5c668..000000000 --- a/package/curl/patches/patch-ltmain_sh +++ /dev/null @@ -1,11 +0,0 @@ ---- curl-7.28.0.orig/ltmain.sh 2012-08-16 19:20:36.000000000 +0200 -+++ curl-7.28.0/ltmain.sh 2012-10-14 14:00:11.000000000 +0200 -@@ -5853,7 +5853,7 @@ func_mode_link () - # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -- -O*|-flto*|-fwhopr*|-fuse-linker-plugin) -+ -O*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - func_append compile_command " $arg" diff --git a/package/curl/patches/patch-src_tool_operate_c b/package/curl/patches/patch-src_tool_operate_c new file mode 100644 index 000000000..eb1a3d52b --- /dev/null +++ b/package/curl/patches/patch-src_tool_operate_c @@ -0,0 +1,13 @@ +--- curl-7.36.0.orig/src/tool_operate.c 2014-03-25 11:36:28.000000000 +0100 ++++ curl-7.36.0/src/tool_operate.c 2014-04-02 14:59:00.000000000 +0200 +@@ -1794,8 +1794,10 @@ CURLcode operate(struct GlobalConfig *co + if(res == PARAM_HELP_REQUESTED) + tool_help(); + /* Check if we were asked for the manual */ ++#ifdef USE_MANUAL + else if(res == PARAM_MANUAL_REQUESTED) + hugehelp(); ++#endif + /* Check if we were asked for the version information */ + else if(res == PARAM_VERSION_INFO_REQUESTED) + tool_version_info(); diff --git a/package/dansguardian/Makefile b/package/dansguardian/Makefile index 711bf0edb..fd7142d5f 100644 --- a/package/dansguardian/Makefile +++ b/package/dansguardian/Makefile @@ -26,7 +26,7 @@ ifeq ($(ADK_COMPILE_DANSGUARDIAN_WITH_UCLIBCXX),y) LIBRARIES:=-nodefaultlibs -luClibc++ -lgcc -lm -lc -lgcc_s endif -ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y) +ifeq ($(ADK_TOOLCHAIN_USE_SSP),y) LIBRARIES+=-lssp endif diff --git a/package/dbus-python/Makefile b/package/dbus-python/Makefile index 9645f7269..b73d43a6c 100644 --- a/package/dbus-python/Makefile +++ b/package/dbus-python/Makefile @@ -14,6 +14,8 @@ PKG_BUILDDEP:= dbus dbus-glib PKG_URL:= http://dbus.freedesktop.org/doc/dbus-python/ PKG_SITES:= http://dbus.freedesktop.org/releases/dbus-python/ +PKG_CFLINE_DBUS_PYTHON:= depends on ADK_BROKEN + include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,DBUS_PYTHON,dbus-python,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/dmidecode/Makefile b/package/dmidecode/Makefile index 8829c91b2..4eb004dc7 100644 --- a/package/dmidecode/Makefile +++ b/package/dmidecode/Makefile @@ -18,7 +18,7 @@ $(eval $(call PKG_template,DMIDECODE,dmidecode,$(PKG_VERSION)-${PKG_RELEASE},${P CONFIG_STYLE:= manual -ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y) +ifeq ($(ADK_TOOLCHAIN_USE_SSP),y) TARGET_LDFLAGS+= -lssp endif diff --git a/package/dosfstools/Makefile b/package/dosfstools/Makefile index 1dd82182a..9292d49f3 100644 --- a/package/dosfstools/Makefile +++ b/package/dosfstools/Makefile @@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk PKG_NAME:= dosfstools PKG_VERSION:= 3.0.26 -PKG_RELEASE:= 2 +PKG_RELEASE:= 3 PKG_MD5SUM:= 45012f5f56f2aae3afcd62120b9e5a08 PKG_DESCR:= utilities to create and check FAT filesystems PKG_SECTION:= fs diff --git a/package/dosfstools/patches/patch-src_boot_c b/package/dosfstools/patches/patch-src_boot_c new file mode 100644 index 000000000..cd2dd927d --- /dev/null +++ b/package/dosfstools/patches/patch-src_boot_c @@ -0,0 +1,77 @@ +--- dosfstools-3.0.26.orig/src/boot.c 2014-01-17 07:06:54.000000000 +0100 ++++ dosfstools-3.0.26/src/boot.c 2014-03-26 13:20:59.000000000 +0100 +@@ -155,7 +155,7 @@ static void check_backup_boot(DOS_FS * f + fs->backupboot_start = bbs * lss; + b->backup_boot = htole16(bbs); + fs_write(fs->backupboot_start, sizeof(*b), b); +- fs_write((loff_t) offsetof(struct boot_sector, backup_boot), ++ fs_write((off_t) offsetof(struct boot_sector, backup_boot), + sizeof(b->backup_boot), &b->backup_boot); + printf("Created backup of boot sector in sector %d\n", bbs); + return; +@@ -233,9 +233,9 @@ static void read_fsinfo(DOS_FS * fs, str + break; + if (s > 0 && s < le16toh(b->reserved)) { + init_fsinfo(&i); +- fs_write((loff_t) s * lss, sizeof(i), &i); ++ fs_write((off_t) s * lss, sizeof(i), &i); + b->info_sector = htole16(s); +- fs_write((loff_t) offsetof(struct boot_sector, info_sector), ++ fs_write((off_t) offsetof(struct boot_sector, info_sector), + sizeof(b->info_sector), &b->info_sector); + if (fs->backupboot_start) + fs_write(fs->backupboot_start + +@@ -327,7 +327,7 @@ void read_boot(DOS_FS * fs) + unsigned total_sectors; + unsigned short logical_sector_size, sectors; + unsigned fat_length; +- loff_t data_size; ++ off_t data_size; + + fs_read(0, sizeof(b), &b); + logical_sector_size = GET_UNALIGNED_W(b.sector_size); +@@ -352,18 +352,18 @@ void read_boot(DOS_FS * fs) + if (verbose) + printf("Checking we can access the last sector of the filesystem\n"); + /* Can't access last odd sector anyway, so round down */ +- fs_test((loff_t) ((total_sectors & ~1) - 1) * (loff_t) logical_sector_size, ++ fs_test((off_t) ((total_sectors & ~1) - 1) * (off_t) logical_sector_size, + logical_sector_size); + fat_length = le16toh(b.fat_length) ? + le16toh(b.fat_length) : le32toh(b.fat32_length); +- fs->fat_start = (loff_t) le16toh(b.reserved) * logical_sector_size; +- fs->root_start = ((loff_t) le16toh(b.reserved) + b.fats * fat_length) * ++ fs->fat_start = (off_t) le16toh(b.reserved) * logical_sector_size; ++ fs->root_start = ((off_t) le16toh(b.reserved) + b.fats * fat_length) * + logical_sector_size; + fs->root_entries = GET_UNALIGNED_W(b.dir_entries); + fs->data_start = fs->root_start + ROUND_TO_MULTIPLE(fs->root_entries << + MSDOS_DIR_BITS, + logical_sector_size); +- data_size = (loff_t) total_sectors *logical_sector_size - fs->data_start; ++ data_size = (off_t) total_sectors *logical_sector_size - fs->data_start; + fs->clusters = data_size / fs->cluster_size; + fs->root_cluster = 0; /* indicates standard, pre-FAT32 root dir */ + fs->fsinfo_start = 0; /* no FSINFO structure */ +@@ -491,10 +491,10 @@ static void write_boot_label(DOS_FS * fs + } + } + +-loff_t find_volume_de(DOS_FS * fs, DIR_ENT * de) ++off_t find_volume_de(DOS_FS * fs, DIR_ENT * de) + { + uint32_t cluster; +- loff_t offset; ++ off_t offset; + int i; + + if (fs->root_cluster) { +@@ -525,7 +525,7 @@ static void write_volume_label(DOS_FS * + { + time_t now = time(NULL); + struct tm *mtime = localtime(&now); +- loff_t offset; ++ off_t offset; + int created; + DIR_ENT de; + diff --git a/package/dosfstools/patches/patch-src_boot_h b/package/dosfstools/patches/patch-src_boot_h new file mode 100644 index 000000000..6ed917b8a --- /dev/null +++ b/package/dosfstools/patches/patch-src_boot_h @@ -0,0 +1,11 @@ +--- dosfstools-3.0.26.orig/src/boot.h 2014-01-17 07:06:55.000000000 +0100 ++++ dosfstools-3.0.26/src/boot.h 2014-03-26 13:29:53.000000000 +0100 +@@ -25,7 +25,7 @@ + + void read_boot(DOS_FS * fs); + void write_label(DOS_FS * fs, char *label); +-loff_t find_volume_de(DOS_FS * fs, DIR_ENT * de); ++off_t find_volume_de(DOS_FS * fs, DIR_ENT * de); + + /* Reads the boot sector from the currently open device and initializes *FS */ + diff --git a/package/dosfstools/patches/patch-src_check_c b/package/dosfstools/patches/patch-src_check_c new file mode 100644 index 000000000..cdfc953fe --- /dev/null +++ b/package/dosfstools/patches/patch-src_check_c @@ -0,0 +1,49 @@ +--- dosfstools-3.0.26.orig/src/check.c 2014-03-07 18:35:11.000000000 +0100 ++++ dosfstools-3.0.26/src/check.c 2014-03-26 10:04:41.000000000 +0100 +@@ -64,7 +64,7 @@ static DOS_FILE *root; + p->dir_ent.start = htole16(__v&0xffff); \ + p->dir_ent.starthi = htole16(__v>>16); \ + __v = htole32(__v); \ +- fs_write((loff_t)offsetof(struct boot_sector,root_cluster), \ ++ fs_write((off_t)offsetof(struct boot_sector,root_cluster), \ + sizeof(((struct boot_sector *)0)->root_cluster), \ + &__v); \ + } \ +@@ -75,16 +75,16 @@ static DOS_FILE *root; + } \ + } while(0) + +-loff_t alloc_rootdir_entry(DOS_FS * fs, DIR_ENT * de, const char *pattern) ++off_t alloc_rootdir_entry(DOS_FS * fs, DIR_ENT * de, const char *pattern) + { + static int curr_num = 0; +- loff_t offset; ++ off_t offset; + + if (fs->root_cluster) { + DIR_ENT d2; + int i = 0, got = 0; + uint32_t clu_num, prev = 0; +- loff_t offset2; ++ off_t offset2; + + clu_num = fs->root_cluster; + offset = cluster_start(fs, clu_num); +@@ -333,7 +333,7 @@ static int bad_name(DOS_FILE * file) + return 0; + } + +-static void lfn_remove(loff_t from, loff_t to) ++static void lfn_remove(off_t from, off_t to) + { + DIR_ENT empty; + +@@ -949,7 +949,7 @@ static void new_dir(void) + * @param cp + */ + static void add_file(DOS_FS * fs, DOS_FILE *** chain, DOS_FILE * parent, +- loff_t offset, FDSC ** cp) ++ off_t offset, FDSC ** cp) + { + DOS_FILE *new; + DIR_ENT de; diff --git a/package/dosfstools/patches/patch-src_check_h b/package/dosfstools/patches/patch-src_check_h new file mode 100644 index 000000000..7f0b5e643 --- /dev/null +++ b/package/dosfstools/patches/patch-src_check_h @@ -0,0 +1,11 @@ +--- dosfstools-3.0.26.orig/src/check.h 2014-01-17 07:07:02.000000000 +0100 ++++ dosfstools-3.0.26/src/check.h 2014-03-26 13:25:47.000000000 +0100 +@@ -23,7 +23,7 @@ + #ifndef _CHECK_H + #define _CHECK_H + +-loff_t alloc_rootdir_entry(DOS_FS * fs, DIR_ENT * de, const char *pattern); ++off_t alloc_rootdir_entry(DOS_FS * fs, DIR_ENT * de, const char *pattern); + + /* Allocate a free slot in the root directory for a new file. The file name is + constructed after 'pattern', which must include a %d type format for printf diff --git a/package/dosfstools/patches/patch-src_fat_c b/package/dosfstools/patches/patch-src_fat_c new file mode 100644 index 000000000..15bfd16db --- /dev/null +++ b/package/dosfstools/patches/patch-src_fat_c @@ -0,0 +1,32 @@ +--- dosfstools-3.0.26.orig/src/fat.c 2014-01-17 07:07:05.000000000 +0100 ++++ dosfstools-3.0.26/src/fat.c 2014-03-26 13:37:03.000000000 +0100 +@@ -180,7 +180,7 @@ void set_fat(DOS_FS * fs, uint32_t clust + { + unsigned char *data = NULL; + int size; +- loff_t offs; ++ off_t offs; + + if (new == -1) + new = FAT_EOF(fs); +@@ -264,9 +264,9 @@ uint32_t next_cluster(DOS_FS * fs, uint3 + return FAT_IS_EOF(fs, value) ? -1 : value; + } + +-loff_t cluster_start(DOS_FS * fs, uint32_t cluster) ++off_t cluster_start(DOS_FS * fs, uint32_t cluster) + { +- return fs->data_start + ((loff_t) cluster - ++ return fs->data_start + ((off_t) cluster - + 2) * (uint64_t)fs->cluster_size; + } + +@@ -475,7 +475,7 @@ void reclaim_file(DOS_FS * fs) + /* If this cluster is the head of an orphan chain... */ + if (get_owner(fs, i) == &orphan && !num_refs[i]) { + DIR_ENT de; +- loff_t offset; ++ off_t offset; + files++; + offset = alloc_rootdir_entry(fs, &de, "FSCK%04dREC"); + de.start = htole16(i & 0xffff); diff --git a/package/dosfstools/patches/patch-src_fat_h b/package/dosfstools/patches/patch-src_fat_h new file mode 100644 index 000000000..9a5a81b88 --- /dev/null +++ b/package/dosfstools/patches/patch-src_fat_h @@ -0,0 +1,11 @@ +--- dosfstools-3.0.26.orig/src/fat.h 2014-01-17 07:07:07.000000000 +0100 ++++ dosfstools-3.0.26/src/fat.h 2014-03-26 13:29:04.000000000 +0100 +@@ -49,7 +49,7 @@ uint32_t next_cluster(DOS_FS * fs, uint3 + last cluster of the respective cluster chain. CLUSTER must not be a bad + cluster. */ + +-loff_t cluster_start(DOS_FS * fs, uint32_t cluster); ++off_t cluster_start(DOS_FS * fs, uint32_t cluster); + + /* Returns the byte offset of CLUSTER, relative to the respective device. */ + diff --git a/package/dosfstools/patches/patch-src_fatlabel_c b/package/dosfstools/patches/patch-src_fatlabel_c new file mode 100644 index 000000000..1a5e2c2cf --- /dev/null +++ b/package/dosfstools/patches/patch-src_fatlabel_c @@ -0,0 +1,11 @@ +--- dosfstools-3.0.26.orig/src/fatlabel.c 2014-01-17 07:07:08.000000000 +0100 ++++ dosfstools-3.0.26/src/fatlabel.c 2014-03-26 13:23:52.000000000 +0100 +@@ -92,7 +92,7 @@ int main(int argc, char *argv[]) + char *device = NULL; + char label[12] = { 0 }; + +- loff_t offset; ++ off_t offset; + DIR_ENT de; + + check_atari(); diff --git a/package/dosfstools/patches/patch-src_fsck_fat_h b/package/dosfstools/patches/patch-src_fsck_fat_h new file mode 100644 index 000000000..feaefb58e --- /dev/null +++ b/package/dosfstools/patches/patch-src_fsck_fat_h @@ -0,0 +1,38 @@ +--- dosfstools-3.0.26.orig/src/fsck.fat.h 2014-02-08 18:53:10.000000000 +0100 ++++ dosfstools-3.0.26/src/fsck.fat.h 2014-03-26 13:29:32.000000000 +0100 +@@ -143,8 +143,8 @@ typedef struct { + typedef struct _dos_file { + DIR_ENT dir_ent; + char *lfn; +- loff_t offset; +- loff_t lfn_offset; ++ off_t offset; ++ off_t lfn_offset; + struct _dos_file *parent; /* parent directory */ + struct _dos_file *next; /* next entry */ + struct _dos_file *first; /* first entry (directory only) */ +@@ -157,19 +157,19 @@ typedef struct { + + typedef struct { + int nfats; +- loff_t fat_start; ++ off_t fat_start; + unsigned int fat_size; /* unit is bytes */ + unsigned int fat_bits; /* size of a FAT entry */ + unsigned int eff_fat_bits; /* # of used bits in a FAT entry */ + uint32_t root_cluster; /* 0 for old-style root dir */ +- loff_t root_start; ++ off_t root_start; + unsigned int root_entries; +- loff_t data_start; ++ off_t data_start; + unsigned int cluster_size; + uint32_t clusters; +- loff_t fsinfo_start; /* 0 if not present */ ++ off_t fsinfo_start; /* 0 if not present */ + long free_clusters; +- loff_t backupboot_start; /* 0 if not present */ ++ off_t backupboot_start; /* 0 if not present */ + unsigned char *fat; + DOS_FILE **cluster_owner; + char *label; diff --git a/package/dosfstools/patches/patch-src_io_c b/package/dosfstools/patches/patch-src_io_c new file mode 100644 index 000000000..fae1ce625 --- /dev/null +++ b/package/dosfstools/patches/patch-src_io_c @@ -0,0 +1,59 @@ +--- dosfstools-3.0.26.orig/src/io.c 2014-01-17 07:07:14.000000000 +0100 ++++ dosfstools-3.0.26/src/io.c 2014-03-26 13:27:02.000000000 +0100 +@@ -48,7 +48,7 @@ + + typedef struct _change { + void *data; +- loff_t pos; ++ off_t pos; + int size; + struct _change *next; + } CHANGE; +@@ -60,7 +60,7 @@ unsigned device_no; + + #ifdef __DJGPP__ + #include "volume.h" /* DOS lowlevel disk access functions */ +-loff_t llseek(int fd, loff_t offset, int whence) ++off_t llseek(int fd, off_t offset, int whence) + { + if ((whence != SEEK_SET) || (fd == 4711)) + return -1; /* only those supported */ +@@ -72,9 +72,9 @@ loff_t llseek(int fd, loff_t offset, int + #define read(a,b,c) ReadVolume(b,c) + #define write(a,b,c) WriteVolume(b,c) + #else +-loff_t llseek(int fd, loff_t offset, int whence) ++off_t llseek(int fd, off_t offset, int whence) + { +- return (loff_t) lseek64(fd, (off64_t) offset, whence); ++ return (off_t) lseek64(fd, (off64_t) offset, whence); + } + #endif + +@@ -118,7 +118,7 @@ void fs_open(char *path, int rw) + * @param[in] size Number of bytes to read + * @param[out] data Where to put the data read + */ +-void fs_read(loff_t pos, int size, void *data) ++void fs_read(off_t pos, int size, void *data) + { + CHANGE *walk; + int got; +@@ -145,7 +145,7 @@ void fs_read(loff_t pos, int size, void + } + } + +-int fs_test(loff_t pos, int size) ++int fs_test(off_t pos, int size) + { + void *scratch; + int okay; +@@ -158,7 +158,7 @@ int fs_test(loff_t pos, int size) + return okay; + } + +-void fs_write(loff_t pos, int size, void *data) ++void fs_write(off_t pos, int size, void *data) + { + CHANGE *new; + int did; diff --git a/package/dosfstools/patches/patch-src_io_h b/package/dosfstools/patches/patch-src_io_h new file mode 100644 index 000000000..3ec0fd809 --- /dev/null +++ b/package/dosfstools/patches/patch-src_io_h @@ -0,0 +1,35 @@ +--- dosfstools-3.0.26.orig/src/io.h 2014-02-08 18:53:10.000000000 +0100 ++++ dosfstools-3.0.26/src/io.h 2014-03-26 13:27:15.000000000 +0100 +@@ -27,9 +27,9 @@ + #ifndef _IO_H + #define _IO_H + +-#include <fcntl.h> /* for loff_t */ ++#include <fcntl.h> /* for off_t */ + +-loff_t llseek(int fd, loff_t offset, int whence); ++off_t llseek(int fd, off_t offset, int whence); + + /* lseek() analogue for large offsets. */ + +@@ -38,17 +38,17 @@ void fs_open(char *path, int rw); + /* Opens the filesystem PATH. If RW is zero, the filesystem is opened + read-only, otherwise, it is opened read-write. */ + +-void fs_read(loff_t pos, int size, void *data); ++void fs_read(off_t pos, int size, void *data); + + /* Reads SIZE bytes starting at POS into DATA. Performs all applicable + changes. */ + +-int fs_test(loff_t pos, int size); ++int fs_test(off_t pos, int size); + + /* Returns a non-zero integer if SIZE bytes starting at POS can be read without + errors. Otherwise, it returns zero. */ + +-void fs_write(loff_t pos, int size, void *data); ++void fs_write(off_t pos, int size, void *data); + + /* If write_immed is non-zero, SIZE bytes are written from DATA to the disk, + starting at POS. If write_immed is zero, the change is added to a list in diff --git a/package/dosfstools/patches/patch-src_lfn_c b/package/dosfstools/patches/patch-src_lfn_c new file mode 100644 index 000000000..dfda2dc3e --- /dev/null +++ b/package/dosfstools/patches/patch-src_lfn_c @@ -0,0 +1,74 @@ +--- dosfstools-3.0.26.orig/src/lfn.c 2014-01-17 07:07:16.000000000 +0100 ++++ dosfstools-3.0.26/src/lfn.c 2014-03-26 13:24:23.000000000 +0100 +@@ -52,7 +52,7 @@ typedef struct { + unsigned char *lfn_unicode = NULL; + unsigned char lfn_checksum; + int lfn_slot = -1; +-loff_t *lfn_offsets = NULL; ++off_t *lfn_offsets = NULL; + int lfn_parts = 0; + + static unsigned char fat_uni2esc[64] = { +@@ -170,7 +170,7 @@ static void clear_lfn_slots(int start, i + } + } + +-void lfn_fix_checksum(loff_t from, loff_t to, const char *short_name) ++void lfn_fix_checksum(off_t from, off_t to, const char *short_name) + { + int i; + __u8 sum; +@@ -195,7 +195,7 @@ void lfn_reset(void) + + /* This function is only called with de->attr == VFAT_LN_ATTR. It stores part + * of the long name. */ +-void lfn_add_slot(DIR_ENT * de, loff_t dir_offset) ++void lfn_add_slot(DIR_ENT * de, off_t dir_offset) + { + LFN_ENT *lfn = (LFN_ENT *) de; + int slot = lfn->id & LFN_ID_SLOTMASK; +@@ -253,7 +253,7 @@ void lfn_add_slot(DIR_ENT * de, loff_t d + lfn_slot = slot; + lfn_checksum = lfn->alias_checksum; + lfn_unicode = alloc((lfn_slot * CHARS_PER_LFN + 1) * 2); +- lfn_offsets = alloc(lfn_slot * sizeof(loff_t)); ++ lfn_offsets = alloc(lfn_slot * sizeof(off_t)); + lfn_parts = 0; + } else if (lfn_slot == -1 && slot != 0) { + /* No LFN in progress, but slot found; start bit missing */ +@@ -272,7 +272,7 @@ void lfn_add_slot(DIR_ENT * de, loff_t d + switch (interactive ? get_key("123", "?") : '2') { + case '1': + if (!lfn_offsets) +- lfn_offsets = alloc(sizeof(loff_t)); ++ lfn_offsets = alloc(sizeof(off_t)); + lfn_offsets[0] = dir_offset; + clear_lfn_slots(0, 0); + lfn_reset(); +@@ -287,7 +287,7 @@ void lfn_add_slot(DIR_ENT * de, loff_t d + lfn_slot = slot; + lfn_checksum = lfn->alias_checksum; + lfn_unicode = alloc((lfn_slot * CHARS_PER_LFN + 1) * 2); +- lfn_offsets = alloc(lfn_slot * sizeof(loff_t)); ++ lfn_offsets = alloc(lfn_slot * sizeof(off_t)); + lfn_parts = 0; + break; + } +@@ -319,7 +319,7 @@ void lfn_add_slot(DIR_ENT * de, loff_t d + switch (interactive ? get_key(can_fix ? "123" : "12", "?") : '2') { + case '1': + if (!lfn_offsets) { +- lfn_offsets = alloc(sizeof(loff_t)); ++ lfn_offsets = alloc(sizeof(off_t)); + lfn_parts = 0; + } + lfn_offsets[lfn_parts++] = dir_offset; +@@ -406,7 +406,7 @@ void lfn_add_slot(DIR_ENT * de, loff_t d + + /* This function is always called when de->attr != VFAT_LN_ATTR is found, to + * retrieve the previously constructed LFN. */ +-char *lfn_get(DIR_ENT * de, loff_t * lfn_offset) ++char *lfn_get(DIR_ENT * de, off_t * lfn_offset) + { + char *lfn; + __u8 sum; diff --git a/package/dosfstools/patches/patch-src_lfn_h b/package/dosfstools/patches/patch-src_lfn_h new file mode 100644 index 000000000..0027ce035 --- /dev/null +++ b/package/dosfstools/patches/patch-src_lfn_h @@ -0,0 +1,20 @@ +--- dosfstools-3.0.26.orig/src/lfn.h 2014-01-17 07:07:17.000000000 +0100 ++++ dosfstools-3.0.26/src/lfn.h 2014-03-26 13:24:56.000000000 +0100 +@@ -26,14 +26,14 @@ + void lfn_reset(void); + /* Reset the state of the LFN parser. */ + +-void lfn_add_slot(DIR_ENT * de, loff_t dir_offset); ++void lfn_add_slot(DIR_ENT * de, off_t dir_offset); + /* Process a dir slot that is a VFAT LFN entry. */ + +-char *lfn_get(DIR_ENT * de, loff_t * lfn_offset); ++char *lfn_get(DIR_ENT * de, off_t * lfn_offset); + /* Retrieve the long name for the proper dir entry. */ + + void lfn_check_orphaned(void); + +-void lfn_fix_checksum(loff_t from, loff_t to, const char *short_name); ++void lfn_fix_checksum(off_t from, off_t to, const char *short_name); + + #endif diff --git a/package/dosfstools/patches/patch-src_mkfs_fat_c b/package/dosfstools/patches/patch-src_mkfs_fat_c new file mode 100644 index 000000000..60703d5f5 --- /dev/null +++ b/package/dosfstools/patches/patch-src_mkfs_fat_c @@ -0,0 +1,56 @@ +--- dosfstools-3.0.26.orig/src/mkfs.fat.c 2014-02-08 18:53:10.000000000 +0100 ++++ dosfstools-3.0.26/src/mkfs.fat.c 2014-03-26 13:37:51.000000000 +0100 +@@ -300,7 +300,7 @@ static long do_check(char *buffer, int t + static void alarm_intr(int alnum); + static void check_blocks(void); + static void get_list_blocks(char *filename); +-static int valid_offset(int fd, loff_t offset); ++static int valid_offset(int fd, off_t offset); + static uint64_t count_blocks(char *filename, int *remainder); + static void check_mount(char *device_name); + static void establish_params(int device_num, int size); +@@ -477,7 +477,7 @@ static void get_list_blocks(char *filena + /* Given a file descriptor and an offset, check whether the offset is a valid offset for the file - return FALSE if it + isn't valid or TRUE if it is */ + +-static int valid_offset(int fd, loff_t offset) ++static int valid_offset(int fd, off_t offset) + { + char ch; + +@@ -492,7 +492,7 @@ static int valid_offset(int fd, loff_t o + + static uint64_t count_blocks(char *filename, int *remainder) + { +- loff_t high, low; ++ off_t high, low; + int fd; + + if ((fd = open(filename, O_RDONLY)) < 0) { +@@ -506,7 +506,7 @@ static uint64_t count_blocks(char *filen + for (high = 1; valid_offset(fd, high); high *= 2) + low = high; + while (low < high - 1) { +- const loff_t mid = (low + high) / 2; ++ const off_t mid = (low + high) / 2; + if (valid_offset(fd, mid)) + low = mid; + else +@@ -1299,7 +1299,7 @@ static void setup_tables(void) + + #define seekto(pos,errstr) \ + do { \ +- loff_t __pos = (pos); \ ++ off_t __pos = (pos); \ + if (llseek (dev, __pos, SEEK_SET) != __pos) \ + error ("seek to " errstr " failed whilst writing tables"); \ + } while(0) +@@ -1679,7 +1679,7 @@ int main(int argc, char **argv) + exit(1); /* The error exit code is 1! */ + } + } else { +- loff_t offset = blocks * BLOCK_SIZE - 1; ++ off_t offset = blocks * BLOCK_SIZE - 1; + char null = 0; + /* create the file */ + dev = open(device_name, O_EXCL | O_RDWR | O_CREAT | O_TRUNC, 0666); diff --git a/package/dovecot/Makefile b/package/dovecot/Makefile index 624d47672..0fd736e4d 100644 --- a/package/dovecot/Makefile +++ b/package/dovecot/Makefile @@ -4,21 +4,15 @@ include ${TOPDIR}/rules.mk PKG_NAME:= dovecot -PKG_VERSION:= 2.0.5 +PKG_VERSION:= 2.2.12 PKG_RELEASE:= 1 -PKG_MD5SUM:= 7168c5bf40fdd38cceb99114547699b8 -PKG_DESCR:= A minimal and secure imap server +PKG_MD5SUM:= 25395269fa2e0525e2d144d71d0450eb +PKG_DESCR:= minimal and secure imap server +PKG_BUILDDEP:= openssl +PKG_DEPENDS:= libopenssl PKG_SECTION:= mail PKG_URL:= http://www.dovecot.org/ -PKG_SITES:= http://www.dovecot.org/releases/2.0/ - -PKG_CHOICES_DOVECOT:= WITH_GNUTLS WITH_OPENSSL -PKGCD_WITH_OPENSSL:= use OpenSSL for crypto -PKGCS_WITH_OPENSSL:= libopenssl -PKGCB_WITH_OPENSSL:= openssl -PKGCD_WITH_GNUTLS:= use GnuTLS for crypto -PKGCS_WITH_GNUTLS:= libgnutls -PKGCB_WITH_GNUTLS:= gnutls +PKG_SITES:= http://www.dovecot.org/releases/2.2/ include ${TOPDIR}/mk/package.mk @@ -45,16 +39,10 @@ CONFIGURE_ARGS+= --with-notify=none \ --without-gssapi \ --without-pam \ --with-ioloop=epoll \ - --with-moduledir=/usr/lib/dovecot/modules - -ifeq (${ADK_PACKAGE_DOVECOT_WITH_GNUTLS},y) -CONFIGURE_ARGS+= --with-ssl=gnutls -endif -ifeq (${ADK_PACKAGE_DOVECOT_WITH_OPENSSL},y) -CONFIGURE_ARGS+= --with-ssl=openssl -endif + --with-moduledir=/usr/lib/dovecot/modules \ + --with-ssl=openssl -post-install: +dovecot-install: ${INSTALL_DIR} ${IDIR_DOVECOT}/etc ${INSTALL_DIR} ${IDIR_DOVECOT}/usr/sbin ${INSTALL_DIR} ${IDIR_DOVECOT}/usr/libexec/dovecot diff --git a/package/dovecot/patches/patch-ltmain_sh b/package/dovecot/patches/patch-ltmain_sh deleted file mode 100644 index 8c7c6bc7d..000000000 --- a/package/dovecot/patches/patch-ltmain_sh +++ /dev/null @@ -1,11 +0,0 @@ ---- dovecot-2.0.5.orig/ltmain.sh 2010-05-24 16:48:06.000000000 +0200 -+++ dovecot-2.0.5/ltmain.sh 2011-01-14 22:05:48.000000000 +0100 -@@ -4765,7 +4765,7 @@ func_mode_link () - # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC - # @file GCC response files - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -- -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) -+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-fstack-protector*|-flto) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - func_append compile_command " $arg" diff --git a/package/dropbear/Makefile b/package/dropbear/Makefile index 319c7522f..58c55376d 100644 --- a/package/dropbear/Makefile +++ b/package/dropbear/Makefile @@ -14,7 +14,6 @@ PKG_SITES:= http://matt.ucc.asn.au/dropbear/releases/ DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 -PKG_DFLT_DROPBEAR:= y if !ADK_TOOLCHAIN_ONLY && !ADK_PKG_TEST PKG_SUBPKGS:= DROPBEAR DBCONVERT PKGSD_DBCONVERT:= Utility for converting SSH private keys @@ -26,8 +25,6 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,DROPBEAR,dropbear,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,DBCONVERT,dropbearconvert,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_DBCONVERT},${PKG_SECTION})) -TARGET_LDFLAGS+= $(ADK_TARGET_ABI_CFLAGS) - ifeq ($(ADK_STATIC),y) TARGET_LDFLAGS+= -static endif diff --git a/package/dropbear/files/dropbear.postinst b/package/dropbear/files/dropbear.postinst index 11c7923bb..c39e16944 100644 --- a/package/dropbear/files/dropbear.postinst +++ b/package/dropbear/files/dropbear.postinst @@ -1,4 +1,4 @@ #!/bin/sh . $IPKG_INSTROOT/etc/functions.sh -add_rcconf '"NO" to disable' dropbear_flags " " -add_rcconf dropbear dropbear YES +add_rcconf dropbear_flags dropbear_flags " " +add_rcconf dropbear dropbear NO diff --git a/package/e2fsprogs/Makefile b/package/e2fsprogs/Makefile index 391d3475b..ada599fb0 100644 --- a/package/e2fsprogs/Makefile +++ b/package/e2fsprogs/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= e2fsprogs -PKG_VERSION:= 1.42.8 -PKG_RELEASE:= 3 -PKG_MD5SUM:= 8ef664b6eb698aa6b733df59b17b9ed4 +PKG_VERSION:= 1.42.9 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 3f8e41e63b432ba114b33f58674563f7 PKG_DESCR:= Ext2/3/4 filesystem utilities (meta-package) PKG_SECTION:= fs PKG_DEPENDS:= libcom-err libuuid libblkid libpthread @@ -16,8 +16,6 @@ PKG_URL:= http://e2fsprogs.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=e2fsprogs/} PKG_OPTS:= dev -PKG_CFLINE_E2FSPROGS:= default y if ADK_TARGET_ROOTFS_CF - PKG_SUBPKGS:= E2FSPROGS LIBE2FS LIBCOM_ERR LIBSS E2FSCK_STATIC PKG_SUBPKGS+= RESIZE2FS TUNE2FS E2FSCK MKE2FS PKGSD_LIBE2FS:= e2fsprogs library @@ -88,6 +86,8 @@ e2fsck-install: ${INSTALL_DIR} ${IDIR_E2FSCK}/usr/sbin ${INSTALL_BIN} ${WRKINST}/usr/sbin/e2fsck ${IDIR_E2FSCK}/usr/sbin cd $(IDIR_E2FSCK)/usr/sbin && ln -sf e2fsck fsck.ext2 + cd $(IDIR_E2FSCK)/usr/sbin && ln -sf e2fsck fsck.ext3 + cd $(IDIR_E2FSCK)/usr/sbin && ln -sf e2fsck fsck.ext4 mke2fs-install: ${INSTALL_DIR} ${IDIR_MKE2FS}/usr/sbin diff --git a/package/ebtables/Makefile b/package/ebtables/Makefile index 59f2ea6ba..e39f58070 100644 --- a/package/ebtables/Makefile +++ b/package/ebtables/Makefile @@ -21,7 +21,7 @@ $(eval $(call PKG_template,EBTABLES,ebtables,${PKG_VERSION}-${PKG_RELEASE},${PKG CONFIG_STYLE:= manual -post-install: +ebtables-install: ${INSTALL_DIR} ${IDIR_EBTABLES}/etc ${INSTALL_DIR} ${IDIR_EBTABLES}/usr/sbin ${IDIR_EBTABLES}/usr/lib ${INSTALL_DATA} ${WRKINST}/etc/ethertypes ${IDIR_EBTABLES}/etc diff --git a/package/ebtables/patches/patch-Makefile b/package/ebtables/patches/patch-Makefile index ff5934a70..f4e293eaf 100644 --- a/package/ebtables/patches/patch-Makefile +++ b/package/ebtables/patches/patch-Makefile @@ -1,6 +1,6 @@ ---- ebtables-v2.0.10-3.orig/Makefile 2011-12-04 10:46:26.000000000 +0100 -+++ ebtables-v2.0.10-3/Makefile 2011-12-11 16:35:34.619464748 +0100 -@@ -10,16 +10,16 @@ LOCKDIR:=$(shell echo $(LOCKFILE) | sed +--- ebtables-v2.0.10-4.orig/Makefile 2011-12-15 21:02:47.000000000 +0100 ++++ ebtables-v2.0.10-4/Makefile 2014-03-23 15:46:20.000000000 +0100 +@@ -10,16 +10,16 @@ LOCKDIR:=$(shell echo $(LOCKFILE) | sed # default paths LIBDIR:=/usr/lib diff --git a/package/ebtables/patches/patch-extensions_ebt_among_c b/package/ebtables/patches/patch-extensions_ebt_among_c new file mode 100644 index 000000000..08f3fb7f1 --- /dev/null +++ b/package/ebtables/patches/patch-extensions_ebt_among_c @@ -0,0 +1,10 @@ +--- ebtables-v2.0.10-4.orig/extensions/ebt_among.c 2011-12-15 21:02:47.000000000 +0100 ++++ ebtables-v2.0.10-4/extensions/ebt_among.c 2014-03-23 15:51:29.000000000 +0100 +@@ -13,7 +13,6 @@ + #include <ctype.h> + #include <unistd.h> + #include "../include/ebtables_u.h" +-#include <netinet/ether.h> + #include "../include/ethernetdb.h" + #include <linux/if_ether.h> + #include <linux/netfilter_bridge/ebt_among.h> diff --git a/package/ebtables/patches/patch-extensions_ebt_arpreply_c b/package/ebtables/patches/patch-extensions_ebt_arpreply_c new file mode 100644 index 000000000..32432efb4 --- /dev/null +++ b/package/ebtables/patches/patch-extensions_ebt_arpreply_c @@ -0,0 +1,10 @@ +--- ebtables-v2.0.10-4.orig/extensions/ebt_arpreply.c 2011-12-15 21:02:47.000000000 +0100 ++++ ebtables-v2.0.10-4/extensions/ebt_arpreply.c 2014-03-23 15:50:38.000000000 +0100 +@@ -12,7 +12,6 @@ + #include <string.h> + #include <getopt.h> + #include "../include/ebtables_u.h" +-#include <netinet/ether.h> + #include <linux/netfilter_bridge/ebt_arpreply.h> + + static int mac_supplied; diff --git a/package/ebtables/patches/patch-extensions_ebt_ip6_c b/package/ebtables/patches/patch-extensions_ebt_ip6_c new file mode 100644 index 000000000..e57677d44 --- /dev/null +++ b/package/ebtables/patches/patch-extensions_ebt_ip6_c @@ -0,0 +1,10 @@ +--- ebtables-v2.0.10-4.orig/extensions/ebt_ip6.c 2011-12-15 21:02:47.000000000 +0100 ++++ ebtables-v2.0.10-4/extensions/ebt_ip6.c 2014-03-23 15:51:09.000000000 +0100 +@@ -11,6 +11,7 @@ + * + */ + ++#include <sys/types.h> + #include <errno.h> + #include <inttypes.h> + #include <limits.h> diff --git a/package/ebtables/patches/patch-extensions_ebt_limit_c b/package/ebtables/patches/patch-extensions_ebt_limit_c new file mode 100644 index 000000000..5464611c1 --- /dev/null +++ b/package/ebtables/patches/patch-extensions_ebt_limit_c @@ -0,0 +1,10 @@ +--- ebtables-v2.0.10-4.orig/extensions/ebt_limit.c 2011-12-15 21:02:47.000000000 +0100 ++++ ebtables-v2.0.10-4/extensions/ebt_limit.c 2014-03-23 15:52:04.000000000 +0100 +@@ -8,6 +8,7 @@ + * September, 2003 + */ + ++#include <sys/types.h> + #include <stdio.h> + #include <stdlib.h> + #include <string.h> diff --git a/package/ebtables/patches/patch-extensions_ebt_nat_c b/package/ebtables/patches/patch-extensions_ebt_nat_c new file mode 100644 index 000000000..1a215e9e7 --- /dev/null +++ b/package/ebtables/patches/patch-extensions_ebt_nat_c @@ -0,0 +1,10 @@ +--- ebtables-v2.0.10-4.orig/extensions/ebt_nat.c 2011-12-15 21:02:47.000000000 +0100 ++++ ebtables-v2.0.10-4/extensions/ebt_nat.c 2014-03-23 15:50:13.000000000 +0100 +@@ -11,7 +11,6 @@ + #include <string.h> + #include <getopt.h> + #include "../include/ebtables_u.h" +-#include <netinet/ether.h> + #include <linux/netfilter_bridge/ebt_nat.h> + + static int to_source_supplied, to_dest_supplied; diff --git a/package/ebtables/patches/patch-include_ethernetdb_h b/package/ebtables/patches/patch-include_ethernetdb_h new file mode 100644 index 000000000..1bc877d57 --- /dev/null +++ b/package/ebtables/patches/patch-include_ethernetdb_h @@ -0,0 +1,29 @@ +--- ebtables-v2.0.10-4.orig/include/ethernetdb.h 2011-12-15 21:02:47.000000000 +0100 ++++ ebtables-v2.0.10-4/include/ethernetdb.h 2014-03-23 15:47:35.000000000 +0100 +@@ -38,21 +38,20 @@ struct ethertypeent { + + /* Open ethertype data base files and mark them as staying open even + after a later search if STAY_OPEN is non-zero. */ +-extern void setethertypeent(int __stay_open) __THROW; ++extern void setethertypeent(int __stay_open); + + /* Close ethertype data base files and clear `stay open' flag. */ +-extern void endethertypeent(void) __THROW; ++extern void endethertypeent(void); + + /* Get next entry from ethertype data base file. Open data base if + necessary. */ +-extern struct ethertypeent *getethertypeent(void) __THROW; ++extern struct ethertypeent *getethertypeent(void); + + /* Return entry from ethertype data base for network with NAME. */ +-extern struct ethertypeent *getethertypebyname(__const char *__name) +- __THROW; ++extern struct ethertypeent *getethertypebyname(__const char *__name); + + /* Return entry from ethertype data base which number is PROTO. */ +-extern struct ethertypeent *getethertypebynumber(int __ethertype) __THROW; ++extern struct ethertypeent *getethertypebynumber(int __ethertype); + + + #endif /* ethernetdb.h */ diff --git a/package/ebtables/patches/patch-useful_functions_c b/package/ebtables/patches/patch-useful_functions_c new file mode 100644 index 000000000..6e851ecd2 --- /dev/null +++ b/package/ebtables/patches/patch-useful_functions_c @@ -0,0 +1,10 @@ +--- ebtables-v2.0.10-4.orig/useful_functions.c 2011-12-15 21:02:47.000000000 +0100 ++++ ebtables-v2.0.10-4/useful_functions.c 2014-03-23 15:49:15.000000000 +0100 +@@ -25,7 +25,6 @@ + #include "include/ebtables_u.h" + #include "include/ethernetdb.h" + #include <stdio.h> +-#include <netinet/ether.h> + #include <string.h> + #include <stdlib.h> + #include <getopt.h> diff --git a/package/ethtool/Makefile b/package/ethtool/Makefile index f6be14fb9..7834dcfdb 100644 --- a/package/ethtool/Makefile +++ b/package/ethtool/Makefile @@ -4,12 +4,14 @@ include ${TOPDIR}/rules.mk PKG_NAME:= ethtool -PKG_VERSION:= 2.6.36 -PKG_RELEASE:= 1 -PKG_MD5SUM:= 3b2322695e9ee7bf447ebcdb85f93e83 -PKG_DESCR:= Display or change ethernet card settings +PKG_VERSION:= 3.13 +PKG_RELEASE:= 2 +PKG_MD5SUM:= dcb8f345d44ee79108282e7d0bdf5013 +PKG_DESCR:= display or change ethernet card settings PKG_SECTION:= net -PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=gkernel/} +PKG_SITES:= https://www.kernel.org/pub/software/network/ethtool/ + +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.xz include ${TOPDIR}/mk/package.mk diff --git a/package/ethtool/patches/patch-internal_h b/package/ethtool/patches/patch-internal_h new file mode 100644 index 000000000..280f92ce7 --- /dev/null +++ b/package/ethtool/patches/patch-internal_h @@ -0,0 +1,33 @@ +--- ethtool-3.13.orig/internal.h 2014-01-27 02:27:14.000000000 +0100 ++++ ethtool-3.13/internal.h 2014-03-23 13:47:54.000000000 +0100 +@@ -7,6 +7,7 @@ + #include "ethtool-config.h" + #endif + #include <stdio.h> ++#include <stdint.h> + #include <stdlib.h> + #include <string.h> + #include <sys/types.h> +@@ -17,16 +18,16 @@ + + /* ethtool.h expects these to be defined by <linux/types.h> */ + #ifndef HAVE_BE_TYPES +-typedef __uint16_t __be16; +-typedef __uint32_t __be32; ++typedef uint16_t __be16; ++typedef uint32_t __be32; + typedef unsigned long long __be64; + #endif + + typedef unsigned long long u64; +-typedef __uint32_t u32; +-typedef __uint16_t u16; +-typedef __uint8_t u8; +-typedef __int32_t s32; ++typedef uint32_t u32; ++typedef uint16_t u16; ++typedef uint8_t u8; ++typedef int32_t s32; + + #include "ethtool-copy.h" + #include "net_tstamp-copy.h" diff --git a/package/eudev/Makefile b/package/eudev/Makefile index 4bce0928c..a6939a032 100644 --- a/package/eudev/Makefile +++ b/package/eudev/Makefile @@ -4,10 +4,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:= eudev -PKG_VERSION:= 1.3 -PKG_RELEASE:= 1 -PKG_MD5SUM:= 164df78f6f0093578a20bdd00335845f -PKG_DESCR:= udev device manager +PKG_VERSION:= 1.5.3 +PKG_RELEASE:= 2 +PKG_MD5SUM:= 51380938b489385cc394f4ebabc048f0 +PKG_DESCR:= device manager (udev clone) PKG_SECTION:= utils PKG_BUILDDEP:= gperf-host glib PKG_DEPENDS:= glib @@ -16,20 +16,22 @@ PKG_SITES:= http://dev.gentoo.org/~blueness/eudev/ PKG_LIBNAME:= libudev PKG_OPTS:= dev -PKG_SUBPKGS:= UDEV LIBUDEV LIBGUDEV -PKGSC_LIBGUDEV:= libs -PKGSD_LIBGUDEV:= GUDEV library +PKG_SUBPKGS:= UDEV LIBUDEV +PKGSD_UDEV:= Dynamic device management manager PKGSC_LIBUDEV:= libs -PKGSD_LIBUDEV:= UDEV library -PKGSD_UDEV:= Dynamic device management subsystem +PKGSD_LIBUDEV:= Dynamic device management library + +ifeq ($(ADK_STATIC),y) +PKG_OPTS+= libmix +endif include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,UDEV,udev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) $(eval $(call PKG_template,LIBUDEV,libudev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) -$(eval $(call PKG_template,LIBGUDEV,libgudev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) CONFIGURE_ARGS+= --disable-manpages \ + --datadir=${STAGING_TARGET_PREFIX}/usr/lib \ --disable-gtk-doc udev-install: @@ -43,8 +45,4 @@ libudev-install: ${INSTALL_DIR} ${IDIR_LIBUDEV}/usr/lib $(CP) $(WRKINST)/usr/lib/libudev.so* $(IDIR_LIBUDEV)/usr/lib -libgudev-install: - ${INSTALL_DIR} ${IDIR_LIBGUDEV}/usr/lib - $(CP) $(WRKINST)/usr/lib/libgudev*.so* $(IDIR_LIBGUDEV)/usr/lib - include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/eudev/patches/patch-rule_generator_write_cd_rules b/package/eudev/patches/patch-rule_generator_write_cd_rules new file mode 100644 index 000000000..ed67769b9 --- /dev/null +++ b/package/eudev/patches/patch-rule_generator_write_cd_rules @@ -0,0 +1,11 @@ +--- eudev-1.5.3.orig/rule_generator/write_cd_rules 2014-03-22 23:45:54.000000000 +0100 ++++ eudev-1.5.3/rule_generator/write_cd_rules 2014-03-24 18:26:38.000000000 +0100 +@@ -27,7 +27,7 @@ if [ -n "$UDEV_LOG" ]; then + fi + fi + +-RULES_FILE="${prefix}/etc/udev/rules.d/70-persistent-cd.rules" ++RULES_FILE="/etc/udev/rules.d/70-persistent-cd.rules" + + . ${prefix}/lib/udev/rule_generator.functions + diff --git a/package/eudev/patches/patch-rule_generator_write_net_rules b/package/eudev/patches/patch-rule_generator_write_net_rules new file mode 100644 index 000000000..e5d14ae2e --- /dev/null +++ b/package/eudev/patches/patch-rule_generator_write_net_rules @@ -0,0 +1,11 @@ +--- eudev-1.5.3.orig/rule_generator/write_net_rules 2014-03-22 23:45:54.000000000 +0100 ++++ eudev-1.5.3/rule_generator/write_net_rules 2014-03-24 18:26:38.000000000 +0100 +@@ -38,7 +38,7 @@ if [ -n "$UDEV_LOG" ]; then + fi + fi + +-RULES_FILE='${prefix}/etc/udev/rules.d/70-persistent-net.rules' ++RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules' + + . ${prefix}/lib/udev/rule_generator.functions + diff --git a/package/eudev/patches/patch-src_accelerometer_accelerometer_c b/package/eudev/patches/patch-src_accelerometer_accelerometer_c new file mode 100644 index 000000000..95735f8c5 --- /dev/null +++ b/package/eudev/patches/patch-src_accelerometer_accelerometer_c @@ -0,0 +1,13 @@ +--- eudev-1.5.3.orig/src/accelerometer/accelerometer.c 2014-03-22 22:56:51.000000000 +0100 ++++ eudev-1.5.3/src/accelerometer/accelerometer.c 2014-03-24 20:41:59.000000000 +0100 +@@ -58,8 +58,8 @@ + #include <linux/limits.h> + #include <linux/input.h> + +-#ifdef __UCLIBC__ +-#include <linux/fcntl.h> ++#if defined(__UCLIBC__) ++#define O_CLOEXEC 02000000 /* set close_on_exec */ + #endif + + #include "libudev.h" diff --git a/package/eudev/patches/patch-src_accelerometer_accelerometer_c.orig b/package/eudev/patches/patch-src_accelerometer_accelerometer_c.orig new file mode 100644 index 000000000..7bfc4f0c6 --- /dev/null +++ b/package/eudev/patches/patch-src_accelerometer_accelerometer_c.orig @@ -0,0 +1,13 @@ +--- eudev-1.5.3.orig/src/accelerometer/accelerometer.c 2014-03-22 22:56:51.000000000 +0100 ++++ eudev-1.5.3/src/accelerometer/accelerometer.c 2014-03-24 20:39:35.000000000 +0100 +@@ -58,10 +58,6 @@ + #include <linux/limits.h> + #include <linux/input.h> + +-#ifdef __UCLIBC__ +-#include <linux/fcntl.h> +-#endif +- + #include "libudev.h" + #include "libudev-private.h" + diff --git a/package/eudev/patches/patch-src_ata_id_ata_id_c b/package/eudev/patches/patch-src_ata_id_ata_id_c new file mode 100644 index 000000000..eae35adf7 --- /dev/null +++ b/package/eudev/patches/patch-src_ata_id_ata_id_c @@ -0,0 +1,11 @@ +--- eudev-1.5.3.orig/src/ata_id/ata_id.c 2014-03-22 22:56:51.000000000 +0100 ++++ eudev-1.5.3/src/ata_id/ata_id.c 2014-03-24 20:44:36.000000000 +0100 +@@ -42,7 +42,7 @@ + #include <arpa/inet.h> + + #ifdef __UCLIBC__ +-#include <linux/fcntl.h> ++#define O_CLOEXEC 02000000 /* Set close_on_exec. */ + #endif + + #include "libudev.h" diff --git a/package/eudev/patches/patch-src_ata_id_ata_id_c.orig b/package/eudev/patches/patch-src_ata_id_ata_id_c.orig new file mode 100644 index 000000000..0d621ffc6 --- /dev/null +++ b/package/eudev/patches/patch-src_ata_id_ata_id_c.orig @@ -0,0 +1,13 @@ +--- eudev-1.5.3.orig/src/ata_id/ata_id.c 2014-03-22 22:56:51.000000000 +0100 ++++ eudev-1.5.3/src/ata_id/ata_id.c 2014-03-24 20:43:14.000000000 +0100 +@@ -41,10 +41,6 @@ + #include <linux/bsg.h> + #include <arpa/inet.h> + +-#ifdef __UCLIBC__ +-#include <linux/fcntl.h> +-#endif +- + #include "libudev.h" + #include "libudev-private.h" + #include "log.h" diff --git a/package/eudev/patches/patch-src_collect_collect_c b/package/eudev/patches/patch-src_collect_collect_c new file mode 100644 index 000000000..dbf17c706 --- /dev/null +++ b/package/eudev/patches/patch-src_collect_collect_c @@ -0,0 +1,11 @@ +--- eudev-1.5.3.orig/src/collect/collect.c 2014-03-22 22:56:51.000000000 +0100 ++++ eudev-1.5.3/src/collect/collect.c 2014-03-24 20:45:48.000000000 +0100 +@@ -32,7 +32,7 @@ + #include <sys/stat.h> + + #ifdef __UCLIBC__ +-#include <linux/fcntl.h> ++#define O_CLOEXEC 02000000 /* Set close_on_exec. */ + #endif + + #include "libudev.h" diff --git a/package/eudev/patches/patch-src_mtd_probe_mtd_probe_c b/package/eudev/patches/patch-src_mtd_probe_mtd_probe_c new file mode 100644 index 000000000..340f08e94 --- /dev/null +++ b/package/eudev/patches/patch-src_mtd_probe_mtd_probe_c @@ -0,0 +1,11 @@ +--- eudev-1.5.3.orig/src/mtd_probe/mtd_probe.c 2014-03-22 22:56:51.000000000 +0100 ++++ eudev-1.5.3/src/mtd_probe/mtd_probe.c 2014-03-24 20:46:53.000000000 +0100 +@@ -27,7 +27,7 @@ + #include <stdlib.h> + + #ifdef __UCLIBC__ +-#include <linux/fcntl.h> ++# define O_CLOEXEC 02000000 /* Set close_on_exec. */ + #endif + + int main(int argc, char** argv) diff --git a/package/eudev/patches/patch-src_scsi_id_scsi_serial_c b/package/eudev/patches/patch-src_scsi_id_scsi_serial_c new file mode 100644 index 000000000..ab4f23dfd --- /dev/null +++ b/package/eudev/patches/patch-src_scsi_id_scsi_serial_c @@ -0,0 +1,11 @@ +--- eudev-1.5.3.orig/src/scsi_id/scsi_serial.c 2014-03-22 22:56:51.000000000 +0100 ++++ eudev-1.5.3/src/scsi_id/scsi_serial.c 2014-03-24 20:49:53.000000000 +0100 +@@ -35,7 +35,7 @@ + #include <linux/bsg.h> + + #ifdef __UCLIBC__ +-#include <linux/fcntl.h> ++#define O_CLOEXEC 02000000 /* set close_on_exec */ + #endif + + #include "libudev.h" diff --git a/package/exmap/Makefile b/package/exmap/Makefile index 9ea289eaf..6755f89df 100644 --- a/package/exmap/Makefile +++ b/package/exmap/Makefile @@ -5,32 +5,23 @@ include ${TOPDIR}/rules.mk PKG_NAME:= exmap PKG_VERSION:= 0.4.1 -PKG_RELEASE:= 3 +PKG_RELEASE:= 4 PKG_MD5SUM:= 55aec784e214037e61400287a55b5426 -PKG_DESCR:= memory analysing client tool +PKG_DESCR:= memory analysing tools PKG_SECTION:= debug -PKG_DEPENDS:= exmap-kmod libreadline glib +PKG_DEPENDS:= libreadline glib PKG_BUILDDEP:= glib readline autotool PKG_SITES:= http://labs.o-hand.com/sources/exmap-console/ PKG_ARCH_DEPENDS:= !m68k PKG_CFLINE_EXMAP:= depends on !ADK_TOOLCHAIN_ONLY -PKG_SUBPKGS:= EXMAP EXMAPD EXMAPSERVER EXMAP_KMOD -PKGSD_EXMAPD:= memory analysing daemon -PKGSD_EXMAPSERVER:= memory analysing server -PKGSD_EXMAP_KMOD:= memory analysing kernel module -PKGSC_EXMAP_KMOD:= kernel - DISTFILES:= ${PKG_NAME}-console-${PKG_VERSION}.tgz WRKDIST= ${WRKDIR}/${PKG_NAME}-console-${PKG_VERSION} include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,EXMAP,exmap,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,EXMAPD,exmapd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_EXMAPD},${PKG_SECTION})) -$(eval $(call PKG_template,EXMAPSERVER,exmapserver,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_EXMAPSERVER},${PKG_SECTION})) -$(eval $(call PKG_template,EXMAP_KMOD,exmap-kmod,${KERNEL_VERSION}+${PKG_VERSION}-${ADK_TARGET}-${PKG_RELEASE},,${PKGSD_EXMAP_KMOD},${PKGSC_EXMAP_KMOD})) AUTOTOOL_STYLE:= autoreconf CONFIGURE_ARGS+= --disable-doc @@ -39,17 +30,13 @@ CONFIGURE_ENV+= LIBS="-lncurses" pre-build: $(MAKE) -C ${WRKBUILD}/kernel $(KERNEL_MODULE_FLAGS) -post-install: - ${INSTALL_DIR} ${IDIR_EXMAP_KMOD}/etc/modules.d/ - echo "exmap" > ${IDIR_EXMAP_KMOD}/etc/modules.d/90-exmap - ${INSTALL_DIR} ${IDIR_EXMAP_KMOD}/lib/modules/${KERNEL_VERSION}/ +exmap-install: + ${INSTALL_DIR} ${IDIR_EXMAP}/etc/modules.d/ + echo "exmap" > ${IDIR_EXMAP}/etc/modules.d/90-exmap + ${INSTALL_DIR} ${IDIR_EXMAP}/lib/modules/${KERNEL_VERSION}/ ${INSTALL_DATA} ${WRKBUILD}/kernel/exmap.ko \ - ${IDIR_EXMAP_KMOD}/lib/modules/${KERNEL_VERSION} + ${IDIR_EXMAP}/lib/modules/${KERNEL_VERSION} ${INSTALL_DIR} ${IDIR_EXMAP}/usr/sbin - ${INSTALL_BIN} ${WRKBUILD}/src/exmap ${IDIR_EXMAP}/usr/sbin - ${INSTALL_DIR} ${IDIR_EXMAPD}/usr/sbin - ${INSTALL_BIN} ${WRKBUILD}/src/exmapd ${IDIR_EXMAPD}/usr/sbin - ${INSTALL_DIR} ${IDIR_EXMAPSERVER}/usr/sbin - ${INSTALL_BIN} ${WRKBUILD}/src/exmapserver ${IDIR_EXMAPSERVER}/usr/sbin + ${INSTALL_BIN} ${WRKBUILD}/src/exmap* ${IDIR_EXMAP}/usr/sbin include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/fbsplash/Makefile b/package/fbsplash/Makefile new file mode 100644 index 000000000..0d2ece693 --- /dev/null +++ b/package/fbsplash/Makefile @@ -0,0 +1,28 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include $(TOPDIR)/rules.mk + +PKG_NAME:= fbsplash +PKG_VERSION:= 1.0 +PKG_RELEASE:= 2 +PKG_MD5SUM:= aa0a9e735e086228bc245b18e231bf6c +PKG_DESCR:= framebuffer splash utility +PKG_SECTION:= misc +PKG_BUILDDEP:= libjpeg-turbo libpng freetype +PKG_DEPENDS:= libjpeg-turbo libpng libfreetype +PKG_URL:= https://github.com/alanhaggai/fbsplash +PKG_SITES:= http://openadk.org/distfiles/ + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,FBSPLASH,fbsplash,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) + +fbsplash-install: + $(INSTALL_DIR) $(IDIR_FBSPLASH)/usr/lib + $(CP) $(WRKINST)/usr/lib/libfb*.so* $(IDIR_FBSPLASH)/usr/lib + $(INSTALL_DIR) $(IDIR_FBSPLASH)/sbin + $(INSTALL_BIN) $(WRKINST)/sbin/{fbcondecor_helper,fbsplashctl} \ + $(IDIR_FBSPLASH)/sbin + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/feh/Makefile b/package/feh/Makefile index 43a90b8b7..4f9f56476 100644 --- a/package/feh/Makefile +++ b/package/feh/Makefile @@ -4,9 +4,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:= feh -PKG_VERSION:= 1.16.1 +PKG_VERSION:= 2.10 PKG_RELEASE:= 1 -PKG_MD5SUM:= 1bb080c7b0021db50884a52161251990 +PKG_MD5SUM:= 6714dedeff1db5c3593c4a27b0d9cf50 PKG_DESCR:= image viewer PKG_SECTION:= multimedia PKG_BUILDDEP:= imlib2 giblib libXt diff --git a/package/fetchmail/Makefile b/package/fetchmail/Makefile index 933333441..0d18d70cc 100644 --- a/package/fetchmail/Makefile +++ b/package/fetchmail/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= fetchmail -PKG_VERSION:= 6.3.9 +PKG_VERSION:= 6.3.26 PKG_RELEASE:= 1 -PKG_MD5SUM:= 72c20ad2b9629f1a109668b05a84d823 +PKG_MD5SUM:= d9ae3d939205a3c06a21ea79b8f14793 PKG_DESCR:= fetch mail from a POP or IMAP server PKG_SECTION:= mail PKG_URL:= http://fetchmail.berlios.de/ diff --git a/package/ffmpeg/Makefile b/package/ffmpeg/Makefile index d82f9d643..838ed551d 100644 --- a/package/ffmpeg/Makefile +++ b/package/ffmpeg/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= ffmpeg -PKG_VERSION:= 2.1.1 +PKG_VERSION:= 2.2 PKG_RELEASE:= 1 -PKG_MD5SUM:= 2719ab2b3311ac3775b9cdeb66c54849 +PKG_MD5SUM:= 744febca199548c9393b1f1ed05ccdd8 PKG_DESCR:= record, convert and stream audio & video PKG_SECTION:= libs PKG_FDEPENDS:= libpthread @@ -100,9 +100,12 @@ $(eval $(call PKG_template,FFSERVER,ffserver,${PKG_VERSION}-${PKG_RELEASE},${PKG $(eval $(call PKG_template,FFPROBE,ffprobe,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_FFPROBE},${PKGSC_FFPROBE})) #$(eval $(call PKG_template,FFPLAY,ffplay,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_FFPLAY},${PKGSD_FFPLAY},${PKGSC_FFPLAY})) -TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) +ifeq ($(ADK_DEBUG),y) +TARGET_CFLAGS:= $(subst O0,O2,$(TARGET_CFLAGS)) +else TARGET_CFLAGS:= $(subst Os,O2,$(TARGET_CFLAGS)) -TARGET_CPPFLAGS+= -D_POSIX_SOURCE=1 -D_GNU_SOURCE=1 +endif +TARGET_CPPFLAGS+= -D_POSIX_SOURCE -D_GNU_SOURCE ifeq ($(ADK_TARGET_CPU_WITH_MMX),y) CONFIGURE_CPU_OPTS:= --enable-mmx diff --git a/package/findutils/Makefile b/package/findutils/Makefile index 46c3e6681..2848ac91c 100644 --- a/package/findutils/Makefile +++ b/package/findutils/Makefile @@ -5,29 +5,42 @@ include $(TOPDIR)/rules.mk PKG_NAME:= findutils PKG_VERSION:= 4.4.2 -PKG_RELEASE:= 2 +PKG_RELEASE:= 4 PKG_MD5SUM:= 351cc4adb07d54877fa15f75fb77d39f -PKG_DESCR:= GNU utilities for finding files +PKG_DESCR:= utilities for finding files PKG_SECTION:= utils PKG_DEPENDS:= libpthread +PKG_BUILDDEP:= autotool +HOST_BUILDDEP:= autotool PKG_URL:= http://www.gnu.org/software/findutils/ PKG_SITES:= http://ftp.gnu.org/pub/gnu/findutils/ -PKG_SUBPKGS:= FINDUTILS LOCATE -PKGSD_LOCATE:= Locate utility +PKG_SUBPKGS:= FIND XARGS LOCATE +PKGSD_LOCATE:= locate utility +PKGSD_XARGS:= xargs utility +include $(TOPDIR)/mk/host.mk include $(TOPDIR)/mk/package.mk -$(eval $(call PKG_template,FINDUTILS,findutils,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call HOST_template,FINDUTILS,findutils,$(PKG_VERSION)-${PKG_RELEASE})) +$(eval $(call PKG_template,FIND,find,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call PKG_template,XARGS,xargs,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_XARGS},${PKG_SECTION})) $(eval $(call PKG_template,LOCATE,locate,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LOCATE},${PKG_SECTION})) +HOST_STYLE:= auto +AUTOTOOL_STYLE:= autoreconf CONFIGURE_ENV+= gl_cv_func_wcwidth_works=yes \ ac_cv_func_working_mktime=yes -findutils-install: - $(INSTALL_DIR) $(IDIR_FINDUTILS)/usr/bin - $(INSTALL_BIN) $(WRKINST)/usr/bin/{find,oldfind,xargs} \ - $(IDIR_FINDUTILS)/usr/bin +find-install: + $(INSTALL_DIR) $(IDIR_FIND)/usr/bin + $(INSTALL_BIN) $(WRKINST)/usr/bin/find \ + $(IDIR_FIND)/usr/bin + +xargs-install: + $(INSTALL_DIR) $(IDIR_XARGS)/usr/bin + $(INSTALL_BIN) $(WRKINST)/usr/bin/xargs \ + $(IDIR_XARGS)/usr/bin locate-install: ${INSTALL_DIR} ${IDIR_LOCATE}/usr/{bin,libexec} @@ -35,4 +48,5 @@ locate-install: $(INSTALL_BIN) $(WRKINST)/usr/libexec/{bigram,code,frcode} \ $(IDIR_LOCATE)/usr/libexec +include ${TOPDIR}/mk/host-bottom.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/findutils/patches/patch-configure_ac b/package/findutils/patches/patch-configure_ac new file mode 100644 index 000000000..34c03d76f --- /dev/null +++ b/package/findutils/patches/patch-configure_ac @@ -0,0 +1,11 @@ +--- findutils-4.4.2.orig/configure.ac 2009-05-16 17:27:39.000000000 +0200 ++++ findutils-4.4.2/configure.ac 2014-03-23 19:39:22.000000000 +0100 +@@ -77,8 +77,6 @@ AC_PROG_CPP + dnl for gnulib + gl_EARLY + +-AM_C_PROTOTYPES +- + AC_PROG_INSTALL + AC_PROG_RANLIB + dnl AC_PROG_LIBTOOL diff --git a/package/findutils/patches/patch-gnulib_lib_freadahead_c b/package/findutils/patches/patch-gnulib_lib_freadahead_c new file mode 100644 index 000000000..d998fbf6c --- /dev/null +++ b/package/findutils/patches/patch-gnulib_lib_freadahead_c @@ -0,0 +1,15 @@ +--- findutils-4.4.2.orig/gnulib/lib/freadahead.c 2009-05-10 23:23:57.000000000 +0200 ++++ findutils-4.4.2/gnulib/lib/freadahead.c 2014-03-23 16:27:43.000000000 +0100 +@@ -19,6 +19,7 @@ + /* Specification. */ + #include "freadahead.h" + ++#ifndef HAVE___FREADAHEAD + size_t + freadahead (FILE *fp) + { +@@ -64,3 +65,4 @@ freadahead (FILE *fp) + #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread on your system, then report this to bug-gnulib." + #endif + } ++#endif diff --git a/package/findutils/patches/patch-gnulib_lib_freadahead_h b/package/findutils/patches/patch-gnulib_lib_freadahead_h new file mode 100644 index 000000000..194232201 --- /dev/null +++ b/package/findutils/patches/patch-gnulib_lib_freadahead_h @@ -0,0 +1,24 @@ +--- findutils-4.4.2.orig/gnulib/lib/freadahead.h 2009-05-10 23:23:57.000000000 +0200 ++++ findutils-4.4.2/gnulib/lib/freadahead.h 2014-03-23 16:27:43.000000000 +0100 +@@ -29,8 +29,21 @@ extern "C" { + + STREAM must not be wide-character oriented. */ + ++#if HAVE___FREADAHEAD || (defined(__linux__) && !defined(__GLIBC__) && !defined(__UCLIBC__)) /* musl libc */ ++ ++#ifndef HAVE___FREADAHEAD ++#define HAVE___FREADAHEAD 1 ++#endif ++ ++# include <stdio_ext.h> ++# define freadahead(stream) __freadahead (stream) ++ ++#else ++ + extern size_t freadahead (FILE *stream); + ++#endif ++ + #ifdef __cplusplus + } + #endif diff --git a/package/findutils/patches/patch-gnulib_lib_fseeko_c b/package/findutils/patches/patch-gnulib_lib_fseeko_c new file mode 100644 index 000000000..aba9a1133 --- /dev/null +++ b/package/findutils/patches/patch-gnulib_lib_fseeko_c @@ -0,0 +1,18 @@ +--- findutils-4.4.2.orig/gnulib/lib/fseeko.c 2009-05-10 23:25:10.000000000 +0200 ++++ findutils-4.4.2/gnulib/lib/fseeko.c 2014-03-23 16:35:34.000000000 +0100 +@@ -94,8 +94,14 @@ rpl_fseeko (FILE *fp, off_t offset, int + if ((fp->_Mode & _MWRITE ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend) + && fp->_Rback == fp->_Back + sizeof (fp->_Back) + && fp->_Rsave == NULL) ++#elif FUNC_FFLUSH_STDIN < 0 && 200809 <= _POSIX_VERSION ++ /* Cross-compiling to some other system advertising conformance to ++ POSIX.1-2008 or later. Assume fseeko and fflush work as advertised. ++ If this assumption is incorrect, please report the bug to ++ bug-gnulib. */ ++ if (0) + #else +- #error "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib." ++ #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib." + #endif + { + off_t pos = lseek (fileno (fp), offset, whence); diff --git a/package/findutils/patches/patch-gnulib_m4_fflush_m4 b/package/findutils/patches/patch-gnulib_m4_fflush_m4 new file mode 100644 index 000000000..b3dd6a082 --- /dev/null +++ b/package/findutils/patches/patch-gnulib_m4_fflush_m4 @@ -0,0 +1,25 @@ +--- findutils-4.4.2.orig/gnulib/m4/fflush.m4 2009-05-10 23:23:57.000000000 +0200 ++++ findutils-4.4.2/gnulib/m4/fflush.m4 2014-03-23 18:40:09.000000000 +0100 +@@ -32,12 +32,18 @@ AC_DEFUN([gl_FUNC_FFLUSH], + return 4; + return !(lseek (fd, 0, SEEK_CUR) == 5); + ]])], [gl_cv_func_fflush_stdin=yes], [gl_cv_func_fflush_stdin=no], +- [dnl Pessimistically assume fflush is broken. This is wrong for +- dnl at least glibc and cygwin; but lib/fflush.c takes this into account. +- gl_cv_func_fflush_stdin=no]) ++ [gl_cv_func_fflush_stdin=cross]) + rm conftest.txt + ]) +- if test $gl_cv_func_fflush_stdin = no; then ++ case $gl_cv_func_fflush_stdin in ++ yes) gl_func_fflush_stdin=1 ;; ++ no) gl_func_fflush_stdin=0 ;; ++ *) gl_func_fflush_stdin='(-1)' ;; ++ esac ++ AC_DEFINE_UNQUOTED([FUNC_FFLUSH_STDIN], [$gl_func_fflush_stdin], ++ [Define to 1 if fflush is known to work on stdin as per POSIX.1-2008, ++ 0 if fflush is known to not work, -1 if unknown.]) ++ if test $gl_cv_func_fflush_stdin != yes; then + gl_REPLACE_FFLUSH + fi + ]) diff --git a/package/fltk/Makefile b/package/fltk/Makefile index 00795d0b6..d294570b2 100644 --- a/package/fltk/Makefile +++ b/package/fltk/Makefile @@ -30,7 +30,7 @@ ifeq ($(ADK_COMPILE_LIBFLTK_WITH_UCLIBCXX),y) LIBRARIES:=-nodefaultlibs -luClibc++ -lgcc -lgcc_s -lm -lc endif -ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y) +ifeq ($(ADK_TOOLCHAIN_USE_SSP),y) LIBRARIES+=-lssp -lssp_nonshared endif diff --git a/package/fping/Makefile b/package/fping/Makefile index fc8b845aa..7009b540e 100644 --- a/package/fping/Makefile +++ b/package/fping/Makefile @@ -4,15 +4,13 @@ include ${TOPDIR}/rules.mk PKG_NAME:= fping -PKG_VERSION:= 2.4b2_to -PKG_RELEASE:= 1 -PKG_MD5SUM:= d5e8be59e307cef76bc479e1684df705 -PKG_DESCR:= A program to ping hosts in parallel +PKG_VERSION:= 3.9 +PKG_RELEASE:= 2 +PKG_MD5SUM:= 7ad0313646681c33e975f7b946d8d283 +PKG_DESCR:= program to ping hosts in parallel PKG_SECTION:= net -PKG_URL:= http://fping.sourceforge.net/ -PKG_SITES:= http://fping.sourceforge.net/download/ - -DISTFILES:= ${PKG_NAME}.tar.gz +PKG_URL:= http://fping.org +PKG_SITES:= http://fping.org/dist/ include ${TOPDIR}/mk/package.mk diff --git a/package/freetype/Makefile b/package/freetype/Makefile index 55fdd98af..e8bcb24ff 100644 --- a/package/freetype/Makefile +++ b/package/freetype/Makefile @@ -4,10 +4,10 @@ include ${TOPDIR}/rules.mk PKG_NAME:= freetype -PKG_VERSION:= 2.5.1 +PKG_VERSION:= 2.5.3 PKG_RELEASE:= 1 -PKG_MD5SUM:= a359993ad0dc23323c676b04fdb57110 -PKG_DESCR:= A free, high-quality and portable font engine +PKG_MD5SUM:= cafe9f210e45360279c730d27bf071e9 +PKG_DESCR:= free, high-quality and portable font engine PKG_SECTION:= libs PKG_DEPENDS:= zlib PKG_BUILDDEP:= zlib freetype-host @@ -27,8 +27,12 @@ $(eval $(call HOST_template,LIBFREETYPE,libfreetype,${PKG_VERSION}-${PKG_RELEASE $(eval $(call PKG_template,LIBFREETYPE,libfreetype,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) HOST_STYLE:= auto -HOST_CONFIGURE_ARGS+= --without-png -CONFIGURE_ARGS+= --without-png +HOST_CONFIGURE_ARGS+= --with-zlib \ + --without-png \ + --without-bzip2 +CONFIGURE_ARGS+= --with-zlib \ + --without-png \ + --without-bzip2 libfreetype-install: ${INSTALL_DIR} ${IDIR_LIBFREETYPE}/usr/lib diff --git a/package/gcc/Makefile b/package/gcc/Makefile index c0c5f749a..24571fb3e 100644 --- a/package/gcc/Makefile +++ b/package/gcc/Makefile @@ -21,7 +21,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,GCC,gcc,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,GXX,g++,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -CPPFLAGS_FOR_BUILD:= -I$(STAGING_HOST_DIR)/include +CPPFLAGS_FOR_BUILD:= -I$(STAGING_HOST_DIR)/usr/include CFLAGS_FOR_BUILD:= LDFLAGS_FOR_BUILD:= TARGET_CPPFLAGS:= @@ -39,12 +39,6 @@ ifeq ($(ADK_TARGET_SYSTEM_QEMU_MIPS64EL),y) CONFIGURE_ARGS+= --with-abi=$(ADK_TARGET_MIPS_ABI) endif -ifeq ($(ADK_TOOLCHAIN_GCC_SJLJ),y) -CONFIGURE_ARGS+= --enable-sjlj-exceptions -else -CONFIGURE_ARGS+= --disable-sjlj-exceptions -endif - ifneq ($(ADK_PACKAGE_GXX),) CONFIGURE_ARGS+= --enable-languages=c,c++ else @@ -57,7 +51,6 @@ else CONFIGURE_ARGS+= --enable-target-optspace endif - CONFIGURE_ENV+= have_sys_sdt_h=no CONFIGURE_ARGS+= --host=$(GNU_TARGET_NAME) \ --target=$(GNU_TARGET_NAME) \ diff --git a/package/gdb/Makefile b/package/gdb/Makefile index 9fc0b48fa..e282052e3 100644 --- a/package/gdb/Makefile +++ b/package/gdb/Makefile @@ -20,27 +20,28 @@ TARGET_CFLAGS+= -static CONFIGURE_ARGS+= --enable-static endif -TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) TARGET_CFLAGS+= ${TARGET_CPPFLAGS} -fPIC -CONFIGURE_ARGS+= --without-uiout --enable-gdbmi \ - --disable-tui --disable-gdbtk --without-x \ - --without-included-gettext --disable-sim \ - --with-curses --disable-werror \ - --without-auto-load-safe-path \ +CONFIGURE_ARGS+= --without-uiout \ + --disable-tui \ + --disable-gdbtk \ + --without-x \ + --disable-sim \ + --disable-werror \ --disable-gdbserver \ - --without-python + --without-python \ + --without-included-gettext \ + --without-auto-load-safe-path \ + --with-curses \ + --enable-gdbmi + XAKE_FLAGS+= LDFLAGS='${TARGET_LDFLAGS}' # disable honour cflags stuff XAKE_FLAGS+= GCC_HONOUR_COPTS:=s -post-extract: - -mv $(STAGING_TARGET_DIR)/usr/lib/libiberty.a $(STAGING_TARGET_DIR)/usr/lib/libiberty.a.bak - gdb-install: ${INSTALL_DIR} ${IDIR_GDB}/usr/bin ${INSTALL_BIN} ${WRKINST}/usr/bin/gdb ${IDIR_GDB}/usr/bin/ # shipped libbfd conflicts with system wide one rm -f ${WRKINST}/usr/lib/libbfd* - -mv $(STAGING_TARGET_DIR)/usr/lib/libiberty.a.bak $(STAGING_TARGET_DIR)/usr/lib/libiberty.a include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/gdb/patches/microblaze.patch b/package/gdb/patches/microblaze.patch new file mode 100644 index 000000000..ce3f9b35b --- /dev/null +++ b/package/gdb/patches/microblaze.patch @@ -0,0 +1,1842 @@ +diff -Nur gdb-7.7.orig/bfd/bfd-in2.h gdb-7.7/bfd/bfd-in2.h +--- gdb-7.7.orig/bfd/bfd-in2.h 2014-02-06 03:21:29.000000000 +0100 ++++ gdb-7.7/bfd/bfd-in2.h 2014-03-26 19:43:36.000000000 +0100 +@@ -5378,6 +5378,11 @@ + expressions of the form "Symbol Op Symbol" */ + BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM, + ++/* This is a 32 bit reloc that stores the 32 bit pc relative ++value in two words (with an imm instruction). No relocation is ++done here - only used for relaxing */ ++ BFD_RELOC_MICROBLAZE_32_NONE, ++ + /* This is a 64 bit reloc that stores the 32 bit pc relative + value in two words (with an imm instruction). No relocation is + done here - only used for relaxing */ +diff -Nur gdb-7.7.orig/bfd/elf32-microblaze.c gdb-7.7/bfd/elf32-microblaze.c +--- gdb-7.7.orig/bfd/elf32-microblaze.c 2013-12-08 05:55:47.000000000 +0100 ++++ gdb-7.7/bfd/elf32-microblaze.c 2014-03-27 08:30:48.000000000 +0100 +@@ -177,6 +177,20 @@ + FALSE), /* PC relative offset? */ + + /* This reloc does nothing. Used for relaxation. */ ++ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */ ++ 0, /* Rightshift. */ ++ 2, /* Size (0 = byte, 1 = short, 2 = long). */ ++ 32, /* Bitsize. */ ++ TRUE, /* PC_relative. */ ++ 0, /* Bitpos. */ ++ complain_overflow_bitfield, /* Complain on overflow. */ ++ NULL, /* Special Function. */ ++ "R_MICROBLAZE_32_NONE",/* Name. */ ++ FALSE, /* Partial Inplace. */ ++ 0, /* Source Mask. */ ++ 0, /* Dest Mask. */ ++ FALSE), /* PC relative offset? */ ++ + HOWTO (R_MICROBLAZE_64_NONE, /* Type. */ + 0, /* Rightshift. */ + 2, /* Size (0 = byte, 1 = short, 2 = long). */ +@@ -532,7 +546,10 @@ + case BFD_RELOC_NONE: + microblaze_reloc = R_MICROBLAZE_NONE; + break; +- case BFD_RELOC_MICROBLAZE_64_NONE: ++ case BFD_RELOC_MICROBLAZE_32_NONE: ++ microblaze_reloc = R_MICROBLAZE_32_NONE; ++ break; ++ case BFD_RELOC_MICROBLAZE_64_NONE: + microblaze_reloc = R_MICROBLAZE_64_NONE; + break; + case BFD_RELOC_32: +@@ -668,6 +685,67 @@ + return _bfd_elf_is_local_label_name (abfd, name); + } + ++/* Support for core dump NOTE sections. */ ++static bfd_boolean ++microblaze_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) ++{ ++ int offset; ++ unsigned int size; ++ ++ switch (note->descsz) ++ { ++ default: ++ return FALSE; ++ ++ case 228: /* Linux/MicroBlaze */ ++ /* pr_cursig */ ++ elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12); ++ ++ /* pr_pid */ ++ elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24); ++ ++ /* pr_reg */ ++ offset = 72; ++ size = 50 * 4; ++ ++ break; ++ } ++ ++ /* Make a ".reg/999" section. */ ++ return _bfd_elfcore_make_pseudosection (abfd, ".reg", ++ size, note->descpos + offset); ++} ++ ++static bfd_boolean ++microblaze_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) ++{ ++ switch (note->descsz) ++ { ++ default: ++ return FALSE; ++ ++ case 128: /* Linux/MicroBlaze elf_prpsinfo */ ++ elf_tdata (abfd)->core->program ++ = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16); ++ elf_tdata (abfd)->core->command ++ = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80); ++ } ++ ++ /* Note that for some reason, a spurious space is tacked ++ onto the end of the args in some (at least one anyway) ++ implementations, so strip it off if it exists. */ ++ ++ { ++ char *command = elf_tdata (abfd)->core->command; ++ int n = strlen (command); ++ ++ if (0 < n && command[n - 1] == ' ') ++ command[n - 1] = '\0'; ++ } ++ ++ return TRUE; ++} ++ + /* The microblaze linker (like many others) needs to keep track of + the number of relocs that it decides to copy as dynamic relocs in + check_relocs for each symbol. This is so that it can later discard +@@ -1023,7 +1101,7 @@ + { + /* External symbol. */ + bfd_boolean warned ATTRIBUTE_UNUSED; +- bfd_boolean ignored ATTRIBUTE_UNUSED; ++ bfd_boolean ignored; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, +@@ -1852,14 +1930,22 @@ + } + break; + case R_MICROBLAZE_NONE: ++ case R_MICROBLAZE_32_NONE: + { + /* This was a PC-relative instruction that was + completely resolved. */ + int sfix, efix; ++ unsigned int val; + bfd_vma target_address; + target_address = irel->r_addend + irel->r_offset; + sfix = calc_fixup (irel->r_offset, 0, sec); + efix = calc_fixup (target_address, 0, sec); ++ ++ /* Validate the in-band val. */ ++ val = bfd_get_32 (abfd, contents + irel->r_offset); ++ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) { ++ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend); ++ } + irel->r_addend -= (efix - sfix); + /* Should use HOWTO. */ + microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset, +@@ -1907,6 +1993,49 @@ + irelscanend = irelocs + o->reloc_count; + for (irelscan = irelocs; irelscan < irelscanend; irelscan++) + { ++ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE) ++ { ++ unsigned int val; ++ ++ isym = isymbuf + ELF32_R_SYM (irelscan->r_info); ++ ++ /* hax: We only do the following fixup for debug location lists. */ ++ if (strcmp(".debug_loc", o->name)) ++ continue; ++ ++ /* This was a PC-relative instruction that was completely resolved. */ ++ if (ocontents == NULL) ++ { ++ if (elf_section_data (o)->this_hdr.contents != NULL) ++ ocontents = elf_section_data (o)->this_hdr.contents; ++ else ++ { ++ /* We always cache the section contents. ++ Perhaps, if info->keep_memory is FALSE, we ++ should free them, if we are permitted to. */ ++ ++ if (o->rawsize == 0) ++ o->rawsize = o->size; ++ ocontents = (bfd_byte *) bfd_malloc (o->rawsize); ++ if (ocontents == NULL) ++ goto error_return; ++ if (!bfd_get_section_contents (abfd, o, ocontents, ++ (file_ptr) 0, ++ o->rawsize)) ++ goto error_return; ++ elf_section_data (o)->this_hdr.contents = ocontents; ++ } ++ } ++ ++ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset); ++ if (val != irelscan->r_addend) { ++ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend); ++ } ++ ++ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec); ++ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, ++ irelscan->r_addend); ++ } + if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) + { + isym = isymbuf + ELF32_R_SYM (irelscan->r_info); +@@ -1966,7 +2095,7 @@ + elf_section_data (o)->this_hdr.contents = ocontents; + } + } +- irelscan->r_addend -= calc_fixup (irel->r_addend ++ irelscan->r_addend -= calc_fixup (irelscan->r_addend + + isym->st_value, + 0, + sec); +@@ -3506,4 +3635,7 @@ + #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections + #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook + ++#define elf_backend_grok_prstatus microblaze_elf_grok_prstatus ++#define elf_backend_grok_psinfo microblaze_elf_grok_psinfo ++ + #include "elf32-target.h" +diff -Nur gdb-7.7.orig/bfd/libbfd.h gdb-7.7/bfd/libbfd.h +--- gdb-7.7.orig/bfd/libbfd.h 2014-02-06 03:21:29.000000000 +0100 ++++ gdb-7.7/bfd/libbfd.h 2014-03-26 20:02:00.000000000 +0100 +@@ -2615,6 +2615,7 @@ + "BFD_RELOC_MICROBLAZE_32_ROSDA", + "BFD_RELOC_MICROBLAZE_32_RWSDA", + "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM", ++ "BFD_RELOC_MICROBLAZE_32_NONE", + "BFD_RELOC_MICROBLAZE_64_NONE", + "BFD_RELOC_MICROBLAZE_64_GOTPC", + "BFD_RELOC_MICROBLAZE_64_GOT", +diff -Nur gdb-7.7.orig/gdb/Makefile.in gdb-7.7/gdb/Makefile.in +--- gdb-7.7.orig/gdb/Makefile.in 2014-02-06 03:21:29.000000000 +0100 ++++ gdb-7.7/gdb/Makefile.in 2014-03-26 20:33:32.000000000 +0100 +@@ -849,7 +849,7 @@ + annotate.h sim-regno.h dictionary.h dfp.h main.h frame-unwind.h \ + remote-fileio.h i386-linux-tdep.h vax-tdep.h objc-lang.h \ + sentinel-frame.h bcache.h symfile.h windows-tdep.h linux-tdep.h \ +-gdb_usleep.h jit.h xml-syscall.h microblaze-tdep.h \ ++gdb_usleep.h jit.h xml-syscall.h microblaze-tdep.h microblaze-linux-tdep.h \ + psymtab.h psympriv.h progspace.h bfin-tdep.h ia64-hpux-tdep.h \ + amd64-darwin-tdep.h charset-list.h \ + config/djgpp/langinfo.h config/djgpp/nl_types.h darwin-nat.h \ +@@ -1547,7 +1547,7 @@ + m68kbsd-nat.c m68kbsd-tdep.c \ + m68klinux-nat.c m68klinux-tdep.c \ + m88k-tdep.c m88kbsd-nat.c \ +- microblaze-tdep.c microblaze-linux-tdep.c \ ++ microblaze-tdep.c microblaze-linux-nat.c microblaze-linux-tdep.c \ + mingw-hdep.c \ + mips-linux-nat.c mips-linux-tdep.c \ + mips-irix-tdep.c \ +diff -Nur gdb-7.7.orig/gdb/config/microblaze/linux.mh gdb-7.7/gdb/config/microblaze/linux.mh +--- gdb-7.7.orig/gdb/config/microblaze/linux.mh 1970-01-01 01:00:00.000000000 +0100 ++++ gdb-7.7/gdb/config/microblaze/linux.mh 2014-03-24 15:52:56.000000000 +0100 +@@ -0,0 +1,10 @@ ++# Host: Microblaze, running Linux ++ ++NAT_FILE= config/nm-linux.h ++NATDEPFILES= inf-ptrace.o fork-child.o \ ++ microblaze-linux-nat.o proc-service.o linux-thread-db.o \ ++ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o \ ++ linux-waitpid.o ++NAT_CDEPS = $(srcdir)/proc-service.list ++ ++LOADLIBES = -ldl $(RDYNAMIC) +diff -Nur gdb-7.7.orig/gdb/configure.host gdb-7.7/gdb/configure.host +--- gdb-7.7.orig/gdb/configure.host 2013-12-08 05:55:47.000000000 +0100 ++++ gdb-7.7/gdb/configure.host 2014-03-26 20:34:44.000000000 +0100 +@@ -59,6 +59,7 @@ + m68*) gdb_host_cpu=m68k ;; + m88*) gdb_host_cpu=m88k ;; + mips*) gdb_host_cpu=mips ;; ++microblaze*) gdb_host_cpu=microblaze ;; + powerpc* | rs6000) gdb_host_cpu=powerpc ;; + sparcv9 | sparc64) gdb_host_cpu=sparc ;; + s390*) gdb_host_cpu=s390 ;; +@@ -133,6 +134,8 @@ + gdb_host=nbsd ;; + mips64*-*-openbsd*) gdb_host=obsd64 ;; + ++microblaze*-*linux*) gdb_host=linux ;; ++ + powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*) + gdb_host=aix ;; + powerpc*-*-freebsd*) gdb_host=fbsd ;; +diff -Nur gdb-7.7.orig/gdb/configure.tgt gdb-7.7/gdb/configure.tgt +--- gdb-7.7.orig/gdb/configure.tgt 2014-02-06 03:21:29.000000000 +0100 ++++ gdb-7.7/gdb/configure.tgt 2014-03-26 20:36:23.000000000 +0100 +@@ -340,9 +340,10 @@ + + microblaze*-linux-*|microblaze*-*-linux*) + # Target: Xilinx MicroBlaze running Linux +- gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o microblaze-rom.o \ ++ gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o microblaze-rom.o glibc-tdep.o \ + monitor.o dsrec.o solib-svr4.o symfile-mem.o linux-tdep.o" + gdb_sim=../sim/microblaze/libsim.a ++ build_gdbserver=yes + ;; + microblaze*-*-*) + # Target: Xilinx MicroBlaze running standalone +diff -Nur gdb-7.7.orig/gdb/gdbserver/Makefile.in gdb-7.7/gdb/gdbserver/Makefile.in +--- gdb-7.7.orig/gdb/gdbserver/Makefile.in 2014-02-06 03:21:29.000000000 +0100 ++++ gdb-7.7/gdb/gdbserver/Makefile.in 2014-03-26 20:39:22.000000000 +0100 +@@ -148,6 +148,7 @@ + $(srcdir)/linux-ia64-low.c $(srcdir)/linux-low.c \ + $(srcdir)/linux-m32r-low.c \ + $(srcdir)/linux-m68k-low.c $(srcdir)/linux-mips-low.c \ ++ $(srcdir)/linux-microblaze-low.c \ + $(srcdir)/linux-nios2-low.c \ + $(srcdir)/linux-ppc-low.c \ + $(srcdir)/linux-s390-low.c \ +@@ -328,6 +329,7 @@ + rm -f arm-with-iwmmxt.c + rm -f arm-with-vfpv2.c arm-with-vfpv3.c arm-with-neon.c + rm -f mips-linux.c mips64-linux.c ++ rm -f microblaze-linux.c + rm -f nios2-linux.c + rm -f powerpc-32.c powerpc-32l.c powerpc-64l.c powerpc-e500l.c + rm -f powerpc-altivec32l.c powerpc-cell32l.c powerpc-vsx32l.c +@@ -600,6 +602,8 @@ + $(SHELL) $(regdat_sh) $(srcdir)/../regformats/mips64-linux.dat mips64-linux.c + mips64-dsp-linux.c : $(srcdir)/../regformats/mips64-dsp-linux.dat $(regdat_sh) + $(SHELL) $(regdat_sh) $(srcdir)/../regformats/mips64-dsp-linux.dat mips64-dsp-linux.c ++microblaze-linux.c : $(srcdir)/../regformats/reg-microblaze.dat $(regdat_sh) ++ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-microblaze.dat microblaze-linux.c + nios2-linux.c : $(srcdir)/../regformats/nios2-linux.dat $(regdat_sh) + $(SHELL) $(regdat_sh) $(srcdir)/../regformats/nios2-linux.dat nios2-linux.c + powerpc-32.c : $(srcdir)/../regformats/rs6000/powerpc-32.dat $(regdat_sh) +diff -Nur gdb-7.7.orig/gdb/gdbserver/configure.srv gdb-7.7/gdb/gdbserver/configure.srv +--- gdb-7.7.orig/gdb/gdbserver/configure.srv 2014-01-08 10:23:36.000000000 +0100 ++++ gdb-7.7/gdb/gdbserver/configure.srv 2014-03-26 20:40:44.000000000 +0100 +@@ -198,6 +198,13 @@ + srv_linux_usrregs=yes + srv_linux_thread_db=yes + ;; ++ microblaze*-*-linux*) srv_regobj=microblaze-linux.o ++ srv_tgtobj="$srv_linux_obj linux-microblaze-low.o" ++ srv_linux_usrregs=yes ++ srv_linux_regsets=yes ++ srv_linux_thread_db=yes ++ ;; ++ + nios2*-*-linux*) srv_regobj="nios2-linux.o" + srv_tgtobj="$srv_linux_obj linux-nios2-low.o" + srv_xmlfiles="nios2-linux.xml" +diff -Nur gdb-7.7.orig/gdb/gdbserver/linux-microblaze-low.c gdb-7.7/gdb/gdbserver/linux-microblaze-low.c +--- gdb-7.7.orig/gdb/gdbserver/linux-microblaze-low.c 1970-01-01 01:00:00.000000000 +0100 ++++ gdb-7.7/gdb/gdbserver/linux-microblaze-low.c 2014-03-26 20:41:13.000000000 +0100 +@@ -0,0 +1,228 @@ ++/* GNU/Linux/Microblaze specific low level interface, for the remote server for ++ GDB. ++ Copyright (C) 1995-2013 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */ ++ ++#include "server.h" ++#include "linux-low.h" ++ ++#include <asm/ptrace.h> ++#include <sys/procfs.h> ++#include <sys/ptrace.h> ++ ++#include "gdb_proc_service.h" ++ ++static int microblaze_regmap[] = ++ {PT_GPR(0), PT_GPR(1), PT_GPR(2), PT_GPR(3), ++ PT_GPR(4), PT_GPR(5), PT_GPR(6), PT_GPR(7), ++ PT_GPR(8), PT_GPR(9), PT_GPR(10), PT_GPR(11), ++ PT_GPR(12), PT_GPR(13), PT_GPR(14), PT_GPR(15), ++ PT_GPR(16), PT_GPR(17), PT_GPR(18), PT_GPR(19), ++ PT_GPR(20), PT_GPR(21), PT_GPR(22), PT_GPR(23), ++ PT_GPR(24), PT_GPR(25), PT_GPR(26), PT_GPR(27), ++ PT_GPR(28), PT_GPR(29), PT_GPR(30), PT_GPR(31), ++ PT_PC, PT_MSR, PT_EAR, PT_ESR, ++ PT_FSR ++ }; ++ ++#define microblaze_num_regs (sizeof microblaze_regmap / sizeof microblaze_regmap[0]) ++ ++/* Defined in auto-generated file microblaze-linux.c. */ ++void init_registers_microblaze (void); ++extern const struct target_desc *tdesc_microblaze; ++ ++static int ++microblaze_cannot_store_register (int regno) ++{ ++ if (microblaze_regmap[regno] == -1 || regno == 0) ++ return 1; ++ ++ return 0; ++} ++ ++static int ++microblaze_cannot_fetch_register (int regno) ++{ ++ return 0; ++} ++ ++static CORE_ADDR ++microblaze_get_pc (struct regcache *regcache) ++{ ++ unsigned long pc; ++ ++ collect_register_by_name (regcache, "pc", &pc); ++ return (CORE_ADDR) pc; ++} ++ ++static void ++microblaze_set_pc (struct regcache *regcache, CORE_ADDR pc) ++{ ++ unsigned long newpc = pc; ++ ++ supply_register_by_name (regcache, "pc", &newpc); ++} ++ ++/* dbtrap insn */ ++/* brki r16, 0x18; */ ++static const unsigned long microblaze_breakpoint = 0xba0c0018; ++#define microblaze_breakpoint_len 4 ++ ++static int ++microblaze_breakpoint_at (CORE_ADDR where) ++{ ++ unsigned long insn; ++ ++ (*the_target->read_memory) (where, (unsigned char *) &insn, 4); ++ if (insn == microblaze_breakpoint) ++ return 1; ++ /* If necessary, recognize more trap instructions here. GDB only uses the ++ one. */ ++ return 0; ++} ++ ++static CORE_ADDR ++microblaze_reinsert_addr (struct regcache *regcache) ++{ ++ unsigned long pc; ++ collect_register_by_name (regcache, "r15", &pc); ++ return pc; ++} ++ ++#ifdef HAVE_PTRACE_GETREGS ++ ++static void ++microblaze_collect_ptrace_register (struct regcache *regcache, int regno, char *buf) ++{ ++ int size = register_size (regcache->tdesc, regno); ++ ++ memset (buf, 0, sizeof (long)); ++ ++ if (size < sizeof (long)) ++ collect_register (regcache, regno, buf + sizeof (long) - size); ++ else ++ collect_register (regcache, regno, buf); ++} ++ ++static void ++microblaze_supply_ptrace_register (struct regcache *regcache, ++ int regno, const char *buf) ++{ ++ int size = register_size (regcache->tdesc, regno); ++ ++ if (regno == 0) { ++ unsigned long regbuf_0 = 0; ++ /* clobbering r0 so that it is always 0 as enforced by hardware */ ++ supply_register (regcache, regno, (const char*)®buf_0); ++ } else { ++ if (size < sizeof (long)) ++ supply_register (regcache, regno, buf + sizeof (long) - size); ++ else ++ supply_register (regcache, regno, buf); ++ } ++} ++ ++/* Provide only a fill function for the general register set. ps_lgetregs ++ will use this for NPTL support. */ ++ ++static void microblaze_fill_gregset (struct regcache *regcache, void *buf) ++{ ++ int i; ++ ++ for (i = 0; i < 32; i++) ++ microblaze_collect_ptrace_register (regcache, i, (char *) buf + microblaze_regmap[i]); ++} ++ ++static void ++microblaze_store_gregset (struct regcache *regcache, const void *buf) ++{ ++ int i; ++ ++ for (i = 0; i < 32; i++) ++ supply_register (regcache, i, (char *) buf + microblaze_regmap[i]); ++} ++ ++#endif /* HAVE_PTRACE_GETREGS */ ++ ++static struct regset_info microblaze_regsets[] = { ++#ifdef HAVE_PTRACE_GETREGS ++ { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t), GENERAL_REGS, microblaze_fill_gregset, microblaze_store_gregset }, ++ { 0, 0, 0, -1, -1, NULL, NULL }, ++#endif /* HAVE_PTRACE_GETREGS */ ++ { 0, 0, 0, -1, -1, NULL, NULL } ++}; ++ ++static struct regsets_info microblaze_regsets_info = ++ { ++ microblaze_regsets, /* regsets */ ++ 0, /* num_regsets */ ++ NULL, /* disabled_regsets */ ++ }; ++ ++static struct usrregs_info microblaze_usrregs_info = ++ { ++ microblaze_num_regs, ++ microblaze_regmap, ++ }; ++ ++static struct regs_info regs_info = ++ { ++ NULL, /* regset_bitmap */ ++ µblaze_usrregs_info, ++ µblaze_regsets_info ++ }; ++ ++static const struct regs_info * ++microblaze_regs_info (void) ++{ ++ return ®s_info; ++} ++ ++static void ++microblaze_arch_setup (void) ++{ ++ current_process ()->tdesc = tdesc_microblaze; ++} ++ ++struct linux_target_ops the_low_target = { ++ microblaze_arch_setup, ++ microblaze_regs_info, ++ microblaze_cannot_fetch_register, ++ microblaze_cannot_store_register, ++ NULL, /* fetch_register */ ++ microblaze_get_pc, ++ microblaze_set_pc, ++ (const unsigned char *) µblaze_breakpoint, ++ microblaze_breakpoint_len, ++ microblaze_reinsert_addr, ++ 0, ++ microblaze_breakpoint_at, ++ NULL, ++ NULL, ++ NULL, ++ NULL, ++ microblaze_collect_ptrace_register, ++ microblaze_supply_ptrace_register, ++}; ++ ++void ++initialize_low_arch (void) ++{ ++ init_registers_microblaze (); ++ ++ initialize_regsets_info (µblaze_regsets_info); ++} +\ No newline at end of file +diff -Nur gdb-7.7.orig/gdb/microblaze-linux-nat.c gdb-7.7/gdb/microblaze-linux-nat.c +--- gdb-7.7.orig/gdb/microblaze-linux-nat.c 1970-01-01 01:00:00.000000000 +0100 ++++ gdb-7.7/gdb/microblaze-linux-nat.c 2014-03-27 09:51:56.000000000 +0100 +@@ -0,0 +1,430 @@ ++/* Microblaze GNU/Linux native support. ++ ++ Copyright (C) 1988-1989, 1991-1992, 1994, 1996, 2000-2012 Free ++ Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */ ++ ++#include "defs.h" ++#include "arch-utils.h" ++#include "dis-asm.h" ++#include "frame.h" ++#include "trad-frame.h" ++#include "symtab.h" ++#include "value.h" ++#include "gdbcmd.h" ++#include "breakpoint.h" ++#include "inferior.h" ++#include "regcache.h" ++#include "target.h" ++#include "frame.h" ++#include "frame-base.h" ++#include "frame-unwind.h" ++#include "dwarf2-frame.h" ++#include "osabi.h" ++ ++#include "gdb_assert.h" ++#include "target-descriptions.h" ++#include "opcodes/microblaze-opcm.h" ++#include "opcodes/microblaze-dis.h" ++ ++#include "linux-nat.h" ++#include "target-descriptions.h" ++ ++#include <sys/user.h> ++#include <sys/utsname.h> ++#include <sys/procfs.h> ++#include <sys/ptrace.h> ++ ++/* Prototypes for supply_gregset etc. */ ++#include "gregset.h" ++ ++#include "microblaze-tdep.h" ++ ++#include <elf/common.h> ++#include "auxv.h" ++ ++/* Defines ps_err_e, struct ps_prochandle. */ ++#include "gdb_proc_service.h" ++ ++/* On GNU/Linux, threads are implemented as pseudo-processes, in which ++ case we may be tracing more than one process at a time. In that ++ case, inferior_ptid will contain the main process ID and the ++ individual thread (process) ID. get_thread_id () is used to get ++ the thread id if it's available, and the process id otherwise. */ ++ ++int ++get_thread_id (ptid_t ptid) ++{ ++ int tid = ptid_get_lwp (ptid); ++ if (0 == tid) ++ tid = ptid_get_pid (ptid); ++ return tid; ++} ++ ++#define GET_THREAD_ID(PTID) get_thread_id (PTID) ++ ++/* Non-zero if our kernel may support the PTRACE_GETREGS and ++ PTRACE_SETREGS requests, for reading and writing the ++ general-purpose registers. Zero if we've tried one of ++ them and gotten an error. */ ++int have_ptrace_getsetregs = 1; ++ ++static int ++microblaze_register_u_addr (struct gdbarch *gdbarch, int regno) ++{ ++ int u_addr = -1; ++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); ++ /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace ++ interface, and not the wordsize of the program's ABI. */ ++ int wordsize = sizeof (long); ++ ++ /* General purpose registers occupy 1 slot each in the buffer. */ ++ if (regno >= MICROBLAZE_R0_REGNUM ++ && regno <= MICROBLAZE_FSR_REGNUM) ++ u_addr = (regno * wordsize); ++ ++ return u_addr; ++} ++ ++ ++static void ++fetch_register (struct regcache *regcache, int tid, int regno) ++{ ++ struct gdbarch *gdbarch = get_regcache_arch (regcache); ++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); ++ /* This isn't really an address. But ptrace thinks of it as one. */ ++ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno); ++ int bytes_transferred; ++ unsigned int offset; /* Offset of registers within the u area. */ ++ char buf[MAX_REGISTER_SIZE]; ++ ++ if (regaddr == -1) ++ { ++ memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */ ++ regcache_raw_supply (regcache, regno, buf); ++ return; ++ } ++ ++ /* Read the raw register using sizeof(long) sized chunks. On a ++ 32-bit platform, 64-bit floating-point registers will require two ++ transfers. */ ++ for (bytes_transferred = 0; ++ bytes_transferred < register_size (gdbarch, regno); ++ bytes_transferred += sizeof (long)) ++ { ++ long l; ++ ++ errno = 0; ++ l = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0); ++ regaddr += sizeof (long); ++ if (errno != 0) ++ { ++ char message[128]; ++ sprintf (message, "reading register %s (#%d)", ++ gdbarch_register_name (gdbarch, regno), regno); ++ perror_with_name (message); ++ } ++ memcpy (&buf[bytes_transferred], &l, sizeof (l)); ++ } ++ ++ /* Now supply the register. Keep in mind that the regcache's idea ++ of the register's size may not be a multiple of sizeof ++ (long). */ ++ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE) ++ { ++ /* Little-endian values are always found at the left end of the ++ bytes transferred. */ ++ regcache_raw_supply (regcache, regno, buf); ++ } ++ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) ++ { ++ /* Big-endian values are found at the right end of the bytes ++ transferred. */ ++ size_t padding = (bytes_transferred - register_size (gdbarch, regno)); ++ regcache_raw_supply (regcache, regno, buf + padding); ++ } ++ else ++ internal_error (__FILE__, __LINE__, ++ _("fetch_register: unexpected byte order: %d"), ++ gdbarch_byte_order (gdbarch)); ++} ++ ++/* This function actually issues the request to ptrace, telling ++ it to get all general-purpose registers and put them into the ++ specified regset. ++ ++ If the ptrace request does not exist, this function returns 0 ++ and properly sets the have_ptrace_* flag. If the request fails, ++ this function calls perror_with_name. Otherwise, if the request ++ succeeds, then the regcache gets filled and 1 is returned. */ ++static int ++fetch_all_gp_regs (struct regcache *regcache, int tid) ++{ ++ struct gdbarch *gdbarch = get_regcache_arch (regcache); ++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); ++ gdb_gregset_t gregset; ++ ++ if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0) ++ { ++ if (errno == EIO) ++ { ++ have_ptrace_getsetregs = 0; ++ return 0; ++ } ++ perror_with_name (_("Couldn't get general-purpose registers.")); ++ } ++ ++ supply_gregset (regcache, (const gdb_gregset_t *) &gregset); ++ ++ return 1; ++} ++ ++ ++/* This is a wrapper for the fetch_all_gp_regs function. It is ++ responsible for verifying if this target has the ptrace request ++ that can be used to fetch all general-purpose registers at one ++ shot. If it doesn't, then we should fetch them using the ++ old-fashioned way, which is to iterate over the registers and ++ request them one by one. */ ++static void ++fetch_gp_regs (struct regcache *regcache, int tid) ++{ ++ struct gdbarch *gdbarch = get_regcache_arch (regcache); ++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); ++ int i; ++ ++ if (have_ptrace_getsetregs) ++ if (fetch_all_gp_regs (regcache, tid)) ++ return; ++ ++ /* If we've hit this point, it doesn't really matter which ++ architecture we are using. We just need to read the ++ registers in the "old-fashioned way". */ ++ for (i = MICROBLAZE_R0_REGNUM; i <= MICROBLAZE_FSR_REGNUM; i++) ++ fetch_register (regcache, tid, i); ++} ++ ++ ++static void ++store_register (const struct regcache *regcache, int tid, int regno) ++{ ++ struct gdbarch *gdbarch = get_regcache_arch (regcache); ++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); ++ /* This isn't really an address. But ptrace thinks of it as one. */ ++ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno); ++ int i; ++ size_t bytes_to_transfer; ++ char buf[MAX_REGISTER_SIZE]; ++ ++ if (regaddr == -1) ++ return; ++ ++ /* First collect the register. Keep in mind that the regcache's ++ idea of the register's size may not be a multiple of sizeof ++ (long). */ ++ memset (buf, 0, sizeof buf); ++ bytes_to_transfer = align_up (register_size (gdbarch, regno), sizeof (long)); ++ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE) ++ { ++ /* Little-endian values always sit at the left end of the buffer. */ ++ regcache_raw_collect (regcache, regno, buf); ++ } ++ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) ++ { ++ /* Big-endian values sit at the right end of the buffer. */ ++ size_t padding = (bytes_to_transfer - register_size (gdbarch, regno)); ++ regcache_raw_collect (regcache, regno, buf + padding); ++ } ++ ++ for (i = 0; i < bytes_to_transfer; i += sizeof (long)) ++ { ++ long l; ++ ++ memcpy (&l, &buf[i], sizeof (l)); ++ errno = 0; ++ ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, l); ++ regaddr += sizeof (long); ++ ++ if (errno != 0) ++ { ++ char message[128]; ++ sprintf (message, "writing register %s (#%d)", ++ gdbarch_register_name (gdbarch, regno), regno); ++ perror_with_name (message); ++ } ++ } ++} ++ ++/* This function actually issues the request to ptrace, telling ++ it to store all general-purpose registers present in the specified ++ regset. ++ ++ If the ptrace request does not exist, this function returns 0 ++ and properly sets the have_ptrace_* flag. If the request fails, ++ this function calls perror_with_name. Otherwise, if the request ++ succeeds, then the regcache is stored and 1 is returned. */ ++static int ++store_all_gp_regs (const struct regcache *regcache, int tid, int regno) ++{ ++ struct gdbarch *gdbarch = get_regcache_arch (regcache); ++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); ++ gdb_gregset_t gregset; ++ ++ if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0) ++ { ++ if (errno == EIO) ++ { ++ have_ptrace_getsetregs = 0; ++ return 0; ++ } ++ perror_with_name (_("Couldn't get general-purpose registers.")); ++ } ++ ++ fill_gregset (regcache, &gregset, regno); ++ ++ if (ptrace (PTRACE_SETREGS, tid, 0, (void *) &gregset) < 0) ++ { ++ if (errno == EIO) ++ { ++ have_ptrace_getsetregs = 0; ++ return 0; ++ } ++ perror_with_name (_("Couldn't set general-purpose registers.")); ++ } ++ ++ return 1; ++} ++ ++/* This is a wrapper for the store_all_gp_regs function. It is ++ responsible for verifying if this target has the ptrace request ++ that can be used to store all general-purpose registers at one ++ shot. If it doesn't, then we should store them using the ++ old-fashioned way, which is to iterate over the registers and ++ store them one by one. */ ++static void ++store_gp_regs (const struct regcache *regcache, int tid, int regno) ++{ ++ struct gdbarch *gdbarch = get_regcache_arch (regcache); ++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); ++ int i; ++ ++ if (have_ptrace_getsetregs) ++ if (store_all_gp_regs (regcache, tid, regno)) ++ return; ++ ++ /* If we hit this point, it doesn't really matter which ++ architecture we are using. We just need to store the ++ registers in the "old-fashioned way". */ ++ for (i = MICROBLAZE_R0_REGNUM; i <= MICROBLAZE_FSR_REGNUM; i++) ++ store_register (regcache, tid, i); ++} ++ ++ ++/* Fetch registers from the child process. Fetch all registers if ++ regno == -1, otherwise fetch all general registers or all floating ++ point registers depending upon the value of regno. */ ++ ++static void ++microblaze_linux_fetch_inferior_registers (struct target_ops *ops, ++ struct regcache *regcache, int regno) ++{ ++ /* Get the thread id for the ptrace call. */ ++ int tid = GET_THREAD_ID (inferior_ptid); ++ ++ if (regno == -1) ++ fetch_gp_regs (regcache, tid); ++ else ++ fetch_register (regcache, tid, regno); ++} ++ ++/* Store registers back into the inferior. Store all registers if ++ regno == -1, otherwise store all general registers or all floating ++ point registers depending upon the value of regno. */ ++ ++static void ++microblaze_linux_store_inferior_registers (struct target_ops *ops, ++ struct regcache *regcache, int regno) ++{ ++ /* Get the thread id for the ptrace call. */ ++ int tid = GET_THREAD_ID (inferior_ptid); ++ ++ if (regno >= 0) ++ store_register (regcache, tid, regno); ++ else ++ store_gp_regs (regcache, tid, -1); ++} ++ ++/* Wrapper functions for the standard regset handling, used by ++ thread debugging. */ ++ ++void ++fill_gregset (const struct regcache *regcache, ++ gdb_gregset_t *gregsetp, int regno) ++{ ++ microblaze_collect_gregset (NULL, regcache, regno, gregsetp); ++} ++ ++void ++supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp) ++{ ++ microblaze_supply_gregset (NULL, regcache, -1, gregsetp); ++} ++ ++void ++fill_fpregset (const struct regcache *regcache, ++ gdb_fpregset_t *fpregsetp, int regno) ++{ ++ /* FIXME. */ ++} ++ ++void ++supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp) ++{ ++ /* FIXME. */ ++} ++ ++static const struct target_desc * ++microblaze_linux_read_description (struct target_ops *ops) ++{ ++ CORE_ADDR microblaze_hwcap = 0; ++ ++ if (target_auxv_search (ops, AT_HWCAP, µblaze_hwcap) != 1) ++ return NULL; ++ ++ return NULL; ++} ++ ++ ++void _initialize_microblaze_linux_nat (void); ++ ++void ++_initialize_microblaze_linux_nat (void) ++{ ++ struct target_ops *t; ++ ++ /* Fill in the generic GNU/Linux methods. */ ++ t = linux_target (); ++ ++ /* Add our register access methods. */ ++ t->to_fetch_registers = microblaze_linux_fetch_inferior_registers; ++ t->to_store_registers = microblaze_linux_store_inferior_registers; ++ ++ t->to_read_description = microblaze_linux_read_description; ++ ++ /* Register the target. */ ++ linux_nat_add_target (t); ++} +diff -Nur gdb-7.7.orig/gdb/microblaze-linux-tdep.c gdb-7.7/gdb/microblaze-linux-tdep.c +--- gdb-7.7.orig/gdb/microblaze-linux-tdep.c 2014-01-08 10:23:36.000000000 +0100 ++++ gdb-7.7/gdb/microblaze-linux-tdep.c 2014-03-26 10:11:41.000000000 +0100 +@@ -1,6 +1,6 @@ + /* Target-dependent code for Xilinx MicroBlaze. + +- Copyright (C) 2009-2014 Free Software Foundation, Inc. ++ Copyright (C) 2009-2013 Free Software Foundation, Inc. + + This file is part of GDB. + +@@ -32,11 +32,28 @@ + #include "regset.h" + #include "solib-svr4.h" + #include "microblaze-tdep.h" ++#include "glibc-tdep.h" + #include "trad-frame.h" + #include "frame-unwind.h" + #include "tramp-frame.h" + #include "linux-tdep.h" + ++static int microblaze_debug_flag = 0; ++ ++static void ++microblaze_debug (const char *fmt, ...) ++{ ++ if (microblaze_debug_flag) ++ { ++ va_list args; ++ ++ va_start (args, fmt); ++ printf_unfiltered ("MICROBLAZE LINUX: "); ++ vprintf_unfiltered (fmt, args); ++ va_end (args); ++ } ++} ++ + static int + microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) +@@ -46,20 +63,27 @@ + int val; + int bplen; + gdb_byte old_contents[BREAKPOINT_MAX]; ++ struct cleanup *cleanup; + + /* Determine appropriate breakpoint contents and size for this address. */ + bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); + if (bp == NULL) + error (_("Software breakpoints not implemented for this target.")); + ++ /* Make sure we see the memory breakpoints. */ ++ cleanup = make_show_memory_breakpoints_cleanup (1); + val = target_read_memory (addr, old_contents, bplen); + + /* If our breakpoint is no longer at the address, this means that the + program modified the code on us, so it is wrong to put back the + old value. */ + if (val == 0 && memcmp (bp, old_contents, bplen) == 0) +- val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen); ++ { ++ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen); ++ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr); ++ } + ++ do_cleanups (cleanup); + return val; + } + +@@ -116,6 +140,43 @@ + microblaze_linux_sighandler_cache_init + }; + ++const struct microblaze_gregset microblaze_linux_core_gregset; ++ ++static void ++microblaze_linux_supply_core_gregset (const struct regset *regset, ++ struct regcache *regcache, ++ int regnum, const void *gregs, size_t len) ++{ ++ microblaze_supply_gregset (µblaze_linux_core_gregset, regcache, ++ regnum, gregs); ++} ++ ++static void ++microblaze_linux_collect_core_gregset (const struct regset *regset, ++ const struct regcache *regcache, ++ int regnum, void *gregs, size_t len) ++{ ++ microblaze_collect_gregset (µblaze_linux_core_gregset, regcache, ++ regnum, gregs); ++} ++ ++static void ++microblaze_linux_supply_core_fpregset (const struct regset *regset, ++ struct regcache *regcache, ++ int regnum, const void *fpregs, size_t len) ++{ ++ /* FIXME. */ ++ microblaze_supply_fpregset (regcache, regnum, fpregs); ++} ++ ++static void ++microblaze_linux_collect_core_fpregset (const struct regset *regset, ++ const struct regcache *regcache, ++ int regnum, void *fpregs, size_t len) ++{ ++ /* FIXME. */ ++ microblaze_collect_fpregset (regcache, regnum, fpregs); ++} + + static void + microblaze_linux_init_abi (struct gdbarch_info info, +@@ -123,6 +184,10 @@ + { + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ++ tdep->gregset = regset_alloc (gdbarch, microblaze_linux_supply_core_gregset, ++ microblaze_linux_collect_core_gregset); ++ tdep->sizeof_gregset = 200; ++ + linux_init_abi (info, gdbarch); + + set_gdbarch_memory_remove_breakpoint (gdbarch, +@@ -135,6 +200,25 @@ + /* Trampolines. */ + tramp_frame_prepend_unwinder (gdbarch, + µblaze_linux_sighandler_tramp_frame); ++ ++ /* BFD target for core files. */ ++ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) ++ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze"); ++ else ++ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel"); ++ ++ ++ /* Shared library handling. */ ++ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); ++ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); ++ ++ set_gdbarch_regset_from_core_section (gdbarch, ++ microblaze_regset_from_core_section); ++ ++ /* Enable TLS support. */ ++ set_gdbarch_fetch_tls_load_module_address (gdbarch, ++ svr4_fetch_objfile_link_map); ++ + } + + /* -Wmissing-prototypes */ +diff -Nur gdb-7.7.orig/gdb/microblaze-rom.c gdb-7.7/gdb/microblaze-rom.c +--- gdb-7.7.orig/gdb/microblaze-rom.c 2014-01-08 10:23:36.000000000 +0100 ++++ gdb-7.7/gdb/microblaze-rom.c 2014-03-27 08:56:48.000000000 +0100 +@@ -1,6 +1,6 @@ + /* Remote debugging interface to Xilinx MicroBlaze. + +- Copyright (C) 2009-2014 Free Software Foundation, Inc. ++ Copyright (C) 2009-2013 Free Software Foundation, Inc. + + This file is part of GDB. + +@@ -21,7 +21,6 @@ + #include "gdbcore.h" + #include "target.h" + #include "monitor.h" +-#include <string.h> + #include "serial.h" + #include "regcache.h" + +diff -Nur gdb-7.7.orig/gdb/microblaze-tdep.c gdb-7.7/gdb/microblaze-tdep.c +--- gdb-7.7.orig/gdb/microblaze-tdep.c 2014-02-06 03:21:29.000000000 +0100 ++++ gdb-7.7/gdb/microblaze-tdep.c 2014-03-27 08:46:21.000000000 +0100 +@@ -1,6 +1,6 @@ + /* Target-dependent code for Xilinx MicroBlaze. + +- Copyright (C) 2009-2014 Free Software Foundation, Inc. ++ Copyright (C) 2009-2013 Free Software Foundation, Inc. + + This file is part of GDB. + +@@ -29,13 +29,13 @@ + #include "inferior.h" + #include "regcache.h" + #include "target.h" ++#include "frame.h" + #include "frame-base.h" + #include "frame-unwind.h" + #include "dwarf2-frame.h" + #include "osabi.h" + + #include "gdb_assert.h" +-#include <string.h> + #include "target-descriptions.h" + #include "opcodes/microblaze-opcm.h" + #include "opcodes/microblaze-dis.h" +@@ -73,7 +73,8 @@ + "rpc", "rmsr", "rear", "resr", "rfsr", "rbtr", + "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6", + "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11", +- "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi" ++ "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi", ++ "rslr", "rshr" + }; + + #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names) +@@ -145,6 +146,14 @@ + return sp; + } + ++static CORE_ADDR ++microblaze_store_arguments (struct regcache *regcache, int nargs, ++ struct value **args, CORE_ADDR sp, ++ int struct_return, CORE_ADDR struct_addr) ++{ ++ error (_("store_arguments not implemented")); ++ return sp; ++} + + static CORE_ADDR + microblaze_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -156,14 +165,52 @@ + return sp; + } + ++static int ++microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, ++ struct bp_target_info *bp_tgt) ++{ ++ CORE_ADDR addr = bp_tgt->placed_address; ++ const unsigned char *bp; ++ int val; ++ int bplen; ++ gdb_byte old_contents[BREAKPOINT_MAX]; ++ struct cleanup *cleanup; ++ ++ /* Determine appropriate breakpoint contents and size for this address. */ ++ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); ++ if (bp == NULL) ++ error (_("Software breakpoints not implemented for this target.")); ++ ++ /* Make sure we see the memory breakpoints. */ ++ cleanup = make_show_memory_breakpoints_cleanup (1); ++ val = target_read_memory (addr, old_contents, bplen); ++ ++ /* If our breakpoint is no longer at the address, this means that the ++ program modified the code on us, so it is wrong to put back the ++ old value. */ ++ if (val == 0 && memcmp (bp, old_contents, bplen) == 0) ++ { ++ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen); ++ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr); ++ } ++ ++ do_cleanups (cleanup); ++ return val; ++} ++ + static const gdb_byte * + microblaze_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc, + int *len) + { ++ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + static gdb_byte break_insn[] = MICROBLAZE_BREAKPOINT; ++ static gdb_byte break_insn_le[] = MICROBLAZE_BREAKPOINT_LE; + + *len = sizeof (break_insn); +- return break_insn; ++ if (byte_order == BFD_ENDIAN_BIG) ++ return break_insn; ++ else ++ return break_insn_le; + } + + /* Allocate and initialize a frame cache. */ +@@ -178,6 +225,7 @@ + /* Base address. */ + cache->base = 0; + cache->pc = 0; ++ cache->saved_sp = 0; + + /* Frameless until proven otherwise. */ + cache->frameless_p = 1; +@@ -234,6 +282,8 @@ + int flags = 0; + int save_hidden_pointer_found = 0; + int non_stack_instruction_found = 0; ++ int n_insns; ++ unsigned int *insn_block; + + /* Find the start of this function. */ + find_pc_partial_function (pc, &name, &func_addr, &func_end); +@@ -273,11 +323,18 @@ + name, paddress (gdbarch, func_addr), + paddress (gdbarch, stop)); + ++/* Do a block read to minimize the transaction with the Debug Agent */ ++ n_insns = (stop == func_addr) ? 1 : ((stop - func_addr) / INST_WORD_SIZE); ++ insn_block = calloc(n_insns, sizeof(unsigned long)); ++ ++ target_read_memory (func_addr, (void*) insn_block, n_insns * INST_WORD_SIZE ); ++ + for (addr = func_addr; addr < stop; addr += INST_WORD_SIZE) + { + insn = microblaze_fetch_instruction (addr); ++ //insn = insn_block[(addr - func_addr) / INST_WORD_SIZE]; + op = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm); +- microblaze_debug ("%s %08lx\n", paddress (gdbarch, pc), insn); ++ microblaze_debug ("%s %08lx op=%x r%d r%d imm=%d\n", paddress (gdbarch, addr), insn, op, rd, ra, imm); + + /* This code is very sensitive to what functions are present in the + prologue. It assumes that the (addi, addik, swi, sw) can be the +@@ -291,6 +348,7 @@ + cache->frameless_p = 0; /* Frame found. */ + save_hidden_pointer_found = 0; + non_stack_instruction_found = 0; ++ cache->register_offsets[rd] = -imm; + continue; + } + else if (IS_SPILL_SP(op, rd, ra)) +@@ -401,8 +459,8 @@ + part of the prologue. */ + if (save_hidden_pointer_found) + prologue_end_addr -= INST_WORD_SIZE; +- +- return prologue_end_addr; ++ free(insn_block); ++ return prologue_end_addr; + } + + static CORE_ADDR +@@ -452,6 +510,7 @@ + return start_pc; + } + ++enum { REG_UNAVAIL = (CORE_ADDR) -1 }; + /* Normal frames. */ + + static struct microblaze_frame_cache * +@@ -459,7 +518,7 @@ + { + struct microblaze_frame_cache *cache; + struct gdbarch *gdbarch = get_frame_arch (next_frame); +- CORE_ADDR func; ++ CORE_ADDR current_pc; + int rn; + + if (*this_cache) +@@ -473,9 +532,18 @@ + for (rn = 0; rn < gdbarch_num_regs (gdbarch); rn++) + cache->register_offsets[rn] = -1; + +- func = get_frame_func (next_frame); ++ cache->pc = get_frame_func (next_frame); ++ current_pc = get_frame_pc (next_frame); ++ ++ if (cache->pc) ++ microblaze_analyze_prologue (gdbarch, cache->pc, current_pc, ++ cache); + +- cache->pc = get_frame_address_in_block (next_frame); ++ cache->base = get_frame_register_unsigned (next_frame, gdbarch_sp_regnum (gdbarch)); ++ cache->saved_sp = cache->base + cache->framesize; ++ ++ cache->register_offsets[MICROBLAZE_PREV_PC_REGNUM] = cache->base; ++ cache->register_offsets[MICROBLAZE_SP_REGNUM] = cache->saved_sp; + + return cache; + } +@@ -501,6 +569,14 @@ + struct microblaze_frame_cache *cache = + microblaze_frame_cache (this_frame, this_cache); + ++ if ((regnum == MICROBLAZE_SP_REGNUM && ++ cache->register_offsets[MICROBLAZE_SP_REGNUM]) ++ || (regnum == MICROBLAZE_FP_REGNUM && ++ cache->register_offsets[MICROBLAZE_SP_REGNUM])) ++ ++ return frame_unwind_got_constant (this_frame, regnum, ++ cache->register_offsets[MICROBLAZE_SP_REGNUM]); ++ + if (cache->frameless_p) + { + if (regnum == MICROBLAZE_PC_REGNUM) +@@ -508,11 +584,18 @@ + if (regnum == MICROBLAZE_SP_REGNUM) + regnum = 1; + return trad_frame_get_prev_register (this_frame, +- cache->saved_regs, regnum); ++ cache->saved_regs, regnum); + } +- else +- return trad_frame_get_prev_register (this_frame, cache->saved_regs, +- regnum); ++ ++ if (regnum == MICROBLAZE_PC_REGNUM) ++ { ++ regnum = 15; ++ return frame_unwind_got_memory (this_frame, regnum, ++ cache->register_offsets[MICROBLAZE_PREV_PC_REGNUM]); ++ } ++ ++ return trad_frame_get_prev_register (this_frame, cache->saved_regs, ++ regnum); + + } + +@@ -536,6 +619,12 @@ + return cache->base; + } + ++static const struct frame_unwind * ++microblaze_frame_sniffer (struct frame_info *next_frame) ++{ ++ return µblaze_frame_unwind; ++} ++ + static const struct frame_base microblaze_frame_base = + { + µblaze_frame_unwind, +@@ -628,6 +717,109 @@ + return (TYPE_LENGTH (type) == 16); + } + ++int ++microblaze_software_single_step (struct frame_info *frame) ++{ ++ struct gdbarch *arch = get_frame_arch (frame); ++ struct address_space *aspace = get_frame_address_space (frame); ++ struct gdbarch_tdep *tdep = gdbarch_tdep (arch); ++ static char le_breakp[] = MICROBLAZE_BREAKPOINT_LE; ++ static char be_breakp[] = MICROBLAZE_BREAKPOINT; ++ enum bfd_endian byte_order = gdbarch_byte_order (arch); ++ char *breakp = byte_order == BFD_ENDIAN_BIG ? be_breakp : le_breakp; ++ int ret = 0; ++ ++ /* Save the address and the values of the next_pc and the target */ ++ static struct sstep_breaks ++ { ++ CORE_ADDR address; ++ bfd_boolean valid; ++ /* Shadow contents. */ ++ char data[INST_WORD_SIZE]; ++ } stepbreaks[2]; ++ int ii; ++ ++ if (1) ++ { ++ CORE_ADDR pc; ++ long insn; ++ enum microblaze_instr minstr; ++ bfd_boolean isunsignednum; ++ enum microblaze_instr_type insn_type; ++ short delay_slots; ++ int imm; ++ bfd_boolean immfound = FALSE; ++ ++ /* Set a breakpoint at the next instruction */ ++ /* If the current instruction is an imm, set it at the inst after */ ++ /* If the instruction has a delay slot, skip the delay slot */ ++ pc = get_frame_pc (frame); ++ insn = microblaze_fetch_instruction (pc); ++ minstr = get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots); ++ if (insn_type == immediate_inst) ++ { ++ int rd, ra, rb; ++ immfound = TRUE; ++ minstr = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm); ++ pc = pc + INST_WORD_SIZE; ++ insn = microblaze_fetch_instruction (pc); ++ minstr = get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots); ++ } ++ stepbreaks[0].address = pc + (delay_slots * INST_WORD_SIZE) + INST_WORD_SIZE; ++ if (insn_type != return_inst) { ++ stepbreaks[0].valid = TRUE; ++ } else { ++ stepbreaks[0].valid = FALSE; ++ } ++ ++ microblaze_debug ("single-step insn_type=%x insn=%x\n", insn_type, insn); ++ /* Now check for branch or return instructions */ ++ if (insn_type == branch_inst || insn_type == return_inst) { ++ int limm; ++ int lrd, lra, lrb; ++ int ra, rb; ++ bfd_boolean targetvalid; ++ bfd_boolean unconditionalbranch; ++ microblaze_decode_insn(insn, &lrd, &lra, &lrb, &limm); ++ if (lra >= 0 && lra < MICROBLAZE_NUM_REGS) ++ ra = get_frame_register_unsigned (frame, lra); ++ else ++ ra = 0; ++ if (lrb >= 0 && lrb < MICROBLAZE_NUM_REGS) ++ rb = get_frame_register_unsigned (frame, lrb); ++ else ++ rb = 0; ++ ++ stepbreaks[1].address = microblaze_get_target_address (insn, immfound, imm, pc, ra, rb, &targetvalid, &unconditionalbranch); ++ microblaze_debug ("single-step uncondbr=%d targetvalid=%d target=%x\n", unconditionalbranch, targetvalid, stepbreaks[1].address); ++ ++ if (unconditionalbranch) ++ stepbreaks[0].valid = FALSE; /* This is a unconditional branch: will not come to the next address */ ++ if (targetvalid && (stepbreaks[0].valid == FALSE || ++ (stepbreaks[0].address != stepbreaks[1].address)) ++ && (stepbreaks[1].address != pc)) { ++ stepbreaks[1].valid = TRUE; ++ } else { ++ stepbreaks[1].valid = FALSE; ++ } ++ } else { ++ stepbreaks[1].valid = FALSE; ++ } ++ ++ /* Insert the breakpoints */ ++ for (ii = 0; ii < 2; ++ii) ++ { ++ ++ /* ignore invalid breakpoint. */ ++ if (stepbreaks[ii].valid) { ++ insert_single_step_breakpoint (arch, aspace, stepbreaks[ii].address); ++ ret = 1; ++ } ++ } ++ } ++ return ret; ++} ++ + static void + microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc) + { +@@ -664,6 +856,70 @@ + return dwarf2_to_reg_map[reg]; + } + ++ ++void ++microblaze_supply_gregset (const struct microblaze_gregset *gregset, ++ struct regcache *regcache, ++ int regnum, const void *gregs) ++{ ++ unsigned int *regs = gregs; ++ if (regnum >= 0) ++ regcache_raw_supply (regcache, regnum, regs + regnum); ++ ++ if (regnum == -1) { ++ int i; ++ ++ for (i = 0; i < 50; i++) { ++ regcache_raw_supply (regcache, i, regs + i); ++ } ++ } ++} ++ ++ ++void ++microblaze_collect_gregset (const struct microblaze_gregset *gregset, ++ const struct regcache *regcache, ++ int regnum, void *gregs) ++{ ++ /* FIXME. */ ++} ++ ++void ++microblaze_supply_fpregset (struct regcache *regcache, ++ int regnum, const void *fpregs) ++{ ++ /* FIXME. */ ++} ++ ++void ++microblaze_collect_fpregset (const struct regcache *regcache, ++ int regnum, void *fpregs) ++{ ++ /* FIXME. */ ++} ++ ++ ++/* Return the appropriate register set for the core section identified ++ by SECT_NAME and SECT_SIZE. */ ++ ++const struct regset * ++microblaze_regset_from_core_section (struct gdbarch *gdbarch, ++ const char *sect_name, size_t sect_size) ++{ ++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); ++ ++ microblaze_debug ("microblaze_regset_from_core_section, sect_name = %s\n", sect_name); ++ ++ if (strcmp (sect_name, ".reg") == 0 && sect_size >= tdep->sizeof_gregset) ++ return tdep->gregset; ++ ++ if (strcmp (sect_name, ".reg2") == 0 && sect_size >= tdep->sizeof_fpregset) ++ return tdep->fpregset; ++ ++ microblaze_debug ("microblaze_regset_from_core_section returning null :-( \n"); ++ return NULL; ++} ++ + static struct gdbarch * + microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + { +@@ -679,6 +935,11 @@ + tdep = XMALLOC (struct gdbarch_tdep); + gdbarch = gdbarch_alloc (&info, tdep); + ++ tdep->gregset = NULL; ++ tdep->sizeof_gregset = 0; ++ tdep->fpregset = NULL; ++ tdep->sizeof_fpregset = 0; ++ + set_gdbarch_long_double_bit (gdbarch, 128); + + set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS); +@@ -706,7 +967,10 @@ + /* Stack grows downward. */ + set_gdbarch_inner_than (gdbarch, core_addr_lessthan); + ++ set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint); ++ + set_gdbarch_breakpoint_from_pc (gdbarch, microblaze_breakpoint_from_pc); ++ set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step); + + set_gdbarch_frame_args_skip (gdbarch, 8); + +@@ -725,6 +989,13 @@ + dwarf2_append_unwinders (gdbarch); + frame_unwind_append_unwinder (gdbarch, µblaze_frame_unwind); + frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer); ++ //frame_base_append_sniffer (gdbarch, microblaze_frame_sniffer); ++ ++ /* If we have register sets, enable the generic core file support. */ ++ if (tdep->gregset) { ++ set_gdbarch_regset_from_core_section (gdbarch, ++ microblaze_regset_from_core_section); ++ } + + return gdbarch; + } +diff -Nur gdb-7.7.orig/gdb/microblaze-tdep.h gdb-7.7/gdb/microblaze-tdep.h +--- gdb-7.7.orig/gdb/microblaze-tdep.h 2014-01-08 10:23:36.000000000 +0100 ++++ gdb-7.7/gdb/microblaze-tdep.h 2014-03-26 10:11:41.000000000 +0100 +@@ -1,6 +1,6 @@ + /* Target-dependent code for Xilinx MicroBlaze. + +- Copyright (C) 2009-2014 Free Software Foundation, Inc. ++ Copyright (C) 2009-2013 Free Software Foundation, Inc. + + This file is part of GDB. + +@@ -22,8 +22,22 @@ + + + /* Microblaze architecture-specific information. */ ++struct microblaze_gregset ++{ ++ unsigned int gregs[32]; ++ unsigned int fpregs[32]; ++ unsigned int pregs[16]; ++}; ++ + struct gdbarch_tdep + { ++ int dummy; // declare something. ++ ++ /* Register sets. */ ++ struct regset *gregset; ++ size_t sizeof_gregset; ++ struct regset *fpregset; ++ size_t sizeof_fpregset; + }; + + struct microblaze_frame_cache +@@ -42,7 +56,8 @@ + int fp_regnum; + + /* Offsets to saved registers. */ +- int register_offsets[57]; /* Must match MICROBLAZE_NUM_REGS. */ ++ int register_offsets[59]; /* Must match MICROBLAZE_NUM_REGS. */ ++ CORE_ADDR saved_sp; + + /* Table of saved registers. */ + struct trad_frame_saved_reg *saved_regs; +@@ -66,11 +81,11 @@ + MICROBLAZE_R12_REGNUM, + MICROBLAZE_R13_REGNUM, + MICROBLAZE_R14_REGNUM, +- MICROBLAZE_R15_REGNUM, ++ MICROBLAZE_R15_REGNUM, MICROBLAZE_PREV_PC_REGNUM = MICROBLAZE_R15_REGNUM, + MICROBLAZE_R16_REGNUM, + MICROBLAZE_R17_REGNUM, + MICROBLAZE_R18_REGNUM, +- MICROBLAZE_R19_REGNUM, ++ MICROBLAZE_R19_REGNUM, MICROBLAZE_FP_REGNUM = MICROBLAZE_R19_REGNUM, + MICROBLAZE_R20_REGNUM, + MICROBLAZE_R21_REGNUM, + MICROBLAZE_R22_REGNUM, +@@ -107,7 +122,9 @@ + MICROBLAZE_RTLBX_REGNUM, + MICROBLAZE_RTLBSX_REGNUM, + MICROBLAZE_RTLBLO_REGNUM, +- MICROBLAZE_RTLBHI_REGNUM ++ MICROBLAZE_RTLBHI_REGNUM, ++ MICROBLAZE_SLR_REGNUM, ++ MICROBLAZE_SHR_REGNUM + }; + + /* All registers are 32 bits. */ +@@ -115,6 +132,21 @@ + + /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used. + Only used for native debugging. */ +-#define MICROBLAZE_BREAKPOINT {0xb9, 0xcc, 0x00, 0x60} ++#define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18} ++#define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba} ++ ++extern void microblaze_supply_gregset (const struct microblaze_gregset *gregset, ++ struct regcache *regcache, ++ int regnum, const void *gregs); ++extern void microblaze_collect_gregset (const struct microblaze_gregset *gregset, ++ const struct regcache *regcache, ++ int regnum, void *gregs); ++extern void microblaze_supply_fpregset (struct regcache *regcache, ++ int regnum, const void *fpregs); ++extern void microblaze_collect_fpregset (const struct regcache *regcache, ++ int regnum, void *fpregs); ++ ++extern const struct regset * microblaze_regset_from_core_section (struct gdbarch *gdbarch, ++ const char *sect_name, size_t sect_size); + + #endif /* microblaze-tdep.h */ +diff -Nur gdb-7.7.orig/gdb/regformats/reg-microblaze.dat gdb-7.7/gdb/regformats/reg-microblaze.dat +--- gdb-7.7.orig/gdb/regformats/reg-microblaze.dat 1970-01-01 01:00:00.000000000 +0100 ++++ gdb-7.7/gdb/regformats/reg-microblaze.dat 2014-03-26 20:43:54.000000000 +0100 +@@ -0,0 +1,41 @@ ++name:microblaze ++expedite:r1,pc ++32:r0 ++32:r1 ++32:r2 ++32:r3 ++32:r4 ++32:r5 ++32:r6 ++32:r7 ++32:r8 ++32:r9 ++32:r10 ++32:r11 ++32:r12 ++32:r13 ++32:r14 ++32:r15 ++32:r16 ++32:r17 ++32:r18 ++32:r19 ++32:r20 ++32:r21 ++32:r22 ++32:r23 ++32:r24 ++32:r25 ++32:r26 ++32:r27 ++32:r28 ++32:r29 ++32:r30 ++32:r31 ++32:pc ++32:msr ++32:ear ++32:esr ++32:fsr ++32:slr ++32:shr +diff -Nur gdb-7.7.orig/include/elf/microblaze.h gdb-7.7/include/elf/microblaze.h +--- gdb-7.7.orig/include/elf/microblaze.h 2013-12-08 05:11:51.000000000 +0100 ++++ gdb-7.7/include/elf/microblaze.h 2014-03-26 20:44:34.000000000 +0100 +@@ -58,6 +58,7 @@ + RELOC_NUMBER (R_MICROBLAZE_TLSDTPREL64, 27) /* TLS Offset Within TLS Block */ + RELOC_NUMBER (R_MICROBLAZE_TLSGOTTPREL32, 28) /* TLS Offset From Thread Pointer */ + RELOC_NUMBER (R_MICROBLAZE_TLSTPREL32, 29) /* TLS Offset From Thread Pointer */ ++ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 30) + + END_RELOC_NUMBERS (R_MICROBLAZE_max) + +diff -Nur gdb-7.7.orig/opcodes/microblaze-opc.h gdb-7.7/opcodes/microblaze-opc.h +--- gdb-7.7.orig/opcodes/microblaze-opc.h 2013-12-08 05:11:52.000000000 +0100 ++++ gdb-7.7/opcodes/microblaze-opc.h 2014-03-26 20:45:46.000000000 +0100 +@@ -91,6 +91,7 @@ + #define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */ + #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */ + #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */ ++#define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */ + #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */ + + /* New Mask for msrset, msrclr insns. */ +@@ -101,7 +102,7 @@ + #define DELAY_SLOT 1 + #define NO_DELAY_SLOT 0 + +-#define MAX_OPCODES 289 ++#define MAX_OPCODES 291 + + struct op_code_struct + { +@@ -174,7 +175,9 @@ + {"wic", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000068, OPCODE_MASK_H34B, wic, special_inst }, + {"wdc", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000064, OPCODE_MASK_H34B, wdc, special_inst }, + {"wdc.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000066, OPCODE_MASK_H34B, wdcclear, special_inst }, ++ {"wdc.ext.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000466, OPCODE_MASK_H35B, wdcextclear, special_inst }, + {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst }, ++ {"wdc.ext.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000476, OPCODE_MASK_H35B, wdcextflush, special_inst }, + {"mts", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9400C000, OPCODE_MASK_H13S, mts, special_inst }, + {"mfs", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94008000, OPCODE_MASK_H23S, mfs, special_inst }, + {"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst }, +diff -Nur gdb-7.7.orig/opcodes/microblaze-opcm.h gdb-7.7/opcodes/microblaze-opcm.h +--- gdb-7.7.orig/opcodes/microblaze-opcm.h 2013-12-08 05:11:52.000000000 +0100 ++++ gdb-7.7/opcodes/microblaze-opcm.h 2014-03-26 20:45:46.000000000 +0100 +@@ -31,9 +31,9 @@ + idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput, + ncget, ncput, muli, bslli, bsrai, bsrli, mului, or, and, xor, + andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16, +- wic, wdc, wdcclear, wdcflush, mts, mfs, mbar, br, brd, +- brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt, +- bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni, ++ wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, mts, mfs, mbar, ++ br, brd, brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, ++ blt, bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni, + imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid, + brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti, + bgtid, bgei, bgeid, lbu, lbur, lhu, lhur, lw, lwr, lwx, sb, sbr, sh, diff --git a/package/genext2fs/Makefile b/package/genext2fs/Makefile new file mode 100644 index 000000000..4e8fea5bd --- /dev/null +++ b/package/genext2fs/Makefile @@ -0,0 +1,24 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include $(TOPDIR)/rules.mk + +PKG_NAME:= genext2fs +PKG_VERSION:= 1.4.1 +PKG_RELEASE:= 1 +PKG_MD5SUM:= b7b6361bcce2cedff1ae437fadafe53b +PKG_DESCR:= genext2fs utility +PKG_SECTION:= fs +PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=genext2fs/} + +PKG_CFLINE_GENEXT2FS:= depends on ADK_HOST_ONLY + +include $(TOPDIR)/mk/host.mk +include $(TOPDIR)/mk/package.mk + +$(eval $(call HOST_template,GENEXT2FS,genext2fs,$(PKG_VERSION)-${PKG_RELEASE})) + +HOST_STYLE:= auto + +include ${TOPDIR}/mk/host-bottom.mk +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/gkrellm/Makefile b/package/gkrellm/Makefile index 1b4a6b118..e8efdabd4 100644 --- a/package/gkrellm/Makefile +++ b/package/gkrellm/Makefile @@ -4,10 +4,10 @@ include ${TOPDIR}/rules.mk PKG_NAME:= gkrellm -PKG_VERSION:= 2.3.4 +PKG_VERSION:= 2.3.5 PKG_RELEASE:= 1 -PKG_MD5SUM:= 600f4daa395112ed19a3633deb0829ff -PKG_DESCR:= The GNU Krell Monitors Server +PKG_MD5SUM:= 05d00fa8d6376038b0c7e967583c0b8d +PKG_DESCR:= GNU krell monitors server PKG_SECTION:= net/misc PKG_DEPENDS:= glib libpthread PKG_BUILDDEP:= glib diff --git a/package/gkrellm/patches/patch-server_Makefile b/package/gkrellm/patches/patch-server_Makefile deleted file mode 100644 index a1a8747e7..000000000 --- a/package/gkrellm/patches/patch-server_Makefile +++ /dev/null @@ -1,30 +0,0 @@ ---- gkrellm-2.3.4.orig/server/Makefile 2008-10-03 23:52:48.000000000 +0200 -+++ gkrellm-2.3.4/server/Makefile 2011-05-17 11:34:14.926610183 +0200 -@@ -26,7 +26,7 @@ SMANDIR ?= $(INSTALLROOT)/share/man/man1 - MANMODE ?= 644 - MANDIRMODE ?= 755 - INSTALL ?= install --LINK_FLAGS ?= -Wl,-E -+LINK_FLAGS ?= -Wl,-E $(LDFLAGS) - EXTRAOBJS = - - SHARED_PATH = ../shared -@@ -109,15 +109,15 @@ endif - - override CC += -Wall $(FLAGS) - --OS_NAME=$(shell uname -s) --OS_RELEASE=$(shell uname -r) -+OS_NAME=Linux -+OS_RELEASE=2.6 - - OBJS = main.o monitor.o mail.o plugins.o glib.o utils.o sysdeps-unix.o log.o - - all: gkrellmd - - gkrellmd: $(OBJS) $(EXTRAOBJS) -- $(CC) $(OBJS) $(EXTRAOBJS) -o gkrellmd $(LIBS) $(LINK_FLAGS) -+ $(CC) $(OBJS) $(EXTRAOBJS) -o gkrellmd $(LINK_FLAGS) $(LIBS) - - static: $(OBJS) $(EXTRAOBJS) - $(CC) $(OBJS) $(EXTRAOBJS) -o gkrellmd.static -static \ diff --git a/package/gkrellm/patches/patch-server_main_c b/package/gkrellm/patches/patch-server_main_c new file mode 100644 index 000000000..c02fb8930 --- /dev/null +++ b/package/gkrellm/patches/patch-server_main_c @@ -0,0 +1,24 @@ +--- gkrellm-2.3.5.orig/server/main.c 2010-10-02 18:13:29.000000000 +0200 ++++ gkrellm-2.3.5/server/main.c 2014-03-23 16:06:59.000000000 +0100 +@@ -39,21 +39,6 @@ + #include <syslog.h> + #endif // !WIN32 + +-// win32 defines addrinfo but only supports getaddrinfo call on winxp or newer +-#if !defined(HAVE_GETADDRINFO) && !defined(WIN32) +-struct addrinfo +- { +- int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ +- int ai_family; /* PF_xxx */ +- int ai_socktype; /* SOCK_xxx */ +- int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ +- size_t ai_addrlen; /* length of ai_addr */ +- char *ai_canonname; /* canonical name for hostname */ +- struct sockaddr *ai_addr; /* binary address */ +- struct addrinfo *ai_next; /* next structure in linked list */ +- }; +-#endif // !HAVE_GETADDRINFO +- + #if !defined(IPV6_V6ONLY) && defined(IPV6_BINDV6ONLY) + #define IPV6_V6ONLY IPV6_BINDV6ONLY + #endif diff --git a/package/gkrellm/patches/patch-server_sysdeps-unix_c b/package/gkrellm/patches/patch-server_sysdeps-unix_c new file mode 100644 index 000000000..e69631735 --- /dev/null +++ b/package/gkrellm/patches/patch-server_sysdeps-unix_c @@ -0,0 +1,10 @@ +--- gkrellm-2.3.5.orig/server/sysdeps-unix.c 2010-09-14 18:34:34.000000000 +0200 ++++ gkrellm-2.3.5/server/sysdeps-unix.c 2014-03-23 16:13:57.000000000 +0100 +@@ -145,6 +145,7 @@ gkrellm_sensors_linux_name_fix(gchar *id + #endif + } + ++#define HAVE_GETADDRINFO 1 + #ifdef SENSORS_COMMON + gint + gkrellm_connect_to(gchar *server, gint server_port) diff --git a/package/glib/Makefile b/package/glib/Makefile index 2c82f8a53..d92294b8e 100644 --- a/package/glib/Makefile +++ b/package/glib/Makefile @@ -5,13 +5,14 @@ include ${TOPDIR}/rules.mk PKG_NAME:= glib PKG_VERSION:= 2.38.2 -PKG_RELEASE:= 2 +PKG_RELEASE:= 3 PKG_EXTRAVER:= 2.38 PKG_MD5SUM:= 26d1d08e478fc48c181ca8be44f5b69f PKG_DESCR:= low-level core library that forms the basis of GTK+ PKG_SECTION:= libs PKG_DEPENDS:= libpthread -PKG_BUILDDEP:= libffi gettext-tiny libiconv-tiny glib-host zlib libelf dbus +PKG_BUILDDEP:= glib-host libffi gettext-tiny libiconv-tiny zlib libelf dbus +HOST_BUILDDEP:= libffi-host gettext-tiny-host libiconv-tiny-host PKG_URL:= http://www.gtk.org/ PKG_SITES:= http://ftp.gnome.org/pub/gnome/sources/glib/${PKG_EXTRAVER}/ PKG_NOPARALLEL:= 1 @@ -29,9 +30,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call HOST_template,GLIB,glib,${PKG_VERSION}-${PKG_RELEASE})) $(eval $(call PKG_template,GLIB,glib,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) -HOST_STYLE:= auto TARGET_CPPFLAGS+= -D_GNU_SOURCE -TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --disable-mem-pools \ --disable-rebuilds \ --disable-fam \ @@ -43,6 +42,7 @@ CONFIGURE_ENV+= glib_cv_long_long_format=ll \ ac_cv_func_posix_getpwuid_r=yes \ ac_cv_func_posix_getgrgid_r=yes +HOST_STYLE:= auto HOST_CONFIGURE_ARGS+= --disable-fam \ --enable-static \ --disable-compile-warnings diff --git a/package/glibc/files/libc.so.sh4 b/package/glibc/files/libc.so.sh4 new file mode 100644 index 000000000..eae5be42d --- /dev/null +++ b/package/glibc/files/libc.so.sh4 @@ -0,0 +1,5 @@ +/* GNU ld script + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ +OUTPUT_FORMAT(elf32-sh-linux) +GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.2 ) ) diff --git a/package/gnutls/Makefile b/package/gnutls/Makefile index b160c1d5f..c1b993c14 100644 --- a/package/gnutls/Makefile +++ b/package/gnutls/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= gnutls -PKG_VERSION:= 3.2.9 +PKG_VERSION:= 3.2.13 PKG_RELEASE:= 1 -PKG_MD5SUM:= 9ae2bfa55d4c12dd6005cfb7014977f9 +PKG_MD5SUM:= 300e5f413054e2f4719c1c3b5179a611 PKG_DESCR:= GNU TLS library PKG_SECTION:= crypto PKG_DEPENDS:= libgcrypt libtasn1 zlib libnettle libgmp @@ -45,7 +45,6 @@ ifneq ($(ADK_PACKAGE_LIBGNUTLS_WITH_CRYPTODEV),) CONFIGURE_ARGS+= --enable-cryptodev endif -TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) TARGET_LDFLAGS+= -pthread CONFIGURE_ARGS+= --disable-rpath \ --without-libz-prefix \ diff --git a/package/gpsd/Makefile b/package/gpsd/Makefile index 04547a9eb..4c21e15ee 100644 --- a/package/gpsd/Makefile +++ b/package/gpsd/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= fc5b03aae38b9b5b6880b31924d0ace3 PKG_DESCR:= An interface daemon for GPS receivers PKG_SECTION:= misc PKG_DEPENDS:= libpthread -PKG_BUILDDEP:= ncurses scons-host bzip2-host python2-host +PKG_BUILDDEP:= scons-host ncurses PKG_URL:= http://catb.org/gpsd/ PKG_SITES:= http://download-mirror.savannah.gnu.org/releases/gpsd/ diff --git a/package/grub-bin/Makefile b/package/grub-bin/Makefile index 7b52cdafa..352c2b572 100644 --- a/package/grub-bin/Makefile +++ b/package/grub-bin/Makefile @@ -18,7 +18,6 @@ PKG_ARCH_DEPENDS:= x86 x86_64 PKG_CFLINE_GRUB_BIN:= select BUSYBOX_FEATURE_STAT_FORMAT@ PKG_CFLINE_GRUB_BIN+= depends on !ADK_TARGET_ROOTFS_INITRAMFS_PIGGYBACK && !ADK_TARGET_ROOTFS_INITRAMFS -PKG_DFLT_GRUB_BIN:= y if !ADK_TOOLCHAIN_ONLY && !ADK_TOOLCHAIN_ARCHIVE include ${TOPDIR}/mk/package.mk diff --git a/package/grub/Makefile b/package/grub/Makefile index cfe17a227..2f2deba4a 100644 --- a/package/grub/Makefile +++ b/package/grub/Makefile @@ -4,38 +4,53 @@ include $(TOPDIR)/rules.mk PKG_NAME:= grub -PKG_VERSION:= 1.98 -PKG_RELEASE:= 1 -PKG_MD5SUM:= c0bcf60e524739bb64e3a2d4e3732a59 +PKG_VERSION:= 2.00 +PKG_RELEASE:= 4 +PKG_MD5SUM:= e927540b6eda8b024fb0391eeaa4091c PKG_DESCR:= GRUB2 bootloader (source package) PKG_SECTION:= boot +PKG_BUILDDEP:= bison-host qemu-host PKG_URL:= http://www.gnu.org/software/grub -PKG_SITES:= ftp://alpha.gnu.org/gnu/grub/ +PKG_SITES:= ftp://ftp.gnu.org/gnu/grub/ -PKG_HOST_DEPENDS:= linux -PKG_ARCH_DEPENDS:= x86 x86_64 +PKG_ARCH_DEPENDS:= x86 x86_64 mips PKG_NOPARALLEL:= 1 +PKG_CHOICES_GRUB:= PC EFI +PKGCD_PC:= build for PC BIOS +PKGCD_EFI:= build for EFI + include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,GRUB,grub,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -ifeq ($(ADK_STATIC),y) -TARGET_CFLAGS+= -static -TARGET_LDFLAGS+= -static +GRUB_MODULES:= ext2 part_msdos biosdisk + +ifeq ($(ADK_PACKAGE_GRUB_PC),y) +GRUB_ARCH:= i386-pc +CONFIGURE_ARGS+= --with-platform=pc +endif +ifeq ($(ADK_PACKAGE_GRUB_EFI),y) +GRUB_ARCH:= x86_64-efi +CONFIGURE_ARGS+= --with-platform=efi endif -XAKE_FLAGS+= GCC_HONOUR_COPTS=s CPPFLAGS_FOR_BUILD="-I./include" -CONFIGURE_ARGS+= --disable-efiemu \ - --disable-grub-mkfont \ - --disable-grub-fstest +TARGET_CFLAGS+= -static +TARGET_LDFLAGS+= -static +CONFIGURE_ARGS+= --disable-grub-mkfont \ + --enable-efiemu=no \ + --enable-liblzma=no \ + --enable-device-mapper=no \ + --enable-libzfs=no \ + --disable-werror +XAKE_FLAGS+= GCC_HONOUR_COPTS=s grub-install: - ${INSTALL_DIR} $(IDIR_GRUB)/usr/{sbin,lib,bin} - ${INSTALL_DIR} $(IDIR_GRUB)/etc - ${CP} ${WRKINST}/etc/grub.d $(IDIR_GRUB)/etc - ${CP} ${WRKINST}/usr/lib/* $(IDIR_GRUB)/usr/lib - ${INSTALL_BIN} ${WRKINST}/usr/bin/* $(IDIR_GRUB)/usr/bin - ${INSTALL_BIN} ${WRKINST}/usr/sbin/* $(IDIR_GRUB)/usr/sbin + ${INSTALL_DIR} $(IDIR_GRUB)/boot/grub/${GRUB_ARCH} + ${CP} ${WRKINST}/usr/lib/grub/${GRUB_ARCH}/*{mod,lst,img} \ + $(IDIR_GRUB)/boot/grub/${GRUB_ARCH}/ + PATH='${HOST_PATH}' qemu-i386 ${WRKBUILD}/grub-mkimage \ + -o $(IDIR_GRUB)/boot/grub/core.img -O ${GRUB_ARCH} \ + -c ./files/embed.cfg ${GRUB_MODULES} include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/grub/patches/patch-conf_common_mk b/package/grub/patches/patch-conf_common_mk deleted file mode 100644 index fec7cd1dd..000000000 --- a/package/grub/patches/patch-conf_common_mk +++ /dev/null @@ -1,11 +0,0 @@ ---- grub-1.98.orig/conf/common.mk 2010-03-06 21:52:26.000000000 +0100 -+++ grub-1.98/conf/common.mk 2012-02-22 13:20:42.022360300 +0100 -@@ -11159,7 +11159,7 @@ trigtables.c: gentrigtables - ./gentrigtables > $@ - DISTCLEANFILES += trigtables.c - gentrigtables: gentrigtables.c -- $(CC) -o $@ $^ $(CPPFLAGS) -lm -+ $(CC_FOR_BUILD) -o $@ $^ $(CPPFLAGS_FOR_BUILD) -lm - DISTCLEANFILES += gentrigtables - - pkglib_MODULES += setjmp.mod diff --git a/package/grub/patches/patch-configure b/package/grub/patches/patch-configure new file mode 100644 index 000000000..a3920a1c1 --- /dev/null +++ b/package/grub/patches/patch-configure @@ -0,0 +1,11 @@ +--- grub-2.00.orig/configure 2012-06-26 13:59:16.000000000 +0200 ++++ grub-2.00/configure 2014-04-06 20:34:33.000000000 +0200 +@@ -3880,7 +3882,7 @@ TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(t + + case "$target_cpu" in + i[3456]86) target_cpu=i386 ;; +- amd64) target_cpu=x86_64 ;; ++ amd64|x86_64) target_cpu=x86_64 ;; + sparc) target_cpu=sparc64 ;; + mipsel|mips64el) + target_cpu=mipsel; diff --git a/package/grub/patches/patch-grub-core_gnulib_stdio_in_h b/package/grub/patches/patch-grub-core_gnulib_stdio_in_h new file mode 100644 index 000000000..79ab772ad --- /dev/null +++ b/package/grub/patches/patch-grub-core_gnulib_stdio_in_h @@ -0,0 +1,14 @@ +--- grub-2.00.orig/grub-core/gnulib/stdio.in.h 2010-12-01 15:45:43.000000000 +0100 ++++ grub-2.00/grub-core/gnulib/stdio.in.h 2014-04-05 10:02:52.000000000 +0200 +@@ -137,11 +137,6 @@ _GL_WARN_ON_USE (fflush, "fflush is not + "use gnulib module fflush for portable POSIX compliance"); + #endif + +-/* It is very rare that the developer ever has full control of stdin, +- so any use of gets warrants an unconditional warning. Assume it is +- always declared, since it is required by C89. */ +-#undef gets +-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); + + #if @GNULIB_FOPEN@ + # if @REPLACE_FOPEN@ diff --git a/package/grub/patches/patch-grub-core_kern_emu_hostdisk_c b/package/grub/patches/patch-grub-core_kern_emu_hostdisk_c new file mode 100644 index 000000000..e238bb7fd --- /dev/null +++ b/package/grub/patches/patch-grub-core_kern_emu_hostdisk_c @@ -0,0 +1,36 @@ +--- grub-2.00.orig/grub-core/kern/emu/hostdisk.c 2012-06-25 10:32:04.000000000 +0200 ++++ grub-2.00/grub-core/kern/emu/hostdisk.c 2014-04-06 13:14:06.000000000 +0200 +@@ -761,25 +761,6 @@ linux_find_partition (char *dev, grub_di + } + #endif /* __linux__ */ + +-#if defined(__linux__) && (!defined(__GLIBC__) || \ +- ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))) +- /* Maybe libc doesn't have large file support. */ +-grub_err_t +-grub_util_fd_seek (int fd, const char *name, grub_uint64_t off) +-{ +- loff_t offset, result; +- static int _llseek (uint filedes, ulong hi, ulong lo, +- loff_t *res, uint wh); +- _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo, +- loff_t *, res, uint, wh); +- +- offset = (loff_t) off; +- if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET)) +- return grub_error (GRUB_ERR_BAD_DEVICE, N_("cannot seek `%s': %s"), +- name, strerror (errno)); +- return GRUB_ERR_NONE; +-} +-#else + grub_err_t + grub_util_fd_seek (int fd, const char *name, grub_uint64_t off) + { +@@ -790,7 +771,6 @@ grub_util_fd_seek (int fd, const char *n + name, strerror (errno)); + return 0; + } +-#endif + + static void + flush_initial_buffer (const char *os_dev __attribute__ ((unused))) diff --git a/package/grub/patches/patch-include_grub_i18n_h b/package/grub/patches/patch-include_grub_i18n_h deleted file mode 100644 index 41151f706..000000000 --- a/package/grub/patches/patch-include_grub_i18n_h +++ /dev/null @@ -1,11 +0,0 @@ ---- grub-1.98.orig/include/grub/i18n.h 2010-03-06 21:51:37.000000000 +0100 -+++ grub-1.98/include/grub/i18n.h 2010-06-26 15:31:22.860562533 +0200 -@@ -25,7 +25,7 @@ - extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s); - - /* NLS can be disabled through the configure --disable-nls option. */ --#if ENABLE_NLS -+#if defined(ENABLE_NLS) - - # ifdef GRUB_UTIL - diff --git a/package/grub/patches/patch-include_grub_misc_h b/package/grub/patches/patch-include_grub_misc_h deleted file mode 100644 index fb3e46108..000000000 --- a/package/grub/patches/patch-include_grub_misc_h +++ /dev/null @@ -1,17 +0,0 @@ ---- grub-1.98.orig/include/grub/misc.h 2010-03-06 21:51:37.000000000 +0100 -+++ grub-1.98/include/grub/misc.h 2010-06-26 18:54:44.075171713 +0200 -@@ -91,14 +91,6 @@ grub_strncat (char *dest, const char *sr - return dest; - } - --/* Prototypes for aliases. */ --#ifndef GRUB_UTIL --int EXPORT_FUNC(memcmp) (const void *s1, const void *s2, grub_size_t n); --void *EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n); --void *EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n); --void *EXPORT_FUNC(memset) (void *s, int c, grub_size_t n); --#endif -- - int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n); - int EXPORT_FUNC(grub_strcmp) (const char *s1, const char *s2); - int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, grub_size_t n); diff --git a/package/grub/patches/patch-kern_misc_c b/package/grub/patches/patch-kern_misc_c deleted file mode 100644 index 2912e2564..000000000 --- a/package/grub/patches/patch-kern_misc_c +++ /dev/null @@ -1,54 +0,0 @@ ---- grub-1.98.orig/kern/misc.c 2010-03-06 21:51:37.000000000 +0100 -+++ grub-1.98/kern/misc.c 2010-06-26 20:12:26.711214130 +0200 -@@ -64,23 +64,6 @@ grub_memmove (void *dest, const void *sr - return dest; - } - --#ifndef APPLE_CC --void *memmove (void *dest, const void *src, grub_size_t n) -- __attribute__ ((alias ("grub_memmove"))); --/* GCC emits references to memcpy() for struct copies etc. */ --void *memcpy (void *dest, const void *src, grub_size_t n) -- __attribute__ ((alias ("grub_memmove"))); --#else --void *memcpy (void *dest, const void *src, grub_size_t n) --{ -- return grub_memmove (dest, src, n); --} --void *memmove (void *dest, const void *src, grub_size_t n) --{ -- return grub_memmove (dest, src, n); --} --#endif -- - char * - grub_strcpy (char *dest, const char *src) - { -@@ -516,15 +499,6 @@ grub_memset (void *s, int c, grub_size_t - - return s; - } --#ifndef APPLE_CC --void *memset (void *s, int c, grub_size_t n) -- __attribute__ ((alias ("grub_memset"))); --#else --void *memset (void *s, int c, grub_size_t n) --{ -- return grub_memset (s, c, n); --} --#endif - - grub_size_t - grub_strlen (const char *s) -@@ -1053,11 +1027,6 @@ grub_abort (void) - grub_exit (); - } - --#ifndef APPLE_CC --/* GCC emits references to abort(). */ --void abort (void) __attribute__ ((alias ("grub_abort"))); --#endif -- - #ifdef NEED_ENABLE_EXECUTE_STACK - /* Some gcc versions generate a call to this function - in trampolines for nested functions. */ diff --git a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_camellia_c b/package/grub/patches/patch-lib_libgcrypt-grub_cipher_camellia_c deleted file mode 100644 index 8b3594525..000000000 --- a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_camellia_c +++ /dev/null @@ -1,29 +0,0 @@ ---- grub-1.98.orig/lib/libgcrypt-grub/cipher/camellia.c 2010-03-06 21:52:26.000000000 +0100 -+++ grub-1.98/lib/libgcrypt-grub/cipher/camellia.c 2010-06-26 20:49:20.915278106 +0200 -@@ -26,6 +26,7 @@ - */ - - -+#include <grub/misc.h> - #include "camellia.h" - - /* u32 must be 32bit word */ -@@ -946,13 +947,13 @@ void camellia_setup192(const unsigned ch - unsigned char kk[32]; - u32 krll, krlr, krrl,krrr; - -- memcpy(kk, key, 24); -- memcpy((unsigned char *)&krll, key+16,4); -- memcpy((unsigned char *)&krlr, key+20,4); -+ grub_memcpy(kk, key, 24); -+ grub_memcpy((unsigned char *)&krll, key+16,4); -+ grub_memcpy((unsigned char *)&krlr, key+20,4); - krrl = ~krll; - krrr = ~krlr; -- memcpy(kk+24, (unsigned char *)&krrl, 4); -- memcpy(kk+28, (unsigned char *)&krrr, 4); -+ grub_memcpy(kk+24, (unsigned char *)&krrl, 4); -+ grub_memcpy(kk+28, (unsigned char *)&krrr, 4); - camellia_setup256(kk, subkey); - return; - } diff --git a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_des_c b/package/grub/patches/patch-lib_libgcrypt-grub_cipher_des_c deleted file mode 100644 index c2c93be5a..000000000 --- a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_des_c +++ /dev/null @@ -1,11 +0,0 @@ ---- grub-1.98.orig/lib/libgcrypt-grub/cipher/des.c 2010-03-06 21:52:26.000000000 +0100 -+++ grub-1.98/lib/libgcrypt-grub/cipher/des.c 2010-06-26 20:35:49.335279651 +0200 -@@ -119,7 +119,7 @@ - #include "cipher.h" - - #if defined(__GNUC__) && defined(__GNU_LIBRARY__) --#define working_memcmp memcmp -+#define working_memcmp grub_memcmp - #else - /* - * According to the SunOS man page, memcmp returns indeterminate sign diff --git a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_dsa_c b/package/grub/patches/patch-lib_libgcrypt-grub_cipher_dsa_c deleted file mode 100644 index 91b467779..000000000 --- a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_dsa_c +++ /dev/null @@ -1,29 +0,0 @@ ---- grub-1.98.orig/lib/libgcrypt-grub/cipher/dsa.c 2010-03-06 21:52:26.000000000 +0100 -+++ grub-1.98/lib/libgcrypt-grub/cipher/dsa.c 2010-06-26 20:41:13.511279436 +0200 -@@ -157,7 +157,7 @@ gen_k( gcry_mpi_t q ) - to get_random_bytes() and use this the here maybe it is - easier to do this directly in random.c. */ - char *pp = gcry_random_bytes_secure( 4, GCRY_STRONG_RANDOM ); -- memcpy( rndbuf,pp, 4 ); -+ grub_memcpy( rndbuf,pp, 4 ); - gcry_free(pp); - } - _gcry_mpi_set_buffer( k, rndbuf, nbytes, 0 ); -@@ -337,7 +337,7 @@ generate (DSA_secret_key *sk, unsigned i - else - { /* Change only some of the higher bits (= 2 bytes)*/ - char *r = gcry_random_bytes_secure (2, random_level); -- memcpy(rndbuf, r, 2 ); -+ grub_memcpy(rndbuf, r, 2 ); - gcry_free(r); - } - -@@ -713,7 +713,7 @@ dsa_generate_ext (int algo, unsigned int - gcry_sexp_release (l1); - return GPG_ERR_INV_OBJ; /* No value or value too large. */ - } -- memcpy (buf, s, n); -+ grub_memcpy (buf, s, n); - buf[n] = 0; - qbits = (unsigned int)strtoul (buf, NULL, 0); - gcry_sexp_release (l1); diff --git a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_elgamal_c b/package/grub/patches/patch-lib_libgcrypt-grub_cipher_elgamal_c deleted file mode 100644 index 5cd42146e..000000000 --- a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_elgamal_c +++ /dev/null @@ -1,20 +0,0 @@ ---- grub-1.98.orig/lib/libgcrypt-grub/cipher/elgamal.c 2010-03-06 21:52:26.000000000 +0100 -+++ grub-1.98/lib/libgcrypt-grub/cipher/elgamal.c 2010-06-26 20:40:56.115156639 +0200 -@@ -212,7 +212,7 @@ gen_k( gcry_mpi_t p, int small_k ) - easier to do this directly in random.c Anyway, it is - highly inlikely that we will ever reach this code. */ - char *pp = gcry_random_bytes_secure( 4, GCRY_STRONG_RANDOM ); -- memcpy( rndbuf, pp, 4 ); -+ grub_memcpy( rndbuf, pp, 4 ); - gcry_free(pp); - } - _gcry_mpi_set_buffer( k, rndbuf, nbytes, 0 ); -@@ -308,7 +308,7 @@ generate ( ELG_secret_key *sk, unsigned - { - char *r = gcry_random_bytes_secure( 2, - GCRY_VERY_STRONG_RANDOM ); -- memcpy(rndbuf, r, 2 ); -+ grub_memcpy(rndbuf, r, 2 ); - gcry_free(r); - } - } diff --git a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_md4_c b/package/grub/patches/patch-lib_libgcrypt-grub_cipher_md4_c deleted file mode 100644 index 8bbe886a7..000000000 --- a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_md4_c +++ /dev/null @@ -1,11 +0,0 @@ ---- grub-1.98.orig/lib/libgcrypt-grub/cipher/md4.c 2010-03-06 21:52:26.000000000 +0100 -+++ grub-1.98/lib/libgcrypt-grub/cipher/md4.c 2010-06-26 20:24:28.691278909 +0200 -@@ -109,7 +109,7 @@ transform ( MD4_CONTEXT *ctx, const unsi - } - } - #else -- memcpy (in, data, 64); -+ grub_memcpy (in, data, 64); - #endif - - /* Round 1. */ diff --git a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_md5_c b/package/grub/patches/patch-lib_libgcrypt-grub_cipher_md5_c deleted file mode 100644 index 53aa3e69f..000000000 --- a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_md5_c +++ /dev/null @@ -1,11 +0,0 @@ ---- grub-1.98.orig/lib/libgcrypt-grub/cipher/md5.c 2010-03-06 21:52:26.000000000 +0100 -+++ grub-1.98/lib/libgcrypt-grub/cipher/md5.c 2010-06-26 20:24:19.631157281 +0200 -@@ -100,7 +100,7 @@ transform ( MD5_CONTEXT *ctx, const unsi - } - } - #else -- memcpy( correct_words, data, 64 ); -+ grub_memcpy( correct_words, data, 64 ); - #endif - - diff --git a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_primegen_c b/package/grub/patches/patch-lib_libgcrypt-grub_cipher_primegen_c deleted file mode 100644 index c97d88c1d..000000000 --- a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_primegen_c +++ /dev/null @@ -1,38 +0,0 @@ ---- grub-1.98.orig/lib/libgcrypt-grub/cipher/primegen.c 2010-03-06 21:52:26.000000000 +0100 -+++ grub-1.98/lib/libgcrypt-grub/cipher/primegen.c 2010-06-26 20:42:06.831276628 +0200 -@@ -1478,7 +1478,7 @@ _gcry_generate_fips186_2_prime (unsigned - } - - /* Step 2: U = sha1(seed) ^ sha1((seed+1) mod 2^{qbits}) */ -- memcpy (seed_plus, seed, seedlen); -+ grub_memcpy (seed_plus, seed, seedlen); - for (i=seedlen-1; i >= 0; i--) - { - seed_plus[i]++; -@@ -1596,7 +1596,7 @@ _gcry_generate_fips186_2_prime (unsigned - *r_counter = counter; - if (r_seed && r_seedlen) - { -- memcpy (seed_plus, seed, seedlen); -+ grub_memcpy (seed_plus, seed, seedlen); - *r_seed = seed_plus; - seed_plus = NULL; - *r_seedlen = seedlen; -@@ -1751,7 +1751,7 @@ _gcry_generate_fips186_3_prime (unsigned - - /* Step 11. Note that we do no use an explicit offset but increment - SEED_PLUS accordingly. */ -- memcpy (seed_plus, seed, seedlen); -+ grub_memcpy (seed_plus, seed, seedlen); - counter = 0; - - /* Generate P. */ -@@ -1838,7 +1838,7 @@ _gcry_generate_fips186_3_prime (unsigned - *r_counter = counter; - if (r_seed && r_seedlen) - { -- memcpy (seed_plus, seed, seedlen); -+ grub_memcpy (seed_plus, seed, seedlen); - *r_seed = seed_plus; - seed_plus = NULL; - *r_seedlen = seedlen; diff --git a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_rijndael_c b/package/grub/patches/patch-lib_libgcrypt-grub_cipher_rijndael_c deleted file mode 100644 index 056abefa3..000000000 --- a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_rijndael_c +++ /dev/null @@ -1,53 +0,0 @@ ---- grub-1.98.orig/lib/libgcrypt-grub/cipher/rijndael.c 2010-03-06 21:52:26.000000000 +0100 -+++ grub-1.98/lib/libgcrypt-grub/cipher/rijndael.c 2010-06-26 20:23:29.463277513 +0200 -@@ -139,7 +139,7 @@ do_setkey (RIJNDAEL_context *ctx, const - if ((_gcry_get_hw_features () & HWF_PADLOCK_AES)) - { - ctx->use_padlock = 1; -- memcpy (ctx->padlock_key, key, keylen); -+ grub_memcpy (ctx->padlock_key, key, keylen); - } - #endif - } -@@ -411,9 +411,9 @@ do_encrypt (const RIJNDAEL_context *ctx, - byte b[16]; - } b; - -- memcpy (a.a, ax, 16); -+ grub_memcpy (a.a, ax, 16); - do_encrypt_aligned (ctx, b.b, a.a); -- memcpy (bx, b.b, 16); -+ grub_memcpy (bx, b.b, 16); - } - - -@@ -440,7 +440,7 @@ do_padlock (const RIJNDAEL_context *ctx, - if (decrypt_flag) - cword[0] |= 0x00000200; - -- memcpy (a, ax, 16); -+ grub_memcpy (a, ax, 16); - - asm volatile - ("pushfl\n\t" /* Force key reload. */ -@@ -454,7 +454,7 @@ do_padlock (const RIJNDAEL_context *ctx, - : "%ecx", "cc", "memory" - ); - -- memcpy (bx, b, 16); -+ grub_memcpy (bx, b, 16); - - } - #endif /*USE_PADLOCK*/ -@@ -609,9 +609,9 @@ do_decrypt (RIJNDAEL_context *ctx, byte - ctx->decryption_prepared = 1; - } - -- memcpy (a.a, ax, 16); -+ grub_memcpy (a.a, ax, 16); - do_decrypt_aligned (ctx, b.b, a.a); -- memcpy (bx, b.b, 16); -+ grub_memcpy (bx, b.b, 16); - #undef rk - } - diff --git a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_rmd160_c b/package/grub/patches/patch-lib_libgcrypt-grub_cipher_rmd160_c deleted file mode 100644 index fb818bd51..000000000 --- a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_rmd160_c +++ /dev/null @@ -1,11 +0,0 @@ ---- grub-1.98.orig/lib/libgcrypt-grub/cipher/rmd160.c 2010-03-06 21:52:26.000000000 +0100 -+++ grub-1.98/lib/libgcrypt-grub/cipher/rmd160.c 2010-06-26 20:23:39.319276778 +0200 -@@ -185,7 +185,7 @@ transform ( RMD160_CONTEXT *hd, const un - * executes on a 586-100 (39.73 bogomips) at about 1900kb/sec; - * [measured with a 4MB data and "gpgm --print-md rmd160"] */ - u32 x[16]; -- memcpy( x, data, 64 ); -+ grub_memcpy( x, data, 64 ); - #endif - - diff --git a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_serpent_c b/package/grub/patches/patch-lib_libgcrypt-grub_cipher_serpent_c deleted file mode 100644 index 7c99e23ad..000000000 --- a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_serpent_c +++ /dev/null @@ -1,20 +0,0 @@ ---- grub-1.98.orig/lib/libgcrypt-grub/cipher/serpent.c 2010-03-06 21:52:26.000000000 +0100 -+++ grub-1.98/lib/libgcrypt-grub/cipher/serpent.c 2010-06-26 20:29:51.523275940 +0200 -@@ -917,7 +917,7 @@ serpent_test (void) - (const u32 *) test_data[i].text_plain, - (u32 *) scratch); - -- if (memcmp (scratch, test_data[i].text_cipher, sizeof (serpent_block_t))) -+ if (grub_memcmp (scratch, test_data[i].text_cipher, sizeof (serpent_block_t))) - switch (test_data[i].key_length) - { - case 16: -@@ -931,7 +931,7 @@ serpent_test (void) - serpent_decrypt_internal (&context, - (const u32 *) test_data[i].text_cipher, - (u32 *) scratch); -- if (memcmp (scratch, test_data[i].text_plain, sizeof (serpent_block_t))) -+ if (grub_memcmp (scratch, test_data[i].text_plain, sizeof (serpent_block_t))) - switch (test_data[i].key_length) - { - case 16: diff --git a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_sha1_c b/package/grub/patches/patch-lib_libgcrypt-grub_cipher_sha1_c deleted file mode 100644 index b04764bb8..000000000 --- a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_sha1_c +++ /dev/null @@ -1,11 +0,0 @@ ---- grub-1.98.orig/lib/libgcrypt-grub/cipher/sha1.c 2010-03-06 21:52:26.000000000 +0100 -+++ grub-1.98/lib/libgcrypt-grub/cipher/sha1.c 2010-06-26 20:23:50.135168960 +0200 -@@ -114,7 +114,7 @@ transform (SHA1_CONTEXT *hd, const unsig - for ( ;nblocks; nblocks--) - { - #ifdef WORDS_BIGENDIAN -- memcpy (x, data, 64); -+ grub_memcpy (x, data, 64); - data += 64; - #else - { diff --git a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_sha256_c b/package/grub/patches/patch-lib_libgcrypt-grub_cipher_sha256_c deleted file mode 100644 index f9676e392..000000000 --- a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_sha256_c +++ /dev/null @@ -1,11 +0,0 @@ ---- grub-1.98.orig/lib/libgcrypt-grub/cipher/sha256.c 2010-03-06 21:52:26.000000000 +0100 -+++ grub-1.98/lib/libgcrypt-grub/cipher/sha256.c 2010-06-26 20:24:00.135274844 +0200 -@@ -150,7 +150,7 @@ transform (SHA256_CONTEXT *hd, const uns - h = hd->h7; - - #ifdef WORDS_BIGENDIAN -- memcpy (x, data, 64); -+ grub_memcpy (x, data, 64); - #else - { - byte *p2; diff --git a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_sha512_c b/package/grub/patches/patch-lib_libgcrypt-grub_cipher_sha512_c deleted file mode 100644 index 070a15dff..000000000 --- a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_sha512_c +++ /dev/null @@ -1,11 +0,0 @@ ---- grub-1.98.orig/lib/libgcrypt-grub/cipher/sha512.c 2010-03-06 21:52:26.000000000 +0100 -+++ grub-1.98/lib/libgcrypt-grub/cipher/sha512.c 2010-06-26 20:24:09.235288423 +0200 -@@ -162,7 +162,7 @@ transform (SHA512_CONTEXT *hd, const uns - h = hd->h7; - - #ifdef WORDS_BIGENDIAN -- memcpy (w, data, 128); -+ grub_memcpy (w, data, 128); - #else - { - int i; diff --git a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_tiger_c b/package/grub/patches/patch-lib_libgcrypt-grub_cipher_tiger_c deleted file mode 100644 index a039004a2..000000000 --- a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_tiger_c +++ /dev/null @@ -1,11 +0,0 @@ ---- grub-1.98.orig/lib/libgcrypt-grub/cipher/tiger.c 2010-03-06 21:52:26.000000000 +0100 -+++ grub-1.98/lib/libgcrypt-grub/cipher/tiger.c 2010-06-26 20:22:45.507277255 +0200 -@@ -685,7 +685,7 @@ transform ( TIGER_CONTEXT *hd, const uns - x[7] = MKWORD(data, 7); - #undef MKWORD - #else -- memcpy( &x[0], data, 64 ); -+ grub_memcpy( &x[0], data, 64 ); - #endif - - /* save */ diff --git a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_twofish_c b/package/grub/patches/patch-lib_libgcrypt-grub_cipher_twofish_c deleted file mode 100644 index 88e9e761c..000000000 --- a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_twofish_c +++ /dev/null @@ -1,20 +0,0 @@ ---- grub-1.98.orig/lib/libgcrypt-grub/cipher/twofish.c 2010-03-06 21:52:26.000000000 +0100 -+++ grub-1.98/lib/libgcrypt-grub/cipher/twofish.c 2010-06-26 20:30:05.671278033 +0200 -@@ -932,7 +932,7 @@ main() - twofish_encrypt (&ctx, buffer[1], buffer[1]); - } - } -- encrypt_msg = memcmp (buffer, test_encrypt, sizeof (test_encrypt)) ? -+ encrypt_msg = grub_memcmp (buffer, test_encrypt, sizeof (test_encrypt)) ? - "encryption failure!\n" : "encryption OK!\n"; - - /* Decryption test. */ -@@ -954,7 +954,7 @@ main() - /* Stop the timer, and print results. */ - timer = clock () - timer; - printf (encrypt_msg); -- printf (memcmp (buffer, test_decrypt, sizeof (test_decrypt)) ? -+ printf (grub_memcmp (buffer, test_decrypt, sizeof (test_decrypt)) ? - "decryption failure!\n" : "decryption OK!\n"); - printf ("elapsed time: %.1f s.\n", (float) timer / CLOCKS_PER_SEC); - diff --git a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_whirlpool_c b/package/grub/patches/patch-lib_libgcrypt-grub_cipher_whirlpool_c deleted file mode 100644 index a92518354..000000000 --- a/package/grub/patches/patch-lib_libgcrypt-grub_cipher_whirlpool_c +++ /dev/null @@ -1,11 +0,0 @@ ---- grub-1.98.orig/lib/libgcrypt-grub/cipher/whirlpool.c 2010-03-06 21:52:26.000000000 +0100 -+++ grub-1.98/lib/libgcrypt-grub/cipher/whirlpool.c 2010-06-26 20:17:35.043170089 +0200 -@@ -1381,7 +1381,7 @@ whirlpool_final (void *ctx) - context->buffer[context->count++] = 0; - - /* Add length of message. */ -- memcpy (context->buffer + context->count, context->length, 32); -+ grub_memcpy (context->buffer + context->count, context->length, 32); - context->count += 32; - whirlpool_add (context, NULL, 0); - diff --git a/package/grub/patches/patch-util_grub-install_in b/package/grub/patches/patch-util_grub-install_in deleted file mode 100644 index 6cbc9fbc3..000000000 --- a/package/grub/patches/patch-util_grub-install_in +++ /dev/null @@ -1,11 +0,0 @@ ---- grub-1.98.orig/util/grub-install.in 2010-03-06 21:51:37.000000000 +0100 -+++ grub-1.98/util/grub-install.in 2010-06-26 21:16:50.031158562 +0200 -@@ -306,7 +306,7 @@ config_opt= - - if [ "x${devabstraction_module}" = "x" ] ; then - if [ x"${install_device}" != x ]; then -- if echo "${install_device}" | grep -qx "(.*)" ; then -+ if echo "${install_device}" | grep -q "(.*)" ; then - install_drive="${install_device}" - else - install_drive="`$grub_probe --target=drive --device ${install_device}`" diff --git a/package/grub/patches/patch-util_grub-mkconfig_lib_in b/package/grub/patches/patch-util_grub-mkconfig_lib_in deleted file mode 100644 index a51e3ec53..000000000 --- a/package/grub/patches/patch-util_grub-mkconfig_lib_in +++ /dev/null @@ -1,11 +0,0 @@ ---- grub-1.98.orig/util/grub-mkconfig_lib.in 2010-03-06 21:51:37.000000000 +0100 -+++ grub-1.98/util/grub-mkconfig_lib.in 2010-06-26 21:17:19.399157123 +0200 -@@ -154,7 +154,7 @@ version_test_numeric () - a=$b - b=$c - fi -- if (echo $a ; echo $b) | sort -n | head -n 1 | grep -qx $b ; then -+ if (echo $a ; echo $b) | sort -n | head -n 1 | grep -q $b ; then - return 0 - else - return 1 diff --git a/package/grub/patches/patch-util_grub_d_10_linux_in b/package/grub/patches/patch-util_grub_d_10_linux_in deleted file mode 100644 index b84b3e3ca..000000000 --- a/package/grub/patches/patch-util_grub_d_10_linux_in +++ /dev/null @@ -1,20 +0,0 @@ ---- grub-1.98.orig/util/grub.d/10_linux.in 2010-03-06 21:51:37.000000000 +0100 -+++ grub-1.98/util/grub.d/10_linux.in 2010-06-26 21:18:10.803156350 +0200 -@@ -66,8 +66,8 @@ linux_entry () - # Use ELILO's generic "efifb" when it's known to be available. - # FIXME: We need an interface to select vesafb in case efifb can't be used. - if [ "x$GRUB_GFXPAYLOAD_LINUX" = x ]; then -- if grep -qx "CONFIG_FB_EFI=y" /boot/config-${version} 2> /dev/null \ -- && grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" /boot/config-${version} 2> /dev/null; then -+ if grep -q "CONFIG_FB_EFI=y" /boot/config-${version} 2> /dev/null \ -+ && grep -q "CONFIG_VT_HW_CONSOLE_BINDING=y" /boot/config-${version} 2> /dev/null; then - cat << EOF - set gfxpayload=keep - EOF -@@ -135,5 +135,5 @@ while [ "x$list" != "x" ] ; do - "single ${GRUB_CMDLINE_LINUX}" - fi - -- list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` -+ list=`echo $list | tr ' ' '\n' | grep -v $linux | tr '\n' ' '` - done diff --git a/package/hdparm/Makefile b/package/hdparm/Makefile index 61925e59c..91d0d0c03 100644 --- a/package/hdparm/Makefile +++ b/package/hdparm/Makefile @@ -7,7 +7,7 @@ PKG_NAME:= hdparm PKG_VERSION:= 9.43 PKG_RELEASE:= 1 PKG_MD5SUM:= f73233be118d86c779a8463d8b6a3cdb -PKG_DESCR:= get/set ATA drive parameters +PKG_DESCR:= get/set ATA/SATA drive parameters PKG_SECTION:= fs PKG_URL:= http://sourceforge.net/projects/hdparm PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=hdparm/} diff --git a/package/heirloom-cpio/Makefile b/package/heirloom-cpio/Makefile new file mode 100644 index 000000000..a91b71ecf --- /dev/null +++ b/package/heirloom-cpio/Makefile @@ -0,0 +1,32 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include ${TOPDIR}/rules.mk + +PKG_NAME:= heirloom-cpio +PKG_VERSION:= 1.0 +PKG_RELEASE:= 1 +PKG_DESCR:= patched version of heirloom cpio +PKG_SECTION:= archive + +PKG_CFLINE_HEIRLOOM_CPIO:= depends on ADK_HOST_ONLY + +NO_DISTFILES:= 1 + +include ${TOPDIR}/mk/host.mk +include ${TOPDIR}/mk/package.mk + +$(eval $(call HOST_template,HEIRLOOM_CPIO,heirloom-cpio,${PKG_VERSION}-${PKG_RELEASE})) + +HOST_STYLE:= manual + +host-build: + (cd ${WRKBUILD} && env ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \ + ${HOST_MAKE_FLAGS} ${HOST_ALL_TARGET}) + +heirloom-cpio-hostinstall: + ${INSTALL_DIR} ${STAGING_HOST_DIR}/usr/bin + ${INSTALL_BIN} ${WRKBUILD}/cpio ${STAGING_HOST_DIR}/usr/bin + +include ${TOPDIR}/mk/host-bottom.mk +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/heirloom-cpio/src/Makefile b/package/heirloom-cpio/src/Makefile new file mode 100644 index 000000000..ecaf82243 --- /dev/null +++ b/package/heirloom-cpio/src/Makefile @@ -0,0 +1,28 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +all: cpio + +SRCS:= ib_open.c \ + ib_close.c \ + ib_read.c \ + ib_alloc.c \ + ib_free.c \ + ib_getlin.c \ + sfile.c \ + gmatch.c \ + sigset.c \ + memalign.c \ + version.c \ + blast.c \ + crc32.c \ + expand.c \ + explode.c \ + flags.c \ + inflate.c \ + unshrink.c \ + nonpax.c \ + cpio.c + +cpio: ${SRCS} + $(CC) $(CFLAGS_FOR_BUILD) -D_GNU_SOURCE -I. -o $@ $^ diff --git a/package/heirloom-cpio/src/_alloca.h b/package/heirloom-cpio/src/_alloca.h new file mode 100644 index 000000000..dc2afe5b4 --- /dev/null +++ b/package/heirloom-cpio/src/_alloca.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)_alloca.h 1.5 (gritter) 1/22/06 */ + +#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || \ + defined (__DragonFly__) || defined (__APPLE__) +#include <stdlib.h> +#endif /* __FreeBSD__, __NetBSD__, __OpenBSD__, __DragonFly__, __APPLE__ */ diff --git a/package/heirloom-cpio/src/_malloc.h b/package/heirloom-cpio/src/_malloc.h new file mode 100644 index 000000000..1693e3673 --- /dev/null +++ b/package/heirloom-cpio/src/_malloc.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)_malloc.h 1.2 (gritter) 5/1/04 */ + +#include <stdlib.h> + +extern void *memalign(size_t, size_t); diff --git a/package/heirloom-cpio/src/_utmpx.h b/package/heirloom-cpio/src/_utmpx.h new file mode 100644 index 000000000..c32bd9527 --- /dev/null +++ b/package/heirloom-cpio/src/_utmpx.h @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2004 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)_utmpx.h 1.9 (gritter) 1/22/06 */ + +#if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ + defined (__UCLIBC__) || defined (__OpenBSD__) || \ + defined (__DragonFly__) || defined (__APPLE__) +#include <sys/types.h> +#include <sys/time.h> +#include <utmp.h> + +#ifndef __dietlibc__ +struct utmpx { + char ut_user[UT_NAMESIZE]; + char ut_id[UT_LINESIZE]; + char ut_line[UT_LINESIZE]; + char ut_host[UT_HOSTSIZE]; + pid_t ut_pid; + short ut_type; + struct timeval ut_tv; + struct { + int e_termination; + int e_exit; + } ut_exit; +}; + +#ifndef EMPTY +#define EMPTY 0 +#endif +#ifndef BOOT_TIME +#define BOOT_TIME 1 +#endif +#ifndef OLD_TIME +#define OLD_TIME 2 +#endif +#ifndef NEW_TIME +#define NEW_TIME 3 +#endif +#ifndef USER_PROCESS +#define USER_PROCESS 4 +#endif +#ifndef INIT_PROCESS +#define INIT_PROCESS 5 +#endif +#ifndef LOGIN_PROCESS +#define LOGIN_PROCESS 6 +#endif +#ifndef DEAD_PROCESS +#define DEAD_PROCESS 7 +#endif +#ifndef RUN_LVL +#define RUN_LVL 8 +#endif +#ifndef ACCOUNTING +#define ACCOUNTING 9 +#endif +#else /* __dietlibc__ */ +#define utmpx utmp +#endif /* __dietlibc__ */ + +extern void endutxent(void); +extern struct utmpx *getutxent(void); +extern struct utmpx *getutxid(const struct utmpx *); +extern struct utmpx *getutxline(const struct utmpx *); +extern struct utmpx *pututxline(const struct utmpx *); +extern void setutxent(void); +extern int utmpxname(const char *); +extern void updwtmpx(const char *, const struct utmpx *); +#endif /* __FreeBSD__ || __dietlibc__ || __NetBSD__ || __UCLIBC__ || + __OpenBSD__ || __DragonFly__ || __APPLE__ */ diff --git a/package/heirloom-cpio/src/asciitype.c b/package/heirloom-cpio/src/asciitype.c new file mode 100644 index 000000000..f7f322173 --- /dev/null +++ b/package/heirloom-cpio/src/asciitype.c @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)asciitype.c 1.4 (gritter) 4/17/03 */ + +#include "asciitype.h" + +const unsigned char class_char[] = { +/* 000 nul 001 soh 002 stx 003 etx 004 eot 005 enq 006 ack 007 bel */ + C_CNTRL,C_CNTRL,C_CNTRL,C_CNTRL,C_CNTRL,C_CNTRL,C_CNTRL,C_CNTRL, +/* 010 bs 011 ht 012 nl 013 vt 014 np 015 cr 016 so 017 si */ + C_CNTRL,C_BLANK,C_WHITE,C_SPACE,C_SPACE,C_SPACE,C_CNTRL,C_CNTRL, +/* 020 dle 021 dc1 022 dc2 023 dc3 024 dc4 025 nak 026 syn 027 etb */ + C_CNTRL,C_CNTRL,C_CNTRL,C_CNTRL,C_CNTRL,C_CNTRL,C_CNTRL,C_CNTRL, +/* 030 can 031 em 032 sub 033 esc 034 fs 035 gs 036 rs 037 us */ + C_CNTRL,C_CNTRL,C_CNTRL,C_CNTRL,C_CNTRL,C_CNTRL,C_CNTRL,C_CNTRL, +/* 040 sp 041 ! 042 " 043 # 044 $ 045 % 046 & 047 ' */ + C_BLANK,C_PUNCT,C_PUNCT,C_PUNCT,C_PUNCT,C_PUNCT,C_PUNCT,C_PUNCT, +/* 050 ( 051 ) 052 * 053 + 054 , 055 - 056 . 057 / */ + C_PUNCT,C_PUNCT,C_PUNCT,C_PUNCT,C_PUNCT,C_PUNCT,C_PUNCT,C_PUNCT, +/* 060 0 061 1 062 2 063 3 064 4 065 5 066 6 067 7 */ + C_OCTAL,C_OCTAL,C_OCTAL,C_OCTAL,C_OCTAL,C_OCTAL,C_OCTAL,C_OCTAL, +/* 070 8 071 9 072 : 073 ; 074 < 075 = 076 > 077 ? */ + C_DIGIT,C_DIGIT,C_PUNCT,C_PUNCT,C_PUNCT,C_PUNCT,C_PUNCT,C_PUNCT, +/* 100 @ 101 A 102 B 103 C 104 D 105 E 106 F 107 G */ + C_PUNCT,C_UPPER,C_UPPER,C_UPPER,C_UPPER,C_UPPER,C_UPPER,C_UPPER, +/* 110 H 111 I 112 J 113 K 114 L 115 M 116 N 117 O */ + C_UPPER,C_UPPER,C_UPPER,C_UPPER,C_UPPER,C_UPPER,C_UPPER,C_UPPER, +/* 120 P 121 Q 122 R 123 S 124 T 125 U 126 V 127 W */ + C_UPPER,C_UPPER,C_UPPER,C_UPPER,C_UPPER,C_UPPER,C_UPPER,C_UPPER, +/* 130 X 131 Y 132 Z 133 [ 134 \ 135 ] 136 ^ 137 _ */ + C_UPPER,C_UPPER,C_UPPER,C_PUNCT,C_PUNCT,C_PUNCT,C_PUNCT,C_PUNCT, +/* 140 ` 141 a 142 b 143 c 144 d 145 e 146 f 147 g */ + C_PUNCT,C_LOWER,C_LOWER,C_LOWER,C_LOWER,C_LOWER,C_LOWER,C_LOWER, +/* 150 h 151 i 152 j 153 k 154 l 155 m 156 n 157 o */ + C_LOWER,C_LOWER,C_LOWER,C_LOWER,C_LOWER,C_LOWER,C_LOWER,C_LOWER, +/* 160 p 161 q 162 r 163 s 164 t 165 u 166 v 167 w */ + C_LOWER,C_LOWER,C_LOWER,C_LOWER,C_LOWER,C_LOWER,C_LOWER,C_LOWER, +/* 170 x 171 y 172 z 173 { 174 | 175 } 176 ~ 177 del */ + C_LOWER,C_LOWER,C_LOWER,C_PUNCT,C_PUNCT,C_PUNCT,C_PUNCT,C_CNTRL +}; diff --git a/package/heirloom-cpio/src/asciitype.h b/package/heirloom-cpio/src/asciitype.h new file mode 100644 index 000000000..6ac1961a1 --- /dev/null +++ b/package/heirloom-cpio/src/asciitype.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)asciitype.h 1.6 (gritter) 9/9/05 */ + +/* + * Locale-independent character classes. + */ +enum { + C_CNTRL = 0000, + C_BLANK = 0001, + C_WHITE = 0002, + C_SPACE = 0004, + C_PUNCT = 0010, + C_OCTAL = 0020, + C_DIGIT = 0040, + C_UPPER = 0100, + C_LOWER = 0200 +}; + +extern const unsigned char class_char[]; + +#define asciichar(c) ((unsigned)(c) <= 0177) +#define alnumchar(c) (asciichar(c)&&(class_char[c]&\ + (C_DIGIT|C_OCTAL|C_UPPER|C_LOWER))) +#define alphachar(c) (asciichar(c)&&(class_char[c]&(C_UPPER|C_LOWER))) +#define blankchar(c) (asciichar(c)&&(class_char[c]&(C_BLANK))) +#define cntrlchar(c) (asciichar(c)&&(class_char[c]==C_CNTRL) +#define digitchar(c) (asciichar(c)&&(class_char[c]&(C_DIGIT|C_OCTAL))) +#define lowerchar(c) (asciichar(c)&&(class_char[c]&(C_LOWER))) +#define punctchar(c) (asciichar(c)&&(class_char[c]&(C_PUNCT))) +#define spacechar(c) (asciichar(c)&&(class_char[c]&(C_BLANK|C_SPACE|C_WHITE))) +#define upperchar(c) (asciichar(c)&&(class_char[c]&(C_UPPER))) +#define whitechar(c) (asciichar(c)&&(class_char[c]&(C_BLANK|C_WHITE))) +#define octalchar(c) (asciichar(c)&&(class_char[c]&(C_OCTAL))) +#define graphchar(c) (asciichar(c)&&(class_char[c]&\ + (C_UPPER|C_LOWER|C_DIGIT|C_OCTAL|C_PUNCT))) +#define printchar(c) ((c)==' ' || asciichar(c)&&(class_char[c]&\ + (C_UPPER|C_LOWER|C_DIGIT|C_OCTAL|C_PUNCT))) + +#define upperconv(c) (lowerchar(c) ? (c)-'a'+'A' : (c)) +#define lowerconv(c) (upperchar(c) ? (c)-'A'+'a' : (c)) diff --git a/package/heirloom-cpio/src/atoll.h b/package/heirloom-cpio/src/atoll.h new file mode 100644 index 000000000..8283aff64 --- /dev/null +++ b/package/heirloom-cpio/src/atoll.h @@ -0,0 +1,8 @@ +/* Sccsid @(#)atoll.h 1.4 (gritter) 7/18/04 */ + +#if defined (__hpux) || defined (_AIX) || \ + defined (__FreeBSD__) && (__FreeBSD__) < 5 +extern long long strtoll(const char *nptr, char **endptr, int base); +extern unsigned long long strtoull(const char *nptr, char **endptr, int base); +extern long long atoll(const char *nptr); +#endif /* __hpux || _AIX || __FreeBSD__ < 5 */ diff --git a/package/heirloom-cpio/src/blank.h b/package/heirloom-cpio/src/blank.h new file mode 100644 index 000000000..1ab3d57b8 --- /dev/null +++ b/package/heirloom-cpio/src/blank.h @@ -0,0 +1,38 @@ +/* + * isblank() and iswblank() are not available with many pre-XSH6 + * systems. Check whether isblank was defined, and assume it is + * not available if not. + */ +/* Sccsid @(#)blank.h 1.3 (gritter) 5/1/04 */ + +#ifndef __dietlibc__ +#ifndef LIBCOMMON_BLANK_H +#define LIBCOMMON_BLANK_H 1 + +#include <ctype.h> +#include <wctype.h> + +#ifndef isblank + +static +#ifdef __GNUC__ +__inline__ +#endif /* __GNUC__ */ +int +my_isblank(int c) +{ + return c == ' ' || c == '\t'; +} +#define isblank(c) my_isblank(c) + +static int +my_iswblank(wint_t c) +{ + return c == L' ' || c == L'\t'; +} +#undef iswblank +#define iswblank(c) my_iswblank(c) + +#endif /* !isblank */ +#endif /* !LIBCOMMON_BLANK_H */ +#endif /* !__dietlibc__ */ diff --git a/package/heirloom-cpio/src/blast.c b/package/heirloom-cpio/src/blast.c new file mode 100644 index 000000000..b62efd585 --- /dev/null +++ b/package/heirloom-cpio/src/blast.c @@ -0,0 +1,449 @@ +/* + * Changes by Gunnar Ritter, Freiburg i. Br., Germany, February 2004. + * + * Sccsid @(#)blast.c 1.2 (gritter) 2/17/04 + */ +/* blast.c + * Copyright (C) 2003 Mark Adler + * For conditions of distribution and use, see copyright notice in blast.h + * version 1.1, 16 Feb 2003 + * + * blast.c decompresses data compressed by the PKWare Compression Library. + * This function provides functionality similar to the explode() function of + * the PKWare library, hence the name "blast". + * + * This decompressor is based on the excellent format description provided by + * Ben Rudiak-Gould in comp.compression on August 13, 2001. Interestingly, the + * example Ben provided in the post is incorrect. The distance 110001 should + * instead be 111000. When corrected, the example byte stream becomes: + * + * 00 04 82 24 25 8f 80 7f + * + * which decompresses to "AIAIAIAIAIAIA" (without the quotes). + */ + +/* + * Change history: + * + * 1.0 12 Feb 2003 - First version + * 1.1 16 Feb 2003 - Fixed distance check for > 4 GB uncompressed data + */ + +#include <setjmp.h> /* for setjmp(), longjmp(), and jmp_buf */ +#include "blast.h" /* prototype for blast() */ + +#define local static /* for local function definitions */ +#define MAXBITS 13 /* maximum code length */ +#define MAXWIN 4096 /* maximum window size */ + +/* input and output state */ +struct state { + /* input state */ + blast_in infun; /* input function provided by user */ + void *inhow; /* opaque information passed to infun() */ + unsigned char *in; /* next input location */ + unsigned left; /* available input at in */ + int bitbuf; /* bit buffer */ + int bitcnt; /* number of bits in bit buffer */ + + /* input limit error return state for bits() and decode() */ + jmp_buf env; + + /* output state */ + blast_out outfun; /* output function provided by user */ + void *outhow; /* opaque information passed to outfun() */ + unsigned next; /* index of next write location in out[] */ + int first; /* true to check distances (for first 4K) */ + unsigned char out[MAXWIN]; /* output buffer and sliding window */ +}; + +/* + * Return need bits from the input stream. This always leaves less than + * eight bits in the buffer. bits() works properly for need == 0. + * + * Format notes: + * + * - Bits are stored in bytes from the least significant bit to the most + * significant bit. Therefore bits are dropped from the bottom of the bit + * buffer, using shift right, and new bytes are appended to the top of the + * bit buffer, using shift left. + */ +local int bits(struct state *s, int need) +{ + int val; /* bit accumulator */ + + /* load at least need bits into val */ + val = s->bitbuf; + while (s->bitcnt < need) { + if (s->left == 0) { + s->left = s->infun(s->inhow, &(s->in)); + if (s->left == 0) longjmp(s->env, 1); /* out of input */ + } + val |= (int)(*(s->in)++) << s->bitcnt; /* load eight bits */ + s->left--; + s->bitcnt += 8; + } + + /* drop need bits and update buffer, always zero to seven bits left */ + s->bitbuf = val >> need; + s->bitcnt -= need; + + /* return need bits, zeroing the bits above that */ + return val & ((1 << need) - 1); +} + +/* + * Huffman code decoding tables. count[1..MAXBITS] is the number of symbols of + * each length, which for a canonical code are stepped through in order. + * symbol[] are the symbol values in canonical order, where the number of + * entries is the sum of the counts in count[]. The decoding process can be + * seen in the function decode() below. + */ +struct huffman { + short *count; /* number of symbols of each length */ + short *symbol; /* canonically ordered symbols */ +}; + +/* + * Decode a code from the stream s using huffman table h. Return the symbol or + * a negative value if there is an error. If all of the lengths are zero, i.e. + * an empty code, or if the code is incomplete and an invalid code is received, + * then -9 is returned after reading MAXBITS bits. + * + * Format notes: + * + * - The codes as stored in the compressed data are bit-reversed relative to + * a simple integer ordering of codes of the same lengths. Hence below the + * bits are pulled from the compressed data one at a time and used to + * build the code value reversed from what is in the stream in order to + * permit simple integer comparisons for decoding. + * + * - The first code for the shortest length is all ones. Subsequent codes of + * the same length are simply integer decrements of the previous code. When + * moving up a length, a one bit is appended to the code. For a complete + * code, the last code of the longest length will be all zeros. To support + * this ordering, the bits pulled during decoding are inverted to apply the + * more "natural" ordering starting with all zeros and incrementing. + */ +local int decode(struct state *s, struct huffman *h) +{ + int len; /* current number of bits in code */ + int code; /* len bits being decoded */ + int first; /* first code of length len */ + int count; /* number of codes of length len */ + int index; /* index of first code of length len in symbol table */ + int bitbuf; /* bits from stream */ + int left; /* bits left in next or left to process */ + short *next; /* next number of codes */ + + bitbuf = s->bitbuf; + left = s->bitcnt; + code = first = index = 0; + len = 1; + next = h->count + 1; + while (1) { + while (left--) { + code |= (bitbuf & 1) ^ 1; /* invert code */ + bitbuf >>= 1; + count = *next++; + if (code < first + count) { /* if length len, return symbol */ + s->bitbuf = bitbuf; + s->bitcnt = (s->bitcnt - len) & 7; + return h->symbol[index + (code - first)]; + } + index += count; /* else update for next length */ + first += count; + first <<= 1; + code <<= 1; + len++; + } + left = (MAXBITS+1) - len; + if (left == 0) break; + if (s->left == 0) { + s->left = s->infun(s->inhow, &(s->in)); + if (s->left == 0) longjmp(s->env, 1); /* out of input */ + } + bitbuf = *(s->in)++; + s->left--; + if (left > 8) left = 8; + } + return -9; /* ran out of codes */ +} + +/* + * Given a list of repeated code lengths rep[0..n-1], where each byte is a + * count (high four bits + 1) and a code length (low four bits), generate the + * list of code lengths. This compaction reduces the size of the object code. + * Then given the list of code lengths length[0..n-1] representing a canonical + * Huffman code for n symbols, construct the tables required to decode those + * codes. Those tables are the number of codes of each length, and the symbols + * sorted by length, retaining their original order within each length. The + * return value is zero for a complete code set, negative for an over- + * subscribed code set, and positive for an incomplete code set. The tables + * can be used if the return value is zero or positive, but they cannot be used + * if the return value is negative. If the return value is zero, it is not + * possible for decode() using that table to return an error--any stream of + * enough bits will resolve to a symbol. If the return value is positive, then + * it is possible for decode() using that table to return an error for received + * codes past the end of the incomplete lengths. + */ +local int construct(struct huffman *h, const unsigned char *rep, int n) +{ + int symbol; /* current symbol when stepping through length[] */ + int len; /* current length when stepping through h->count[] */ + int left; /* number of possible codes left of current length */ + short offs[MAXBITS+1]; /* offsets in symbol table for each length */ + short length[256]; /* code lengths */ + + /* convert compact repeat counts into symbol bit length list */ + symbol = 0; + do { + len = *rep++; + left = (len >> 4) + 1; + len &= 15; + do { + length[symbol++] = len; + } while (--left); + } while (--n); + n = symbol; + + /* count number of codes of each length */ + for (len = 0; len <= MAXBITS; len++) + h->count[len] = 0; + for (symbol = 0; symbol < n; symbol++) + (h->count[length[symbol]])++; /* assumes lengths are within bounds */ + if (h->count[0] == n) /* no codes! */ + return 0; /* complete, but decode() will fail */ + + /* check for an over-subscribed or incomplete set of lengths */ + left = 1; /* one possible code of zero length */ + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; /* one more bit, double codes left */ + left -= h->count[len]; /* deduct count from possible codes */ + if (left < 0) return left; /* over-subscribed--return negative */ + } /* left > 0 means incomplete */ + + /* generate offsets into symbol table for each length for sorting */ + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) + offs[len + 1] = offs[len] + h->count[len]; + + /* + * put symbols in table sorted by length, by symbol order within each + * length + */ + for (symbol = 0; symbol < n; symbol++) + if (length[symbol] != 0) + h->symbol[offs[length[symbol]]++] = symbol; + + /* return zero for complete set, positive for incomplete set */ + return left; +} + +/* + * Decode PKWare Compression Library stream. + * + * Format notes: + * + * - First byte is 0 if literals are uncoded or 1 if they are coded. Second + * byte is 4, 5, or 6 for the number of extra bits in the distance code. + * This is the base-2 logarithm of the dictionary size minus six. + * + * - Compressed data is a combination of literals and length/distance pairs + * terminated by an end code. Literals are either Huffman coded or + * uncoded bytes. A length/distance pair is a coded length followed by a + * coded distance to represent a string that occurs earlier in the + * uncompressed data that occurs again at the current location. + * + * - A bit preceding a literal or length/distance pair indicates which comes + * next, 0 for literals, 1 for length/distance. + * + * - If literals are uncoded, then the next eight bits are the literal, in the + * normal bit order in th stream, i.e. no bit-reversal is needed. Similarly, + * no bit reversal is needed for either the length extra bits or the distance + * extra bits. + * + * - Literal bytes are simply written to the output. A length/distance pair is + * an instruction to copy previously uncompressed bytes to the output. The + * copy is from distance bytes back in the output stream, copying for length + * bytes. + * + * - Distances pointing before the beginning of the output data are not + * permitted. + * + * - Overlapped copies, where the length is greater than the distance, are + * allowed and common. For example, a distance of one and a length of 518 + * simply copies the last byte 518 times. A distance of four and a length of + * twelve copies the last four bytes three times. A simple forward copy + * ignoring whether the length is greater than the distance or not implements + * this correctly. + */ +local int decomp(struct state *s) +{ + int lit; /* true if literals are coded */ + int dict; /* log2(dictionary size) - 6 */ + int symbol; /* decoded symbol, extra bits for distance */ + int len; /* length for copy */ + int dist; /* distance for copy */ + int copy; /* copy counter */ + unsigned char *from, *to; /* copy pointers */ + static int virgin = 1; /* build tables once */ + static short litcnt[MAXBITS+1], litsym[256]; /* litcode memory */ + static short lencnt[MAXBITS+1], lensym[16]; /* lencode memory */ + static short distcnt[MAXBITS+1], distsym[64]; /* distcode memory */ + static struct huffman litcode = {litcnt, litsym}; /* length code */ + static struct huffman lencode = {lencnt, lensym}; /* length code */ + static struct huffman distcode = {distcnt, distsym};/* distance code */ + /* bit lengths of literal codes */ + static const unsigned char litlen[] = { + 11, 124, 8, 7, 28, 7, 188, 13, 76, 4, 10, 8, 12, 10, 12, 10, 8, 23, 8, + 9, 7, 6, 7, 8, 7, 6, 55, 8, 23, 24, 12, 11, 7, 9, 11, 12, 6, 7, 22, 5, + 7, 24, 6, 11, 9, 6, 7, 22, 7, 11, 38, 7, 9, 8, 25, 11, 8, 11, 9, 12, + 8, 12, 5, 38, 5, 38, 5, 11, 7, 5, 6, 21, 6, 10, 53, 8, 7, 24, 10, 27, + 44, 253, 253, 253, 252, 252, 252, 13, 12, 45, 12, 45, 12, 61, 12, 45, + 44, 173}; + /* bit lengths of length codes 0..15 */ + static const unsigned char lenlen[] = {2, 35, 36, 53, 38, 23}; + /* bit lengths of distance codes 0..63 */ + static const unsigned char distlen[] = {2, 20, 53, 230, 247, 151, 248}; + static const short base[16] = { /* base for length codes */ + 3, 2, 4, 5, 6, 7, 8, 9, 10, 12, 16, 24, 40, 72, 136, 264}; + static const char extra[16] = { /* extra bits for length codes */ + 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8}; + + /* set up decoding tables (once--might not be thread-safe) */ + if (virgin) { + construct(&litcode, litlen, sizeof(litlen)); + construct(&lencode, lenlen, sizeof(lenlen)); + construct(&distcode, distlen, sizeof(distlen)); + virgin = 0; + } + + /* read header */ + lit = bits(s, 8); + if (lit > 1) return -1; + dict = bits(s, 8); + if (dict < 4 || dict > 6) return -2; + + /* decode literals and length/distance pairs */ + do { + if (bits(s, 1)) { + /* get length */ + symbol = decode(s, &lencode); + len = base[symbol] + bits(s, extra[symbol]); + if (len == 519) break; /* end code */ + + /* get distance */ + symbol = len == 2 ? 2 : dict; + dist = decode(s, &distcode) << symbol; + dist += bits(s, symbol); + dist++; + if (s->first && dist > s->next) + return -3; /* distance too far back */ + + /* copy length bytes from distance bytes back */ + do { + to = s->out + s->next; + from = to - dist; + copy = MAXWIN; + if (s->next < dist) { + from += copy; + copy = dist; + } + copy -= s->next; + if (copy > len) copy = len; + len -= copy; + s->next += copy; + do { + *to++ = *from++; + } while (--copy); + if (s->next == MAXWIN) { + if (s->outfun(s->outhow, s->out, s->next)) return 1; + s->next = 0; + s->first = 0; + } + } while (len != 0); + } + else { + /* get literal and write it */ + symbol = lit ? decode(s, &litcode) : bits(s, 8); + s->out[s->next++] = symbol; + if (s->next == MAXWIN) { + if (s->outfun(s->outhow, s->out, s->next)) return 1; + s->next = 0; + s->first = 0; + } + } + } while (1); + return 0; +} + +/* See comments in blast.h */ +int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow) +{ + struct state s; /* input/output state */ + int err; /* return value */ + + /* initialize input state */ + s.infun = infun; + s.inhow = inhow; + s.left = 0; + s.bitbuf = 0; + s.bitcnt = 0; + + /* initialize output state */ + s.outfun = outfun; + s.outhow = outhow; + s.next = 0; + s.first = 1; + + /* return if bits() or decode() tries to read past available input */ + if (setjmp(s.env) != 0) /* if came back here via longjmp(), */ + err = 2; /* then skip decomp(), return error */ + else + err = decomp(&s); /* decompress */ + + /* write any leftover output and update the error code if needed */ + if (err != 1 && s.next && s.outfun(s.outhow, s.out, s.next) && err == 0) + err = 1; + return err; +} + +#ifdef TEST +/* Example of how to use blast() */ +#include <stdio.h> +#include <stdlib.h> + +#define CHUNK 16384 + +local unsigned inf(void *how, unsigned char **buf) +{ + static unsigned char hold[CHUNK]; + + *buf = hold; + return fread(hold, 1, CHUNK, (FILE *)how); +} + +local int outf(void *how, unsigned char *buf, unsigned len) +{ + return fwrite(buf, 1, len, (FILE *)how) != len; +} + +/* Decompress a PKWare Compression Library stream from stdin to stdout */ +int main(void) +{ + int ret, n; + + /* decompress to stdout */ + ret = blast(inf, stdin, outf, stdout); + if (ret != 0) fprintf(stderr, "blast error: %d\n", ret); + + /* see if there are any leftover bytes */ + n = 0; + while (getchar() != EOF) n++; + if (n) fprintf(stderr, "blast warning: %d unused bytes of input\n", n); + + /* return blast() error code */ + return ret; +} +#endif diff --git a/package/heirloom-cpio/src/blast.h b/package/heirloom-cpio/src/blast.h new file mode 100644 index 000000000..0c16d1391 --- /dev/null +++ b/package/heirloom-cpio/src/blast.h @@ -0,0 +1,76 @@ +/* + * Changes by Gunnar Ritter, Freiburg i. Br., Germany, February 2004. + * + * Sccsid @(#)blast.h 1.2 (gritter) 2/17/04 + */ +/* blast.h -- interface for blast.c + Copyright (C) 2003 Mark Adler + version 1.1, 16 Feb 2003 + + This software is provided 'as-is', without any express or implied + warranty. In no event will the author be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Mark Adler madler@alumni.caltech.edu + */ + + +/* + * blast() decompresses the PKWare Data Compression Library (DCL) compressed + * format. It provides the same functionality as the explode() function in + * that library. (Note: PKWare overused the "implode" verb, and the format + * used by their library implode() function is completely different and + * incompatible with the implode compression method supported by PKZIP.) + */ + + +typedef unsigned (*blast_in)(void *how, unsigned char **buf); +typedef int (*blast_out)(void *how, unsigned char *buf, unsigned len); +/* Definitions for input/output functions passed to blast(). See below for + * what the provided functions need to do. + */ + + +int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow); +/* Decompress input to output using the provided infun() and outfun() calls. + * On success, the return value of blast() is zero. If there is an error in + * the source data, i.e. it is not in the proper format, then a negative value + * is returned. If there is not enough input available or there is not enough + * output space, then a positive error is returned. + * + * The input function is invoked: len = infun(how, &buf), where buf is set by + * infun() to point to the input buffer, and infun() returns the number of + * available bytes there. If infun() returns zero, then blast() returns with + * an input error. (blast() only asks for input if it needs it.) inhow is for + * use by the application to pass an input descriptor to infun(), if desired. + * + * The output function is invoked: err = outfun(how, buf, len), where the bytes + * to be written are buf[0..len-1]. If err is not zero, then blast() returns + * with an output error. outfun() is always called with len <= 4096. outhow + * is for use by the application to pass an output descriptor to outfun(), if + * desired. + * + * The return codes are: + * + * 2: ran out of input before completing decompression + * 1: output error before completing decompression + * 0: successful decompression + * -1: literal flag not zero or one + * -2: dictionary size not in 4..6 + * -3: distance is too far back + * + * At the bottom of blast.c is an example program that uses blast() that can be + * compiled to produce a command-line decompression filter by defining TEST. + */ diff --git a/package/heirloom-cpio/src/cpio.1 b/package/heirloom-cpio/src/cpio.1 new file mode 100644 index 000000000..9c8b1f98c --- /dev/null +++ b/package/heirloom-cpio/src/cpio.1 @@ -0,0 +1,943 @@ +'\" t +.\" Copyright (c) 2003 Gunnar Ritter +.\" +.\" This software is provided 'as-is', without any express or implied +.\" warranty. In no event will the authors be held liable for any damages +.\" arising from the use of this software. +.\" +.\" Permission is granted to anyone to use this software for any purpose, +.\" including commercial applications, and to alter it and redistribute +.\" it freely, subject to the following restrictions: +.\" +.\" 1. The origin of this software must not be misrepresented; you must not +.\" claim that you wrote the original software. If you use this software +.\" in a product, an acknowledgment in the product documentation would be +.\" appreciated but is not required. +.\" +.\" 2. Altered source versions must be plainly marked as such, and must not be +.\" misrepresented as being the original software. +.\" +.\" 3. This notice may not be removed or altered from any source distribution. +.\" Sccsid @(#)cpio.1 1.92 (gritter) 3/26/07 +.TH CPIO 1 "3/26/07" "Heirloom Toolchest" "User Commands" +.SH NAME +cpio \- copy file archives in and out +.SH SYNOPSIS +.PD 0 +.HP +.nh +.ad l +\fBcpio\fR \fB\-i\fR[\fBbcdfkmrstuvBSV6\fR] [\fB\-C\fI\ size\fR] +[\fB\-E\fI\ file\fR] [\fB\-H\fI\ hdr\fR] [[\fB\-I\fI\ file\fR] +[\fB\-M\fI\ msg\fR]] [\fB\-R\fI\ id\fR] [\fIpatterns\fR] +.HP +.ad l +\fBcpio\fR \fB\-o\fR[\fBacvABLPV\fR] [\fB\-C\fI\ size\fR] +[\fB\-H\fI\ hdr\fR] [[\fB\-M\fI\ msg\fR] [\fB\-O\fI\ file\fR]] +.HP +.ad l +\fBcpio\fR \fB\-p\fR[\fBadlmPuvLV\fR] [\fB\-R\fI\ id\fR] \fIdirectory\fR +.br +.PD +.ad b +.hy 1 +.SH DESCRIPTION +.I Cpio +creates and extracts file archives and copies files. +.PP +With the +.B \-i +option, +.I cpio +works in +.RI ` copy-in ' +mode and extracts files from a file archive. +By default, +the archive is read from standard input. +Optional arguments are interpreted as +.I patterns +and restrict the set of extracted files +to those matching any of the +.IR patterns . +A +.RB ` !\& ' +at the beginning of the +.I pattern +selects all files that do not match this +.IR pattern . +The syntax is otherwise identical to that described in +.IR glob (7), +except that the slash character +.RB ` / ' +is matched by +meta-character constructs with +.RB ` * ', +.RB ` ? ' +and +.RB ` [ '. +Care must be taken to quote meta-characters appropriately from the shell. +File permissions are set to those in the archive; +if the caller is the super-user, +ownerships are restored as well. +.I Cpio +will not create directories, +preserve modification times +or overwrite more recently modified target files +unless the appropriate +.IR \-d , +.I \-m +or +.I \-u +options are specified. +Archives compressed with +.IR bzip2 (1), +.IR compress (1), +.IR gzip (1), +or +.IR rpm (1) +are transparently de\%compressed on input. +.PP +With +.BR \-o , +.I cpio +works in +.RI ` copy-out ' +mode, +creates archives +and writes them to standard output per default. +A list of filenames to be included in the archive is +read from standard input; +if the name of a directory appears, +it is included in the archive, +but +.I cpio +will not include any of its members +unless they are explicitly given in addition. +The +.IR find (1) +utility is useful to generate a list of files +(see also its +.I \-cpio +and +.I \-ncpio +operators). +When producing a filename list for +.IR cpio , +find should always be invoked with +.I \-depth +since this makes it possible to extract write-protected directories +for users other than the super-user. +.PP +The +.B \-p +option selects +.RI ` pass ' +mode; +a list of files is read from standard input as described for +.IR \-o ; +files are copied to the specified +.IR directory , +preserving attributes as described for +.IR \-i . +Special files are re-created in the target hierarchy, +and hard links between copied files are preserved. +.PP +When a premature end-of-file is detected with +.I \-i +and +.I \-o +and the archive is a block or character special file, +the user is prompted for new media. +.PP +The following options alter the behavior of +.IR cpio : +.TP +.B \-a +Resets the access times of files +that were included in the archive with +.I \-o +or copied with +.IR \-p . +.TP +.B \-A +Append files to the archive. +The archive must be seekable, +such as a regular file or a block device, +or a tape device capable of writing between filemarks. +.TP +.B \-b +Swap bytes within each half word +and half words within each word +of input file data. +.TP +.B \-B +Blocks input and output archives at 5120 byte records. +The default blocking size is device dependent. +.TP +.B \-c +Specifies that archive headers are in SVR4 ASCII cpio format. +This option is ignored with +.I \-i +unless the +.I \-k +option is also present. +.TP +\fB\-C\fI size\fR +Blocks input and output archives at +.I size +byte records. +.TP +.B \-d +Creates missing parent directories +for each file extracted from the archive +and allows the extraction of directories. +.TP +\fB\-E\fI file\fR +Each line read from +.I file +is taken as a pattern in addition +to those specified on the command line. +.TP +.B \-f +Reverses the sense of patterns +such that a file that does not match any of the patterns +is selected. +.TP +\fB\-H\fI header\fR +Specifies the archive header format to be one of: +.sp +.in +6 +.TS +lfB l. +\fBcrc\fR SVR4 ASCII cpio format with checksum;\ +\fBsco\fR T{ +SCO UnixWare 7.1 ASCII cpio format; +T} +\fBscocrc\fR T{ +SCO UnixWare 7.1 ASCII cpio format with checksum; +T} +\fBodc\fR T{ +traditional ASCII cpio format, as standardized in IEEE Std. 1003.1, 1996; +T} +\fBbbs\fR byte-swapped binary cpio format; +\fBsgi\fR T{ +SGI IRIX extended binary cpio format; +T} +\fBcray\fR T{ +Cray UNICOS 9 cpio format; +T} +\fBcray5\fR T{ +Cray UNICOS 5 cpio format; +T} +\fBdec\fR T{ +Digital UNIX extended cpio format; +T} +\fBtar\fR tar format; +\fBotar\fR old tar format; +\fBustar\fR T{ +IEEE Std. 1003.1, 1996 tar format; +T} +.T& +l s. +\fBpax\fR[\fB:\fIoption\fB,\fR[\fIoption\fB,\fR\|...]] +.T& +l l. +\& T{ +IEEE Std. 1003.1, 2001 pax format. +Format-specific \fIoptions\fR are: +.in +2n +.ti 0 +.br +\fBlinkdata\fR +.br +For a regular file which has multiple hard links, +the file data is stored once for each link in the archive, +instead of being stored for the first entry only. +This option must be used with care +since many implementations are unable +to read the resulting archive. +.ti 0 +.br +\fBtimes\fR +.br +Causes the times of last access and last modification +of each archived file +to be stored in an extended \fIpax\fR header. +This in particular allows the time of last access +to be restored when the archive is read. +.br +.in -2n +T} +\fBsun\fR T{ +Sun Solaris 7 extended tar format; +T} +\fBgnu\fR T{ +GNU tar format; +T} +\fBbar\fR T{ +SunOS 4 bar format; +T} +\fBzip\fR[\fB:\fIcc\fR] T{ +zip format with optional compression method. +If \fIcc\fR is one of +\fBen\fR (normal, default), +\fBex\fR (extra), +\fBef\fR (fast), +or +\fBes\fR (super fast), +the standard \fIdeflate\fR compression is used. +\fBe0\fR selects no compression, +and +\fBbz2\fR selects \fIbzip2\fR compression. +T} +.TE +.in -6 +.sp +This option is ignored with +.I \-i +unless the +.I \-k +option is also present. +The default for +.I \-o +is binary cpio format. +.TP +\fB\-I\fI\ file\fR +Selects a +.I file +that is read with the +.I \-i +option instead of standard input. +.TP +.B \-k +Try to continue operation on read errors and invalid headers. +If an archive contains another archive, +files from either archive may be chosen. +.TP +.B \-l +Link files instead of copying them with +.I \-p +if possible. +.TP +.B \-L +Follow symbolic links when reading files with +.I \-o +or +.IR \-p . +.TP +.B \-m +Restore modification times of extracted files +to those given in the archive. +.TP +\fB\-M\fI message\fR +The given +.I message +is printed instead of the standard one +with +.I \-I +or +.I \-O +when changing media. +.TP +\fB\-O\fI file\fR +Selects an archive +.I file +that is written instead of standard output +with the +.I \-o +option. +.TP +.B \-P +In copy-out or pass mode, +interpret the data read from standard input +as prototype lines +of colon-separated fields +of the form +.in +3m +.sp +\fItype\fB:\fIuser\fB:\fIgroup\fB:\fImode\fB:\fIatime\fB:\fImtime\fB:\fImajor\fB:\fIminor\fB:\fIpath\fR +.sp +.in -3m +For each non-empty field, +the corresponding attribute of the input file is overridden. +With this option, +an unprivileged user can create +an archive that contains files +with arbitrary attributes. +The meanings of the individual fields are: +.RS +.TP 6 +.PD 0 +.I type +File type, one of: +\fBb\fR (block device), +\fBc\fR (character device), +\fBd\fR (directory), +\fBf\fR (plain file), +\fBp\fR (named pipe), +or +\fBs\fR (symbolic link). +.TP +.I user +The owner of the file, +which can be a numeric user ID or a user name. +.TP +.I group +The group owner of the file, +which can be a numeric group ID or a group name. +.TP +.I mode +The octal mode of the file. +.TP +.I atime +The time the file was last accessed. +Note that most archive formats cannot store this attribute, +in which case it is ignored. +The format is the same as that of the +.I mtime +field. +.TP +.I mtime +The time the file was last modified. +This is either a decimal integer +specifying the seconds past the epoch, +or an ISO\ 8601 date and time field +of the format \fIYYYYMMDD\fBT\fIHHMMSS\fR, +e.g. 20070326T190511, +the latter being relative to the current time zone +and with all digits past the \fBT\fR being optional. +.TP +.I major minor +Major and minor device numbers as with +.IR mknod (1M). +These fields are only allowed for block and character devices. +.TP +.I path +The name of the file to be archived. +If the file is not a symbolic link, +and the specification is otherwise sufficient, +the file needs not exist +at the time the archive is created. +A non-existent regular file will be empty in the archive. +.PD +.RE +.IP +This option is an extension. +.TP +.B \-r +Rename files interactively. +Before a file is extracted from the archive, +its file name is printed on standard error +and the user is prompted to specify a substitute file name. +If the line read from the terminal is empty, +the file is skipped; +if the line consists of a single dot, +the name is retained; +otherwise, +the line forms the new file name. +.TP +\fB\-R\fI user\fR +Set the ownership of extracted files +to the user and group ids of +.I user +instead of those specified in the archive. +Valid only for the super-user. +.TP +.B \-s +Swap bytes within each half word +of input file data. +.TP +.B \-S +Swap half words within each word +of input file data. +.TP +.B \-t +When combined with the +.I \-o +option, +a list of files in the archive is written to standard output; +no files are extracted. +.TP +.B \-u +.I Cpio +will overwrite existing target files +that were modified more recently than the file in the archive +when this option is given. +.TP +.B \-v +Prints the file names of archived or extracted files with +.I \-i +and +.I \-o +and a verbose output format with +.IR \-t . +If given twice +.RB ( \-vv ) +in combination with +.I \-t +when reading a +.I zip +archive, +information about compression level and method is printed. +.TP +.B \-V +Prints a dot for each archived or extracted file. +.TP +.B \-6 +Selects Unix 6th Edition archive format +(only in copy-in mode). +.PP +.ne 37 +Characteristics of archive formats are as follows: +.sp +.TS +allbox; +l r r r l +l1fB r2 n2 r2 c. + T{ +.ad l +maximum user/\%group id +T} T{ +.ad l +maximum file size +T} T{ +.ad l +maximum pathname length +T} T{ +.ad l +bits in dev_t (major/minor) +T} +binary 65535 2 GB\ 256 \ 16 +\-H\ sgi 65535 9 EB\ 256 \ 14/18 +\-H\ odc 262143 8 GB\ 256 \ 18 +\-H\ dec 262143 8 GB\ 256 \ 24/24 +T{ +\-c, \-H\ crc +T} 4.3e9 4 GB\ 1024 \ 32/32 +T{ +\-H\ sco, \-H\ scocrc +T} 4.3e9 9 EB\ 1024 \ 32/32 +T{ +\-H\ cray, \-H\ cray5 +T} 1.8e19 9 EB\ 65535 \ 64 +\-H\ otar 2097151 8 GB\ 99 \ n/a +T{ +\-H\ tar, +\-H\ ustar +T} 2097151 8 GB\ 256 (99) \ 21/21 +\-H\ pax 1.8e19 9 EB\ 65535 \ 21/21 +\-H\ sun 1.8e19 9 EB\ 65535 \ 63/63 +\-H\ gnu 1.8e19 9 EB\ 65535 \ 63/63 +\-H\ bar 2097151 8 GB\ 427 \ 21 +\-H\ zip 4.3e9 9 EB\ 60000 \ 32 +.TE +.sp +.PP +By default, +.B binary +cpio archives are written. +The byte order of such archives +depends on the machine +on which the archive is created. +Unlike some other implementations, +.I cpio +fully supports +archives of either byte order. +.I \-H\ bbs +can be used to create an archive +with the byte order opposed to that of the current machine. +.PP +The +.B sgi +format extends the binary format +to handle larger files and more device bits. +If an archive does not contain any entries +that actually need the extensions, +it is identical to a binary archive. +.I \-H\ sgi +archives are always created in MSB order. +.PP +The +.B odc +format was introduced with System\ III +and standardized with IEEE Std. 1003.1. +All known +.I cpio +implementations since around 1980 can read this format. +.PP +The +.B dec +format extends the +.I odc +format +to support more device bits. +Archives in this format are generally incompatible with +.I odc +archives +and need special implementation support to be read. +.PP +The +.B \-c +format was introduced with System\ V Release\ 4. +Except for the file size, +it imposes no practical limitations +on files archived. +The original SVR4 implementation +stores the contents of hard linked files +only once and with the last archived link. +This +.I cpio +ensures compatibility with SVR4. +With archives created by implementations that employ other methods +for storing hard linked files, +each file is extracted as a single link, +and some of these files may be empty. +Implementations that expect methods other than the original SVR4 one +may extract no data for hard linked files at all. +.PP +The +.B crc +format is essentially the same as the +.I \-c +format +but adds a simple checksum (not a CRC, despite its name) +for the data of regular files. +The checksum requires the implementation to read each file twice, +which can considerably increase running time and system overhead. +As not all implementations claiming to support this format +handle the checksum correctly, +it is of limited use. +.PP +The +.B sco +and +.B scocrc +formats are variants of the +.I \-c +and +.I \-H\ crc +formats, respectively, +with extensions to support larger files. +The extensions result in a different archive format +only if files larger than slightly below 2\ GB occur. +.PP +The +.B cray +format extends all header fields to 64 bits. +It thus imposes no practical limitations of any kind +on archived files, +but requires special implementation support +to be read. +Although it is originally a binary format, +the byte order is always MSB as on Cray machines. +The +.B cray5 +format is an older variant +that was used with UNICOS 5 and earlier. +.PP +The +.B otar +format was introduced with the Unix 7th Edition +.I tar +utility. +Archives in this format +can be read on all Unix systems since about 1980. +It can only hold regular files +(and, on more recent systems, symbolic links). +For file names that contain characters with the most significant bit set +(non-ASCII characters), +implementations differ in the interpretation of the header checksum. +.PP +The +.B ustar +format was introduced with IEEE Std. 1003.1. +It extends the old +.I tar +format +with support for directories, device files, +and longer file names. +Pathnames of single-linked files can consist of up to 256 characters, +dependent on the position of slashes. +Files with multiple links can only be archived +if the first link encountered is no longer than 100 characters. +Due to implementation errors, +file names longer than 99 characters +can not considered to be generally portable. +Another addition of the +.I ustar +format +are fields for the symbolic user and group IDs. +These fields are created by +.IR cpio , +but ignored when reading such archives. +.PP +With +.BR "\-H tar" , +a variant of the +.I ustar +format is selected +which stores file type bits in the mode field +to work around common implementation problems. +These bits are ignored by +.I cpio +when reading archives. +.PP +The +.B pax +format is an extension to the +.I ustar +format. +If attributes cannot be archived with +.IR ustar , +an extended header is written. +Unless the size of an entry is greater than 8\ GB, +a +.I pax +archive should be readable by any implementation +capable of reading +.I ustar +archives, +although files may be extracted under wrong names +and extended headers may be extracted as separate files. +If a file name contains non-UTF-8 characters, +it may not be archived or extracted correctly +because of a problem of the +.I pax +format specification. +.PP +The +.B sun +format extends the +.I ustar +format similar as the +.I pax +format does. +The extended headers in +.I sun +format archives are not understood +by implementations that support only the +.I pax +format and vice-versa. +The +.I sun +format has also problems with non-UTF-8 characters in file names. +.PP +The +.B GNU +.I tar +format is mostly compatible with the other +.I tar +formats, +unless an archive entry actually uses its extended features. +There are no practical limitations on files archived with this format. +The implementation of +.I cpio +is limited to expanded numerical fields +and long file names; +in particular, +there is no support for sparse files or incremental backups. +If +.I cpio +creates a multi-volume +.I GNU +archive, +it just splits a single-volume archive in multiple parts, +as with the other formats; +.I GNU +multi-volume archives are not supported. +.PP +The +.B bar +format is similar to the +.I tar +format, but can store longer file names. +It requires special implementation support to be read. +.PP +The +.B zip +format can be read in many non-Unix environments. +There are several restrictions on archives +intended for data exchange: +only regular files should be stored; +file times, permissions and ownerships +might be ignored by other implementations; +there should be no more than 65536 files in the archive; +the total archive size should not exceed 2 GB; +only +.I deflate +compression should be used. +Otherwise, +.I cpio +stores all information available with other archive formats +in extended +.I zip +file headers, +so if archive portability is of no concern, +the +.I zip +implementation in +.I cpio +can archive complete Unix file hierarchies. +.I Cpio +supports the +.I zip64 +format extension for large files; +it automatically writes +.I zip64 +entries if necessary. +.I Cpio +can extract all known +.I zip +format compression codes. +It does not support +.I zip +encryption. +Multi-volume +.I zip +archives are created as splitted single-volume archives, +as with the other formats written by +.IR cpio ; +generic multi-volume +.I zip +archives are not supported. +.SH EXAMPLES +Extract all files named +.I Makefile +or +.I makefile +from the archive stored on +.IR /dev/rmt/c0s0 , +overwriting recent files: +.RS 2 +.sp +cpio \-idmu \-I /dev/rmt/c0s0 \'[Mm]akefile\' \'*/[Mm]akefile\' +.RE +.PP +List the files contained in a software distribution archive: +.RS 2 +.sp +cpio \-itv \-I distribution.tar.gz +.RE +.PP +Write a +.IR gzip (1) +compressed +.I ustar +archive containing all files below the directory +.I \%project +to the file +.IR \%project.tar.gz , +excluding all directories named +.I CVS +or +.I SCCS +and their contents: +.RS 2 +.sp +find project \-depth \-print | egrep \-v \'/(CVS|SCCS)(/|$)\' | +.br + cpio \-o \-H ustar | gzip \-c > project.tar.gz +.RE +.PP +Copy the directory +.I work +and its contents +to the directory +.IR \%savedfiles : +.RS 2 +.sp +find work \-depth \-print | cpio \-pdm savedfiles +.RE +.PP +Self-extracting zip archives are not automatically recognized, +but can normally be read using the +.I \-k +option, as with +.RS 2 +.sp +cpio \-itvk \-H zip \-I archive.exe +.sp +.RE +.SH "ENVIRONMENT VARIABLES" +.TP +.BR LANG ", " LC_ALL +See +.IR locale (7). +.TP +.B LC_CTYPE +Selects the mapping of bytes to characters +used for matching patterns. +.TP +.B LC_TIME +Sets the month names printed with +.IR \-tv . +.TP +.B SYSV3 +If this variable is set, +the +.I \-c +option has the same effect as \fI\-H odc\fR; +\fB\-H newc\fR can be used +to select SVR4 ASCII format. +The output format of +.I \-tv +is changed, as well as the text of diagnostic messages. +.SH "SEE ALSO" +find(1), +pax(1), +tar(1) +.SH DIAGNOSTICS +.I Cpio +exits with +.sp +.TS +l8fB l. +0 after successful operation; +1 on usage errors; +2 when operation was continued after minor errors; +3 on fatal error conditions. +.TE +.SH NOTES +Device and inode numbers +are used for hard link recognition +with the various cpio formats. +Since the header space cannot hold +large numbers present in current file systems, +devices and inode numbers are set on a per-archive basis. +This enables hard link recognition with all cpio formats, +but the link connection to files appended with +.I \-A +is not preserved. +.PP +If a numeric user or group id does not fit +within the size of the header field in the selected format, +files are stored with the user id (or group id, respectively) +set to 60001. +.PP +Use of the +.I \-A +option with a +.I zip +format archive may cause data loss +if the archive was not previously created by +.I cpio +itself. +.PP +.I Cpio +cannot store file names that contain newline characters; +see the +.I NOTES +section of +.IR find (1) +for more information. +.PP +If the file names passed to +.I "cpio \-o" +begin with a slash character, +absolute path names are stored in the archive +and will be extracted to these path names later +regardless of the current working directory. +This is normally not advisable, +and relative path names should be passed to +.I cpio +only. diff --git a/package/heirloom-cpio/src/cpio.c b/package/heirloom-cpio/src/cpio.c new file mode 100644 index 000000000..e5090e4c9 --- /dev/null +++ b/package/heirloom-cpio/src/cpio.c @@ -0,0 +1,7172 @@ +/* + * cpio - copy file archives in and out + * + * Gunnar Ritter, Freiburg i. Br., Germany, April 2003. + */ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +/* + * Sccsid @(#)cpio.c 1.304 (gritter) 2/14/09 + */ + +#include <sys/types.h> +#include <sys/stat.h> +#ifdef __linux__ +#if !defined (__UCLIBC__) && !defined (__dietlibc__) +#include <linux/fs.h> +#endif /* !__UCLIBC__, !__dietlibc__ */ +#include <linux/fd.h> +#undef WNOHANG +#undef WUNTRACED +#undef P_ALL +#undef P_PID +#undef P_PGID +#ifdef __dietlibc__ +#undef NR_OPEN +#undef PATH_MAX +#endif /* __dietlibc__ */ +#endif /* __linux__ */ +#include <sys/wait.h> +#include <fcntl.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <signal.h> +#include "sigset.h" +#include <time.h> +#include <utime.h> +#include <pwd.h> +#include <grp.h> +#include <limits.h> +#include <stdio.h> +#include <libgen.h> +#include <errno.h> +#include <inttypes.h> +#include <stdarg.h> +#include <locale.h> +#include <ctype.h> +#include "memalign.h" + +int sysv3; + +#if USE_ZLIB +#include <zlib.h> +#endif /* USE_ZLIB */ + +#if USE_BZLIB +#include <bzlib.h> +#endif /* USE_BZLIB */ + +#include <sys/ioctl.h> + +#if defined (__linux__) || defined (__sun) || defined (__FreeBSD__) || \ + defined (__hpux) || defined (_AIX) || defined (__NetBSD__) || \ + defined (__OpenBSD__) || defined (__DragonFly__) || \ + defined (__CYGWIN__) +#include <sys/mtio.h> +#endif + +#include <iblok.h> +#include <sfile.h> +#include <atoll.h> + +#ifdef _AIX +#include <sys/sysmacros.h> +#endif /* _AIX */ + +#ifndef major +#include <sys/mkdev.h> +#endif /* !major */ + +#include "cpio.h" +#include "blast.h" + +#ifdef __GLIBC__ +#ifdef _IO_putc_unlocked +#undef putc +#define putc(c, f) _IO_putc_unlocked(c, f) +#undef putchar +#define putchar(c) _IO_putc_unlocked(c, stdout) +#endif /* _IO_putc_unlocked */ +#endif /* __GLIBC__ */ + +/* + * The cpio code assumes that all following S_IFMT bits are the same as + * those of the mode fields in cpio headers. The only real Unix system + * known to deviate from this de facto standard is UNICOS which uses + * 0130000 for S_IFLNK. But this software does not run on UNICOS for + * a variety of other reasons anyway, so this should not be of much + * concern. + */ +#if S_IFIFO != 0010000 || \ + S_IFCHR != 0020000 || \ + S_IFDIR != 0040000 || \ + S_IFBLK != 0060000 || \ + S_IFREG != 0100000 || \ + S_IFLNK != 0120000 || \ + S_IFSOCK!= 0140000 || \ + S_IFMT != 0170000 +#error non-standard S_IFMT bits +#endif + +/* + * File types that are not present on all systems but that we want to + * recognize nevertheless. + */ +#ifndef S_IFDOOR +#define S_IFDOOR 0150000 /* Solaris door */ +#endif +#ifndef S_IFNAM +#define S_IFNAM 0050000 /* XENIX special named file */ +#endif +#ifndef S_INSEM +#define S_INSEM 0x1 /* XENIX semaphore subtype of IFNAM */ +#endif +#ifndef S_INSHD +#define S_INSHD 0x2 /* XENIX shared data subtype of IFNAM */ +#endif +#ifndef S_IFNWK +#define S_IFNWK 0110000 /* HP-UX network special file */ +#endif + +#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || \ + defined (__DragonFly__) || defined (__APPLE__) +/* + * For whatever reason, FreeBSD casts the return values of major() and + * minor() to signed values so that normal limit comparisons will fail. + */ +static unsigned long +mymajor(long dev) +{ + return major(dev) & 0xFFFFFFFFUL; +} +#undef major +#define major(a) mymajor(a) +static unsigned long +myminor(long dev) +{ + return minor(dev) & 0xFFFFFFFFUL; +} +#undef minor +#define minor(a) myminor(a) +#endif /* __FreeBSD__, __NetBSD__, __OpenBSD__, __DragonFly__, __APPLE__ */ + +/* + * Device and inode counts in cpio formats are too small to store the + * information used to detect hard links on today's systems. Keep track + * of all devices and inodes and store fake counts in the archive. + */ +struct ilink { + struct ilink *l_nxt; /* next link to same i-node */ + char *l_nam; /* link name */ + size_t l_siz; /* link name size */ +}; + +struct islot { + struct islot *i_lln; /* left link */ + struct islot *i_rln; /* right link */ + struct ilink *i_lnk; /* links list */ + struct stat *i_st; /* stat information */ + char *i_name;/* name of first link encountered */ + ino_t i_ino; /* real inode number */ + uint32_t i_fino; /* fake inode number */ + nlink_t i_nlk; /* number of remaining links */ +}; + +struct dslot { + struct dslot *d_nxt; /* next device */ + struct islot *d_isl; /* inode slots */ + uint32_t d_cnt; /* used inode number count */ + uint32_t d_fake; /* faked device id */ + dev_t d_dev; /* real device id */ +}; + +union types2 { + uint8_t byte[2]; + uint16_t sword; +}; + +union types4 { + uint8_t byte[4]; + uint16_t sword[2]; + uint32_t lword; +}; + +/* + * Store and retrieve integers in a defined endian order. + */ +static uint16_t +ple16(const char *cp) +{ + return (uint16_t)(cp[0]&0377) + + ((uint16_t)(cp[1]&0377) << 8); +} + +static uint16_t +pbe16(const char *cp) +{ + return (uint16_t)(cp[1]&0377) + + ((uint16_t)(cp[0]&0377) << 8); +} + +static uint32_t +ple32(const char *cp) +{ + return (uint32_t)(cp[0]&0377) + + ((uint32_t)(cp[1]&0377) << 8) + + ((uint32_t)(cp[2]&0377) << 16) + + ((uint32_t)(cp[3]&0377) << 24); +} + +static uint32_t +pbe32(const char *cp) +{ + return (uint32_t)(cp[3]&0377) + + ((uint32_t)(cp[2]&0377) << 8) + + ((uint32_t)(cp[1]&0377) << 16) + + ((uint32_t)(cp[0]&0377) << 24); +} + +static uint32_t +pme32(const char *cp) +{ + return (uint32_t)(cp[2]&0377) + + ((uint32_t)(cp[3]&0377) << 8) + + ((uint32_t)(cp[0]&0377) << 16) + + ((uint32_t)(cp[1]&0377) << 24); +} + +static uint64_t +ple64(const char *cp) +{ + return (uint64_t)(cp[0]&0377) + + ((uint64_t)(cp[1]&0377) << 8) + + ((uint64_t)(cp[2]&0377) << 16) + + ((uint64_t)(cp[3]&0377) << 24) + + ((uint64_t)(cp[4]&0377) << 32) + + ((uint64_t)(cp[5]&0377) << 40) + + ((uint64_t)(cp[6]&0377) << 48) + + ((uint64_t)(cp[7]&0377) << 56); +} + +static uint64_t +pbe64(const char *cp) +{ + return (uint64_t)(cp[7]&0377) + + ((uint64_t)(cp[6]&0377) << 8) + + ((uint64_t)(cp[5]&0377) << 16) + + ((uint64_t)(cp[4]&0377) << 24) + + ((uint64_t)(cp[3]&0377) << 32) + + ((uint64_t)(cp[2]&0377) << 40) + + ((uint64_t)(cp[1]&0377) << 48) + + ((uint64_t)(cp[0]&0377) << 56); +} + +static void +le16p(uint16_t n, char *cp) +{ + cp[0] = (n&0x00ff); + cp[1] = (n&0xff00) >> 8; +} + +static void +be16p(uint16_t n, char *cp) +{ + cp[1] = (n&0x00ff); + cp[0] = (n&0xff00) >> 8; +} + +static void +le32p(uint32_t n, char *cp) +{ + cp[0] = (n&0x000000ff); + cp[1] = (n&0x0000ff00) >> 8; + cp[2] = (n&0x00ff0000) >> 16; + cp[3] = (n&0xff000000) >> 24; +} + +static void +be32p(uint32_t n, char *cp) +{ + cp[3] = (n&0x000000ff); + cp[2] = (n&0x0000ff00) >> 8; + cp[1] = (n&0x00ff0000) >> 16; + cp[0] = (n&0xff000000) >> 24; +} + +static void +me32p(uint32_t n, char *cp) +{ + cp[2] = (n&0x000000ff); + cp[3] = (n&0x0000ff00) >> 8; + cp[0] = (n&0x00ff0000) >> 16; + cp[1] = (n&0xff000000) >> 24; +} + +static void +le64p(uint64_t n, char *cp) +{ + cp[0] = (n&0x00000000000000ffLL); + cp[1] = (n&0x000000000000ff00LL) >> 8; + cp[2] = (n&0x0000000000ff0000LL) >> 16; + cp[3] = (n&0x00000000ff000000LL) >> 24; + cp[4] = (n&0x000000ff00000000LL) >> 32; + cp[5] = (n&0x0000ff0000000000LL) >> 40; + cp[6] = (n&0x00ff000000000000LL) >> 48; + cp[7] = (n&0xff00000000000000LL) >> 56; +} + +static void +be64p(uint64_t n, char *cp) +{ + cp[7] = (n&0x00000000000000ffLL); + cp[6] = (n&0x000000000000ff00LL) >> 8; + cp[5] = (n&0x0000000000ff0000LL) >> 16; + cp[4] = (n&0x00000000ff000000LL) >> 24; + cp[3] = (n&0x000000ff00000000LL) >> 32; + cp[2] = (n&0x0000ff0000000000LL) >> 40; + cp[1] = (n&0x00ff000000000000LL) >> 48; + cp[0] = (n&0xff00000000000000LL) >> 56; +} + +#define TNAMSIZ 100 +#define TPFXSIZ 155 +#define TMAGSIZ 6 +#define TTIMSIZ 12 + +/* + * Structure of an archive header. + */ +union bincpio { + char data[4096]; +#define SIZEOF_hdr_cpio 26 + struct hdr_cpio { + char c_magic[2]; + char c_dev[2]; + char c_ino[2]; + char c_mode[2]; + char c_uid[2]; + char c_gid[2]; + char c_nlink[2]; + char c_rdev[2]; + char c_mtime[4]; + char c_namesize[2]; + char c_filesize[4]; + } Hdr; +#define SIZEOF_cray_hdr 152 + struct cray_hdr { /* with thanks to Cray-Cyber.org */ + char C_magic[8]; + char C_dev[8]; + char C_ino[8]; + char C_mode[8]; + char C_uid[8]; + char C_gid[8]; + char C_nlink[8]; + char C_rdev[8]; + /* + * The C_param field was introduced with + * UNICOS 6 and is simply not present in + * the earlier format. Following fields + * are the same for both revisions again. + */ +#define CRAY_PARAMSZ (8*8) + char C_param[CRAY_PARAMSZ]; + char C_mtime[8]; + char C_namesize[8]; + char C_filesize[8]; + } Crayhdr; +#define SIZEOF_c_hdr 76 + struct c_hdr { + char c_magic[6]; + char c_dev[6]; + char c_ino[6]; + char c_mode[6]; + char c_uid[6]; + char c_gid[6]; + char c_nlink[6]; + char c_rdev[6]; + char c_mtime[11]; + char c_namesz[6]; + char c_filesz[11]; + } Cdr; +#define SIZEOF_d_hdr 86 + struct d_hdr { + char d_magic[6]; + char d_dev[6]; + char d_ino[6]; + char d_mode[6]; + char d_uid[6]; + char d_gid[6]; + char d_nlink[6]; + char d_rmaj[8]; + char d_rmin[8]; + char d_mtime[11]; + char d_namesz[6]; + char d_filesz[11]; + } Ddr; +#define SIZEOF_Exp_cpio_hdr 110 + struct Exp_cpio_hdr { + char E_magic[6]; + char E_ino[8]; + char E_mode[8]; + char E_uid[8]; + char E_gid[8]; + char E_nlink[8]; + char E_mtime[8]; + char E_filesize[8]; + char E_maj[8]; + char E_min[8]; + char E_rmaj[8]; + char E_rmin[8]; + char E_namesize[8]; + char E_chksum[8]; + } Edr; + struct tar_header { + char t_name[TNAMSIZ]; + char t_mode[8]; + char t_uid[8]; + char t_gid[8]; + char t_size[12]; + char t_mtime[TTIMSIZ]; + char t_chksum[8]; + char t_linkflag; + char t_linkname[TNAMSIZ]; + char t_magic[TMAGSIZ]; + char t_version[2]; + char t_uname[32]; + char t_gname[32]; + char t_devmajor[8]; + char t_devminor[8]; + char t_prefix[TPFXSIZ]; + } Tdr; +#define SIZEOF_bar_header 84 + struct bar_header { + char b_mode[8]; + char b_uid[8]; + char b_gid[8]; + char b_size[12]; + char b_mtime[12]; + char b_chksum[8]; + char b_rdev[8]; + char b_linkflag; + char b_bar_magic[2]; + char b_volume_num[4]; + char b_compressed; + char b_date[12]; + } Bdr; +#define SIZEOF_zip_header 30 + struct zip_header { + char z_signature[4]; + char z_version[2]; + char z_gflag[2]; + char z_cmethod[2]; + char z_modtime[2]; + char z_moddate[2]; + char z_crc32[4]; + char z_csize[4]; + char z_nsize[4]; + char z_namelen[2]; + char z_extralen[2]; + } Zdr; +}; + +#define BCUT 0177777 +#define OCUT 0777777 +#define ECUT 0xFFFFFFFFUL + +static const char trailer[] = "TRAILER!!!"; + +/* + * Structure of per-file extra data for zip format. + */ +union zextra { + char data[1]; +#define SIZEOF_zextra_gn 4 + struct zextra_gn { + char ze_gn_tag[2]; + char ze_gn_tsize[2]; + } Ze_gn; +#define SIZEOF_zextra_64 32 /* regular size */ +#define SIZEOF_zextra_64_a 28 /* size without startn field */ +#define SIZEOF_zextra_64_b 20 /* size without reloff field */ + struct zextra_64 { + char ze_64_tag[2]; + char ze_64_tsize[2]; + char ze_64_nsize[8]; + char ze_64_csize[8]; + char ze_64_reloff[8]; + char ze_64_startn[4]; + } Ze_64; +#define SIZEOF_zextra_pk 16 + struct zextra_pk { + char ze_pk_tag[2]; + char ze_pk_tsize[2]; + char ze_pk_atime[4]; + char ze_pk_mtime[4]; + char ze_pk_uid[2]; + char ze_pk_gid[2]; + } Ze_pk; +#define SIZEOF_zextra_ek 17 + struct zextra_et { + char ze_et_tag[2]; + char ze_et_tsize[2]; + char ze_et_flags[1]; + char ze_et_mtime[4]; + char ze_et_atime[4]; + char ze_et_ctime[4]; + } Ze_et; +#define SIZEOF_zextra_i1 16 + struct zextra_i1 { + char ze_i1_tag[2]; + char ze_i1_tsize[2]; + char ze_i1_atime[4]; + char ze_i1_mtime[4]; + char ze_i1_uid[2]; + char ze_i1_gid[2]; + } Ze_i1; +#define SIZEOF_zextra_i2 8 + struct zextra_i2 { + char ze_i2_tag[2]; + char ze_i2_tsize[2]; + char ze_i2_uid[2]; + char ze_i2_gid[2]; + } Ze_i2; +#define SIZEOF_zextra_as 16 + struct zextra_as { + char ze_as_tag[2]; + char ze_as_tsize[2]; + char ze_as_crc[4]; + char ze_as_mode[2]; + char ze_as_sizdev[4]; + char ze_as_uid[2]; + char ze_as_gid[2]; + } Ze_as; +#define SIZEOF_zextra_cp 40 + struct zextra_cp { + char ze_cp_tag[2]; + char ze_cp_tsize[2]; + char ze_cp_dev[4]; + char ze_cp_ino[4]; + char ze_cp_mode[4]; + char ze_cp_uid[4]; + char ze_cp_gid[4]; + char ze_cp_nlink[4]; + char ze_cp_rdev[4]; + char ze_cp_mtime[4]; + char ze_cp_atime[4]; + } Ze_cp; +}; + +static struct zipstuff { /* stuff for central directory at EOF */ + struct zipstuff *zs_next; + char *zs_name; /* file name */ + long long zs_size; /* file size */ + long long zs_relative; /* offset of local header */ + long long zs_csize; /* compressed size */ + uint32_t zs_crc32; /* CRC */ + time_t zs_mtime; /* modification time */ + enum cmethod zs_cmethod; /* compression method */ + int zs_gflag; /* general flag */ + mode_t zs_mode; /* file mode */ +} *zipbulk; + +/* + * Structure of the central zip directory at the end of the file. This + * (obligatory) part of a zip file is written by this implementation, + * but is completely ignored on copy-in. This means that we miss the + * mode_t stored in zc_extralen if zc_versionmade[1] is 3 (Unix). We + * have to do this since it contains the S_IFMT bits, thus telling us + * whether something is a symbolic link and resulting in different + * behavior - but as the input had to be seekable in order to do this, + * we had to store entire archives in temporary files if input came + * from a pipe to be consistent. + */ +#define SIZEOF_zipcentral 46 +struct zipcentral { + char zc_signature[4]; + char zc_versionmade[2]; + char zc_versionextr[2]; + char zc_gflag[2]; + char zc_cmethod[2]; + char zc_modtime[2]; + char zc_moddate[2]; + char zc_crc32[4]; + char zc_csize[4]; + char zc_nsize[4]; + char zc_namelen[2]; + char zc_extralen[2]; + char zc_commentlen[2]; + char zc_disknstart[2]; + char zc_internal[2]; + char zc_external[4]; + char zc_relative[4]; +}; + +#define SIZEOF_zip64end 56 +struct zip64end { + char z6_signature[4]; + char z6_recsize[8]; + char z6_versionmade[2]; + char z6_versionextr[2]; + char z6_thisdiskn[4]; + char z6_alldiskn[4]; + char z6_thisentries[8]; + char z6_allentries[8]; + char z6_dirsize[8]; + char z6_startsize[8]; +}; + +#define SIZEOF_zip64loc 20 +struct zip64loc { + char z4_signature[4]; + char z4_startno[4]; + char z4_reloff[8]; + char z4_alldiskn[4]; +}; + +#define SIZEOF_zipend 22 +struct zipend { + char ze_signature[4]; + char ze_thisdiskn[2]; + char ze_alldiskn[2]; + char ze_thisentries[2]; + char ze_allentries[2]; + char ze_dirsize[4]; + char ze_startsize[4]; + char ze_commentlen[2]; +}; + +#define SIZEOF_zipddesc 16 +struct zipddesc { + char zd_signature[4]; + char zd_crc32[4]; + char zd_csize[4]; + char zd_nsize[4]; +}; + +#define SIZEOF_zipddesc64 24 +struct zipddesc64 { + char zd_signature[4]; + char zd_crc32[4]; + char zd_csize[8]; + char zd_nsize[8]; +}; + +/* + * Magic numbers and strings. + */ +static const uint16_t mag_bin = 070707; +/*static const uint16_t mag_bbs = 0143561;*/ +static const char mag_asc[6] = "070701"; +static const char mag_crc[6] = "070702"; +static const char mag_odc[6] = "070707"; +static const long mag_sco = 0x7ffffe00; + +static const char mag_ustar[6] = "ustar\0"; +static const char mag_gnutar[8] = "ustar \0"; +static const char mag_bar[2] = "V\0"; + +static const char mag_zipctr[4] = "PK\1\2"; +static const char mag_zipsig[4] = "PK\3\4"; +static const char mag_zipend[4] = "PK\5\6"; +static const char mag_zip64e[4] = "PK\6\6"; +static const char mag_zip64l[4] = "PK\6\7"; +static const char mag_zipdds[4] = "PK\7\10"; +#define mag_zip64f 0x0001 +#define mag_zipcpio 0x0707 + +/* + * Fields for the extended pax header. + */ +static enum paxrec { + PR_NONE = 0000, + PR_ATIME = 0001, + PR_GID = 0002, + PR_LINKPATH = 0004, + PR_MTIME = 0010, + PR_PATH = 0020, + PR_SIZE = 0040, + PR_UID = 0100, + PR_SUN_DEVMAJOR = 0200, + PR_SUN_DEVMINOR = 0400 +} paxrec, globrec; + +/* + * Prototype structure, collecting user-defined information + * about a file. + */ +struct prototype { + mode_t pt_mode; /* type and permission bits */ + uid_t pt_uid; /* owner */ + gid_t pt_gid; /* group owner */ + time_t pt_atime; /* time of last access */ + time_t pt_mtime; /* time of last modification */ + dev_t pt_rdev; /* device major/minor */ + enum { + PT_NONE = 0000, + PT_TYPE = 0001, + PT_OWNER = 0002, + PT_GROUP = 0004, + PT_MODE = 0010, + PT_ATIME = 0020, + PT_MTIME = 0040, + PT_RDEV = 0100 + } pt_spec; /* specified information */ +}; + +static struct stat globst; + +/* + * This sets a sanity check limit on path names. If a longer path name + * occurs in an archive, it is treated as corrupt. This is because no + * known Unix system can handle path names of arbitrary length; limits + * are typically between 1024 and 4096. Trying to extract longer path + * names would fail anyway and will cpio eventually fail to allocate + * memory. + */ +#define SANELIMIT 0177777 + +char *progname; /* argv[0] to main() */ +static struct dslot *devices; /* devices table */ +static struct dslot *markeddevs; /* unusable device numbers */ +static char *blkbuf; /* block buffer */ +int blksiz; /* block buffer size */ +static int blktop; /* top of filled part of buffer */ +static int curpos; /* position in blkbuf */ +static uint32_t fakedev; /* fake device for single link inodes */ +static uint32_t fakeino; /* fake inode for single link inodes */ +static uint32_t harddev; /* fake device used for hard links */ +static unsigned long long maxsize;/* maximum size for format */ +static unsigned long long maxrdev;/* maximum st_rdev for format */ +static unsigned long long maxmajor;/* maximum major(st_rdev) for format */ +static unsigned long long maxminor;/* maximum minor(st_rdev) for format */ +static unsigned long long maxuid; /* maximum user id for format */ +static unsigned long long maxgid; /* maximum group id for format */ +static unsigned long long maxnlink;/* maximum link count for format */ +static int mt; /* magtape file descriptor */ +static int mfl; /* magtape flags */ +static struct stat mtst; /* fstat() on mt */ +int aflag; /* reset access times */ +int Aflag; /* append to archive */ +int bflag; /* swap bytes */ +int Bflag; /* 5120 blocking */ +int cflag; /* ascii format */ +int Cflag; /* user-defined blocking */ +int dflag; /* create directories */ +int Dflag; /* do not ask for next device */ +int eflag; /* DEC format */ +int cray_eflag; /* do not archive if values too large */ +const char *Eflag; /* filename for files to be extracted */ +int fflag; /* pattern excludes */ +int Hflag; /* header format */ +const char *Iflag; /* input archive name */ +int kflag; /* skipt corrupted parts */ +int Kflag; /* IRIX-style large file support */ +int lflag; /* link of possible */ +int Lflag; /* follow symbolic links */ +int mflag; /* retain modification times */ +const char *Mflag; /* message when switching media */ +const char *Oflag; /* output archive name */ +int Pflag; /* prototype file list */ +int rflag; /* rename files */ +const char *Rflag; /* reassign ownerships */ +static uid_t Ruid; /* uid to assign */ +static gid_t Rgid; /* gid to assign */ +int sflag; /* swap half word bytes */ +int Sflag; /* swap word bytes */ +int tflag; /* print toc */ +int uflag; /* overwrite files unconditionally */ +int hp_Uflag; /* use umask when creating files */ +int vflag; /* verbose */ +int Vflag; /* special verbose */ +int sixflag; /* 6th Edition archives */ +int action; /* -i -o -p */ +long long errcnt; /* error status */ +static unsigned long long maxpath;/* maximum path length with -i */ +static uint32_t maxino; /* maximum inode number with -i */ +static uid_t myuid; /* user id of caller */ +static gid_t mygid; /* group id of caller */ +static long long blocks; /* copying statistics: full blocks */ +static long long bytes; /* copying statistics: partial blocks */ +static long long nwritten; /* bytes written to archive */ +static off_t aoffs; /* offset in archive */ +static off_t poffs; /* physical offset in archive */ +static int tapeblock = -1; /* physical tape block size */ +struct glist *patterns; /* patterns for -i */ +static int tty; /* terminal file descriptor */ +static const char *cur_ofile; /* current original file */ +static const char *cur_tfile; /* current temporary file */ +static mode_t umsk; /* user's umask */ +static int zipclevel; /* zip compression level */ +static struct islot *inull; /* splay tree null element */ +int printsev; /* print message severity strings */ +static int compressed_bar; /* this is a compressed bar archive */ +static int formatforced; /* -k -i -Hfmt forces a format */ +static long long lineno; /* input line number */ + +int pax_dflag; /* directory matches only itself */ +int pax_kflag; /* do not overwrite files */ +int pax_nflag; /* select first archive member only */ +int pax_sflag; /* substitute file names */ +int pax_uflag; /* add only recent files to archive */ +int pax_Xflag; /* do not cross device boundaries */ +static enum { + PO_NONE = 0, + PO_LINKDATA = 01, /* include link data in type 2 */ + PO_TIMES = 02, /* create atime and mtime fields */ +} pax_oflag; /* recognized -o options */ + +static void copyout(int (*)(const char *, struct stat *)); +static size_t ofiles_cpio(char **, size_t *); +static void dooutp(void); +static int outfile(const char *, struct stat *); +static int addfile(const char *, struct stat *, uint32_t, uint32_t, int, + const char *); +static void iflush(struct islot *, uint32_t); +static void lflush(void); +static int bigendian(void); +static void getbuf(char **, size_t *, size_t); +static void prdot(int); +static void newmedia(int); +static void mclose(void); +static ssize_t mwrite(int); +static void bwrite(const char *, size_t); +static void bflush(void); +static int sum(int, const char *, struct stat *, char *); +static int rstime(const char *, struct stat *, const char *); +static struct islot *isplay(ino_t, struct islot *); +static struct islot *ifind(ino_t, struct islot **); +static void iput(struct islot *, struct islot **); +static struct dslot *dfind(struct dslot **, dev_t); +static void done(int); +static void dopass(const char *); +static int passdata(struct file *, const char *, int); +static int passfile(const char *, struct stat *); +static int filein(struct file *, int (*)(struct file *, const char *, int), + char *); +static int linkunlink(const char *, const char *); +static void tunlink(char **); +static int filet(struct file *, int (*)(struct file *, const char *, int)); +static void filev(struct file *); +static int typec(struct stat *); +static void permbits(mode_t); +static void prtime_cpio(time_t); +static void getpath(const char *, char **, char **, size_t *, size_t *); +static void setpath(const char *, char **, char **, + size_t, size_t *, size_t *); +static int imdir(char *); +static int setattr(const char *, struct stat *); +static int setowner(const char *, struct stat *); +static int canlink(const char *, struct stat *, int); +static void doinp(void); +static void storelink(struct file *); +static void flushlinks(struct file *); +static void flushnode(struct islot *, struct file *); +static void flushrest(int); +static void flushtree(struct islot *, int); +static int inpone(struct file *, int); +static int readhdr(struct file *, union bincpio *); +static void whathdr(void); +static int infile(struct file *); +static int skipfile(struct file *); +static int skipdata(struct file *f, + int (*)(struct file *, const char *, int)); +static int indata(struct file *, const char *, int); +static int totrailer(void); +static long long rdoct(const char *, int); +static long long rdhex(const char *, int); +static ssize_t mread(void); +static void mstat(void); +static int skippad(unsigned long long, int); +static int allzero(const char *, int); +static const char *getuser(uid_t); +static const char *getgroup(gid_t); +static struct glist *want(struct file *, struct glist **); +static void patfile(void); +static int ckodd(long long, int, const char *, const char *); +static int rname(char **, size_t *); +static int redirect(const char *, const char *); +static char *tnameof(struct tar_header *, char *); +static int tmkname(struct tar_header *, const char *); +static void tlinkof(struct tar_header *, struct file *); +static int tmklink(struct tar_header *, const char *); +static int tlflag(struct stat *); +static void tchksum(union bincpio *); +static int tcssum(union bincpio *, int); +static int trdsum(union bincpio *); +static mode_t tifmt(int); +static void bchksum(union bincpio *); +static int bcssum(union bincpio *); +static void blinkof(const char *, struct file *, int); +static void dump_barhdr(void); +static int zcreat(const char *, mode_t); +static int zclose(int); +static void markdev(dev_t); +static int marked(dev_t); +static void cantsup(int, const char *); +static void onint(int); +static int zipread(struct file *, const char *, int, int); +static void zipreaddesc(struct file *); +static int cantunzip(struct file *, const char *); +static time_t gdostime(const char *, const char *); +static void mkdostime(time_t, char *, char *); +static ssize_t ziprxtra(struct file *, struct zip_header *); +static void ziptrailer(void); +static void zipdefer(const char *, struct stat *, long long, + uint32_t, long long, const struct zip_header *); +static int zipwrite(int, const char *, struct stat *, + union bincpio *, size_t, uint32_t, uint32_t, + uint32_t *, long long *); +static int zipwtemp(int, const char *, struct stat *, + union bincpio *, size_t, uint32_t, uint32_t, + uint32_t *, long long *); +#if USE_ZLIB +static int zipwdesc(int, const char *, struct stat *, + union bincpio *, size_t, uint32_t, uint32_t, + uint32_t *, long long *); +#endif /* USE_ZLIB */ +static int zipwxtra(const char *, struct stat *, uint32_t, uint32_t); +static void zipinfo(struct file *); +static void readK2hdr(struct file *); +static int readgnuname(char **, size_t *, long); +static void writegnuname(const char *, long, int); +static void tgetpax(struct tar_header *, struct file *); +static enum paxrec tgetrec(char **, char **, char **); +static void wrpax(const char *, const char *, struct stat *); +static void addrec(char **, long *, long *, + const char *, const char *, long long); +static void paxnam(struct tar_header *, const char *); +static char *sequence(void); +static char *joinpath(const char *, char *); +static int utf8(const char *); +static char *getproto(char *, struct prototype *); + +size_t (*ofiles)(char **, size_t *) = ofiles_cpio; +void (*prtime)(time_t) = prtime_cpio; + +int +main(int argc, char **argv) +{ + myuid = getuid(); + mygid = getgid(); + umask(umsk = umask(0)); + progname = basename(argv[0]); + setlocale(LC_CTYPE, ""); + setlocale(LC_TIME, ""); + inull = scalloc(1, sizeof *inull); + inull->i_lln = inull->i_rln = inull; + flags(argc, argv); + switch (action) { + case 'i': + if (sigset(SIGINT, SIG_IGN) != SIG_IGN) + sigset(SIGINT, onint); + doinp(); + break; + case 'o': + dooutp(); + break; + case 'p': + if (sigset(SIGINT, SIG_IGN) != SIG_IGN) + sigset(SIGINT, onint); + dopass(argv[optind]); + break; + } + if (tflag) + fflush(stdout); + else if (Vflag) + prdot(1); + if (pax != PAX_TYPE_CPIO) + pax_onexit(); + //fprintf(stderr, "%llu blocks\n", blocks + ((bytes + 0777) >> 9)); + mclose(); + if (errcnt && sysv3 == 0) + fprintf(stderr, "%llu error(s)\n", errcnt); + return errcnt ? sysv3 ? 1 : 2 : 0; +} + +static size_t +ofiles_cpio(char **name, size_t *namsiz) +{ + static struct iblok *ip; + + if (ip == NULL) + ip = ib_alloc(0, 0); + return ib_getlin(ip, name, namsiz, srealloc); +} + +/* + * Read the file name list for -o and -p and do initial processing + * for each name. + */ +static void +copyout(int (*copyfn)(const char *, struct stat *)) +{ + char *name = NULL, *np; + size_t namsiz = 0, namlen; + struct stat st; + struct prototype pt; + + while ((namlen = ofiles(&name, &namsiz)) != 0) { + lineno++; + if (name[namlen-1] == '\n') + name[--namlen] = '\0'; + if (Pflag) + np = getproto(name, &pt); + else + np = name; + while (np[0] == '.' && np[1] == '/') { + np += 2; + while (*np == '/') + np++; + if (*np == '\0') { + np = name; + break; + } + } + if (lstat(np, &st) < 0) { + if (Pflag && *np && ((pt.pt_spec & + (PT_TYPE|PT_OWNER|PT_GROUP|PT_MODE|PT_RDEV) && + ((pt.pt_mode&S_IFMT) == S_IFBLK || + (pt.pt_mode&S_IFMT) == S_IFCHR)) || + (pt.pt_spec & + (PT_TYPE|PT_OWNER|PT_GROUP|PT_MODE) && + ((pt.pt_mode&S_IFMT) == S_IFDIR || + (pt.pt_mode&S_IFMT) == S_IFIFO || + (pt.pt_mode&S_IFMT) == S_IFREG)))) { + memset(&st, 0, sizeof st); + st.st_mode = pt.pt_mode; + st.st_blksize = 4096; + st.st_nlink = 1; + goto missingok; + } + else if (sysv3 < 0) + msg(2, 0, "< %s > ?\n", np); + else if (sysv3 > 0) + msg(2, 0, "Cannot obtain information " + "about file: \"%s\".\n", + np); + else + emsg(2, "Error with lstat of \"%s\"", np); + errcnt++; + continue; + } + missingok: + if (Lflag && (st.st_mode&S_IFMT) == S_IFLNK) { + if (stat(np, &st) < 0) { + emsg(2, "Cannot follow \"%s\"", np); + errcnt++; + continue; + } + } + /* + * These file types are essentially useless in an archive + * since they are recreated by any process that needs them. + * We thus ignore them and do not even issue a warning, + * because that would only displace more important messages + * on a terminal and confuse people who just want to copy + * directory hierarchies.--But for pax, POSIX.1-2001 requires + * us to fail! + */ + if ((st.st_mode&S_IFMT) == S_IFSOCK || + (st.st_mode&S_IFMT) == S_IFDOOR) { + if (pax >= PAX_TYPE_PAX2001) { + msg(2, 0, "Cannot handle %s \"%s\".\n", + (st.st_mode&S_IFMT) == S_IFSOCK ? + "socket" : "door", np); + errcnt++; + } + continue; + } + if (Pflag) { + if (pt.pt_spec & PT_TYPE) + if ((st.st_mode&S_IFMT) != (pt.pt_mode&S_IFMT)) + msg(4, 0, "line %lld: types " + "do not match\n", lineno); + if (pt.pt_spec & PT_OWNER) + st.st_uid = pt.pt_uid; + if (pt.pt_spec & PT_GROUP) + st.st_gid = pt.pt_gid; + if (pt.pt_spec & PT_MODE) { + st.st_mode &= ~(mode_t)07777; + st.st_mode |= pt.pt_mode; + } + if (pt.pt_spec & PT_ATIME) + st.st_atime = pt.pt_atime; + if (pt.pt_spec & PT_MTIME) + st.st_mtime = pt.pt_mtime; + if (pt.pt_spec & PT_RDEV) { + if ((st.st_mode&S_IFMT) != S_IFBLK && + (st.st_mode&S_IFMT) != S_IFCHR) + msg(4, 0, "line %lld: device type " + "specified for non-device " + "file\n", lineno); + st.st_rdev = pt.pt_rdev; + } + } + if (pax_track(np, st.st_mtime) == 0) + continue; + if ((fmttype == FMT_ZIP || + fmttype & TYP_BAR || + fmttype == FMT_GNUTAR) + && (st.st_mode&S_IFMT) == S_IFDIR && + name[namlen-1] != '/') { + if (namlen+2 >= namsiz) { + size_t diff = np - name; + name = srealloc(name, namsiz = namlen+2); + np = &name[diff]; + } + name[namlen++] = '/'; + name[namlen] = '\0'; + } + errcnt += copyfn(np, &st); + } +} + +/* + * Execution for -o. + */ +static void +dooutp(void) +{ + if (Oflag) { + if ((mt = Aflag ? open(Oflag, O_RDWR, 0666) : + creat(Oflag, 0666)) < 0) { + if (sysv3) { + emsg(013, "Cannot open <%s> for %s.", Oflag, + Aflag ? "append" : "output"); + done(1); + } else + msg(3, -2, "Cannot open \"%s\" for %s\n", Oflag, + Aflag ? "append" : "output"); + } + } else + mt = dup(1); + mstat(); + blkbuf = svalloc(blksiz, 1); + if (Aflag) { + if (totrailer() != 0) + return; + } else if (fmttype == FMT_NONE) + fmttype = bigendian() ? FMT_BINBE : FMT_BINLE; + if (fmttype & TYP_BINARY) { + maxino = 0177777; + fakeino = 0177777; + maxpath = 256; + if (fmttype & TYP_SGI) { + maxsize = 0x7FFFFFFFFFFFFFFFLL; + maxmajor = 037777; + maxminor = 0777777; + } else { + maxsize = 0x7FFFFFFFLL; + maxrdev = 0177777; + } + maxuid = 0177777; + maxgid = 0177777; + maxnlink = 0177777; + } else if (fmttype == FMT_ODC) { + maxino = 0777777; + fakeino = 0777777; + maxpath = 256; + maxsize = 077777777777LL; + maxrdev = 0777777; + maxuid = 0777777; + maxgid = 0777777; + maxnlink = 0777777; + } else if (fmttype == FMT_DEC) { + maxino = 0777777; + fakeino = 0777777; + maxpath = 256; + maxsize = 077777777777LL; + maxmajor = 077777777; + maxminor = 077777777; + maxuid = 0777777; + maxgid = 0777777; + maxnlink = 0777777; + } else if (fmttype & TYP_NCPIO) { + maxino = 0xFFFFFFFFUL; + fakeino = 0xFFFFFFFFUL; + maxpath = 1024; + maxsize = fmttype&TYP_SCO ? 0x7FFFFFFFFFFFFFFFLL : 0xFFFFFFFFUL; + maxmajor = 0xFFFFFFFFUL; + maxminor = 0xFFFFFFFFUL; + maxuid = 0xFFFFFFFFUL; + maxgid = 0xFFFFFFFFUL; + maxnlink = 0xFFFFFFFFUL; + } else if (fmttype & TYP_CRAY) { + maxino = 0xFFFFFFFFUL; + fakeino = 0xFFFFFFFFUL; + maxpath = SANELIMIT; + maxsize = 0x7FFFFFFFFFFFFFFFLL; + maxrdev = 0x7FFFFFFFFFFFFFFFLL; + maxuid = 0x7FFFFFFFFFFFFFFFLL; + maxgid = 0x7FFFFFFFFFFFFFFFLL; + maxnlink = 0x7FFFFFFFFFFFFFFFLL; + } else if (fmttype == FMT_GNUTAR) { + maxino = 0xFFFFFFFFUL; + fakeino = 0xFFFFFFFFUL; + maxpath = SANELIMIT; + maxsize = 0x7FFFFFFFFFFFFFFFLL; + maxmajor = 0x7FFFFFFFFFFFFFFFLL; + maxminor = 0x7FFFFFFFFFFFFFFFLL; + maxuid = 0x7FFFFFFFFFFFFFFFLL; + maxgid = 0x7FFFFFFFFFFFFFFFLL; + maxnlink = 0x7FFFFFFFFFFFFFFFLL; + } else if (fmttype & TYP_PAX) { + maxino = 0xFFFFFFFFUL; + fakeino = 0xFFFFFFFFUL; + maxpath = SANELIMIT; + maxsize = 0x7FFFFFFFFFFFFFFFLL; + maxmajor = fmttype==FMT_SUN ? 0x7FFFFFFFFFFFFFFFLL : 07777777; + maxminor = fmttype==FMT_SUN ? 0x7FFFFFFFFFFFFFFFLL : 07777777; + maxuid = 0x7FFFFFFFFFFFFFFFLL; + maxgid = 0x7FFFFFFFFFFFFFFFLL; + maxnlink = 0x7FFFFFFFFFFFFFFFLL; + if (pax_oflag & PO_TIMES) + globrec |= PR_ATIME|PR_MTIME; + } else if (fmttype & TYP_BAR) { + maxino = 0xFFFFFFFFUL; + fakeino = 0xFFFFFFFFUL; + maxpath = 512 - SIZEOF_bar_header - 1; + maxsize = 077777777777LL; + maxrdev = 07777777; + maxuid = 07777777; + maxgid = 07777777; + maxnlink = 0x7FFFFFFFFFFFFFFFLL; + if (nwritten == 0) + dump_barhdr(); + } else if (fmttype & TYP_USTAR) { + maxino = 0xFFFFFFFFUL; + fakeino = 0xFFFFFFFFUL; + maxpath = 256; + maxsize = 077777777777LL; + maxmajor = 07777777; + maxminor = 07777777; + maxuid = 07777777; + maxgid = 07777777; + maxnlink = 0x7FFFFFFFFFFFFFFFLL; + } else if (fmttype & TYP_OTAR) { + maxino = 0xFFFFFFFFUL; + fakeino = 0xFFFFFFFFUL; + maxpath = 99; + maxsize = 077777777777LL; + maxuid = 07777777; + maxgid = 07777777; + maxnlink = 0x7FFFFFFFFFFFFFFFLL; + } else if (fmttype == FMT_ZIP) { + maxino = 0xFFFFFFFFUL; + fakeino = 0xFFFFFFFFUL; + maxpath = 60000; + maxsize = 0x7FFFFFFFFFFFFFFFLL; + maxrdev = 0xFFFFFFFFUL; + maxuid = 0xFFFFFFFFUL; + maxgid = 0xFFFFFFFFUL; + maxnlink = 0xFFFFFFFFUL; + } else + abort(); + fakedev = 0177777; + harddev = 1; + copyout(outfile); + if (fmttype & TYP_NCPIO) + lflush(); + if (fmttype & TYP_CPIO) { + struct stat st; + + memset(&st, 0, sizeof st); + st.st_nlink = 1; + outfile(trailer, &st); + } + if (fmttype & TYP_TAR) { + char b[512]; + + memset(b, 0, sizeof b); + bwrite(b, sizeof b); + bwrite(b, sizeof b); + } + if (fmttype == FMT_ZIP) + ziptrailer(); + bflush(); +} + +/* + * Handle a single file for -o, do sanity checks and detect hard links. + */ +static int +outfile(const char *file, struct stat *st) +{ + uint32_t dev, ino; + size_t pathsz; + + if ((st->st_mode&S_IFMT) == S_IFREG) + if (mtst.st_dev == st->st_dev && mtst.st_ino == st->st_ino) + return 0; + if (st->st_size > maxsize) { + msg(2, 0, "Size of %c%s%c >%lluGB. Not dumped\n", + sysv3 ? '<' : '"', + file, + sysv3 ? '>' : '"', + (maxsize+1) / (1024*1024*1024)); + return 1; + } + if (((st->st_mode&S_IFMT)==S_IFBLK||(st->st_mode&S_IFMT)==S_IFCHR) && + (maxrdev && + (unsigned long long)st->st_rdev > maxrdev || + maxmajor && + (unsigned long long)major(st->st_rdev) > maxmajor || + maxminor && + (unsigned long long)minor(st->st_rdev) > maxminor)) { + cantsup(1, file); + return 1; + } + if ((unsigned long long)st->st_uid > maxuid) { + if (cray_eflag) { + cantsup(1, file); + return 1; + } + cantsup(0, file); + st->st_uid = 60001; + if ((st->st_mode&S_IFMT) == S_IFREG && st->st_mode & 0111) + st->st_mode &= ~(mode_t)S_ISUID; + if ((unsigned long long)st->st_gid > maxgid) { + st->st_gid = 60001; + if ((st->st_mode&S_IFMT)==S_IFREG && st->st_mode&0010) + st->st_mode &= ~(mode_t)S_ISGID; + } + } else if ((unsigned long long)st->st_gid > maxgid) { + if (cray_eflag) { + cantsup(1, file); + return 1; + } + cantsup(0, file); + st->st_gid = 60001; + if ((st->st_mode&S_IFMT) == S_IFREG && st->st_mode & 0010) + st->st_mode &= ~(mode_t)S_ISGID; + } + if ((pathsz = strlen(file)) > maxpath) { + msg(2, 0, "%s: file name too long\n", file); + return 1; + } + /* + * Detect hard links and compute fake inode counts. The mechanism + * is as follows: If a file has more than one link, a fake device + * number starting at one is used for its device, and a fake inode + * number is used starting at one too. + * + * The information on links of directories is useless, so it is + * dropped and handled like a file with a single link only: Fake + * devices are allocated just below the format's limit, fake + * i-nodes the same. + * + * This way even the binary cpio format can have up to ~4G files. + */ + if (maxino && st->st_nlink > 1 && (st->st_mode&S_IFMT) != S_IFDIR) { + struct dslot *ds, *dp; + struct islot *ip; + + dev = 1; + ds = devices; + dp = NULL; +nextdev: + for (; ds; dp = ds, ds = ds->d_nxt, dev++ /* see below! */) + if (ds->d_dev == st->st_dev) + break; + if (markeddevs && marked(dev)) { + dev++; + goto nextdev; + } + if (dev >= fakedev) + msg(4, 1, "Too many devices in archive, exiting\n"); + if (ds == NULL) { + ds = scalloc(1, sizeof *ds); + ds->d_dev = st->st_dev; + ds->d_fake = dev; + if (devices == NULL) + devices = ds; + else + dp->d_nxt = ds; + } + harddev = dev; + if ((ip = ifind(st->st_ino, &ds->d_isl)) == NULL) { + if (ds->d_cnt >= maxino) { + /* corresponds to for loop above */ + dev++, dp = ds, ds = ds->d_nxt; + goto nextdev; + } + ip = scalloc(1, sizeof *ip); + ip->i_ino = st->st_ino; + ip->i_fino = ++ds->d_cnt; + ip->i_nlk = st->st_nlink; + if (fmttype & TYP_TAR) + ip->i_name = sstrdup(file); + if (fmttype & TYP_NCPIO) { + ip->i_st = smalloc(sizeof *ip->i_st); + *ip->i_st = *st; + } + iput(ip, &ds->d_isl); + } + ino = ip->i_fino; + if (fmttype & TYP_NCPIO) { + /* + * In SVR4 ascii cpio format, files with multiple + * links are stored with a zero size except for the + * last link, which contains the actual file content. + * As one cannot know which is the last link in + * advance since some links may be outside the + * archive content, all links have to be collected + * and written out at once. + */ + struct ilink *il, *ik; + + switch (ip->i_nlk) { + case 1: + /* + * This was the last link to a file. Write + * all previous links and break to write + * the actual file content. Free the pointers + * in islot; islot remains within the tree + * with a remaining link count of zero. + */ + ip->i_nlk--; + free(ip->i_st); + ip->i_st = NULL; + for (il = ip->i_lnk, ik = NULL; il; + ik = il, il = il->l_nxt, + ik ? free(ik), 0 : 0) { + errcnt += addfile(il->l_nam, st, + dev, ino, 1, 0); + free(il->l_nam); + } + break; + case 0: + /* + * This file got a link during operation, or + * -L was specified and we encountered a link + * more than once. Start with a fresh link + * count again. + */ + ip->i_nlk = st->st_nlink; + ip->i_lnk = NULL; + ip->i_st = smalloc(sizeof *ip->i_st); + *ip->i_st = *st; + /*FALLTHRU*/ + default: + /* + * There are more links to this file. Store + * only the name and return. + */ + ip->i_nlk--; + if (ip->i_lnk) { + for (il = ip->i_lnk; il->l_nxt; + il = il->l_nxt); + il->l_nxt = scalloc(1,sizeof*il->l_nxt); + il = il->l_nxt; + } else { + ip->i_lnk = scalloc(1,sizeof*ip->i_lnk); + il = ip->i_lnk; + } + il->l_nam = smalloc(pathsz + 1); + strcpy(il->l_nam, file); + return 0; + } + } else if (fmttype & TYP_TAR) { + if (strcmp(ip->i_name, file)) + return addfile(file, st, dev, ino, 1, + ip->i_name); + } + } else { /* single-linked or directory */ + dev = fakedev; + while (markeddevs && marked(dev)) + dev--; + if ((ino = fakeino--) == 0) { + if (--dev <= harddev) + msg(4, 1, "Too many devices in archive, " + "exiting\n"); + fakedev = dev; + ino = maxino; + fakeino = ino - 1; + } + } + return addfile(file, st, dev, ino, 0, 0); +} + +/* + * Add a single file to the archive with -o. + */ +static int +addfile(const char *realfile, struct stat *st, + uint32_t dev, uint32_t ino, int zerolink, const char *linkname) +{ + union bincpio bc; + int fd = -1; + long long size; + int pad, i; + ssize_t rsz = 0, wsz = 0, hsz, fsz, psz; + long long remsz, relative, nlink; + long long Kbase = 0, Krest = 0, Ksize = 0; + struct hdr_cpio K2hdr; + uint32_t crc = 0; + long long csize = 0; + char *file; + char *symblink = NULL; + int failure = 1; + + file = sstrdup(realfile); + if (pax != PAX_TYPE_CPIO && strcmp(file, trailer)) { + size_t junk = 0; + if (pax_sflag && pax_sname(&file, &junk) == 0) + goto cleanup; + if (rflag && rname(&file, &junk) == 0) + goto cleanup; + } + fsz = strlen(file); + relative = nwritten; + memset(bc.data, 0, sizeof bc.data); + if (fmttype == FMT_PAX && pax_oflag & PO_LINKDATA && + (st->st_mode&S_IFMT) == S_IFREG) + size = st->st_size; + else if (zerolink) + size = 0; + else if ((st->st_mode&S_IFMT) == S_IFREG) + size = st->st_size; + else if ((st->st_mode&S_IFMT) == S_IFLNK) { + i = st->st_size ? st->st_size : PATH_MAX; + symblink = smalloc(i+1); + if ((size = readlink(realfile, symblink, i)) < 0) { + emsg(3, "Cannot read symbolic link \"%s\"", realfile); + goto cleanup; + } + symblink[size] = '\0'; + } else + size = 0; + nlink = ((unsigned long long)st->st_nlink>maxnlink ? + maxnlink : st->st_nlink); + if (fmttype & TYP_NCPIO) { + long size1; + if (fmttype & TYP_SCO && size >= mag_sco) { + char *ofile = file; + size1 = mag_sco; + fsz += 22; + file = smalloc(fsz + 1); + snprintf(file, fsz + 1, "%s%csize=%016llx", + ofile, 0, size); + free(ofile); + } else + size1 = size; + pad = 4; + sprintf(bc.data, "%*.*s%08lx%08lx%08lx%08lx%08lx%08lx" + "%08lx%08lx%08lx%08lx%08lx%08lx%08lx", + (int)(fmttype&TYP_CRC? sizeof mag_crc:sizeof mag_asc), + (int)(fmttype&TYP_CRC? sizeof mag_crc:sizeof mag_asc), + fmttype & TYP_CRC ? mag_crc : mag_asc, + (long)ino & ECUT, + (long)st->st_mode & ECUT, + (long)st->st_uid & ECUT, + (long)st->st_gid & ECUT, + (long)nlink & ECUT, + (long)st->st_mtime & ECUT, + (long)size1 & ECUT, + (long)major(dev) & ECUT, + (long)minor(dev) & ECUT, + (long)major(st->st_rdev) & ECUT, + (long)minor(st->st_rdev) & ECUT, + (long)++fsz, + 0L); + hsz = SIZEOF_Exp_cpio_hdr; + if ((psz = (hsz + fsz) % pad) != 0) + psz = pad - psz; + } else if (fmttype == FMT_ODC) { + pad = 1; + sprintf(bc.data, "%*.*s%06lo%06lo%06lo%06lo%06lo%06lo%06lo" + "%011lo%06lo%011lo", + (int)sizeof mag_odc, (int)sizeof mag_odc, mag_odc, + (long)dev & OCUT, + (long)ino & OCUT, + (long)st->st_mode & OCUT, + (long)st->st_uid & OCUT, + (long)st->st_gid & OCUT, + (long)nlink & OCUT, + (long)st->st_rdev & OCUT, + (long)st->st_mtime, + (long)++fsz, + (long)size); + hsz = SIZEOF_c_hdr; + if ((psz = (hsz + fsz) % pad) != 0) + psz = pad - psz; + } else if (fmttype == FMT_DEC) { + pad = 1; + sprintf(bc.data, "%*.*s%06lo%06lo%06lo%06lo%06lo%06lo" + "%08lo%08lo%011lo%06lo%011lo", + (int)sizeof mag_odc, (int)sizeof mag_odc, mag_odc, + (long)dev & OCUT, + (long)ino & OCUT, + (long)st->st_mode & OCUT, + (long)st->st_uid & OCUT, + (long)st->st_gid & OCUT, + (long)nlink & OCUT, + (long)major(st->st_rdev) & 077777777, + (long)minor(st->st_rdev) & 077777777, + (long)st->st_mtime, + (long)++fsz, + (long)size); + hsz = SIZEOF_d_hdr; + if ((psz = (hsz + fsz) % pad) != 0) + psz = pad - psz; + } else if (fmttype & TYP_BINARY) { + /* + * To avoid gcc's stupid 'comparison is always false due to + * limited range of data type' warning. + */ + unsigned long long gcccrap; + pad = 2; + if (fmttype & TYP_BE) { + be16p(mag_bin, bc.Hdr.c_magic); + be16p(dev, bc.Hdr.c_dev); + be16p(ino, bc.Hdr.c_ino); + be16p(st->st_mode, bc.Hdr.c_mode); + be16p(st->st_uid, bc.Hdr.c_uid); + be16p(st->st_gid, bc.Hdr.c_gid); + be16p(nlink, bc.Hdr.c_nlink); + be16p(st->st_rdev, bc.Hdr.c_rdev); + be32p(st->st_mtime, bc.Hdr.c_mtime); + be16p(++fsz, bc.Hdr.c_namesize); + } else { + le16p(mag_bin, bc.Hdr.c_magic); + le16p(dev, bc.Hdr.c_dev); + le16p(ino, bc.Hdr.c_ino); + le16p(st->st_mode, bc.Hdr.c_mode); + le16p(st->st_uid, bc.Hdr.c_uid); + le16p(st->st_gid, bc.Hdr.c_gid); + le16p(nlink, bc.Hdr.c_nlink); + le16p(st->st_rdev, bc.Hdr.c_rdev); + me32p(st->st_mtime, bc.Hdr.c_mtime); + le16p(++fsz, bc.Hdr.c_namesize); + } + if (fmttype & TYP_SGI && size > 0x7FFFFFFFLL) { + Krest = size & 0x7FFFFFFFLL; + Kbase = size - Krest; + Ksize = 0x100000000LL - (Kbase >> 31); + if (fmttype & TYP_BE) + be32p(Ksize, bc.Hdr.c_filesize); + else + me32p(Ksize, bc.Hdr.c_filesize); + K2hdr = bc.Hdr; + if (fmttype & TYP_BE) + be32p(Krest, K2hdr.c_filesize); + else + me32p(Krest, K2hdr.c_filesize); + } else { + if (fmttype & TYP_BE) + be32p(size, bc.Hdr.c_filesize); + else + me32p(size, bc.Hdr.c_filesize); + } + if (fmttype & TYP_SGI && + (((st->st_mode&S_IFMT) == S_IFBLK || + (st->st_mode&S_IFMT) == S_IFCHR) && + ((unsigned long long)major(st->st_rdev)>0xFF || + (unsigned long long)minor(st->st_rdev)>0xFF) || + (gcccrap = st->st_rdev) > 0177777)) { + uint32_t rdev; + rdev = (minor(st->st_rdev) & 0x0003FFFF) + + ((major(st->st_rdev)<<18) & 0xFFFC0000); + if (fmttype & TYP_BE) { + be16p(0xFFFF, bc.Hdr.c_rdev); + be32p(rdev, bc.Hdr.c_filesize); + } else { + le16p(0xFFFF, bc.Hdr.c_rdev); + me32p(rdev, bc.Hdr.c_filesize); + } + } + hsz = SIZEOF_hdr_cpio; + psz = (hsz + fsz) % 2; + } else if (fmttype & TYP_CRAY) { + int diff5 = fmttype==FMT_CRAY5 ? CRAY_PARAMSZ : 0; + mode_t mo; + pad = 1; + be64p(mag_bin, bc.Crayhdr.C_magic); + be64p(dev, bc.Crayhdr.C_dev); + be64p(ino, bc.Crayhdr.C_ino); + if ((st->st_mode&S_IFMT) == S_IFLNK) /* non-standard */ + mo = st->st_mode&07777|0130000; /* S_IFLNK on Cray */ + else + mo = st->st_mode; + be64p(mo, bc.Crayhdr.C_mode); + be64p(st->st_uid, bc.Crayhdr.C_uid); + be64p(st->st_gid, bc.Crayhdr.C_gid); + be64p(nlink, bc.Crayhdr.C_nlink); + be64p(st->st_rdev, bc.Crayhdr.C_rdev); + be64p(st->st_mtime, bc.Crayhdr.C_mtime - diff5); + be64p(++fsz, bc.Crayhdr.C_namesize - diff5); + be64p(size, bc.Crayhdr.C_filesize - diff5); + hsz = SIZEOF_cray_hdr - diff5; + psz = 0; + } else if (fmttype & TYP_BAR) { + int c, n = 0; + pad = 512; + sprintf(bc.Bdr.b_mode, "%7.7o",(int)st->st_mode&(07777|S_IFMT)); + sprintf(bc.Bdr.b_uid, "%7.7lo", (long)st->st_uid); + sprintf(bc.Bdr.b_gid, "%7.7lo", (long)st->st_gid); + sprintf(bc.Bdr.b_size, "%11.11llo", + (st->st_mode&S_IFMT) == S_IFREG && !zerolink ? + (long long)st->st_size&077777777777LL : 0LL); + sprintf(bc.Bdr.b_mtime, "%11.11lo", (long)st->st_mtime); + sprintf(bc.Bdr.b_rdev, "%7.7lo", (long)st->st_rdev); + strcpy(&bc.data[SIZEOF_bar_header], file); + c = tlflag(st); + if (zerolink == 0) { + bc.Bdr.b_linkflag = c; + if (c == '2') { + strncpy(&bc.data[SIZEOF_bar_header+fsz+1], + symblink, + 512-SIZEOF_bar_header-fsz); + n = size; + } + } else { + bc.Bdr.b_linkflag = '1'; + strncpy(&bc.data[SIZEOF_bar_header+fsz+1], linkname, + 512-SIZEOF_bar_header-fsz-1); + n = strlen(linkname); + } + if (n > 512-SIZEOF_bar_header-fsz-1) { + msg(3, 0, "%s: linked name too long\n", realfile); + goto cleanup; + } + bchksum(&bc); + hsz = 512; + psz = 0; + fsz = 0; + } else if (fmttype & TYP_TAR) { + const char *cp; + int c; + /* + * Many SVR4 cpio derivatives expect the mode field + * to contain S_IFMT bits. The meaning of these bits + * in the mode field of the ustar header is left + * unspecified by IEEE Std 1003.1, 1996, 10.1.1. + */ + int mmask = fmttype == FMT_USTAR || fmttype == FMT_PAX ? + 07777 : 07777|S_IFMT; + + paxrec = globrec; + pad = 512; + if (tmkname(&bc.Tdr, file) != 0) + goto cleanup; + sprintf(bc.Tdr.t_mode, "%7.7o", (int)st->st_mode & mmask); + if (fmttype == FMT_GNUTAR && st->st_uid > 07777777) { + be64p(st->st_uid, bc.Tdr.t_uid); + bc.Tdr.t_uid[0] |= 0200; + } else { + sprintf(bc.Tdr.t_uid, "%7.7lo", + (long)st->st_uid&07777777); + if (fmttype & TYP_PAX && st->st_uid > 07777777) + paxrec |= PR_UID; + } + if (fmttype == FMT_GNUTAR && st->st_gid > 07777777) { + be64p(st->st_gid, bc.Tdr.t_gid); + bc.Tdr.t_gid[0] |= 0200; + } else { + sprintf(bc.Tdr.t_gid, "%7.7lo", + (long)st->st_gid&07777777); + if (fmttype & TYP_PAX && st->st_gid > 07777777) + paxrec |= PR_GID; + } + if (fmttype == FMT_GNUTAR && (st->st_mode&S_IFMT) == S_IFREG && + st->st_size > 077777777777LL && !zerolink) { + bc.Tdr.t_size[0] = '\200'; + be64p(st->st_size, &bc.Tdr.t_size[4]); + } else { + sprintf(bc.Tdr.t_size, "%11.11llo", + (st->st_mode&S_IFMT) == S_IFREG && + (!zerolink || fmttype == FMT_PAX && + pax_oflag & PO_LINKDATA) ? + (long long)st->st_size&077777777777LL : 0LL); + if (fmttype & TYP_PAX && + (st->st_mode&S_IFMT) == S_IFREG && + st->st_size > 077777777777LL && + (!zerolink || fmttype == FMT_PAX && + pax_oflag & PO_LINKDATA)) + paxrec |= PR_SIZE; + } + sprintf(bc.Tdr.t_mtime, "%11.11lo", (long)st->st_mtime); + if ((c = tlflag(st)) < 0) { + if ((st->st_mode&S_IFMT) != S_IFDIR) { + msg(2, 0, "%s is not a file. Not dumped\n", + realfile); + errcnt++; + } else + failure = 0; + goto cleanup; + } + if (zerolink == 0) { + bc.Tdr.t_linkflag = c; + if (c == '2') { + if (tmklink(&bc.Tdr, symblink) != 0) + goto cleanup; + } + } else { + bc.Tdr.t_linkflag = '1'; + if (tmklink(&bc.Tdr, linkname) != 0) + goto cleanup; + } + if (fmttype & TYP_USTAR) { + if (fmttype == FMT_GNUTAR) + strcpy(bc.Tdr.t_magic, mag_gnutar); + else { + strcpy(bc.Tdr.t_magic, mag_ustar); + bc.Tdr.t_version[0] = bc.Tdr.t_version[1] = '0'; + } + if ((cp = getuser(st->st_uid)) != NULL) + sprintf(bc.Tdr.t_uname, "%.31s", cp); + if ((cp = getgroup(st->st_gid)) != NULL) + sprintf(bc.Tdr.t_gname, "%.31s", cp); + else + msg(1, 0, "could not get group information " + "for %s\n", realfile); + if (fmttype == FMT_GNUTAR && + (unsigned long long)major(st->st_rdev) + > 077777777) { + be64p(major(st->st_rdev), bc.Tdr.t_devmajor); + bc.Tdr.t_devmajor[0] |= 0200; + } else { + if (fmttype == FMT_SUN && + (unsigned long long)major(st->st_rdev) + > 077777777 && + ((st->st_mode&S_IFMT)==S_IFBLK|| + (st->st_mode&S_IFMT)==S_IFCHR)) + paxrec |= PR_SUN_DEVMAJOR; + sprintf(bc.Tdr.t_devmajor, "%7.7o", + (int)major(st->st_rdev)&07777777); + } + if (fmttype == FMT_GNUTAR && + (unsigned long long)minor(st->st_rdev) + > 077777777) { + be64p(minor(st->st_rdev), bc.Tdr.t_devminor); + bc.Tdr.t_devminor[0] |= 0200; + } else { + if (fmttype == FMT_SUN && + (unsigned long long)minor(st->st_rdev) + > 077777777 && + ((st->st_mode&S_IFMT)==S_IFBLK|| + (st->st_mode&S_IFMT)==S_IFCHR)) + paxrec |= PR_SUN_DEVMINOR; + sprintf(bc.Tdr.t_devminor, "%7.7o", + (int)minor(st->st_rdev)&07777777); + } + } + tchksum(&bc); + hsz = 512; + psz = 0; + fsz = 0; + } else if (fmttype == FMT_ZIP) { + pad = 1; + memcpy(bc.Zdr.z_signature, mag_zipsig, sizeof mag_zipsig); + bc.Zdr.z_version[0] = 10; + mkdostime(st->st_mtime, bc.Zdr.z_modtime, bc.Zdr.z_moddate); + if ((st->st_mode&S_IFMT) == S_IFREG || + (st->st_mode&S_IFMT) == S_IFLNK) { + le32p(size, bc.Zdr.z_csize); + le32p(size, bc.Zdr.z_nsize); + csize = size; + } + le16p(fsz, bc.Zdr.z_namelen); + le16p(SIZEOF_zextra_cp, bc.Zdr.z_extralen); + hsz = SIZEOF_zip_header; + psz = 0; + } else + abort(); + /* + * Start writing the file to the archive. + */ + if ((st->st_mode&S_IFMT) == S_IFREG && st->st_size != 0 && + (zerolink == 0 || fmttype == FMT_PAX && + pax_oflag & PO_LINKDATA)) { + char *buf; + size_t bufsize; + int readerr = 0; + + if ((fd = open(realfile, O_RDONLY)) < 0) { + if (sysv3 < 0) + msg(0, 0, "< %s > ?\n", realfile); + else if (sysv3 > 0) + fprintf(stderr, "<%s> ?\n", realfile); + else + msg(0, 0, "\"%s\" ?\n", realfile); + goto cleanup; + } + if (fmttype == FMT_ZIP) { + if (zipwrite(fd, file, st, &bc, fsz, dev, ino, + &crc, &csize) < 0) + goto cleanup2; + goto done; + } + if (fmttype & TYP_CRC) + if (sum(fd, realfile, st, bc.Edr.E_chksum) < 0) + goto cleanup2; + if (fmttype & TYP_PAX && paxrec != PR_NONE) + wrpax(file, symblink?symblink:linkname, st); + bwrite(bc.data, hsz); + if (fsz) + bwrite(file, fsz); + if (psz) + bwrite(&bc.data[hsz], psz); + if (Kbase) + remsz = Kbase; + else + remsz = st->st_size; + getbuf(&buf, &bufsize, st->st_blksize); + again: while (remsz > 0) { + if (fd < 0 || (rsz = read(fd, &buf[wsz], + bufsize - wsz)) < 0) { + if (readerr == 0) { + emsg(3, "Cannot read \"%s\"", realfile); + if (fd >= 0) + errcnt++; + readerr = 1; + } + if (fd >= 0 && lseek(fd, bufsize - wsz, + SEEK_CUR) < 0) { + close(fd); + fd = -1; + } + rsz = bufsize - wsz; + if (rsz > remsz) + rsz = remsz; + memset(&buf[wsz], 0, rsz); + } + if (rsz > remsz) + rsz = remsz; + wsz += rsz; + remsz -= rsz; + bwrite(buf, wsz); + memset(buf, 0, wsz); + size = wsz; + wsz = 0; + } + wsz = size; + if (Kbase) { + if ((i = Ksize % pad) != 0) + bwrite(&bc.data[hsz], i); + bwrite((char *)&K2hdr, hsz); + if (fsz) + bwrite(file, fsz); + if (psz) + bwrite(&bc.data[hsz], psz); + remsz = Krest; + Kbase = 0; + wsz = 0; + goto again; + } else if (Ksize) + wsz = Krest; + } else if ((fmttype == FMT_ZIP || fmttype & TYP_CPIO) && + (st->st_mode&S_IFMT) == S_IFLNK) { + wsz = size; + if (fmttype == FMT_ZIP) { + crc = zipcrc(0, (unsigned char *)symblink, wsz); + le32p(crc, bc.Zdr.z_crc32); + bwrite(bc.data, SIZEOF_zip_header); + bwrite(file, fsz); + zipwxtra(file, st, dev, ino); + bwrite(symblink, wsz); + } else { + bwrite(bc.data, hsz); + if (fsz) + bwrite(file, fsz); + if (psz) + bwrite(&bc.data[hsz], psz); + bwrite(symblink, wsz); + } + } else { + if (fmttype & TYP_PAX && paxrec != PR_NONE) + wrpax(file, symblink?symblink:linkname, st); + bwrite(bc.data, hsz); + if (fsz) + bwrite(file, fsz); + if (psz) + bwrite(&bc.data[hsz], psz); + if (fmttype == FMT_ZIP) + zipwxtra(file, st, dev, ino); + } +done: if (fmttype == FMT_ZIP) { + zipdefer(file, st, relative, crc, csize, &bc.Zdr); + } + if ((i = wsz % pad) != 0) + bwrite(&bc.data[hsz], pad - i); + if (vflag && strcmp(file, trailer)) + fprintf(stderr, "%s\n", file); + else if (Vflag) + prdot(0); + failure = 0; +cleanup2: + if ((st->st_mode&S_IFMT) == S_IFREG) { + if (fd >= 0) + close(fd); + if (aflag) + errcnt += rstime(realfile, st, "access"); + } +cleanup: + free(file); + free(symblink); + return failure; +} + +/* + * Flush a SVR4 cpio format inode tree for -o. + */ +static void +iflush(struct islot *ip, uint32_t dev) +{ + if (ip == inull) + return; + iflush(ip->i_lln, dev); + iflush(ip->i_rln, dev); + if (ip->i_nlk > 0 && ip->i_st) { + struct ilink *il; + + for (il = ip->i_lnk; il->l_nxt; il = il->l_nxt) + errcnt += addfile(il->l_nam, ip->i_st, + dev, ip->i_fino, 1, 0); + errcnt += addfile(il->l_nam, ip->i_st, dev, ip->i_fino, 0, 0); + } +} + +/* + * Flush the SVR4 cpio link forest for -o. + */ +static void +lflush(void) +{ + struct dslot *ds; + + for (ds = devices; ds; ds = ds->d_nxt) + iflush(ds->d_isl, ds->d_fake); +} + +int +setfmt(char *s) +{ + int i, j; + + struct { + const char *ucs; + const char *lcs; + int type; + int bits; + } fs[] = { + { "NEWC", "newc", FMT_ASC, 00 }, + { "SCO", "sco", FMT_SCOASC, 00 }, + { "CRC", "crc", FMT_CRC, 00 }, + { "SCOCRC", "scocrc", FMT_SCOCRC, 00 }, + { "ODC", "odc", FMT_ODC, 00 }, + { "DEC", "dec", FMT_DEC, 00 }, + { "BIN", "bin", FMT_NONE, 00 }, + { "BBS", "bbs", TYP_BE, 00 }, + { "SGI", "sgi", FMT_SGIBE, 00 }, + { "CRAY", "cray", FMT_CRAY, 00 }, + { "CRAY5", "cray5", FMT_CRAY5, 00 }, + { "TAR", "tar", FMT_TAR, 00 }, + { "USTAR", "ustar", FMT_USTAR, 00 }, + { "PAX:", "pax:", FMT_PAX, 00 }, + { "SUN", "sun", FMT_SUN, 00 }, + { "GNU", "gnu", FMT_GNUTAR, 00 }, + { "OTAR", "otar", FMT_OTAR, 00 }, + { "BAR", "bar", FMT_BAR, 00 }, + { "ZIP:", "zip:", FMT_ZIP, 00 }, + { NULL, NULL, 0, 00 } + }; + for (i = 0; fs[i].ucs; i++) { + for (j = 0; s[j] && + (s[j] == fs[i].ucs[j] || s[j] == fs[i].lcs[j]); + j++) + if (fs[i].ucs[j] == ':') + break; + if (s[j] == '\0' && + (fs[i].ucs[j] == '\0' || fs[i].ucs[j] == ':') || + s[j] == ':' && fs[i].ucs[j] == ':') { + fmttype = fs[i].type; + if (fmttype == FMT_ZIP && s[j] == ':') { +#if USE_ZLIB + if (strcmp(&s[j+1], "en") == 0) + zipclevel = 00; + else if (strcmp(&s[j+1], "ex") == 0) + zipclevel = 01; + else if (strcmp(&s[j+1], "ef") == 0) + zipclevel = 02; + else if (strcmp(&s[j+1], "es") == 0) + zipclevel = 03; + else +#endif /* USE_ZLIB */ + if (strcmp(&s[j+1], "e0") == 0) + zipclevel = 04; + else +#if USE_BZLIB + if (strcmp(&s[j+1], "bz2") == 0) + zipclevel = 07; + else +#endif /* USE_BZLIB */ + continue; + } else if (fmttype == FMT_NONE) + fmttype = bigendian() ? FMT_BINBE : FMT_BINLE; + else if (fmttype == TYP_BE) + fmttype = bigendian() ? FMT_BINLE : FMT_BINBE; + else if (fmttype == FMT_PAX && s[j] == ':') { + if (pax_options(&s[j+1], 0) < 0) + continue; + } + return 0; + } + } + msg(3, 0, "Invalid header \"%s\" specified.\n", s); + return -1; +} + +static int +bigendian(void) +{ + union { + char u_c[2]; + int16_t u_i; + } u; + u.u_i = 1; + return u.u_c[1] == 1; +} + +int +setreassign(const char *s) +{ + struct passwd *pwd; + int val = 0; + + if (myuid != 0) { + msg(3, 0, "R option only valid for super-user.\n"); + val = -1; + } + if ((pwd = getpwnam(s)) == NULL) { + msg(3, 0, "\"%s\" is not a valid user id\n", s); + val = -1; + } else { + Ruid = pwd->pw_uid; + Rgid = pwd->pw_gid; + } + return val; +} + +void * +srealloc(void *m, size_t n) +{ + if ((m = realloc(m, n)) == NULL) { + write(2, "Out of memory.\n", 15); + _exit(sysv3 ? 2 : 3); + } + return m; +} + +void * +smalloc(size_t n) +{ + return srealloc(NULL, n); +} + +void * +scalloc(size_t nmemb, size_t size) +{ + void *vp; + + if ((vp = calloc(nmemb, size)) == NULL) { + write(2, "Out of memory.\n", 15); + _exit(sysv3 ? 2 : 3); + } + return vp; +} + +void * +svalloc(size_t n, int force) +{ + static long pagesize; + void *vp; + + if (pagesize == 0) + if ((pagesize = sysconf(_SC_PAGESIZE)) < 0) + pagesize = 4096; + if ((vp = memalign(pagesize, n)) == NULL && force) { + write(2, "Out of memory.\n", 15); + _exit(sysv3 ? 2 : 3); + } + return vp; +} + +/* + * A single static buffer is used for intermediate copying from file + * data to the tape buffer and vice versa, for creating checksums, and + * for data transfer with -p. + */ +static void +getbuf(char **bufp, size_t *sizep, size_t best) +{ + static char *buf; + static size_t size; + + if (size != best) { + if (buf) + free(buf); + size = best; + if (size == 0 || (buf = svalloc(size, 0)) == NULL) + buf = svalloc(size = 512, 1); + } + *bufp = buf; + *sizep = size; +} + +static void +sevprnt(int sev) +{ + if (printsev) switch (sev) { + case 1: + fprintf(stderr, "INFORM: "); + break; + case 2: + fprintf(stderr, "WARNING: "); + break; + case 3: + fprintf(stderr, "ERROR: "); + break; + case 4: + fprintf(stderr, "HALT: "); + break; + } +} + +void +msg(int sev, int err, const char *fmt, ...) +{ + va_list ap; + + /* + * The error message should appear near the file it refers to. + */ + if (tflag) + fflush(stdout); + else if (Vflag) + prdot(1); + if (sysv3 >= 0 && sev >= (printsev ? 0 : -1)) + fprintf(stderr, "%s: ", progname); + sevprnt(sev); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + if (err > 0) + done(err); + else if (err == -2) { + if (sysv3) + done(1); + usage(); + } +} + +void +emsg(int sev, const char *fmt, ...) +{ + char _fmt[60]; + int i, fl = sev & 030, n; + va_list ap; + + sev &= ~030; + i = errno; + if (tflag) + fflush(stdout); + else if (Vflag) + prdot(1); + fprintf(stderr, "%s: ", progname); + sevprnt(sev); + va_start(ap, fmt); + if (sysv3) { + if (fmt[(n=strlen(fmt))-1] == '"' && fmt[n-2] == 's' && + fmt[n-3] == '%' && fmt[n-4] == '"' && + n < sizeof _fmt) { + strcpy(_fmt, fmt); + _fmt[n-1] = '>'; + _fmt[n-4] = '<'; + fmt = _fmt; + } + } + vfprintf(stderr, fmt, ap); + va_end(ap); + if (sysv3 > 0 && sev >= 0 && fl & 010) + fprintf(stderr, "\n\t%s\n", strerror(i)); + else if (sysv3 < 0) { + if (fl & 020) + putc('\n', stderr); + else + fprintf(stderr, " (errno:%d)\n", i); + } else + fprintf(stderr, ", errno %d, %s\n", i, strerror(i)); +} + +static void +prdot(int flush) +{ + static int column; + + if (flush && column != 0 || column >= 50) { + write(action == 'o' && !Oflag ? 2 : 1, "\n", 1); + column = 0; + } + if (!flush) { + write(action == 'o' && !Oflag ? 2 : 1, ".", 1); + column++; + } +} + +/* + * Ask the user for new media if applicable, or exit. + */ +static void +newmedia(int err) +{ + static int mediacnt = 1; + static char answer[PATH_MAX+1]; + const char *mesf = action == 'i' ? + (Iflag && !sysv3 ? Iflag : "input") : + (Oflag && !sysv3 ? Oflag : "output"); + char c; + int i, j; + + if (mfl == 0 && close(mt) < 0) { + emsg(3, "Close error on \"%s\"", mesf); + errcnt++; + } + mfl = -1; + if ((mtst.st_mode&S_IFMT)!=S_IFCHR && (mtst.st_mode&S_IFMT)!=S_IFBLK || + Dflag) { + if (action == 'o') { + switch (err) { + case 0: + break; + case EFBIG: + msg(3, 0, "ulimit reached for output file.\n"); + break; + case ENOSPC: + msg(3, 0, "No space left for output file.\n"); + break; + default: + msg(3, 0, "I/O error - cannot continue, " + "errno %d, %s\n", + err, strerror(err)); + } + } + return; + } + if (err == ENOSPC || err == ENXIO || err == 0) + msg(-2, 0, sysv3 ? "Reached end of medium on %s.\a\n" : + "End of medium on \"%s\".\a\n", mesf); + else + msg(3, 0, "I/O error on \"%s\", errno %d, %s\a\n", mesf, + err, strerror(err)); + mediacnt++; + while (mfl < 0) { + if (Iflag || Oflag) + msg(-2, 0, Mflag ? Mflag : + "Change to part %d and press " + "RETURN key. [q] ", mediacnt); + else + msg(-2, 0, sysv3 ? "If you want to go on, " + "type device/file name when ready.\n" : + "To continue, type device/file name " + "when ready.\n"); + if (tty == 0) + if ((tty = open("/dev/tty", O_RDWR)) < 0 || + fcntl(tty, F_SETFD, FD_CLOEXEC) < 0) { + cantrt: errcnt++; + msg(4, 1, "Cannot read tty.\n"); + } + i = 0; + while ((j = read(tty, &c, 1)) == 1 && c != '\n') + if (i < sizeof answer - 1) + answer[i++] = c; + if (j != 1) + goto cantrt; + answer[i] = 0; + if (Iflag || Oflag) { + if (answer[0] == '\0') + snprintf(answer, sizeof answer, Iflag ? Iflag : + Oflag); + else if (answer[0] == 'q') + exit(errcnt != 0 ? sysv3 ? 1 : 2 : 0); + else if (Iflag) + Iflag = sstrdup(answer); + else if (Oflag) + Oflag = sstrdup(answer); + } else if (answer[0] == '\0') + return; + if ((mt = action == 'i' ? open(answer, O_RDONLY) : + creat(answer, 0666)) < 0) { + if (sysv3) + msg(-2, 0, "That didn't work, " + "cannot open \"%s\"\n%s\n", + answer, strerror(errno)); + else + emsg(3, "Cannot open \"%s\"", answer); + } + else + mfl = 0; + } + mstat(); +} + +static void +mclose(void) +{ + if (action == 'o' && mt >= 0 && close(mt) < 0) { + emsg(3, "Close error on \"%s\"", + Oflag && !sysv3 ? Oflag : "output"); + errcnt++; + } +} + +/* + * Write the archive buffer to tape. + */ +static ssize_t +mwrite(int max) +{ + ssize_t wo, wt = 0; + + do { + if ((wo = write(mt, blkbuf + wt, (max?max:blksiz) - wt)) < 0) { + if (errno == EINTR) { + continue; + } else { + newmedia(errno); + if (mfl == 0) { + if (fmttype & TYP_BAR) + dump_barhdr(); + continue; + } + else + done(1); + } + } + poffs += wo; + wt += wo; + } while (wt < (max?max:blksiz)); + blocks += wt >> 9; + bytes += wt & 0777; + return wt; +} + +/* + * Buffered writes to tape. + */ +static void +bwrite(const char *data, size_t sz) +{ + size_t di; + + nwritten += sz; + while (curpos + sz > blksiz) { + di = blksiz - curpos; + sz -= di; + memcpy(&blkbuf[curpos], data, di); + mwrite(0); + data += di; + curpos = 0; + } + memcpy(&blkbuf[curpos], data, sz); + curpos += sz; +} + +/* + * Flush the tape write buffer. + */ +static void +bflush(void) +{ + if (curpos) { + memset(&blkbuf[curpos], 0, blksiz - curpos); + mwrite(fmttype==FMT_ZIP && (mtst.st_mode&S_IFMT) == S_IFREG ? + curpos : 0); + } + curpos = 0; +} + +/* + * CRC format checksum calculation with -i. + */ +static int +sum(int fd, const char *fn, struct stat *sp, char *tg) +{ + char *buf; + size_t bufsize; + uint32_t size = sp->st_size, sum = 0; + ssize_t rd; + char c; + + getbuf(&buf, &bufsize, sp->st_blksize); + /* + * Unfortunately, SVR4 cpio derivatives (as on Solaris 8 and + * UnixWare 2.1) compute the checksum of signed char values, + * whereas GNU cpio and the pax implementations of AT&T and + * BSD use unsigned chars. Since there is no 'open' standard + * for the SVR4 CRC format, the SVR4 implementation should be + * taken as a de facto reference and we thus create SVR4 type + * checksums. + */ + while ((rd = read(fd, buf, size>bufsize ? bufsize : size )) > 0) { + size -= rd; + do + sum += ((signed char *)buf)[--rd]; + while (rd); + } + if (rd < 0) { + msg(3, 0, "Error computing checksum\n"); + return 1; + } + if (lseek(fd, 0, SEEK_SET) == (off_t)-1) { + emsg(3, "Cannot reset file after checksum"); + return 1; + } + c = tg[8]; + sprintf(tg, "%08lx", (long)sum); + tg[8] = c; + return 0; +} + +static int +rstime(const char *fn, struct stat *st, const char *which) +{ + struct utimbuf utb; + + utb.actime = st->st_atime; + utb.modtime = st->st_mtime; + if (pax != PAX_TYPE_CPIO && + (pax_preserve&(PAX_P_ATIME|PAX_P_MTIME)) != 0 && + (pax_preserve&PAX_P_EVERY) == 0) { + struct stat xst; + if (stat(fn, &xst) < 0) + goto fail; + if (pax_preserve&PAX_P_ATIME) + utb.actime = xst.st_atime; + if (pax_preserve&PAX_P_MTIME) + utb.modtime = xst.st_mtime; + } + if (utime(fn, &utb) < 0) { + fail: emsg(2, "Unable to reset %s time for \"%s\"", which, fn); + return 1; + } + return 0; +} + +/* + * Top-down splay function for inode tree. + */ +static struct islot * +isplay(ino_t ino, struct islot *x) +{ + struct islot hdr; + struct islot *leftmax, *rightmin; + struct islot *y; + + hdr.i_lln = hdr.i_rln = inull; + leftmax = rightmin = &hdr; + inull->i_ino = ino; + while (ino != x->i_ino) { + if (ino < x->i_ino) { + if (ino < x->i_lln->i_ino) { + y = x->i_lln; + x->i_lln = y->i_rln; + y->i_rln = x; + x = y; + } + if (x->i_lln == inull) + break; + rightmin->i_lln = x; + rightmin = x; + x = x->i_lln; + } else { + if (ino > x->i_rln->i_ino) { + y = x->i_rln; + x->i_rln = y->i_lln; + y->i_lln = x; + x = y; + } + if (x->i_rln == inull) + break; + leftmax->i_rln = x; + leftmax = x; + x = x->i_rln; + } + } + leftmax->i_rln = x->i_lln; + rightmin->i_lln = x->i_rln; + x->i_lln = hdr.i_rln; + x->i_rln = hdr.i_lln; + inull->i_ino = !ino; + return x; +} + +/* + * Find the inode number ino. + */ +static struct islot * +ifind(ino_t ino, struct islot **it) +{ + if (*it == NULL) + return NULL; + *it = isplay(ino, *it); + return (*it)->i_ino == ino ? *it : NULL; +} + +/* + * Put ik into the tree. + */ +static void +iput(struct islot *ik, struct islot **it) +{ + if ((*it) == NULL) { + ik->i_lln = ik->i_rln = inull; + (*it) = ik; + } else { + /* ifind() is always called before */ + /*(*it) = isplay(ik->i_ino, (*it));*/ + if (ik->i_ino < (*it)->i_ino) { + ik->i_lln = (*it)->i_lln; + ik->i_rln = (*it); + (*it)->i_lln = inull; + (*it) = ik; + } else if ((*it)->i_ino < ik->i_ino) { + ik->i_rln = (*it)->i_rln; + ik->i_lln = (*it); + (*it)->i_rln = inull; + (*it) = ik; + } + } +} + +/* + * Find the device dev or add it to the device/inode forest if not + * already present. + */ +static struct dslot * +dfind(struct dslot **root, dev_t dev) +{ + struct dslot *ds, *dp; + + for (ds = *root, dp = NULL; ds; dp = ds, ds = ds->d_nxt) + if (ds->d_dev == dev) + break; + if (ds == NULL) { + ds = scalloc(1, sizeof *ds); + ds->d_dev = dev; + if (*root == NULL) + *root = ds; + else + dp->d_nxt = ds; + } + return ds; +} + +/* + * Exit on fatal error conditions. + */ +static void +done(int i) +{ + if (tflag) + fflush(stdout); + errcnt += i; + mclose(); + if (errcnt && !sysv3) + fprintf(stderr, "%llu errors\n", errcnt); + exit(sysv3 ? 2 : 3); +} + +static char *pcopy, *pcend; +static size_t psz, pslen, pss; + +/* + * Execution for -p. + */ +static void +dopass(const char *target) +{ + struct stat st; + + if (access(target, W_OK) < 0) { + emsg(033, sysv3 ? "cannot write in <%s>" : + "Error during access() of \"%s\"", target); + if (sysv3) + done(1); + usage(); + } + if (stat(target, &st) < 0) { + emsg(023, "Error during stat() of \"%s\"", target); + done(1); + } + if ((st.st_mode&S_IFMT) != S_IFDIR) + msg(3, 1, sysv3 ? "<%s> not a directory.\n" : + "\"%s\" is not a directory\n", target); + getpath(target, &pcopy, &pcend, &psz, &pslen); + copyout(passfile); +} + +/* + * Callback for sfile(). + */ +/*ARGSUSED*/ +void +writerr(void *vp, int count, int written) +{ +} + +/* + * Copy file data of regular files with -p. + */ +static int +passdata(struct file *f, const char *tgt, int tfd) +{ + char *buf; + size_t bufsize; + ssize_t rd = 0; + + if (f->f_fd < 0) /* is a zero-sized unreadable file */ + return 0; +#ifdef __linux__ + if (f->f_st.st_size > 0) { + long long sent; + + sent = sfile(tfd, f->f_fd, f->f_st.st_mode, f->f_st.st_size); + blocks += (sent + 0777) >> 9; + if (sent == f->f_st.st_size) + return 0; + if (sent < 0) + goto rerr; + } +#endif /* __linux__ */ + getbuf(&buf, &bufsize, f->f_st.st_blksize); + while ((rd = read(f->f_fd, buf, bufsize)) > 0) { + blocks += (rd + 0777) >> 9; + if (write(tfd, buf, rd) != rd) { + emsg(3, "Cannot write \"%s\"", tgt); + return -1; + } + } + if (rd < 0) { +#ifdef __linux__ + rerr: +#endif /* __linux__ */ + emsg(3, "Cannot read \"%s\"", f->f_name); + return -1; + } + return 0; +} + +/* + * Handle a single file for -p. + */ +static int +passfile(const char *fn, struct stat *st) +{ + struct file f; + ssize_t sz; + int val; + char *newfn; + size_t newsz = 0; + + newfn = sstrdup(fn); + if (pax != PAX_TYPE_CPIO) { + if (pax_sflag && pax_sname(&newfn, &newsz) == 0) + return 0; + if (rflag && rname(&newfn, &newsz) == 0) + return 0; + } + setpath(newfn, &pcopy, &pcend, pslen, &psz, &pss); + free(newfn); + memset(&f, 0, sizeof f); + f.f_name = sstrdup(fn); + f.f_nsiz = strlen(fn) + 1; + f.f_st = *st; + f.f_fd = -1; + if ((st->st_mode&S_IFMT) == S_IFLNK) { + sz = st->st_size ? st->st_size : PATH_MAX; + f.f_lnam = smalloc(sz+1); + if ((sz = readlink(fn, f.f_lnam, sz+1)) < 0) { + emsg(3, "Cannot read symbolic link \"%s\"", fn); + free(f.f_lnam); + return 1; + } + f.f_lnam[sz] = '\0'; + } else if ((st->st_mode&S_IFMT) == S_IFREG) { + if ((f.f_fd = open(fn, O_RDONLY)) < 0) { + if (sysv3) + msg(2, 0, "Cannot open file \"%s\".\n", fn); + else + emsg(2, "Cannot open \"%s\", skipped", fn); + if (st->st_size != 0) + return 1; + } + } + val = filein(&f, passdata, pcopy); + if (f.f_lnam) + free(f.f_lnam); + free(f.f_name); + if (f.f_fd >= 0) + close(f.f_fd); + if (val <= 1 && aflag && (st->st_mode&S_IFMT) == S_IFREG) + errcnt += rstime(fn, st, "access"); + return val != 0; +} + +/* + * Processing of a single file common to -i and -p. Return value: 0 if + * successful, 1 at failure if data was read, 2 at failure if no data + * was read. + */ +static int +filein(struct file *f, int (*copydata)(struct file *, const char *, int), + char *tgt) +{ + struct stat nst; + char *temp = NULL; + size_t len; + int fd, i, j, new; + int failure = 2; + + if (fmttype == FMT_ZIP && (f->f_st.st_mode&S_IFMT) != S_IFREG && + (f->f_st.st_mode&S_IFMT) != S_IFLNK && + (f->f_csize > 0 || f->f_gflag & FG_DESC)) + skipfile(f); + if ((new = lstat(tgt, &nst)) == 0) { + if (action == 'p' && f->f_st.st_dev == nst.st_dev && + f->f_st.st_ino == nst.st_ino) { + msg(3, 0, sysv3 ? + "Attempt to pass file to self!\n" : + "Attempt to pass a file to itself.\n"); + return 1; + } + if ((f->f_st.st_mode&S_IFMT) == S_IFDIR) { + if ((nst.st_mode&S_IFMT) == S_IFDIR) + return setattr(tgt, &f->f_st); + rmdir(tgt); + } else { + if (pax_kflag) { + failure = 0; + goto skip; + } + if (uflag == 0 && f->f_st.st_mtime <= nst.st_mtime) { + if (pax == PAX_TYPE_CPIO) + msg(-1, 0, sysv3 ? + "current <%s> newer or same age\n" : + "Existing \"%s\" same age or newer\n", + tgt); + else + failure = 0; + goto skip; + } + } + } else { + if (imdir(tgt) < 0) + goto skip; + } + if (Vflag && !vflag) + prdot(0); + if ((f->f_st.st_mode&S_IFMT) != S_IFDIR && lflag) { + if (Lflag) { + char *symblink, *name; + struct stat xst; + name = f->f_name; + for (;;) { + if (lstat(name, &xst) < 0) { + emsg(3, "Cannot lstat \"%s\"", name); + if (name != f->f_name) + free(name); + goto cantlink; + } + if ((xst.st_mode&S_IFMT) != S_IFLNK) + break; + i = xst.st_size ? xst.st_size : PATH_MAX; + symblink = smalloc(i+1); + if ((j = readlink(name, symblink, i)) < 0) { + emsg(3, "Cannot read symbolic link " + "\"%s\"", name); + free(symblink); + if (name != f->f_name) + free(name); + goto cantlink; + } + symblink[j] = '\0'; + symblink = joinpath(name, symblink); + if (name != f->f_name) + free(name); + name = symblink; + } + if (linkunlink(name, tgt) == 0) { + if (vflag) + fprintf(stderr, "%s\n", tgt); + if (name != f->f_name) + free(name); + return 0; + } + if (name != f->f_name) + free(name); + } else if (linkunlink(f->f_name, tgt) == 0) { + if (vflag) + fprintf(stderr, "%s\n", tgt); + return 0; + } +cantlink: errcnt += 1; + } + if ((f->f_st.st_mode&S_IFMT) != S_IFDIR && f->f_st.st_nlink > 1 && + (fmttype & TYP_CPIO || fmttype == FMT_ZIP + || action == 'p') && + (i = canlink(tgt, &f->f_st, 1)) != 0) { + if (i < 0) + goto skip; + /* + * At this point, hard links in SVR4 cpio format have + * been reordered and data is associated with the first + * link; remaining links have st_size == 0 so don't + * overwrite the data here. + */ + if (fmttype & TYP_NCPIO && f->f_st.st_size == 0 || + (f->f_st.st_mode&S_IFMT) != S_IFREG) { + if (vflag) + fprintf(stderr, "%s\n", f->f_name); + return 0; + } + /* + * Make sure we can creat() this file later. + */ + chmod(tgt, 0600); + } else if (fmttype & TYP_TAR && f->f_st.st_nlink > 1) { + if (linkunlink(f->f_lnam, f->f_name) == 0) { + if (fmttype & TYP_USTAR && f->f_st.st_size > 0) + chmod(tgt, 0600); + else { + if (vflag) + fprintf(stderr, "%s\n", f->f_name); + return 0; + } + } else { + goto restore; + } + } else if (new == 0 && (f->f_st.st_mode&S_IFMT) != S_IFDIR) { + len = strlen(tgt); + temp = smalloc(len + 7); + strcpy(temp, tgt); + strcpy(&temp[len], "XXXXXX"); + if ((fd = mkstemp(temp)) < 0 || close(fd) < 0) { + emsg(3, "Cannot create temporary file"); + if (fd < 0) { + free(temp); + temp = NULL; + } + goto skip; + } + cur_ofile = tgt; + cur_tfile = temp; + if (rename(tgt, temp) < 0) { + emsg(3, "Cannot rename current \"%s\"", tgt); + tunlink(&temp); + goto skip; + } + } + switch (f->f_st.st_mode & S_IFMT) { + case S_IFDIR: + if (!dflag) { + if (action == 'p') + msg(-1, 0, "Use -d option to copy \"%s\"\n", + f->f_name); + goto restore; + } + if (mkdir(tgt, 0777) < 0 && errno != EEXIST) { + emsg(-1, "Cannot create directory \"%s\"", tgt); + goto restore; + } + break; + case S_IFLNK: + if (symlink(f->f_lnam, tgt) < 0) { + emsg(3, "Cannot create \"%s\"", tgt); + goto restore; + } + break; + case S_IFREG: + if (temp && f->f_fd < 0) + goto restore; + cur_ofile = tgt; + if ((fd = (compressed_bar ? zcreat : creat)(tgt, + f->f_st.st_mode & 0777)) < 0) { + emsg(3, "Cannot create \"%s\"", tgt); + goto skip; + } + failure = 1; + if (copydata(f, tgt, fd) != 0) { + close(fd); + goto restore; + } + if ((compressed_bar ? zclose : close)(fd) < 0) { + emsg(3, "Close error on \"%s\"", tgt); + goto restore; + } + break; + case S_IFBLK: + case S_IFCHR: + case S_IFIFO: + case S_IFNAM: + case S_IFNWK: + if (mknod(tgt, f->f_st.st_mode&(S_IFMT|0777), + f->f_st.st_rdev) < 0) { + emsg(3, "Cannot mknod() \"%s\"", tgt); + goto restore; + } + break; + default: + msg(-1, 0, "Impossible file type\n"); + goto skip; + } + if (vflag) + fprintf(stderr, "%s\n", f->f_name); + tunlink(&temp); + return setattr(tgt, &f->f_st); +skip: if (copydata == indata) + skipdata(f, copydata); +restore: + if (temp) { + if (rename(temp, tgt) < 0) { + emsg(3, "Cannot recover original version of \"%s\"", + tgt); + tunlink(&temp); + } else + fprintf(stderr, "Restoring existing \"%s\"\n", tgt); + cur_tfile = cur_ofile = NULL; + } + return failure; +} + +static int +linkunlink(const char *path1, const char *path2) +{ + int twice = 0; + + do { + if (link(path1, path2) == 0) { + if (vflag && pax == PAX_TYPE_CPIO) + printf("%s linked to %s\n", path1, path2); + return 0; + } + if (errno == EEXIST && unlink(path2) < 0) + emsg(3, sysv3 ? "cannot unlink <%s>" : + "Error cannot unlink \"%s\"", path2); + } while (twice++ == 0); + emsg(023, sysv3 ? "Cannot link <%s> & <%s>" : + "Cannot link \"%s\" and \"%s\"", path1, path2); + return -1; +} + +static void +tunlink(char **fn) +{ + cur_tfile = cur_ofile = NULL; + if (*fn) { + if (unlink(*fn) < 0) + emsg(3, "Cannot unlink() temp file \"%s\"", *fn); + free(*fn); + *fn = NULL; + } +} + +/* + * For -it[v] option. + */ +static int +filet(struct file *f, int (*copydata)(struct file *, const char *, int)) +{ + if (vflag && ( + (fmttype == FMT_ZIP && f->f_gflag & FG_DESC && + (f->f_cmethod == C_DEFLATED || f->f_cmethod == C_ENHDEFLD) && + (f->f_gflag & FG_CRYPT) == 0) || + f->f_Kbase)) { + /* + * Need to read zip data descriptor located after the + * file contents in order to know the file size. Or + * need to read second header of -K archive. + */ + int i; + i = skipdata(f, copydata); + filev(f); + return i; + } + if (vflag) + filev(f); + else + puts(f->f_name); + return skipdata(f, copydata); +} + +static void +filev(struct file *f) +{ + const char *cp; + long c; + + if (pax == PAX_TYPE_CPIO && fmttype & TYP_TAR && f->f_st.st_nlink > 1) + printf("%s linked to %s\n", f->f_lnam, f->f_name); + if (sysv3) + printf("%-6o", (int)f->f_st.st_mode&(07777|S_IFMT)); + else { + c = typec(&f->f_st); + putchar(c); + permbits(f->f_st.st_mode); + } + if (fmttype == FMT_ZIP && vflag > 1) + zipinfo(f); + else { + if (sysv3 == 0) + printf(" %3d", fmttype&TYP_TAR && + (f->f_st.st_mode&S_IFMT) == S_IFLNK ? + 2 : (int)f->f_st.st_nlink); + if ((cp = getuser(f->f_st.st_uid)) != NULL) + printf(sysv3 ? " %-6s" : " %-8s", cp); + else + printf(sysv3 ? " %-6lu" : " %-8lu", + (long)f->f_st.st_uid); + if (sysv3 == 0) { + if ((cp = getgroup(f->f_st.st_gid)) != NULL) + printf(" %-8s", cp); + else + printf(" %-8lu", (long)f->f_st.st_gid); + } + } + if (sysv3 || (f->f_st.st_mode&S_IFMT)!=S_IFCHR && + (f->f_st.st_mode&S_IFMT)!=S_IFBLK && + (f->f_st.st_mode&S_IFMT)!=S_IFNAM && + (f->f_st.st_mode&S_IFMT)!=S_IFNWK) + printf(pax != PAX_TYPE_CPIO ? "%8llu" : + sysv3 ? "%7llu" : " %-7llu", f->f_dsize); + else + printf(" %3lu,%3lu", (long)f->f_rmajor, (long)f->f_rminor); + prtime(f->f_st.st_mtime); + printf("%s", f->f_name); + if ((f->f_st.st_mode&S_IFMT) == S_IFLNK) + printf(" -> %s", f->f_lnam); + if (pax != PAX_TYPE_CPIO && (f->f_st.st_mode&S_IFMT) != S_IFDIR && + f->f_st.st_nlink>1) { + if (fmttype & TYP_TAR) + printf(" == %s", f->f_lnam); + else + canlink(f->f_name, &f->f_st, 0); + } + putchar('\n'); +} + +static int +typec(struct stat *st) +{ + switch (st->st_mode&S_IFMT) { + case S_IFREG: + return '-'; + case S_IFDIR: + return 'd'; + case S_IFLNK: + return 'l'; + case S_IFCHR: + return 'c'; + case S_IFBLK: + return 'b'; + case S_IFIFO: + return 'p'; + case S_IFNWK: + return 'n'; + case S_IFNAM: + switch (st->st_rdev) { + case S_INSEM: + return 's'; + case S_INSHD: + return 'm'; + } + /*FALLTHRU*/ + default: + msg(-1, 0, "Impossible file type\n"); + errcnt++; + return '-'; + } +} + +static void +permbits(mode_t mode) +{ + mode_t mask = 0700, shft = 6; + + while (mask) { + if (((mode & mask) >> shft) & 04) + putchar('r'); + else + putchar('-'); + if (((mode & mask) >> shft) & 02) + putchar('w'); + else + putchar('-'); + if (mask == 0700 && mode & 04000) + putchar('s'); + else if (mask == 0070 && (mode & 02010) == 02010) + putchar('s'); + else if (mask == 0070 && mode & 02000) + putchar('l'); + else if (mask == 0007 && mode & 01000) + putchar('t'); + else if (((mode & mask) >> shft) & 01) + putchar('x'); + else + putchar('-'); + mask >>= 3; + shft -= 3; + } +} + +static void +prtime_cpio(time_t t) +{ + char b[30]; + + strftime(b, sizeof b, sysv3 ? "%b %e %H:%M:%S %Y" : "%b %e %H:%M %Y", + localtime(&t)); + printf(sysv3 ? " %s " : " %s, ", b); +} + +/* + * Prepare path to add names of files below it later. + */ +static void +getpath(const char *path, char **file, char **filend, size_t *sz, size_t *slen) +{ + *sz = 14 + strlen(path) + 2; + *file = smalloc(*sz); + *filend = *file; + if (path[0] == '/' && path[1] == '\0') + *(*filend)++ = '/'; + else { + const char *cp = path; + while ((*(*filend)++ = *cp++) != '\0'); + (*filend)[-1] = '/'; + } + *slen = *filend - *file; +} + +/* + * Concatenate base (prepared with getpath()) and file. + */ +static void +setpath(const char *base, char **file, char **filend, + size_t slen, size_t *sz, size_t *ss) +{ + if (slen + (*ss = strlen(base)) >= *sz) { + *sz += slen + *ss + 15; + *file = srealloc(*file, *sz); + *filend = &(*file)[slen]; + } + strcpy(*filend, base); +} + +/* + * Create intermediate directories with -m. + */ +static int +imdir(char *fn) +{ + struct stat st; + char *cp; + int dfl = dflag != 0; + + for (cp = fn; *cp == '/'; cp++); + do { + while (*cp && *cp != '/') + cp++; + if (*cp == '/') { + *cp = '\0'; + if (stat(fn, &st) < 0) { + if (dfl) { + if (mkdir(fn, 0777) < 0) { + *cp = '/'; + emsg(-1, "Cannot create " + "directory for \"%s\"", + fn); + return -1; + } + } else { + msg(-1, 0, sysv3 ? + "missing 'd' option\n" : + "Missing -d option\n"); + dfl = 2; + } + } + *cp = '/'; + while (*cp == '/') + cp++; + } + } while (*cp); + return 0; +} + +/* + * Set file attributes and make sure that suid/sgid bits are only restored + * if the owner is the same as on the tape. + */ +static int +setattr(const char *fn, struct stat *st) +{ + mode_t mode = st->st_mode & 07777; + uid_t uid = Rflag ? Ruid : myuid; + gid_t gid = Rflag ? Rgid : mygid; + + if ((pax != PAX_TYPE_CPIO || myuid == 0) && + (pax == PAX_TYPE_CPIO || + pax_preserve&(PAX_P_OWNER|PAX_P_EVERY))) { + if (setowner(fn, st) != 0) + return 1; + } + if (pax != PAX_TYPE_CPIO && + (pax_preserve&(PAX_P_OWNER|PAX_P_EVERY)) == 0) + mode &= ~(mode_t)(S_ISUID|S_ISGID); + if (myuid != 0 || Rflag) { + if (st->st_uid != uid || st->st_gid != gid) { + mode &= ~(mode_t)S_ISUID; + if ((st->st_mode&S_IFMT) != S_IFDIR && mode & 0010) + mode &= ~(mode_t)S_ISGID; + if ((st->st_mode&S_IFMT) == S_IFDIR && st->st_gid!=gid) + mode &= ~(mode_t)S_ISGID; + } + } + if ((st->st_mode&S_IFMT) == S_IFLNK) + return 0; + if (hp_Uflag) + mode &= ~umsk|S_IFMT; + if (pax != PAX_TYPE_CPIO && + (pax_preserve&(PAX_P_MODE|PAX_P_OWNER|PAX_P_EVERY))==0) + mode &= 01777|S_IFMT; + if ((pax == PAX_TYPE_CPIO || pax_preserve&(PAX_P_MODE|PAX_P_EVERY)) && + chmod(fn, mode) < 0) { + emsg(2, "Cannot chmod() \"%s\"", fn); + return 1; + } + if (pax != PAX_TYPE_CPIO ? + (pax_preserve&(PAX_P_ATIME|PAX_P_MTIME|PAX_P_EVERY)) != + (PAX_P_ATIME|PAX_P_MTIME) : mflag) + return rstime(fn, st, "modification"); + else + return 0; +} + +static int +setowner(const char *fn, struct stat *st) +{ + uid_t uid = Rflag ? Ruid : myuid ? myuid : st->st_uid; + gid_t gid = Rflag ? Rgid : st->st_gid; + + if (((st->st_mode&S_IFMT)==S_IFLNK?lchown:chown)(fn, uid, gid) < 0) { + emsg(2, "Cannot chown() \"%s\"", fn); + return 1; + } + if (pax >= PAX_TYPE_PAX2001 && myuid && myuid != st->st_uid && + pax_preserve & (PAX_P_OWNER|PAX_P_EVERY)) { + /* + * Do not even try to preserve user ownership in this case. + * It would either fail, or, without _POSIX_CHOWN_RESTRICTED, + * leave us with a file we do not own and which we thus could + * not chmod() later. + */ + errno = EPERM; + emsg(2, "Cannot chown() \"%s\"", fn); + return 1; + } + return 0; +} + +/* + * For -i and -p: Check if device/inode have been created already and + * if so, link path (or print the link name). + */ +static int +canlink(const char *path, struct stat *st, int really) +{ + struct dslot *ds; + struct islot *ip; + + ds = dfind(&devices, st->st_dev); + if ((ip = ifind(st->st_ino, &ds->d_isl)) == NULL || + ip->i_name == NULL) { + if (ip == NULL) { + ip = scalloc(1, sizeof *ip); + ip->i_ino = st->st_ino; + if ((fmttype&(TYP_NCPIO|TYP_TAR)) == 0) + ip->i_nlk = st->st_nlink; + iput(ip, &ds->d_isl); + } + ip->i_name = sstrdup(path); + } else { + if ((fmttype&(TYP_NCPIO|TYP_TAR)) == 0) { + /* + * If an archive inode has more links than given in + * st_nlink, write a new disk inode. See the comments + * to storelink() for the rationale. + */ + if (--ip->i_nlk == 0) { + free(ip->i_name); + ip->i_name = sstrdup(path); + ip->i_nlk = st->st_nlink; + return 0; + } + } + if (really) { + /* + * If there was file data before the last link with + * SVR4 cpio formats, do not create a hard link. + */ + if (fmttype & TYP_NCPIO && ip->i_nlk == 0) + return 0; + if (linkunlink(ip->i_name, path) == 0) + return 1; + else + return -1; + } else { + printf(" == %s", ip->i_name); + return 1; + } + } + return 0; +} + +/* + * Execution for -i. + */ +static void +doinp(void) +{ + union bincpio bc; + struct file f; + int n; + + memset(&f, 0, sizeof f); + if (Eflag) + patfile(); + if (Iflag) { + if ((mt = open(Iflag, O_RDONLY)) < 0) { + if (sysv3) { + emsg(3, "Cannot open <%s> for input.", Iflag); + done(1); + } + else + msg(3, -2, "Cannot open \"%s\" for input\n", + Iflag); + } + } else + mt = dup(0); + mstat(); + blkbuf = svalloc(blksiz, 1); + if ((n = mread()) == 0) + unexeoa(); + else if (n < 0) { + emsg(3, "Read error on \"%s\"", + Iflag && !sysv3 ? Iflag : "input"); + done(1); + } + if (kflag == 0 && sixflag == 0) + fmttype = FMT_NONE; + if (fmttype == FMT_NONE) + whathdr(); + else + formatforced = 1; + while (readhdr(&f, &bc) == 0) { + if (fmttype & TYP_NCPIO && f.f_st.st_nlink > 1 && + (f.f_st.st_mode&S_IFMT) != S_IFDIR) { + if (f.f_st.st_size != 0) + flushlinks(&f); + else + storelink(&f); + } else + inpone(&f, 1); + f.f_Kbase = f.f_Krest = f.f_Ksize = 0; + f.f_oflag = 0; + } + if (fmttype & TYP_NCPIO) + flushrest(f.f_pad); +} + +/* + * SVR4 cpio link handling with -i; called if we assume that more links + * to this file will follow. + */ +static void +storelink(struct file *f) +{ + struct dslot *ds; + struct islot *ip; + struct ilink *il, *iz; + + ds = dfind(&devices, f->f_st.st_dev); + if ((ip = ifind(f->f_st.st_ino, &ds->d_isl)) == NULL) { + ip = scalloc(1, sizeof *ip); + ip->i_ino = f->f_st.st_ino; + ip->i_nlk = f->f_st.st_nlink; + ip->i_st = smalloc(sizeof *ip->i_st); + *ip->i_st = f->f_st; + iput(ip, &ds->d_isl); + } else { + if (ip->i_nlk == 0) { + /* + * More links to an inode than given in the first + * st_nlink occurence are found within this archive. + * This happens if -L was specified and soft links + * point to a file with multiple hard links. We do + * the same as SVR4 cpio implementations here and + * associate these links with a new inode, since it + * is related to the way a file with a single hard + * link but referenced by soft links is unpacked. + */ + ip->i_nlk = f->f_st.st_nlink; + if (ip->i_name) + free(ip->i_name); + ip->i_name = NULL; + ip->i_st = smalloc(sizeof *ip->i_st); + *ip->i_st = f->f_st; + } else if (ip->i_nlk <= 2) { + /* + * We get here if + * - a file with multiple links is empty; + * - a broken implementation has stored file data + * before the last link; + * - a linked file has been added to the archive later + * again (does not happen with our implementation). + */ + flushnode(ip, f); + return; + } else + ip->i_nlk--; + } + for (il = ip->i_lnk, iz = NULL; il; il = il->l_nxt) + iz = il; + il = scalloc(1, sizeof *il); + il->l_siz = strlen(f->f_name) + 1; + il->l_nam = smalloc(il->l_siz); + strcpy(il->l_nam, f->f_name); + if (iz) + iz->l_nxt = il; + else + ip->i_lnk = il; +} + +/* + * Flush all links of a file with SVR4 cpio format and -i. + */ +static void +flushlinks(struct file *f) +{ + struct dslot *ds; + struct islot *ip; + + ds = dfind(&devices, f->f_st.st_dev); + ip = ifind(f->f_st.st_ino, &ds->d_isl); + flushnode(ip, f); +} + +/* + * Data of a multi-linked file shall be transferred now for SVR4 cpio + * format and -i. + */ +static void +flushnode(struct islot *ip, struct file *f) +{ + struct file nf; + struct ilink *il, *iz; + + f->f_dsize = f->f_st.st_size; + if (ip && ip->i_nlk > 0) { + /* + * Write out the file data with the first link the user + * wants to be extracted, but show the same display size + * for all links. + */ + for (il = ip->i_lnk, iz = NULL; il; + iz = il, il = il->l_nxt, iz ? free(iz), 0 : 0) { + memset(&nf, 0, sizeof nf); + nf.f_name = il->l_nam; + nf.f_nsiz = il->l_siz; + nf.f_st = f->f_st; + nf.f_chksum = f->f_chksum; + nf.f_pad = f->f_pad; + nf.f_dsize = f->f_dsize; + if (inpone(&nf, 0) == 0) { + f->f_chksum = 0; + f->f_st.st_size = 0; + } + free(il->l_nam); + } + ip->i_lnk = NULL; + if (ip->i_st) + free(ip->i_st); + ip->i_st = NULL; + } + if (f->f_name) + inpone(f, 1); + if (ip) { + if (ip->i_nlk <= 2 && ip->i_name) { + free(ip->i_name); + ip->i_name = NULL; + } + ip->i_nlk = 0; + } +} + +/* + * This writes all remaining multiply linked files, i. e. those with + * st_size == 0 and st_nlink > number of links within the archive. + */ +static void +flushrest(int pad) +{ + struct dslot *ds; + + for (ds = devices; ds; ds = ds->d_nxt) + if (ds->d_isl != NULL) + flushtree(ds->d_isl, pad); +} + +static void +flushtree(struct islot *ip, int pad) +{ + struct file f; + + if (ip == inull) + return; + flushtree(ip->i_lln, pad); + flushtree(ip->i_rln, pad); + if (ip->i_nlk > 0 && ip->i_st) { + memset(&f, 0, sizeof f); + f.f_st = *ip->i_st; + f.f_pad = pad; + flushnode(ip, &f); + } +} + +/* + * See if the user wants to have this file with -i, and extract it or + * skip its data on the tape. + */ +static int +inpone(struct file *f, int shallskip) +{ + struct glist *gp = NULL, *gb = NULL; + int val = -1, selected = 0; + + if ((patterns == NULL || (gp = want(f, &gb)) != NULL ^ fflag) && + pax_track(f->f_name, f->f_st.st_mtime)) { + selected = 1; + if ((pax_sflag == 0 || pax_sname(&f->f_name, &f->f_nsiz)) && + (rflag == 0 || rname(&f->f_name, &f->f_nsiz))) { + errcnt += infile(f); + val = 0; + } + } else if (shallskip) + errcnt += skipfile(f); + if (gp != NULL && selected) { + gp->g_gotcha = 1; + if (gp->g_nxt && gp->g_nxt->g_art) + gp->g_nxt->g_gotcha = 1; + else if (gp->g_art && gb) + gb->g_gotcha = 1; + } + return val; +} + +/* + * Read the header for a file with -i. Return values: 0 okay, 1 end of + * archive, -1 failure. + */ +static int +readhdr(struct file *f, union bincpio *bp) +{ + long namlen, l1, l2, rd, hsz; + static long attempts; + long long skipped = 0; + + if (fmttype & TYP_TAR) { + if (f->f_name) + f->f_name[0] = '\0'; + if (f->f_lnam) + f->f_lnam[0] = '\0'; + } + paxrec = globrec; +retry: f->f_st = globst; +retry2: if (fmttype & TYP_BINARY) { + hsz = SIZEOF_hdr_cpio; + if (attempts == 0 && bread(bp->data, hsz) != hsz) + unexeoa(); + if ((fmttype&TYP_BE ? pbe16(bp->Hdr.c_magic) : + ple16(bp->Hdr.c_magic)) != mag_bin) + goto badhdr; + if (fmttype & TYP_BE) { + f->f_st.st_dev = pbe16(bp->Hdr.c_dev)&0177777; + f->f_st.st_ino = pbe16(bp->Hdr.c_ino)&0177777; + f->f_st.st_mode = pbe16(bp->Hdr.c_mode); + } else { + f->f_st.st_dev = ple16(bp->Hdr.c_dev)&0177777; + f->f_st.st_ino = ple16(bp->Hdr.c_ino)&0177777; + f->f_st.st_mode = ple16(bp->Hdr.c_mode); + } + if (sixflag) { + /* + * relevant Unix 6th Edition style mode bits + * (according to /usr/sys/inode.h, untested:) + * + * 060000 IFMT type of file + * 040000 IFDIR directory + * 020000 IFCHR character special + * 060000 IFBLK block special, 0 is regular + * 007777 permission bits as today + */ + f->f_st.st_mode &= 067777; + if ((f->f_st.st_mode & 060000) == 0) + f->f_st.st_mode |= S_IFREG; + } + if (fmttype & TYP_BE) { + f->f_st.st_uid = pbe16(bp->Hdr.c_uid)&0177777; + f->f_st.st_gid = pbe16(bp->Hdr.c_gid)&0177777; + f->f_st.st_nlink = pbe16(bp->Hdr.c_nlink)&0177777; + f->f_st.st_mtime = pbe32(bp->Hdr.c_mtime); + f->f_st.st_rdev = pbe16(bp->Hdr.c_rdev); + namlen = pbe16(bp->Hdr.c_namesize); + f->f_st.st_size = pbe32(bp->Hdr.c_filesize)&0xFFFFFFFF; + } else { + f->f_st.st_uid = ple16(bp->Hdr.c_uid)&0177777; + f->f_st.st_gid = ple16(bp->Hdr.c_gid)&0177777; + f->f_st.st_nlink = ple16(bp->Hdr.c_nlink)&0177777; + f->f_st.st_mtime = pme32(bp->Hdr.c_mtime); + f->f_st.st_rdev = ple16(bp->Hdr.c_rdev); + namlen = ple16(bp->Hdr.c_namesize); + f->f_st.st_size = pme32(bp->Hdr.c_filesize)&0xFFFFFFFF; + } + f->f_rmajor = major(f->f_st.st_rdev); + f->f_rminor = minor(f->f_st.st_rdev); + if ((f->f_st.st_rdev&0xFFFF) == 0xFFFF && + f->f_st.st_size > 0 && + ((f->f_st.st_mode&S_IFMT) == S_IFBLK || + (f->f_st.st_mode&S_IFMT) == S_IFCHR && + (!formatforced || fmttype & TYP_SGI))) { + fmttype |= TYP_SGI; + f->f_rmajor = (f->f_st.st_size&0xFFFC0000)>>18; + f->f_rminor = f->f_st.st_size&0x0003FFFF; + f->f_st.st_rdev = makedev(f->f_rmajor, f->f_rminor); + f->f_st.st_size = 0; + } + if ((f->f_st.st_mode&S_IFMT) == S_IFREG && + f->f_st.st_size&0x80000000 && + (!formatforced || fmttype & TYP_SGI)) { + fmttype |= TYP_SGI; + f->f_Ksize = f->f_st.st_size&0xFFFFFFFF; + f->f_Kbase = (0x100000000LL-f->f_st.st_size) * + 0x80000000; + f->f_st.st_size = 0; + } + f->f_pad = 2; + rd = SIZEOF_hdr_cpio; + } else if (fmttype == FMT_ODC) { + hsz = SIZEOF_c_hdr; + if (attempts == 0 && bread(bp->data, hsz) != hsz) + unexeoa(); + if(memcmp(bp->Cdr.c_magic, mag_odc, sizeof mag_odc)) + goto badhdr; + f->f_st.st_dev = rdoct(bp->Cdr.c_dev, 6); + f->f_st.st_ino = rdoct(bp->Cdr.c_ino, 6); + f->f_st.st_mode = rdoct(bp->Cdr.c_mode, 6); + f->f_st.st_uid = rdoct(bp->Cdr.c_uid, 6); + f->f_st.st_gid = rdoct(bp->Cdr.c_gid, 6); + f->f_st.st_nlink = rdoct(bp->Cdr.c_nlink, 6); + f->f_st.st_rdev = rdoct(bp->Cdr.c_rdev, 6); + f->f_rmajor = major(f->f_st.st_rdev); + f->f_rminor = minor(f->f_st.st_rdev); + f->f_st.st_mtime = rdoct(bp->Cdr.c_mtime, 11); + namlen = rdoct(bp->Cdr.c_namesz, 6); + f->f_st.st_size = rdoct(bp->Cdr.c_filesz, 11); + f->f_pad = 1; + rd = SIZEOF_c_hdr; + } else if (fmttype == FMT_DEC) { + hsz = SIZEOF_d_hdr; + if (attempts == 0 && bread(bp->data, hsz) != hsz) + unexeoa(); + if(memcmp(bp->Ddr.d_magic, mag_odc, sizeof mag_odc)) + goto badhdr; + f->f_st.st_dev = rdoct(bp->Ddr.d_dev, 6); + f->f_st.st_ino = rdoct(bp->Ddr.d_ino, 6); + f->f_st.st_mode = rdoct(bp->Ddr.d_mode, 6); + f->f_st.st_uid = rdoct(bp->Ddr.d_uid, 6); + f->f_st.st_gid = rdoct(bp->Ddr.d_gid, 6); + f->f_st.st_nlink = rdoct(bp->Ddr.d_nlink, 6); + f->f_rmajor = rdoct(bp->Ddr.d_rmaj, 8); + f->f_rminor = rdoct(bp->Ddr.d_rmin, 8); + f->f_st.st_rdev = makedev(f->f_rmajor, f->f_rminor); + f->f_st.st_mtime = rdoct(bp->Ddr.d_mtime, 11); + namlen = rdoct(bp->Ddr.d_namesz, 6); + f->f_st.st_size = rdoct(bp->Ddr.d_filesz, 11); + f->f_pad = 1; + rd = SIZEOF_d_hdr; + } else if (fmttype & TYP_NCPIO) { + hsz = SIZEOF_Exp_cpio_hdr; + if (attempts == 0 && bread(bp->data, hsz) != hsz) + unexeoa(); + if (memcmp(bp->Edr.E_magic, mag_asc, sizeof mag_asc) && + memcmp(bp->Edr.E_magic, mag_crc, sizeof mag_crc)) + goto badhdr; + f->f_st.st_ino = rdhex(bp->Edr.E_ino, 8); + f->f_st.st_mode = rdhex(bp->Edr.E_mode, 8); + f->f_st.st_uid = rdhex(bp->Edr.E_uid, 8); + f->f_st.st_gid = rdhex(bp->Edr.E_gid, 8); + f->f_st.st_nlink = rdhex(bp->Edr.E_nlink, 8); + f->f_st.st_mtime = rdhex(bp->Edr.E_mtime, 8); + f->f_st.st_size = rdhex(bp->Edr.E_filesize, 8); + l1 = rdhex(bp->Edr.E_maj, 8); + l2 = rdhex(bp->Edr.E_min, 8); + f->f_st.st_dev = makedev(l1, l2); + f->f_rmajor = rdhex(bp->Edr.E_rmaj, 8); + f->f_rminor = rdhex(bp->Edr.E_rmin, 8); + f->f_st.st_rdev = makedev(f->f_rmajor, f->f_rminor); + namlen = rdhex(bp->Edr.E_namesize, 8); + f->f_chksum = rdhex(bp->Edr.E_chksum, 8); + f->f_pad = 4; + rd = SIZEOF_Exp_cpio_hdr; + } else if (fmttype & TYP_CRAY) { + int diff5 = fmttype==FMT_CRAY5 ? CRAY_PARAMSZ : 0; + hsz = SIZEOF_cray_hdr - diff5; + if (attempts == 0 && bread(bp->data, hsz) != hsz) + unexeoa(); + if (pbe64(bp->Crayhdr.C_magic) != mag_bin) + goto badhdr; + f->f_st.st_dev = pbe64(bp->Crayhdr.C_dev); + f->f_st.st_ino = pbe64(bp->Crayhdr.C_ino); + f->f_st.st_mode = pbe64(bp->Crayhdr.C_mode); + /* + * Some of the S_IFMT bits on Cray UNICOS 9 differ from + * the common Unix values, namely: + * + * S_IFLNK 0130000 symbolic link + * S_IFOFD 0110000 off line, with data + * S_IFOFL 0120000 off line, with no data + * + * We treat the latter ones as regular files. + */ + if ((f->f_st.st_mode&S_IFMT) == 0130000) + f->f_st.st_mode = f->f_st.st_mode&07777|S_IFLNK; + else if ((f->f_st.st_mode&S_IFMT) == 0110000 || + (f->f_st.st_mode&S_IFMT) == 0120000) + f->f_st.st_mode = f->f_st.st_mode&07777|S_IFREG; + f->f_st.st_uid = pbe64(bp->Crayhdr.C_uid); + f->f_st.st_gid = pbe64(bp->Crayhdr.C_gid); + f->f_st.st_nlink = pbe64(bp->Crayhdr.C_nlink); + f->f_st.st_mtime = pbe64(bp->Crayhdr.C_mtime - diff5); + f->f_st.st_rdev = pbe64(bp->Crayhdr.C_rdev); + f->f_rmajor = major(f->f_st.st_rdev); + f->f_rminor = minor(f->f_st.st_rdev); + f->f_st.st_size = pbe64(bp->Crayhdr.C_filesize - diff5); + namlen = pbe64(bp->Crayhdr.C_namesize - diff5); + f->f_pad = 1; + rd = SIZEOF_cray_hdr - diff5; + } else if (fmttype & TYP_BAR) { + hsz = 512; + if (attempts == 0 && bread(bp->data, hsz) != hsz) + unexeoa(); + if (bp->data[SIZEOF_bar_header] == '\0') { + if (kflag && !allzero(bp->data, hsz)) + goto badhdr; + return 1; + } + if (trdsum(bp) != 0 && kflag == 0) + goto badhdr; + bp->data[512] = bp->data[513] = '\0'; + if (f->f_name == NULL || f->f_name[0] == '\0') { + if (f->f_nsiz < 512) { + free(f->f_name); + f->f_name = smalloc(f->f_nsiz = 512); + } + strcpy(f->f_name, &bp->data[SIZEOF_bar_header]); + } + namlen = strlen(f->f_name) + 1; + f->f_st.st_mode = rdoct(bp->Bdr.b_mode, 8); + f->f_st.st_uid = rdoct(bp->Bdr.b_uid, 8); + f->f_st.st_gid = rdoct(bp->Bdr.b_gid, 8); + f->f_st.st_size = rdoct(bp->Bdr.b_size, 12); + f->f_st.st_mtime = rdoct(bp->Bdr.b_mtime, 12); + f->f_st.st_rdev = rdoct(bp->Bdr.b_rdev, 8); + f->f_rmajor = major(f->f_st.st_rdev); + f->f_rminor = minor(f->f_st.st_rdev); + switch (bp->Bdr.b_linkflag) { + case '0': + f->f_st.st_mode &= 07777; + if (f->f_name[namlen-2] == '/') + f->f_st.st_mode |= S_IFDIR; + else + f->f_st.st_mode |= S_IFREG; + break; + case '1': + if (f->f_lnam == NULL || f->f_lnam[0] == '\0') + blinkof(bp->data, f, namlen); + f->f_st.st_nlink = 2; + if ((f->f_st.st_mode&S_IFMT) == 0) + f->f_st.st_mode |= S_IFREG; + break; + case '2': + if (f->f_lnam == NULL || f->f_lnam[0] == '\0') + blinkof(bp->data, f, namlen); + f->f_st.st_mode &= 07777; + f->f_st.st_mode |= S_IFLNK; + } + f->f_pad = 512; + rd = 512; + } else if (fmttype & TYP_TAR) { + hsz = 512; + if (attempts == 0 && bread(bp->data, hsz) != hsz) + unexeoa(); + if (bp->Tdr.t_name[0] == '\0') { + if (kflag && !allzero(bp->data, hsz)) + goto badhdr; + return 1; + } + if (fmttype == FMT_GNUTAR) { + if (memcmp(bp->Tdr.t_magic, mag_gnutar, 8)) + goto badhdr; + } else if (fmttype & TYP_USTAR) { + if (memcmp(bp->Tdr.t_magic, mag_ustar, 6)) + goto badhdr; + } + if (trdsum(bp) != 0 && kflag == 0) + goto badhdr; + if ((fmttype & TYP_PAX) == 0 && (fmttype == FMT_GNUTAR || + strcmp(bp->Tdr.t_name, "././@LongLink") == 0)) { + switch (bp->Tdr.t_linkflag) { + case 'L': + if (readgnuname(&f->f_name, &f->f_nsiz, + rdoct(bp->Tdr.t_size, 12)) < 0) + goto badhdr; + goto retry; + case 'K': + if (readgnuname(&f->f_lnam, &f->f_lsiz, + rdoct(bp->Tdr.t_size, 12)) < 0) + goto badhdr; + goto retry; + } + } + if (fmttype & TYP_USTAR && fmttype != FMT_GNUTAR) { + switch (bp->Tdr.t_linkflag) { + case 'g': + case 'x': + if (formatforced && fmttype != FMT_PAX) + break; + fmttype = FMT_PAX; + tgetpax(&bp->Tdr, f); + goto retry2; + case 'X': + if (formatforced && fmttype != FMT_SUN) + break; + fmttype = FMT_SUN; + tgetpax(&bp->Tdr, f); + goto retry2; + } + } + if (f->f_name == NULL || f->f_name[0] == '\0') { + if (f->f_nsiz < TNAMSIZ+TPFXSIZ+2) { + free(f->f_name); + f->f_name= smalloc(f->f_nsiz=TNAMSIZ+TPFXSIZ+2); + } + tnameof(&bp->Tdr, f->f_name); + } + namlen = strlen(f->f_name) + 1; + f->f_st.st_mode = rdoct(bp->Tdr.t_mode, 8) & 07777; + if (paxrec & PR_UID) + /*EMPTY*/; + else if (fmttype == FMT_GNUTAR && bp->Tdr.t_uid[0] & 0200) + f->f_st.st_uid = pbe64(bp->Tdr.t_uid) & + 0x7FFFFFFFFFFFFFFFLL; + else + f->f_st.st_uid = rdoct(bp->Tdr.t_uid, 8); + if (paxrec & PR_GID) + /*EMPTY*/; + else if (fmttype == FMT_GNUTAR && bp->Tdr.t_gid[0] & 0200) + f->f_st.st_gid = pbe64(bp->Tdr.t_gid) & + 0x7FFFFFFFFFFFFFFFLL; + else + f->f_st.st_gid = rdoct(bp->Tdr.t_gid, 8); + if (paxrec & PR_SIZE) + /*EMPTY*/; + else if (fmttype == FMT_GNUTAR && bp->Tdr.t_size[0] == '\200') + f->f_st.st_size = pbe64(&bp->Tdr.t_size[4]); + else + f->f_st.st_size = rdoct(bp->Tdr.t_size, 12); + if ((paxrec & PR_MTIME) == 0) + f->f_st.st_mtime = rdoct(bp->Tdr.t_mtime, TTIMSIZ); + if (bp->Tdr.t_linkflag == '1') { + if (f->f_lnam == NULL || f->f_lnam[0] == '\0') + tlinkof(&bp->Tdr, f); + f->f_st.st_mode |= S_IFREG; /* for -tv */ + f->f_st.st_nlink = 2; + } else if (bp->Tdr.t_linkflag == '2') { + if (f->f_lnam == NULL || f->f_lnam[0] == '\0') + tlinkof(&bp->Tdr, f); + f->f_st.st_mode |= S_IFLNK; + } else if (tflag == 0 && (f->f_name)[namlen-2] == '/') + f->f_st.st_mode |= S_IFDIR; + else + f->f_st.st_mode |= tifmt(bp->Tdr.t_linkflag); + if (paxrec & PR_SUN_DEVMAJOR) + /*EMPTY*/; + else if (fmttype == FMT_GNUTAR && bp->Tdr.t_devmajor[0] & 0200) + f->f_rmajor = pbe64(bp->Tdr.t_devmajor) & + 0x7FFFFFFFFFFFFFFFLL; + else + f->f_rmajor = rdoct(bp->Tdr.t_devmajor, 8); + if (paxrec & PR_SUN_DEVMINOR) + /*EMPTY*/; + else if (fmttype == FMT_GNUTAR && bp->Tdr.t_devminor[0] & 0200) + f->f_rminor = pbe64(bp->Tdr.t_devminor) & + 0x7FFFFFFFFFFFFFFFLL; + else + f->f_rminor = rdoct(bp->Tdr.t_devminor, 8); + f->f_st.st_rdev = makedev(f->f_rmajor, f->f_rminor); + f->f_pad = 512; + rd = 512; + } else if (fmttype == FMT_ZIP) { + hsz = SIZEOF_zip_header; + if (attempts == 0 && bread(bp->data, hsz) != hsz) + unexeoa(); + if (memcmp(bp->Zdr.z_signature, mag_zipctr, + sizeof mag_zipctr) == 0 || + memcmp(bp->Zdr.z_signature, mag_zipend, + sizeof mag_zipend) == 0 || + memcmp(bp->Zdr.z_signature, mag_zip64e, + sizeof mag_zip64e) == 0 || + memcmp(bp->Zdr.z_signature, mag_zip64l, + sizeof mag_zip64l) == 0) + return 1; + if (memcmp(bp->Zdr.z_signature, mag_zipsig, sizeof mag_zipsig)) + goto badhdr; + f->f_st.st_uid = myuid; + f->f_st.st_gid = mygid; + f->f_st.st_nlink = 1; + f->f_st.st_mtime = + gdostime(bp->Zdr.z_modtime, bp->Zdr.z_moddate); + f->f_st.st_size = ple32(bp->Zdr.z_nsize); + f->f_csize = ple32(bp->Zdr.z_csize); + f->f_cmethod = ple16(bp->Zdr.z_cmethod); + f->f_chksum = ple32(bp->Zdr.z_crc32); + f->f_gflag = ple16(bp->Zdr.z_gflag); + rd = SIZEOF_zip_header; + namlen = ple16(bp->Zdr.z_namelen)&0177777; + if (f->f_nsiz < namlen+1) { + free(f->f_name); + f->f_name = smalloc(f->f_nsiz = namlen+1); + } + if (bread(f->f_name, namlen) != namlen) + goto corrupt; + (f->f_name)[namlen] = '\0'; + if (f->f_name[namlen-1] == '/') + f->f_st.st_mode = 0777&~(mode_t)umsk|S_IFDIR; + else + f->f_st.st_mode = 0666&~(mode_t)umsk|S_IFREG; + rd += namlen; + if ((l1 = ziprxtra(f, &bp->Zdr)) < 0) + goto corrupt; + rd += l1; + f->f_pad = 1; + } else + abort(); + if (fmttype & TYP_CPIO) { + if (f->f_st.st_nlink <= 0 || namlen <= 0 || namlen >= SANELIMIT) + goto corrupt; + if (namlen > f->f_nsiz) { + if (f->f_name) + free(f->f_name); + f->f_name = smalloc(f->f_nsiz = namlen); + } + if (bread(f->f_name, namlen) != namlen) + unexeoa(); + if (f->f_name[namlen-1] != '\0') + goto corrupt; + rd += namlen; + skippad(rd, f->f_pad); + if (fmttype & TYP_NCPIO && + (!formatforced || fmttype & TYP_SCO)) { + /* + * The UnixWare format is a hack, but not a bad + * one. It is backwards compatible as far as + * possible; old implementations can use the -k + * option and will then get only the beginning + * of a large file, but all other files in the + * archive. + */ + if (namlen >= 24 && memcmp(&f->f_name[namlen-23], + "\0size=", 6) == 0) { + fmttype |= TYP_SCO; + f->f_st.st_size = rdhex(&f->f_name[namlen-17], + 16); + } + } + } + if (attempts) { + if (tflag) + fflush(stdout); + msg(0, 0, sysv3 < 0 ? + "Re-synced after skipping %lld bytes.\n" : + "Re-synchronized on magic number/header.\n", + skipped); + } + attempts = 0; + if (f->f_st.st_atime == 0 || (pax_preserve&(PAX_P_ATIME|PAX_P_EVERY)) == + PAX_P_ATIME) + f->f_st.st_atime = f->f_st.st_mtime; + if ((f->f_dsize = f->f_st.st_size) < 0) + goto badhdr; + if (fmttype & TYP_CPIO && strcmp(f->f_name, trailer) == 0) + return 1; + return 0; +corrupt: + if (kflag) { + if (tflag) + fflush(stdout); + msg(3, 0, "Corrupt header, file(s) may be lost.\n"); + } +badhdr: + if (kflag) { + int next = fmttype & TYP_TAR ? 512 : 1; + if (attempts++ == 0) { + if (tflag) + fflush(stdout); + msg(1, 0, sysv3 < 0 ? "Out of phase; resyncing.\n" : + "Searching for magic number/header.\n"); + errcnt++; + } + for (l1 = next; l1 < hsz; l1++) + bp->data[l1-next] = bp->data[l1]; + if (bread(&bp->data[l1-next], next) != next) + unexeoa(); + skipped++; + goto retry; + } + if (tflag) + fflush(stdout); + msg(3, 1, sysv3 < 0 ? "Out of phase--get help\n" : + sysv3 > 0 ? "Out of sync, bad magic number/header.\n" : + "Bad magic number/header.\n"); + /*NOTREACHED*/ + return -1; +} + +/* + * Determine the kind of archive on tape. + */ +static void +whathdr(void) +{ +again: if (blktop >= SIZEOF_hdr_cpio && + ple16(blkbuf) == mag_bin) { + fmttype = FMT_BINLE; + } else if (blktop >= SIZEOF_hdr_cpio && + pbe16(blkbuf) == mag_bin) { + fmttype = FMT_BINBE; + } else if (blktop >= SIZEOF_c_hdr && + memcmp(blkbuf, mag_odc, sizeof mag_odc) == 0) { + /* + * The DEC format is rubbish. Instead of introducing a new + * archive magic, its engineers reused the POSIX/odc magic + * and changed the fields. But there's a workaround: For a + * real odc archive, the byte following the file name is a + * \0 byte (unless the archive is damaged, of course). If + * it is not a \0 byte, but a \0 byte appears at the + * corresponding location for the DEC format, this is + * treated as a DEC archive. It must be noted that the + * Tru64 UNIX 5.1 cpio command is too stupid even for + * doing that - it will spill out a list of complaints + * if an extended archive is read but -e is not given. + */ + int ns1, ns2; + ns1 = rdoct(((struct c_hdr *)blkbuf)->c_namesz, 6); + ns2 = rdoct(((struct d_hdr *)blkbuf)->d_namesz, 6); + if (blktop >= SIZEOF_d_hdr && + (ns1 >= blktop - SIZEOF_c_hdr || + blkbuf[SIZEOF_c_hdr+ns1-1] != '\0') && + ns2 <= blktop - SIZEOF_d_hdr && + blkbuf[SIZEOF_d_hdr+ns2-1] == '\0') + fmttype = FMT_DEC; + else + fmttype = FMT_ODC; + } else if (blktop >= SIZEOF_Exp_cpio_hdr && + memcmp(blkbuf, mag_asc, sizeof mag_asc) == 0) { + fmttype = FMT_ASC; + } else if (blktop >= SIZEOF_Exp_cpio_hdr && + memcmp(blkbuf, mag_crc, sizeof mag_crc) == 0) { + fmttype = FMT_CRC; + } else if (blktop >= SIZEOF_cray_hdr && + pbe64(blkbuf) == mag_bin) { + /* + * Old and new Cray headers are identical in the first + * 64 header bytes (including the magic). cpio(5) on + * UNICOS does not describe what the new param field + * is for. + * + * An archive is treated as old format if the mtime + * and namesize fields make sense and all characters + * of the name are non-null. + */ + struct cray_hdr *Cp = (struct cray_hdr *)blkbuf; + long long mtime, namesize; + fmttype = FMT_CRAY; + mtime = pbe64(Cp->C_mtime - CRAY_PARAMSZ); + namesize = pbe64(Cp->C_namesize - CRAY_PARAMSZ); + if (mtime > 0 && mtime < (1LL<<31) && + namesize > 0 && namesize < 2048 && + blktop > SIZEOF_cray_hdr- + CRAY_PARAMSZ+namesize+1) { + int i; + for (i = 0; i < namesize; i++) + if (blkbuf[SIZEOF_cray_hdr- + CRAY_PARAMSZ+i] == '\0') + break; + if (i == namesize-1) + fmttype = FMT_CRAY5; + } + } else if (blktop >= 512 && + memcmp(&blkbuf[257], mag_ustar, 6) == 0 && + tcssum((union bincpio *)blkbuf, 1) == 0) { + fmttype = FMT_USTAR; + } else if (blktop >= 512 && + memcmp(&blkbuf[257], mag_gnutar, 8) == 0 && + tcssum((union bincpio *)blkbuf, 1) == 0) { + fmttype = FMT_GNUTAR; + } else if (blktop >= 512 && blkbuf[0] && /* require filename + to avoid match on + /dev/zero etc. */ + memcmp(&blkbuf[257], "\0\0\0\0\0", 5) == 0 && + tcssum((union bincpio *)blkbuf, 0) == 0) { + fmttype = FMT_OTAR; + } else if (blktop >= SIZEOF_zip_header && + (memcmp(blkbuf, mag_zipctr, sizeof mag_zipctr) == 0 || + memcmp(blkbuf, mag_zipsig, sizeof mag_zipsig) == 0 || + memcmp(blkbuf, mag_zipend, sizeof mag_zipend) == 0 || + memcmp(blkbuf, mag_zip64e, sizeof mag_zip64e) == 0 || + memcmp(blkbuf, mag_zip64l, sizeof mag_zip64l) == 0)) { + fmttype = FMT_ZIP; + } else if (blktop >= 512 && memcmp(blkbuf,"\0\0\0\0\0\0\0\0",8) == 0 && + memcmp(&blkbuf[65], mag_bar, sizeof mag_bar) == 0 && + bcssum((union bincpio *)blkbuf) == 0) { + fmttype = FMT_BAR; + compressed_bar = blkbuf[71] == '1'; + curpos = 512; + } else if (!Aflag && blktop > 3 && memcmp(blkbuf, "BZh", 3) == 0 && + redirect("bzip2", "-cd") == 0) { + goto zip; + } else if (!Aflag && blktop > 2 && memcmp(blkbuf, "\37\235", 2) == 0 && + redirect("zcat", NULL) == 0) { + goto zip; + } else if (!Aflag && blktop > 2 && memcmp(blkbuf, "\37\213", 2) == 0 && + redirect("gzip", "-cd") == 0) { + goto zip; + } else if (!Aflag && blktop > 4 && + memcmp(blkbuf, "\355\253\356\333", 4) == 0 && + redirect("rpm2cpio", "-") == 0) { + goto zip; + } else { + msg(3, 0, sysv3 ? "This is not a cpio file, bad header.\n" : + "Not a cpio file, bad header.\n"); + done(1); + } + return; +zip: + blktop = curpos = 0; + blocks = 0; + bytes = 0; + mfl = 0; + mstat(); + if (mread() == 0) + unexeoa(); + goto again; +} + +/* + * Processing of a single file with -i. + */ +static int +infile(struct file *f) +{ + int val; + + if ((fmttype & TYP_CPIO || fmttype == FMT_ZIP && f->f_st.st_size) && + (f->f_st.st_mode&S_IFMT) == S_IFLNK) { + if (f->f_lsiz < f->f_st.st_size+1) + f->f_lnam = srealloc(f->f_lnam, + f->f_lsiz = f->f_st.st_size+1); + if (bread(f->f_lnam, f->f_st.st_size) != f->f_st.st_size) + unexeoa(); + f->f_lnam[f->f_st.st_size] = '\0'; + skippad(f->f_st.st_size, f->f_pad); + } + if (tflag) + val = filet(f, indata); + else + val = filein(f, indata, f->f_name); + return val != 0; +} + +/* + * Fetch the data of regular files from tape and write it to tfd or, if + * tfd < 0, discard it. + */ +static int +indata(struct file *f, const char *tgt, int tfd) +{ + char *buf; + size_t bufsize; + struct stat ts; + long long size; + ssize_t rd; + uint32_t ssum = 0, usum = 0; + int val = 0; + int doswap = 0; + + size = fmttype == FMT_ZIP ? f->f_csize : + f->f_Kbase ? f->f_Kbase : f->f_st.st_size; + doswap = ((bflag|sflag) == 0 || + ckodd(size, 2, "bytes", f->f_name) == 0) & + ((bflag|Sflag) == 0 || + ckodd(size, 4, "halfwords", f->f_name) == 0) & + (bflag|sflag|Sflag); + if (fmttype == FMT_ZIP && f->f_cmethod != C_STORED) + return zipread(f, tgt, tfd, doswap); + if (tfd < 0 || fstat(tfd, &ts) < 0) + ts.st_blksize = 4096; + getbuf(&buf, &bufsize, ts.st_blksize); +again: while (size) { + if ((rd = bread(buf, size > bufsize ? bufsize : size)) <= 0) + unexeoa(); + if (doswap) + swap(buf, rd, bflag || sflag, bflag || Sflag); + if (tfd >= 0 && write(tfd, buf, rd) != rd) { + emsg(3, "Cannot write \"%s\"", tgt); + tfd = -1; + val = -1; + } + size -= rd; + if (fmttype & TYP_CRC) + do { + rd--; + ssum += ((signed char *)buf)[rd]; + usum += ((unsigned char *)buf)[rd]; + } while (rd); + } + if (f->f_Kbase) { + skippad(f->f_Ksize, f->f_pad); + readK2hdr(f); + size = f->f_Krest; + goto again; + } + skippad(fmttype==FMT_ZIP ? f->f_csize : + f->f_Ksize ? f->f_Krest : f->f_st.st_size, f->f_pad); + if (fmttype & TYP_CRC) { + if (f->f_chksum != ssum && f->f_chksum != usum) { + msg(3, 0, "\"%s\" - checksum error\n", f->f_name); + if (kflag) + errcnt++; + else + val = -1; + } + } + return val; +} + +/* + * Skip the data for a file on tape. + */ +static int +skipfile(struct file *f) +{ + char b[4096]; + long long size; + ssize_t rd; + + if (fmttype & TYP_TAR && ((f->f_st.st_mode&S_IFMT) == S_IFLNK || + f->f_st.st_nlink > 1)) { + if (fmttype & TYP_USTAR && (!formatforced || + fmttype == FMT_PAX) && + f->f_st.st_nlink > 1 && + f->f_st.st_size > 0) + /*EMPTY*/; + else + return 0; + } + /* + * SVR4 cpio derivatives always ignore the size of these, + * even if not reading tar formats. We do the same for now, + * although POSIX (for -H odc format) says the contrary. + */ + if (fmttype != FMT_ZIP && ((f->f_st.st_mode&S_IFMT) == S_IFDIR || + (f->f_st.st_mode&S_IFMT) == S_IFCHR || + (f->f_st.st_mode&S_IFMT) == S_IFBLK || + (f->f_st.st_mode&S_IFMT) == S_IFIFO || + (f->f_st.st_mode&S_IFMT) == S_IFNAM || + (f->f_st.st_mode&S_IFMT) == S_IFNWK)) + return 0; + if (fmttype == FMT_ZIP && f->f_gflag & FG_DESC) + return zipread(f, f->f_name, -1, 0); + size = fmttype == FMT_ZIP ? f->f_csize : + f->f_Kbase ? f->f_Kbase : f->f_st.st_size; +again: while (size) { + if ((rd = bread(b, size > sizeof b ? sizeof b : size)) <= 0) + unexeoa(); + size -= rd; + } + if (f->f_Kbase) { + skippad(f->f_Ksize, f->f_pad); + readK2hdr(f); + size = f->f_Krest; + goto again; + } + skippad(fmttype==FMT_ZIP ? f->f_csize : + f->f_Ksize ? f->f_Krest : f->f_st.st_size, f->f_pad); + return 0; +} + +/* + * Skip data also, but perform checks as if copying. + */ +static int +skipdata(struct file *f, int (*copydata)(struct file *, const char *, int)) +{ + switch (f->f_st.st_mode&S_IFMT) { + case S_IFLNK: + break; + case S_IFDIR: + case S_IFBLK: + case S_IFCHR: + case S_IFIFO: + case S_IFNAM: + case S_IFNWK: + if (fmttype != FMT_ZIP) + break; + /*FALLTHRU*/ + case S_IFREG: + default: + if (fmttype & TYP_TAR && f->f_st.st_nlink > 1 && + ((fmttype & TYP_USTAR) == 0 || + formatforced && fmttype != FMT_PAX)) + break; + if (copydata(f, f->f_name, -1) != 0) + return 1; + } + return 0; +} + +/* + * Seek to a position in the archive measured from the begin of + * operation. Handle media-dependent seeks. n must be a multiple + * of the tape device's physical block size. + */ +static int +tseek(off_t n) +{ + int fault; + + if (tapeblock > 0) { + int i = (n - poffs) / tapeblock; +#if defined (__linux__) || defined (__sun) || defined (__FreeBSD__) || \ + defined (__hpux) || defined (_AIX) || defined (__NetBSD__) || \ + defined (__OpenBSD__) || defined (__DragonFly__) || \ + defined (__CYGWIN__) + struct mtop mo; + mo.mt_op = i > 0 ? MTFSR : MTBSR; + mo.mt_count = i > 0 ? i : -i; + fault = ioctl(mt, MTIOCTOP, &mo); +#endif + } else + fault = lseek(mt, n - poffs, SEEK_CUR) == (off_t)-1 ? -1 : 0; + if (fault == 0) + poffs = n; + return fault; +} + +/* + * Advance to the trailer on the tape (for -A). + */ +static int +totrailer(void) +{ + union bincpio bc; + struct file f; + off_t ooffs, noffs, diff; + int i; + + if (mread() == 0) + unexeoa(); + if (fmttype == FMT_NONE) + whathdr(); + memset(&f, 0, sizeof f); + for (;;) { + ooffs = aoffs; + if ((i = readhdr(&f, &bc)) < 0) + goto fail; + if (i > 0) + break; + markdev(f.f_st.st_dev); + if (skipfile(&f) != 0) + goto fail; + if (fmttype == FMT_ZIP) + zipdefer(f.f_name, &f.f_st, ooffs, + f.f_chksum, f.f_csize, &bc.Zdr); + pax_track(f.f_name, f.f_st.st_mtime); + } + /* + * Now seek to the position of the trailer, but retain the + * block alignment. + */ + diff = ooffs % blksiz; + noffs = ooffs - diff; + if (diff ? tseek(noffs) == 0 && mread() >= diff && tseek(noffs) == 0 + : tseek(ooffs) == 0) { + free(f.f_name); + free(f.f_lnam); + nwritten = ooffs; + curpos = diff; + return 0; + } +fail: msg(4, 1, "Unable to append to this archive\n"); + /*NOTREACHED*/ + return 1; +} + +static long long +rdoct(const char *data, int len) +{ + int i; + long long val = 0; + + for (i = 0; i < len && data[i] == ' '; i++); + for ( ; i < len && data[i] && data[i] != ' '; i++) { + val <<= 3; + val += data[i] - '0'; + } + return val; +} + +static long long +rdhex(const char *data, int len) +{ + int i; + long long val = 0; + + for (i = 0; i < len && data[i] == ' '; i++); + for ( ; i < len && data[i] && data[i] != ' '; i++) { + val <<= 4; + val += data[i] > '9' ? data[i] > 'F' ? data[i] - 'a' + 10 : + data[i] - 'A' + 10 : data[i] - '0'; + } + return val; +} + +void +unexeoa(void) +{ + if (sysv3) { + fprintf(stderr, + "Can't read input: end of file encountered " + "prior to expected end of archive.\n"); + done(1); + } + else + msg(3, 1, "Unexpected end-of-archive encountered.\n"); +} + +static char *peekdata; +static size_t peekbot, peektop, peeksize; + +void +bunread(const char *data, size_t sz) +{ + peekdata = srealloc(peekdata, peeksize += sz); + memcpy(&peekdata[peekbot], data, sz); + peektop += sz; + aoffs -= sz; +} + +/* + * Buffered read of data from tape. sz is the amount of data required + * by the archive format; if it cannot be retrieved, processing fails. + */ +ssize_t +bread(char *data, size_t sz) +{ + ssize_t rd = 0; + + if (peekdata) { + rd = sz>peektop-peekbot ? peektop-peekbot : sz; + memcpy(&data[0], &peekdata[peekbot], rd); + sz -= rd; + peekbot += rd; + if (peekbot == peektop) { + free(peekdata); + peekdata = 0; + peeksize = 0; + peekbot = peektop = 0; + } + } + while (sz) { + if (blktop - curpos >= sz) { + memcpy(&data[rd], &blkbuf[curpos], sz); + curpos += sz; + rd += sz; + aoffs += rd; + return rd; + } + if (blktop > curpos) { + memcpy(&data[rd], &blkbuf[curpos], blktop - curpos); + rd += blktop - curpos; + sz -= blktop - curpos; + curpos = blktop; + } + if (mfl < 0) { + if (mfl == -1) { + emsg(3, "I/O error on \"%s\"", + Iflag ? Iflag : "input"); + if (kflag == 0) + break; + if (tapeblock < 0 && ( + (mtst.st_mode&S_IFMT)==S_IFBLK|| + (mtst.st_mode&S_IFMT)==S_IFCHR|| + (mtst.st_mode&S_IFMT)==S_IFREG + ) && lseek(mt, blksiz, SEEK_CUR) + == (off_t)-1) { + emsg(3, "Cannot lseek()"); + done(1); + } + } + if (kflag == 0 || mfl == -2) { + if ((mtst.st_mode&S_IFMT)!=S_IFCHR && + (mtst.st_mode&S_IFMT)!=S_IFBLK) + break; + newmedia(mfl == -1 ? errno : 0); + if (mfl == -1) { + mfl = -2; + break; + } + if (fmttype & TYP_BAR) + curpos = 512; + } + } + mread(); + } + aoffs += rd; + return rd; +} + +/* + * Read a block of data from tape. + */ +static ssize_t +mread(void) +{ + ssize_t ro, rt = 0; + + do { + if ((ro = read(mt, blkbuf + rt, blksiz - rt)) <= 0) { + if (ro < 0) { + if (errno == EINTR) + continue; + mfl = -1; + } else + mfl = -2; + if (rt > 0) { + rt += ro; + break; + } + curpos = blktop = 0; + return ro; + } + rt += ro; + poffs += ro; + if (tapeblock == 0) { + tapeblock = ro; + if (!Bflag && !Cflag) + blksiz = ro; + } + } while (rt < blksiz); + curpos = 0; + blocks += rt >> 9; + bytes += rt & 0777; + blktop = rt; + return rt; +} + +/* + * Look what kind of tape or other archive media we are working on and + * set the buffer size appropriately (if not specified by the user). + */ +static void +mstat(void) +{ + if (fstat(mt, &mtst) < 0) { + emsg(3, "Error during stat() of archive"); + done(1); + } +#if defined (__linux__) + if ((mtst.st_mode&S_IFMT) == S_IFCHR) { + struct mtget mg; + if (ioctl(mt, MTIOCGET, &mg) == 0) + tapeblock = (mg.mt_dsreg&MT_ST_BLKSIZE_MASK) >> + MT_ST_BLKSIZE_SHIFT; + } else if ((mtst.st_mode&S_IFMT) == S_IFBLK) { + /* + * If using a block device, write blocks of the floppy + * disk sector with direct i/o. This enables signals + * after each block is written instead of being ~40 + * seconds in uninterruptible sleep when calling close() + * later. For block devices other than floppies, use the + * kernel defined i/o block size. For floppies, use direct + * i/o even when reading since it is faster. + */ + struct floppy_struct fs; + int floppy = -1; + int blkbsz; + + if (blksiz == 0) { + if ((floppy = ioctl(mt, FDGETPRM, &fs)) == 0) + blksiz = fs.sect * FD_SECTSIZE(&fs); +#ifdef BLKBSZGET + else if (ioctl(mt, BLKBSZGET, &blkbsz) == 0) + blksiz = blkbsz; +#endif /* BLKBSZGET */ + } +#ifdef O_DIRECT + if ((action == 'o' || floppy == 0) && blksiz != 0) { + int flags; + if ((flags = fcntl(mt, F_GETFL)) != -1) + fcntl(mt, F_SETFL, flags | O_DIRECT); + } + } +#endif /* O_DIRECT */ +#elif defined (__sun) + if ((mtst.st_mode&S_IFMT) == S_IFCHR) { + struct mtdrivetype_request mr; + static struct mtdrivetype md; + mr.size = sizeof md; + mr.mtdtp = &md; + if (ioctl(mt, MTIOCGETDRIVETYPE, &mr) == 0) + tapeblock = md.bsize; + } +#elif defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) \ + || defined (__DragonFly__) + if ((mtst.st_mode&S_IFMT) == S_IFCHR) { + struct mtget mg; + if (ioctl(mt, MTIOCGET, &mg) == 0) + tapeblock = mg.mt_blksiz; + } +#elif defined (__CYGWIN__) + if ((mtst.st_mode&S_IFMT) == S_IFCHR) { + struct mtget mg; + if (ioctl(mt, MTIOCGET, &mg) == 0) + tapeblock = (mg.mt_dsreg&MT_ST_BLKSIZE_MASK) >> + MT_ST_BLKSIZE_SHIFT; + } +#elif defined (__hpux) || defined (_AIX) +#endif /* SVR4.2MP */ + if (blksiz == 0) + switch (mtst.st_mode&S_IFMT) { + case S_IFREG: + case S_IFBLK: + blksiz = 4096; + break; + case S_IFCHR: + if (action == 'o' && !Aflag) { + if (pax != PAX_TYPE_CPIO) { + if (fmttype & TYP_PAX) + blksiz = 5120; + else if (fmttype & TYP_TAR) + blksiz = 10240; + else if (fmttype & TYP_CPIO) + blksiz = 5120; + else + blksiz = 512; + } else + blksiz = tapeblock>0 ? tapeblock : 512; + } else + blksiz = tapeblock > 0 && tapeblock % 1024 ? + tapeblock : tapeblock > 10240 ? + tapeblock : 10240; + break; + default: + blksiz = 512; + } +} + +/* + * Skip tape data such that size becomes aligned to pad. + */ +static int +skippad(unsigned long long size, int pad) +{ + char b[512]; + int to; + + if ((to = size % pad) != 0) { + if (bread(b, pad - to) != pad - to) + unexeoa(); + } + return 0; +} + +static int +allzero(const char *bp, int n) +{ + int i; + + for (i = 0; i < n; i++) + if (bp[i] != '\0') + return 0; + return 1; +} + +#define CACHESIZE 16 + +static const char * +getuser(uid_t uid) +{ + static struct { + char *name; + uid_t uid; + } cache[CACHESIZE]; + static int last; + int i; + struct passwd *pwd; + const char *name; + + for (i = 0; i < CACHESIZE && cache[i].name; i++) + if (cache[i].uid == uid) + goto found; + if ((pwd = getpwuid(uid)) != NULL) + name = pwd->pw_name; + else + name = ""; + if (i >= CACHESIZE) { + if (last >= CACHESIZE) + last = 0; + i = last++; + } + if (cache[i].name) + free(cache[i].name); + cache[i].name = sstrdup(name); + cache[i].uid = uid; +found: return cache[i].name[0] ? cache[i].name : NULL; +} + +static const char * +getgroup(gid_t gid) +{ + static struct { + char *name; + gid_t gid; + } cache[CACHESIZE]; + static int last; + int i; + struct group *grp; + const char *name; + + for (i = 0; i < CACHESIZE && cache[i].name; i++) + if (cache[i].gid == gid) + goto found; + if ((grp = getgrgid(gid)) != NULL) + name = grp->gr_name; + else + name = ""; + if (i >= CACHESIZE) { + if (last >= CACHESIZE) + last = 0; + i = last++; + } + if (cache[i].name) + free(cache[i].name); + cache[i].name = sstrdup(name); + cache[i].gid = gid; +found: return cache[i].name[0] ? cache[i].name : NULL; +} + +/* + * Return a version of the passed string that contains at most one '%d' + * and no other printf formats. + */ +char * +oneintfmt(const char *op) +{ + char *new, *np; + int no = 0; + + np = new = smalloc(2 * strlen(op) + 1); + do { + if (*op == '%') { + *np++ = *op++; + if (*op != '%') + if (*op != 'd' || no++) + *np++ = '%'; + } + *np++ = *op; + } while (*op++); + return new; +} + +char * +sstrdup(const char *op) +{ + char *np; + + np = smalloc(strlen(op) + 1); + strcpy(np, op); + return np; +} + +/* + * Add this pattern to the extraction list with -i. + */ +void +addg(const char *pattern, int art) +{ + struct glist *gp; + + gp = scalloc(1, sizeof *gp); + if (pax == PAX_TYPE_CPIO && pattern[0] == '!') { + gp->g_not = 1; + pattern++; + } + gp->g_pat = sstrdup(pattern); + gp->g_art = art; + if (pax != PAX_TYPE_CPIO) { + struct glist *gb = NULL, *gc; + for (gc = patterns; gc; gc = gc->g_nxt) + gb = gc; + if (gb) + gb->g_nxt = gp; + else + patterns = gp; + } else { + gp->g_nxt = patterns; + patterns = gp; + } +} + +/* + * Check if the file name s matches any of the given patterns. + */ +static struct glist * +want(struct file *f, struct glist **gb) +{ + extern int gmatch(const char *, const char *); + struct glist *gp; + + for (gp = patterns; gp; gp = gp->g_nxt) { + if ((gmatch(f->f_name, gp->g_pat) != 0) ^ gp->g_not && + (pax_nflag == 0 || gp->g_gotcha == 0)) { + return gp; + } + *gb = gp; + } + return NULL; +} + +static void +patfile(void) +{ + struct iblok *ip; + char *name = NULL; + size_t namsiz = 0, namlen; + + if ((ip = ib_open(Eflag, 0)) == NULL) + msg(3, -2, "Cannot open \"%s\" to read patterns\n", Eflag); + while ((namlen = ib_getlin(ip, &name, &namsiz, srealloc)) != 0) { + if (name[namlen-1] == '\n') + name[--namlen] = '\0'; + addg(name, 0); + } + ib_close(ip); +} + +void +swap(char *b, size_t sz, int s8, int s16) +{ + uint8_t u8; + uint16_t u16; + union types2 *t2; + union types4 *t4; + int i; + + if (s8) { + for (i = 0; i < (sz >> 1); i++) { + t2 = &((union types2 *)b)[i]; + u8 = t2->byte[0]; + t2->byte[0] = t2->byte[1]; + t2->byte[1] = u8; + } + } + if (s16) { + for (i = 0; i < (sz >> 2); i++) { + t4 = &((union types4 *)b)[i]; + u16 = t4->sword[0]; + t4->sword[0] = t4->sword[1]; + t4->sword[1] = u16; + } + } +} + +static int +ckodd(long long size, int mod, const char *str, const char *fn) +{ + if (size % mod) { + msg(3, 0, "Cannot swap %s of \"%s\", odd number of %s\n", + str, fn, str); + errcnt++; + return 1; + } + return 0; +} + +/* + * Interactive rename (-r option). + */ +static int +rname(char **oldp, size_t *olds) +{ + char *new = NULL; + size_t newsize = 0; + int i, r; + char c; + + fprintf(stderr, "Rename \"%s\"? ", *oldp); + if (tty == 0) + if ((tty = open("/dev/tty", O_RDWR)) < 0 || + fcntl(tty, F_SETFD, FD_CLOEXEC) < 0) + err: msg(3, 1, "Cannot read tty.\n"); + i = 0; + while ((r = read(tty, &c, 1)) == 1 && c != '\n') { + if (i+1 >= newsize) + new = srealloc(new, newsize += 32); + new[i++] = c; + } + if (r <= 0) + goto err; + if (new == NULL) + return 0; + new[i] = '\0'; + if (new[0] == '.' && new[1] == '\0') { + free(new); + } else { + free(*oldp); + *oldp = new; + *olds = newsize; + } + return 1; +} + +/* + * Filter data from tape through the commands given in arg?. + */ +static int +redirect(const char *arg0, const char *arg1) +{ + int pd[2]; + + if (pipe(pd) < 0) + return -1; + switch (fork()) { + case 0: + if (tapeblock>=0 || lseek(mt, -blktop, SEEK_CUR) == (off_t)-1) { + int xpd[2]; + if (pipe(xpd) == 0 && fork() == 0) { + ssize_t rd, wo, wt; + close(xpd[0]); + do { + wo = wt = 0; + do { + if ((wo = write(xpd[1], + blkbuf + wt, + blktop - wt)) + <= 0) { + if (errno == EINTR) + continue; + _exit(0); + } + wt += wo; + } while (wt < blktop); + } while ((rd = mread()) >= 0); + if (rd < 0) { + emsg(3, "Read error on \"%s\"", + Iflag && !sysv3 ? + Iflag : "input"); + } + _exit(0); + } else { + close(xpd[1]); + dup2(xpd[0], 0); + close(xpd[0]); + } + } else { + dup2(mt, 0); + } + close(mt); + dup2(pd[1], 1); + close(pd[0]); + close(pd[1]); + execlp(arg0, arg0, arg1, NULL); + fprintf(stderr, "%s: could not exec %s: %s\n", + progname, arg0, strerror(errno)); + _exit(0177); + /*NOTREACHED*/ + default: + dup2(pd[0], mt); + close(pd[0]); + close(pd[1]); + tapeblock = -1; + break; + case -1: + return -1; + } + return 0; +} + +/* + * Get the name stored in a tar header. buf is expected to be at least + * TPFXSIZ+TNAMSIZ+2 bytes. + */ +static char * +tnameof(struct tar_header *hp, char *buf) +{ + const char *cp; + char *bp = buf; + + if (fmttype & TYP_USTAR && fmttype != FMT_GNUTAR && + hp->t_prefix[0] != '\0') { + cp = hp->t_prefix; + while (cp < &hp->t_prefix[TPFXSIZ] && *cp) + *bp++ = *cp++; + if (bp > buf) + *bp++ = '/'; + } + cp = hp->t_name; + while (cp < &hp->t_name[TNAMSIZ] && *cp) + *bp++ = *cp++; + *bp = '\0'; + return buf; +} + +/* + * Store fn as file name in a tar header. + */ +static int +tmkname(struct tar_header *hp, const char *fn) +{ + const char *cp, *cs = NULL; + + for (cp = fn; *cp; cp++) { + if (fmttype & TYP_USTAR && *cp == '/' && cp[1] != '\0' && + cp > fn && cp-fn <= TPFXSIZ) + cs = cp; + } + if (fmttype == FMT_GNUTAR && cp - fn > 99) { + writegnuname(fn, cp - fn + 1, 'L'); + cp = &fn[99]; + } else if (cp - (cs ? &cs[1] : fn) > TNAMSIZ) { + if (fmttype & TYP_PAX && utf8(fn)) { + paxrec |= PR_PATH; + strcpy(hp->t_name, sequence()); + return 0; + } + msg(3, 0, "%s: file name too long\n", fn); + return -1; + } + if (cs && cp - fn > TNAMSIZ) { + memcpy(hp->t_prefix, fn, cs - fn); + if (cs - fn < TPFXSIZ) + hp->t_prefix[cs - fn] = '\0'; + memcpy(hp->t_name, &cs[1], cp - &cs[1]); + if (cp - &cs[1] < TNAMSIZ) + hp->t_name[cp - &cs[1]] = '\0'; + } else { + memcpy(hp->t_name, fn, cp - fn); + if (cp - fn < TNAMSIZ) + hp->t_name[cp - fn] = '\0'; + } + return 0; +} + +/* + * Get the link name of a tar header. + */ +static void +tlinkof(struct tar_header *hp, struct file *f) +{ + const char *cp; + char *bp; + + + if (f->f_lsiz < TNAMSIZ+1) + f->f_lnam = srealloc(f->f_lnam, f->f_lsiz = TNAMSIZ+1); + cp = hp->t_linkname; + bp = f->f_lnam; + while (cp < &hp->t_linkname[TNAMSIZ] && *cp) + *bp++ = *cp++; + *bp = '\0'; +} + +/* + * Create the link name in a tar header. + */ +static int +tmklink(struct tar_header *hp, const char *fn) +{ + const char *cp; + + for (cp = fn; *cp; cp++); + if (fmttype == FMT_GNUTAR && cp - fn > 99) { + writegnuname(fn, cp - fn + 1, 'K'); + cp = &fn[99]; + } else if (cp - fn > TNAMSIZ) { + if (fmttype & TYP_PAX && utf8(fn)) { + paxrec |= PR_LINKPATH; + strcpy(hp->t_linkname, sequence()); + return 0; + } + msg(3, 0, "%s: linked name too long\n", fn); + return -1; + } + memcpy(hp->t_linkname, fn, cp - fn); + if (cp - fn < TNAMSIZ) + hp->t_linkname[cp - fn] = '\0'; + return 0; +} + +static int +tlflag(struct stat *st) +{ + if (fmttype & TYP_BAR) { + switch (st->st_mode & S_IFMT) { + case S_IFREG: + case S_IFDIR: + return '0'; + case S_IFLNK: + return '2'; + default: + return '3'; + } + } else if (fmttype & TYP_USTAR) { + switch (st->st_mode & S_IFMT) { + case S_IFREG: + return '0'; + case S_IFLNK: + return '2'; + case S_IFCHR: + return '3'; + case S_IFBLK: + return '4'; + case S_IFDIR: + return '5'; + case S_IFIFO: + return '6'; + default: + return -1; + } + } else { + switch (st->st_mode & S_IFMT) { + case S_IFREG: + return '\0'; + case S_IFLNK: + return '2'; + default: + return -1; + } + } +} + +/* + * Ustar checksums are created using unsigned chars, as specified by + * POSIX. Traditional tar implementations use signed chars. Some + * implementations (notably SVR4 cpio derivatives) use signed chars + * even for ustar archives, but this is clearly an implementation bug. + */ +static void +tchksum(union bincpio *bp) +{ + uint32_t sum; + char *cp; + + memset(bp->Tdr.t_chksum, ' ', sizeof bp->Tdr.t_chksum); + sum = 0; + if (fmttype & TYP_USTAR) + for (cp = bp->data; cp < &bp->data[512]; cp++) + sum += *((unsigned char *)cp); + else + for (cp = bp->data; cp < &bp->data[512]; cp++) + sum += *((signed char *)cp); + sprintf(bp->Tdr.t_chksum, "%7.7o", sum); +} + +static int +tcssum(union bincpio *bp, int ustar) +{ + uint32_t ssum = 0, usum = 0, osum; + char ochk[sizeof bp->Tdr.t_chksum]; + char *cp; + + osum = rdoct(bp->Tdr.t_chksum, 8); + memcpy(ochk, bp->Tdr.t_chksum, sizeof ochk); + memset(bp->Tdr.t_chksum, ' ', sizeof bp->Tdr.t_chksum); + for (cp = bp->data; cp < &bp->data[512]; cp++) { + ssum += *((signed char *)cp); + usum += *((unsigned char *)cp); + } + memcpy(bp->Tdr.t_chksum, ochk, sizeof bp->Tdr.t_chksum); + return ssum != osum && usum != osum; +} + +static int +trdsum(union bincpio *bp) +{ + int i; + + if (fmttype & TYP_BAR) + i = bcssum(bp); + else + i = tcssum(bp, fmttype & TYP_USTAR); + if (i) + msg(3, 0, "Bad header - checksum error.\n"); + return i; +} + +static mode_t +tifmt(int c) +{ + switch (c) { + default: + case '\0': + case '0': + return S_IFREG; + case '2': + return S_IFLNK; + case '3': + return S_IFCHR; + case '4': + return S_IFBLK; + case '5': + return S_IFDIR; + case '6': + return S_IFIFO; + } +} + +/* + * bar format support functions. + */ +static void +bchksum(union bincpio *bp) +{ + uint32_t sum; + char *cp; + + memset(bp->Bdr.b_chksum, ' ', sizeof bp->Bdr.b_chksum); + sum = 0; + for (cp = bp->data; cp < &bp->data[512]; cp++) + sum += *((signed char *)cp); + sprintf(bp->Bdr.b_chksum, "%7.7o", sum); +} + +static int +bcssum(union bincpio *bp) +{ + uint32_t sum, osum; + char ochk[sizeof bp->Bdr.b_chksum]; + char *cp; + + osum = rdoct(bp->Bdr.b_chksum, 8); + memcpy(ochk, bp->Bdr.b_chksum, sizeof ochk); + memset(bp->Bdr.b_chksum, ' ', sizeof bp->Bdr.b_chksum); + sum = 0; + for (cp = bp->data; cp < &bp->data[512]; cp++) + sum += *((signed char *)cp); + memcpy(bp->Bdr.b_chksum, ochk, sizeof bp->Bdr.b_chksum); + return sum != osum; +} + +static void +blinkof(const char *cp, struct file *f, int namlen) +{ + if (f->f_lsiz < 512) + f->f_lnam = srealloc(f->f_lnam, f->f_lsiz = 512); + strcpy(f->f_lnam, &cp[SIZEOF_bar_header + namlen]); +} + +static void +dump_barhdr(void) +{ + union bincpio bc; + static int volno; + static time_t now = -1; + + memset(&bc, 0, 512); + sprintf(bc.Bdr.b_uid, "%d", myuid & 07777777); + sprintf(bc.Bdr.b_gid, "%d", mygid & 07777777); + bc.Bdr.b_size[0] = '0'; + memcpy(bc.Bdr.b_bar_magic, mag_bar, sizeof bc.Bdr.b_bar_magic); + sprintf(bc.Bdr.b_volume_num, "%d", ++volno & 0777); + bc.Bdr.b_compressed = '0'; + if (now == (time_t)-1) + time(&now); + sprintf(bc.Bdr.b_date, "%llo", now & 077777777777LL); + bchksum(&bc); + bwrite(bc.data, 512); +} + +/* + * Support for compressed bar format (any regular file is piped through zcat). + */ +static pid_t zpid; + +static int +zcreat(const char *name, mode_t mode) +{ + int pd[2]; + int fd; + + if (pipe(pd) < 0) + return -1; + if ((fd = creat(name, mode)) < 0) { + fd = errno; + close(pd[0]); + close(pd[1]); + errno = fd; + return -1; + } + switch (zpid = fork()) { + case -1: + return -1; + case 0: + dup2(pd[0], 0); + dup2(fd, 1); + close(pd[0]); + close(pd[1]); + close(fd); + execlp("zcat", "zcat", NULL); + _exit(0177); + /*NOTREACHED*/ + } + close(pd[0]); + close(fd); + sigset(SIGPIPE, SIG_IGN); + return pd[1]; +} + +static int +zclose(int fd) +{ + int c, s; + + c = close(fd); + while (waitpid(zpid, &s, 0) != zpid); + return c != 0 || s != 0 ? -1 : 0; +} + +/* + * If using the -A option, device numbers that appear in the archive + * are not reused for appended files. This avoids wrong hardlink + * connections on extraction. + * + * In fact, this should be done even if we did not fake device and + * inode numbers, since it is not guaranteed that the archive was + * created on the same machine, or even on the same machine, inode + * number could have changed after a file was unlinked. + */ +static void +markdev(dev_t dev) +{ + struct dslot *dp, *dq = NULL;; + + for (dp = markeddevs; dp; dp = dp->d_nxt) { + if (dp->d_dev == dev) + return; + dq = dp; + } + dp = scalloc(1, sizeof *dp); + dp->d_dev = dev; + if (markeddevs == NULL) + markeddevs = dp; + else + dq->d_nxt = dp; +} + +static int +marked(dev_t dev) +{ + struct dslot *dp; + + for (dp = markeddevs; dp; dp = dp->d_nxt) + if (dp->d_dev == dev) + return 1; + return 0; +} + +static void +cantsup(int err, const char *file) +{ + if (sysv3) + msg(err ? 3 : 2, 0, + "format can't support expanded types on %s\n", + file); + else + msg(0, 0, "%s format can't support expanded types on %s\n", + err ? "Error" : "Warning", file); + errcnt++; +} + +static void +onint(int signo) +{ + if (cur_ofile && cur_tfile && rename(cur_tfile, cur_ofile) < 0) + emsg(3, "Cannot recover original \"%s\"", cur_ofile); + if (cur_ofile && cur_tfile == NULL && unlink(cur_ofile) < 0) + emsg(3, "Cannot remove incomplete \"%s\"", cur_ofile); + exit(signo | 0200); +} + +/* + * Read the compressed zip data part for a file. + */ +static int +zipread(struct file *f, const char *tgt, int tfd, int doswap) +{ + int val = 0; + uint32_t crc = 0; + + if (f->f_gflag & FG_DESC) { + if (f->f_cmethod != C_DEFLATED && f->f_cmethod != C_ENHDEFLD || + f->f_gflag & FG_CRYPT) + msg(4, 1, "Cannot handle zip data descriptor\n"); + f->f_csize = 0x7FFFFFFFFFFFFFFFLL; + f->f_st.st_size = 0x7FFFFFFFFFFFFFFFLL; + } else if (tfd < 0) + return skipfile(f); + if (f->f_gflag & FG_CRYPT) + return cantunzip(f, "encrypted"); + switch (f->f_cmethod) { + case C_DEFLATED: + case C_ENHDEFLD: + val = zipinflate(f, tgt, tfd, doswap, &crc); + break; + case C_SHRUNK: + val = zipunshrink(f, tgt, tfd, doswap, &crc); + break; + case C_IMPLODED: + val = zipexplode(f, tgt, tfd, doswap, &crc); + break; + case C_REDUCED1: + case C_REDUCED2: + case C_REDUCED3: + case C_REDUCED4: + val = zipexpand(f, tgt, tfd, doswap, &crc); + break; + case C_TOKENIZED: + return cantunzip(f, "tokenized"); + case C_DCLIMPLODED: + val = zipblast(f, tgt, tfd, doswap, &crc); + break; + case C_BZIP2: +#if USE_BZLIB + val = zipunbz2(f, tgt, tfd, doswap, &crc); + break; +#else /* !USE_BZLIB */ + return cantunzip(f, "bzip2 compressed"); +#endif /* !USE_BZLIB */ + default: + return cantunzip(f, "compressed"); + } + if (f->f_gflag & FG_DESC) + zipreaddesc(f); + if (val == 0 && crc != f->f_chksum) { + msg(3, 0, "\"%s\" - checksum error\n", f->f_name); + return -1; + } + return val; +} + +/* + * Read a zip data descriptor (i. e. a field after the compressed data + * that contains the actual values for sizes and crc). + */ +static void +zipreaddesc(struct file *f) +{ + if (f->f_oflag & OF_ZIP64) { + struct zipddesc64 zd64; + bread((char *)&zd64, SIZEOF_zipddesc64); + if (memcmp(zd64.zd_signature, mag_zipdds, sizeof mag_zipdds)) + msg(4, 1, "Invalid zip data descriptor\n"); + f->f_chksum = ple32(zd64.zd_crc32); + f->f_dsize = f->f_st.st_size = ple64(zd64.zd_nsize) & + 0xFFFFFFFFFFFFFFFFULL; + f->f_csize = ple64(zd64.zd_csize) & + 0xFFFFFFFFFFFFFFFFULL; + } else { + struct zipddesc zd; + bread((char *)&zd, SIZEOF_zipddesc); + if (memcmp(zd.zd_signature, mag_zipdds, sizeof mag_zipdds)) + msg(4, 1, "Invalid zip data descriptor\n"); + f->f_chksum = ple32(zd.zd_crc32); + f->f_dsize = f->f_st.st_size = ple32(zd.zd_nsize)&0xFFFFFFFFUL; + f->f_csize = ple32(zd.zd_csize)&0xFFFFFFFFUL; + } +} + +static int +cantunzip(struct file *f, const char *method) +{ + msg(3, 0, "Cannot unzip %s file \"%s\"\n", method, f->f_name); + errcnt++; + return skipfile(f); +} + +/* + * PC-DOS time format: + * + * 31 24 20 15 10 4 0 + * | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + * | | | | | + * |year |months |days |hours |minutes |biseconds| + * + * refers to local time on the machine it was created on. + */ + +static time_t +gdostime(const char *tp, const char *dp) +{ + uint32_t v; + struct tm tm; + + v = (int)(tp[0]&0377) + + ((int)(tp[1]&0377) << 8) + + ((int)(dp[0]&0377) << 16) + + ((int)(dp[1]&0377) << 24); + memset(&tm, 0, sizeof tm); + tm.tm_sec = (v&0x1F) << 1; + tm.tm_min = (v&0x7E0) >> 5; + tm.tm_hour = (v&0xF800) >> 11; + tm.tm_mday = ((v&0x1F0000) >> 16); + tm.tm_mon = ((v&0x1E00000) >> 21) - 1; + tm.tm_year = ((v&0xFE000000) >> 25) + 80; + tm.tm_isdst = -1; + return mktime(&tm); +} + +static void +mkdostime(time_t t, char *tp, char *dp) +{ + uint32_t v; + struct tm *tm; + + tm = localtime(&t); + v = (tm->tm_sec >> 1) + (tm->tm_sec&1) + (tm->tm_min << 5) + + (tm->tm_hour << 11) + (tm->tm_mday << 16) + + ((tm->tm_mon+1) << 21) + ((tm->tm_year - 80) << 25); + le16p(v&0x0000ffff, tp); + le16p((v&0xffff0000) >> 16, dp); +} + +/* + * Read and interpret the zip extra field for a file. + */ +static ssize_t +ziprxtra(struct file *f, struct zip_header *z) +{ + union zextra *x, *xp; + short tag, size; + ssize_t len; + + len = ple16(z->z_extralen)&0177777; + if (len > 0) { + x = smalloc(len); + if (bread((char *)x, len) != len) + return -1; + if (len < 4) + return len; + xp = x; + while (len > 0) { + if (len < 4) + return -1; + tag = ple16(xp->Ze_gn.ze_gn_tag); + size = (ple16(xp->Ze_gn.ze_gn_tsize)&0177777) + 4; + switch (tag) { + case mag_zip64f: /* ZIP64 extended information */ + if (size != SIZEOF_zextra_64 && + size != SIZEOF_zextra_64_a && + size != SIZEOF_zextra_64_b) + break; + if (f->f_st.st_size == 0xffffffff) + f->f_st.st_size = + ple64(xp->Ze_64.ze_64_nsize); + if (f->f_csize == 0xffffffff) + f->f_csize = + ple64(xp->Ze_64.ze_64_csize); + f->f_oflag |= OF_ZIP64; + break; + case 0x000d: /* PKWARE Unix Extra Field */ + if (size != SIZEOF_zextra_pk) + break; + f->f_st.st_atime = ple32(xp->Ze_pk.ze_pk_atime); + f->f_st.st_mtime = ple32(xp->Ze_pk.ze_pk_mtime); + f->f_st.st_uid = ple16(xp->Ze_pk.ze_pk_uid) & + 0177777; + f->f_st.st_gid = ple16(xp->Ze_pk.ze_pk_gid) & + 0177777; + break; + case 0x5455: /* Extended Timestamp Extra Field */ + if (xp->Ze_et.ze_et_flags[0] & 1) + f->f_st.st_atime = + ple32(xp->Ze_et.ze_et_atime); + if (xp->Ze_et.ze_et_flags[0] & 2) + f->f_st.st_mtime = + ple32(xp->Ze_et.ze_et_mtime); + if (xp->Ze_et.ze_et_flags[0] & 3) + f->f_st.st_ctime = + ple32(xp->Ze_et.ze_et_ctime); + break; + case 0x5855: /* Info-ZIP Unix Extra Field #1 */ + if (size != SIZEOF_zextra_i1) + break; + f->f_st.st_atime = ple32(xp->Ze_i1.ze_i1_atime); + f->f_st.st_mtime = ple32(xp->Ze_i1.ze_i1_mtime); + f->f_st.st_uid = ple16(xp->Ze_i1.ze_i1_uid) & + 0177777; + f->f_st.st_gid = ple16(xp->Ze_i1.ze_i1_gid) & + 0177777; + break; + case 0x7855: /* Info-ZIP Unix Extra Field #2 */ + if (size != SIZEOF_zextra_i2) + break; + f->f_st.st_uid = ple16(xp->Ze_i2.ze_i2_uid) & + 0177777; + f->f_st.st_gid = ple16(xp->Ze_i2.ze_i2_gid) & + 0177777; + break; + case 0x756e: /* ASi Unix Extra Field */ + if (size < SIZEOF_zextra_as) + break; + f->f_st.st_mode = ple16(xp->Ze_as.ze_as_mode); + f->f_st.st_uid = ple16(xp->Ze_as.ze_as_uid) & + 0177777; + f->f_st.st_gid = ple16(xp->Ze_as.ze_as_gid) & + 0177777; + if ((f->f_st.st_mode&S_IFMT) == S_IFLNK) { + if (f->f_lsiz < size-14+1) + f->f_lnam = srealloc(f->f_lnam, + f->f_lsiz = + size-18+1); + memcpy(f->f_lnam, &((char *)xp)[18], + size-18); + f->f_lnam[size-18] = '\0'; + f->f_st.st_size = size-18; + } else { + f->f_st.st_rdev = + ple32(xp->Ze_as.ze_as_sizdev); + f->f_rmajor = major(f->f_st.st_rdev); + f->f_rminor = minor(f->f_st.st_rdev); + } + break; + case mag_zipcpio: + if (size != SIZEOF_zextra_cp) + break; + f->f_st.st_dev = ple32(xp->Ze_cp.ze_cp_dev); + f->f_st.st_ino = ple32(xp->Ze_cp.ze_cp_ino); + f->f_st.st_mode = ple32(xp->Ze_cp.ze_cp_mode); + f->f_st.st_uid = ple32(xp->Ze_cp.ze_cp_uid) & + 0xFFFFFFFFUL; + f->f_st.st_gid = ple32(xp->Ze_cp.ze_cp_gid) & + 0xFFFFFFFFUL; + f->f_st.st_nlink = ple32(xp->Ze_cp.ze_cp_nlink)& + 0xFFFFFFFFUL; + f->f_st.st_rdev = ple32(xp->Ze_cp.ze_cp_rdev); + f->f_rmajor = major(f->f_st.st_rdev); + f->f_rminor = minor(f->f_st.st_rdev); + f->f_st.st_mtime = ple32(xp->Ze_cp.ze_cp_mtime); + f->f_st.st_atime = ple32(xp->Ze_cp.ze_cp_atime); + break; + } + xp = (union zextra *)&((char *)xp)[size]; + len -= size; + } + free(x); + } + return len; +} + +/* + * Write the central directory and the end of a zip file. + */ +static void +ziptrailer(void) +{ + struct zipstuff *zs; + struct zipcentral zc; + struct zipend ze; + long long cpstart, cpend, entries = 0; + size_t sz; + + cpstart = nwritten; + for (zs = zipbulk; zs; zs = zs->zs_next) { + entries++; + memset(&zc, 0, SIZEOF_zipcentral); + memcpy(zc.zc_signature, mag_zipctr, 4); + zc.zc_versionmade[0] = 20; + zc.zc_versionextr[0] = zs->zs_cmethod == 8 ? 20 : 10; + mkdostime(zs->zs_mtime, zc.zc_modtime, zc.zc_moddate); + le32p(zs->zs_crc32, zc.zc_crc32); + le16p(zs->zs_cmethod, zc.zc_cmethod); + le16p(zs->zs_gflag, zc.zc_gflag); + /* + * We flag files as created on PC-DOS / FAT filesystem + * and thus set PC-DOS attributes here. + */ + if ((zs->zs_mode&0222) == 0) + zc.zc_external[0] |= 0x01; /* readonly attribute */ + if ((zs->zs_mode&S_IFMT) == S_IFDIR) + zc.zc_external[0] |= 0x10; /* directory attr. */ + sz = strlen(zs->zs_name); + le16p(sz, zc.zc_namelen); + if (zs->zs_size >= 0xffffffff || zs->zs_csize >= 0xffffffff || + zs->zs_relative >= 0xffffffff) { + struct zextra_64 zf; + + memset(&zf, 0, SIZEOF_zextra_64); + le16p(mag_zip64f, zf.ze_64_tag); + le16p(SIZEOF_zextra_64 - 4, zf.ze_64_tsize); + if ((zs->zs_mode&S_IFMT) == S_IFREG || + (zs->zs_mode&S_IFMT) == S_IFLNK) { + le32p(0xffffffff, zc.zc_csize); + le32p(0xffffffff, zc.zc_nsize); + le64p(zs->zs_csize, zf.ze_64_csize); + le64p(zs->zs_size, zf.ze_64_nsize); + } + le64p(zs->zs_relative, zf.ze_64_reloff); + le32p(0xffffffff, zc.zc_relative); + le16p(SIZEOF_zextra_64, zc.zc_extralen); + bwrite((char *)&zc, SIZEOF_zipcentral); + bwrite(zs->zs_name, sz); + bwrite((char *)&zf, SIZEOF_zextra_64); + } else { + if ((zs->zs_mode&S_IFMT) == S_IFREG || + (zs->zs_mode&S_IFMT) == S_IFLNK) { + le32p(zs->zs_csize, zc.zc_csize); + le32p(zs->zs_size, zc.zc_nsize); + } + le32p(zs->zs_relative, zc.zc_relative); + bwrite((char *)&zc, SIZEOF_zipcentral); + bwrite(zs->zs_name, sz); + } + } + cpend = nwritten; + memset(&ze, 0, SIZEOF_zipend); + memcpy(ze.ze_signature, mag_zipend, 4); + if (cpend >= 0xffffffff || entries >= 0xffff) { + struct zip64end z6; + struct zip64loc z4; + + memset(&z6, 0, SIZEOF_zip64end); + memcpy(z6.z6_signature, mag_zip64e, 4); + le64p(SIZEOF_zip64end - 12, z6.z6_recsize); + z6.z6_versionmade[0] = 20; + z6.z6_versionextr[0] = 20; + le64p(entries, z6.z6_thisentries); + le64p(entries, z6.z6_allentries); + le64p(cpend - cpstart, z6.z6_dirsize); + le64p(cpstart, z6.z6_startsize); + bwrite((char *)&z6, SIZEOF_zip64end); + memset(&z4, 0, SIZEOF_zip64loc); + memcpy(z4.z4_signature, mag_zip64l, 4); + le64p(cpend, z4.z4_reloff); + le32p(1, z4.z4_alldiskn); + bwrite((char *)&z4, SIZEOF_zip64loc); + le16p(0xffff, ze.ze_thisentries); + le16p(0xffff, ze.ze_allentries); + le32p(0xffffffff, ze.ze_dirsize); + le32p(0xffffffff, ze.ze_startsize); + } else { + le16p(entries, ze.ze_thisentries); + le16p(entries, ze.ze_allentries); + le32p(cpend - cpstart, ze.ze_dirsize); + le32p(cpstart, ze.ze_startsize); + } + bwrite((char *)&ze, SIZEOF_zipend); +} + +/* + * Store the data later needed for the central directory. + */ +static void +zipdefer(const char *fn, struct stat *st, long long relative, + uint32_t crc, long long csize, const struct zip_header *zh) +{ + struct zipstuff *zp; + + zp = scalloc(1, sizeof *zp); + zp->zs_name = sstrdup(fn); + zp->zs_size = st->st_size; + zp->zs_mtime = st->st_mtime; + zp->zs_mode = st->st_mode; + zp->zs_relative = relative; + zp->zs_cmethod = ple16(zh->z_cmethod); + zp->zs_gflag = ple16(zh->z_gflag); + zp->zs_csize = csize; + zp->zs_crc32 = crc; + zp->zs_next = zipbulk; + zipbulk = zp; +} + +#define ziptrlevel() ( \ + zipclevel == 01 ? 9 : /* maximum */ \ + zipclevel == 02 ? 3 : /* fast */ \ + zipclevel == 03 ? 1 : /* super fast */\ + /*zipclevel==00*/ 6 /* normal */ \ +) + +/* + * Write (and compress) data for a regular file to a zip archive. + */ +static int +zipwrite(int fd, const char *fn, struct stat *st, union bincpio *bp, size_t sz, + uint32_t dev, uint32_t ino, uint32_t *crc, long long *csize) +{ +#if USE_ZLIB + struct z_stream_s z; + int i; + size_t osize = 0; +#endif /* USE_ZLIB */ + char *ibuf, *obuf = 0; + + if (st->st_size > 196608 || (ibuf = malloc(st->st_size)) == 0) { +#if USE_ZLIB + if (zipclevel < 04) + return zipwdesc(fd, fn, st, bp, sz, dev, ino, + crc, csize); +#endif /* USE_ZLIB */ + return zipwtemp(fd, fn, st, bp, sz, dev, ino, crc, csize); + } + *csize = 0; + if (read(fd, ibuf, st->st_size) != st->st_size) { + free(ibuf); + emsg(3, "Cannot read \"%s\"", fn); + close(fd); + return -1; + } + *crc = zipcrc(0, (unsigned char *)ibuf, st->st_size); +#if USE_BZLIB + if (zipclevel == 07) { + unsigned int sb; + if ((obuf = malloc(sb = st->st_size)) == 0) + goto store; + if (BZ2_bzBuffToBuffCompress(obuf, &sb, ibuf, st->st_size, + 9, 0, 0) != BZ_OK) + goto store; + *csize = sb; + bp->Zdr.z_cmethod[0] = C_BZIP2; + bp->Zdr.z_version[0] = 0x2e; + goto out; + } +#endif /* USE_BZLIB */ + if (zipclevel > 03) + goto store; +#if USE_ZLIB + memset(&z, 0, sizeof z); + if (deflateInit2(&z, ziptrlevel(), Z_DEFLATED, -15, + 8, Z_DEFAULT_STRATEGY) < 0) + goto store; + z.next_in = (unsigned char *)ibuf; + z.avail_in = z.total_in = st->st_size; + do { + if (z.avail_out == 0) { + if ((obuf = realloc(obuf, osize += 4096)) == 0) { + deflateEnd(&z); + goto store; + } + z.next_out = (unsigned char *)&obuf[*csize]; + z.avail_out = osize - *csize; + } + if ((i = deflate(&z, z.avail_in ? Z_NO_FLUSH : Z_FINISH)) < 0) { + deflateEnd(&z); + goto store; + } + *csize = osize - z.avail_out; + } while (z.avail_in || i != Z_STREAM_END); + deflateEnd(&z); + if (*csize < st->st_size) { + bp->Zdr.z_cmethod[0] = C_DEFLATED; + bp->Zdr.z_gflag[0] |= zipclevel << 1; + bp->Zdr.z_version[0] = 20; + } else +#endif /* USE_ZLIB */ + store: *csize = st->st_size; +#if USE_BZLIB +out: +#endif /* USE_BZLIB */ + le32p(*crc, bp->Zdr.z_crc32); + le32p(*csize, bp->Zdr.z_csize); + bwrite((char *)bp, SIZEOF_zip_header); + bwrite(fn, sz); + zipwxtra(fn, st, dev, ino); + switch (bp->Zdr.z_cmethod[0]) { + case C_DEFLATED: + case C_BZIP2: + bwrite(obuf, *csize); + break; + default: + bwrite(ibuf, *csize); + } + free(ibuf); + free(obuf); + close(fd); + return 0; +} + +/* + * Write and compress data to a zip archive for a file that is to large + * too be kept in memory. If there is an error with the temporary file + * (e. g. no space left on device), the file is stored in uncompressed + * form. + */ +static int +zipwtemp(int fd, const char *fn, struct stat *st, union bincpio *bp, size_t sz, + uint32_t dev, uint32_t ino, uint32_t *crc, long long *csize) +{ + static int tf = -1; + static char tlate[] = "/var/tmp/cpioXXXXXX"; + char ibuf[32768]; +#if USE_ZLIB || USE_BZLIB + char obuf[32768]; +#endif /* USE_ZLIB || USE_BZLIB */ + struct zextra_64 zf; + struct zextra_64 *zfp = 0; + long long size = st->st_size; + const char *sname; + int cuse, sf; + ssize_t rd; + + *csize = 0; + *crc = 0; +#if USE_ZLIB || USE_BZLIB + if (tf < 0) { + if ((tf = mkstemp(tlate)) >= 0) + unlink(tlate); + } else if (lseek(tf, 0, SEEK_SET) != 0) { + close(tf); + tf = -1; + } +#endif /* USE_ZLIB || USE_BZLIB */ +#if USE_ZLIB + if (zipclevel < 04) { + struct z_stream_s z; + memset(&z, 0, sizeof z); + if ((cuse = deflateInit2(&z, ziptrlevel(), Z_DEFLATED, + -15, 8, Z_DEFAULT_STRATEGY)) < 0) + goto store; + do { + if (z.avail_in == 0 && size > 0) { + if ((rd = read(fd, ibuf, sizeof ibuf)) <= 0) { + emsg(3, "Cannot read \"%s\"", fn); + close(fd); + ftruncate(tf, 0); + return -1; + } + z.next_in = (unsigned char *)ibuf; + z.avail_in = z.total_in = rd; + size -= rd; + *crc = zipcrc(*crc, (unsigned char *)ibuf, rd); + } + if (z.next_out == NULL || (char *)z.next_out > obuf) { + if (z.next_out && tf >= 0) { + if (write(tf, obuf, + (char *)z.next_out-obuf) != + (char *)z.next_out-obuf) { + close(tf); + tf = -1; + } + *csize += (char *)z.next_out - obuf; + } + z.next_out = (unsigned char *)obuf; + z.avail_out = sizeof obuf; + } + if (cuse >= 0 && cuse != Z_STREAM_END) + cuse = deflate(&z, + z.avail_in?Z_NO_FLUSH:Z_FINISH); + else + z.avail_in = 0; + } while (size>0 || (char *)z.next_out>obuf || + cuse>=0 && cuse!=Z_STREAM_END); + deflateEnd(&z); + goto out; + } +#endif /* USE_ZLIB */ +#if USE_BZLIB + if (zipclevel == 07) { + bz_stream bs; + int ok, on; + memset(&bs, sizeof bs, 0); + if ((ok = BZ2_bzCompressInit(&bs, 9, 0, 0)) != BZ_OK) + goto store; + cuse = 1; + do { + if (bs.avail_in == 0 && size > 0) { + if ((rd = read(fd, ibuf, sizeof ibuf)) <= 0) { + emsg(3, "Cannot read \"%s\"", fn); + close(fd); + ftruncate(tf, 0); + return -1; + } + bs.next_in = ibuf; + bs.avail_in = rd; + size -= rd; + *crc = zipcrc(*crc, (unsigned char *)ibuf, rd); + } + if (bs.next_out == NULL || bs.next_out > obuf) { + if (bs.next_out && tf >= 0) { + on = bs.next_out - obuf; + if (write(tf, obuf, on) != on) { + close(tf); + tf = -1; + } + *csize += on; + } + bs.next_out = obuf; + bs.avail_out = sizeof obuf; + } + if (ok != BZ_STREAM_END) { + switch (ok = BZ2_bzCompress(&bs, + bs.avail_in?BZ_RUN:BZ_FINISH)) { + case BZ_RUN_OK: + case BZ_FINISH_OK: + case BZ_STREAM_END: + break; + default: + msg(3, 1, "Compression error %d " + "on \"%s\"\n", ok, fn); + close(fd); + return -1; + } + } + } while (size > 0 || bs.next_out > obuf || ok != BZ_STREAM_END); + BZ2_bzCompressEnd(&bs); + goto out; + } +#endif /* USE_BZLIB */ +store: cuse = -1; + while (size > 0) { + if ((rd = read(fd, ibuf, sizeof ibuf)) <= 0) { + emsg(3, "Cannot read \"%s\"", fn); + close(fd); + return -1; + } + size -= rd; + *crc = zipcrc(*crc, (unsigned char *)ibuf, rd); + } +out: if (tf >= 0 && cuse >= 0 && *csize < st->st_size) { + if (zipclevel == 07) { + bp->Zdr.z_cmethod[0] = C_BZIP2; + bp->Zdr.z_version[0] = 0x2e; + } else { + bp->Zdr.z_cmethod[0] = C_DEFLATED; + bp->Zdr.z_gflag[0] |= zipclevel << 1; + bp->Zdr.z_version[0] = 20; + } + sf = tf; + sname = tlate; + } else { + *csize = st->st_size; + sf = fd; + sname = fn; + } + if ((lseek(sf, 0, SEEK_SET)) != 0) { + emsg(3, "Cannot rewind \"%s\"", sname); + errcnt++; + close(fd); + ftruncate(tf, 0); + return -1; + } + le32p(*crc, bp->Zdr.z_crc32); + if (st->st_size >= 0xffffffff || *csize >= 0xffffffff) { + int n; + zfp = &zf; + memset(&zf, 0, SIZEOF_zextra_64); + le16p(mag_zip64f, zf.ze_64_tag); + le16p(SIZEOF_zextra_64 - 4, zf.ze_64_tsize); + le64p(st->st_size, zf.ze_64_nsize); + le64p(*csize, zf.ze_64_csize); + le32p(0xffffffff, bp->Zdr.z_csize); + le32p(0xffffffff, bp->Zdr.z_nsize); + n = (ple16(bp->Zdr.z_extralen)&0177777) + SIZEOF_zextra_64; + le16p(n, bp->Zdr.z_extralen); + } else + le32p(*csize, bp->Zdr.z_csize); + bwrite((char *)bp, SIZEOF_zip_header); + bwrite(fn, sz); + if (zfp) + bwrite((char *)zfp, SIZEOF_zextra_64); + zipwxtra(fn, st, dev, ino); + size = *csize; + while (size) { + if ((rd=read(sf, ibuf, size>sizeof ibuf?sizeof ibuf:size)) <= 0) + msg(3, 1, "Cannot read \"%s\"\n", sname); + bwrite(ibuf, rd); + size -= rd; + } + ftruncate(tf, 0); + close(fd); + return 0; +} + +#if USE_ZLIB +/* + * Write a zip archive entry using the data descriptor structure. + */ +static int +zipwdesc(int fd, const char *fn, struct stat *st, union bincpio *bp, size_t sz, + uint32_t dev, uint32_t ino, uint32_t *crc, long long *csize) +{ + struct zextra_64 zf; + struct zextra_64 *zfp = 0; + char ibuf[32768], obuf[32768]; + long long size = st->st_size; + ssize_t rd; + struct z_stream_s z; + int cuse; + + *csize = 0; + *crc = 0; + memset(&z, 0, sizeof z); + if ((cuse = deflateInit2(&z, ziptrlevel(), Z_DEFLATED, + -15, 8, Z_DEFAULT_STRATEGY)) < 0) + return zipwtemp(fd, fn, st, bp, sz, dev, ino, crc, csize); + bp->Zdr.z_cmethod[0] = C_DEFLATED; + bp->Zdr.z_gflag[0] |= zipclevel << 1 | FG_DESC; + bp->Zdr.z_version[0] = 20; + /* + * RFC 1951 states that deflate compression needs 5 bytes additional + * space per 32k block in the worst case. Thus a compressed size + * greater than 4G-1 can be reached if at least 131052 blocks are + * used. + */ + if (st->st_size >= 131052LL*32768) { + int n; + zfp = &zf; + memset(&zf, 0, SIZEOF_zextra_64); + le16p(mag_zip64f, zf.ze_64_tag); + le16p(SIZEOF_zextra_64 - 4, zf.ze_64_tsize); + le32p(0xffffffff, bp->Zdr.z_csize); + le32p(0xffffffff, bp->Zdr.z_nsize); + n = (ple16(bp->Zdr.z_extralen)&0177777) + SIZEOF_zextra_64; + le16p(n, bp->Zdr.z_extralen); + } + bwrite((char *)bp, SIZEOF_zip_header); + bwrite(fn, sz); + if (zfp) + bwrite((char *)zfp, SIZEOF_zextra_64); + zipwxtra(fn, st, dev, ino); + do { + if (z.avail_in == 0 && size > 0) { + if ((rd = read(fd, ibuf, sizeof ibuf)) <= 0) { + emsg(3, "Cannot read \"%s\"", fn); + st->st_size -= size; + size = 0; /* can't simply stop here */ + rd = 0; /* no data */ + } + z.next_in = (unsigned char *)ibuf; + z.avail_in = z.total_in = rd; + size -= rd; + *crc = zipcrc(*crc, (unsigned char *)ibuf, rd); + } + if (z.next_out == NULL || (char *)z.next_out > obuf) { + if (z.next_out) { + bwrite(obuf, (char *)z.next_out - obuf); + *csize += (char *)z.next_out - obuf; + } + z.next_out = (unsigned char *)obuf; + z.avail_out = sizeof obuf; + } + if (cuse >= 0 && cuse != Z_STREAM_END) + cuse = deflate(&z, z.avail_in?Z_NO_FLUSH:Z_FINISH); + else + z.avail_in = 0; + } while (size > 0 || (char *)z.next_out > obuf || + cuse >= 0 && cuse != Z_STREAM_END); + deflateEnd(&z); + if (zfp) { + struct zipddesc64 zd64; + memcpy(zd64.zd_signature, mag_zipdds, sizeof mag_zipdds); + le32p(*crc, zd64.zd_crc32); + le64p(st->st_size, zd64.zd_nsize); + le64p(*csize, zd64.zd_csize); + bwrite((char *)&zd64, SIZEOF_zipddesc64); + } else { + struct zipddesc zd; + memcpy(zd.zd_signature, mag_zipdds, sizeof mag_zipdds); + le32p(*crc, zd.zd_crc32); + le32p(st->st_size, zd.zd_nsize); + le32p(*csize, zd.zd_csize); + bwrite((char *)&zd, SIZEOF_zipddesc); + } + close(fd); + return 0; +} +#endif /* USE_ZLIB */ + +/* + * Write the extra fields for a file to a zip archive (currently + * our own field type). Note that the z_extralen field in the file + * header must correspond to the size of the data written here. + */ +static int +zipwxtra(const char *fn, struct stat *st, uint32_t dev, uint32_t ino) +{ + struct zextra_cp z; + + memset(&z, 0, SIZEOF_zextra_cp); + le16p(mag_zipcpio, z.ze_cp_tag); + le16p(SIZEOF_zextra_cp - 4, z.ze_cp_tsize); + le32p(dev, z.ze_cp_mode); + le32p(ino, z.ze_cp_ino); + le32p(st->st_mode&(S_IFMT|07777), z.ze_cp_mode); + le32p(st->st_uid, z.ze_cp_uid); + le32p(st->st_gid, z.ze_cp_gid); + le32p(st->st_nlink, z.ze_cp_nlink); + le32p(st->st_rdev, z.ze_cp_rdev); + le32p(st->st_mtime, z.ze_cp_mtime); + le32p(st->st_atime, z.ze_cp_atime); + bwrite((char *)&z, SIZEOF_zextra_cp); + return SIZEOF_zextra_cp; +} + +static void +zipinfo(struct file *f) +{ + const char *cp; + char b[5]; + int i; + + printf(" %7llu", f->f_csize); + if (f->f_dsize) { + i = f->f_csize*100 / f->f_dsize; + i += f->f_csize*200 / f->f_dsize & 1; + i = 100 - i; + } else + i = 0; + printf(" %3d%%", i); + switch (f->f_cmethod) { + case C_STORED: + cp = "stor"; + break; + case C_SHRUNK: + cp = "shrk"; + break; + case C_REDUCED1: + cp = "re:1"; + break; + case C_REDUCED2: + cp = "re:2"; + break; + case C_REDUCED3: + cp = "re:3"; + break; + case C_REDUCED4: + cp = "re:4"; + break; + case C_IMPLODED: + b[0] = 'i'; + b[1] = f->f_gflag & FG_BIT1 ? '8' : '4'; + b[2] = ':'; + b[3] = f->f_gflag & FG_BIT2 ? '3' : '2'; + b[4] = '\0'; + cp = b; + break; + case C_TOKENIZED: + cp = "tokn"; + break; + case C_DEFLATED: + b[0] = 'd', b[1] = 'e', b[2] = 'f', b[4] = '\0'; + if (f->f_gflag & FG_BIT2) + b[3] = f->f_gflag & FG_BIT1 ? 'S' : 'F'; + else + b[3] = f->f_gflag & FG_BIT1 ? 'X' : 'N'; + cp = b; + break; + case C_ENHDEFLD: + cp = "edef"; + break; + case C_DCLIMPLODED: + cp = "dcli"; + break; + case C_BZIP2: + cp = "bz2 "; + break; + default: + snprintf(b, sizeof b, "%4.4X", f->f_cmethod); + cp = b; + } + printf(" %s", cp); +} + +#if USE_BZLIB +int +zipunbz2(struct file *f, const char *tgt, int tfd, int doswap, uint32_t *crc) +{ + bz_stream bs; + long long isize = f->f_csize; + char ibuf[4096], obuf[8192]; + int in, on, val = 0, ok; + + memset(&bs, 0, sizeof bs); + + if ((ok = BZ2_bzDecompressInit(&bs, 0, 0)) != BZ_OK) { + msg(3, 0, "bzip2 initialization error %d on \"%s\"\n", + ok, f->f_name); + errcnt++; + return skipfile(f); + } + while (isize > 0 || ok == BZ_OK) { + if (bs.avail_in == 0 && isize > 0) { + in = sizeof ibuf < isize ? sizeof ibuf : isize; + isize -= in; + if (bread(ibuf, in) != in) + unexeoa(); + if (doswap) + swap(ibuf, in, bflag || sflag, bflag || Sflag); + bs.next_in = ibuf; + bs.avail_in = in; + } + if (ok == BZ_OK) { + bs.next_out = obuf; + bs.avail_out = sizeof obuf; + switch (ok = BZ2_bzDecompress(&bs)) { + case BZ_OK: + case BZ_STREAM_END: + on = sizeof obuf - bs.avail_out; + if (tfd >= 0 && write(tfd, obuf, on) != on) { + emsg(3, "Cannot write \"%s\"", tgt); + tfd = -1; + val = 1; + } + *crc = zipcrc(*crc, (unsigned char *)obuf, on); + break; + default: + msg(3, 0, "compression error %d on \"%s\"\n", + ok, f->f_name); + errcnt++; + val = 1; + } + } + } + BZ2_bzDecompressEnd(&bs); + return val; +} +#endif /* USE_BZLIB */ + +struct blasthow { + struct file *bh_f; + const char *bh_tgt; + long long bh_isize; + uint32_t *bh_crc; + int bh_tfd; + int bh_doswap; + int bh_val; +}; + +static unsigned +blastin(void *how, unsigned char **buf) +{ + const int chunk = 16384; + static unsigned char *hold; + struct blasthow *bp = how; + unsigned sz; + + if (bp->bh_isize <= 0) + return 0; + if (hold == NULL) + hold = smalloc(chunk); + sz = bp->bh_isize > chunk ? chunk : bp->bh_isize; + bp->bh_isize -= sz; + if (bread((char *)hold, sz) != sz) + unexeoa(); + if (bp->bh_doswap) + swap((char *)hold, sz, bflag || sflag, bflag || Sflag); + *buf = hold; + return sz; +} + +static int +blastout(void *how, unsigned char *buf, unsigned len) +{ + struct blasthow *bp = how; + + if (bp->bh_tfd >= 0 && write(bp->bh_tfd, buf, len) != len) { + emsg(3, "Cannot write \"%s\"", bp->bh_tgt); + bp->bh_tfd = -1; + bp->bh_val = 1; + } + *bp->bh_crc = zipcrc(*bp->bh_crc, buf, len); + return 0; +} + +int +zipblast(struct file *f, const char *tgt, int tfd, int doswap, uint32_t *crc) +{ + struct blasthow bh; + int n; + + bh.bh_f = f; + bh.bh_tgt = tgt; + bh.bh_isize = f->f_csize; + bh.bh_crc = crc; + bh.bh_tfd = tfd; + bh.bh_doswap = doswap; + bh.bh_val = 0; + switch (n = blast(blastin, &bh, blastout, &bh)) { + case 0: + break; + default: + msg(3, 0, "compression error %d on \"%s\"\n", n, f->f_name); + errcnt++; + bh.bh_val = 1; + } + while (bh.bh_isize) { + char buf[4096]; + unsigned n; + n = bh.bh_isize > sizeof buf ? sizeof buf : bh.bh_isize; + if (bread(buf, n) != n) + unexeoa(); + bh.bh_isize -= n; + } + return bh.bh_val; +} + +/* + * The SGI -K format was introduced with SGI's IRIX 5.X. It is essentially + * a slightly extended binary format. The known additions are: + * + * - If the major or minor st_rdev device number exceeds the limit of + * 255 imposed by the 16-bit c_rdev field, this field is set to 0xFFFF + * and st_rdev is stored in the c_filesize 32-bit field. The first 14 + * bits of this field compose the major device number, the minor is + * stored in the remaining 18 bits. This enables implementations to + * read the modified format without special support if they ignore + * the size of device files; otherwise they will try to read a lot + * of archive data and fail. + * + * - If the file is larger than 2 GB - 1 byte, two nearly identical + * archive headers are stored for it. The only difference is in + * the c_filesize field: + * + * [first header: file size X times 2 GB] + * [first data part: X times 2 GB] + * [second header: file size modulo 2 GB] + * [second data part: rest of data] + * + * The first header can be recognized by a negative c_filesize. A + * value of 0xFFFFFFFF means that 2 GB follow, 0xFFFFFFFE -> 4 GB + * 0xFFFFFFFD -> 6 GB, 0xFFFFFFFC -> 8 GB, and so forth. The second + * is a standard binary cpio header, although the following data is + * meant to be appended to the preceding file. + * + * It is important to note that padding follows the number in + * c_filesize, not the amount of data written; thus all data parts + * with odd c_filesize fields (0xFFFFFFFF = 2+ GB, 0xFFFFFFFD = 6+ GB + * etc.) cause the following archive entries to be aligned on an odd + * offset. This seems to be an implementation artifact but has to be + * followed for compatibility. + * + * This extension seems a bit weird since no known cpio implementation + * is able to read these archive entries without special support. Thus + * a more straightforward extension (such as storing the size just past + * the file name) would well have had the same effect. Nevertheless, + * the cpio -K format is useful, so it is implemented here. + * + * --Note that IRIX 6.X tar also has a -K option. This option extends + * the tar format in essentially the same way as the second extension + * to cpio described above. Unfortunately, the result is definitively + * broken. Contrasting to the binary cpio format, the standard POSIX + * tar format is well able to hold files of size 0xFFFFFFFF and below + * in a regular manner. Thus, a tar -K archive entry is _exactly_ the + * same as two regular POSIX tar entries for the same file. And this + * situation even occurs on a regular basis with tar -r! For this + * reason, we do not implement the IRIX tar -K format and will probably + * never do so unless it is changed (the tar format really has a lot + * of options to indicate extensions that might be used for this). + * + * Many thanks to Sven Mascheck who made archiving tests on the IRIX + * machine. + */ +/* + * This function reads the second header of a SGI -K format archive. + */ +static void +readK2hdr(struct file *f) +{ + struct file n; + union bincpio bc; + + n.f_name = n.f_lnam = NULL; + n.f_nsiz = n.f_lsiz = 0; + readhdr(&n, &bc); + f->f_Krest = n.f_st.st_size; + f->f_dsize = f->f_st.st_size = n.f_st.st_size + f->f_Kbase; + f->f_Kbase = 0; + free(n.f_name); + free(n.f_lnam); +} + +/* + * Read the data of a GNU filename extra header. + */ +static int +readgnuname(char **np, size_t *sp, long length) +{ + if (length > SANELIMIT) + return -1; + if (*sp == 0 || *sp <= length) + *np = srealloc(*np, *sp = length+1); + bread(*np, length); + (*np)[length] = '\0'; + skippad(length, 512); + return 0; +} + +/* + * Write a GNU filename extra header and its data. + */ +static void +writegnuname(const char *fn, long length, int flag) +{ + union bincpio bc; + + memset(bc.data, 0, 512); + strcpy(bc.Tdr.t_name, "././@LongLink"); + sprintf(bc.Tdr.t_mode, "%7.7o", 0); + sprintf(bc.Tdr.t_uid, "%7.7o", 0); + sprintf(bc.Tdr.t_gid, "%7.7o", 0); + sprintf(bc.Tdr.t_size, "%11.11lo", length); + sprintf(bc.Tdr.t_mtime, "%11.11lo", 0L); + bc.Tdr.t_linkflag = flag; + memcpy(bc.Tdr.t_magic, mag_gnutar, 8); + strcpy(bc.Tdr.t_uname, "root"); + strcpy(bc.Tdr.t_gname, "root"); + tchksum(&bc); + bwrite(bc.data, 512); + bwrite(fn, length); + length %= 512; + memset(bc.data, 0, 512 - length); + bwrite(bc.data, 512 - length); +} + +/* + * POSIX.1-2001 pax format support. + */ +static void +tgetpax(struct tar_header *tp, struct file *f) +{ + char *keyword, *value; + char *block, *bp; + long long n; + enum paxrec pr; + + n = rdoct(tp->t_size, 12); + bp = block = smalloc(n+1); + bread(block, n); + skippad(n, 512); + block[n] = '\0'; + while (bp < &block[n]) { + int c; + pr = tgetrec(&bp, &keyword, &value); + switch (pr) { + case PR_ATIME: + f->f_st.st_atime = strtoll(value, NULL, 10); + break; + case PR_GID: + f->f_st.st_gid = strtoll(value, NULL, 10); + break; + case PR_LINKPATH: + c = strlen(value); + if (f->f_lnam == NULL || f->f_lsiz < c+1) { + f->f_lsiz = c+1; + f->f_lnam = srealloc(f->f_lnam, c+1); + } + strcpy(f->f_lnam, value); + break; + case PR_MTIME: + f->f_st.st_mtime = strtoll(value, NULL, 10); + break; + case PR_PATH: + c = strlen(value); + if (f->f_name == NULL || f->f_nsiz < c+1) { + f->f_nsiz = c+1; + f->f_name = srealloc(f->f_name, c+1); + } + strcpy(f->f_name, value); + break; + case PR_SIZE: + f->f_st.st_size = strtoll(value, NULL, 10); + break; + case PR_UID: + f->f_st.st_uid = strtoll(value, NULL, 10); + break; + case PR_SUN_DEVMAJOR: + f->f_rmajor = strtoll(value, NULL, 10); + break; + case PR_SUN_DEVMINOR: + f->f_rminor = strtoll(value, NULL, 10); + break; + } + paxrec |= pr; + } + if (tp->t_linkflag == 'g') { + globrec = paxrec & ~(PR_LINKPATH|PR_PATH|PR_SIZE); + globst = f->f_st; + } + free(block); +} + +static enum paxrec +tgetrec(char **bp, char **keyword, char **value) +{ + char *x; + long n = 0; + enum paxrec pr; + + *keyword = ""; + *value = ""; + while (**bp && (n = strtol(*bp, &x, 10)) <= 0 && (*x!=' ' || *x!='\t')) + do + (*bp)++; + while (**bp && **bp != '\n'); + if (*x == '\0' || **bp == '\0') { + (*bp)++; + return PR_NONE; + } + while (x < &(*bp)[n] && (*x == ' ' || *x == '\t')) + x++; + if (x == &(*bp)[n] || *x == '=') + goto out; + *keyword = x; + while (x < &(*bp)[n] && *x != '=') + x++; + if (x == &(*bp)[n]) + goto out; + *x = '\0'; + if (&x[1] < &(*bp)[n]) + *value = &x[1]; + (*bp)[n-1] = '\0'; +out: *bp = &(*bp)[n]; + if (strcmp(*keyword, "atime") == 0) + pr = PR_ATIME; + else if (strcmp(*keyword, "gid") == 0) + pr = PR_GID; + else if (strcmp(*keyword, "linkpath") == 0) + pr = PR_LINKPATH; + else if (strcmp(*keyword, "mtime") == 0) + pr = PR_MTIME; + else if (strcmp(*keyword, "path") == 0) + pr = PR_PATH; + else if (strcmp(*keyword, "size") == 0) + pr = PR_SIZE; + else if (strcmp(*keyword, "uid") == 0) + pr = PR_UID; + else if (strcmp(*keyword, "SUN.devmajor") == 0) + pr = PR_SUN_DEVMAJOR; + else if (strcmp(*keyword, "SUN.devminor") == 0) + pr = PR_SUN_DEVMINOR; + else + pr = PR_NONE; + return pr; +} + +static void +wrpax(const char *longname, const char *linkname, struct stat *sp) +{ + union bincpio bc; + char *pdata = NULL; + long psize = 0, pcur = 0; + long long blocks; + + memset(bc.data, 0, 512); + if (paxrec & PR_ATIME) + addrec(&pdata, &psize, &pcur, "atime", NULL, sp->st_atime); + if (paxrec & PR_GID) + addrec(&pdata, &psize, &pcur, "gid", NULL, sp->st_gid); + if (paxrec & PR_LINKPATH) + addrec(&pdata, &psize, &pcur, "linkpath", linkname, 0); + if (paxrec & PR_MTIME) + addrec(&pdata, &psize, &pcur, "mtime", NULL, sp->st_mtime); + if (paxrec & PR_PATH) + addrec(&pdata, &psize, &pcur, "path", longname, 0); + if (paxrec & PR_SIZE) + addrec(&pdata, &psize, &pcur, "size", NULL, sp->st_size); + if (paxrec & PR_UID) + addrec(&pdata, &psize, &pcur, "uid", NULL, sp->st_uid); + if (paxrec & PR_SUN_DEVMAJOR) + addrec(&pdata, &psize, &pcur, "SUN.devmajor", NULL, + major(sp->st_rdev)); + if (paxrec & PR_SUN_DEVMINOR) + addrec(&pdata, &psize, &pcur, "SUN.devminor", NULL, + minor(sp->st_rdev)); + paxnam(&bc.Tdr, longname); + sprintf(bc.Tdr.t_mode, "%7.7o", fmttype==FMT_SUN ? 0444|S_IFREG : 0444); + sprintf(bc.Tdr.t_uid, "%7.7o", 0); + sprintf(bc.Tdr.t_gid, "%7.7o", 0); + sprintf(bc.Tdr.t_size, "%11.11lo", pcur); + sprintf(bc.Tdr.t_mtime, "%11.11o", 0); + strcpy(bc.Tdr.t_magic, "ustar"); + bc.Tdr.t_version[0] = bc.Tdr.t_version[1] = '0'; + strcpy(bc.Tdr.t_uname, "root"); + strcpy(bc.Tdr.t_gname, "root"); + bc.Tdr.t_linkflag = fmttype==FMT_SUN ? 'X' : 'x'; + tchksum(&bc); + bwrite(bc.data, 512); + memset(&pdata[pcur], 0, psize - pcur); + blocks = (pcur + (512-1)) / 512; + bwrite(pdata, blocks * 512); + free(pdata); +} + +static void +addrec(char **pdata, long *psize, long *pcur, + const char *keyword, const char *sval, long long lval) +{ + char dval[25], xval[25]; + long od, d, r; + + if (sval == 0) { + sprintf(xval, "%lld", lval); + sval = xval; + } + r = strlen(keyword) + strlen(sval) + 3; + d = 0; + do { + od = d; + d = sprintf(dval, "%ld", od + r); + } while (d != od); + *psize += d + r + 1 + 512; + *pdata = srealloc(*pdata, *psize); + sprintf(&(*pdata)[*pcur], "%s %s=%s\n", dval, keyword, sval); + *pcur += d + r; +} + +static void +paxnam(struct tar_header *hp, const char *name) +{ + char buf[257], *bp; + const char *cp, *np; + int bl = 0; + static int pid; + + if (pid == 0) + pid = getpid(); + for (np = name; *np; np++); + while (np > name && *np != '/') { + np--; + bl++; + } + if ((np > name || *name == '/') && np-name <= 120) + for (bp = buf, cp = name; cp < np; bp++, cp++) + *bp = *cp; + else { + *buf = '.'; + bp = &buf[1]; + } + snprintf(bp, sizeof buf - (bp - buf), "/PaxHeaders.%d/%s", + pid, bl < 100 ? np>name?&np[1]:name : sequence()); + tmkname(hp, buf); +} + +static char * +sequence(void) +{ + static char buf[25]; + static long long d; + + sprintf(buf, "%10.10lld", ++d); + return buf; +} + +static int +pax_oneopt(const char *s, int warn) +{ + if (strcmp(s, "linkdata") == 0) + pax_oflag |= PO_LINKDATA; + else if (strcmp(s, "times") == 0) + pax_oflag |= PO_TIMES; + else { + if (warn) + msg(2, 0, "Unknown flag \"-o %s\"\n", s); + return -1; + } + return 0; +} + +int +pax_options(char *s, int warn) +{ + char *o = s, c; + int val = 0, word = 0; + + do { + if (word == 0) { + if (isspace(*s&0377)) + o = &s[1]; + else + word = 1; + } + if (*s == ',' || *s == '\0') { + c = *s; + *s = '\0'; + val |= pax_oneopt(o, warn); + *s = c; + o = &s[1]; + word = 0; + } + } while (*s++); + return val; +} + +/* + * Given a symbolic link "base" and the result of readlink "name", form + * a valid path name for the link target. + */ +static char * +joinpath(const char *base, char *name) +{ + const char *bp = NULL, *cp; + char *new, *np; + + if (*name == '/') + return name; + for (cp = base; *cp; cp++) + if (*cp == '/') + bp = cp; + if (bp == NULL) + return name; + np = new = smalloc(bp - base + strlen(name) + 2); + for (cp = base; cp < bp; cp++) + *np++ = *cp; + *np++ = '/'; + for (cp = name; *cp; cp++) + *np++ = *cp; + *np = '\0'; + free(name); + return new; +} + +static int +utf8(const char *cp) +{ + int c, n; + + while (*cp) if ((c = *cp++ & 0377) & 0200) { + if (c == (c & 037 | 0300)) + n = 1; + else if (c == (c & 017 | 0340)) + n = 2; + else if (c == (c & 07 | 0360)) + n = 3; + else if (c == (c & 03 | 0370)) + n = 4; + else if (c == (c & 01 | 0374)) + n = 5; + else + return 0; + while (n--) { + c = *cp++ & 0377; + if (c != (c & 077 | 0200)) + return 0; + } + } + return 1; +} + +static time_t +fetchtime(const char *cp) +{ + struct tm tm; + time_t t; + char *xp; + int n; + + t = strtoll(cp, &xp, 10); + if (*xp == '\0') + return t; + memset(&tm, 0, sizeof tm); + n = sscanf(cp, "%4d%2d%2dT%2d%2d%2d", + &tm.tm_year, &tm.tm_mon, &tm.tm_mday, + &tm.tm_hour, &tm.tm_min, &tm.tm_sec); + tm.tm_year -= 1900; + tm.tm_mon--; + tm.tm_isdst = -1; + t = mktime(&tm); + if (n < 3 || t == (time_t)-1) + msg(4, 1, "line %lld: illegal time \"%s\"\n", + lineno, cp); + return t; +} + +static char * +nextfield(char *cp, const char *fieldname) +{ + while (*cp && *cp != ':') + cp++; + if (*cp == 0) + msg(4, 1, "line %lld: unterminated \"%s\" field\n", + lineno, fieldname); + *cp++ = 0; + return cp; +} + +static char * +getproto(char *np, struct prototype *pp) +{ + char *tp, *xp; + long long t, u; + + memset(pp, 0, sizeof *pp); + if (*np == ':') + np++; + else { + tp = nextfield(np, "type"); + if (np[1]) + goto notype; + switch (np[0]) { + case 'b': + pp->pt_mode |= S_IFBLK; + break; + case 'c': + pp->pt_mode |= S_IFCHR; + break; + case 'd': + pp->pt_mode |= S_IFDIR; + break; + case 'f': + pp->pt_mode |= S_IFREG; + break; + case 'p': + pp->pt_mode |= S_IFIFO; + break; + case 's': + pp->pt_mode |= S_IFLNK; + break; + default: + notype: + msg(4, 1, "line %lld: unknown type \"%s\"\n", + lineno, np); + } + pp->pt_spec |= PT_TYPE; + np = tp; + } + if (*np == ':') + np++; + else { + struct passwd *pwd; + tp = nextfield(np, "owner"); + t = strtoll(np, &xp, 10); + if (*xp == '\0') + pp->pt_uid = t; + else { + if ((pwd = getpwnam(np)) == NULL) + msg(4, 1, "line %lld: unknown user \"%s\"\n", + lineno, np); + pp->pt_uid = pwd->pw_uid; + } + pp->pt_spec |= PT_OWNER; + np = tp; + } + if (*np == ':') + np++; + else { + struct group *grp; + tp = nextfield(np, "group"); + t = strtoll(np, &xp, 10); + if (*xp == '\0') + pp->pt_gid = t; + else { + if ((grp = getgrnam(np)) == NULL) + msg(4, 1, "line %lld: unknown group \"%s\"\n", + lineno, np); + pp->pt_gid = grp->gr_gid; + } + pp->pt_spec |= PT_GROUP; + np = tp; + } + if (*np == ':') + np++; + else { + tp = nextfield(np, "mode"); + t = strtol(np, &xp, 8); + if (t & ~07777 || *xp) + msg(4, 1, "line %lld: illegal mode \"%s\"\n", + lineno, np); + pp->pt_mode |= t; + pp->pt_spec |= PT_MODE; + np = tp; + } + if (*np == ':') + np++; + else { + tp = nextfield(np, "access time"); + pp->pt_atime = fetchtime(np); + pp->pt_spec |= PT_ATIME; + np = tp; + } + if (*np == ':') + np++; + else { + tp = nextfield(np, "modification time"); + pp->pt_mtime = fetchtime(np); + pp->pt_spec |= PT_MTIME; + np = tp; + } + if (*np == ':') { + np++; + if (*np++ != ':') + majmin: msg(4, 1, "line %lld: need either both major and " + "minor or none\n", + lineno); + } else { + tp = nextfield(np, "major"); + t = strtoll(np, &xp, 10); + if (*xp) + msg(4, 1, "line %lld: illegal major \"%s\"\n", + lineno, np); + np = tp; + if (*np == ':') + goto majmin; + tp = nextfield(np, "minor"); + u = strtoll(np, &xp, 10); + if (*xp) + msg(4, 1, "line %lld: illegal minor \"%s\"\n", + lineno, np); + np = tp; + pp->pt_rdev = makedev(t, u); + pp->pt_spec |= PT_RDEV; + } + return np; +} diff --git a/package/heirloom-cpio/src/cpio.h b/package/heirloom-cpio/src/cpio.h new file mode 100644 index 000000000..131a3d388 --- /dev/null +++ b/package/heirloom-cpio/src/cpio.h @@ -0,0 +1,232 @@ +/* + * cpio - copy file archives in and out + * + * Gunnar Ritter, Freiburg i. Br., Germany, April 2003. + */ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +/* Sccsid @(#)cpio.h 1.29 (gritter) 3/26/07 */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <inttypes.h> + +enum { + FMT_NONE = 00000000, /* no format chosen yet */ + + TYP_PAX = 00000010, /* uses pax-like extended headers */ + TYP_BE = 00000100, /* this binary archive is big-endian */ + TYP_SGI = 00000200, /* SGI cpio -K flag binary archive */ + TYP_SCO = 00000200, /* SCO UnixWare 7.1 extended archive */ + TYP_CRC = 00000400, /* this has a SVR4 'crc' checksum */ + TYP_BINARY = 00001000, /* this is a binary cpio type */ + TYP_OCPIO = 00002000, /* this is an old cpio type */ + TYP_NCPIO = 00004000, /* this is a SVR4 cpio type */ + TYP_CRAY = 00010000, /* this is a Cray cpio archive */ + TYP_CPIO = 00077000, /* this is a cpio type */ + TYP_OTAR = 00100000, /* this is an old tar type */ + TYP_USTAR = 00200000, /* this is a ustar type */ + TYP_BAR = 00400000, /* this is a bar type */ + TYP_TAR = 00700000, /* this is a tar type */ + + FMT_ODC = 00002001, /* POSIX ASCII cpio format */ + FMT_DEC = 00002002, /* DEC extended cpio format */ + FMT_BINLE = 00003001, /* binary (default) cpio format LE */ + FMT_BINBE = 00003101, /* binary (default) cpio format BE */ + FMT_SGILE = 00003201, /* IRIX-style -K binary format LE */ + FMT_SGIBE = 00003301, /* IRIX-style -K binary format BE */ + FMT_ASC = 00004001, /* SVR4 ASCII cpio format */ + FMT_SCOASC = 00004201, /* UnixWare 7.1 ASCII cpio format */ + FMT_CRC = 00004401, /* SVR4 ASCII cpio format w/checksum */ + FMT_SCOCRC = 00004601, /* UnixWare 7.1 ASCII cpio w/checksum */ + FMT_CRAY = 00010001, /* Cray cpio, UNICOS 6 and later */ + FMT_CRAY5 = 00010002, /* Cray cpio, UNICOS 5 and earlier */ + FMT_OTAR = 00100001, /* obsolete tar format */ + FMT_TAR = 00200001, /* our tar format type */ + FMT_USTAR = 00200002, /* ustar format */ + FMT_GNUTAR = 00200003, /* GNU tar format type */ + FMT_PAX = 00200011, /* POSIX.1-2001 pax format type */ + FMT_SUN = 00200012, /* Sun extended tar format type */ + FMT_BAR = 00400001, /* bar format type */ + + FMT_ZIP = 01000000 /* zip format */ +} fmttype; + +/* + * Zip compression method. + */ +enum cmethod { + C_STORED = 0, /* no compression */ + C_SHRUNK = 1, + C_REDUCED1 = 2, + C_REDUCED2 = 3, + C_REDUCED3 = 4, + C_REDUCED4 = 5, + C_IMPLODED = 6, + C_TOKENIZED = 7, + C_DEFLATED = 8, + C_ENHDEFLD = 9, + C_DCLIMPLODED = 10, + C_PKRESERVED = 11, + C_BZIP2 = 12, +}; + +/* + * A collection of the interesting facts about a file in copy-in mode. + */ +struct file { + struct stat f_st; /* file stat */ + long long f_rmajor; /* st_rdev major */ + long long f_rminor; /* st_rdev minor */ + long long f_dsize; /* display size */ + long long f_csize; /* compressed size */ + long long f_Kbase; /* base size for -K */ + long long f_Krest; /* rest size for -K */ + long long f_Ksize; /* faked -K size field */ + char *f_name; /* file name */ + size_t f_nsiz; /* file name size */ + char *f_lnam; /* link name */ + size_t f_lsiz; /* link name size */ + uint32_t f_chksum; /* checksum */ + int f_pad; /* padding size */ + int f_fd; /* file descriptor (for pass mode) */ + enum cmethod f_cmethod; /* zip compression method */ + enum { + FG_CRYPT = 0001, /* encrypted zip file */ + FG_BIT1 = 0002, + FG_BIT2 = 0004, + FG_DESC = 0010 /* zip file with data descriptor */ + } f_gflag; /* zip general flag */ + enum { + OF_ZIP64 = 0001 /* is a zip64 archive entry */ + } f_oflag; /* other flags */ +}; + +/* + * Patterns for gmatch(). + */ +struct glist { + struct glist *g_nxt; + const char *g_pat; + unsigned g_gotcha : 1; + unsigned g_not : 1; + unsigned g_art : 1; +}; + +extern int aflag; +extern int Aflag; +extern int bflag; +extern int Bflag; +extern int cflag; +extern int Cflag; +extern int dflag; +extern int Dflag; +extern int eflag; +extern int cray_eflag; +extern const char *Eflag; +extern int fflag; +extern int Hflag; +extern const char *Iflag; +extern int kflag; +extern int Kflag; +extern int lflag; +extern int Lflag; +extern int mflag; +extern const char *Mflag; +extern const char *Oflag; +extern int Pflag; +extern int rflag; +extern const char *Rflag; +extern int sflag; +extern int Sflag; +extern int tflag; +extern int uflag; +extern int hp_Uflag; +extern int vflag; +extern int Vflag; +extern int sixflag; +extern int action; +extern long long errcnt; +extern int blksiz; +extern int sysv3; +extern int printsev; +extern char *progname; +extern struct glist *patterns; + +enum { /* type of pax command this is */ + PAX_TYPE_CPIO = 0, /* not a pax command */ + PAX_TYPE_PAX1992 = 1, /* POSIX.2 pax command */ + PAX_TYPE_PAX2001 = 2 /* POSIX.1-2001 pax command */ +} pax; +extern int pax_dflag; +extern int pax_kflag; +extern int pax_nflag; +extern int pax_sflag; +extern int pax_uflag; +extern int pax_Xflag; + +enum { + PAX_P_NONE = 0000, + PAX_P_ATIME = 0001, + PAX_P_MTIME = 0004, + PAX_P_OWNER = 0010, + PAX_P_MODE = 0020, + PAX_P_EVERY = 0400 +} pax_preserve; + +extern size_t (*ofiles)(char **, size_t *); +extern void (*prtime)(time_t); + +extern ssize_t bread(char *, size_t); +extern void bunread(const char *, size_t); +extern void swap(char *, size_t, int, int); +extern void msg(int, int, const char *, ...); +extern void emsg(int, const char *, ...); +extern void unexeoa(void); +extern int setfmt(char *); +extern char *oneintfmt(const char *); +extern int setreassign(const char *); +extern void addg(const char *, int); +extern void *srealloc(void *, size_t); +extern void *smalloc(size_t); +extern void *scalloc(size_t, size_t); +extern void *svalloc(size_t, int); +extern char *sstrdup(const char *); +extern int pax_options(char *, int); + +extern int zipunshrink(struct file *, const char *, int, int, uint32_t *); +extern int zipexplode(struct file *, const char *, int, int, uint32_t *); +extern int zipexpand(struct file *, const char *, int, int, uint32_t *); +extern int zipinflate(struct file *, const char *, int, int, uint32_t *); +extern int zipunbz2(struct file *, const char *, int, int, uint32_t *); +extern int zipblast(struct file *, const char *, int, int, uint32_t *); + +extern uint32_t zipcrc(uint32_t, const uint8_t *, size_t); + +extern void flags(int, char **); +extern void usage(void); + +extern int pax_track(const char *, time_t); +extern void pax_prlink(struct file *); +extern int pax_sname(char **, size_t *); +extern void pax_onexit(void); diff --git a/package/heirloom-cpio/src/crc32.c b/package/heirloom-cpio/src/crc32.c new file mode 100644 index 000000000..084cb52cf --- /dev/null +++ b/package/heirloom-cpio/src/crc32.c @@ -0,0 +1,115 @@ +/* + * Changes by Gunnar Ritter, Freiburg i. Br., Germany, May 2003. + * + * Derived from zlib 1.1.4 + * + * Sccsid @(#)crc32.c 1.2 (gritter) 5/29/03 + */ +/* crc32.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995-2002 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + + Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + */ + +#include "cpio.h" + +/* + * Table of CRC-32's of all single-byte values (made by make_crc_table) + */ +static const uint32_t crc_table[256] = { + 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, + 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, + 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, + 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, + 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, + 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, + 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, + 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, + 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, + 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, + 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, + 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, + 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, + 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, + 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, + 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, + 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, + 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, + 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, + 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, + 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, + 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, + 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, + 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, + 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, + 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, + 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, + 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, + 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, + 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, + 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, + 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, + 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, + 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, + 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, + 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, + 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, + 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, + 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, + 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, + 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, + 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, + 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, + 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, + 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, + 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, + 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, + 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, + 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, + 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, + 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, + 0x2d02ef8dL +}; + +#define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8); +#define DO2(buf) DO1(buf); DO1(buf); +#define DO4(buf) DO2(buf); DO2(buf); +#define DO8(buf) DO4(buf); DO4(buf); + +/* ========================================================================= */ +uint32_t +zipcrc(uint32_t crc, const uint8_t *buf, size_t len) +{ + if (buf == 0) + return 0L; + crc = crc ^ 0xffffffffL; + while (len >= 8) + { + DO8(buf); + len -= 8; + } + if (len) do { + DO1(buf); + } while (--len); + return crc ^ 0xffffffffL; +} diff --git a/package/heirloom-cpio/src/expand.c b/package/heirloom-cpio/src/expand.c new file mode 100644 index 000000000..5a5233f3e --- /dev/null +++ b/package/heirloom-cpio/src/expand.c @@ -0,0 +1,193 @@ +/* + * cpio - copy file archives in and out + * + * Gunnar Ritter, Freiburg i. Br., Germany, April 2003. + */ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +/* Sccsid @(#)expand.c 1.6 (gritter) 12/15/03 */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include "cpio.h" + +#define DLE 144 + +static void +zexread(char *data, size_t size, int doswap) +{ + if (bread(data, size) != size) + unexeoa(); + if (doswap) + swap(data, size, bflag || sflag, bflag || Sflag); +} + +#define nextbyte() ( \ + ipos >= sizeof ibuf && isize > 0 ? ( \ + zexread(ibuf, isize>sizeof ibuf?sizeof ibuf:isize, doswap), \ + ipos = 0 \ + ) : 0, \ + isize--, \ + ibuf[ipos++] & 0377 \ +) + +#define nextbit() ( \ + ibit = ibit >= 7 ? (ibyte = nextbyte(), 0) : ibit + 1, \ + isize < 0 ? (ieof = 1, -1) : (ibyte & (1<<ibit)) >> ibit \ +) + +#define sixbits(n) { \ + int t; \ + (n) = 0; \ + for (t = 0; t < 6; t++) \ + (n) |= nextbit() << t; \ +} + +#define eightbits(n) { \ + int t; \ + (n) = 0; \ + for (t = 0; t < 8; t++) \ + (n) |= nextbit() << t; \ +} + +static void +zexwrite(int *tfd, char *data, size_t size, uint32_t *crc, int *val, + const char *tgt, long long *nsize) +{ + if (size) { + if (size > *nsize) + size = *nsize; + if (*tfd >= 0 && write(*tfd, data, size) != size) { + emsg(3, "Cannot write \"%s\"", tgt); + *tfd = -1; + *val = -1; + } + *crc = zipcrc(*crc, (unsigned char *)data, size); + *nsize -= size; + } +} + +#define wadd(c) ( \ + wpos >= sizeof wbuf ? ( \ + zexwrite(&tfd, wbuf, sizeof wbuf, crc, &val, tgt, &nsize), \ + wpos = 0 \ + ) : 0, \ + wsize++, \ + wbuf[wpos++] = (c) \ +) + +#define zex_L(x) ( \ + f->f_cmethod == C_REDUCED1 ? (x) & 0177 : \ + f->f_cmethod == C_REDUCED2 ? (x) & 077 : \ + f->f_cmethod == C_REDUCED3 ? (x) & 037 : \ + /* f->f_cmethod == C_REDUCED4 */ (x) & 017 \ +) + +#define zex_F(x) ( \ + f->f_cmethod == C_REDUCED1 ? (x) == 0177 ? 2 : 3 : \ + f->f_cmethod == C_REDUCED2 ? (x) == 077 ? 2 : 3 : \ + f->f_cmethod == C_REDUCED3 ? (x) == 037 ? 2 : 3 : \ + /* f->f_cmethod == C_REDUCED4 */ (x) == 017 ? 2 : 3 \ +) + +#define zex_D(x, y) ( \ + f->f_cmethod == C_REDUCED1 ? (((x)&0200)>>7) * 0400 + (y) + 1 : \ + f->f_cmethod == C_REDUCED2 ? (((x)&0300)>>6) * 0400 + (y) + 1 : \ + f->f_cmethod == C_REDUCED3 ? (((x)&0340)>>5) * 0400 + (y) + 1 : \ + /* f->f_cmethod == C_REDUCED4 */ (((x)&0360)>>4) * 0400 + (y) + 1 \ +) + +int +zipexpand(struct file *f, const char *tgt, int tfd, int doswap, uint32_t *crc) +{ + char fset[256][33]; + char ibuf[4096], ibyte = 0, wbuf[8192]; + long ipos = sizeof ibuf, wpos = 0, isize = f->f_csize, wsize = 0; + int val = 0, ieof = 0; + int c = 0, i, j, k, n, ibit = 7, lastc, state, v = 0, len = 0; + long long nsize = f->f_st.st_size; + + *crc = 0; + memset(fset, 0, sizeof fset); + for (j = 255; j >= 0; j--) { + sixbits(n); + for (i = 0; i < n; i++) { + eightbits(fset[j][i]); + } + fset[j][32] = n<1?0:n<3?1:n<5?2:n<9?3:n<17?4:n<37?5:n<65?6:7; + } + lastc = 0; + state = 0; + while (ieof == 0) { + if (fset[lastc][32] == 0) { + eightbits(c); + } else { + if (nextbit() != 0) { + eightbits(c); + } else { + i = 0; + for (k = 0; k < fset[lastc][32]; k++) + i |= nextbit() << k; + c = fset[lastc][i] & 0377; + } + } + lastc = c; + switch (state) { + case 0: + if (c != DLE) + wadd(c); + else + state = 1; + break; + case 1: + if (c != 0) { + v = c; + len = zex_L(v); + state = zex_F(len); + } else { + wadd(DLE); + state = 0; + } + break; + case 2: + len += c; + state = 3; + break; + case 3: + n = wsize - zex_D(v, c); + for (i = 0; i < len + 3; i++) { + c = n+i >= 0 ? wbuf[n+i&sizeof wbuf-1]&0377 : 0; + wadd(c); + } + state = 0; + } + } + zexwrite(&tfd, wbuf, wpos, crc, &val, tgt, &nsize); + while (isize >= 0) + nextbyte(); + return val; +} diff --git a/package/heirloom-cpio/src/explode.c b/package/heirloom-cpio/src/explode.c new file mode 100644 index 000000000..863dbf672 --- /dev/null +++ b/package/heirloom-cpio/src/explode.c @@ -0,0 +1,1138 @@ +/* + * Changes by Gunnar Ritter, Freiburg i. Br., Germany, May 2003. + * + * Derived from unzip 5.40. + * + * Sccsid @(#)explode.c 1.6 (gritter) 9/30/03 + */ +/* explode.c -- put in the public domain by Mark Adler + version c15, 6 July 1996 */ + + +/* You can do whatever you like with this source file, though I would + prefer that if you modify it and redistribute it that you include + comments to that effect with your name and the date. Thank you. + + History: + vers date who what + ---- --------- -------------- ------------------------------------ + c1 30 Mar 92 M. Adler explode that uses huft_build from inflate + (this gives over a 70% speed improvement + over the original unimplode.c, which + decoded a bit at a time) + c2 4 Apr 92 M. Adler fixed bug for file sizes a multiple of 32k. + c3 10 Apr 92 M. Adler added a little memory tracking if DEBUG + c4 11 Apr 92 M. Adler added NOMEMCPY do kill use of memcpy() + c5 21 Apr 92 M. Adler added the WSIZE #define to allow reducing + the 32K window size for specialized + applications. + c6 31 May 92 M. Adler added typecasts to eliminate some warnings + c7 27 Jun 92 G. Roelofs added more typecasts. + c8 17 Oct 92 G. Roelofs changed ULONG/UWORD/byte to ulg/ush/uch. + c9 19 Jul 93 J. Bush added more typecasts (to return values); + made l[256] array static for Amiga. + c10 8 Oct 93 G. Roelofs added used_csize for diagnostics; added + buf and unshrink arguments to flush(); + undef'd various macros at end for Turbo C; + removed NEXTBYTE macro (now in unzip.h) + and bytebuf variable (not used); changed + memset() to memzero(). + c11 9 Jan 94 M. Adler fixed incorrect used_csize calculation. + c12 9 Apr 94 G. Roelofs fixed split comments on preprocessor lines + to avoid bug in Encore compiler. + c13 25 Aug 94 M. Adler fixed distance-length comment (orig c9 fix) + c14 22 Nov 95 S. Maxwell removed unnecessary "static" on auto array + c15 6 Jul 96 W. Haidinger added ulg typecasts to flush() calls. + c16 8 Feb 98 C. Spieler added ZCONST modifiers to const tables + and #ifdef DEBUG around debugging code. + c16b 25 Mar 98 C. Spieler modified DLL code for slide redirection. + + 23 May 03 Gunnar Ritter use cpio structures; C99 conversion. + */ + + +/* + Explode imploded (PKZIP method 6 compressed) data. This compression + method searches for as much of the current string of bytes (up to a length + of ~320) in the previous 4K or 8K bytes. If it doesn't find any matches + (of at least length 2 or 3), it codes the next byte. Otherwise, it codes + the length of the matched string and its distance backwards from the + current position. Single bytes ("literals") are preceded by a one (a + single bit) and are either uncoded (the eight bits go directly into the + compressed stream for a total of nine bits) or Huffman coded with a + supplied literal code tree. If literals are coded, then the minimum match + length is three, otherwise it is two. + + There are therefore four kinds of imploded streams: 8K search with coded + literals (min match = 3), 4K search with coded literals (min match = 3), + 8K with uncoded literals (min match = 2), and 4K with uncoded literals + (min match = 2). The kind of stream is identified in two bits of a + general purpose bit flag that is outside of the compressed stream. + + Distance-length pairs for matched strings are preceded by a zero bit (to + distinguish them from literals) and are always coded. The distance comes + first and is either the low six (4K) or low seven (8K) bits of the + distance (uncoded), followed by the high six bits of the distance coded. + Then the length is six bits coded (0..63 + min match length), and if the + maximum such length is coded, then it's followed by another eight bits + (uncoded) to be added to the coded length. This gives a match length + range of 2..320 or 3..321 bytes. + + The literal, length, and distance codes are all represented in a slightly + compressed form themselves. What is sent are the lengths of the codes for + each value, which is sufficient to construct the codes. Each byte of the + code representation is the code length (the low four bits representing + 1..16), and the number of values sequentially with that length (the high + four bits also representing 1..16). There are 256 literal code values (if + literals are coded), 64 length code values, and 64 distance code values, + in that order at the beginning of the compressed stream. Each set of code + values is preceded (redundantly) with a byte indicating how many bytes are + in the code description that follows, in the range 1..256. + + The codes themselves are decoded using tables made by huft_build() from + the bit lengths. That routine and its comments are in the inflate.c + module. + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + +#include "cpio.h" +#include "unzip.h" /* must supply slide[] (uint8_t) array and NEXTBYTE macro */ + +/* routines here */ +static int get_tree(struct globals *, unsigned *l, unsigned n); +static int explode_lit8(struct globals *, struct huft *tb, struct huft *tl, + struct huft *td, int bb, int bl, int bd); +static int explode_lit4(struct globals *, struct huft *tb, struct huft *tl, + struct huft *td, int bb, int bl, int bd); +static int explode_nolit8(struct globals *, struct huft *tl, struct huft *td, + int bl, int bd); +static int explode_nolit4(struct globals *, struct huft *tl, struct huft *td, + int bl, int bd); + +/* The implode algorithm uses a sliding 4K or 8K byte window on the + uncompressed stream to find repeated byte strings. This is implemented + here as a circular buffer. The index is updated simply by incrementing + and then and'ing with 0x0fff (4K-1) or 0x1fff (8K-1). Here, the 32K + buffer of inflate is used, and it works just as well to always have + a 32K circular buffer, so the index is anded with 0x7fff. This is + done to allow the window to also be used as the output buffer. */ +/* This must be supplied in an external module useable like + "uint8_t slide[8192];" or "uint8_t *slide;", where the latter would + be malloc'ed. In unzip, slide[] is actually a 32K area for use by + inflate, which uses a 32K sliding window. + */ + + +/* Tables for length and distance */ +static const uint16_t cplen2[] = + {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65}; +static const uint16_t cplen3[] = + {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66}; +static const uint8_t extra[] = + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8}; +static const uint16_t cpdist4[] = + {1, 65, 129, 193, 257, 321, 385, 449, 513, 577, 641, 705, + 769, 833, 897, 961, 1025, 1089, 1153, 1217, 1281, 1345, 1409, 1473, + 1537, 1601, 1665, 1729, 1793, 1857, 1921, 1985, 2049, 2113, 2177, + 2241, 2305, 2369, 2433, 2497, 2561, 2625, 2689, 2753, 2817, 2881, + 2945, 3009, 3073, 3137, 3201, 3265, 3329, 3393, 3457, 3521, 3585, + 3649, 3713, 3777, 3841, 3905, 3969, 4033}; +static const uint16_t cpdist8[] = + {1, 129, 257, 385, 513, 641, 769, 897, 1025, 1153, 1281, + 1409, 1537, 1665, 1793, 1921, 2049, 2177, 2305, 2433, 2561, 2689, + 2817, 2945, 3073, 3201, 3329, 3457, 3585, 3713, 3841, 3969, 4097, + 4225, 4353, 4481, 4609, 4737, 4865, 4993, 5121, 5249, 5377, 5505, + 5633, 5761, 5889, 6017, 6145, 6273, 6401, 6529, 6657, 6785, 6913, + 7041, 7169, 7297, 7425, 7553, 7681, 7809, 7937, 8065}; + + +/* Macros for inflate() bit peeking and grabbing. + The usage is: + + NEEDBITS(j) + x = b & mask_bits[j]; + DUMPBITS(j) + + where NEEDBITS makes sure that b has at least j bits in it, and + DUMPBITS removes the bits from b. The macros use the variable k + for the number of bits in b. Normally, b and k are register + variables for speed. + */ + +#define NEEDBITS(n) {while(k<(n)){b|=((uint32_t)NEXTBYTE)<<k;k+=8;}} +#define DUMPBITS(n) {b>>=(n);k-=(n);} + +#define Bits 16 +#define Nob 16 +#define Eob 15 + +#define G (*Gp) + +static int +get_tree(struct globals *Gp, unsigned *l, unsigned n) +/*unsigned *l;*/ /* bit lengths */ +/*unsigned n;*/ /* number expected */ +/* Get the bit lengths for a code representation from the compressed + stream. If get_tree() returns 4, then there is an error in the data. + Otherwise zero is returned. */ +{ + unsigned i; /* bytes remaining in list */ + unsigned k; /* lengths entered */ + unsigned j; /* number of codes */ + unsigned b; /* bit length for those codes */ + + + /* get bit lengths */ + i = NEXTBYTE + 1; /* length/count pairs to read */ + k = 0; /* next code */ + do { + b = ((j = NEXTBYTE) & 0xf) + 1; /* bits in code (1..16) */ + j = ((j & 0xf0) >> 4) + 1; /* codes with those bits (1..16) */ + if (k + j > n) + return 4; /* don't overflow l[] */ + do { + l[k++] = b; + } while (--j); + } while (--i); + return k != n ? 4 : 0; /* should have read n of them */ +} + + + +static int +explode_lit8(struct globals *Gp, + struct huft *tb, struct huft *tl, struct huft *td, + int bb, int bl, int bd) +/*struct huft *tb, *tl, *td;*/ /* literal, length, and distance tables */ +/*int bb, bl, bd;*/ /* number of bits decoded by those */ +/* Decompress the imploded data using coded literals and an 8K sliding + window. */ +{ + long s; /* bytes to decompress */ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned n, d; /* length and index for copy */ + unsigned w; /* current window position */ + struct huft *t; /* pointer to table entry */ + unsigned mb, ml, md; /* masks for bb, bl, and bd bits */ + register uint32_t b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + unsigned u; /* true if unflushed */ + + + /* explode the coded data */ + b = k = w = 0; /* initialize bit buffer, window */ + u = 1; /* buffer unflushed */ + mb = mask_bits[bb]; /* precompute masks for speed */ + ml = mask_bits[bl]; + md = mask_bits[bd]; + s = G.ucsize; + while (s > 0) /* do until ucsize bytes uncompressed */ + { + NEEDBITS(1) + if (b & 1) /* then literal--decode it */ + { + DUMPBITS(1) + s--; + NEEDBITS((unsigned)bb) /* get coded literal */ + if ((e = (t = tb + ((~(unsigned)b) & mb))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + redirSlide[w++] = (uint8_t)t->v.n; + if (w == WSIZE) + { + flush(&G, redirSlide, (uint32_t)w); + w = u = 0; + } + } + else /* else distance/length */ + { + DUMPBITS(1) + NEEDBITS(7) /* get distance low bits */ + d = (unsigned)b & 0x7f; + DUMPBITS(7) + NEEDBITS((unsigned)bd) /* get coded distance high bits */ + if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + d = w - d - t->v.n; /* construct offset */ + NEEDBITS((unsigned)bl) /* get coded length */ + if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + n = t->v.n; + if (e) /* get length extra bits */ + { + NEEDBITS(8) + n += (unsigned)b & 0xff; + DUMPBITS(8) + } + + /* do the copy */ + s -= n; + do { + n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e); + if (u && w <= d) + { + memset(redirSlide + w, 0, e); + w += e; + d += e; + } + else +#ifndef NOMEMCPY + if (w - d >= e) /* (this test assumes unsigned comparison) */ + { + memcpy(redirSlide + w, redirSlide + d, e); + w += e; + d += e; + } + else /* do it slow to avoid memcpy() overlap */ +#endif /* !NOMEMCPY */ + do { + redirSlide[w++] = redirSlide[d++]; + } while (--e); + if (w == WSIZE) + { + flush(&G, redirSlide, (uint32_t)w); + w = u = 0; + } + } while (n); + } + } + + /* flush out redirSlide */ + flush(&G, redirSlide, (uint32_t)w); + if (G.csize + G.incnt + (k >> 3)) /* should have read csize bytes, but */ + { /* sometimes read one too many: k>>3 compensates */ + /*G.used_csize = G.zsize - G.csize - G.incnt - (k >> 3);*/ + return 5; + } + return 0; +} + + + +static int +explode_lit4(struct globals *Gp, + struct huft *tb, struct huft *tl, struct huft *td, + int bb, int bl, int bd) +/*struct huft *tb, *tl, *td;*/ /* literal, length, and distance tables */ +/*int bb, bl, bd;*/ /* number of bits decoded by those */ +/* Decompress the imploded data using coded literals and a 4K sliding + window. */ +{ + long s; /* bytes to decompress */ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned n, d; /* length and index for copy */ + unsigned w; /* current window position */ + struct huft *t; /* pointer to table entry */ + unsigned mb, ml, md; /* masks for bb, bl, and bd bits */ + register uint32_t b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + unsigned u; /* true if unflushed */ + + + /* explode the coded data */ + b = k = w = 0; /* initialize bit buffer, window */ + u = 1; /* buffer unflushed */ + mb = mask_bits[bb]; /* precompute masks for speed */ + ml = mask_bits[bl]; + md = mask_bits[bd]; + s = G.ucsize; + while (s > 0) /* do until ucsize bytes uncompressed */ + { + NEEDBITS(1) + if (b & 1) /* then literal--decode it */ + { + DUMPBITS(1) + s--; + NEEDBITS((unsigned)bb) /* get coded literal */ + if ((e = (t = tb + ((~(unsigned)b) & mb))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + redirSlide[w++] = (uint8_t)t->v.n; + if (w == WSIZE) + { + flush(&G, redirSlide, (uint32_t)w); + w = u = 0; + } + } + else /* else distance/length */ + { + DUMPBITS(1) + NEEDBITS(6) /* get distance low bits */ + d = (unsigned)b & 0x3f; + DUMPBITS(6) + NEEDBITS((unsigned)bd) /* get coded distance high bits */ + if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + d = w - d - t->v.n; /* construct offset */ + NEEDBITS((unsigned)bl) /* get coded length */ + if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + n = t->v.n; + if (e) /* get length extra bits */ + { + NEEDBITS(8) + n += (unsigned)b & 0xff; + DUMPBITS(8) + } + + /* do the copy */ + s -= n; + do { + n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e); + if (u && w <= d) + { + memset(redirSlide + w, 0, e); + w += e; + d += e; + } + else +#ifndef NOMEMCPY + if (w - d >= e) /* (this test assumes unsigned comparison) */ + { + memcpy(redirSlide + w, redirSlide + d, e); + w += e; + d += e; + } + else /* do it slow to avoid memcpy() overlap */ +#endif /* !NOMEMCPY */ + do { + redirSlide[w++] = redirSlide[d++]; + } while (--e); + if (w == WSIZE) + { + flush(&G, redirSlide, (uint32_t)w); + w = u = 0; + } + } while (n); + } + } + + /* flush out redirSlide */ + flush(&G, redirSlide, (uint32_t)w); + if (G.csize + G.incnt + (k >> 3)) /* should have read csize bytes, but */ + { /* sometimes read one too many: k>>3 compensates */ + /*G.used_csize = G.zsize - G.csize - G.incnt - (k >> 3);*/ + return 5; + } + return 0; +} + + + +static int +explode_nolit8(struct globals *Gp, + struct huft *tl, struct huft *td, int bl, int bd) +/*struct huft *tl, *td;*/ /* length and distance decoder tables */ +/*int bl, bd;*/ /* number of bits decoded by tl[] and td[] */ +/* Decompress the imploded data using uncoded literals and an 8K sliding + window. */ +{ + long s; /* bytes to decompress */ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned n, d; /* length and index for copy */ + unsigned w; /* current window position */ + struct huft *t; /* pointer to table entry */ + unsigned ml, md; /* masks for bl and bd bits */ + register uint32_t b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + unsigned u; /* true if unflushed */ + + + /* explode the coded data */ + b = k = w = 0; /* initialize bit buffer, window */ + u = 1; /* buffer unflushed */ + ml = mask_bits[bl]; /* precompute masks for speed */ + md = mask_bits[bd]; + s = G.ucsize; + while (s > 0) /* do until ucsize bytes uncompressed */ + { + NEEDBITS(1) + if (b & 1) /* then literal--get eight bits */ + { + DUMPBITS(1) + s--; + NEEDBITS(8) + redirSlide[w++] = (uint8_t)b; + if (w == WSIZE) + { + flush(&G, redirSlide, (uint32_t)w); + w = u = 0; + } + DUMPBITS(8) + } + else /* else distance/length */ + { + DUMPBITS(1) + NEEDBITS(7) /* get distance low bits */ + d = (unsigned)b & 0x7f; + DUMPBITS(7) + NEEDBITS((unsigned)bd) /* get coded distance high bits */ + if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + d = w - d - t->v.n; /* construct offset */ + NEEDBITS((unsigned)bl) /* get coded length */ + if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + n = t->v.n; + if (e) /* get length extra bits */ + { + NEEDBITS(8) + n += (unsigned)b & 0xff; + DUMPBITS(8) + } + + /* do the copy */ + s -= n; + do { + n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e); + if (u && w <= d) + { + memset(redirSlide + w, 0, e); + w += e; + d += e; + } + else +#ifndef NOMEMCPY + if (w - d >= e) /* (this test assumes unsigned comparison) */ + { + memcpy(redirSlide + w, redirSlide + d, e); + w += e; + d += e; + } + else /* do it slow to avoid memcpy() overlap */ +#endif /* !NOMEMCPY */ + do { + redirSlide[w++] = redirSlide[d++]; + } while (--e); + if (w == WSIZE) + { + flush(&G, redirSlide, (uint32_t)w); + w = u = 0; + } + } while (n); + } + } + + /* flush out redirSlide */ + flush(&G, redirSlide, (uint32_t)w); + if (G.csize + G.incnt + (k >> 3)) /* should have read csize bytes, but */ + { /* sometimes read one too many: k>>3 compensates */ + /*G.used_csize = G.zsize - G.csize - G.incnt - (k >> 3);*/ + return 5; + } + return 0; +} + + + +static int +explode_nolit4(struct globals *Gp, + struct huft *tl, struct huft *td, int bl, int bd) +/*struct huft *tl, *td;*/ /* length and distance decoder tables */ +/*int bl, bd;*/ /* number of bits decoded by tl[] and td[] */ +/* Decompress the imploded data using uncoded literals and a 4K sliding + window. */ +{ + long s; /* bytes to decompress */ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned n, d; /* length and index for copy */ + unsigned w; /* current window position */ + struct huft *t; /* pointer to table entry */ + unsigned ml, md; /* masks for bl and bd bits */ + register uint32_t b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + unsigned u; /* true if unflushed */ + + + /* explode the coded data */ + b = k = w = 0; /* initialize bit buffer, window */ + u = 1; /* buffer unflushed */ + ml = mask_bits[bl]; /* precompute masks for speed */ + md = mask_bits[bd]; + s = G.ucsize; + while (s > 0) /* do until ucsize bytes uncompressed */ + { + NEEDBITS(1) + if (b & 1) /* then literal--get eight bits */ + { + DUMPBITS(1) + s--; + NEEDBITS(8) + redirSlide[w++] = (uint8_t)b; + if (w == WSIZE) + { + flush(&G, redirSlide, (uint32_t)w); + w = u = 0; + } + DUMPBITS(8) + } + else /* else distance/length */ + { + DUMPBITS(1) + NEEDBITS(6) /* get distance low bits */ + d = (unsigned)b & 0x3f; + DUMPBITS(6) + NEEDBITS((unsigned)bd) /* get coded distance high bits */ + if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + d = w - d - t->v.n; /* construct offset */ + NEEDBITS((unsigned)bl) /* get coded length */ + if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16) + do { + if (e == 99) + return 1; + DUMPBITS(t->b) + e -= 16; + NEEDBITS(e) + } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16); + DUMPBITS(t->b) + n = t->v.n; + if (e) /* get length extra bits */ + { + NEEDBITS(8) + n += (unsigned)b & 0xff; + DUMPBITS(8) + } + + /* do the copy */ + s -= n; + do { + n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e); + if (u && w <= d) + { + memset(redirSlide + w, 0, e); + w += e; + d += e; + } + else +#ifndef NOMEMCPY + if (w - d >= e) /* (this test assumes unsigned comparison) */ + { + memcpy(redirSlide + w, redirSlide + d, e); + w += e; + d += e; + } + else /* do it slow to avoid memcpy() overlap */ +#endif /* !NOMEMCPY */ + do { + redirSlide[w++] = redirSlide[d++]; + } while (--e); + if (w == WSIZE) + { + flush(&G, redirSlide, (uint32_t)w); + w = u = 0; + } + } while (n); + } + } + + /* flush out redirSlide */ + flush(&G, redirSlide, (uint32_t)w); + if (G.csize + G.incnt + (k >> 3)) /* should have read csize bytes, but */ + { /* sometimes read one too many: k>>3 compensates */ + /*G.used_csize = G.zsize - G.csize - G.incnt - (k >> 3);*/ + return 5; + } + return 0; +} + +#undef G + +int +zipexplode(struct file *f, const char *tgt, int tfd, int doswap, uint32_t *crc) +/* Explode an imploded compressed stream. Based on the general purpose + bit flag, decide on coded or uncoded literals, and an 8K or 4K sliding + window. Construct the literal (if any), length, and distance codes and + the tables needed to decode them (using huft_build() from inflate.c), + and call the appropriate routine for the type of data in the remainder + of the stream. The four routines are nearly identical, differing only + in whether the literal is decoded or simply read in, and in how many + bits are read in, uncoded, for the low distance bits. */ +{ + struct globals G; + unsigned r; /* return codes */ + struct huft *tb; /* literal code table */ + struct huft *tl; /* length code table */ + struct huft *td; /* distance code table */ + int bb; /* bits for tb */ + int bl; /* bits for tl */ + int bd; /* bits for td */ + unsigned l[256]; /* bit lengths for codes */ + + memset(&G, 0, sizeof G); + G.tgt = tgt; + G.tfd = tfd; + G.doswap = doswap; + G.crc = crc; + G.zsize = G.uzsize = f->f_csize; + G.ucsize = f->f_st.st_size; + + /* Tune base table sizes. Note: I thought that to truly optimize speed, + I would have to select different bl, bd, and bb values for different + compressed file sizes. I was surprised to find out that the values of + 7, 7, and 9 worked best over a very wide range of sizes, except that + bd = 8 worked marginally better for large compressed sizes. */ + bl = 7; + bd = (G.csize + G.incnt) > 200000L ? 8 : 7; + + + /* With literal tree--minimum match length is 3 */ +#ifdef DEBUG + G.hufts = 0; /* initialize huft's malloc'ed */ +#endif + if (f->f_gflag & FG_BIT2) + { + bb = 9; /* base table size for literals */ + if ((r = get_tree(&G, l, 256)) != 0) + goto err; + if ((r = huft_build(l, 256, 256, NULL, NULL, &tb, &bb, + Bits, Nob, Eob)) != 0) + { + if (r == 1) + huft_free(tb); + goto err; + } + if ((r = get_tree(&G, l, 64)) != 0) + goto err; + if ((r = huft_build(l, 64, 0, cplen3, extra, &tl, &bl, + Bits, Nob, Eob)) != 0) + { + if (r == 1) + huft_free(tl); + huft_free(tb); + goto err; + } + if ((r = get_tree(&G, l, 64)) != 0) + goto err; + if (f->f_gflag & FG_BIT1) /* true if 8K */ + { + if ((r = huft_build(l, 64, 0, cpdist8, extra, &td, &bd, + Bits, Nob, Eob)) != 0) + { + if (r == 1) + huft_free(td); + huft_free(tl); + huft_free(tb); + goto err; + } + r = explode_lit8(&G, tb, tl, td, bb, bl, bd); + } + else /* else 4K */ + { + if ((r = huft_build(l, 64, 0, cpdist4, extra, &td, &bd, + Bits, Nob, Eob)) != 0) + { + if (r == 1) + huft_free(td); + huft_free(tl); + huft_free(tb); + goto err; + } + r = explode_lit4(&G, tb, tl, td, bb, bl, bd); + } + huft_free(td); + huft_free(tl); + huft_free(tb); + } + else + + + /* No literal tree--minimum match length is 2 */ + { + if ((r = get_tree(&G, l, 64)) != 0) + goto err; + if ((r = huft_build(l, 64, 0, cplen2, extra, &tl, &bl, + Bits, Nob, Eob)) != 0) + { + if (r == 1) + huft_free(tl); + goto err; + } + if ((r = get_tree(&G, l, 64)) != 0) + goto err; + if (f->f_gflag & FG_BIT1) /* true if 8K */ + { + if ((r = huft_build(l, 64, 0, cpdist8, extra, &td, &bd, + Bits, Nob, Eob)) != 0) + { + if (r == 1) + huft_free(td); + huft_free(tl); + goto err; + } + r = explode_nolit8(&G, tl, td, bl, bd); + } + else /* else 4K */ + { + if ((r = huft_build(l, 64, 0, cpdist4, extra, &td, &bd, + Bits, Nob, Eob)) != 0) + { + if (r == 1) + huft_free(td); + huft_free(tl); + goto err; + } + r = explode_nolit4(&G, tl, td, bl, bd); + } + huft_free(td); + huft_free(tl); + } + Trace((stderr, "<%u > ", G.hufts)); +err: + switch (r) { + case 0: + break; + case 5: + while (G.uzsize > 0) + NEXTBYTE; + /*FALLTHRU*/ + default: + msg(3, 0, "compression error on \"%s\"\n", f->f_name); + } + return r || G.status ? -1 : 0; +} + +/* The following code is derived from: */ + +/* inflate.c -- put in the public domain by Mark Adler + version c16b, 29 March 1998 */ + +/* If BMAX needs to be larger than 16, then h and x[] should be uint32_t. */ +#define BMAX 16 /* maximum bit length of any code (16 for explode) */ +#define N_MAX 288 /* maximum number of codes in any set */ + + +int +huft_build(const unsigned *b, unsigned n, unsigned s, + const uint16_t *d, const uint8_t *e, + struct huft **t, int *m, + int bits, int nob, int eob) +/*const unsigned *b;*/ /* code lengths in bits (all assumed <= BMAX) */ +/*unsigned n;*/ /* number of codes (assumed <= N_MAX) */ +/*unsigned s;*/ /* number of simple-valued codes (0..s-1) */ +/*const uint16_t *d;*/ /* list of base values for non-simple codes */ +/*const uint16_t *e;*/ /* list of extra bits for non-simple codes */ +/*struct huft **t;*/ /* result: starting table */ +/*int *m;*/ /* maximum lookup bits, returns actual */ +/* Given a list of code lengths and a maximum table size, make a set of + tables to decode that set of codes. Return zero on success, one if + the given code set is incomplete (the tables are still built in this + case), two if the input is invalid (all zero length codes or an + oversubscribed set of lengths), and three if not enough memory. + The code with value 256 is special, and the tables are constructed + so that no bits beyond that code are fetched when that code is + decoded. */ +{ + unsigned a; /* counter for codes of length k */ + unsigned c[BMAX+1]; /* bit length count table */ + unsigned el; /* length of EOB code (value 256) */ + unsigned f; /* i repeats in table every f entries */ + int g; /* maximum code length */ + int h; /* table level */ + register unsigned i; /* counter, current code */ + register unsigned j; /* counter */ + register int k; /* number of bits in current code */ + int lx[BMAX+1]; /* memory for l[-1..BMAX-1] */ + int *l = lx+1; /* stack of bits per table */ + register unsigned *p; /* pointer into c[], b[], or v[] */ + register struct huft *q; /* points to current table */ + struct huft r; /* table entry for structure assignment */ + struct huft *u[BMAX]; /* table stack */ + unsigned v[N_MAX]; /* values in order of bit length */ + register int w; /* bits before this table == (l * h) */ + unsigned x[BMAX+1]; /* bit offsets, then code stack */ + unsigned *xp; /* pointer into x */ + int y; /* number of dummy codes added */ + unsigned z; /* number of entries in current table */ + + + /* Generate counts for each bit length */ + el = n > 256 ? b[256] : BMAX; /* set length of EOB code, if any */ + memset(c, 0, sizeof c); + p = (unsigned *)b; i = n; + do { + c[*p]++; p++; /* assume all entries <= BMAX */ + } while (--i); + if (c[0] == n) /* null input--all zero length codes */ + { + *t = NULL; + *m = 0; + return 0; + } + + + /* Find minimum and maximum length, bound *m by those */ + for (j = 1; j <= BMAX; j++) + if (c[j]) + break; + k = j; /* minimum code length */ + if ((unsigned)*m < j) + *m = j; + for (i = BMAX; i; i--) + if (c[i]) + break; + g = i; /* maximum code length */ + if ((unsigned)*m > i) + *m = i; + + + /* Adjust last length count to fill out codes, if needed */ + for (y = 1 << j; j < i; j++, y <<= 1) + if ((y -= c[j]) < 0) + return 2; /* bad input: more codes than bits */ + if ((y -= c[i]) < 0) + return 2; + c[i] += y; + + + /* Generate starting offsets into the value table for each length */ + x[1] = j = 0; + p = c + 1; xp = x + 2; + while (--i) { /* note that i == g from above */ + *xp++ = (j += *p++); + } + + + /* Make a table of values in order of bit lengths */ + memset(v, 0, sizeof v); + p = (unsigned *)b; i = 0; + do { + if ((j = *p++) != 0) + v[x[j]++] = i; + } while (++i < n); + n = x[g]; /* set n to length of v */ + + + /* Generate the Huffman codes and for each, make the table entries */ + x[0] = i = 0; /* first Huffman code is zero */ + p = v; /* grab values in bit order */ + h = -1; /* no tables yet--level -1 */ + w = l[-1] = 0; /* no bits decoded yet */ + u[0] = NULL; /* just to keep compilers happy */ + q = NULL; /* ditto */ + z = 0; /* ditto */ + + /* go through the bit lengths (k already is bits in shortest code) */ + for (; k <= g; k++) + { + a = c[k]; + while (a--) + { + /* here i is the Huffman code of length k bits for value *p */ + /* make tables up to required level */ + while (k > w + l[h]) + { + w += l[h++]; /* add bits already decoded */ + + /* compute minimum size table less than or equal to *m bits */ + z = (z = g - w) > (unsigned)*m ? *m : z; /* upper limit */ + if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ + { /* too few codes for k-w bit table */ + f -= a + 1; /* deduct codes from patterns left */ + xp = c + k; + while (++j < z) /* try smaller tables up to z bits */ + { + if ((f <<= 1) <= *++xp) + break; /* enough codes to use up j bits */ + f -= *xp; /* else deduct codes from patterns */ + } + } + if ((unsigned)w + j > el && (unsigned)w < el) + j = el - w; /* make EOB code end at table */ + z = 1 << j; /* table entries for j-bit table */ + l[h] = j; /* set table size in stack */ + + /* allocate and link in new table */ + if ((q = malloc((z + 1)*sizeof(struct huft))) == NULL) + { + if (h) + huft_free(u[0]); + return 3; /* not enough memory */ + } +#ifdef DEBUG + G.hufts += z + 1; /* track memory usage */ +#endif + *t = q + 1; /* link to list for huft_free() */ + *(t = &(q->v.t)) = NULL; + u[h] = ++q; /* table starts after link */ + + /* connect to last table, if there is one */ + if (h) + { + x[h] = i; /* save pattern for backing up */ + r.b = (uint8_t)l[h-1]; /* bits to dump before this table */ + r.e = (uint8_t)(bits + j); /* bits in this table */ + r.v.t = q; /* pointer to this table */ + j = (i & ((1 << w) - 1)) >> (w - l[h-1]); + u[h-1][j] = r; /* connect to last table */ + } + } + + /* set up table entry in r */ + r.b = (uint8_t)(k - w); + if (p >= v + n) + r.e = 99; /* out of values--invalid code */ + else if (*p < s) + { + r.e = (uint8_t)(*p < 256 ? nob : eob); /* 256 is end-of-block code */ + r.v.n = (uint16_t)*p++; /* simple code is just the value */ + } + else + { + r.e = (uint8_t)e[*p - s]; /* non-simple--look up in lists */ + r.v.n = d[*p++ - s]; + } + + /* fill code-like entries with r */ + f = 1 << (k - w); + for (j = i >> w; j < z; j += f) + q[j] = r; + + /* backwards increment the k-bit code i */ + for (j = 1 << (k - 1); i & j; j >>= 1) + i ^= j; + i ^= j; + + /* backup over finished tables */ + while ((i & ((1 << w) - 1)) != x[h]) + w -= l[--h]; /* don't need to update q */ + } + } + + + /* return actual size of base table */ + *m = l[0]; + + + /* Return true (1) if we were given an incomplete table */ + return y != 0 && g != 1; +} + + +void +huft_free(struct huft *t) +/*struct huft *t;*/ /* table to free */ +/* Free the malloc'ed tables built by huft_build(), which makes a linked + list of the tables it made, with the links in a dummy first entry of + each table. */ +{ + register struct huft *p, *q; + + + /* Go through linked list, freeing from the malloced (t[-1]) address. */ + p = t; + while (p != NULL) + { + q = (--p)->v.t; + free(p); + p = q; + } +} + +const uint16_t mask_bits[] = { + 0x0000, + 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, + 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff +}; + +void +flush(struct globals *Gp, const void *data, size_t size) +{ + if (Gp->tfd>=0 && write(Gp->tfd, data, size) != size) { + emsg(3, "Cannot write \"%s\"", Gp->tgt); + Gp->tfd = -1; + Gp->status = -1; + } + *Gp->crc = zipcrc(*Gp->crc, data, size); +} + +int +readbyte(struct globals *Gp) +{ + if (Gp->uzsize <= 0) + return EOF; + Gp->incnt = bread((char *)Gp->inbuf, + Gp->uzsize>sizeof Gp->inbuf?sizeof Gp->inbuf:Gp->uzsize); + if (Gp->incnt <= 0) + unexeoa(); + if (Gp->doswap) + swap((char *)Gp->inbuf, Gp->incnt, bflag||sflag,bflag||Sflag); + Gp->uzsize -= Gp->incnt; + Gp->incnt--; + Gp->inptr = Gp->inbuf; + return (int)(*Gp->inptr++); +} diff --git a/package/heirloom-cpio/src/flags.c b/package/heirloom-cpio/src/flags.c new file mode 100644 index 000000000..e06c8e80d --- /dev/null +++ b/package/heirloom-cpio/src/flags.c @@ -0,0 +1,257 @@ +/* + * cpio - copy file archives in and out + * + * Gunnar Ritter, Freiburg i. Br., Germany, April 2003. + */ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +/* Sccsid @(#)flags.c 1.6 (gritter) 3/26/07 */ + +#include <unistd.h> +#include <stdio.h> +#include <stdarg.h> +#include <stdlib.h> + +#include "cpio.h" + +void +flags(int ac, char **av) +{ + const char optstring[] = + "iopaAbBcC:dDeE:fH:I:kKlLmM:O:PrR:sStTuvV6"; + int i, illegal = 0; + + if (getenv("SYSV3") != NULL) + sysv3 = printsev = 1; + while ((i = getopt(ac, av, optstring)) != EOF) { + switch (i) { + case 'i': + case 'o': + case 'p': + if (action && action != i) + illegal = 1; + action = i; + break; + case 'a': + aflag = 1; + break; + case 'A': + Aflag = 1; + break; + case 'b': + bflag = 1; + break; + case 'B': + blksiz = 5120; + Bflag = 1; + break; + case 'c': + fmttype = sysv3 ? FMT_ODC : FMT_ASC; + cflag = 1; + break; + case 'C': + if ((blksiz = atol(optarg)) <= 0) + msg(4, -2, + "Illegal size given for -C option.\n"); + Cflag = 1; + break; + case 'd': + dflag = 1; + break; + case 'D': + Dflag = 1; + break; + case 'e': + /* + * This option is accepted for compatibility only, + * -Hdec should be used instead. + */ + fmttype = FMT_DEC; + eflag = 1; + break; + case 'E': + Eflag = optarg; + break; + case 'f': + fflag = 1; + break; + case 'H': + if (setfmt(optarg) < 0) + illegal = 1; + Hflag = 1; + break; + case 'I': + Iflag = optarg; + break; + case 'k': + kflag = 1; + break; + case 'K': + /* + * This option is accepted for compatibility only, + * -Hsgi should be used instead. + */ + fmttype = FMT_SGIBE; + Kflag = 1; + break; + case 'l': + lflag = 1; + break; + case 'L': + Lflag = 1; + break; + case 'm': + mflag = 1; + break; + case 'M': + Mflag = oneintfmt(optarg); + break; + case 'O': + Oflag = optarg; + break; + case 'P': + Pflag = 1; + break; + case 'r': + rflag = 1; + break; + case 'R': + if (setreassign(Rflag = optarg) < 0) + illegal = 1; + break; + case 's': + sflag = 1; + break; + case 'S': + Sflag = 1; + break; + case 't': + tflag = 1; + break; + case 'u': + uflag = 1; + break; + case 'v': + vflag++; + break; + case 'V': + Vflag = 1; + break; + case '6': + sixflag = 1; + fmttype = FMT_BINLE; + break; + default: + if (sysv3) + usage(); + illegal = 1; + } + } + switch (action) { + case 'i': + if (Oflag || Kflag || eflag || Lflag || lflag || aflag || + Aflag || Pflag) + illegal = 1; + for (i = optind; i < ac; i++) + addg(av[i], 0); + break; + case 'o': + if (Iflag || dflag || fflag || kflag || mflag || + rflag || tflag || uflag || + sixflag || Eflag || Rflag) + illegal = 1; + if (optind != ac) + illegal = 1; + break; + case 'p': + if (Iflag || Oflag || blksiz || Eflag || fmttype != FMT_NONE || + Mflag || bflag || fflag || kflag || sflag || + tflag || Sflag || sixflag) + illegal = 1; + if (optind + 1 != ac) + illegal = 1; + break; + default: + if (sysv3 == 0) + msg(3, 0, "One of -i, -o or -p must be specified.\n"); + else if (ac > 1) + msg(3, -2, "Options must include one: -o, -i, -p.\n"); + illegal = 1; + } + /* + * Sanity checks. No check for multiple occurences of options + * since they can make sense, behave as other programs and use + * the latter one. + */ + /*if (aflag && mflag) { + msg(3, 0, "-a and -m are mutually exclusive.\n"); + illegal = 1; + } why? */ + /*if (cflag && (Hflag || Kflag || eflag)) { + msg(3, 0, "-c and -H are mutually exclusive.\n"); + illegal = 1; + } allow overriding -c with -H and vice versa */ + if ((vflag || tflag) && Vflag) { + msg(3, 0, "-v and -V are mutually exclusive.\n"); + illegal = 1; + } + /*if (Bflag && Cflag) { + msg(3, 0, "-B and -C are mutually exclusive.\n"); + illegal = 1; + } allow overriding of block sizes */ + if ((Hflag || cflag || Kflag || eflag) && sixflag) { + msg(3, 0, "-H and -6 are mutually exclusive.\n"); + illegal = 1; + } + if (!sysv3 && Mflag && Oflag == NULL && Iflag == NULL) { + msg(3, 0, "-M not meaningful without -O or -I.\n"); + illegal = 1; + } + if (!sysv3 && Aflag && Oflag == NULL) { + msg(3, 0, "-A requires the -O option\n"); + illegal = 1; + } + if (illegal) + usage(); +} + +void +usage(void) +{ + if (sysv3) + fprintf(stderr, "\ +Usage: %s -o[acvVABL] [-Csize] [-Hhdr] [-Mmsg] <name-list >collection\n\ +\t%s -o[acvVABL] -Ocollection [-Csize] [-Hhdr] [-Mmsg] <name-list\n\ +\t%s -i[bcdkmrsStuvVfB6] [-Csize] [-Efile] [-Hhdr] [-Mmsg] [-Rid] [pattern ...] <collection\n\ +\t%s -i[bcdkmrsStuvVfB6] -Icollection [-Csize] [-Efile] [-Hhdr] [-Mmsg] [-Rid] [pattern ...]\n\ +\t%s -p[adlmruvVL] [-Rid] directory <name-list\n", + progname, progname, progname, progname, progname); + else + fprintf(stderr, "USAGE:\n\ +\t%s -i[bcdfkmrstuvBSV6] [-C size] [-E file] [-H hdr] [[-I file] [-M msg]] \ +[-R id] [patterns]\n\ +\t%s -o[acvABLV] [-C size] [-H hdr] [[-M msg] [-O file]]\n\ +\t%s -p[adlmuvLV] [-R id] directory\n", + progname, progname, progname); + exit(1); +} diff --git a/package/heirloom-cpio/src/getdir.c b/package/heirloom-cpio/src/getdir.c new file mode 100644 index 000000000..245b7641e --- /dev/null +++ b/package/heirloom-cpio/src/getdir.c @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)getdir.c 1.20 (gritter) 5/14/06 */ + +#ifndef __linux__ +/* + * 32-bit Solaris and Open UNIX do not have 64-bit getdents(); but + * having _FILE_OFFSET_BITS=64 will make it use a dirent64 struct + * on Open UNIX -> SEGV. + */ +#undef _FILE_OFFSET_BITS +#endif /* !__linux__ */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <stdlib.h> +#include <errno.h> +#include <string.h> + +#if defined (__UCLIBC__) +#include <linux/types.h> +#include <linux/dirent.h> +#define getdents(a, b, c) __getdents64(a, b, c) +#define dirent dirent64 +extern int getdents(int, struct dirent *, size_t); +#elif defined (__GLIBC__) || defined (__FreeBSD__) || defined (_AIX) || \ + defined (__NetBSD__) || defined (__OpenBSD__) || \ + defined (__DragonFly__) || defined (__APPLE__) +#include <dirent.h> +#define getdents(a, b, c) getdirentries((a), (char *)(b), (c), &(db->g_offs)) +#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || \ + defined (__DragonFly__) || defined (__APPLE__) +#undef d_ino +#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ + || __APPLE__ */ +#elif defined (__dietlibc__) +#include <dirent.h> +#include <unistd.h> +#else /* !__GLIBC__, !__dietlibc__ */ +#ifdef __hpux +#define _KERNEL +#endif /* __hpux */ +#include <sys/dirent.h> +#ifdef __hpux +#ifndef _INO64_T +typedef unsigned long long uint64_t; +typedef uint64_t ino64_t; +#endif /* !_INO64_T */ +#ifdef __LP64__ +#define dirent __dirent64 +#else /* !__LP64__ */ +#define dirent __dirent32 +#endif /* !__LP64__ */ +#define d_reclen __d_reclen +#define d_name __d_name +#define d_ino __d_ino +#endif /* __hpux */ +#endif /* !__GLIBC__, !__dietlibc__ */ + +#include "getdir.h" + +#define DIBSIZE 5120 + +struct getdb { +#if !defined (__FreeBSD__) && !defined (__NetBSD__) && !defined (__OpenBSD__) \ + && !defined (__DragonFly__) && !defined (__APPLE__) + off_t g_offs; +#else /* __FreeBSD__, __NetBSD__, __OpenBSD__, __DragonFly__, __APPLE__ */ + long g_offs; +#endif /* __FreeBSD__, __NetBSD__, __OpenBSD__, __DragonFly__, __APPLE__ */ + struct dirent *g_dirp; + const char *g_path; + struct direc g_dic; + union { + char g_dirbuf[DIBSIZE+1]; + struct dirent g_dummy[1]; + } g_u; + int g_num; + int g_fd; +}; + +struct getdb * +getdb_alloc(const char *path, int fd) +{ + struct getdb *db; + + if ((db = malloc(sizeof *db)) == NULL) + return NULL; + db->g_dirp = NULL; + db->g_offs = 0; + db->g_fd = fd; + db->g_path = path; + return db; +} + +void +getdb_free(struct getdb *db) +{ + free(db); +} + +struct direc * +getdir(struct getdb *db, int *err) +{ + int reclen; + + *err = 0; + while (db->g_dirp == NULL) + { + /*LINTED*/ + db->g_num = getdents(db->g_fd, + (struct dirent *)db->g_u.g_dirbuf, + DIBSIZE); + if (db->g_num <= 0) { + if (db->g_num < 0) + *err = errno; + db->g_offs = 0; + return NULL; + } + /*LINTED*/ + db->g_dirp = (struct dirent *)db->g_u.g_dirbuf; + while (db->g_dirp && +#if !defined (__FreeBSD__) && !defined (__NetBSD__) && !defined (__OpenBSD__) \ + && !defined (__DragonFly__) && !defined (__APPLE__) + db->g_dirp->d_ino == 0 +#else /* __FreeBSD__, __NetBSD__, __OpenBSD__, __DragonFly__, __APPLE__ */ + (db->g_dirp->d_fileno == 0 +#ifdef DT_WHT + || db->g_dirp->d_type == DT_WHT +#endif + ) +#endif /* __FreeBSD__, __NetBSD__, __OpenBSD__, __DragonFly__, __APPLE__ */ + ) + { + next: +#ifndef __DragonFly__ + reclen = db->g_dirp->d_reclen; +#else + reclen = _DIRENT_DIRSIZ(db->g_dirp); +#endif + if ((db->g_num -= reclen) == 0 || reclen == 0) + db->g_dirp = NULL; + else + db->g_dirp = + /*LINTED*/ + (struct dirent *)((char *)db->g_dirp + + reclen); + } + } +#if !defined (__FreeBSD__) && !defined (__NetBSD__) && !defined (__OpenBSD__) \ + && !defined (__DragonFly__) && !defined (__APPLE__) + if (db->g_dirp->d_ino == 0) + goto next; + db->g_dic.d_ino = db->g_dirp->d_ino; +#else /* __FreeBSD__, __NetBSD__, __OpenBSD__, __DragonFly__, __APPLE__ */ + if (db->g_dirp->d_fileno == 0 +#ifdef DT_WHT + || db->g_dirp->d_type == DT_WHT +#endif + ) + { + goto next; + } + db->g_dic.d_ino = db->g_dirp->d_fileno; +#endif /* __FreeBSD__, __NetBSD__, __OpenBSD__, __DragonFly__, __APPLE__ */ + db->g_dic.d_name = db->g_dirp->d_name; +#ifndef __DragonFly__ + reclen = db->g_dirp->d_reclen; +#else + reclen = _DIRENT_DIRSIZ(db->g_dirp); +#endif + if ((db->g_num -= reclen) == 0 || reclen == 0) + db->g_dirp = NULL; + else + /*LINTED*/ + db->g_dirp = (struct dirent *)((char *)db->g_dirp + reclen); + return &(db->g_dic); +} diff --git a/package/heirloom-cpio/src/getdir.h b/package/heirloom-cpio/src/getdir.h new file mode 100644 index 000000000..29d107b6f --- /dev/null +++ b/package/heirloom-cpio/src/getdir.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)getdir.h 1.4 (gritter) 10/19/03 */ + +#include <sys/types.h> + +struct direc { + unsigned long long d_ino; + char *d_name; +}; + +extern struct getdb *getdb_alloc(const char *, int); +extern void getdb_free(struct getdb *); +extern struct direc *getdir(struct getdb *, int *); diff --git a/package/heirloom-cpio/src/getopt.c b/package/heirloom-cpio/src/getopt.c new file mode 100644 index 000000000..0a68ac8e9 --- /dev/null +++ b/package/heirloom-cpio/src/getopt.c @@ -0,0 +1,141 @@ +/* + * getopt() - command option parsing + * + * Gunnar Ritter, Freiburg i. Br., Germany, March 2002. + */ + +/* Sccsid @(#)getopt.c 1.6 (gritter) 12/16/07 */ + +#include <sys/types.h> +#include <alloca.h> +#include <string.h> +#include "msgselect.h" + +/* + * One should not think that re-implementing this is necessary, but + * + * - Some libcs print weird messages. + * + * - GNU libc getopt() is totally brain-damaged, as it requires special + * care _not_ to reorder parameters and can't be told to work correctly + * with ':' as first optstring character at all. + */ + +char *optarg = 0; +int optind = 1; +int opterr = 1; +int optopt = 0; +extern char *pfmt_label__; + +static void +error(const char *s, int c) +{ + /* + * Avoid including <unistd.h>, in case its getopt() declaration + * conflicts. + */ + extern ssize_t write(int, const void *, size_t); + const char *msg = 0; + char *buf, *bp; + + if (pfmt_label__) + s = pfmt_label__; + switch (c) { + case '?': + msg = ": " msgselect("I","i") "llegal option -- "; + break; + case ':': + msg = ": " msgselect("O","o") "ption requires an argument -- "; + break; + } + bp = buf = alloca(strlen(s) + strlen(msg) + 2); + while (*s) + *bp++ = *s++; + while (*msg) + *bp++ = *msg++; + *bp++ = optopt; + *bp++ = '\n'; + write(2, buf, bp - buf); +} + +int +getopt(int argc, char *const argv[], const char *optstring) +{ + int colon; + static const char *lastp; + const char *curp; + + if (optstring[0] == ':') { + colon = 1; + optstring++; + } else + colon = 0; + if (lastp) { + curp = lastp; + lastp = 0; + } else { + if (optind >= argc || argv[optind] == 0 || + argv[optind][0] != '-' || + argv[optind][1] == '\0') + return -1; + if (argv[optind][1] == '-' && argv[optind][2] == '\0') { + optind++; + return -1; + } + curp = &argv[optind][1]; + } + optopt = curp[0] & 0377; + while (optstring[0]) { + if (optstring[0] == ':') { + optstring++; + continue; + } + if ((optstring[0] & 0377) == optopt) { + if (optstring[1] == ':') { + if (curp[1] != '\0') { + optarg = (char *)&curp[1]; + optind++; + } else { + if ((optind += 2) > argc) { + if (!colon && opterr) + error(argv[0], ':'); + return colon ? ':' : '?'; + } + optarg = argv[optind - 1]; + } + } else { + if (curp[1] != '\0') + lastp = &curp[1]; + else + optind++; + optarg = 0; + } + return optopt; + } + optstring++; + } + if (!colon && opterr) + error(argv[0], '?'); + if (curp[1] != '\0') + lastp = &curp[1]; + else + optind++; + optarg = 0; + return '?'; +} + +#ifdef __APPLE__ +/* + * Starting with Mac OS 10.5 Leopard, <unistd.h> turns getopt() + * into getopt$UNIX2003() by default. Consequently, this function + * is called instead of the one defined above. However, optind is + * still taken from this file, so in effect, options are not + * properly handled. Defining an own getopt$UNIX2003() function + * works around this issue. + */ +int +getopt$UNIX2003(int argc, char *const argv[], const char *optstring) +{ + return getopt(argc, argv, optstring); +} +#endif /* __APPLE__ */ diff --git a/package/heirloom-cpio/src/gmatch.c b/package/heirloom-cpio/src/gmatch.c new file mode 100644 index 000000000..a2c5eb7ba --- /dev/null +++ b/package/heirloom-cpio/src/gmatch.c @@ -0,0 +1,136 @@ +/* + * Derived from /usr/src/cmd/sh/expand.c, Unix 7th Edition: + * + * Copyright(C) Caldera International Inc. 2001-2002. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * Redistributions of source code and documentation must retain the + * above copyright notice, this list of conditions and the following + * disclaimer. + * 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. + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed or owned by Caldera + * International, Inc. + * Neither the name of Caldera International, Inc. nor the names of + * other contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA + * INTERNATIONAL, INC. 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 CALDERA INTERNATIONAL, INC. 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. + */ + +#if __GNUC__ >= 3 && __GNUC_MINOR__ >= 4 || __GNUC__ >= 4 +#define USED __attribute__ ((used)) +#elif defined __GNUC__ +#define USED __attribute__ ((unused)) +#else +#define USED +#endif +static const char sccsid[] USED = "@(#)gmatch.sl 1.5 (gritter) 5/29/05"; + +#include <stdlib.h> +#include <wchar.h> +#include <limits.h> + +#include "mbtowi.h" + +#define fetch(wc, s, n) ((mb_cur_max > 1 && *(s) & 0200 ? \ + ((n) = mbtowi(&(wc), (s), mb_cur_max), \ + (n) = ((n) > 0 ? (n) : (n) < 0 ? (wc = WEOF, 1) : 1)) :\ + ((wc) = *(s) & 0377, (n) = 1)), (s) += (n), (wc)) + +int +gmatch(const char *s, const char *p) +{ + const char *bs = s; + int mb_cur_max = MB_CUR_MAX; + wint_t c, scc; + int n; + + if (fetch(scc, s, n) == WEOF) + return (0); + switch (fetch(c, p, n)) { + + case '[': { + int ok = 0, excl; + unsigned long lc = ULONG_MAX; + const char *bp; + + if (*p == '!') { + p++; + excl = 1; + } else + excl = 0; + fetch(c, p, n); + bp = p; + while (c != '\0') { + if (c == ']' && p > bp) + return (ok ^ excl ? gmatch(s, p) : 0); + else if (c == '-' && p > bp && *p != ']') { + if (*p == '\\') + p++; + if (fetch(c, p, n) == '\0') + break; + if (lc <= scc && scc <= c) + ok = 1; + } else { + if (c == '\\') { + if (fetch(c, p, n) == '\0') + break; + } + if (scc == (lc = c)) + ok = 1; + } + fetch(c, p, n); + } + return (0); + } + + case '\\': + fetch(c, p, n); + if (c == '\0') + return (0); + /*FALLTHRU*/ + + default: + if (c != scc) + return (0); + /*FALLTHRU*/ + + case '?': + return (scc ? gmatch(s, p) : 0); + + case '*': + if (*p == '\0') + return (1); + s = bs; + while (*s) { + if (gmatch(s, p)) + return (1); + fetch(scc, s, n); + } + return (0); + + case '\0': + return (scc == '\0'); + + case WEOF: + return (0); + + } +} diff --git a/package/heirloom-cpio/src/ib_alloc.c b/package/heirloom-cpio/src/ib_alloc.c new file mode 100644 index 000000000..4020940ce --- /dev/null +++ b/package/heirloom-cpio/src/ib_alloc.c @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)ib_alloc.c 1.5 (gritter) 3/12/05 */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +#include "memalign.h" +#include "iblok.h" + +struct iblok * +ib_alloc(int fd, unsigned blksize) +{ + static long pagesize; + struct iblok *ip; + struct stat st; + + if (pagesize == 0) + if ((pagesize = sysconf(_SC_PAGESIZE)) < 0) + pagesize = 4096; + if (blksize == 0) { + if (fstat(fd, &st) < 0) + return NULL; + blksize = st.st_blksize > 0 ? st.st_blksize : 512; + } + if ((ip = calloc(1, sizeof *ip)) == NULL) + return NULL; + if ((ip->ib_blk = memalign(pagesize, blksize)) == NULL) { + free(ip); + return NULL; + } + ip->ib_blksize = blksize; + ip->ib_fd = fd; + ip->ib_mb_cur_max = MB_CUR_MAX; + return ip; +} diff --git a/package/heirloom-cpio/src/ib_close.c b/package/heirloom-cpio/src/ib_close.c new file mode 100644 index 000000000..946bb9ef6 --- /dev/null +++ b/package/heirloom-cpio/src/ib_close.c @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)ib_close.c 1.2 (gritter) 4/17/03 */ + +#include <unistd.h> + +#include "iblok.h" + +int +ib_close(struct iblok *ip) +{ + int fd; + + fd = ip->ib_fd; + ib_free(ip); + return close(fd); +} diff --git a/package/heirloom-cpio/src/ib_free.c b/package/heirloom-cpio/src/ib_free.c new file mode 100644 index 000000000..72143afef --- /dev/null +++ b/package/heirloom-cpio/src/ib_free.c @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)ib_free.c 1.2 (gritter) 4/17/03 */ + +#include <stdlib.h> + +#include "iblok.h" + +void +ib_free(struct iblok *ip) +{ + free(ip->ib_blk); + free(ip); +} diff --git a/package/heirloom-cpio/src/ib_getlin.c b/package/heirloom-cpio/src/ib_getlin.c new file mode 100644 index 000000000..ddee226b4 --- /dev/null +++ b/package/heirloom-cpio/src/ib_getlin.c @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)ib_getlin.c 1.2 (gritter) 4/17/03 */ + +#include <string.h> +#include <stdlib.h> +#include "iblok.h" + +size_t +ib_getlin(struct iblok *ip, char **line, size_t *alcd, + void *(*reallc)(void *, size_t)) +{ + char *nl; + size_t sz, llen = 0, nllen; + + for (;;) { + if (ip->ib_cur >= ip->ib_end) { + if (ip->ib_incompl) { + ip->ib_incompl = 0; + return 0; + } + if (ib_read(ip) == EOF) { + if (llen) { + ip->ib_incompl++; + (*line)[llen] = '\0'; + return llen; + } else + return 0; + } + /* + * ib_read() advances ib_cur since *ib_cur++ gives + * better performance than *++ib_cur for ib_get(). + * Go back again. + */ + ip->ib_cur--; + } + sz = ip->ib_end - ip->ib_cur; + if ((nl = memchr(ip->ib_cur, '\n', sz)) != NULL) { + sz = nl - ip->ib_cur + 1; + if ((nllen = llen + sz + 1) > *alcd) { + *line = reallc(*line, nllen); + *alcd = nllen; + } + memcpy(&(*line)[llen], ip->ib_cur, sz); + (*line)[llen + sz] = '\0'; + ip->ib_cur = nl + 1; + return llen + sz; + } + if ((nllen = llen + sz + 1) > *alcd) { + *line = reallc(*line, nllen); + *alcd = nllen; + } + memcpy(&(*line)[llen], ip->ib_cur, sz); + llen += sz; + ip->ib_cur = ip->ib_end; + } + /*NOTREACHED*/ + return 0; +} diff --git a/package/heirloom-cpio/src/ib_getw.c b/package/heirloom-cpio/src/ib_getw.c new file mode 100644 index 000000000..b7f2e6762 --- /dev/null +++ b/package/heirloom-cpio/src/ib_getw.c @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)ib_getw.c 1.5 (gritter) 7/16/04 */ + +#include <stdlib.h> +#include <string.h> +#include "iblok.h" +#include "mbtowi.h" + +char * +ib_getw(struct iblok *ip, wint_t *wc, int *len) +{ + size_t rest; + int c, i, n; + + i = 0; + rest = ip->ib_mend - ip->ib_mcur; + if (rest && ip->ib_mcur > ip->ib_mbuf) { + do + ip->ib_mbuf[i] = ip->ib_mcur[i]; + while (i++, --rest); + } else if (ip->ib_incompl) { + ip->ib_incompl = 0; + *wc = WEOF; + ip->ib_mend = ip->ib_mcur = NULL; + return NULL; + } + if (i == 0) { + c = ib_get(ip); + if (c == EOF) { + *wc = WEOF; + ip->ib_mend = ip->ib_mcur = NULL; + return NULL; + } + ip->ib_mbuf[i++] = (char)c; + } + if (ip->ib_mbuf[0] & 0200) { + while (ip->ib_mbuf[i-1] != '\n' && i < ip->ib_mb_cur_max && + ip->ib_incompl == 0) { + c = ib_get(ip); + if (c != EOF) + ip->ib_mbuf[i++] = (char)c; + else + ip->ib_incompl = 1; + } + n = mbtowi(wc, ip->ib_mbuf, i); + if (n < 0) { + *len = 1; + *wc = WEOF; + } else if (n == 0) { + *len = 1; + *wc = '\0'; + } else + *len = n; + } else { + *wc = ip->ib_mbuf[0]; + *len = n = 1; + } + ip->ib_mcur = &ip->ib_mbuf[*len]; + ip->ib_mend = &ip->ib_mcur[i - *len]; + return ip->ib_mbuf; +} diff --git a/package/heirloom-cpio/src/ib_open.c b/package/heirloom-cpio/src/ib_open.c new file mode 100644 index 000000000..18e09c776 --- /dev/null +++ b/package/heirloom-cpio/src/ib_open.c @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)ib_open.c 1.2 (gritter) 4/17/03 */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +#include "iblok.h" + +struct iblok * +ib_open(const char *name, unsigned blksize) +{ + struct iblok *ip; + int fd, err; + + if ((fd = open(name, O_RDONLY)) < 0) + return NULL; + if ((ip = ib_alloc(fd, blksize)) == NULL) { + err = errno; + close(fd); + errno = err; + } + return ip; +} diff --git a/package/heirloom-cpio/src/ib_popen.c b/package/heirloom-cpio/src/ib_popen.c new file mode 100644 index 000000000..9aa873042 --- /dev/null +++ b/package/heirloom-cpio/src/ib_popen.c @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)ib_popen.c 1.2 (gritter) 4/17/03 */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/wait.h> +#include <fcntl.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> +#include <signal.h> + +#include "iblok.h" + +struct iblok * +ib_popen(const char *cmd, unsigned blksize) +{ + struct iblok *ip; + int fd[2], err; + pid_t pid; + char *shell; + + if (pipe(fd) < 0) + return NULL; + switch (pid = fork()) { + case -1: + return NULL; + case 0: + close(fd[0]); + dup2(fd[1], 1); + close(fd[1]); + if ((shell = getenv("SHELL")) == NULL) + shell = "/bin/sh"; + execl(shell, shell, "-c", cmd, NULL); + _exit(0177); + /*NOTREACHED*/ + } + close(fd[1]); + if ((ip = ib_alloc(fd[0], blksize)) == NULL) { + err = errno; + close(fd[0]); + errno = err; + } + ip->ib_pid = pid; + return ip; +} + +int +ib_pclose(struct iblok *ip) +{ + struct sigaction oldhup, oldint, oldquit, act; + int status; + + close(ip->ib_fd); + act.sa_handler = SIG_IGN; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; + sigaction(SIGHUP, &act, &oldhup); + sigaction(SIGINT, &act, &oldint); + sigaction(SIGQUIT, &act, &oldquit); + while (waitpid(ip->ib_pid, &status, 0) < 0 && errno == EINTR); + sigaction(SIGHUP, &oldhup, NULL); + sigaction(SIGINT, &oldint, NULL); + sigaction(SIGQUIT, &oldquit, NULL); + return status; +} diff --git a/package/heirloom-cpio/src/ib_read.c b/package/heirloom-cpio/src/ib_read.c new file mode 100644 index 000000000..3794f3e95 --- /dev/null +++ b/package/heirloom-cpio/src/ib_read.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)ib_read.c 1.2 (gritter) 4/17/03 */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +#include "iblok.h" + +int +ib_read(struct iblok *ip) +{ + ssize_t sz; + + do { + if ((sz = read(ip->ib_fd, ip->ib_blk, ip->ib_blksize)) > 0) { + ip->ib_endoff += sz; + ip->ib_cur = ip->ib_blk; + ip->ib_end = &ip->ib_blk[sz]; + return *ip->ib_cur++ & 0377; + } + } while (sz < 0 && errno == EINTR); + if (sz < 0) + ip->ib_errno = errno; + ip->ib_cur = ip->ib_end = NULL; + return EOF; +} diff --git a/package/heirloom-cpio/src/ib_seek.c b/package/heirloom-cpio/src/ib_seek.c new file mode 100644 index 000000000..48b2f99bc --- /dev/null +++ b/package/heirloom-cpio/src/ib_seek.c @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)ib_seek.c 1.4 (gritter) 5/8/03 */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +#include "iblok.h" + +off_t +ib_seek(struct iblok *ip, off_t off, int whence) +{ + if (whence == SEEK_CUR) { + off = ip->ib_endoff - (ip->ib_end - ip->ib_cur); + whence = SEEK_SET; + } + if (ip->ib_seekable && whence == SEEK_SET && ip->ib_cur && ip->ib_end && + off < ip->ib_endoff && + off >= ip->ib_endoff - (ip->ib_end - ip->ib_blk)) { + ip->ib_cur = ip->ib_end - (ip->ib_endoff - off); + return off; + } + if ((off = lseek(ip->ib_fd, off, whence)) == (off_t)-1) + return -1; + ip->ib_cur = ip->ib_end = NULL; + ip->ib_endoff = off; + ip->ib_seekable = 1; + return off; +} diff --git a/package/heirloom-cpio/src/iblok.h b/package/heirloom-cpio/src/iblok.h new file mode 100644 index 000000000..66964627f --- /dev/null +++ b/package/heirloom-cpio/src/iblok.h @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)iblok.h 1.5 (gritter) 7/16/04 */ + +/* + * Functions to read a file sequentially. + */ + +#include <sys/types.h> /* for off_t, pid_t */ +#include <stdio.h> /* for EOF */ +#include <wchar.h> /* for wchar_t */ +#include <limits.h> /* for MB_LEN_MAX */ + +struct iblok { + long long ib_endoff; /* offset of endc from start of file */ + char ib_mbuf[MB_LEN_MAX+1]; /* multibyte overflow buffer */ + char *ib_mcur; /* next byte to read in ib_mbuf */ + char *ib_mend; /* one beyond last byte in ib_mbuf */ + char *ib_blk; /* buffered data */ + char *ib_cur; /* next character in ib_blk */ + char *ib_end; /* one beyond last byte in ib_blk */ + int ib_fd; /* input file descriptor */ + int ib_errno; /* errno on error, or 0 */ + int ib_incompl; /* had an incomplete last line */ + int ib_mb_cur_max; /* MB_CUR_MAX at time of ib_alloc() */ + int ib_seekable; /* had a successful lseek() */ + pid_t ib_pid; /* child from ib_popen() */ + unsigned ib_blksize; /* buffer size */ +}; + +/* + * Allocate an input buffer with file descriptor fd. blksize may be + * either the size of a buffer to allocate in ib_blk, or 0 if the + * size is determined automatically. On error, NULL is returned and + * errno indicates the offending error. + */ +extern struct iblok *ib_alloc(int fd, unsigned blksize); + +/* + * Deallocate the passed input buffer. The file descriptor is not + * closed. + */ +extern void ib_free(struct iblok *ip); + +/* + * Open file name and do ib_alloc() on the descriptor. + */ +extern struct iblok *ib_open(const char *name, unsigned blksize); + +/* + * Close the file descriptor in ip and do ib_free(). Return value is + * the result of close(). + */ +extern int ib_close(struct iblok *ip); + +/* + * A workalike of popen(cmd, "r") using iblok facilities. + */ +extern struct iblok *ib_popen(const char *cmd, unsigned blksize); + +/* + * Close an iblok opened with ib_popen(). + */ +extern int ib_pclose(struct iblok *ip); + +/* + * Read new input buffer. Returns the next character (or EOF) and advances + * ib_cur by one above the bottom of the buffer. + */ +extern int ib_read(struct iblok *ip); + +/* + * Get next character. Return EOF at end-of-file or read error. + */ +#define ib_get(ip) ((ip)->ib_cur < (ip)->ib_end ? *(ip)->ib_cur++ & 0377 :\ + ib_read(ip)) + +/* + * Unget a character. Note that this implementation alters the read buffer. + * Caution: Calling this macro more than once might underflow ib_blk. + */ +#define ib_unget(c, ip) (*(--(ip)->ib_cur) = (char)(c)) + +/* + * Get file offset of last read character. + */ +#define ib_offs(ip) ((ip)->ib_endoff - ((ip)->ib_end - (ip)->ib_cur - 1)) + +/* + * Read a wide character using ib_get() facilities. *wc is used to store + * the wide character, or WEOF if an invalid byte sequence was found. + * The number of bytes consumed is stored in *len. Return value is the + * corresponding byte sequence, or NULL at end-of-file in input. + * + * Note that it is not possible to mix calls to ib_getw() with calls to + * ib_get(), ib_unget() or ib_seek() unless the last character read by + * ib_getw() was L'\n'. + */ +extern char *ib_getw(struct iblok *ip, wint_t *wc, int *len); + +/* + * Get a line from ip, returning the line length. Further arguments are either + * the pointer to a malloc()ed buffer and a pointer to its size, or (NULL, 0) + * if ib_getlin() shall allocate the buffer itselves. ib_getlin() will use + * the realloc-style function reallc() to increase the buffer if necessary; + * this function is expected never to fail (i. e., it must longjmp() or abort + * if it cannot allocate a buffer of the demanded size). + * On end-of-file or error, 0 is returned. + */ +extern size_t ib_getlin(struct iblok *ip, char **line, size_t *alcd, + void *(*reallc)(void *, size_t)); + +/* + * Like lseek(). + */ +extern off_t ib_seek(struct iblok *ip, off_t off, int whence); diff --git a/package/heirloom-cpio/src/inflate.c b/package/heirloom-cpio/src/inflate.c new file mode 100644 index 000000000..2c6d3e59f --- /dev/null +++ b/package/heirloom-cpio/src/inflate.c @@ -0,0 +1,991 @@ +/* + * Changes by Gunnar Ritter, Freiburg i. Br., Germany, May 2003. + * + * Derived from Info-ZIP 5.50. + * + * Sccsid @(#)inflate.c 1.6 (gritter) 10/13/04 + */ +/* +This is version 2002-Feb-16 of the Info-ZIP copyright and license. +The definitive version of this document should be available at +ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely. + + +Copyright (c) 1990-2002 Info-ZIP. All rights reserved. + +For the purposes of this copyright and license, "Info-ZIP" is defined as +the following set of individuals: + + Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois, + Jean-loup Gailly, Hunter Goatley, Ian Gorman, Chris Herborth, Dirk Haase, + Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz, David Kirschbaum, + Johnny Lee, Onno van der Linden, Igor Mandrichenko, Steve P. Miller, + Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs, Kai Uwe Rommel, + Steve Salisbury, Dave Smith, Christian Spieler, Antoine Verheijen, + Paul von Behren, Rich Wales, Mike White + +This software is provided "as is," without warranty of any kind, express +or implied. In no event shall Info-ZIP or its contributors be held liable +for any direct, indirect, incidental, special or consequential damages +arising out of the use of or inability to use this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + + 1. Redistributions of source code must retain the above copyright notice, + definition, disclaimer, and this list of conditions. + + 2. Redistributions in binary form (compiled executables) must reproduce + the above copyright notice, definition, disclaimer, and this list of + conditions in documentation and/or other materials provided with the + distribution. The sole exception to this condition is redistribution + of a standard UnZipSFX binary as part of a self-extracting archive; + that is permitted without inclusion of this license, as long as the + normal UnZipSFX banner has not been removed from the binary or disabled. + + 3. Altered versions--including, but not limited to, ports to new operating + systems, existing ports with new graphical interfaces, and dynamic, + shared, or static library versions--must be plainly marked as such + and must not be misrepresented as being the original source. Such + altered versions also must not be misrepresented as being Info-ZIP + releases--including, but not limited to, labeling of the altered + versions with the names "Info-ZIP" (or any variation thereof, including, + but not limited to, different capitalizations), "Pocket UnZip," "WiZ" + or "MacZip" without the explicit permission of Info-ZIP. Such altered + versions are further prohibited from misrepresentative use of the + Zip-Bugs or Info-ZIP e-mail addresses or of the Info-ZIP URL(s). + + 4. Info-ZIP retains the right to use the names "Info-ZIP," "Zip," "UnZip," + "UnZipSFX," "WiZ," "Pocket UnZip," "Pocket Zip," and "MacZip" for its + own source and binary releases. +*/ +/* + Copyright (c) 1990-2002 Info-ZIP. All rights reserved. + + See the accompanying file LICENSE, version 2000-Apr-09 or later + (the contents of which are also included in unzip.h) for terms of use. + If, for some reason, all these files are missing, the Info-ZIP license + also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html +*/ +/* inflate.c -- by Mark Adler + version c17a, 04 Feb 2001 */ + + +/* Copyright history: + - Starting with UnZip 5.41 of 16-April-2000, this source file + is covered by the Info-Zip LICENSE cited above. + - Prior versions of this source file, found in UnZip source packages + up to UnZip 5.40, were put in the public domain. + The original copyright note by Mark Adler was: + "You can do whatever you like with this source file, + though I would prefer that if you modify it and + redistribute it that you include comments to that effect + with your name and the date. Thank you." + + History: + vers date who what + ---- --------- -------------- ------------------------------------ + a ~~ Feb 92 M. Adler used full (large, one-step) lookup table + b1 21 Mar 92 M. Adler first version with partial lookup tables + b2 21 Mar 92 M. Adler fixed bug in fixed-code blocks + b3 22 Mar 92 M. Adler sped up match copies, cleaned up some + b4 25 Mar 92 M. Adler added prototypes; removed window[] (now + is the responsibility of unzip.h--also + changed name to slide[]), so needs diffs + for unzip.c and unzip.h (this allows + compiling in the small model on MSDOS); + fixed cast of q in huft_build(); + b5 26 Mar 92 M. Adler got rid of unintended macro recursion. + b6 27 Mar 92 M. Adler got rid of nextbyte() routine. fixed + bug in inflate_fixed(). + c1 30 Mar 92 M. Adler removed lbits, dbits environment variables. + changed BMAX to 16 for explode. Removed + OUTB usage, and replaced it with flush()-- + this was a 20% speed improvement! Added + an explode.c (to replace unimplod.c) that + uses the huft routines here. Removed + register union. + c2 4 Apr 92 M. Adler fixed bug for file sizes a multiple of 32k. + c3 10 Apr 92 M. Adler reduced memory of code tables made by + huft_build significantly (factor of two to + three). + c4 15 Apr 92 M. Adler added NOMEMCPY do kill use of memcpy(). + worked around a Turbo C optimization bug. + c5 21 Apr 92 M. Adler added the WSIZE #define to allow reducing + the 32K window size for specialized + applications. + c6 31 May 92 M. Adler added some typecasts to eliminate warnings + c7 27 Jun 92 G. Roelofs added some more typecasts (444: MSC bug). + c8 5 Oct 92 J-l. Gailly added ifdef'd code to deal with PKZIP bug. + c9 9 Oct 92 M. Adler removed a memory error message (~line 416). + c10 17 Oct 92 G. Roelofs changed ULONG/UWORD/byte to ulg/ush/uch, + removed old inflate, renamed inflate_entry + to inflate, added Mark's fix to a comment. + c10.5 14 Dec 92 M. Adler fix up error messages for incomplete trees. + c11 2 Jan 93 M. Adler fixed bug in detection of incomplete + tables, and removed assumption that EOB is + the longest code (bad assumption). + c12 3 Jan 93 M. Adler make tables for fixed blocks only once. + c13 5 Jan 93 M. Adler allow all zero length codes (pkzip 2.04c + outputs one zero length code for an empty + distance tree). + c14 12 Mar 93 M. Adler made inflate.c standalone with the + introduction of inflate.h. + c14b 16 Jul 93 G. Roelofs added (unsigned) typecast to w at 470. + c14c 19 Jul 93 J. Bush changed v[N_MAX], l[288], ll[28x+3x] arrays + to static for Amiga. + c14d 13 Aug 93 J-l. Gailly de-complicatified Mark's c[*p++]++ thing. + c14e 8 Oct 93 G. Roelofs changed memset() to memzero(). + c14f 22 Oct 93 G. Roelofs renamed quietflg to qflag; made Trace() + conditional; added inflate_free(). + c14g 28 Oct 93 G. Roelofs changed l/(lx+1) macro to pointer (Cray bug) + c14h 7 Dec 93 C. Ghisler huft_build() optimizations. + c14i 9 Jan 94 A. Verheijen set fixed_t{d,l} to NULL after freeing; + G. Roelofs check NEXTBYTE macro for EOF. + c14j 23 Jan 94 G. Roelofs removed Ghisler "optimizations"; ifdef'd + EOF check. + c14k 27 Feb 94 G. Roelofs added some typecasts to avoid warnings. + c14l 9 Apr 94 G. Roelofs fixed split comments on preprocessor lines + to avoid bug in Encore compiler. + c14m 7 Jul 94 P. Kienitz modified to allow assembler version of + inflate_codes() (define ASM_INFLATECODES) + c14n 22 Jul 94 G. Roelofs changed fprintf to macro for DLL versions + c14o 23 Aug 94 C. Spieler added a newline to a debug statement; + G. Roelofs added another typecast to avoid MSC warning + c14p 4 Oct 94 G. Roelofs added (voidp *) cast to free() argument + c14q 30 Oct 94 G. Roelofs changed fprintf macro to MESSAGE() + c14r 1 Nov 94 G. Roelofs fixed possible redefinition of CHECK_EOF + c14s 7 May 95 S. Maxwell OS/2 DLL globals stuff incorporated; + P. Kienitz "fixed" ASM_INFLATECODES macro/prototype + c14t 18 Aug 95 G. Roelofs added UZinflate() to use zlib functions; + changed voidp to zvoid; moved huft_build() + and huft_free() to end of file + c14u 1 Oct 95 G. Roelofs moved G into definition of MESSAGE macro + c14v 8 Nov 95 P. Kienitz changed ASM_INFLATECODES to use a regular + call with __G__ instead of a macro + c15 3 Aug 96 M. Adler fixed bomb-bug on random input data (Adobe) + c15b 24 Aug 96 M. Adler more fixes for random input data + c15c 28 Mar 97 G. Roelofs changed USE_ZLIB fatal exit code from + PK_MEM2 to PK_MEM3 + c16 20 Apr 97 J. Altman added memzero(v[]) in huft_build() + c16b 29 Mar 98 C. Spieler modified DLL code for slide redirection + c16c 04 Apr 99 C. Spieler fixed memory leaks when processing gets + stopped because of input data errors + c16d 05 Jul 99 C. Spieler take care of FLUSH() return values and + stop processing in case of errors + c17 31 Dec 00 C. Spieler added preliminary support for Deflate64 + c17a 04 Feb 01 C. Spieler complete integration of Deflate64 support + c17b 16 Feb 02 C. Spieler changed type of "extra bits" arrays and + corresponding huft_buid() parameter e from + ush into uch, to save space + */ + + +/* + Inflate deflated (PKZIP's method 8 compressed) data. The compression + method searches for as much of the current string of bytes (up to a + length of 258) in the previous 32K bytes. If it doesn't find any + matches (of at least length 3), it codes the next byte. Otherwise, it + codes the length of the matched string and its distance backwards from + the current position. There is a single Huffman code that codes both + single bytes (called "literals") and match lengths. A second Huffman + code codes the distance information, which follows a length code. Each + length or distance code actually represents a base value and a number + of "extra" (sometimes zero) bits to get to add to the base value. At + the end of each deflated block is a special end-of-block (EOB) literal/ + length code. The decoding process is basically: get a literal/length + code; if EOB then done; if a literal, emit the decoded byte; if a + length then get the distance and emit the referred-to bytes from the + sliding window of previously emitted data. + + There are (currently) three kinds of inflate blocks: stored, fixed, and + dynamic. The compressor outputs a chunk of data at a time and decides + which method to use on a chunk-by-chunk basis. A chunk might typically + be 32K to 64K, uncompressed. If the chunk is uncompressible, then the + "stored" method is used. In this case, the bytes are simply stored as + is, eight bits per byte, with none of the above coding. The bytes are + preceded by a count, since there is no longer an EOB code. + + If the data are compressible, then either the fixed or dynamic methods + are used. In the dynamic method, the compressed data are preceded by + an encoding of the literal/length and distance Huffman codes that are + to be used to decode this block. The representation is itself Huffman + coded, and so is preceded by a description of that code. These code + descriptions take up a little space, and so for small blocks, there is + a predefined set of codes, called the fixed codes. The fixed method is + used if the block ends up smaller that way (usually for quite small + chunks); otherwise the dynamic method is used. In the latter case, the + codes are customized to the probabilities in the current block and so + can code it much better than the pre-determined fixed codes can. + + The Huffman codes themselves are decoded using a multi-level table + lookup, in order to maximize the speed of decoding plus the speed of + building the decoding tables. See the comments below that precede the + lbits and dbits tuning parameters. + + GRR: return values(?) + 0 OK + 1 incomplete table + 2 bad input + 3 not enough memory + the following return codes are passed through from FLUSH() errors + 50 (PK_DISK) "overflow of output space" + 80 (IZ_CTRLC) "canceled by user's request" + */ + + +/* + Notes beyond the 1.93a appnote.txt: + + 1. Distance pointers never point before the beginning of the output + stream. + 2. Distance pointers can point back across blocks, up to 32k away. + 3. There is an implied maximum of 7 bits for the bit length table and + 15 bits for the actual data. + 4. If only one code exists, then it is encoded using one bit. (Zero + would be more efficient, but perhaps a little confusing.) If two + codes exist, they are coded using one bit each (0 and 1). + 5. There is no way of sending zero distance codes--a dummy must be + sent if there are none. (History: a pre 2.0 version of PKZIP would + store blocks with no distance codes, but this was discovered to be + too harsh a criterion.) Valid only for 1.93a. 2.04c does allow + zero distance codes, which is sent as one code of zero bits in + length. + 6. There are up to 286 literal/length codes. Code 256 represents the + end-of-block. Note however that the static length tree defines + 288 codes just to fill out the Huffman codes. Codes 286 and 287 + cannot be used though, since there is no length base or extra bits + defined for them. Similarily, there are up to 30 distance codes. + However, static trees define 32 codes (all 5 bits) to fill out the + Huffman codes, but the last two had better not show up in the data. + 7. Unzip can check dynamic Huffman blocks for complete code sets. + The exception is that a single code would not be complete (see #4). + 8. The five bits following the block type is really the number of + literal codes sent minus 257. + 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits + (1+6+6). Therefore, to output three times the length, you output + three codes (1+1+1), whereas to output four times the same length, + you only need two codes (1+3). Hmm. + 10. In the tree reconstruction algorithm, Code = Code + Increment + only if BitLength(i) is not zero. (Pretty obvious.) + 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19) + 12. Note: length code 284 can represent 227-258, but length code 285 + really is 258. The last length deserves its own, short code + since it gets used a lot in very redundant files. The length + 258 is special since 258 - 3 (the min match length) is 255. + 13. The literal/length and distance code bit lengths are read as a + single stream of lengths. It is possible (and advantageous) for + a repeat code (16, 17, or 18) to go across the boundary between + the two sets of lengths. + 14. The Deflate64 (PKZIP method 9) variant of the compression algorithm + differs from "classic" deflate in the following 3 aspect: + a) The size of the sliding history window is expanded to 64 kByte. + b) The previously unused distance codes #30 and #31 code distances + from 32769 to 49152 and 49153 to 65536. Both codes take 14 bits + of extra data to determine the exact position in their 16 kByte + range. + c) The last lit/length code #285 gets a different meaning. Instead + of coding a fixed maximum match length of 258, it is used as a + "generic" match length code, capable of coding any length from + 3 (min match length + 0) to 65538 (min match length + 65535). + This means that the length code #285 takes 16 bits (!) of uncoded + extra data, added to a fixed min length of 3. + Changes a) and b) would have been transparent for valid deflated + data, but change c) requires to switch decoder configurations between + Deflate and Deflate64 modes. + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include "cpio.h" +#include "unzip.h" + +/* + inflate.h must supply the uch slide[WSIZE] array, the zvoid typedef + (void if (void *) is accepted, else char) and the NEXTBYTE, + FLUSH() and memzero macros. If the window size is not 32K, it + should also define WSIZE. If INFMOD is defined, it can include + compiled functions to support the NEXTBYTE and/or FLUSH() macros. + There are defaults for NEXTBYTE and FLUSH() below for use as + examples of what those functions need to do. Normally, you would + also want FLUSH() to compute a crc on the data. inflate.h also + needs to provide these typedefs: + + typedef unsigned char uch; + typedef unsigned short ush; + typedef unsigned long ulg; + + This module uses the external functions malloc() and free() (and + probably memset() or bzero() in the memzero() macro). Their + prototypes are normally found in <string.h> and <stdlib.h>. + */ + +/* marker for "unused" huft code, and corresponding check macro */ +#define INVALID_CODE 99 +#define IS_INVALID_CODE(c) ((c) == INVALID_CODE) + +static int inflate_codes(struct globals *Gp, + struct huft *tl, struct huft *td, + int bl, int bd); +static int inflate_stored(struct globals *Gp); +static int inflate_fixed(struct globals *Gp); +static int inflate_dynamic(struct globals *Gp); +static int inflate_block(struct globals *Gp, int *e); + +#define FLUSH(n) (flush(&G, redirSlide, (n)), 0) + +/* The inflate algorithm uses a sliding 32K byte window on the uncompressed + stream to find repeated byte strings. This is implemented here as a + circular buffer. The index is updated simply by incrementing and then + and'ing with 0x7fff (32K-1). */ +/* It is left to other modules to supply the 32K area. It is assumed + to be usable as if it were declared "uch slide[32768];" or as just + "uch *slide;" and then malloc'ed in the latter case. The definition + must be in unzip.h, included above. */ + + +/* Tables for deflate from PKZIP's appnote.txt. */ +/* - Order of the bit length code lengths */ +static const unsigned border[] = { + 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + +/* - Copy lengths for literal codes 257..285 */ +static const uint16_t cplens64[] = { + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 3, 0, 0}; + /* For Deflate64, the code 285 is defined differently. */ +static const uint16_t cplens32[] = { + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; + /* note: see note #13 above about the 258 in this list. */ +/* - Extra bits for literal codes 257..285 */ +static const uint8_t cplext64[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, + 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 16, INVALID_CODE, INVALID_CODE}; +static const uint8_t cplext32[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, + 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, INVALID_CODE, INVALID_CODE}; + +/* - Copy offsets for distance codes 0..29 (0..31 for Deflate64) */ +static const uint16_t cpdist[] = { + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577, 32769, 49153}; + +/* - Extra bits for distance codes 0..29 (0..31 for Deflate64) */ +static const uint8_t cpdext64[] = { + 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, + 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, + 12, 12, 13, 13, 14, 14}; +static const uint8_t cpdext32[] = { + 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, + 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, + 12, 12, 13, 13, INVALID_CODE, INVALID_CODE}; + +# define MAXLITLENS 288 +# define MAXDISTS 32 + +/* Macros for inflate() bit peeking and grabbing. + The usage is: + + NEEDBITS(j) + x = b & mask_bits[j]; + DUMPBITS(j) + + where NEEDBITS makes sure that b has at least j bits in it, and + DUMPBITS removes the bits from b. The macros use the variable k + for the number of bits in b. Normally, b and k are register + variables for speed and are initialized at the begining of a + routine that uses these macros from a global bit buffer and count. + + In order to not ask for more bits than there are in the compressed + stream, the Huffman tables are constructed to only ask for just + enough bits to make up the end-of-block code (value 256). Then no + bytes need to be "returned" to the buffer at the end of the last + block. See the huft_build() routine. + */ + +# define NEEDBITS(n) {while(k<(n)){int c=NEXTBYTE;\ + if(c==EOF){retval=1;goto cleanup_and_exit;}\ + b|=((uint32_t)c)<<k;k+=8;}} + +#define DUMPBITS(n) {b>>=(n);k-=(n);} + +#define Bits 32 +#define Nob 32 +#define Eob 31 + +/* + Huffman code decoding is performed using a multi-level table lookup. + The fastest way to decode is to simply build a lookup table whose + size is determined by the longest code. However, the time it takes + to build this table can also be a factor if the data being decoded + are not very long. The most common codes are necessarily the + shortest codes, so those codes dominate the decoding time, and hence + the speed. The idea is you can have a shorter table that decodes the + shorter, more probable codes, and then point to subsidiary tables for + the longer codes. The time it costs to decode the longer codes is + then traded against the time it takes to make longer tables. + + This results of this trade are in the variables lbits and dbits + below. lbits is the number of bits the first level table for literal/ + length codes can decode in one step, and dbits is the same thing for + the distance codes. Subsequent tables are also less than or equal to + those sizes. These values may be adjusted either when all of the + codes are shorter than that, in which case the longest code length in + bits is used, or when the shortest code is *longer* than the requested + table size, in which case the length of the shortest code in bits is + used. + + There are two different values for the two tables, since they code a + different number of possibilities each. The literal/length table + codes 286 possible values, or in a flat code, a little over eight + bits. The distance table codes 30 possible values, or a little less + than five bits, flat. The optimum values for speed end up being + about one bit more than those, so lbits is 8+1 and dbits is 5+1. + The optimum values may differ though from machine to machine, and + possibly even between compilers. Your mileage may vary. + */ + + +static const int lbits = 9; /* bits in base literal/length lookup table */ +static const int dbits = 6; /* bits in base distance lookup table */ + +#define G (*Gp) + +static int +inflate_codes(struct globals *Gp, + struct huft *tl, struct huft *td, int bl, int bd) +/*struct huft *tl, *td;*/ /* literal/length and distance decoder tables */ +/*int bl, bd;*/ /* number of bits decoded by tl[] and td[] */ +/* inflate (decompress) the codes in a deflated (compressed) block. + Return an error code or zero if it all goes ok. */ +{ + register unsigned e; /* table entry flag/number of extra bits */ + unsigned d; /* index for copy */ + uint32_t n; /* length for copy (deflate64: might be 64k+2) */ + uint32_t w; /* current window position (deflate64: up to 64k) */ + struct huft *t; /* pointer to table entry */ + unsigned ml, md; /* masks for bl and bd bits */ + register uint32_t b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + int retval = 0; /* error code returned: initialized to "no error" */ + + + /* make local copies of globals */ + b = G.bb; /* initialize bit buffer */ + k = G.bk; + w = G.wp; /* initialize window position */ + + + /* inflate the coded data */ + ml = mask_bits[bl]; /* precompute masks for speed */ + md = mask_bits[bd]; + while (1) /* do until end of block */ + { + NEEDBITS((unsigned)bl) + t = tl + ((unsigned)b & ml); + while (1) { + DUMPBITS(t->b) + + if ((e = t->e) == 32) /* then it's a literal */ + { + redirSlide[w++] = (uint8_t)t->v.n; + if (w == WSIZE) + { + if ((retval = FLUSH(w)) != 0) goto cleanup_and_exit; + w = 0; + } + break; + } + + if (e < 31) /* then it's a length */ + { + /* get length of block to copy */ + NEEDBITS(e) + n = t->v.n + ((unsigned)b & mask_bits[e]); + DUMPBITS(e) + + /* decode distance of block to copy */ + NEEDBITS((unsigned)bd) + t = td + ((unsigned)b & md); + while (1) { + DUMPBITS(t->b) + if ((e = t->e) < 32) + break; + if (IS_INVALID_CODE(e)) + return 1; + e &= 31; + NEEDBITS(e) + t = t->v.t + ((unsigned)b & mask_bits[e]); + } + NEEDBITS(e) + d = (unsigned)w - t->v.n - ((unsigned)b & mask_bits[e]); + DUMPBITS(e) + + /* do the copy */ + do { + e = (unsigned)(WSIZE - + ((d &= (unsigned)(WSIZE-1)) > (unsigned)w ? + (uint32_t)d : w)); + if ((uint32_t)e > n) e = (unsigned)n; + n -= e; +#ifndef NOMEMCPY + if ((unsigned)w - d >= e) + /* (this test assumes unsigned comparison) */ + { + memcpy(redirSlide + (unsigned)w, redirSlide + d, e); + w += e; + d += e; + } + else /* do it slowly to avoid memcpy() overlap */ +#endif /* !NOMEMCPY */ + do { + redirSlide[w++] = redirSlide[d++]; + } while (--e); + if (w == WSIZE) + { + if ((retval = FLUSH(w)) != 0) goto cleanup_and_exit; + w = 0; + } + } while (n); + break; + } + + if (e == 31) /* it's the EOB signal */ + { + /* sorry for this goto, but we have to exit two loops at once */ + goto cleanup_decode; + } + + if (IS_INVALID_CODE(e)) + return 1; + + e &= 31; + NEEDBITS(e) + t = t->v.t + ((unsigned)b & mask_bits[e]); + } + } +cleanup_decode: + + /* restore the globals from the locals */ + G.wp = (unsigned)w; /* restore global window pointer */ + G.bb = b; /* restore global bit buffer */ + G.bk = k; + + +cleanup_and_exit: + /* done */ + return retval; +} + +static int +inflate_stored(struct globals *Gp) +/* "decompress" an inflated type 0 (stored) block. */ +{ + uint32_t w; /* current window position (deflate64: up to 64k!) */ + unsigned n; /* number of bytes in block */ + register uint32_t b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + int retval = 0; /* error code returned: initialized to "no error" */ + + + /* make local copies of globals */ + Trace((stderr, "\nstored block")); + b = G.bb; /* initialize bit buffer */ + k = G.bk; + w = G.wp; /* initialize window position */ + + + /* go to byte boundary */ + n = k & 7; + DUMPBITS(n); + + + /* get the length and its complement */ + NEEDBITS(16) + n = ((unsigned)b & 0xffff); + DUMPBITS(16) + NEEDBITS(16) + if (n != (unsigned)((~b) & 0xffff)) + return 1; /* error in compressed data */ + DUMPBITS(16) + + + /* read and output the compressed data */ + while (n--) + { + NEEDBITS(8) + redirSlide[w++] = (uint8_t)b; + if (w == WSIZE) + { + if ((retval = FLUSH(w)) != 0) goto cleanup_and_exit; + w = 0; + } + DUMPBITS(8) + } + + + /* restore the globals from the locals */ + G.wp = (unsigned)w; /* restore global window pointer */ + G.bb = b; /* restore global bit buffer */ + G.bk = k; + +cleanup_and_exit: + return retval; +} + + +static int +inflate_fixed(struct globals *Gp) +/* decompress an inflated type 1 (fixed Huffman codes) block. We should + either replace this with a custom decoder, or at least precompute the + Huffman tables. */ +{ + /* if first time, set up tables for fixed blocks */ + Trace((stderr, "\nliteral block")); + if (G.fixed_tl == NULL) + { + int i; /* temporary variable */ + unsigned l[288]; /* length list for huft_build */ + + /* literal table */ + for (i = 0; i < 144; i++) + l[i] = 8; + for (; i < 256; i++) + l[i] = 9; + for (; i < 280; i++) + l[i] = 7; + for (; i < 288; i++) /* make a complete, but wrong code set */ + l[i] = 8; + G.fixed_bl = 7; + if ((i = huft_build(l, 288, 257, G.cplens, G.cplext, + &G.fixed_tl, &G.fixed_bl, + Bits, Nob, Eob)) != 0) + { + G.fixed_tl = NULL; + return i; + } + + /* distance table */ + for (i = 0; i < MAXDISTS; i++) /* make an incomplete code set */ + l[i] = 5; + G.fixed_bd = 5; + if ((i = huft_build(l, MAXDISTS, 0, cpdist, G.cpdext, + &G.fixed_td, &G.fixed_bd, + Bits, Nob, Eob)) > 1) + { + huft_free(G.fixed_tl); + G.fixed_td = G.fixed_tl = NULL; + return i; + } + } + + /* decompress until an end-of-block code */ + return inflate_codes(&G, G.fixed_tl, G.fixed_td, + G.fixed_bl, G.fixed_bd); +} + + + +static int inflate_dynamic(struct globals *Gp) +/* decompress an inflated type 2 (dynamic Huffman codes) block. */ +{ + int i; /* temporary variables */ + unsigned j; + unsigned l; /* last length */ + unsigned m; /* mask for bit lengths table */ + unsigned n; /* number of lengths to get */ + struct huft *tl; /* literal/length code table */ + struct huft *td; /* distance code table */ + int bl; /* lookup bits for tl */ + int bd; /* lookup bits for td */ + unsigned nb; /* number of bit length codes */ + unsigned nl; /* number of literal/length codes */ + unsigned nd; /* number of distance codes */ + unsigned ll[MAXLITLENS+MAXDISTS]; /* lit./length and distance code lengths */ + register uint32_t b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + int retval = 0; /* error code returned: initialized to "no error" */ + + + /* make local bit buffer */ + Trace((stderr, "\ndynamic block")); + b = G.bb; + k = G.bk; + + + /* read in table lengths */ + NEEDBITS(5) + nl = 257 + ((unsigned)b & 0x1f); /* number of literal/length codes */ + DUMPBITS(5) + NEEDBITS(5) + nd = 1 + ((unsigned)b & 0x1f); /* number of distance codes */ + DUMPBITS(5) + NEEDBITS(4) + nb = 4 + ((unsigned)b & 0xf); /* number of bit length codes */ + DUMPBITS(4) + if (nl > MAXLITLENS || nd > MAXDISTS) + return 1; /* bad lengths */ + + + /* read in bit-length-code lengths */ + for (j = 0; j < nb; j++) + { + NEEDBITS(3) + ll[border[j]] = (unsigned)b & 7; + DUMPBITS(3) + } + for (; j < 19; j++) + ll[border[j]] = 0; + + + /* build decoding table for trees--single level, 7 bit lookup */ + bl = 7; + retval = huft_build(ll, 19, 19, NULL, NULL, &tl, &bl, + Bits, Nob, Eob); + if (bl == 0) /* no bit lengths */ + retval = 1; + if (retval) + { + if (retval == 1) + huft_free(tl); + return retval; /* incomplete code set */ + } + + + /* read in literal and distance code lengths */ + n = nl + nd; + m = mask_bits[bl]; + i = l = 0; + while ((unsigned)i < n) + { + NEEDBITS((unsigned)bl) + j = (td = tl + ((unsigned)b & m))->b; + DUMPBITS(j) + j = td->v.n; + if (j < 16) /* length of code in bits (0..15) */ + ll[i++] = l = j; /* save last length in l */ + else if (j == 16) /* repeat last length 3 to 6 times */ + { + NEEDBITS(2) + j = 3 + ((unsigned)b & 3); + DUMPBITS(2) + if ((unsigned)i + j > n) + return 1; + while (j--) + ll[i++] = l; + } + else if (j == 17) /* 3 to 10 zero length codes */ + { + NEEDBITS(3) + j = 3 + ((unsigned)b & 7); + DUMPBITS(3) + if ((unsigned)i + j > n) + return 1; + while (j--) + ll[i++] = 0; + l = 0; + } + else /* j == 18: 11 to 138 zero length codes */ + { + NEEDBITS(7) + j = 11 + ((unsigned)b & 0x7f); + DUMPBITS(7) + if ((unsigned)i + j > n) + return 1; + while (j--) + ll[i++] = 0; + l = 0; + } + } + + + /* free decoding table for trees */ + huft_free(tl); + + + /* restore the global bit buffer */ + G.bb = b; + G.bk = k; + + + /* build the decoding tables for literal/length and distance codes */ + bl = lbits; + retval = huft_build(ll, nl, 257, G.cplens, G.cplext, &tl, &bl, + Bits, Nob, Eob); + if (bl == 0) /* no literals or lengths */ + retval = 1; + if (retval) + { + if (retval == 1) { + /*if (!uO.qflag) + MESSAGE((uint8_t *)"(incomplete l-tree) ", 21L, 1);*/ + huft_free(tl); + } + return retval; /* incomplete code set */ + } + bd = dbits; + retval = huft_build(ll + nl, nd, 0, cpdist, G.cpdext, &td, &bd, + Bits, Nob, Eob); + if (retval == 1) + retval = 0; + if (bd == 0 && nl > 257) /* lengths but no distances */ + retval = 1; + if (retval) + { + if (retval == 1) { + /*if (!uO.qflag) + MESSAGE((uint8_t *)"(incomplete d-tree) ", 21L, 1);*/ + huft_free(td); + } + huft_free(tl); + return retval; + } + + /* decompress until an end-of-block code */ + retval = inflate_codes(&G, tl, td, bl, bd); + +cleanup_and_exit: + /* free the decoding tables, return */ + huft_free(tl); + huft_free(td); + return retval; +} + + + +static int inflate_block(struct globals *Gp, int *e) +/*int *e;*/ /* last block flag */ +/* decompress an inflated block */ +{ + unsigned t; /* block type */ + register uint32_t b; /* bit buffer */ + register unsigned k; /* number of bits in bit buffer */ + int retval = 0; /* error code returned: initialized to "no error" */ + + + /* make local bit buffer */ + b = G.bb; + k = G.bk; + + + /* read in last block bit */ + NEEDBITS(1) + *e = (int)b & 1; + DUMPBITS(1) + + + /* read in block type */ + NEEDBITS(2) + t = (unsigned)b & 3; + DUMPBITS(2) + + + /* restore the global bit buffer */ + G.bb = b; + G.bk = k; + + + /* inflate that block type */ + if (t == 2) + return inflate_dynamic(&G); + if (t == 0) + return inflate_stored(&G); + if (t == 1) + return inflate_fixed(&G); + + + /* bad block type */ + retval = 2; + +cleanup_and_exit: + return retval; +} + +#undef G + +int +zipinflate(struct file *f, const char *tgt, int tfd, int doswap, uint32_t *crc) +/* decompress an inflated entry */ +{ + struct globals G; + int e = 0; /* last block flag */ + int r; /* result code */ + int is_defl64; +#ifdef DEBUG + unsigned h = 0; /* maximum struct huft's malloc'ed */ +#endif + + is_defl64 = f->f_cmethod == C_ENHDEFLD; + memset(&G, 0, sizeof G); + G.tgt = tgt; + G.tfd = tfd; + G.doswap = doswap; + G.crc = crc; + G.zsize = G.uzsize = f->f_csize; + G.ucsize = f->f_st.st_size; + /* initialize window, bit buffer */ + G.wp = 0; + G.bk = 0; + G.bb = 0; + + if (is_defl64) { + G.cplens = cplens64; + G.cplext = cplext64; + G.cpdext = cpdext64; + G.fixed_tl = G.fixed_tl64; + G.fixed_bl = G.fixed_bl64; + G.fixed_td = G.fixed_td64; + G.fixed_bd = G.fixed_bd64; + } else { + G.cplens = cplens32; + G.cplext = cplext32; + G.cpdext = cpdext32; + G.fixed_tl = G.fixed_tl32; + G.fixed_bl = G.fixed_bl32; + G.fixed_td = G.fixed_td32; + G.fixed_bd = G.fixed_bd32; + } + + /* decompress until the last block */ + do { +#ifdef DEBUG + G.hufts = 0; +#endif + if ((r = inflate_block(&G, &e)) != 0) { + if ((f->f_gflag & FG_DESC) == 0) + while (G.uzsize > 0) + NEXTBYTE; + msg(3, 0, "compression error on \"%s\"\n", f->f_name); + return -1; + } +#ifdef DEBUG + if (G.hufts > h) + h = G.hufts; +#endif + } while (!e); + + Trace((stderr, "\n%u bytes in Huffman tables (%u/entry)\n", + h * (unsigned)sizeof(struct huft), (unsigned)sizeof(struct huft))); + + if (is_defl64) { + G.fixed_tl64 = G.fixed_tl; + G.fixed_bl64 = G.fixed_bl; + G.fixed_td64 = G.fixed_td; + G.fixed_bd64 = G.fixed_bd; + } else { + G.fixed_tl32 = G.fixed_tl; + G.fixed_bl32 = G.fixed_bl; + G.fixed_td32 = G.fixed_td; + G.fixed_bd32 = G.fixed_bd; + } + + /* flush out redirSlide and return (success, unless final FLUSH failed) */ + (FLUSH(G.wp)); + if (f->f_gflag & FG_DESC) + bunread((char *)G.inptr, G.incnt); + return G.status; +} diff --git a/package/heirloom-cpio/src/mbtowi.h b/package/heirloom-cpio/src/mbtowi.h new file mode 100644 index 000000000..525ad08d1 --- /dev/null +++ b/package/heirloom-cpio/src/mbtowi.h @@ -0,0 +1,22 @@ +/* Sccsid @(#)mbtowi.h 1.2 (gritter) 7/16/04 */ + +#ifndef LIBCOMMON_MBTOWI_H +#define LIBCOMMON_MBTOWI_H + +static +#if defined (__GNUC__) || defined (__USLC__) || defined (__INTEL_COMPILER) || \ + defined (__IBMC__) || defined (__SUNPRO_C) + inline +#endif + int +mbtowi(wint_t *pwi, const char *s, size_t n) +{ + wchar_t wc; + int i; + + i = mbtowc(&wc, s, n); + *pwi = wc; + return i; +} + +#endif /* !LIBCOMMON_MBTOWI_H */ diff --git a/package/heirloom-cpio/src/memalign.c b/package/heirloom-cpio/src/memalign.c new file mode 100644 index 000000000..268949b20 --- /dev/null +++ b/package/heirloom-cpio/src/memalign.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)memalign.c 1.7 (gritter) 1/22/06 */ + +#if defined (__FreeBSD__) || defined (__dietlibc__) || defined (_AIX) || \ + defined (__NetBSD__) || defined (__OpenBSD__) || \ + defined (__DragonFly__) || defined (__APPLE__) +/* + * FreeBSD malloc(3) promises to page-align the return of malloc() calls + * if size is at least a page. This serves for a poor man's memalign() + * implementation that matches our needs. + */ +#include <unistd.h> +#include <stdlib.h> + +#include "memalign.h" + +void * +memalign(size_t alignment, size_t size) +{ + static long pagesize; + + if (pagesize == 0) + pagesize = sysconf(_SC_PAGESIZE); + if (alignment != pagesize) + return NULL; + if (size < pagesize) + size = pagesize; + return malloc(size); +} +#endif /* __FreeBSD__ || __dietlibc__ || _AIX || __NetBSD__ || __OpenBSD__ || + __DragonFly__ || __APPLE__ */ diff --git a/package/heirloom-cpio/src/memalign.h b/package/heirloom-cpio/src/memalign.h new file mode 100644 index 000000000..edaef031b --- /dev/null +++ b/package/heirloom-cpio/src/memalign.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)memalign.h 1.7 (gritter) 1/22/06 */ + +#ifndef LIBCOMMON_MEMALIGN_H +#define LIBCOMMON_MEMALIGN_H + +#if defined (__FreeBSD__) || defined (__dietlibc__) || defined (_AIX) || \ + defined (__NetBSD__) || defined (__OpenBSD__) || \ + defined (__DragonFly__) || defined (__APPLE__) +#include <stdlib.h> + +extern void *memalign(size_t, size_t); +#endif /* __FreeBSD__ || __dietlibc__ || _AIX || __NetBSD__ || __OpenBSD__ || + __DragonFly__ || __APPLE__ */ +#endif /* !LIBCOMMON_MEMALIGN_H */ diff --git a/package/heirloom-cpio/src/msgselect.h b/package/heirloom-cpio/src/msgselect.h new file mode 100644 index 000000000..94a5daa9f --- /dev/null +++ b/package/heirloom-cpio/src/msgselect.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)msgselect.h 1.2 (gritter) 9/21/03 */ + +#define MSG_LEVEL 0 + +#if MSG_LEVEL == 1 +#define msgselect(a, b) a +#else +#define msgselect(a, b) b +#endif diff --git a/package/heirloom-cpio/src/nonpax.c b/package/heirloom-cpio/src/nonpax.c new file mode 100644 index 000000000..d0eb585b7 --- /dev/null +++ b/package/heirloom-cpio/src/nonpax.c @@ -0,0 +1,55 @@ +/* + * cpio - copy file archives in and out + * + * Gunnar Ritter, Freiburg i. Br., Germany, April 2003. + */ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +/* Sccsid @(#)nonpax.c 1.1 (gritter) 2/24/04 */ + +#include "cpio.h" + +/*ARGSUSED*/ +int +pax_track(const char *name, time_t mtime) +{ + return 1; +} + +/*ARGSUSED*/ +void +pax_prlink(struct file *f) +{ +} + +/*ARGSUSED*/ +int +pax_sname(char **oldp, size_t *olds) +{ + return 1; +} + +void +pax_onexit(void) +{ +} diff --git a/package/heirloom-cpio/src/oblok.c b/package/heirloom-cpio/src/oblok.c new file mode 100644 index 000000000..38859ba6d --- /dev/null +++ b/package/heirloom-cpio/src/oblok.c @@ -0,0 +1,260 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)oblok.c 1.7 (gritter) 7/16/04 */ + +#include <sys/types.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <malloc.h> + +#include "memalign.h" +#include "oblok.h" + +struct list { + struct list *l_nxt; + struct oblok *l_op; +}; + +static struct list *bloks; +static int exitset; + +int +ob_clear(void) +{ + struct list *lp; + int val = 0; + + for (lp = bloks; lp; lp = lp->l_nxt) { + if (ob_flush(lp->l_op) < 0) + val = -1; + else if (val >= 0) + val++; + } + return val; +} + +static void +add(struct oblok *op) +{ + struct list *lp, *lq; + + if ((lp = calloc(1, sizeof *lp)) != NULL) { + lp->l_nxt = NULL; + lp->l_op = op; + if (bloks) { + for (lq = bloks; lq->l_nxt; lq = lq->l_nxt); + lq->l_nxt = lp; + } else + bloks = lp; + if (exitset == 0) { + exitset = 1; + atexit((void (*)(void))ob_clear); + } + } +} + +static void +del(struct oblok *op) +{ + struct list *lp, *lq = NULL; + + if (bloks) { + for (lp = bloks; lp && lp->l_op != op; lp = lp->l_nxt) + lq = lp; + if (lp) { + if (lq) + lq->l_nxt = lp->l_nxt; + if (lp == bloks) + bloks = bloks->l_nxt; + free(lp); + } + } +} + +struct oblok * +ob_alloc(int fd, enum ob_mode bf) +{ + static long pagesize; + struct oblok *op; + + if (pagesize == 0) + if ((pagesize = sysconf(_SC_PAGESIZE)) < 0) + pagesize = 4096; + if ((op = memalign(pagesize, sizeof *op)) == NULL) + return NULL; + memset(op, 0, sizeof *op); + op->ob_fd = fd; + switch (bf) { + case OB_EBF: + op->ob_bf = isatty(fd) ? OB_LBF : OB_FBF; + break; + default: + op->ob_bf = bf; + } + add(op); + return op; +} + +ssize_t +ob_free(struct oblok *op) +{ + ssize_t wrt; + + wrt = ob_flush(op); + del(op); + free(op); + return wrt; +} + +static ssize_t +swrite(int fd, const char *data, size_t sz) +{ + ssize_t wo, wt = 0; + + do { + if ((wo = write(fd, data + wt, sz - wt)) < 0) { + if (errno == EINTR) + continue; + else + return wt; + } + wt += wo; + } while (wt < sz); + return sz; +} + +ssize_t +ob_write(struct oblok *op, const char *data, size_t sz) +{ + ssize_t wrt; + size_t di, isz; + + switch (op->ob_bf) { + case OB_NBF: + wrt = swrite(op->ob_fd, data, sz); + op->ob_wrt += wrt; + if (wrt != sz) { + op->ob_bf = OB_EBF; + writerr(op, sz, wrt>0?wrt:0); + return -1; + } + return wrt; + case OB_LBF: + case OB_FBF: + isz = sz; + while (op->ob_pos + sz > (OBLOK)) { + di = (OBLOK) - op->ob_pos; + sz -= di; + if (op->ob_pos > 0) { + memcpy(&op->ob_blk[op->ob_pos], data, di); + wrt = swrite(op->ob_fd, op->ob_blk, (OBLOK)); + } else + wrt = swrite(op->ob_fd, data, (OBLOK)); + op->ob_wrt += wrt; + if (wrt != (OBLOK)) { + op->ob_bf = OB_EBF; + writerr(op, (OBLOK), wrt>0?wrt:0); + return -1; + } + data += di; + op->ob_pos = 0; + } + if (op->ob_bf == OB_LBF) { + const char *cp; + + cp = data; + while (cp < &data[sz]) { + if (*cp == '\n') { + di = cp - data + 1; + sz -= di; + if (op->ob_pos > 0) { + memcpy(&op->ob_blk[op->ob_pos], + data, di); + wrt = swrite(op->ob_fd, + op->ob_blk, + op->ob_pos + di); + } else + wrt = swrite(op->ob_fd, + data, di); + op->ob_wrt += wrt; + if (wrt != op->ob_pos + di) { + op->ob_bf = OB_EBF; + writerr(op, di, wrt>0?wrt:0); + return -1; + } + op->ob_pos = 0; + data += di; + cp = data; + } + cp++; + } + } + if (sz == (OBLOK)) { + wrt = swrite(op->ob_fd, data, sz); + op->ob_wrt += wrt; + if (wrt != sz) { + op->ob_bf = OB_EBF; + writerr(op, sz, wrt>0?wrt:0); + return -1; + } + } else if (sz) { + memcpy(&op->ob_blk[op->ob_pos], data, sz); + op->ob_pos += sz; + } + return isz; + case OB_EBF: + ; + } + return -1; +} + +ssize_t +ob_flush(struct oblok *op) +{ + ssize_t wrt = 0; + + if (op->ob_pos) { + wrt = swrite(op->ob_fd, op->ob_blk, op->ob_pos); + op->ob_wrt += wrt; + if (wrt != op->ob_pos) { + op->ob_bf = OB_EBF; + writerr(op, op->ob_pos, wrt>0?wrt:0); + wrt = -1; + } + op->ob_pos = 0; + } + return wrt; +} + +int +ob_chr(int c, struct oblok *op) +{ + char b; + ssize_t wrt; + + b = (char)c; + wrt = ob_write(op, &b, 1); + return wrt < 0 ? EOF : c; +} diff --git a/package/heirloom-cpio/src/oblok.h b/package/heirloom-cpio/src/oblok.h new file mode 100644 index 000000000..1ee91b1c5 --- /dev/null +++ b/package/heirloom-cpio/src/oblok.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)oblok.h 1.3 (gritter) 4/17/03 */ + +#include <sys/types.h> + +#ifndef OBLOK +enum { + OBLOK = 4096 +}; +#endif /* !OBLOK */ + +enum ob_mode { + OB_EBF = 0, /* error or mode unset */ + OB_NBF = 1, /* not buffered */ + OB_LBF = 2, /* line buffered */ + OB_FBF = 3 /* fully buffered */ +}; + +struct oblok { + char ob_blk[OBLOK]; /* buffered data */ + long long ob_wrt; /* amount of data written */ + int ob_pos; /* position of first empty date byte */ + int ob_fd; /* file descriptor to write to */ + enum ob_mode ob_bf; /* buffering mode */ +}; + +/* + * Allocate an output buffer with file descriptor fd and buffer mode bf. + * If bf is OB_EBF, the choice is made dependant upon the file type. + * NULL is returned if no memory is available. + */ +extern struct oblok *ob_alloc(int fd, enum ob_mode bf); + +/* + * Deallocate the passed output buffer, flushing all data. The file + * descriptor is not closed. Returns -1 if flushing fails. + */ +extern ssize_t ob_free(struct oblok *op); + +/* + * Write data of length sz to the passed output buffer. Returns -1 on + * error or the amount of data written. + */ +extern ssize_t ob_write(struct oblok *op, const char *data, size_t sz); + +/* + * Flush all data in the passed output buffer. Returns -1 on error or + * the amount of data written; 0 is success and means 'nothing to flush'. + * The underlying device is not flushed (i. e. no fsync() is performed). + */ +extern ssize_t ob_flush(struct oblok *op); + +/* + * Flush all output buffers. Called automatically using atexit(). Returns + * -1 on error or the number of buffers flushed; 0 is success. + */ +extern int ob_clear(void); + +/* + * putc() workalike. + */ +#define ob_put(c, op) ((op)->ob_bf != OB_FBF || (op)->ob_pos >= (OBLOK) - 1 ?\ + ob_chr((c), (op)) : \ + (int)((op)->ob_blk[(op)->ob_pos++] = (char)(c))) + + +/* + * fputc() workalike. + */ +extern int ob_chr(int c, struct oblok *op); + +/* + * This function must be supplied by the calling code; it is called on + * write error. + */ +extern void writerr(struct oblok *op, int count, int written); diff --git a/package/heirloom-cpio/src/pathconf.c b/package/heirloom-cpio/src/pathconf.c new file mode 100644 index 000000000..a6b91ef86 --- /dev/null +++ b/package/heirloom-cpio/src/pathconf.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2004 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)pathconf.c 1.2 (gritter) 5/1/04 */ + +#ifdef __dietlibc__ +#include <unistd.h> +#include "pathconf.h" + +static long +pc(int name) +{ + switch (name) { + case _PC_PATH_MAX: + return 1024; + case _PC_VDISABLE: + return 0; + default: + return -1; + } +} + +long +fpathconf(int fildes, int name) +{ + return pc(name); +} + +long +pathconf(const char *path, int name) { + return pc(name); +} +#endif /* __dietlibc__ */ diff --git a/package/heirloom-cpio/src/pathconf.h b/package/heirloom-cpio/src/pathconf.h new file mode 100644 index 000000000..79696b6da --- /dev/null +++ b/package/heirloom-cpio/src/pathconf.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2004 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)pathconf.h 1.2 (gritter) 5/1/04 */ + +#ifdef __dietlibc__ +#include <unistd.h> + +extern long fpathconf(int, int); +extern long pathconf(const char *, int); +#endif /* __dietlibc__ */ diff --git a/package/heirloom-cpio/src/pax.1 b/package/heirloom-cpio/src/pax.1 new file mode 100644 index 000000000..4fb9206f9 --- /dev/null +++ b/package/heirloom-cpio/src/pax.1 @@ -0,0 +1,919 @@ +'\" t +.\" Copyright (c) 2004 Gunnar Ritter +.\" +.\" This software is provided 'as-is', without any express or implied +.\" warranty. In no event will the authors be held liable for any damages +.\" arising from the use of this software. +.\" +.\" Permission is granted to anyone to use this software for any purpose, +.\" including commercial applications, and to alter it and redistribute +.\" it freely, subject to the following restrictions: +.\" +.\" 1. The origin of this software must not be misrepresented; you must not +.\" claim that you wrote the original software. If you use this software +.\" in a product, an acknowledgment in the product documentation would be +.\" appreciated but is not required. +.\" +.\" 2. Altered source versions must be plainly marked as such, and must not be +.\" misrepresented as being the original software. +.\" +.\" 3. This notice may not be removed or altered from any source distribution. +.\" Sccsid @(#)pax.1 1.38 (gritter) 8/13/09 +.TH PAX 1 "8/13/09" "Heirloom Toolchest" "User Commands" +.SH NAME +pax \- portable archive interchange +.SH SYNOPSIS +.PD 0 +.HP +.nh +.ad l +\fBpax\fR [\fB\-cdnvK\fR] [\fB\-b\ \fIsize\fR] +[\fB\-f\ \fIfile\fR] [\fB\-s\ \fIreplstr\fR] +[\fB\-x\ \fIhdr\fR] [\fIpatterns\fR] +.HP +.ad l +\fBpax\fR \fB\-r\fR[\fBcdiknuvK\fR] [\fB\-b\ \fIsize\fR] +[\fB\-f\ \fIfile\fR] +[\fB\-o\ \fIoptions\fR] +[\fB\-p\ \fIpriv\fR] [\fB\-s\ \fIreplstr\fR] +[\fB\-x\ \fIhdr\fR] [\fIpatterns\fR] +.HP +.ad l +\fBpax\fR \fB\-w\fR[\fBadiHtuvLX\fR] [\fB\-b\ \fIsize\fR] +[\fB\-f\ \fIfile\fR] +[\fB\-o\ \fIoptions\fR] +[\fB\-s\ \fIreplstr\fR] +[\fB\-x\ \fIhdr\fR] [\fIfiles\fR] +.HP +.ad l +\fBpax\fR \fB\-rw\fR[\fBdiHklntuvLX\fR] +[\fB\-p\ \fIpriv\fR] [\fB\-s\ \fIreplstr\fR] +[\fIfiles\fR] \fIdirectory\fR +.br +.ad b +.hy 1 +.PD +.SH DESCRIPTION +.I Pax +creates and extracts file archives and copies files. +.PP +If neither the +.I \-r +or +.I \-w +options are given, +.I pax +works in +.I list +mode +and prints the contents of the archive. +.PP +With the +.B \-r +option, +.I pax +works in +.RI ` read ' +mode and extracts files from a file archive. +By default, +the archive is read from standard input. +Optional arguments are interpreted as +.I patterns +and restrict the set of extracted files +to those matching any of the +.IR patterns . +The syntax is identical to that described in +.IR glob (7), +except that the slash character +.RB ` / ' +is matched by +meta-character constructs with +.RB ` * ', +.RB ` ? ' +and +.RB ` [ '. +Care must be taken to quote meta-characters appropriately from the shell. +If a pattern matches the prefix name of a directory in the archive, +all files below that directory are also extracted. +File permissions are set to those in the archive; +if the caller is the super-user, +ownerships are restored as well. +options are specified. +Archives compressed with +.IR bzip2 (1), +.IR compress (1), +.IR gzip (1), +or +.IR rpm (1) +are transparently de\%compressed on input. +.PP +With +.BR \-w , +.I pax +works in +.RI ` write ' +mode, +creates archives +and writes them to standard output per default. +A list of filenames to be included in the archive is +read from standard input; +if the name of a directory appears, +all its members and the directory itself are recursively +included in the archive. +The +.IR find (1) +utility is useful to generate a list of files +(see also its +.I \-cpio +and +.I \-ncpio +operators). +When producing a filename list for +.IR pax , +find should always be invoked with +.I \-depth +since this makes it possible to extract write-protected directories +for users other than the super-user. +If +.I files +are given on the command line, +they are included in the archive +in the same manner as described above +and standard input is not read. +.PP +The +.B \-rw +options selects +.RI ` copy ' +mode; +a list of +.I files +is read from standard input +or taken from the command line +as described for +.IR \-w ; +files are copied to the specified +.IR directory , +preserving attributes as described for +.IR \-r . +Special files are re-created in the target hierarchy, +and hard links between copied files are preserved. +.PP +When a premature end-of-file is detected with +.I \-r +and +.I \-w +and the archive is a block or character special file, +the user is prompted for new media. +.PP +The following options alter the behavior of +.IR pax : +.TP +.B \-a +Append files to the archive. +The archive must be seekable, +such as a regular file or a block device, +or a tape device capable of writing between filemarks. +.TP +\fB\-b\fI size\fR[\fBw\fR|\fBb\fR|\fBk\fR|\fBm\fR] +Blocks input and output archives at +.I size +byte records. +The optional suffix multiplies +.I size +by 2 for +.BR w , +512 for +.BR b , +1024 for +.BR k , +and 1048576 for +.BR m . +.TP +.B \-c +Reverses the sense of patterns +such that a file that does not match any of the patterns +is selected. +.TP +.B \-d +Causes +.I pax +to ignore files below directories. +In read mode, +patterns matching directories +cause only the directory itself to extracted, +files below will be ignored +unless another pattern applies to them. +In write mode, +arguments or standard input lines referring to directories +do not cause files below the respective directory +to be archived. +.TP +\fB\-f\fI\ file\fR +Selects a +.I file +that is read with the +.I \-r +option instead of standard input +or written with the +.I \-w +option instead of standard output. +.TP +.B \-H +Follow symbolic links given on the command line when reading files with +.I \-w +or +.IR \-rw , +but do not follow symbolic links encountered during directory traversal. +.TP +.B \-i +Rename files interactively. +Before a file is extracted from the archive, +its file name is printed on standard error +and the user is prompted to specify a substitute file name. +If the line read from the terminal is empty, +the file is skipped; +if the line consists of a single dot, +the name is retained; +otherwise, +the line forms the new file name. +.TP +.B \-k +Causes existing files not to be overwritten. +.TP +.B \-K +Try to continue operation on read errors and invalid headers. +If an archive contains another archive, +files from either archive may be chosen. +.TP +.B \-l +Link files instead of copying them with +.I \-rw +if possible. +.TP +.B \-L +Follow symbolic links when reading files with +.I \-w +or +.IR \-rw . +.B /usr/posix2001/bin/pax +terminates immediately when it +detects a symbolic link loop with this option. +.TP +.B \-n +If any +.I pattern +arguments are present, +each pattern can match exactly one archive member; +further members that could match the particular pattern are ignored. +Without +.I pattern +arguments, +only the first occurence of +a file that occurs more than once in the archive +is selected, the following are ignored. +.TP +\fB\-o\ \fIoption\fB,\fR[\fIoption\fB,\fR\|...] +Specifies options as described for \fI\-x pax\fR. +.TP +\fB\-p\ \fIstring\fR +Specifies which file modes are to be preserved or ignored. +.I string +may contain one or more of +.RS +.TP +.B a +Inhibits preservation of file access times. +.TP +.B e +Causes preservation of every possible mode, ownership and time. +.TP +.B m +Inhibits preservation of file modification times. +.TP +.B o +Causes preservation of owner and group IDs. +.TP +.B p +Causes preservation of file mode bits +regardless of the umask +(see +.IR umask (2)). +.RE +.IP +If file ownership is preserved, +.I pax +tries to set the group ownerships to those specified in the archive +or the original hierarchy, respectively, +regardless of the privilegues of the invoking user. +.BR /usr/5bin/pax , +.BR /usr/5bin/s42/pax , +and +.B /usr/5bin/posix/pax +try to set the user ownerships only if invoked by the super-user; +if invoked by regular users, +.B /usr/5bin/posix2001/pax +will produce an error for any file that is not owned by the invoking user. +.TP +\fB\-s\ /\fIregular expression\fB/\fIreplacement\fB/\fR[\fBgp\fR] +Modifies file names in a manner similar to that described in +.IR ed (1). +The +.I p +flag causes each modified file name to printed. +Any character can be used as delimiter instead of +.RI ` / '. +If a file name is empty after the replacement is done, +the file is ignored. +This option can be specified multiple times +to execute multiple substitutions in the order specified. +.TP +.B \-t +Resets the access times of files +that were included in the archive with +.IR \-r . +.TP +.B \-u +In read mode, +.I pax +will not overwrite existing target files +that were modified more recently than the file in the archive +when this option is given. +In write mode, +.I pax +will read the archive first. +It will then only append those files to the archive +that are not already included +or were more recently modified. +.TP +.B \-v +Prints the file names of archived or extracted files with +.I \-r +and +.I \-w +and a verbose output format +if neither of them is given. +.TP +\fB\-x\fI header\fR +Specifies the archive header format to be one of: +.sp +.in +6 +.TS +lfB l. +\fBnewc\fR SVR4 ASCII cpio format;\ +\fBcrc\fR SVR4 ASCII cpio format with checksum;\ +\fBsco\fR T{ +SCO UnixWare 7.1 ASCII cpio format; +T} +\fBscocrc\fR T{ +SCO UnixWare 7.1 ASCII cpio format with checksum; +T} +\fBodc\fR T{ +traditional ASCII cpio format, as standardized in IEEE Std. 1003.1, 1996; +T} +\fBcpio\fR T{ +same as \fIodc\fR; +T} +\fBbin\fR binary cpio format; +\fBbbs\fR byte-swapped binary cpio format; +\fBsgi\fR T{ +SGI IRIX extended binary cpio format; +T} +\fBcray\fR T{ +Cray UNICOS 9 cpio format; +T} +\fBcray5\fR T{ +Cray UNICOS 5 cpio format; +T} +\fBdec\fR T{ +Digital UNIX extended cpio format; +T} +\fBtar\fR tar format; +\fBotar\fR old tar format; +\fBustar\fR T{ +IEEE Std. 1003.1, 1996 tar format; +T} +.T& +l s. +\fBpax\fR[\fB:\fIoption\fB,\fR[\fIoption\fB,\fR\|...]] +.T& +l l. +\& T{ +IEEE Std. 1003.1, 2001 pax format. +Format-specific \fIoptions\fR are: +.in +2n +.ti 0 +.br +\fBlinkdata\fR +.br +For a regular file which has multiple hard links, +the file data is stored once for each link in the archive, +instead of being stored for the first entry only. +This option must be used with care +since many implementations are unable +to read the resulting archive. +.ti 0 +.br +\fBtimes\fR +.br +Causes the times of last access and last modification +of each archived file +to be stored in an extended \fIpax\fR header. +This in particular allows the time of last access +to be restored when the archive is read. +.br +.in -2n +T} +\fBsun\fR T{ +Sun Solaris 7 extended tar format; +T} +\fBbar\fR T{ +SunOS 4 bar format; +T} +\fBgnu\fR T{ +GNU tar format; +T} +\fBzip\fR[\fB:\fIcc\fR] T{ +zip format with optional compression method. +If \fIcc\fR is one of +\fBen\fR (normal, default), +\fBex\fR (extra), +\fBef\fR (fast), +or +\fBes\fR (super fast), +the standard \fIdeflate\fR compression is used. +\fBe0\fR selects no compression, +and +\fBbz2\fR selects \fIbzip2\fR compression. +T} +.TE +.in -6 +.sp +This option is ignored with +.I \-r +unless the +.I \-K +option is also present. +The default for +.I \-w +is traditional ASCII cpio +.I (odc) +format. +.PP +.ne 38 +Characteristics of archive formats are as follows: +.sp +.TS +allbox; +l r r r l +l1fB r2 n2 r2 c. + T{ +.ad l +maximum user/\%group id +T} T{ +.ad l +maximum file size +T} T{ +.ad l +maximum pathname length +T} T{ +.ad l +bits in dev_t (major/minor) +T} +\-x\ bin 65535 2 GB\ 256 \ 16 +\-x\ sgi 65535 9 EB\ 256 \ 14/18 +T{ +\-x\ odc +T} 262143 8 GB\ 256 \ 18 +\-x\ dec 262143 8 GB\ 256 \ 24/24 +T{ +\-x\ newc, +\-x\ crc +T} 4.3e9 4 GB\ 1024 \ 32/32 +T{ +\-x\ sco, \-x\ scocrc +T} 4.3e9 9 EB\ 1024 \ 32/32 +T{ +\-x\ cray, \-x\ cray5 +T} 1.8e19 9 EB\ 65535 \ 64 +\-x\ otar 2097151 8 GB\ 99 \ n/a +T{ +\-x\ tar, +\-x\ ustar +T} 2097151 8 GB\ 256 (99) \ 21/21 +\-x\ pax 1.8e19 9 EB\ 65535 \ 21/21 +\-x\ sun 1.8e19 9 EB\ 65535 \ 63/63 +\-x\ gnu 1.8e19 9 EB\ 65535 \ 63/63 +\-x\ bar 2097151 8 GB\ 427 \ 21 +\-x\ zip 4.3e9 9 EB\ 60000 \ 32 +.TE +.sp +.PP +The byte order of +.B binary +cpio archives +depends on the machine +on which the archive is created. +Unlike some other implementations, +.I pax +fully supports +archives of either byte order. +.I \-x\ bbs +can be used to create an archive +with the byte order opposed to that of the current machine. +.PP +The +.B sgi +format extends the binary format +to handle larger files and more device bits. +If an archive does not contain any entries +that actually need the extensions, +it is identical to a binary archive. +.I \-x\ sgi +archives are always created in MSB order. +.PP +The +.B odc +format was introduced with System\ III +and standardized with IEEE Std. 1003.1. +All known +.I cpio +and +.I pax +implementations since around 1980 can read this format. +.PP +The +.B dec +format extends the +.I odc +format +to support more device bits. +Archives in this format are generally incompatible with +.I odc +archives +and need special implementation support to be read. +.PP +The +.B \-x\ newc +format was introduced with System\ V Release\ 4. +Except for the file size, +it imposes no practical limitations +on files archived. +The original SVR4 implementation +stores the contents of hard linked files +only once and with the last archived link. +This +.I pax +ensures compatibility with SVR4. +With archives created by implementations that employ other methods +for storing hard linked files, +each file is extracted as a single link, +and some of these files may be empty. +Implementations that expect methods other than the original SVR4 one +may extract no data for hard linked files at all. +.PP +The +.B crc +format is essentially the same as the +.I \-x\ newc +format +but adds a simple checksum (not a CRC, despite its name) +for the data of regular files. +The checksum requires the implementation to read each file twice, +which can considerably increase running time and system overhead. +As not all implementations claiming to support this format +handle the checksum correctly, +it is of limited use. +.PP +The +.B sco +and +.B scocrc +formats are variants of the +.I \-x\ newc +and +.I \-x\ crc +formats, respectively, +with extensions to support larger files. +The extensions result in a different archive format +only if files larger than slightly below 2\ GB occur. +.PP +The +.B cray +format extends all header fields to 64 bits. +It thus imposes no practical limitations of any kind +on archived files, +but requires special implementation support +to be read. +Although it is originally a binary format, +the byte order is always MSB as on Cray machines. +The +.B cray5 +format is an older variant +that was used with UNICOS 5 and earlier. +.PP +The +.B otar +format was introduced with the Unix 7th Edition +.I tar +utility. +Archives in this format +can be read on all Unix systems since about 1980. +It can only hold regular files +(and, on more recent systems, symbolic links). +For file names that contain characters with the most significant bit set +(non-ASCII characters), +implementations differ in the interpretation of the header checksum. +.PP +The +.B ustar +format was introduced with IEEE Std. 1003.1. +It extends the old +.I tar +format +with support for directories, device files, +and longer file names. +Pathnames of single-linked files can consist of up to 256 characters, +dependent on the position of slashes. +Files with multiple links can only be archived +if the first link encountered is no longer than 100 characters. +Due to implementation errors, +file names longer than 99 characters +can not considered to be generally portable. +Another addition of the +.I ustar +format +are fields for the symbolic user and group IDs. +These fields are created by +.IR pax , +but ignored when reading such archives. +.PP +With +.BR "\-x tar" , +a variant of the +.I ustar +format is selected +which stores file type bits in the mode field +to work around common implementation problems. +These bits are ignored by +.I pax +when reading archives. +.PP +The +.B pax +format is an extension to the +.I ustar +format. +If attributes cannot be archived with +.IR ustar , +an extended header is written. +Unless the size of an entry is greater than 8\ GB, +a +.I pax +archive should be readable by any implementation +capable of reading +.I ustar +archives, +although files may be extracted under wrong names +and extended headers may be extracted as separate files. +If a file name contains non-UTF-8 characters, +it may not be archived or extracted correctly +because of a problem of the +.I pax +format specification. +.PP +The +.B sun +format extends the +.I ustar +format similar as the +.I pax +format does. +The extended headers in +.I sun +format archives are not understood +by implementations that support only the +.I pax +format and vice-versa. +The +.I sun +format has also problems with non-UTF-8 characters in file names. +.PP +The +.B GNU +.I tar +format is mostly compatible with the other +.I tar +formats, +unless an archive entry actually uses its extended features. +There are no practical limitations on files archived with this format. +The implementation of +.I pax +is limited to expanded numerical fields +and long file names; +in particular, +there is no support for sparse files or incremental backups. +If +.I pax +creates a multi-volume +.I GNU +archive, +it just splits a single-volume archive in multiple parts, +as with the other formats; +.I GNU +multi-volume archives are not supported. +.PP +The +.B bar +format is similar to the +.I tar +format, but can store longer file names. +It requires special implementation support to be read. +.PP +The +.B zip +format can be read in many non-Unix environments. +There are several restrictions on archives +intended for data exchange: +only regular files should be stored; +file times, permissions and ownerships +might be ignored by other implementations; +there should be no more than 65536 files in the archive; +the total archive size should not exceed 2 GB; +only +.I deflate +compression should be used. +Otherwise, +.I pax +stores all information available with other archive formats +in extended +.I zip +file headers, +so if archive portability is of no concern, +the +.I zip +implementation in +.I pax +can archive complete Unix file hierarchies. +.I Pax +supports the +.I zip64 +format extension for large files; +it automatically writes +.I zip64 +entries if necessary. +.I Pax +can extract all known +.I zip +format compression codes. +It does not support +.I zip +encryption. +Multi-volume +.I zip +archives are created as splitted single-volume archives, +as with the other formats written by +.IR pax ; +generic multi-volume +.I zip +archives are not supported. +.SH EXAMPLES +Extract all files named +.I Makefile +or +.I makefile +from the archive stored on +.IR /dev/rmt/c0s0 , +overwriting recent files: +.RS 2 +.sp +pax \-r \-f /dev/rmt/c0s0 \'[Mm]akefile\' \'*/[Mm]akefile\' +.RE +.PP +List the files contained in a software distribution archive: +.RS 2 +.sp +pax \-v \-f distribution.tar.gz +.RE +.PP +Write a +.IR gzip (1) +compressed +.I ustar +archive containing all files below the directory +.I \%project +to the file +.IR \%project.tar.gz , +excluding all directories named +.I CVS +or +.I SCCS +and their contents: +.RS 2 +.sp +find project \-depth \-print | egrep \-v \'/(CVS|SCCS)(/|$)\' | +.br + pax \-wd \-x ustar | gzip \-c > project.tar.gz +.RE +.PP +Copy the directory +.I work +and its contents +to the directory +.IR \%savedfiles , +preserving all file attributes: +.RS 2 +.sp +pax \-rw \-pe work savedfiles +.RE +.PP +Self-extracting zip archives are not automatically recognized, +but can normally be read using the +.I \-K +option, as with +.RS 2 +.sp +pax \-rK \-x zip \-f archive.exe +.sp +.RE +.SH "ENVIRONMENT VARIABLES" +.TP +.BR LANG ", " LC_ALL +See +.IR locale (7). +.TP +.B LC_CTYPE +Selects the mapping of bytes to characters +used for matching patterns +and regular expressions. +.TP +.B LC_TIME +Sets the month names printed in list mode. +.SH "SEE ALSO" +cpio(1), +find(1), +tar(1) +.SH DIAGNOSTICS +.I Pax +exits with +.sp +.TS +l8fB l. +0 after successful operation; +1 on usage errors; +2 when operation was continued after minor errors; +3 on fatal error conditions. +.TE +.SH NOTES +Device and inode numbers +are used for hard link recognition +with the various cpio formats. +Since the header space cannot hold +large numbers present in current file systems, +devices and inode numbers are set on a per-archive basis. +This enables hard link recognition with all cpio formats, +but the link connection to files appended with +.I \-a +is not preserved. +.PP +If a numeric user or group id does not fit +within the size of the header field in the selected format, +files are stored with the user id (or group id, respectively) +set to 60001. +.PP +Use of the +.I \-a +option with a +.I zip +format archive may cause data loss +if the archive was not previously created by +.I cpio +or +.I pax +itself. +.PP +If the file names passed to +.I "pax -w" +begin with a slash character, +absolute path names are stored in the archive +and will be extracted to these path names later +regardless of the current working directory. +This is normally not advisable, +and relative path names should be passed to +.I pax +only. +The +.I \-s +option can be used to substitute relative for absolute path names +and vice-versa. +.PP +.I Pax +does not currently accept the +\fB\-o delete\fR, +\fB\-o exthdr.name\fR, +\fB\-o globexthdr.name\fR, +\fB\-o invalid\fR, +\fB\-o listopt\fR, +and +\fB\-o keyword\fR +options from POSIX.1-2001. diff --git a/package/heirloom-cpio/src/pax.c b/package/heirloom-cpio/src/pax.c new file mode 100644 index 000000000..50632b6b1 --- /dev/null +++ b/package/heirloom-cpio/src/pax.c @@ -0,0 +1,757 @@ +/* + * cpio - copy file archives in and out + * + * Gunnar Ritter, Freiburg i. Br., Germany, April 2003. + */ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ + +#if __GNUC__ >= 3 && __GNUC_MINOR__ >= 4 || __GNUC__ >= 4 +#define USED __attribute__ ((used)) +#elif defined __GNUC__ +#define USED __attribute__ ((unused)) +#else +#define USED +#endif +#if defined (SU3) +static const char sccsid[] USED = "@(#)pax_su3.sl 1.26 (gritter) 6/26/05"; +#else +static const char sccsid[] USED = "@(#)pax.sl 1.26 (gritter) 6/26/05"; +#endif +/* Sccsid @(#)pax.c 1.26 (gritter) 6/26/05 */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <stdio.h> +#include <stdarg.h> +#include <stdlib.h> +#include <string.h> +#include <fnmatch.h> +#include <dirent.h> +#include <regex.h> +#include <wchar.h> +#include <time.h> +#include <inttypes.h> + +#include "iblok.h" +#include "cpio.h" + +static char **files; +static int filec; +static struct iblok *filinp; +static char *path; +static size_t pathsz; +static int pax_Hflag; + +static void setpres(const char *); +static size_t ofiles_pax(char **, size_t *); +static void prtime_pax(time_t); +static void parsesub(char *); + +void +flags(int ac, char **av) +{ + const char optstring[] = "rwab:cdf:HikKlLno:p:s:tuvx:X"; + int i; + int illegal = 0; + char *x; + +#if defined (SU3) + pax = PAX_TYPE_PAX2001; +#else + pax = PAX_TYPE_PAX1992; +#endif + dflag = 1; + uflag = 1; + ofiles = ofiles_pax; + prtime = prtime_pax; + while ((i = getopt(ac, av, optstring)) != EOF) { + switch (i) { + case 'r': + if (action && action != 'i') + action = 'p'; + else + action = 'i'; + break; + case 'w': + if (action && action != 'o') + action = 'p'; + else + action = 'o'; + break; + case 'a': + Aflag = 1; + break; + case 'b': + blksiz = strtol(optarg, &x, 10); + switch (*x) { + case 'b': + blksiz *= 512; + break; + case 'k': + blksiz *= 1024; + break; + case 'm': + blksiz *= 1048576; + break; + case 'w': + blksiz *= 2; + break; + } + if (blksiz <= 0) + msg(4, -2, + "Illegal size given for -b option.\n"); + Cflag = 1; + break; + case 'c': + fflag = 1; + break; + case 'd': + pax_dflag = 1; + break; + case 'f': + Oflag = Iflag = optarg; + break; + case 'H': + pax_Hflag = 1; + break; + case 'i': + rflag = 1; + break; + case 'k': + pax_kflag = 1; + break; + case 'K': + kflag = 1; + break; + case 'l': + lflag = 1; + break; + case 'L': + Lflag = 1; + break; + case 'n': + pax_nflag = 1; + break; + case 'o': + pax_options(optarg, 1); + break; + case 'p': + setpres(optarg); + break; + case 's': + pax_sflag = 1; + parsesub(optarg); + break; + case 't': + aflag = 1; + break; + case 'u': + uflag = 0; + pax_uflag = 1; + break; + case 'v': + vflag = 1; + break; + case 'x': + if (strcmp(optarg, "cpio") == 0) + fmttype = FMT_ODC; + else { + if (setfmt(optarg) < 0) + illegal = 1; + } + break; + case 'X': + pax_Xflag = 1; + break; + default: + illegal = 1; + } + } + switch (action) { + case 0: + if (rflag || pax_kflag || pax_uflag || pax_preserve) + illegal = 1; + action = 'i'; + tflag = 1; + setvbuf(stdout, NULL, _IOLBF, 0); + /*FALLTHRU*/ + case 'i': + if (aflag || pax_Xflag || lflag) + illegal = 1; + for (i = optind; i < ac; i++) { + addg(av[i], 0); + if (pax_dflag == 0) { + char *da; + int j; + + da = smalloc(strlen(av[i]) + 2); + for (j = 0; av[i][j]; j++) + da[j] = av[i][j]; + da[j++] = '/'; + da[j++] = '*'; + da[j] = 0; + addg(da, 1); + free(da); + } + } + break; + case 'o': + if (fflag || pax_kflag || pax_nflag || kflag) + illegal = 1; + if (Aflag && Oflag == NULL) { + msg(3, 0, "-a requires the -f option\n"); + illegal = 1; + } + if (optind != ac) { + files = &av[optind]; + filec = ac - optind; + } else + filinp = ib_alloc(0, 0); + if (pax_uflag) + Aflag = 1; + if (Aflag == 0 && fmttype == FMT_NONE) + fmttype = FMT_ODC; + break; + case 'p': + if (fflag || blksiz || Oflag || Iflag || fmttype != FMT_NONE || + kflag) + illegal = 1; + if (optind == ac) + illegal = 1; + else if (optind+1 != ac) { + files = &av[optind]; + filec = ac - optind - 1; + optind = ac - 1; + } else + filinp = ib_alloc(0, 0); + break; + } + if (illegal) + usage(); +} + +void +usage(void) +{ + fprintf(stderr, "USAGE:\n\ +\t%s [-cdnvK] [-b size] [-f file] [-s replstr] [-x hdr] [patterns]\n\ +\t%s -r[cdiknuvK] [-b size] [-f file] [-p priv] [-s replstr] [-x hdr] [patterns]\n\ +\t%s -w[adituvLX] [-b size] [-f file] [-s replstr] [-x hdr] [files]\n\ +\t%s -rw[diklntuvLX] [-p priv] [-s replstr] [files] directory\n", + progname, progname, progname, progname); + exit(1); +} + +static void +setpres(const char *s) +{ + s--; + while (*++s) { + pax_preserve &= ~PAX_P_EVERY; + switch (*s) { + case 'a': + pax_preserve |= PAX_P_ATIME; + break; + case 'e': + pax_preserve |= PAX_P_EVERY; + break; + case 'm': + pax_preserve |= PAX_P_MTIME; + break; + case 'o': + pax_preserve |= PAX_P_OWNER; + break; + case 'p': + pax_preserve |= PAX_P_MODE; + break; + default: + msg(2, 0, "ignoring unknown option \"-p%c\"\n", + *s&0377); + } + } + if (pax_preserve & PAX_P_EVERY) + pax_preserve |= PAX_P_OWNER|PAX_P_MODE; +} + +int +gmatch(const char *s, const char *p) +{ + int val; +#ifdef __GLIBC__ + /* avoid glibc's broken [^...] */ + extern char **environ; + char **savenv = environ; + char *newenv[] = { "POSIXLY_CORRECT=", NULL }; + environ = newenv; +#endif /* __GLIBC__ */ + val = fnmatch(p, s, 0) == 0; +#ifdef __GLIBC__ + environ = savenv; +#endif /* __GLIBC__ */ + return val; +} + +static const char * +nextfile(void) +{ + char *line = NULL; + size_t linsiz = 0, linlen; + + if (filinp) { + pax_Hflag = 0; + if ((linlen=ib_getlin(filinp, &line, &linsiz, srealloc)) == 0) { + filinp = NULL; + return NULL; + } + if (line[linlen-1] == '\n') + line[--linlen] = '\0'; + return line; + } else if (filec > 0) { + filec--; + return *files++; + } else + return NULL; +} + +static size_t +catpath(size_t pend, const char *base) +{ + size_t blen = strlen(base); + + if (pend + blen + 2 >= pathsz) + path = srealloc(path, pathsz = pend + blen + 16); + if (pend == 0 || path[pend-1] != '/') + path[pend++] = '/'; + strcpy(&path[pend], base); + return pend + blen; +} + +/* + * Descend the directory hierarchies given using stdin or arguments + * and return file names one per one. + */ +static size_t +ofiles_pax(char **name, size_t *namsiz) +{ + static DIR **dt; + static int dti, dts; + static int *pend; + static dev_t *curdev; + static ino_t *curino; + struct stat st; + struct dirent *dp; + const char *nf; + int i; + + if (dt == NULL) { + dt = scalloc(dts = 1, sizeof *dt); + pend = scalloc(dts, sizeof *pend); + curdev = scalloc(dts, sizeof *curdev); + curino = scalloc(dts, sizeof *curino); + } + for (;;) { + if (dti >= 0 && dt[dti] != NULL) { + if ((dp = readdir(dt[dti])) != NULL) { + if (dp->d_name[0] == '.' && + (dp->d_name[1] == '\0' || + dp->d_name[1] == '.' && + dp->d_name[2] == '\0')) + continue; + if (dti+1 <= dts) { + dt = srealloc(dt, sizeof *dt * ++dts); + pend = srealloc(pend, sizeof *pend*dts); + curdev = srealloc(curdev, sizeof *curdev + * dts); + curino = srealloc(curino, sizeof *curino + * dts); + } + pend[dti+1] = catpath(pend[dti], dp->d_name); + if (pax_Hflag) + Lflag = dti < 0; + if ((Lflag ? stat : lstat)(path, &st) < 0) { + emsg(2, "Error with %s of \"%s\"", + lflag? "stat" : "lstat", + path); + errcnt++; + } else if ((st.st_mode&S_IFMT) == S_IFDIR && + (pax_Xflag == 0 || + curdev[0] == st.st_dev)) { + if (Lflag) { + for (i = 0; i <= dti; i++) + if (st.st_dev == + curdev[i] && + st.st_ino == + curino[i]) { + if (pax == + PAX_TYPE_PAX2001) + msg(4, 1, + "Symbolic link " + "loop at " + "\"%s\"\n", + path); + break; + } + if (i <= dti) + break; + } + if ((dt[dti+1]=opendir(path)) == NULL) { + emsg(2, "Cannot open directory " + "\"%s\"", path); + errcnt++; + } else { + dti++; + curdev[dti] = st.st_dev; + curino[dti] = st.st_ino; + continue; + } + } else + break; + } else { + path[pend[dti]] = '\0'; + closedir(dt[dti]); + dt[dti--] = NULL; + if (pax_Hflag) + Lflag = dti < 0; + break; + } + } else { + if (pax_Hflag) + Lflag = 1; + while ((nf = nextfile()) != NULL && + (Lflag ? stat : lstat)(nf, &st) < 0) { + emsg(2, "Error with stat of \"%s\"", nf); + errcnt++; + } + if (nf == NULL) + return 0; + dti = 0; + if (path) + free(path); + pend[dti] = strlen(nf); + strcpy(path = smalloc(pathsz = pend[dti]+1), nf); + if (pax_dflag || (st.st_mode&S_IFMT) != S_IFDIR) { + dti = -1; + break; + } + curdev[dti] = st.st_dev; + curino[dti] = st.st_ino; + if ((dt[dti] = opendir(path)) == NULL) { + emsg(2, "Cannot open directory \"%s\"", path); + errcnt++; + } + } + } + if (*name == NULL || *namsiz < pathsz) { + free(*name); + *name = smalloc(*namsiz=pathsz); + } + strcpy(*name, path); + return pend[dti+1]; +} + +struct pax_had { + struct pax_had *p_next; + const char *p_name; + time_t p_mtime; +}; + +static int pprime = 7919; + +static int +phash(const char *s) +{ + uint32_t h = 0, g; + + s--; + while (*++s) { + h = (h << 4) + (*s & 0377); + if (g = h & 0xf0000000) { + h = h ^ (g >> 24); + h = h ^ g; + } + } + return h % pprime; +} + +static int +plook(const char *name, struct pax_had **pp) +{ + static struct pax_had **pt; + uint32_t h, had; + + if (pt == NULL) + pt = scalloc(pprime, sizeof *pt); + (*pp) = pt[h = phash(name)]; + while (*pp != NULL) { + if (strcmp((*pp)->p_name, name) == 0) + break; + *pp = (*pp)->p_next; + } + had = *pp != NULL; + if (*pp == NULL) { + *pp = scalloc(1, sizeof **pp); + (*pp)->p_name = sstrdup(name); + (*pp)->p_next = pt[h]; + pt[h] = *pp; + } + return had; +} + +int +pax_track(const char *name, time_t mtime) +{ + struct pax_had *pp; + struct stat st; + + if (pax_uflag == 0 && (pax_nflag == 0 || patterns)) + return 1; + if (action == 'i' && pax_uflag) { + if (lstat(name, &st) == 0 && mtime < st.st_mtime) + return 0; + } + if (action != 'i' || pax_nflag) { + if (plook(name, &pp) != 0) { + if (action != 'i' && pax_uflag == 0) + return 0; + if (mtime > pp->p_mtime) { + pp->p_mtime = mtime; + return 1; + } + return 0; + } else + pp->p_mtime = mtime; + } + return 1; +} + +static void +prtime_pax(time_t t) +{ + char b[30]; + time_t now; + + time(&now); + if (t > now || t < now - (6*30*86400)) + strftime(b, sizeof b, "%b %e %Y", localtime(&t)); + else + strftime(b, sizeof b, "%b %e %H:%M", localtime(&t)); + printf(" %s ", b); +} + +struct replacement { + regex_t r_re; + const char *r_rhs; + int r_nbra; + enum { + REPL_0 = 0, + REPL_G = 1, + REPL_P = 2 + } r_flags; +} *rep; + +#define NBRA 9 +static int ren, res; +static int mb_cur_max; + +static wchar_t +nextc(char **sc, int *np) +{ + char *p = *sc; + wchar_t wcbuf; + int len; + + if (**sc == '\0') { + *np = 0; + return 0; + } + if (mb_cur_max == 1 || (**sc&0200) == 0) { + *np = 1; + return *(*sc)++ & 0377; + } + if ((len = mbtowc(&wcbuf, p, mb_cur_max)) < 0) + msg(3, -2, "Invalid multibyte character for \"-s\" option\n"); + *np = len; + *sc += len; + return wcbuf; +} + +static void +parsesub(char *s) +{ + int len; + char *ps = NULL; + wchar_t seof = nextc(&s, &len); + wint_t c, d; + int nbra = 0; + int reflags; + + if (seof == 0) + goto unt; + mb_cur_max = MB_CUR_MAX; + ps = s; + do { + if ((c = nextc(&s, &len)) == seof) + break; + if (c == '\\') { + if ((c = nextc(&s, &len)) == '(') + nbra++; + continue; + } else if (c == '[') { + d = WEOF; + do { + if ((c = nextc(&s, &len)) == '\0') + continue; + if (d == '[' && (c == ':' || c == '.' || + c == '=')) { + d = c; + do { + if ((c=nextc(&s, &len)) == '\0') + continue; + } while (c != d || *s != ']'); + nextc(&s, &len); + c = WEOF; /* reset d and continue */ + } + d = c; + } while (c != ']'); + } + } while (*s != '\0'); + if (c != seof) + unt: msg(3, -2, "Unterminated argument for \"-s\" option.\n"); + s[-len] = '\0'; + if (ren <= res) + rep = srealloc(rep, ++res * sizeof *rep); + reflags = REG_ANGLES; + if (pax >= PAX_TYPE_PAX2001) + reflags |= REG_AVOIDNULL; + if (regcomp(&rep[ren].r_re, ps, reflags) != 0) + msg(3, -2, "Regular expression error in \"-s\" option\n"); + rep[ren].r_rhs = s; + rep[ren].r_nbra = nbra; + while ((c = nextc(&s, &len)) != 0) { + if (c == '\\') + c = nextc(&s, &len); + else if (c == seof) + break; + } + rep[ren].r_flags = 0; + if (c == seof) { + s[-len] = '\0'; + while ((c = nextc(&s, &len)) != '\0') { + switch (c) { + case 'g': + rep[ren].r_flags |= REPL_G; + break; + case 'p': + rep[ren].r_flags |= REPL_P; + break; + default: + msg(2, 0, "Ignoring unknown -s flag \"%c\"\n", + c); + } + } + } + ren++; +} + +#define put(c) ((new = innew+1>=newsize ? srealloc(new, newsize+=32) : new), \ + new[innew++] = (c)) + +int +pax_sname(char **oldp, size_t *olds) +{ + char *new = NULL; + size_t newsize = 0; + regmatch_t bralist[NBRA+1]; + int c, i, k, l, y, z; + int innew = 0, ef = 0; + char *inp = *oldp; + + for (z = 0; z < ren; z++) { + in: if (regexec(&rep[z].r_re, inp, NBRA+1, bralist, ef) != 0) { + if (ef == 0) + continue; + goto out; + } + for (i = 0; i < bralist[0].rm_so; i++) + put(inp[i]); + k = 0; + while (c = rep[z].r_rhs[k++] & 0377) { + y = -1; + if (c == '&') + y = 0; + else if (c == '\\') { + c = rep[z].r_rhs[k++] & 0377; + if (c >= '1' && c < rep[z].r_nbra+'1') + y = c - '0'; + } + if (y >= 0) + for (l = bralist[y].rm_so; l < bralist[y].rm_eo; + l++) + put(inp[l]); + else + put(c); + } + k = innew; + for (i = bralist[0].rm_eo; inp[i]; i++) + put(inp[i]); + put('\0'); + if (rep[z].r_flags & REPL_G) { + ef = REG_NOTBOL; + inp = &inp[bralist[0].rm_eo]; + innew = k; + if (bralist[0].rm_so == bralist[0].rm_eo) { + if (inp[0] && (nextc(&inp, &l), inp[0])) + innew++; + else + goto out; + } + goto in; + } + out: if (rep[z].r_flags & REPL_P) + fprintf(stderr, "%s >> %s\n", *oldp, new); + free(*oldp); + *oldp = new; + *olds = newsize; + return *new != '\0'; + } + return 1; +} + +void +pax_onexit(void) +{ + struct glist *gp; + + for (gp = patterns; gp; gp = gp->g_nxt) { + if (gp->g_art) + continue; + if (gp->g_gotcha == 0 && (gp->g_nxt == NULL || + gp->g_nxt->g_art == 0 || + gp->g_gotcha == 0)) { + msg(3, 0, "Pattern not matched: \"%s\"\n", gp->g_pat); + errcnt++; + } + } +} diff --git a/package/heirloom-cpio/src/pfmt.c b/package/heirloom-cpio/src/pfmt.c new file mode 100644 index 000000000..8adc22f23 --- /dev/null +++ b/package/heirloom-cpio/src/pfmt.c @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)pfmt.c 1.2 (gritter) 9/21/03 */ + +#include <stdio.h> +#include <stdarg.h> + +#include "pfmt.h" + +int +pfmt(FILE *stream, long flags, const char *fmt, ...) +{ + va_list ap; + int i; + + va_start(ap, fmt); + i = vpfmt(stream, flags, fmt, ap); + va_end(ap); + return i; +} diff --git a/package/heirloom-cpio/src/pfmt.h b/package/heirloom-cpio/src/pfmt.h new file mode 100644 index 000000000..012667b0b --- /dev/null +++ b/package/heirloom-cpio/src/pfmt.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)pfmt.h 1.2 (gritter) 9/21/03 */ + +#include <stdio.h> + +extern int pfmt(FILE *stream, long flags, const char *format, ...); + +#include <stdarg.h> + +extern int vpfmt(FILE *stream, long flags, const char *format, va_list ap); + +#define MM_HALT 0x00000001 +#define MM_ERROR 0x00000000 +#define MM_WARNING 0x00000002 +#define MM_INFO 0x00000004 +#define MM_ACTION 0x00000100 +#define MM_NOSTD 0x00000200 +#define MM_STD 0x00000000 +#define MM_NOGET 0x00000400 +#define MM_GET 0x00000000 + +extern int setlabel(const char *label); +extern int setuxlabel(const char *label); + +#define setcat(s) (s) +#define gettxt(n, s) (s) diff --git a/package/heirloom-cpio/src/pfmt_label.c b/package/heirloom-cpio/src/pfmt_label.c new file mode 100644 index 000000000..5b1a53f0a --- /dev/null +++ b/package/heirloom-cpio/src/pfmt_label.c @@ -0,0 +1 @@ +char *pfmt_label__; diff --git a/package/heirloom-cpio/src/regexp.h b/package/heirloom-cpio/src/regexp.h new file mode 100644 index 000000000..5b1fee5e6 --- /dev/null +++ b/package/heirloom-cpio/src/regexp.h @@ -0,0 +1,1211 @@ +/* + * Simple Regular Expression functions. Derived from Unix 7th Edition, + * /usr/src/cmd/expr.y + * + * Modified by Gunnar Ritter, Freiburg i. Br., Germany, February 2002. + * + * Copyright(C) Caldera International Inc. 2001-2002. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * Redistributions of source code and documentation must retain the + * above copyright notice, this list of conditions and the following + * disclaimer. + * 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. + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed or owned by Caldera + * International, Inc. + * Neither the name of Caldera International, Inc. nor the names of + * other contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA + * INTERNATIONAL, INC. 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 CALDERA INTERNATIONAL, INC. 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. + */ + +#if __GNUC__ >= 3 && __GNUC_MINOR__ >= 4 || __GNUC__ >= 4 +#define REGEXP_H_USED __attribute__ ((used)) +#elif defined __GNUC__ +#define REGEXP_H_USED __attribute__ ((unused)) +#else +#define REGEXP_H_USED +#endif +static const char regexp_h_sccsid[] REGEXP_H_USED = + "@(#)regexp.sl 1.56 (gritter) 5/29/05"; + +#if !defined (REGEXP_H_USED_FROM_VI) && !defined (__dietlibc__) +#define REGEXP_H_WCHARS +#endif + +#define CBRA 2 +#define CCHR 4 +#define CDOT 8 +#define CCL 12 +/* CLNUM 14 used in sed */ +/* CEND 16 used in sed */ +#define CDOL 20 +#define CCEOF 22 +#define CKET 24 +#define CBACK 36 +#define CNCL 40 +#define CBRC 44 +#define CLET 48 +#define CCH1 52 +#define CCH2 56 +#define CCH3 60 + +#define STAR 01 +#define RNGE 03 +#define REGEXP_H_LEAST 0100 + +#ifdef REGEXP_H_WCHARS +#define CMB 0200 +#else /* !REGEXP_H_WCHARS */ +#define CMB 0 +#endif /* !REGEXP_H_WCHARS */ + +#define NBRA 9 + +#define PLACE(c) ep[c >> 3] |= bittab[c & 07] +#define ISTHERE(c) (ep[c >> 3] & bittab[c & 07]) + +#ifdef REGEXP_H_WCHARS +#define REGEXP_H_IS_THERE(ep, c) ((ep)[c >> 3] & bittab[c & 07]) +#endif + +#include <ctype.h> +#include <string.h> +#include <limits.h> +#ifdef REGEXP_H_WCHARS +#include <stdlib.h> +#include <wchar.h> +#include <wctype.h> +#endif /* REGEXP_H_WCHARS */ + +#define regexp_h_uletter(c) (isalpha(c) || (c) == '_') +#ifdef REGEXP_H_WCHARS +#define regexp_h_wuletter(c) (iswalpha(c) || (c) == L'_') + +/* + * Used to allocate memory for the multibyte star algorithm. + */ +#ifndef regexp_h_malloc +#define regexp_h_malloc(n) malloc(n) +#endif +#ifndef regexp_h_free +#define regexp_h_free(p) free(p) +#endif + +/* + * Can be predefined to 'inline' to inline some multibyte functions; + * may improve performance for files that contain many multibyte + * sequences. + */ +#ifndef regexp_h_inline +#define regexp_h_inline +#endif + +/* + * Mask to determine whether the first byte of a sequence possibly + * starts a multibyte character. Set to 0377 to force mbtowc() for + * any byte sequence (except 0). + */ +#ifndef REGEXP_H_MASK +#define REGEXP_H_MASK 0200 +#endif +#endif /* REGEXP_H_WCHARS */ + +/* + * For regexpr.h. + */ +#ifndef regexp_h_static +#define regexp_h_static +#endif +#ifndef REGEXP_H_STEP_INIT +#define REGEXP_H_STEP_INIT +#endif +#ifndef REGEXP_H_ADVANCE_INIT +#define REGEXP_H_ADVANCE_INIT +#endif + +char *braslist[NBRA]; +char *braelist[NBRA]; +int nbra; +char *loc1, *loc2, *locs; +int sed; +int nodelim; + +regexp_h_static int circf; +regexp_h_static int low; +regexp_h_static int size; + +regexp_h_static unsigned char bittab[] = { + 1, + 2, + 4, + 8, + 16, + 32, + 64, + 128 +}; +static int regexp_h_advance(register const char *lp, + register const char *ep); +static void regexp_h_getrnge(register const char *str, int least); + +static const char *regexp_h_bol; /* beginning of input line (for \<) */ + +#ifdef REGEXP_H_WCHARS +static int regexp_h_wchars; +static int regexp_h_mbcurmax; + +static const char *regexp_h_firstwc; /* location of first + multibyte character + on input line */ + +#define regexp_h_getwc(c) { \ + if (regexp_h_wchars) { \ + char mbbuf[MB_LEN_MAX + 1], *mbptr; \ + wchar_t wcbuf; \ + int mb, len; \ + mbptr = mbbuf; \ + do { \ + mb = GETC(); \ + *mbptr++ = mb; \ + *mbptr = '\0'; \ + } while ((len = mbtowc(&wcbuf, mbbuf, regexp_h_mbcurmax)) < 0 \ + && mb != eof && mbptr < mbbuf + MB_LEN_MAX); \ + if (len == -1) \ + ERROR(67); \ + c = wcbuf; \ + } else { \ + c = GETC(); \ + } \ +} + +#define regexp_h_store(wc, mb, me) { \ + int len; \ + if (wc == WEOF) \ + ERROR(67); \ + if ((len = me - mb) <= regexp_h_mbcurmax) { \ + char mt[MB_LEN_MAX]; \ + if (wctomb(mt, wc) >= len) \ + ERROR(50); \ + } \ + switch (len = wctomb(mb, wc)) { \ + case -1: \ + ERROR(67); \ + case 0: \ + mb++; \ + break; \ + default: \ + mb += len; \ + } \ +} + +static regexp_h_inline wint_t +regexp_h_fetchwc(const char **mb, int islp) +{ + wchar_t wc; + int len; + + if ((len = mbtowc(&wc, *mb, regexp_h_mbcurmax)) < 0) { + (*mb)++; + return WEOF; + } + if (islp && regexp_h_firstwc == NULL) + regexp_h_firstwc = *mb; + /*if (len == 0) { + (*mb)++; + return L'\0'; + } handled in singlebyte code */ + *mb += len; + return wc; +} + +#define regexp_h_fetch(mb, islp) ((*(mb) & REGEXP_H_MASK) == 0 ? \ + (*(mb)++&0377): \ + regexp_h_fetchwc(&(mb), islp)) + +static regexp_h_inline wint_t +regexp_h_showwc(const char *mb) +{ + wchar_t wc; + + if (mbtowc(&wc, mb, regexp_h_mbcurmax) < 0) + return WEOF; + return wc; +} + +#define regexp_h_show(mb) ((*(mb) & REGEXP_H_MASK) == 0 ? (*(mb)&0377): \ + regexp_h_showwc(mb)) + +/* + * Return the character immediately preceding mb. Since no byte is + * required to be the first byte of a character, the longest multibyte + * character ending at &[mb-1] is searched. + */ +static regexp_h_inline wint_t +regexp_h_previous(const char *mb) +{ + const char *p = mb; + wchar_t wc, lastwc = WEOF; + int len, max = 0; + + if (regexp_h_firstwc == NULL || mb <= regexp_h_firstwc) + return (mb > regexp_h_bol ? (mb[-1] & 0377) : WEOF); + while (p-- > regexp_h_bol) { + mbtowc(NULL, NULL, 0); + if ((len = mbtowc(&wc, p, mb - p)) >= 0) { + if (len < max || len < mb - p) + break; + max = len; + lastwc = wc; + } else if (len < 0 && max > 0) + break; + } + return lastwc; +} + +#define regexp_h_cclass(set, c, af) \ + ((c) == 0 || (c) == WEOF ? 0 : ( \ + ((c) > 0177) ? \ + regexp_h_cclass_wc(set, c, af) : ( \ + REGEXP_H_IS_THERE((set)+1, (c)) ? (af) : !(af) \ + ) \ + ) \ + ) + +static regexp_h_inline int +regexp_h_cclass_wc(const char *set, register wint_t c, int af) +{ + register wint_t wc, wl = WEOF; + const char *end; + + end = &set[18] + set[0] - 1; + set += 17; + while (set < end) { + wc = regexp_h_fetch(set, 0); +#ifdef REGEXP_H_VI_BACKSLASH + if (wc == '\\' && set < end && + (*set == ']' || *set == '-' || + *set == '^' || *set == '\\')) { + wc = regexp_h_fetch(set, 0); + } else +#endif /* REGEXP_H_VI_BACKSLASH */ + if (wc == '-' && wl != WEOF && set < end) { + wc = regexp_h_fetch(set, 0); +#ifdef REGEXP_H_VI_BACKSLASH + if (wc == '\\' && set < end && + (*set == ']' || *set == '-' || + *set == '^' || *set == '\\')) { + wc = regexp_h_fetch(set, 0); + } +#endif /* REGEXP_H_VI_BACKSLASH */ + if (c > wl && c < wc) + return af; + } + if (c == wc) + return af; + wl = wc; + } + return !af; +} +#else /* !REGEXP_H_WCHARS */ +#define regexp_h_wchars 0 +#define regexp_h_getwc(c) { c = GETC(); } +#endif /* !REGEXP_H_WCHARS */ + +regexp_h_static char * +compile(char *instring, char *ep, const char *endbuf, int seof) +{ + INIT /* Dependent declarations and initializations */ + register int c; + register int eof = seof; + char *lastep = instring; + int cclcnt; + char bracket[NBRA], *bracketp; + int closed; + char neg; + int lc; + int i, cflg; + +#ifdef REGEXP_H_WCHARS + char *eq; + regexp_h_mbcurmax = MB_CUR_MAX; + regexp_h_wchars = regexp_h_mbcurmax > 1 ? CMB : 0; +#endif + lastep = 0; + bracketp = bracket; + if((c = GETC()) == eof || c == '\n') { + if (c == '\n') { + UNGETC(c); + nodelim = 1; + } + if(*ep == 0 && !sed) + ERROR(41); + if (bracketp > bracket) + ERROR(42); + RETURN(ep); + } + circf = closed = nbra = 0; + if (c == '^') + circf++; + else + UNGETC(c); + for (;;) { + if (ep >= endbuf) + ERROR(50); + regexp_h_getwc(c); + if(c != '*' && ((c != '\\') || (PEEKC() != '{'))) + lastep = ep; + if (c == eof) { + *ep++ = CCEOF; + if (bracketp > bracket) + ERROR(42); + RETURN(ep); + } + switch (c) { + + case '.': + *ep++ = CDOT|regexp_h_wchars; + continue; + + case '\n': + if (sed == 0) { + UNGETC(c); + *ep++ = CCEOF; + nodelim = 1; + RETURN(ep); + } + ERROR(36); + case '*': + if (lastep==0 || *lastep==CBRA || *lastep==CKET || + *lastep==(CBRC|regexp_h_wchars) || + *lastep==(CLET|regexp_h_wchars)) + goto defchar; + *lastep |= STAR; + continue; + + case '$': + if(PEEKC() != eof) + goto defchar; + *ep++ = CDOL; + continue; + + case '[': +#ifdef REGEXP_H_WCHARS + if (regexp_h_wchars == 0) { +#endif + if(&ep[33] >= endbuf) + ERROR(50); + + *ep++ = CCL; + lc = 0; + for(i = 0; i < 32; i++) + ep[i] = 0; + + neg = 0; + if((c = GETC()) == '^') { + neg = 1; + c = GETC(); + } + + do { + c &= 0377; + if(c == '\0' || c == '\n') + ERROR(49); +#ifdef REGEXP_H_VI_BACKSLASH + if(c == '\\' && ((c = PEEKC()) == ']' || + c == '-' || c == '^' || + c == '\\')) { + c = GETC(); + c &= 0377; + } else +#endif /* REGEXP_H_VI_BACKSLASH */ + if(c == '-' && lc != 0) { + if ((c = GETC()) == ']') { + PLACE('-'); + break; + } +#ifdef REGEXP_H_VI_BACKSLASH + if(c == '\\' && + ((c = PEEKC()) == ']' || + c == '-' || + c == '^' || + c == '\\')) + c = GETC(); +#endif /* REGEXP_H_VI_BACKSLASH */ + c &= 0377; + while(lc < c) { + PLACE(lc); + lc++; + } + } + lc = c; + PLACE(c); + } while((c = GETC()) != ']'); + if(neg) { + for(cclcnt = 0; cclcnt < 32; cclcnt++) + ep[cclcnt] ^= 0377; + ep[0] &= 0376; + } + + ep += 32; +#ifdef REGEXP_H_WCHARS + } else { + if (&ep[18] >= endbuf) + ERROR(50); + *ep++ = CCL|CMB; + *ep++ = 0; + lc = 0; + for (i = 0; i < 16; i++) + ep[i] = 0; + eq = &ep[16]; + regexp_h_getwc(c); + if (c == L'^') { + regexp_h_getwc(c); + ep[-2] = CNCL|CMB; + } + do { + if (c == '\0' || c == '\n') + ERROR(49); +#ifdef REGEXP_H_VI_BACKSLASH + if(c == '\\' && ((c = PEEKC()) == ']' || + c == '-' || c == '^' || + c == '\\')) { + regexp_h_store(c, eq, endbuf); + regexp_h_getwc(c); + } else +#endif /* REGEXP_H_VI_BACKSLASH */ + if (c == '-' && lc != 0 && lc <= 0177) { + regexp_h_store(c, eq, endbuf); + regexp_h_getwc(c); + if (c == ']') { + PLACE('-'); + break; + } +#ifdef REGEXP_H_VI_BACKSLASH + if(c == '\\' && + ((c = PEEKC()) == ']' || + c == '-' || + c == '^' || + c == '\\')) { + regexp_h_store(c, eq, + endbuf); + regexp_h_getwc(c); + } +#endif /* REGEXP_H_VI_BACKSLASH */ + while (lc < (c & 0177)) { + PLACE(lc); + lc++; + } + } + lc = c; + if (c <= 0177) + PLACE(c); + regexp_h_store(c, eq, endbuf); + regexp_h_getwc(c); + } while (c != L']'); + if ((i = eq - &ep[16]) > 255) + ERROR(50); + lastep[1] = i; + ep = eq; + } +#endif /* REGEXP_H_WCHARS */ + + continue; + + case '\\': + regexp_h_getwc(c); + switch(c) { + + case '(': + if(nbra >= NBRA) + ERROR(43); + *bracketp++ = nbra; + *ep++ = CBRA; + *ep++ = nbra++; + continue; + + case ')': + if(bracketp <= bracket) + ERROR(42); + *ep++ = CKET; + *ep++ = *--bracketp; + closed++; + continue; + + case '<': + *ep++ = CBRC|regexp_h_wchars; + continue; + + case '>': + *ep++ = CLET|regexp_h_wchars; + continue; + + case '{': + if(lastep == (char *) (0)) + goto defchar; + *lastep |= RNGE; + cflg = 0; + nlim: + c = GETC(); + i = 0; + do { + if ('0' <= c && c <= '9') + i = 10 * i + c - '0'; + else + ERROR(16); + } while(((c = GETC()) != '\\') && (c != ',')); + if (i > 255) + ERROR(11); + *ep++ = i; + if (c == ',') { + if(cflg++) + ERROR(44); + if((c = GETC()) == '\\') { + *ep++ = (char)255; + *lastep |= REGEXP_H_LEAST; + } else { + UNGETC(c); + goto nlim; /* get 2'nd number */ + } + } + if(GETC() != '}') + ERROR(45); + if(!cflg) /* one number */ + *ep++ = i; + else if((ep[-1] & 0377) < (ep[-2] & 0377)) + ERROR(46); + continue; + + case '\n': + ERROR(36); + + case 'n': + c = '\n'; + goto defchar; + + default: + if(c >= '1' && c <= '9') { + if((c -= '1') >= closed) + ERROR(25); + *ep++ = CBACK; + *ep++ = c; + continue; + } + } + /* Drop through to default to use \ to turn off special chars */ + + defchar: + default: + lastep = ep; +#ifdef REGEXP_H_WCHARS + if (regexp_h_wchars == 0) { +#endif + *ep++ = CCHR; + *ep++ = c; +#ifdef REGEXP_H_WCHARS + } else { + char mbbuf[MB_LEN_MAX]; + + switch (wctomb(mbbuf, c)) { + case 1: *ep++ = CCH1; + break; + case 2: *ep++ = CCH2; + break; + case 3: *ep++ = CCH3; + break; + default: + *ep++ = CCHR|CMB; + } + regexp_h_store(c, ep, endbuf); + } +#endif /* REGEXP_H_WCHARS */ + } + } +} + +int +step(const char *p1, const char *p2) +{ + register int c; +#ifdef REGEXP_H_WCHARS + register int d; +#endif /* REGEXP_H_WCHARS */ + + REGEXP_H_STEP_INIT /* get circf */ + regexp_h_bol = p1; +#ifdef REGEXP_H_WCHARS + regexp_h_firstwc = NULL; +#endif /* REGEXP_H_WCHARS */ + if (circf) { + loc1 = (char *)p1; + return(regexp_h_advance(p1, p2)); + } + /* fast check for first character */ + if (*p2==CCHR) { + c = p2[1] & 0377; + do { + if ((*p1 & 0377) != c) + continue; + if (regexp_h_advance(p1, p2)) { + loc1 = (char *)p1; + return(1); + } + } while (*p1++); + return(0); + } +#ifdef REGEXP_H_WCHARS + else if (*p2==CCH1) { + do { + if (p1[0] == p2[1] && regexp_h_advance(p1, p2)) { + loc1 = (char *)p1; + return(1); + } + c = regexp_h_fetch(p1, 1); + } while (c); + return(0); + } else if (*p2==CCH2) { + do { + if (p1[0] == p2[1] && p1[1] == p2[2] && + regexp_h_advance(p1, p2)) { + loc1 = (char *)p1; + return(1); + } + c = regexp_h_fetch(p1, 1); + } while (c); + return(0); + } else if (*p2==CCH3) { + do { + if (p1[0] == p2[1] && p1[1] == p2[2] && p1[2] == p2[3]&& + regexp_h_advance(p1, p2)) { + loc1 = (char *)p1; + return(1); + } + c = regexp_h_fetch(p1, 1); + } while (c); + return(0); + } else if ((*p2&0377)==(CCHR|CMB)) { + d = regexp_h_fetch(p2, 0); + do { + c = regexp_h_fetch(p1, 1); + if (c == d && regexp_h_advance(p1, p2)) { + loc1 = (char *)p1; + return(1); + } + } while(c); + return(0); + } + /* regular algorithm */ + if (regexp_h_wchars) + do { + if (regexp_h_advance(p1, p2)) { + loc1 = (char *)p1; + return(1); + } + c = regexp_h_fetch(p1, 1); + } while (c); + else +#endif /* REGEXP_H_WCHARS */ + do { + if (regexp_h_advance(p1, p2)) { + loc1 = (char *)p1; + return(1); + } + } while (*p1++); + return(0); +} + +#ifdef REGEXP_H_WCHARS +/* + * It is painfully slow to read character-wise backwards in a + * multibyte string (see regexp_h_previous() above). For the star + * algorithm, we therefore keep track of every character as it is + * read in forward direction. + * + * Don't use alloca() for stack blocks since there is no measurable + * speedup and huge amounts of memory are used up for long input + * lines. + */ +#ifndef REGEXP_H_STAKBLOK +#define REGEXP_H_STAKBLOK 1000 +#endif + +struct regexp_h_stack { + struct regexp_h_stack *s_nxt; + struct regexp_h_stack *s_prv; + const char *s_ptr[REGEXP_H_STAKBLOK]; +}; + +#define regexp_h_push(sb, sp, sc, lp) (regexp_h_wchars ? \ + regexp_h_pushwc(sb, sp, sc, lp) : (void)0) + +static regexp_h_inline void +regexp_h_pushwc(struct regexp_h_stack **sb, + struct regexp_h_stack **sp, + const char ***sc, const char *lp) +{ + if (regexp_h_firstwc == NULL || lp < regexp_h_firstwc) + return; + if (*sb == NULL) { + if ((*sb = regexp_h_malloc(sizeof **sb)) == NULL) + return; + (*sb)->s_nxt = (*sb)->s_prv = NULL; + *sp = *sb; + *sc = &(*sb)->s_ptr[0]; + } else if (*sc >= &(*sp)->s_ptr[REGEXP_H_STAKBLOK]) { + if ((*sp)->s_nxt == NULL) { + struct regexp_h_stack *bq; + + if ((bq = regexp_h_malloc(sizeof *bq)) == NULL) + return; + bq->s_nxt = NULL; + bq->s_prv = *sp; + (*sp)->s_nxt = bq; + *sp = bq; + } else + *sp = (*sp)->s_nxt; + *sc = &(*sp)->s_ptr[0]; + } + *(*sc)++ = lp; +} + +static regexp_h_inline const char * +regexp_h_pop(struct regexp_h_stack **sb, struct regexp_h_stack **sp, + const char ***sc, const char *lp) +{ + if (regexp_h_firstwc == NULL || lp <= regexp_h_firstwc) + return &lp[-1]; + if (*sp == NULL) + return regexp_h_firstwc; + if (*sc == &(*sp)->s_ptr[0]) { + if ((*sp)->s_prv == NULL) { + regexp_h_free(*sp); + *sp = NULL; + *sb = NULL; + return regexp_h_firstwc; + } + *sp = (*sp)->s_prv; + regexp_h_free((*sp)->s_nxt); + (*sp)->s_nxt = NULL ; + *sc = &(*sp)->s_ptr[REGEXP_H_STAKBLOK]; + } + return *(--(*sc)); +} + +static void +regexp_h_zerostak(struct regexp_h_stack **sb, struct regexp_h_stack **sp) +{ + for (*sp = *sb; *sp && (*sp)->s_nxt; *sp = (*sp)->s_nxt) + if ((*sp)->s_prv) + regexp_h_free((*sp)->s_prv); + if (*sp) { + if ((*sp)->s_prv) + regexp_h_free((*sp)->s_prv); + regexp_h_free(*sp); + } + *sp = *sb = NULL; +} +#else /* !REGEXP_H_WCHARS */ +#define regexp_h_push(sb, sp, sc, lp) +#endif /* !REGEXP_H_WCHARS */ + +static int +regexp_h_advance(const char *lp, const char *ep) +{ + register const char *curlp; + int c, least; +#ifdef REGEXP_H_WCHARS + int d; + struct regexp_h_stack *sb = NULL, *sp = NULL; + const char **sc; +#endif /* REGEXP_H_WCHARS */ + char *bbeg; + int ct; + + for (;;) switch (least = *ep++ & 0377, least & ~REGEXP_H_LEAST) { + + case CCHR: +#ifdef REGEXP_H_WCHARS + case CCH1: +#endif + if (*ep++ == *lp++) + continue; + return(0); + +#ifdef REGEXP_H_WCHARS + case CCHR|CMB: + if (regexp_h_fetch(ep, 0) == regexp_h_fetch(lp, 1)) + continue; + return(0); + + case CCH2: + if (ep[0] == lp[0] && ep[1] == lp[1]) { + ep += 2, lp += 2; + continue; + } + return(0); + + case CCH3: + if (ep[0] == lp[0] && ep[1] == lp[1] && ep[2] == lp[2]) { + ep += 3, lp += 3; + continue; + } + return(0); +#endif /* REGEXP_H_WCHARS */ + + case CDOT: + if (*lp++) + continue; + return(0); +#ifdef REGEXP_H_WCHARS + case CDOT|CMB: + if ((c = regexp_h_fetch(lp, 1)) != L'\0' && c != WEOF) + continue; + return(0); +#endif /* REGEXP_H_WCHARS */ + + case CDOL: + if (*lp==0) + continue; + return(0); + + case CCEOF: + loc2 = (char *)lp; + return(1); + + case CCL: + c = *lp++ & 0377; + if(ISTHERE(c)) { + ep += 32; + continue; + } + return(0); + +#ifdef REGEXP_H_WCHARS + case CCL|CMB: + case CNCL|CMB: + c = regexp_h_fetch(lp, 1); + if (regexp_h_cclass(ep, c, (ep[-1] & 0377) == (CCL|CMB))) { + ep += (*ep & 0377) + 17; + continue; + } + return 0; +#endif /* REGEXP_H_WCHARS */ + + case CBRA: + braslist[*ep++ & 0377] = (char *)lp; + continue; + + case CKET: + braelist[*ep++ & 0377] = (char *)lp; + continue; + + case CBRC: + if (lp == regexp_h_bol && locs == NULL) + continue; + if ((isdigit(lp[0] & 0377) || regexp_h_uletter(lp[0] & 0377)) + && !regexp_h_uletter(lp[-1] & 0377) + && !isdigit(lp[-1] & 0377)) + continue; + return(0); + +#ifdef REGEXP_H_WCHARS + case CBRC|CMB: + c = regexp_h_show(lp); + d = regexp_h_previous(lp); + if ((iswdigit(c) || regexp_h_wuletter(c)) + && !regexp_h_wuletter(d) + && !iswdigit(d)) + continue; + return(0); +#endif /* REGEXP_H_WCHARS */ + + case CLET: + if (!regexp_h_uletter(lp[0] & 0377) && !isdigit(lp[0] & 0377)) + continue; + return(0); + +#ifdef REGEXP_H_WCHARS + case CLET|CMB: + c = regexp_h_show(lp); + if (!regexp_h_wuletter(c) && !iswdigit(c)) + continue; + return(0); +#endif /* REGEXP_H_WCHARS */ + + case CCHR|RNGE: + c = *ep++; + regexp_h_getrnge(ep, least); + while(low--) + if(*lp++ != c) + return(0); + curlp = lp; + while(size--) { + regexp_h_push(&sb, &sp, &sc, lp); + if(*lp++ != c) + break; + } + if(size < 0) { + regexp_h_push(&sb, &sp, &sc, lp); + lp++; + } + ep += 2; + goto star; + +#ifdef REGEXP_H_WCHARS + case CCHR|RNGE|CMB: + case CCH1|RNGE: + case CCH2|RNGE: + case CCH3|RNGE: + c = regexp_h_fetch(ep, 0); + regexp_h_getrnge(ep, least); + while (low--) + if (regexp_h_fetch(lp, 1) != c) + return 0; + curlp = lp; + while (size--) { + regexp_h_push(&sb, &sp, &sc, lp); + if (regexp_h_fetch(lp, 1) != c) + break; + } + if(size < 0) { + regexp_h_push(&sb, &sp, &sc, lp); + regexp_h_fetch(lp, 1); + } + ep += 2; + goto star; +#endif /* REGEXP_H_WCHARS */ + + case CDOT|RNGE: + regexp_h_getrnge(ep, least); + while(low--) + if(*lp++ == '\0') + return(0); + curlp = lp; + while(size--) { + regexp_h_push(&sb, &sp, &sc, lp); + if(*lp++ == '\0') + break; + } + if(size < 0) { + regexp_h_push(&sb, &sp, &sc, lp); + lp++; + } + ep += 2; + goto star; + +#ifdef REGEXP_H_WCHARS + case CDOT|RNGE|CMB: + regexp_h_getrnge(ep, least); + while (low--) + if ((c = regexp_h_fetch(lp, 1)) == L'\0' || c == WEOF) + return 0; + curlp = lp; + while (size--) { + regexp_h_push(&sb, &sp, &sc, lp); + if ((c = regexp_h_fetch(lp, 1)) == L'\0' || c == WEOF) + break; + } + if (size < 0) { + regexp_h_push(&sb, &sp, &sc, lp); + regexp_h_fetch(lp, 1); + } + ep += 2; + goto star; +#endif /* REGEXP_H_WCHARS */ + + case CCL|RNGE: + regexp_h_getrnge(ep + 32, least); + while(low--) { + c = *lp++ & 0377; + if(!ISTHERE(c)) + return(0); + } + curlp = lp; + while(size--) { + regexp_h_push(&sb, &sp, &sc, lp); + c = *lp++ & 0377; + if(!ISTHERE(c)) + break; + } + if(size < 0) { + regexp_h_push(&sb, &sp, &sc, lp); + lp++; + } + ep += 34; /* 32 + 2 */ + goto star; + +#ifdef REGEXP_H_WCHARS + case CCL|RNGE|CMB: + case CNCL|RNGE|CMB: + regexp_h_getrnge(ep + (*ep & 0377) + 17, least); + while (low--) { + c = regexp_h_fetch(lp, 1); + if (!regexp_h_cclass(ep, c, + (ep[-1] & 0377 & ~REGEXP_H_LEAST) + == (CCL|RNGE|CMB))) + return 0; + } + curlp = lp; + while (size--) { + regexp_h_push(&sb, &sp, &sc, lp); + c = regexp_h_fetch(lp, 1); + if (!regexp_h_cclass(ep, c, + (ep[-1] & 0377 & ~REGEXP_H_LEAST) + == (CCL|RNGE|CMB))) + break; + } + if (size < 0) { + regexp_h_push(&sb, &sp, &sc, lp); + regexp_h_fetch(lp, 1); + } + ep += (*ep & 0377) + 19; + goto star; +#endif /* REGEXP_H_WCHARS */ + + case CBACK: + bbeg = braslist[*ep & 0377]; + ct = braelist[*ep++ & 0377] - bbeg; + + if(strncmp(bbeg, lp, ct) == 0) { + lp += ct; + continue; + } + return(0); + + case CBACK|STAR: + bbeg = braslist[*ep & 0377]; + ct = braelist[*ep++ & 0377] - bbeg; + curlp = lp; + while(strncmp(bbeg, lp, ct) == 0) + lp += ct; + + while(lp >= curlp) { + if(regexp_h_advance(lp, ep)) return(1); + lp -= ct; + } + return(0); + + + case CDOT|STAR: + curlp = lp; + do + regexp_h_push(&sb, &sp, &sc, lp); + while (*lp++); + goto star; + +#ifdef REGEXP_H_WCHARS + case CDOT|STAR|CMB: + curlp = lp; + do + regexp_h_push(&sb, &sp, &sc, lp); + while ((c = regexp_h_fetch(lp, 1)) != L'\0' && c != WEOF); + goto star; +#endif /* REGEXP_H_WCHARS */ + + case CCHR|STAR: + curlp = lp; + do + regexp_h_push(&sb, &sp, &sc, lp); + while (*lp++ == *ep); + ep++; + goto star; + +#ifdef REGEXP_H_WCHARS + case CCHR|STAR|CMB: + case CCH1|STAR: + case CCH2|STAR: + case CCH3|STAR: + curlp = lp; + d = regexp_h_fetch(ep, 0); + do + regexp_h_push(&sb, &sp, &sc, lp); + while (regexp_h_fetch(lp, 1) == d); + goto star; +#endif /* REGEXP_H_WCHARS */ + + case CCL|STAR: + curlp = lp; + do { + regexp_h_push(&sb, &sp, &sc, lp); + c = *lp++ & 0377; + } while(ISTHERE(c)); + ep += 32; + goto star; + +#ifdef REGEXP_H_WCHARS + case CCL|STAR|CMB: + case CNCL|STAR|CMB: + curlp = lp; + do { + regexp_h_push(&sb, &sp, &sc, lp); + c = regexp_h_fetch(lp, 1); + } while (regexp_h_cclass(ep, c, (ep[-1] & 0377) + == (CCL|STAR|CMB))); + ep += (*ep & 0377) + 17; + goto star; +#endif /* REGEXP_H_WCHARS */ + + star: +#ifdef REGEXP_H_WCHARS + if (regexp_h_wchars == 0) { +#endif + do { + if(--lp == locs) + break; + if (regexp_h_advance(lp, ep)) + return(1); + } while (lp > curlp); +#ifdef REGEXP_H_WCHARS + } else { + do { + lp = regexp_h_pop(&sb, &sp, &sc, lp); + if (lp <= locs) + break; + if (regexp_h_advance(lp, ep)) { + regexp_h_zerostak(&sb, &sp); + return(1); + } + } while (lp > curlp); + regexp_h_zerostak(&sb, &sp); + } +#endif /* REGEXP_H_WCHARS */ + return(0); + + } +} + +static void +regexp_h_getrnge(register const char *str, int least) +{ + low = *str++ & 0377; + size = least & REGEXP_H_LEAST ? /*20000*/INT_MAX : (*str & 0377) - low; +} + +int +advance(const char *lp, const char *ep) +{ + REGEXP_H_ADVANCE_INIT /* skip past circf */ + regexp_h_bol = lp; +#ifdef REGEXP_H_WCHARS + regexp_h_firstwc = NULL; +#endif /* REGEXP_H_WCHARS */ + return regexp_h_advance(lp, ep); +} diff --git a/package/heirloom-cpio/src/regexpr.c b/package/heirloom-cpio/src/regexpr.c new file mode 100644 index 000000000..40dceb525 --- /dev/null +++ b/package/heirloom-cpio/src/regexpr.c @@ -0,0 +1,90 @@ +/* + * Simple Regular Expression functions. Derived from Unix 7th Edition, + * /usr/src/cmd/expr.y + * + * Modified by Gunnar Ritter, Freiburg i. Br., Germany, January 2003. + * + * Copyright(C) Caldera International Inc. 2001-2002. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * Redistributions of source code and documentation must retain the + * above copyright notice, this list of conditions and the following + * disclaimer. + * 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. + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed or owned by Caldera + * International, Inc. + * Neither the name of Caldera International, Inc. nor the names of + * other contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA + * INTERNATIONAL, INC. 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 CALDERA INTERNATIONAL, INC. 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. + */ + +/* Sccsid @(#)regexpr.c 1.8 (gritter) 10/13/04 */ + +#include <stdlib.h> +#include "regexpr.h" + +int regerrno, reglength; +static int circf; + +static char *regexpr_compile(char *, char *, const char *, int); + +char * +compile(const char *instring, char *ep, char *endbuf) +{ + char *cp; + int sz = 0; + + if (ep == 0) { + for (cp = (char *)instring; *cp != '\0'; cp++) + if (*cp == '[') + sz += 32; + sz += 2 * (cp - instring) + 5; + if ((ep = malloc(sz)) == 0) { + regerrno = 11; + return 0; + } + endbuf = &ep[sz]; + ep[1] = '\0'; + } + if ((cp=regexpr_compile((char *)instring, &ep[1], endbuf, '\0')) == 0) { + if (sz) + free(ep); + return 0; + } + ep[0] = circf; + reglength = cp - ep; + return sz ? ep : cp; +} + +#define INIT register char *sp = instring; +#define GETC() (*sp++) +#define PEEKC() (*sp) +#define UNGETC(c) (--sp) +#define RETURN(c) return (c); +#define ERROR(c) { regerrno = c; return 0; } + +#define compile(a, b, c, d) regexpr_compile(a, b, c, d) +#define regexp_h_static static +#define REGEXP_H_STEP_INIT circf = *p2++; +#define REGEXP_H_ADVANCE_INIT circf = *ep++; + +#include "regexp.h" diff --git a/package/heirloom-cpio/src/regexpr.h b/package/heirloom-cpio/src/regexpr.h new file mode 100644 index 000000000..74f4a1426 --- /dev/null +++ b/package/heirloom-cpio/src/regexpr.h @@ -0,0 +1,53 @@ +/* + * Simple Regular Expression functions. Derived from Unix 7th Edition, + * /usr/src/cmd/expr.y + * + * Modified by Gunnar Ritter, Freiburg i. Br., Germany, January 2003. + * + * Copyright(C) Caldera International Inc. 2001-2002. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * Redistributions of source code and documentation must retain the + * above copyright notice, this list of conditions and the following + * disclaimer. + * 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. + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed or owned by Caldera + * International, Inc. + * Neither the name of Caldera International, Inc. nor the names of + * other contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA + * INTERNATIONAL, INC. 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 CALDERA INTERNATIONAL, INC. 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. + */ + +/* Sccsid @(#)regexpr.h 1.2 (gritter) 1/11/03 */ + +#define NBRA 9 + +extern char *braslist[NBRA]; +extern char *braelist[NBRA]; +extern int nbra; +extern int regerrno, reglength; +extern char *loc1, *loc2, *locs; +extern int sed; + +extern char *compile(const char *, char *, char *); +extern int step(const char *, const char *); +extern int advance(const char *, const char *); diff --git a/package/heirloom-cpio/src/setlabel.c b/package/heirloom-cpio/src/setlabel.c new file mode 100644 index 000000000..a1db0646e --- /dev/null +++ b/package/heirloom-cpio/src/setlabel.c @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)setlabel.c 1.1 (gritter) 9/21/03 */ + +extern char *pfmt_label__; + +int +setlabel(const char *s) +{ + static char lbuf[26]; + char *lp; + + if (s && s[0]) { + for (lp = lbuf; *s && lp < &lbuf[sizeof lbuf-1]; s++, lp++) + *lp = *s; + *lp = '\0'; + pfmt_label__ = lbuf; + } else + pfmt_label__ = 0; + return 0; +} diff --git a/package/heirloom-cpio/src/setuxlabel.c b/package/heirloom-cpio/src/setuxlabel.c new file mode 100644 index 000000000..9d304869e --- /dev/null +++ b/package/heirloom-cpio/src/setuxlabel.c @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)setuxlabel.c 1.1 (gritter) 9/21/03 */ + +#include "msgselect.h" + +extern char *pfmt_label__; + +int +setuxlabel(const char *s) +{ + static char lbuf[msgselect(29,26)]; + char *lp, *mp; + + if (s && s[0]) { + lp = lbuf; + mp = msgselect("UX:",""); + while (*mp) + *lp++ = *mp++; + lbuf[0] = 'U', lbuf[1] = 'X', lbuf[2] = ':'; + while (*s && lp < &lbuf[sizeof lbuf-1]) + *lp++ = *s++; + *lp = '\0'; + pfmt_label__ = lbuf; + } else + pfmt_label__ = 0; + return 0; +} diff --git a/package/heirloom-cpio/src/sfile.c b/package/heirloom-cpio/src/sfile.c new file mode 100644 index 000000000..089d85fdf --- /dev/null +++ b/package/heirloom-cpio/src/sfile.c @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)sfile.c 1.9 (gritter) 6/7/04 */ + +#ifdef __linux__ +#undef _FILE_OFFSET_BITS + +#include <sys/types.h> +#include <sys/sendfile.h> +#include <sys/stat.h> +#include <unistd.h> +#include <limits.h> +#include <errno.h> +#include "sfile.h" + +long long +sfile(int dfd, int sfd, mode_t mode, long long count) +{ + static int enosys, einval, success; + off_t offset; + ssize_t sent, total; + extern void writerr(void *, int, int); + /* + * A process is not interruptible while executing a sendfile() + * system call. So it is not advisable to to send an entire + * file with one call; it is sent in parts so signals can + * be delivered in between. + */ + const ssize_t chunk = 196608; + + /* + * If a previous call returned ENOSYS, the operating system does + * not support sendfile() at all and it makes no sense to try it + * again. + * + * If a previous call returned EINVAL and there was no successful + * call yet, it is very likely that this is a permanent error + * condition (on Linux 2.6.0-test4, sendfile() may be used for + * socket targets only; older versions don't support tmpfs as + * source file system etc.). + */ + if (enosys || !success && einval || + (mode&S_IFMT) != S_IFREG || count > SSIZE_MAX) + return 0; + offset = lseek(sfd, 0, SEEK_CUR); + sent = 0, total = 0; + while (count > 0 && (sent = sendfile(dfd, sfd, &offset, + count > chunk ? chunk : count)) > 0) { + count -= sent, total += sent; + } + if (total && lseek(sfd, offset, SEEK_SET) == (off_t)-1) + return -1; + if (count == 0 || sent == 0) { + success = 1; + return total; + } + switch (errno) { + case ENOSYS: + enosys = 1; + return 0; + case EINVAL: + einval = 1; + return 0; + case ENOMEM: + return 0; + default: + writerr(NULL, count > chunk ? chunk : count, 0); + return -1; + } +} +#else /* !__linux__ */ +#include <sys/types.h> + +/*ARGSUSED*/ +long long +sfile(int dfd, int sfd, mode_t mode, long long count) +{ + return 0; +} +#endif /* __linux__ */ diff --git a/package/heirloom-cpio/src/sfile.h b/package/heirloom-cpio/src/sfile.h new file mode 100644 index 000000000..53d832a6f --- /dev/null +++ b/package/heirloom-cpio/src/sfile.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)sfile.h 1.4 (gritter) 4/17/03 */ + +/* + * Return values: + * + * src_size The entire range has been copied. The file offset of both + * dst_fd and src_fd have been set to this position. The + * operation has been completed successfully. + * + * >0 Number of bytes written. The file offset of both dst_fd + * and src_fd have been set to this position. The operation + * may continue using read()/write(). + * + * 0 No data was written; operation may continue. + * + * -1 An error occured; operation may not continue. + */ +extern long long sfile(int dst_fd, int src_fd, mode_t src_mode, + long long src_size); diff --git a/package/heirloom-cpio/src/sighold.c b/package/heirloom-cpio/src/sighold.c new file mode 100644 index 000000000..bae3bc393 --- /dev/null +++ b/package/heirloom-cpio/src/sighold.c @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2004 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)sighold.c 1.7 (gritter) 1/22/06 */ + +#if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ + defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) || \ + defined (__UCLIBC__) +#include <signal.h> +#include "sigset.h" + +int +sighold(int sig) +{ + sigset_t set, oset; + + if (sig <= 0) + return -1; + sigemptyset(&set); + sigaddset(&set, sig); + return sigprocmask(SIG_BLOCK, &set, &oset); +} +#endif /* __FreeBSD__ || __dietlibc__ || __NetBSD__ || __OpenBSD__ || + __DragonFly__ || __APPLE__ || __UCLIBC__ */ diff --git a/package/heirloom-cpio/src/sigignore.c b/package/heirloom-cpio/src/sigignore.c new file mode 100644 index 000000000..6938ef676 --- /dev/null +++ b/package/heirloom-cpio/src/sigignore.c @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2004 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)sigignore.c 1.6 (gritter) 1/22/06 */ + +#if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ + defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) +#include <signal.h> +#include "sigset.h" + +int +sigignore(int sig) +{ + struct sigaction act; + + if (sig <= 0) + return -1; + act.sa_handler = SIG_IGN; + act.sa_flags = 0; + if (sig == SIGCHLD) + act.sa_flags |= SA_NOCLDSTOP|SA_NOCLDWAIT; + sigemptyset(&act.sa_mask); + sigaddset(&act.sa_mask, sig); + return sigaction(sig, &act, (struct sigaction *)0); +} +#endif /* __FreeBSD__ || __dietlibc__ || __NetBSD__ || __OpenBSD__ || + __DragonFly__ || __APPLE__ */ diff --git a/package/heirloom-cpio/src/signal.c b/package/heirloom-cpio/src/signal.c new file mode 100644 index 000000000..1f9d51cb7 --- /dev/null +++ b/package/heirloom-cpio/src/signal.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2004 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)signal.c 1.6 (gritter) 1/22/06 */ + +#if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ + defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) || \ + defined (__UCLIBC__) +#include <signal.h> +#include "sigset.h" + +void (*signal(int sig, void (*func)(int)))(int) +{ + struct sigaction nact, oact; + + if (sig <= 0) + return SIG_ERR; + nact.sa_handler = func; + nact.sa_flags = SA_RESETHAND|SA_NODEFER; + if (sig == SIGCHLD && func == SIG_IGN) + nact.sa_flags |= SA_NOCLDSTOP|SA_NOCLDWAIT; + sigemptyset(&nact.sa_mask); + if (sigaction(sig, &nact, &oact) == -1) + return SIG_ERR; + return oact.sa_handler; +} +#endif /* __FreeBSD__ || __dietlibc__ || __NetBSD__ || __OpenBSD__ || + __DragonFly__ || __APPLE__ || __UCLIBC__ */ diff --git a/package/heirloom-cpio/src/sigpause.c b/package/heirloom-cpio/src/sigpause.c new file mode 100644 index 000000000..504a5ed4d --- /dev/null +++ b/package/heirloom-cpio/src/sigpause.c @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2004 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)sigpause.c 1.6 (gritter) 1/22/06 */ + +#if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ + defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) +#include <signal.h> +#include "sigset.h" + +int +sigpause(int sig) +{ + sigset_t nset, oset; + int ret; + + if (sig <= 0) + return -1; + sigemptyset(&nset); + sigaddset(&nset, sig); + if (sigprocmask(SIG_UNBLOCK, &nset, &oset) < 0) + return -1; + sigemptyset(&nset); + ret = sigsuspend(&nset); + if (sigprocmask(SIG_SETMASK, &oset, (sigset_t *)0) < 0) + ret = -1; + return ret; +} +#endif /* __FreeBSD__ || __dietlibc__ || __NetBSD__ || __OpenBSD__ || + __DragonFly__ || __APPLE__ */ diff --git a/package/heirloom-cpio/src/sigrelse.c b/package/heirloom-cpio/src/sigrelse.c new file mode 100644 index 000000000..d74de74bf --- /dev/null +++ b/package/heirloom-cpio/src/sigrelse.c @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2004 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)sigrelse.c 1.8 (gritter) 1/22/06 */ + +#if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ + defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) || \ + defined (__UCLIBC__) +#include <signal.h> +#include "sigset.h" + +int +sigrelse(int sig) +{ + sigset_t set, oset; + + if (sig <= 0) + return -1; + sigemptyset(&set); + sigaddset(&set, sig); + return sigprocmask(SIG_UNBLOCK, &set, &oset); +} +#endif /* __FreeBSD__ || __dietlibc__ || __NetBSD__ || __OpenBSD__ || + __DragonFly__ || __APPLE__ || __UCLIBC__ */ diff --git a/package/heirloom-cpio/src/sigset.c b/package/heirloom-cpio/src/sigset.c new file mode 100644 index 000000000..d561d541d --- /dev/null +++ b/package/heirloom-cpio/src/sigset.c @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2004 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)sigset.c 1.7 (gritter) 1/22/06 */ + +#include <sys/param.h> +#if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ + defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) || \ + defined (__UCLIBC__) +#include <signal.h> +#include "sigset.h" + +void (*sigset(int sig, void (*func)(int)))(int) +{ + struct sigaction nact, oact; + sigset_t nset, oset; + + if (sig <= 0) + return SIG_ERR; + sigemptyset(&nset); + sigaddset(&nset, sig); + if (sigprocmask(func==SIG_HOLD?SIG_BLOCK:SIG_UNBLOCK, &nset, &oset) < 0) + return SIG_ERR; + nact.sa_handler = func; + nact.sa_flags = 0; + if (sig == SIGCHLD && func == SIG_IGN) + nact.sa_flags |= SA_NOCLDSTOP|SA_NOCLDWAIT; + sigemptyset(&nact.sa_mask); + sigaddset(&nact.sa_mask, sig); + if (sigaction(sig, func==SIG_HOLD?(struct sigaction *)0:&nact, &oact) + == -1) + return SIG_ERR; + if (sigismember(&oset, sig)) + return SIG_HOLD; + else + return (oact.sa_handler); +} +#endif /* __FreeBSD__ || __dietlibc__ || __NetBSD__ || __OpenBSD__ || + __DragonFly__ || __APPLE__ || __UCLIBC__ */ diff --git a/package/heirloom-cpio/src/sigset.h b/package/heirloom-cpio/src/sigset.h new file mode 100644 index 000000000..ada73a884 --- /dev/null +++ b/package/heirloom-cpio/src/sigset.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2004 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)sigset.h 1.9 (gritter) 1/22/06 */ + +#include <sys/param.h> +#if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ + defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) || \ + defined (__UCLIBC__) + +#ifndef SIG_HOLD +#define SIG_HOLD ((void (*)(int))2) +#endif /* !SIG_HOLD */ + +extern int sighold(int); +extern int sigignore(int); +//extern int sigpause(int); +extern int sigrelse(int); +extern void (*sigset(int, void (*)(int)))(int); +extern void (*signal(int, void (*)(int)))(int); +#endif /* __FreeBSD__ || __dietlibc__ || __NetBSD__ || __OpenBSD__ || + __DragonFly__ || __APPLE__ || __UCLIBC__ */ diff --git a/package/heirloom-cpio/src/strtol.c b/package/heirloom-cpio/src/strtol.c new file mode 100644 index 000000000..cd8ecfe7a --- /dev/null +++ b/package/heirloom-cpio/src/strtol.c @@ -0,0 +1,117 @@ +/* Sccsid @(#)strtol.c 1.6 (gritter) 7/18/04 */ + +#if defined (__hpux) || defined (_AIX) || \ + defined (__FreeBSD__) && (__FreeBSD__) < 5 + +#include <stdlib.h> +#include <ctype.h> +#include <errno.h> + +#include "atoll.h" + +#ifdef __hpux +#ifndef _INCLUDE__STDC_A1_SOURCE +#error You must use cc -D_INCLUDE__STDC_A1_SOURCE on HP-UX +#endif +#endif /* __hpux */ + +static long long +internal(const char *nptr, char **endptr, int base, int flags) +{ + const char *pp = nptr, *bptr; + long long v = 0, ov; + int sign = 1; + int c; + int valid = 1; + + /* XXX + * iswspace() should be used. + */ + for (bptr = nptr; isspace(*bptr&0377); bptr++); + if (*bptr == '-') { + sign = -1; + bptr++; + } else if (*bptr == '+') + bptr++; + if (base == 0) { + if (*bptr >= '1' && *bptr <= '9') + base = 10; + else if (*bptr == '0') { + if (bptr[1] == 'x' || bptr[1] == 'X') + base = 16; + else + base = 8; + } else { + if (flags&1) + errno = EINVAL; + goto out; + } + } + if (base < 2 || base > 36) { + if (flags&1) + errno = EINVAL; + goto out; + } + if (base == 16 && bptr[0] == '0' && + (bptr[1] == 'x' || bptr[1] == 'X')) + bptr += 2; + pp = bptr; + for (;;) { + if (*pp >= '0' && *pp <= '9') + c = *pp - '0'; + else if (*pp >= 'a' && *pp <= 'z') + c = *pp - 'a' + 10; + else if (*pp >= 'A' && *pp <= 'A') + c = *pp - 'A' + 10; + else + break; + if (c >= base) + break; + pp++; + if (valid) { + ov = v; + v = v * base + c; + if (flags&1) { + if (flags&2 && (unsigned long long)v < + (unsigned long long)ov || + v < ov) { + sign = 1; + errno = ERANGE; + v = -1; + if ((flags&2)==0) + v = (unsigned long long)v >> 1; + valid = 0; + } + } + } + } +out: if (pp <= bptr) { + if (flags&1) + errno = EINVAL; + if (endptr) + *endptr = (char *)nptr; + } else { + if (endptr) + *endptr = (char *)pp; + } + return v * sign; +} + +long long +strtoll(const char *nptr, char **endptr, int base) +{ + return internal(nptr, endptr, base, 1); +} + +unsigned long long +strtoull(const char *nptr, char **endptr, int base) +{ + return (unsigned long long)internal(nptr, endptr, base, 3); +} + +long long +atoll(const char *nptr) +{ + return internal(nptr, NULL, 10, 0); +} +#endif /* __hpux || _AIX || __FreeBSD__ < 5 */ diff --git a/package/heirloom-cpio/src/unshrink.c b/package/heirloom-cpio/src/unshrink.c new file mode 100644 index 000000000..61f5c507c --- /dev/null +++ b/package/heirloom-cpio/src/unshrink.c @@ -0,0 +1,307 @@ +/* + * Changes by Gunnar Ritter, Freiburg i. Br., Germany, May 2003. + * + * Derived from unzip 5.40. + * + * Sccsid @(#)unshrink.c 1.4 (gritter) 6/18/04 + */ +/*--------------------------------------------------------------------------- + + unshrink.c version 1.21 23 Nov 95 + + + NOTE: This code may or may not infringe on the so-called "Welch + patent" owned by Unisys. (From reading the patent, it appears + that a pure LZW decompressor is *not* covered, but this claim has + not been tested in court, and Unisys is reported to believe other- + wise.) It is therefore the responsibility of the user to acquire + whatever license(s) may be required for legal use of this code. + + THE INFO-ZIP GROUP DISCLAIMS ALL LIABILITY FOR USE OF THIS CODE + IN VIOLATION OF APPLICABLE PATENT LAW. + + + Shrinking is basically a dynamic LZW algorithm with allowed code sizes of + up to 13 bits; in addition, there is provision for partial clearing of + leaf nodes. PKWARE uses the special code 256 (decimal) to indicate a + change in code size or a partial clear of the code tree: 256,1 for the + former and 256,2 for the latter. [Note that partial clearing can "orphan" + nodes: the parent-to-be can be cleared before its new child is added, + but the child is added anyway (as an orphan, as though the parent still + existed). When the tree fills up to the point where the parent node is + reused, the orphan is effectively "adopted." Versions prior to 1.05 were + affected more due to greater use of pointers (to children and siblings + as well as parents).] + + This replacement version of unshrink.c was written from scratch. It is + based only on the algorithms described in Mark Nelson's _The Data Compres- + sion Book_ and in Terry Welch's original paper in the June 1984 issue of + IEEE _Computer_; no existing source code, including any in Nelson's book, + was used. + + Memory requirements have been reduced in this version and are now no more + than the original Sam Smith code. This is still larger than any of the + other algorithms: at a minimum, 8K+8K+16K (stack+values+parents) assuming + 16-bit short ints, and this does not even include the output buffer (the + other algorithms leave the uncompressed data in the work area, typically + called slide[]). For machines with a 64KB data space this is a problem, + particularly when text conversion is required and line endings have more + than one character. UnZip's solution is to use two roughly equal halves + of outbuf for the ASCII conversion in such a case; the "unshrink" argument + to flush() signals that this is the case. + + For large-memory machines, a second outbuf is allocated for translations, + but only if unshrinking and only if translations are required. + + | binary mode | text mode + --------------------------------------------------- + big mem | big outbuf | big outbuf + big outbuf2 <- malloc'd here + small mem | small outbuf | half + half small outbuf + + Copyright 1994, 1995 Greg Roelofs. See the accompanying file "COPYING" + in UnZip 5.20 (or later) source or binary distributions. + + From "COPYING": + + The following copyright applies to the new version of unshrink.c, + distributed with UnZip version 5.2 and later: + + * Copyright (c) 1994 Greg Roelofs. + * Permission is granted to any individual/institution/corporate + * entity to use, copy, redistribute or modify this software for + * any purpose whatsoever, subject to the conditions noted in the + * Frequently Asked Questions section below, plus one additional + * condition: namely, that my name not be removed from the source + * code. (Other names may, of course, be added as modifications + * are made.) Corporate legal staff (like at IBM :-) ) who have + * problems understanding this can contact me through Zip-Bugs... + + + Q. Can I use the source code of Zip and UnZip in my commercial + application? + + A. Yes, so long as you include in your product an acknowledgment; a + pointer to the original, free compression sources; and a statement + making it clear that there are no extra or hidden charges resulting + from the use of our compression code in your product (see below for + an example). The acknowledgment should appear in at least one piece + of human-readable documentation (e.g., a README file or man page), + although additionally putting it in the executable(s) is OK, too. + In other words, you are allowed to sell only your own work, not ours, + and we'd like a little credit. (Note the additional restrictions + above on the code in unreduce.c, unshrink.c, vms.c, time_lib.c, and + everything in the wince and windll subdirectories.) Contact us at + Zip-Bugs@lists.wku.edu if you have special requirements. We also + like to hear when our code is being used, but we don't require that. + + <Product> incorporates compression code from the Info-ZIP group. + There are no extra charges or costs due to the use of this code, + and the original compression sources are freely available from + http://www.cdrom.com/pub/infozip/ or ftp://ftp.cdrom.com/pub/infozip/ + on the Internet. + + If you only need compression capability, not full zipfile support, + you might want to look at zlib instead; it has fewer restrictions + on commercial use. See http://www.cdrom.com/pub/infozip/zlib/ . + + ---------------------------------------------------------------------------*/ + +#include <string.h> +#include <stdio.h> + +#include "cpio.h" +#include "unzip.h" + +static void partial_clear(struct globals *); + +#define trace() + +/* HSIZE is defined as 2^13 (8192) in unzip.h */ +#define BOGUSCODE 256 +#define FLAG_BITS parent /* upper bits of parent[] used as flag bits */ +#define CODE_MASK (HSIZE - 1) /* 0x1fff (lower bits are parent's index) */ +#define FREE_CODE HSIZE /* 0x2000 (code is unused or was cleared) */ +#define HAS_CHILD (HSIZE << 1) /* 0x4000 (code has a child--do not clear) */ + +#define parent G.area.shrink.Parent +#define Value G.area.shrink.value /* "value" conflicts with Pyramid ioctl.h */ +#define stack G.area.shrink.Stack + +/***********************/ +/* Function unshrink() */ +/***********************/ + +int +zipunshrink(struct file *f, const char *tgt, int tfd, int doswap, uint32_t *crc) +{ + struct globals G; + int offset = (HSIZE - 1); + uint8_t *stacktop = stack + offset; + register uint8_t *newstr; + int codesize=9, len, KwKwK; + int16_t code, oldcode, freecode, curcode; + int16_t lastfreecode; + unsigned int outbufsiz; + +/*--------------------------------------------------------------------------- + Initialize various variables. + ---------------------------------------------------------------------------*/ + + memset(&G, 0, sizeof G); + G.tgt = tgt; + G.tfd = tfd; + G.doswap = doswap; + G.crc = crc; + G.zsize = G.uzsize = f->f_csize; + lastfreecode = BOGUSCODE; + + for (code = 0; code < BOGUSCODE; ++code) { + Value[code] = (uint8_t)code; + parent[code] = BOGUSCODE; + } + for (code = BOGUSCODE+1; code < HSIZE; ++code) + parent[code] = FREE_CODE; + + outbufsiz = OUTBUFSIZ; + G.outptr = G.outbuf; + G.outcnt = 0L; + +/*--------------------------------------------------------------------------- + Get and output first code, then loop over remaining ones. + ---------------------------------------------------------------------------*/ + + READBITS(codesize, oldcode) + if (!G.zipeof) { + *G.outptr++ = (uint8_t)oldcode; + ++G.outcnt; + } + + do { + READBITS(codesize, code) + if (G.zipeof) + break; + if (code == BOGUSCODE) { /* possible to have consecutive escapes? */ + READBITS(codesize, code) + if (code == 1) { + ++codesize; + Trace((stderr, " (codesize now %d bits)\n", codesize)); + } else if (code == 2) { + Trace((stderr, " (partial clear code)\n")); + partial_clear(&G); /* clear leafs (nodes with no children) */ + Trace((stderr, " (done with partial clear)\n")); + lastfreecode = BOGUSCODE; /* reset start of free-node search */ + } + continue; + } + + /*----------------------------------------------------------------------- + Translate code: traverse tree from leaf back to root. + -----------------------------------------------------------------------*/ + + newstr = stacktop; + curcode = code; + + if (parent[curcode] == FREE_CODE) { + /* or (FLAG_BITS[curcode] & FREE_CODE)? */ + KwKwK = TRUE; + Trace((stderr, " (found a KwKwK code %d; oldcode = %d)\n", code, + oldcode)); + --newstr; /* last character will be same as first character */ + curcode = oldcode; + } else + KwKwK = FALSE; + + do { + *newstr-- = Value[curcode]; + curcode = (int16_t)(parent[curcode] & CODE_MASK); + } while (curcode != BOGUSCODE); + + len = (int)(stacktop - newstr++); + if (KwKwK) + *stacktop = *newstr; + + /*----------------------------------------------------------------------- + Write expanded string in reverse order to output buffer. + -----------------------------------------------------------------------*/ + + Trace((stderr, "code %4d; oldcode %4d; char %3d (%c); string [", code, + oldcode, (int)(*newstr), (*newstr<32 || *newstr>=127)? ' ':*newstr)); + + { + register uint8_t *p; + + for (p = newstr; p < newstr+len; ++p) { + *G.outptr++ = *p; + if (++G.outcnt == outbufsiz) { + flush(&G, G.outbuf, G.outcnt); + G.outptr = G.outbuf; + G.outcnt = 0L; + } + } + } + + /*----------------------------------------------------------------------- + Add new leaf (first character of newstr) to tree as child of oldcode. + -----------------------------------------------------------------------*/ + + /* search for freecode */ + freecode = (int16_t)(lastfreecode + 1); + /* add if-test before loop for speed? */ + while (parent[freecode] != FREE_CODE) + ++freecode; + lastfreecode = freecode; + Trace((stderr, "]; newcode %d\n", freecode)); + + Value[freecode] = *newstr; + parent[freecode] = oldcode; + oldcode = code; + + } while (!G.zipeof); + +/*--------------------------------------------------------------------------- + Flush any remaining data and return to sender... + ---------------------------------------------------------------------------*/ + + if (G.outcnt > 0L) + flush(&G, G.outbuf, G.outcnt); + + return G.status; + +} /* end function unshrink() */ + + + + + +/****************************/ +/* Function partial_clear() */ /* no longer recursive... */ +/****************************/ + +static void +partial_clear(struct globals *Gp) +{ +#define G (*Gp) + register int16_t code; + + /* clear all nodes which have no children (i.e., leaf nodes only) */ + + /* first loop: mark each parent as such */ + for (code = BOGUSCODE+1; code < HSIZE; ++code) { + register int16_t cparent = (int16_t)(parent[code] & CODE_MASK); + + if (cparent > BOGUSCODE && cparent != FREE_CODE) + FLAG_BITS[cparent] |= HAS_CHILD; /* set parent's child-bit */ + } + + /* second loop: clear all nodes *not* marked as parents; reset flag bits */ + for (code = BOGUSCODE+1; code < HSIZE; ++code) { + if (FLAG_BITS[code] & HAS_CHILD) /* just clear child-bit */ + FLAG_BITS[code] &= ~HAS_CHILD; + else { /* leaf: lose it */ + Trace((stderr, "%d\n", code)); + parent[code] = FREE_CODE; + } + } + + return; +} diff --git a/package/heirloom-cpio/src/unzip.h b/package/heirloom-cpio/src/unzip.h new file mode 100644 index 000000000..d53f81024 --- /dev/null +++ b/package/heirloom-cpio/src/unzip.h @@ -0,0 +1,121 @@ +/* + * Changes by Gunnar Ritter, Freiburg i. Br., Germany, May 2003. + * + * Derived from unzip 5.40. + * + * Sccsid @(#)unzip.h 1.5 (gritter) 7/16/04 + */ + +#include <inttypes.h> + +#define Trace(a) + +#define MAX_BITS 13 +#define HSIZE (1 << MAX_BITS) +#define WSIZE 65536L /* at least 64K for enhanced deflate */ + +#define redirSlide G.area.Slide + +#define NEXTBYTE (--G.incnt >= 0 ? (int)(*G.inptr++) : readbyte(&G)) + +#define READBITS(nbits, zdest) { \ + if (nbits > G.bits_left) { \ + int temp; \ + G.zipeof = 1; \ + while (G.bits_left <= 8 * (int)(sizeof G.bitbuf - 1) && \ + (temp = NEXTBYTE) != EOF) { \ + G.bitbuf |= (uint32_t)temp << G.bits_left; \ + G.bits_left += 8; \ + G.zipeof = 0; \ + } \ + } \ + zdest = (int16_t)((uint16_t)G.bitbuf & mask_bits[nbits]); \ + G.bitbuf >>= nbits; \ + G.bits_left -= nbits; \ +} + +#undef FALSE +#undef TRUE +enum { + FALSE = 0, + TRUE = 1 +}; + +union work { + struct { + int16_t Parent[HSIZE]; + uint8_t value[HSIZE]; + uint8_t Stack[HSIZE]; + } shrink; + uint8_t Slide[WSIZE]; +}; + +#define OUTBUFSIZ 4096 + +struct globals { + union work area; + uint8_t inbuf[4096]; + long long zsize; + long long uzsize; + uint8_t *inptr; + const char *tgt; + struct huft *fixed_tl; + struct huft *fixed_td; + struct huft *fixed_tl64; + struct huft *fixed_td64; + struct huft *fixed_tl32; + struct huft *fixed_td32; + const uint16_t *cplens; + const uint8_t *cplext; + const uint8_t *cpdext; + long csize; + long ucsize; + uint8_t outbuf[OUTBUFSIZ]; + uint8_t *outptr; + uint32_t *crc; + uint32_t bitbuf; + uint32_t wp; + uint32_t bb; + uint32_t bk; + unsigned outcnt; + int tfd; + int doswap; + int incnt; + int bits_left; + int zipeof; + int fixed_bl; + int fixed_bd; + int fixed_bl64; + int fixed_bd64; + int fixed_bl32; + int fixed_bd32; + int status; +}; + +/* Huffman code lookup table entry--this entry is four bytes for machines + that have 16-bit pointers (e.g. PC's in the small or medium model). + Valid extra bits are 0..13. e == 15 is EOB (end of block), e == 16 + means that v is a literal, 16 < e < 32 means that v is a pointer to + the next table, which codes e - 16 bits, and lastly e == 99 indicates + an unused code. If a code with e == 99 is looked up, this implies an + error in the data. */ + +struct huft { + uint8_t e; /* number of extra bits or operation */ + uint8_t b; /* number of bits in this code or subcode */ + union { + uint16_t n; /* literal, length base, or distance base */ + struct huft *t; /* pointer to next level of table */ + } v; +}; + +extern const uint16_t mask_bits[]; + +extern void flush(struct globals *, const void *, size_t); +extern int readbyte(struct globals *); + +extern int huft_build(const unsigned *b, unsigned n, unsigned s, + const uint16_t *d, const uint8_t *e, + struct huft **t, int *m, + int bits, int nob, int eob); +extern void huft_free(struct huft *); diff --git a/package/heirloom-cpio/src/utmpx.c b/package/heirloom-cpio/src/utmpx.c new file mode 100644 index 000000000..d88a627a7 --- /dev/null +++ b/package/heirloom-cpio/src/utmpx.c @@ -0,0 +1,252 @@ +/* + * Copyright (c) 2004 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)utmpx.c 1.13 (gritter) 12/16/07 */ + +#include <stdio.h> + +#if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ + defined (__UCLIBC__) || defined (__OpenBSD__) || \ + defined (__DragonFly__) || \ + defined (__APPLE__) && \ + (__MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_OS_X_VERSION_10_5) +#include <sys/types.h> +#include <sys/time.h> +#include <utmp.h> +#include <string.h> + +#include "utmpx.h" + +static FILE *utfp; +static struct utmpx utx; +static const char *utmpfile = _PATH_UTMP; + +static FILE * +init(void) +{ + if (utfp == NULL && (utfp = fopen(utmpfile, "r+")) == NULL) + if ((utfp = fopen(utmpfile, "r")) == NULL) + return NULL; + return utfp; +} + +static struct utmpx * +utmp2utmpx(struct utmpx *ux, const struct utmp *up) +{ +#ifndef __dietlibc__ + memset(ux, 0, sizeof *ux); + ux->ut_tv.tv_sec = up->ut_time; + memcpy(ux->ut_line, up->ut_line, UT_LINESIZE); + memcpy(ux->ut_user, up->ut_name, UT_NAMESIZE); + memcpy(ux->ut_host, up->ut_host, UT_HOSTSIZE); + if (strcmp(up->ut_line, "~") == 0) + ux->ut_type = BOOT_TIME; + else if (strcmp(up->ut_line, "|") == 0) + ux->ut_type = OLD_TIME; + else if (strcmp(up->ut_line, "}") == 0) + ux->ut_type = NEW_TIME; + else if (*up->ut_name == 0) + ux->ut_type = DEAD_PROCESS; + else + ux->ut_type = USER_PROCESS; +#else /* __dietlibc__ */ + *ux = *up; +#endif /* __dietlibc__ */ + return ux; +} + +static struct utmp * +utmpx2utmp(struct utmp *up, const struct utmpx *ux) +{ +#ifndef __dietlibc__ + memset(up, 0, sizeof *up); + up->ut_time = ux->ut_tv.tv_sec; + switch (ux->ut_type) { + case DEAD_PROCESS: + memcpy(up->ut_line, ux->ut_line, UT_LINESIZE); + break; + default: + case EMPTY: + case INIT_PROCESS: + case LOGIN_PROCESS: + case RUN_LVL: + case ACCOUNTING: + return NULL; + case BOOT_TIME: + strcpy(up->ut_name, "reboot"); + strcpy(up->ut_line, "~"); + break; + case OLD_TIME: + strcpy(up->ut_name, "date"); + strcpy(up->ut_line, "|"); + break; + case NEW_TIME: + strcpy(up->ut_name, "date"); + strcpy(up->ut_line, "{"); + break; + case USER_PROCESS: + memcpy(up->ut_line, ux->ut_line, UT_LINESIZE); + memcpy(up->ut_name, ux->ut_user, UT_NAMESIZE); + memcpy(up->ut_host, ux->ut_host, UT_HOSTSIZE); + } +#else /* __dietlibc__ */ + *up = *ux; +#endif /* __dietlibc__ */ + return up; +} + +struct utmpx * +getutxent(void) +{ + static struct utmp zero; + struct utmp ut; + + if (init() == NULL) + return NULL; + do { + if (fread(&ut, sizeof ut, 1, utfp) != 1) + return NULL; + } while (memcmp(&ut, &zero, sizeof ut) == 0); + return utmp2utmpx(&utx, &ut); +} + +struct utmpx * +getutxline(const struct utmpx *ux) +{ + struct utmp ut; + + if (init() == NULL) + return NULL; + fseek(utfp, 0, SEEK_SET); + while (fread(&ut, sizeof ut, 1, utfp) == 1) { + utmp2utmpx(&utx, &ut); + if ((utx.ut_type == LOGIN_PROCESS || + utx.ut_type == USER_PROCESS) && + strcmp(ut.ut_line, utx.ut_line) == 0) + return &utx; + } + return NULL; +} + +struct utmpx * +getutxid(const struct utmpx *ux) +{ +#ifdef __dietlibc__ + struct utmp ut; +#endif + + if (init() == NULL) + return NULL; +#ifdef __dietlibc__ + fseek(utfp, 0, SEEK_SET); + while (fread(&ut, sizeof ut, 1, utfp) == 1) { + utmp2utmpx(&utx, &ut); + switch (ux->ut_type) { + case BOOT_TIME: + case OLD_TIME: + case NEW_TIME: + if (ux->ut_type == utx.ut_type) + return &utx; + break; + case INIT_PROCESS: + case LOGIN_PROCESS: + case USER_PROCESS: + case DEAD_PROCESS: + if (ux->ut_type == utx.ut_type && + ux->ut_id == utx.ut_id) + return &utx; + break; + } + } +#endif /* __dietlibc__ */ + return NULL; +} + +void +setutxent(void) +{ + if (init() == NULL) + return; + fseek(utfp, 0, SEEK_SET); +} + +void +endutxent(void) +{ + FILE *fp; + + if (init() == NULL) + return; + fp = utfp; + utfp = NULL; + fclose(fp); +} + +int +utmpxname(const char *name) +{ + utmpfile = strdup(name); + return 0; +} + +extern struct utmpx * +pututxline(const struct utmpx *up) +{ + struct utmp ut; + struct utmpx *rp; + + if (init() == NULL) + return NULL; + /* + * Cannot use getutxid() because there is no id field. Use + * the equivalent of getutxline() instead. + */ + while (fread(&ut, sizeof ut, 1, utfp) == 1) { + if (strncmp(ut.ut_line, up->ut_line, UT_LINESIZE) == 0) { + fseek(utfp, -sizeof ut, SEEK_CUR); + break; + } + } + fflush(utfp); + if (utmpx2utmp(&ut, up) == NULL) + rp = NULL; + else if (fwrite(&ut, sizeof ut, 1, utfp) == 1) { + utx = *up; + rp = &utx; + } else + rp = NULL; + fflush(utfp); + return rp; +} + +extern void +updwtmpx(const char *name, const struct utmpx *up) +{ + FILE *fp; + + if ((fp = fopen(name, "a")) == NULL) + return; + fwrite(up, sizeof *up, 1, fp); + fclose(fp); +} + +#endif /* __FreeBSD__ || __dietlibc__ || __NetBSD__ || __UCLIBC__ || + __OpenBSD__ || __DragonFly__ || __APPLE__ */ diff --git a/package/heirloom-cpio/src/version.c b/package/heirloom-cpio/src/version.c new file mode 100644 index 000000000..a9d4a4681 --- /dev/null +++ b/package/heirloom-cpio/src/version.c @@ -0,0 +1,26 @@ +#if __GNUC__ >= 3 && __GNUC_MINOR__ >= 4 || __GNUC__ >= 4 +#define USED __attribute__ ((used)) +#elif defined __GNUC__ +#define USED __attribute__ ((unused)) +#else +#define USED +#endif +static const char sccsid[] USED = "@(#)cpio.sl 2.9 (gritter) 8/14/09"; +/* SLIST */ +/* +blast.c: * Sccsid @(#)blast.c 1.2 (gritter) 2/17/04 +blast.h: * Sccsid @(#)blast.h 1.2 (gritter) 2/17/04 +cpio.c: * Sccsid @(#)cpio.c 1.305 (gritter) 8/14/09 +cpio.h: Sccsid @(#)cpio.h 1.29 (gritter) 3/26/07 +crc32.c: * Sccsid @(#)crc32.c 1.2 (gritter) 5/29/03 +expand.c: Sccsid @(#)expand.c 1.6 (gritter) 12/15/03 +explode.c: * Sccsid @(#)explode.c 1.6 (gritter) 9/30/03 +flags.c: Sccsid @(#)flags.c 1.6 (gritter) 3/26/07 +inflate.c: * Sccsid @(#)inflate.c 1.6 (gritter) 10/13/04 +nonpax.c: Sccsid @(#)nonpax.c 1.1 (gritter) 2/24/04 +pax.c:static const char sccsid[] USED = "@(#)pax_su3.sl 1.26 (gritter) 6/26/05"; +pax.c:static const char sccsid[] USED = "@(#)pax.sl 1.26 (gritter) 6/26/05"; +pax.c: Sccsid @(#)pax.c 1.26 (gritter) 6/26/05 +unshrink.c: * Sccsid @(#)unshrink.c 1.4 (gritter) 6/18/04 +unzip.h: * Sccsid @(#)unzip.h 1.5 (gritter) 7/16/04 +*/ diff --git a/package/heirloom-cpio/src/vpfmt.c b/package/heirloom-cpio/src/vpfmt.c new file mode 100644 index 000000000..fdbb4ccb0 --- /dev/null +++ b/package/heirloom-cpio/src/vpfmt.c @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2003 Gunnar Ritter + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute + * it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source distribution. + */ +/* Sccsid @(#)vpfmt.c 1.2 (gritter) 9/21/03 */ + +#include <stdio.h> +#include <stdarg.h> + +#include "pfmt.h" + +extern char *pfmt_label__; + +/* + * Strip catalog and msgnum from s, but only if they actually appear. + */ +static const char * +begin(const char *s, long flags) +{ + const char *sp; + + if (flags & MM_NOGET) + return s; + sp = s; + if (*sp && *sp != ':') { + sp++; + while (*sp && *sp != '/' && *sp != ':' && sp - s < 14) + sp++; + } + if (*sp++ != ':') + return s; + while (*sp >= '0' && *sp <= '9') + sp++; + if (*sp++ != ':' || *sp == '\0') + return s; + return sp; +} + +int +vpfmt(FILE *stream, long flags, const char *fmt, va_list ap) +{ + int n = 0; + const char *severity = NULL; + char sevbuf[25]; + + if ((flags&MM_NOSTD) == 0) { + if (flags & MM_ACTION) + severity = "TO FIX"; + else switch (flags & 0377) { + case MM_HALT: + severity = "HALT"; + break; + case MM_WARNING: + severity = "WARNING"; + break; + case MM_INFO: + severity = "INFO"; + break; + case MM_ERROR: + severity = "ERROR"; + break; + default: + snprintf(sevbuf, sizeof sevbuf, "SEV=%ld", flags&0377); + severity = sevbuf; + } + if (pfmt_label__) + n = fprintf(stream, "%s: ", pfmt_label__); + if (severity) + n += fprintf(stream, "%s: ", severity); + } + n += vfprintf(stream, begin(fmt, flags), ap); + return n; +} diff --git a/package/id3lib/Makefile b/package/id3lib/Makefile index 19d678a7a..82f23f375 100644 --- a/package/id3lib/Makefile +++ b/package/id3lib/Makefile @@ -28,7 +28,7 @@ ifeq ($(ADK_COMPILE_ID3LIB_WITH_UCLIBCXX),y) LIBRARIES:=-nodefaultlibs -luClibc++ -lz -lm -lc -lgcc endif -ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y) +ifeq ($(ADK_TOOLCHAIN_USE_SSP),y) LIBRARIES+=-lssp -fstack-protector endif diff --git a/package/igmpproxy/patches/patch-src_igmpproxy_h b/package/igmpproxy/patches/patch-src_igmpproxy_h new file mode 100644 index 000000000..0d2bbbc4d --- /dev/null +++ b/package/igmpproxy/patches/patch-src_igmpproxy_h @@ -0,0 +1,10 @@ +--- igmpproxy-0.1.orig/src/igmpproxy.h 2009-10-05 20:19:26.000000000 +0200 ++++ igmpproxy-0.1/src/igmpproxy.h 2014-03-26 18:05:47.000000000 +0100 +@@ -48,6 +48,7 @@ + #include <sys/socket.h> + #include <sys/un.h> + #include <sys/time.h> ++#include <sys/types.h> + #include <sys/ioctl.h> + #include <sys/param.h> + diff --git a/package/ipcad/Makefile b/package/ipcad/Makefile index 5ee22cba2..57b4d7111 100644 --- a/package/ipcad/Makefile +++ b/package/ipcad/Makefile @@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk PKG_NAME:= ipcad PKG_VERSION:= 3.7.3 -PKG_RELEASE:= 1 +PKG_RELEASE:= 2 PKG_MD5SUM:= 125605249958894148ec26d3c88189f5 PKG_DESCR:= IP Cisco Accounting Daemon PKG_SECTION:= net diff --git a/package/ipcad/patches/patch-Makefile b/package/ipcad/patches/patch-Makefile new file mode 100644 index 000000000..8ced9f13a --- /dev/null +++ b/package/ipcad/patches/patch-Makefile @@ -0,0 +1,169 @@ +--- ipcad-3.7.3.orig/Makefile 2007-04-22 10:08:45.000000000 +0200 ++++ ipcad-3.7.3/Makefile 2014-03-23 17:59:56.000000000 +0100 +@@ -1,4 +1,163 @@ +-all: bootstrap + +-bootstrap: +- ./configure && make ++prefix= /usr ++exec_prefix= ${prefix} ++bindir= /usr/bin ++sysconfdir= /etc ++datadir= /usr/share ++ ++CC= /home/wbx/hudson/toolchain_x86_64-linux-gnu/usr/bin/arm-openadk-linux-muslgnueabihf-gcc ++LDFLAGS= -L/home/wbx/hudson/target_arm_musl_eabihf/lib -L/home/wbx/hudson/target_arm_musl_eabihf/usr/lib -Wl,-O1 -Wl,-rpath -Wl,/usr/lib -Wl,-rpath-link -Wl,/home/wbx/hudson/target_arm_musl_eabihf/usr/lib -Wl,-z,relro,-z,now ++LIBS= -lpcap ++CFLAGS= -march=armv6 -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -fwrapv -fno-ident -fhonour-copts -fomit-frame-pointer -Os -pipe -fno-unwind-tables -fno-asynchronous-unwind-tables -g3 -DHAVE_CONFIG_H -W -Wall ++CPPFLAGS=-DIPCAD_VERSION=\"3.7.3\" ++CPPFLAGS+=-DCONFIG_FILE=\"${sysconfdir}/ipcad.conf\" ++CPPFLAGS+=-DHAVE_CONFIG_H -D_REENTRANT -D_THREAD_SAFE ++CPPFLAGS+=-DPSRC_pcap -DIFST_linux ++ ++YACC=bison -y ++LEX=flex ++INSTALL=/usr/bin/install -c ++ ++MANROOT=/usr/share/man/man ++MAN8=${MANROOT}8 ++MAN5=${MANROOT}5 ++ ++NROFF= groff -Tascii -mandoc ++ ++PACKAGE=ipcad ++TARGETS=ipcad ++VERSION=3.7.3 ++ ++IPCAD_OBJS= main.o process.o pps.o disp.o storage.o usage.o cfgy.o cfglex.o cfgread.o cfgvar.o dump.o import.o nflow.o cshelly.o cslex.o csparse.o service.o rw.o servers.o opt.o pidfile.o sf_lite.o ++IPCAD_OBJS+= ifst_linux.o # Interface statistics ++IPCAD_OBJS+= ifs_list.o # Interface statistics ++IPCAD_OBJS+= loop-pcap.o # Method of capturing ++IPCAD_OBJS+= loop-file.o # Method of capturing ++IPCAD_OBJS+= loop-divert.o # Method of capturing ++IPCAD_OBJS+= loop-dynamic.o # Method of capturing ++IPCAD_OBJS+= loop-ulog.o loop-ipq.o # Methods of capturing ++IPCAD_OBJS+= psrc.o psrc-pcap.o # Initialize capturers ++IPCAD_OBJS+= psrc-ipq.o psrc-ulog.o # Initialize capturers ++IPCAD_OBJS+= psrc-file.o # Initialize capturers ++IPCAD_OBJS+= psrc-dynamic.o # Initialize capturers ++IPCAD_OBJS+= psrc-divert.o # Initialize capturers ++IPCAD_OBJS+= wrap_oclose.o # Special file descriptors cache ++IPCAD_OBJS+= genhash.o # General hashing ++ ++all: ${TARGETS} man ++ ++ipcad: ${IPCAD_OBJS} ++ ${CC} ${CFLAGS} -o $@ ${IPCAD_OBJS} ${LDFLAGS} ${LIBS} ++ ++.SUFFIXES: ++.SUFFIXES: .o .c .0 .8 .5 ++ ++.c.o: ++ ${CC} ${CPPFLAGS} ${CFLAGS} -o $@ -c $< ++ ++.8.0: ++ ${NROFF} $< > $@ ++ ++.5.0: ++ ${NROFF} $< > $@ ++ ++cfgy.h cfgy.c: cfg.y ++ ${YACC} -p ipcacfg -d cfg.y ++ @mv y.tab.c cfgy.c ++ @mv y.tab.h cfgy.h ++ ++cshelly.h cshelly.c: cshell.y ++ ${YACC} -p CS -d cshell.y ++ @mv y.tab.c cshelly.c ++ @mv y.tab.h cshelly.h ++ ++cslex.c: cslex.l ++ ${LEX} -s -p -Cem -ocslex.c -PCS cslex.l ++ ++cfglex.c: cfglex.l ++ ${LEX} -s -p -Cem -ocfglex.c -Pipcacfg cfglex.l ++ ++ ++man: ipcad.8 ipcad.conf.5 ++ ++distdir = $(PACKAGE)-$(VERSION) ++distdir: ++ rm -rf $(distdir) ++ mkdir $(distdir) ++ cp *.c *.h $(distdir) ++ cp ipcad.8 ipcad.conf.5 $(distdir) ++ cp *.y *.l $(distdir) ++ cp *.in configure install-sh $(distdir) ++ cp ipcad.conf.default $(distdir) ++ cp ipcad.conf.simple $(distdir) ++ cp ipcad.spec.in $(distdir) ++ cp Makefile.in Makefile $(distdir) ++ cp ChangeLog INSTALL README TODO BUGS AUTHORS COPYING FAQ $(distdir) ++ cd $(distdir) && make distclean ++ ++dist: distdir ++ tar chof - $(distdir) | GZIP="--best" gzip -c > $(distdir).tar.gz ++ rm -rf $(distdir) ++ ++clean: ++ rm -f *.o ${TARGETS} *.core 1 ++ rm -f *.0 ++ ++distclean: clean ++ rm -f config.h ++ rm -f config.cache config.log config.status ++ rm -f Makefile ++ rm -f $(distdir).tar.gz ++ rm -f ipcad.spec ++ (echo "all: bootstrap"; echo; echo "bootstrap:"; \ ++ echo " ./configure && make") > Makefile ++ ++maintainer-clean: distclean ++ @echo "This command is intended for maintainers to use; it" ++ @echo "deletes files that may need special tools to rebuild." ++ rm -f Makefile ++ rm -f *.tab.* cfgy.? *lex.c ++ rm -f config.h.in configure ++ ++install: all install-bin install-conf ++ ++install-bin: ++ @${INSTALL} -d $(DESTDIR)${bindir} ++ ${INSTALL} ipcad $(DESTDIR)${bindir} ++ ++install-man: man ++ ${INSTALL} -m 444 ipcad.8 $(DESTDIR)${MAN8}/ipcad.8 ++ ${INSTALL} -m 444 ipcad.conf.5 $(DESTDIR)${MAN5}/ipcad.conf.5 ++ ++install-conf: ++ @${INSTALL} -d $(DESTDIR)${sysconfdir} ++ ${INSTALL} -m 644 ipcad.conf.simple $(DESTDIR)${sysconfdir}/ipcad.conf.simple ++ -@diff ${sysconfdir}/ipcad.conf \ ++ ${sysconfdir}/ipcad.conf.default >/dev/null 2>&1; \ ++ if [ "$$?" -eq 0 ] || [ ! -f ${sysconfdir}/ipcad.conf ]; then \ ++ echo ${INSTALL} -m 644 ipcad.conf.default $(DESTDIR)${sysconfdir}/ipcad.conf.default; \ ++ ${INSTALL} -m 644 ipcad.conf.default $(DESTDIR)${sysconfdir}/ipcad.conf.default; \ ++ echo ${INSTALL} -m 644 ipcad.conf.default $(DESTDIR)${sysconfdir}/ipcad.conf; \ ++ ${INSTALL} -m 644 ipcad.conf.default $(DESTDIR)${sysconfdir}/ipcad.conf; \ ++ echo "**********************************************"; \ ++ echo "* Please customize ${sysconfdir}/ipcad.conf *"; \ ++ echo "**********************************************"; \ ++ else \ ++ echo ${INSTALL} -m 644 ipcad.conf.default $(DESTDIR)${sysconfdir}/ipcad.conf.default; \ ++ ${INSTALL} -m 644 ipcad.conf.default $(DESTDIR)${sysconfdir}/ipcad.conf.default; \ ++ echo "*********************************************"; \ ++ echo "* Updated ${sysconfdir}/ipcad.conf.default *"; \ ++ echo "*********************************************"; \ ++ fi ++ @echo "" ++ @echo "Now you might want to 'make install-man'" ++ @echo "" ++ ++ ++uninstall: ++ rm -f ${bindir}/ipcad ++ rm -f ${sysconfdir}/ipcad.conf.default ++ rm -f ${sysconfdir}/ipcad.conf.simple ++ rm -f ${MAN8}/ipcad.8 ++ rm -f ${MAN5}/ipcad.conf.5 ++ diff --git a/package/ipcad/patches/patch-Makefile_in b/package/ipcad/patches/patch-Makefile_in index 40bcdf546..2fb2eaece 100644 --- a/package/ipcad/patches/patch-Makefile_in +++ b/package/ipcad/patches/patch-Makefile_in @@ -1,5 +1,5 @@ --- ipcad-3.7.3.orig/Makefile.in 2007-04-22 10:08:45.000000000 +0200 -+++ ipcad-3.7.3/Makefile.in 2011-01-11 17:16:15.000000000 +0100 ++++ ipcad-3.7.3/Makefile.in 2014-03-23 17:58:49.000000000 +0100 @@ -6,10 +6,10 @@ sysconfdir= @sysconfdir@ datadir= @datadir@ @@ -15,3 +15,12 @@ CPPFLAGS+=-DCONFIG_FILE=\"${sysconfdir}/ipcad.conf\" CPPFLAGS+=@DEFS@ -D_REENTRANT -D_THREAD_SAFE CPPFLAGS+=-DPSRC_@PSRC@ -DIFST_@IFST@ +@@ -28,7 +28,7 @@ PACKAGE=ipcad + TARGETS=ipcad + VERSION=@IPCAD_VERSION@ + +-IPCAD_OBJS= main.o process.o pps.o disp.o storage.o usage.o cfgy.o cfglex.o cfgread.o cfgvar.o rsh.o rshp.o dump.o import.o nflow.o cshelly.o cslex.o csparse.o service.o rw.o servers.o opt.o pidfile.o sf_lite.o ++IPCAD_OBJS= main.o process.o pps.o disp.o storage.o usage.o cfgy.o cfglex.o cfgread.o cfgvar.o dump.o import.o nflow.o cshelly.o cslex.o csparse.o service.o rw.o servers.o opt.o pidfile.o sf_lite.o + IPCAD_OBJS+= ifst_@IFST@.o # Interface statistics + IPCAD_OBJS+= ifs_list.o # Interface statistics + IPCAD_OBJS+= loop-@PSRC@.o # Method of capturing diff --git a/package/ipcad/patches/patch-cfg_y b/package/ipcad/patches/patch-cfg_y new file mode 100644 index 000000000..11fbc7564 --- /dev/null +++ b/package/ipcad/patches/patch-cfg_y @@ -0,0 +1,60 @@ +--- ipcad-3.7.3.orig/cfg.y 2007-04-22 10:08:45.000000000 +0200 ++++ ipcad-3.7.3/cfg.y 2014-03-23 18:03:07.000000000 +0100 +@@ -3,7 +3,6 @@ + #include "headers.h" + #include "cfgvar.h" + #include "servers.h" +-#include "rsh.h" + #include "opt.h" + #include "storage.h" + +@@ -214,49 +213,6 @@ block: + | CAPTURE_PORTS DENY { + conf->capture_ports = 0; + } +- | RSH ALLOW at_ip { +- if(add_server(rsh_server, "RSH Server", &($3), 514)) +- return yyerror("Failed to install RSH server"); +- fprintf(stderr, "Configured RSH Server listening at %s\n", +- inet_ntoa($3)); +- } +- | RSH DENY at_ip { +- fprintf(stderr, "Warning: Option at line %d has no effect\n", +- ipcacfglineno); +- } +- | RSH TIMEOUT EQ TOK_STRING { +- int to_ms; +- to_ms = atoi($4); +- free($4); +- if(to_ms < 0) +- to_ms = -1; /* INFTIM */ +- else +- to_ms = to_ms * 1000; +- rsh_rw_timeout = to_ms; +- } +- | RSH TOK_STRING privlevel { +- cfg_add_rsh_host("", $2, $3); +- free($2); +- } +- | RSH AT TOK_STRING privlevel { +- cfg_add_rsh_host("", $3, $4); +- free($3); +- } +- | RSH TOK_STRING AT TOK_STRING privlevel { +- cfg_add_rsh_host($2, $4, $5); +- free($2); free($4); +- } +- | RSH TTL EQ TOK_STRING { +- conf->rsh_ttl = atoi($4); +- free($4); +- } +- | TTL EQ TOK_STRING { +- fprintf(stderr, "WARNING: \"ttl = %s;\" at line %d: " +- "Obsolete syntax. Please use \"rsh ttl = %s;\"\n", +- $3, ipcacfglineno, $3); +- conf->rsh_ttl = atoi($3); +- free($3); +- } + | NetFlow + | CHROOT EQ TOK_STRING { + if(conf->chroot_to) diff --git a/package/iperf/Makefile b/package/iperf/Makefile index d867dd210..da2c5f156 100644 --- a/package/iperf/Makefile +++ b/package/iperf/Makefile @@ -22,7 +22,7 @@ $(eval $(call PKG_template,IPERF,iperf,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPEN TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) TARGET_CXXFLAGS:= $(filter-out -flto,$(TARGET_CXXFLAGS)) -ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y) +ifeq ($(ADK_TOOLCHAIN_USE_SSP),y) TARGET_LDFLAGS+= -lssp endif diff --git a/package/iproute2/Makefile b/package/iproute2/Makefile index a20bfd0a6..0257e3909 100644 --- a/package/iproute2/Makefile +++ b/package/iproute2/Makefile @@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk PKG_NAME:= iproute2 PKG_VERSION:= 3.12.0 -PKG_RELEASE:= 2 +PKG_RELEASE:= 3 PKG_MD5SUM:= f87386aaaecafab95607fd10e8152c68 PKG_DESCR:= iproute2 routing control utility PKG_SECTION:= route diff --git a/package/iproute2/patches/patch-include_iptables_common_h b/package/iproute2/patches/patch-include_iptables_common_h new file mode 100644 index 000000000..d0ca2c0a2 --- /dev/null +++ b/package/iproute2/patches/patch-include_iptables_common_h @@ -0,0 +1,25 @@ +--- iproute2-3.12.0.orig/include/iptables_common.h 2013-11-23 02:10:33.000000000 +0100 ++++ iproute2-3.12.0/include/iptables_common.h 2014-04-05 05:21:46.946376336 +0200 +@@ -1,5 +1,8 @@ + #ifndef _IPTABLES_COMMON_H + #define _IPTABLES_COMMON_H ++ ++#include <stdint.h> ++ + /* Shared definitions between ipv4 and ipv6. */ + + enum exittype { +@@ -43,9 +46,9 @@ extern char *lib_dir; + extern void init_extensions(void); + #endif + +-#define __be32 u_int32_t +-#define __le32 u_int32_t +-#define __be16 u_int16_t +-#define __le16 u_int16_t ++#define __be32 uint32_t ++#define __le32 uint32_t ++#define __be16 uint16_t ++#define __le16 uint16_t + + #endif /*_IPTABLES_COMMON_H*/ diff --git a/package/iproute2/patches/patch-include_iptables_h b/package/iproute2/patches/patch-include_iptables_h new file mode 100644 index 000000000..ca5f11b3e --- /dev/null +++ b/package/iproute2/patches/patch-include_iptables_h @@ -0,0 +1,38 @@ +--- iproute2-3.12.0.orig/include/iptables.h 2013-11-23 02:10:33.000000000 +0100 ++++ iproute2-3.12.0/include/iptables.h 2014-04-05 05:22:26.690501973 +0200 +@@ -20,7 +20,7 @@ struct ipt_get_revision + { + char name[IPT_FUNCTION_MAXNAMELEN-1]; + +- u_int8_t revision; ++ uint8_t revision; + }; + #endif /* IPT_SO_GET_REVISION_MATCH Old kernel source */ + +@@ -39,7 +39,7 @@ struct iptables_match + ipt_chainlabel name; + + /* Revision of match (0 by default). */ +- u_int8_t revision; ++ uint8_t revision; + + const char *version; + +@@ -92,7 +92,7 @@ struct iptables_target + ipt_chainlabel name; + + /* Revision of target (0 by default). */ +- u_int8_t revision; ++ uint8_t revision; + + const char *version; + +@@ -153,7 +153,7 @@ extern char *mask_to_dotted(const struct + + extern void parse_hostnetworkmask(const char *name, struct in_addr **addrpp, + struct in_addr *maskp, unsigned int *naddrs); +-extern u_int16_t parse_protocol(const char *s); ++extern uint16_t parse_protocol(const char *s); + + extern int do_command(int argc, char *argv[], char **table, + iptc_handle_t *handle); diff --git a/package/iproute2/patches/patch-include_libiptc_ipt_kernel_headers_h b/package/iproute2/patches/patch-include_libiptc_ipt_kernel_headers_h new file mode 100644 index 000000000..bc836c0d1 --- /dev/null +++ b/package/iproute2/patches/patch-include_libiptc_ipt_kernel_headers_h @@ -0,0 +1,25 @@ +--- iproute2-3.12.0.orig/include/libiptc/ipt_kernel_headers.h 2013-11-23 02:10:33.000000000 +0100 ++++ iproute2-3.12.0/include/libiptc/ipt_kernel_headers.h 2014-04-05 05:25:40.983670487 +0200 +@@ -5,22 +5,10 @@ + + #include <limits.h> + +-#if defined(__GLIBC__) && __GLIBC__ == 2 + #include <netinet/ip.h> + #include <netinet/in.h> + #include <netinet/ip_icmp.h> + #include <netinet/tcp.h> + #include <netinet/udp.h> + #include <sys/types.h> +-#else /* libc5 */ +-#include <sys/socket.h> +-#include <linux/ip.h> +-#include <linux/in.h> +-#include <linux/if.h> +-#include <linux/icmp.h> +-#include <linux/tcp.h> +-#include <linux/udp.h> +-#include <linux/types.h> +-#include <linux/in6.h> +-#endif + #endif diff --git a/package/iptables-snmp/Makefile b/package/iptables-snmp/Makefile index 28aa8c8ef..130872cf9 100644 --- a/package/iptables-snmp/Makefile +++ b/package/iptables-snmp/Makefile @@ -13,6 +13,8 @@ PKG_BUILDDEP:= net-snmp PKG_URL:= http://www.nobiscuit.com/iptables-snmp/ PKG_SITES:= http://www.nobiscuit.com/iptables-snmp/ +PKG_LIBC_DEPENDS:= uclibc glibc + include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,IPTABLES_SNMP,iptables-snmp,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/iptables/Makefile b/package/iptables/Makefile index d9fa9fd2a..93e8500d0 100644 --- a/package/iptables/Makefile +++ b/package/iptables/Makefile @@ -5,31 +5,37 @@ include ${TOPDIR}/rules.mk PKG_NAME:= iptables PKG_VERSION:= 1.4.21 -PKG_RELEASE:= 2 +PKG_RELEASE:= 5 PKG_MD5SUM:= 536d048c8e8eeebcd9757d0863ebb0c0 -PKG_DESCR:= The netfilter firewalling software +PKG_DESCR:= netfilter firewalling software PKG_SECTION:= firewall PKG_DEPENDS:= kmod-ip-nf-iptables kmod-nf-conntrack PKG_DEPENDS+= kmod-nf-conntrack-ipv4 kmod-full-nat PKG_DEPENDS+= kmod-ip-nf-target-masquerade kmod-ip-nf-target-reject PKG_DEPENDS+= kmod-ip-nf-filter kmod-ip-nf-match-state PKG_DEPENDS+= kmod-netfilter-xt-target-tcpmss -PKG_DEPENDS+= kmod-ip6-nf-iptables kmod-nf-conntrack-ipv6 -PKG_DEPENDS+= kmod-ip6-nf-filter kmod-ip6-nf-target-reject +PKG_BUILDDEP:= autotool libnetfilter_conntrack PKG_URL:= http://www.netfilter.org/ PKG_SITES:= http://www.netfilter.org/projects/iptables/files/ PKG_OPTS:= dev DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 +PKG_SUBPKGS:= IPTABLES IP6TABLES +PKGSD_IPTABLES:= iptables for IPv4 +PKGSD_IP6TABLES:= iptables for IPv6 +PKGSS_IP6TABLES:= iptables kmod-ip6-nf-iptables kmod-nf-conntrack-ipv6 kmod-ip6-nf-filter kmod-ip6-nf-target-reject + include ${TOPDIR}/mk/package.mk # right now default extensions are builtin # use --disable-static in CONFIGURE_ARGS to change and optimize package #include ${LINUX_DIR}/.config -$(eval $(call PKG_template,IPTABLES,iptables,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) +$(eval $(call PKG_template,IPTABLES,iptables,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_IPTABLES},${PKG_SECTION},${PKG_OPTS})) +$(eval $(call PKG_template,IP6TABLES,ip6tables,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_IP6TABLES},${PKGSD_IP6TABLES},${PKG_SECTION},${PKG_OPTS})) +AUTOTOOL_STYLE:= autoreconf TARGET_LDFLAGS+= -fPIC CONFIGURE_ARGS+= --enable-devel @@ -41,9 +47,11 @@ iptables-install: ${CP} ${WRKINST}/usr/lib/libiptc.so* ${IDIR_IPTABLES}/usr/lib ${CP} ${WRKINST}/usr/lib/libip4tc.so* ${IDIR_IPTABLES}/usr/lib ${CP} ${WRKINST}/usr/lib/libxtables.so* ${IDIR_IPTABLES}/usr/lib - ${INSTALL_DIR} ${IDIR_IPTABLES}/{usr/lib,etc,usr/sbin} - ${INSTALL_DATA} ./files/firewall6.conf ${IDIR_IPTABLES}/etc - ${CP} ${WRKINST}/usr/sbin/ip6tables ${IDIR_IPTABLES}/usr/sbin - ${CP} ${WRKINST}/usr/lib/libip6tc.so* ${IDIR_IPTABLES}/usr/lib + +ip6tables-install: + ${INSTALL_DIR} ${IDIR_IP6TABLES}/{usr/lib,etc,usr/sbin} + ${INSTALL_DATA} ./files/firewall6.conf ${IDIR_IP6TABLES}/etc + ${CP} ${WRKINST}/usr/sbin/ip6tables ${IDIR_IP6TABLES}/usr/sbin + ${CP} ${WRKINST}/usr/lib/libip6tc.so* ${IDIR_IP6TABLES}/usr/lib include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/iptables/files/firewall6.init b/package/iptables/files/firewall6.init index bedb639a9..162b98a4f 100755 --- a/package/iptables/files/firewall6.init +++ b/package/iptables/files/firewall6.init @@ -1,5 +1,5 @@ #!/bin/sh -#PKG iptables +#PKG ip6tables #INIT 45 . /etc/rc.conf diff --git a/package/osiris/files/osirisd.postinst b/package/iptables/files/ip6tables.postinst index 04e53ac93..09645104b 100644 --- a/package/osiris/files/osirisd.postinst +++ b/package/iptables/files/ip6tables.postinst @@ -1,3 +1,4 @@ #!/bin/sh . $IPKG_INSTROOT/etc/functions.sh -add_rcconf osirisd osirisd NO + +add_rcconf iptables firewall6 NO diff --git a/package/iptables/files/iptables.postinst b/package/iptables/files/iptables.postinst index b418e73f9..89b0af164 100644 --- a/package/iptables/files/iptables.postinst +++ b/package/iptables/files/iptables.postinst @@ -2,4 +2,3 @@ . $IPKG_INSTROOT/etc/functions.sh add_rcconf iptables firewall NO -add_rcconf iptables firewall6 NO diff --git a/package/iptables/patches/patch-extensions_GNUmakefile_in b/package/iptables/patches/patch-extensions_GNUmakefile_in new file mode 100644 index 000000000..cc922cc28 --- /dev/null +++ b/package/iptables/patches/patch-extensions_GNUmakefile_in @@ -0,0 +1,28 @@ +--- iptables-1.4.21.orig/extensions/GNUmakefile.in 2013-11-22 12:18:13.000000000 +0100 ++++ iptables-1.4.21/extensions/GNUmakefile.in 2014-04-08 11:49:28.000000000 +0200 +@@ -21,7 +21,7 @@ regular_CPPFLAGS = @regular_CPPFLAGS@ + kinclude_CPPFLAGS = @kinclude_CPPFLAGS@ + + AM_CFLAGS = ${regular_CFLAGS} +-AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_builddir} -I${top_srcdir}/include ${kinclude_CPPFLAGS} ${CPPFLAGS} ++AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_builddir} -I${top_srcdir}/include ${kinclude_CPPFLAGS} ${CPPFLAGS} @libnetfilter_conntrack_CFLAGS@ + AM_DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@ + AM_LDFLAGS = @noundef_LDFLAGS@ + +@@ -93,7 +93,7 @@ lib%.so: lib%.oo + ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $< -L../libxtables/.libs -lxtables ${$*_LIBADD}; + + lib%.oo: ${srcdir}/lib%.c +- ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=lib$*_init -DPIC -fPIC ${CFLAGS} ${$*_CFLAGADD} -o $@ -c $<; ++ ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=lib$*_init -DPIC -fPIC ${CFLAGS} -o $@ -c $<; + + libxt_NOTRACK.so: libxt_CT.so + ln -fs $< $@ +@@ -106,6 +106,7 @@ xt_statistic_LIBADD = -lm + @HAVE_LIBNETFILTER_CONNTRACK_TRUE@xt_connlabel_LIBADD = @libnetfilter_conntrack_LIBS@ + + @HAVE_LIBNETFILTER_CONNTRACK_TRUE@xt_connlabel_CFLAGADD = @libnetfilter_conntrack_CFLAGS@ ++xt_connlabel_LIBADD = @libnetfilter_conntrack_LIBS@ + + # + # Static bits diff --git a/package/iptables/patches/patch-libxtables_Makefile_am b/package/iptables/patches/patch-libxtables_Makefile_am new file mode 100644 index 000000000..d05a100aa --- /dev/null +++ b/package/iptables/patches/patch-libxtables_Makefile_am @@ -0,0 +1,11 @@ +--- iptables-1.4.21.orig/libxtables/Makefile.am 2013-11-22 12:18:13.000000000 +0100 ++++ iptables-1.4.21/libxtables/Makefile.am 2014-04-08 11:51:20.000000000 +0200 +@@ -10,7 +10,7 @@ libxtables_la_LIBADD = + if ENABLE_STATIC + # With --enable-static, shipped extensions are linked into the main executable, + # so we need all the LIBADDs here too +-libxtables_la_LIBADD += -lm ++libxtables_la_LIBADD += -lm ${libnetfilter_conntrack_LIBS} + endif + if ENABLE_SHARED + libxtables_la_CFLAGS = ${AM_CFLAGS} diff --git a/package/kbd/Makefile b/package/kbd/Makefile index 0293849de..7923783ca 100644 --- a/package/kbd/Makefile +++ b/package/kbd/Makefile @@ -4,17 +4,22 @@ include $(TOPDIR)/rules.mk PKG_NAME:= kbd -PKG_VERSION:= 1.15.3 -PKG_RELEASE:= 1 -PKG_MD5SUM:= 8143e179a0f3c25646ce5085e8777200 +PKG_VERSION:= 2.0.1 +PKG_RELEASE:= 2 +PKG_MD5SUM:= e9f2b7046312c11cec9e52e22f307b6a PKG_DESCR:= keyboard utility PKG_SECTION:= utils -PKG_SITES:= ftp://ftp.altlinux.org/pub/people/legion/kbd/ +PKG_DEPENDS:= libcheck +PKG_BUILDDEP:= flex-host bison-host check +PKG_URL:= http://kbd-project.org/ +PKG_SITES:= http://kbd-project.org/download/ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,KBD,kbd,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +CONFIGURE_ARGS+= --disable-vlock + kbd-install: $(INSTALL_DIR) $(IDIR_KBD)/usr/bin $(INSTALL_BIN) $(WRKINST)/usr/bin/loadkeys \ diff --git a/package/kbd/patches/patch-src_dumpkeys_c b/package/kbd/patches/patch-src_dumpkeys_c new file mode 100644 index 000000000..f77b2d841 --- /dev/null +++ b/package/kbd/patches/patch-src_dumpkeys_c @@ -0,0 +1,11 @@ +--- kbd-2.0.1.orig/src/dumpkeys.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/src/dumpkeys.c 2014-03-24 22:38:21.000000000 +0100 +@@ -3,6 +3,8 @@ + * + * derived from version 0.81 - aeb@cwi.nl + */ ++ ++#include <stdarg.h> + #include <stdio.h> + #include <stdlib.h> + #include <ctype.h> diff --git a/package/kbd/patches/patch-src_kbdinfo_c b/package/kbd/patches/patch-src_kbdinfo_c new file mode 100644 index 000000000..cd322eb3c --- /dev/null +++ b/package/kbd/patches/patch-src_kbdinfo_c @@ -0,0 +1,46 @@ +--- kbd-2.0.1.orig/src/kbdinfo.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/src/kbdinfo.c 2014-03-24 13:24:51.000000000 +0100 +@@ -1,6 +1,6 @@ + #include <stdio.h> + #include <errno.h> +-#include <error.h> ++#include <err.h> + #include <unistd.h> + #include <sys/ioctl.h> + #include <linux/kd.h> +@@ -75,7 +75,7 @@ main(int argc, char **argv) { + + if (!strcasecmp("GETMODE", action)) { + if (ioctl(fd, KDGETMODE, &mode) == -1) +- error(EXIT_FAILURE, errno, "ioctl"); ++ err(EXIT_FAILURE, "ioctl"); + + switch (mode) { + case KD_TEXT: rc = answer("text"); break; +@@ -84,7 +84,7 @@ main(int argc, char **argv) { + + } else if (!strcasecmp("GKBMODE", action)) { + if (ioctl(fd, KDGKBMODE, &mode) == -1) +- error(EXIT_FAILURE, errno, "ioctl"); ++ err(EXIT_FAILURE, "ioctl"); + + switch (mode) { + case K_RAW: rc = answer("raw"); break; +@@ -95,7 +95,7 @@ main(int argc, char **argv) { + + } else if (!strcasecmp("GKBMETA", action)) { + if (ioctl(fd, KDGKBMETA, &mode) == -1) +- error(EXIT_FAILURE, errno, "ioctl"); ++ err(EXIT_FAILURE, "ioctl"); + + switch (mode) { + case K_METABIT: rc = answer("metabit"); break; +@@ -104,7 +104,7 @@ main(int argc, char **argv) { + + } else if (!strcasecmp("GKBLED", action)) { + if (ioctl(fd, KDGKBLED, &flags) == -1) +- error(EXIT_FAILURE, errno, "ioctl"); ++ err(EXIT_FAILURE, "ioctl"); + + mode = (flags & 0x7); + diff --git a/package/kbd/patches/patch-src_kbdrate_c b/package/kbd/patches/patch-src_kbdrate_c new file mode 100644 index 000000000..8d267789d --- /dev/null +++ b/package/kbd/patches/patch-src_kbdrate_c @@ -0,0 +1,10 @@ +--- kbd-2.0.1.orig/src/kbdrate.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/src/kbdrate.c 2014-03-24 12:40:34.000000000 +0100 +@@ -68,6 +68,7 @@ beats rebuilding the kernel! + + */ + ++#include <fcntl.h> + #include <stdio.h> + #include <unistd.h> + #include <stdlib.h> diff --git a/package/kbd/patches/patch-src_libkeymap_analyze_l b/package/kbd/patches/patch-src_libkeymap_analyze_l new file mode 100644 index 000000000..56396f23e --- /dev/null +++ b/package/kbd/patches/patch-src_libkeymap_analyze_l @@ -0,0 +1,11 @@ +--- kbd-2.0.1.orig/src/libkeymap/analyze.l 2013-10-04 15:28:49.000000000 +0200 ++++ kbd-2.0.1/src/libkeymap/analyze.l 2014-03-24 22:34:35.000000000 +0100 +@@ -12,6 +12,8 @@ + %} + + %top { ++#include <stdarg.h> ++#include <stdio.h> + #include "keymap.h" + int stack_push(struct lk_ctx *ctx, lkfile_t *fp, void *scanner); + int stack_pop(struct lk_ctx *ctx, void *scanner); diff --git a/package/kbd/patches/patch-src_libkeymap_common_c b/package/kbd/patches/patch-src_libkeymap_common_c new file mode 100644 index 000000000..bbdb8726f --- /dev/null +++ b/package/kbd/patches/patch-src_libkeymap_common_c @@ -0,0 +1,8 @@ +--- kbd-2.0.1.orig/src/libkeymap/common.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/src/libkeymap/common.c 2014-03-24 21:30:58.000000000 +0100 +@@ -1,4 +1,5 @@ + #include <string.h> ++#include <stdio.h> + #include <stdlib.h> + #include <stdarg.h> + diff --git a/package/kbd/patches/patch-src_libkeymap_dump_c b/package/kbd/patches/patch-src_libkeymap_dump_c new file mode 100644 index 000000000..cf3aca4d8 --- /dev/null +++ b/package/kbd/patches/patch-src_libkeymap_dump_c @@ -0,0 +1,12 @@ +--- kbd-2.0.1.orig/src/libkeymap/dump.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/src/libkeymap/dump.c 2014-03-24 21:46:08.000000000 +0100 +@@ -9,6 +9,9 @@ + * This file is covered by the GNU General Public License, + * which should be included with kbd as the file COPYING. + */ ++ ++#include <sys/types.h> ++#include <stdarg.h> + #include <stdio.h> + #include <string.h> + #include <ctype.h> diff --git a/package/kbd/patches/patch-src_libkeymap_kernel_c b/package/kbd/patches/patch-src_libkeymap_kernel_c new file mode 100644 index 000000000..70cff9735 --- /dev/null +++ b/package/kbd/patches/patch-src_libkeymap_kernel_c @@ -0,0 +1,13 @@ +--- kbd-2.0.1.orig/src/libkeymap/kernel.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/src/libkeymap/kernel.c 2014-03-24 21:45:01.000000000 +0100 +@@ -6,7 +6,10 @@ + * This file is covered by the GNU General Public License, + * which should be included with kbd as the file COPYING. + */ ++ ++#include <stdarg.h> + #include <string.h> ++#include <stdio.h> + #include <errno.h> + #include <sys/ioctl.h> + diff --git a/package/kbd/patches/patch-src_libkeymap_kmap_c b/package/kbd/patches/patch-src_libkeymap_kmap_c new file mode 100644 index 000000000..3f945e5da --- /dev/null +++ b/package/kbd/patches/patch-src_libkeymap_kmap_c @@ -0,0 +1,10 @@ +--- kbd-2.0.1.orig/src/libkeymap/kmap.c 2013-10-07 16:13:31.000000000 +0200 ++++ kbd-2.0.1/src/libkeymap/kmap.c 2014-03-24 21:46:56.000000000 +0100 +@@ -1,4 +1,7 @@ ++#include <sys/types.h> ++#include <stdarg.h> + #include <stdlib.h> ++#include <stdio.h> + #include <string.h> + + #include "nls.h" diff --git a/package/kbd/patches/patch-src_libkeymap_ksyms_c b/package/kbd/patches/patch-src_libkeymap_ksyms_c new file mode 100644 index 000000000..13c1be329 --- /dev/null +++ b/package/kbd/patches/patch-src_libkeymap_ksyms_c @@ -0,0 +1,8 @@ +--- kbd-2.0.1.orig/src/libkeymap/ksyms.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/src/libkeymap/ksyms.c 2014-03-24 22:37:11.000000000 +0100 +@@ -1,4 +1,5 @@ + #include <linux/keyboard.h> ++#include <stdarg.h> + #include <stdio.h> + #include <string.h> + #include <stdlib.h> diff --git a/package/kbd/patches/patch-src_libkeymap_loadkeys_c b/package/kbd/patches/patch-src_libkeymap_loadkeys_c new file mode 100644 index 000000000..ca368041b --- /dev/null +++ b/package/kbd/patches/patch-src_libkeymap_loadkeys_c @@ -0,0 +1,8 @@ +--- kbd-2.0.1.orig/src/libkeymap/loadkeys.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/src/libkeymap/loadkeys.c 2014-03-24 21:48:35.000000000 +0100 +@@ -1,4 +1,5 @@ + #include <errno.h> ++#include <stdarg.h> + #include <stdlib.h> + #include <string.h> + #include <sys/ioctl.h> diff --git a/package/kbd/patches/patch-src_libkeymap_parser_y b/package/kbd/patches/patch-src_libkeymap_parser_y new file mode 100644 index 000000000..f06797961 --- /dev/null +++ b/package/kbd/patches/patch-src_libkeymap_parser_y @@ -0,0 +1,11 @@ +--- kbd-2.0.1.orig/src/libkeymap/parser.y 2013-10-07 16:13:39.000000000 +0200 ++++ kbd-2.0.1/src/libkeymap/parser.y 2014-03-24 21:49:52.000000000 +0100 +@@ -12,6 +12,8 @@ + %{ + #define YY_HEADER_EXPORT_START_CONDITIONS 1 + ++#include <stdarg.h> ++ + #include "nls.h" + #include "kbd.h" + diff --git a/package/kbd/patches/patch-src_libkeymap_summary_c b/package/kbd/patches/patch-src_libkeymap_summary_c new file mode 100644 index 000000000..de2ec90b7 --- /dev/null +++ b/package/kbd/patches/patch-src_libkeymap_summary_c @@ -0,0 +1,13 @@ +--- kbd-2.0.1.orig/src/libkeymap/summary.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/src/libkeymap/summary.c 2014-03-24 21:47:48.000000000 +0100 +@@ -6,6 +6,10 @@ + * This file is covered by the GNU General Public License, + * which should be included with kbd as the file COPYING. + */ ++ ++#include <sys/types.h> ++#include <stdarg.h> ++#include <stdio.h> + #include <string.h> + #include <errno.h> + #include <sys/ioctl.h> diff --git a/package/kbd/patches/patch-src_loadkeys_c b/package/kbd/patches/patch-src_loadkeys_c new file mode 100644 index 000000000..11d44825f --- /dev/null +++ b/package/kbd/patches/patch-src_loadkeys_c @@ -0,0 +1,10 @@ +--- kbd-2.0.1.orig/src/loadkeys.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/src/loadkeys.c 2014-03-24 22:39:26.000000000 +0100 +@@ -10,6 +10,7 @@ + * which should be included with kbd as the file COPYING. + */ + ++#include <stdarg.h> + #include <stdio.h> + #include <stdlib.h> + #include <string.h> diff --git a/package/kbd/patches/patch-src_openvt_c b/package/kbd/patches/patch-src_openvt_c new file mode 100644 index 000000000..efb8736cc --- /dev/null +++ b/package/kbd/patches/patch-src_openvt_c @@ -0,0 +1,8 @@ +--- kbd-2.0.1.orig/src/openvt.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/src/openvt.c 2014-03-24 12:48:07.000000000 +0100 +@@ -1,3 +1,5 @@ ++#include <fcntl.h> ++#include <limits.h> + #include <stdio.h> + #include <stdarg.h> + #include <unistd.h> diff --git a/package/kbd/patches/patch-src_setvtrgb_c b/package/kbd/patches/patch-src_setvtrgb_c new file mode 100644 index 000000000..fc72c2409 --- /dev/null +++ b/package/kbd/patches/patch-src_setvtrgb_c @@ -0,0 +1,70 @@ +--- kbd-2.0.1.orig/src/setvtrgb.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/src/setvtrgb.c 2014-03-24 13:10:47.000000000 +0100 +@@ -5,7 +5,7 @@ + #include <sys/ioctl.h> + #include <linux/kd.h> + #include <errno.h> +-#include <error.h> ++#include <err.h> + #include "kbd.h" + #include "getfd.h" + #include "nls.h" +@@ -60,7 +60,7 @@ set_colormap(unsigned char *colormap) + + /* Apply the color map to the tty via ioctl */ + if (ioctl(fd, PIO_CMAP, colormap) == -1) +- error(EXIT_FAILURE, errno, "ioctl"); ++ err(EXIT_FAILURE, "ioctl"); + + close(fd); + } +@@ -72,7 +72,7 @@ parse_file(FILE *fd, const char *filenam + unsigned int rows, cols, val; + + if ((cmap = calloc(3 * 16, sizeof(unsigned char))) == NULL) +- error(EXIT_FAILURE, errno, "calloc"); ++ err(EXIT_FAILURE, "calloc"); + + for (rows = 0; rows < 3; rows++) { + cols = 0; +@@ -80,26 +80,26 @@ parse_file(FILE *fd, const char *filenam + while (cols < 16) { + if ((c = fscanf(fd, "%u", &val)) != 1) { + if (c == EOF) +- error(EXIT_FAILURE, errno, "fscanf"); ++ err(EXIT_FAILURE, "fscanf"); + +- error(EXIT_FAILURE, 0, _("Error: %s: Invalid value in field %u in line %u."), ++ err(EXIT_FAILURE, _("Error: %s: Invalid value in field %u in line %u."), + filename, rows + 1, cols + 1); + } + + cmap[rows + cols * 3] = (unsigned char) val; + + if (cols < 15 && fgetc(fd) != ',') +- error(EXIT_FAILURE, 0, _("Error: %s: Insufficient number of fields in line %u."), ++ err(EXIT_FAILURE, _("Error: %s: Insufficient number of fields in line %u."), + filename, rows + 1); + cols++; + } + + if ((c = fgetc(fd)) == EOF) +- error(EXIT_FAILURE, 0, _("Error: %s: Line %u has ended unexpectedly.\n"), ++ err(EXIT_FAILURE, _("Error: %s: Line %u has ended unexpectedly.\n"), + filename, rows + 1); + + if (c != '\n') +- error(EXIT_FAILURE, 0, _("Error: %s: Line %u is too long.\n"), ++ err(EXIT_FAILURE, _("Error: %s: Line %u is too long.\n"), + filename, rows + 1); + } + } +@@ -141,7 +141,7 @@ main(int argc, char **argv) { + + } else { + if ((fd = fopen(file, "r")) == NULL) +- error(EXIT_FAILURE, errno, "fopen"); ++ err(EXIT_FAILURE, "fopen"); + + parse_file(fd, file); + fclose(fd); diff --git a/package/kbd/patches/patch-tests_libkeymap-bkeymap_c b/package/kbd/patches/patch-tests_libkeymap-bkeymap_c new file mode 100644 index 000000000..66247229b --- /dev/null +++ b/package/kbd/patches/patch-tests_libkeymap-bkeymap_c @@ -0,0 +1,7 @@ +--- kbd-2.0.1.orig/tests/libkeymap-bkeymap.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/tests/libkeymap-bkeymap.c 2014-03-24 22:43:01.000000000 +0100 +@@ -1,3 +1,4 @@ ++#include <stdarg.h> + #include <stdio.h> + #include <stdlib.h> + #include <string.h> diff --git a/package/kbd/patches/patch-tests_libkeymap-charset_c b/package/kbd/patches/patch-tests_libkeymap-charset_c new file mode 100644 index 000000000..629bc06cd --- /dev/null +++ b/package/kbd/patches/patch-tests_libkeymap-charset_c @@ -0,0 +1,7 @@ +--- kbd-2.0.1.orig/tests/libkeymap-charset.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/tests/libkeymap-charset.c 2014-03-24 22:51:27.000000000 +0100 +@@ -1,3 +1,4 @@ ++#include <stdarg.h> + #include <stdio.h> + #include <stdlib.h> + #include <check.h> diff --git a/package/kbd/patches/patch-tests_libkeymap-dumpkeys_c b/package/kbd/patches/patch-tests_libkeymap-dumpkeys_c new file mode 100644 index 000000000..85c242608 --- /dev/null +++ b/package/kbd/patches/patch-tests_libkeymap-dumpkeys_c @@ -0,0 +1,7 @@ +--- kbd-2.0.1.orig/tests/libkeymap-dumpkeys.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/tests/libkeymap-dumpkeys.c 2014-03-24 22:40:50.000000000 +0100 +@@ -1,3 +1,4 @@ ++#include <stdarg.h> + #include <stdio.h> + #include <stdlib.h> + #include <string.h> diff --git a/package/kbd/patches/patch-tests_libkeymap-init_c b/package/kbd/patches/patch-tests_libkeymap-init_c new file mode 100644 index 000000000..7c9d9f1e1 --- /dev/null +++ b/package/kbd/patches/patch-tests_libkeymap-init_c @@ -0,0 +1,7 @@ +--- kbd-2.0.1.orig/tests/libkeymap-init.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/tests/libkeymap-init.c 2014-03-24 22:45:25.000000000 +0100 +@@ -1,3 +1,4 @@ ++#include <stdarg.h> + #include <stdio.h> + #include <stdlib.h> + #include <check.h> diff --git a/package/kbd/patches/patch-tests_libkeymap-keys_c b/package/kbd/patches/patch-tests_libkeymap-keys_c new file mode 100644 index 000000000..b2656fa25 --- /dev/null +++ b/package/kbd/patches/patch-tests_libkeymap-keys_c @@ -0,0 +1,7 @@ +--- kbd-2.0.1.orig/tests/libkeymap-keys.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/tests/libkeymap-keys.c 2014-03-24 22:49:03.000000000 +0100 +@@ -1,3 +1,4 @@ ++#include <stdarg.h> + #include <stdio.h> + #include <stdlib.h> + #include <check.h> diff --git a/package/kbd/patches/patch-tests_libkeymap-kmap_c b/package/kbd/patches/patch-tests_libkeymap-kmap_c new file mode 100644 index 000000000..a07347d55 --- /dev/null +++ b/package/kbd/patches/patch-tests_libkeymap-kmap_c @@ -0,0 +1,7 @@ +--- kbd-2.0.1.orig/tests/libkeymap-kmap.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/tests/libkeymap-kmap.c 2014-03-24 22:46:30.000000000 +0100 +@@ -1,3 +1,4 @@ ++#include <stdarg.h> + #include <stdio.h> + #include <stdlib.h> + #include <check.h> diff --git a/package/kbd/patches/patch-tests_libkeymap-mktable_c b/package/kbd/patches/patch-tests_libkeymap-mktable_c new file mode 100644 index 000000000..adc5b722d --- /dev/null +++ b/package/kbd/patches/patch-tests_libkeymap-mktable_c @@ -0,0 +1,7 @@ +--- kbd-2.0.1.orig/tests/libkeymap-mktable.c 2013-08-27 22:45:33.000000000 +0200 ++++ kbd-2.0.1/tests/libkeymap-mktable.c 2014-03-24 22:41:52.000000000 +0100 +@@ -1,3 +1,4 @@ ++#include <stdarg.h> + #include <stdio.h> + #include <stdlib.h> + #include <string.h> diff --git a/package/kbd/patches/patch-tests_libkeymap-parse_c b/package/kbd/patches/patch-tests_libkeymap-parse_c new file mode 100644 index 000000000..53293e773 --- /dev/null +++ b/package/kbd/patches/patch-tests_libkeymap-parse_c @@ -0,0 +1,7 @@ +--- kbd-2.0.1.orig/tests/libkeymap-parse.c 2013-10-07 14:55:01.000000000 +0200 ++++ kbd-2.0.1/tests/libkeymap-parse.c 2014-03-24 22:50:11.000000000 +0100 +@@ -1,3 +1,4 @@ ++#include <stdarg.h> + #include <stdio.h> + #include <stdlib.h> + #include <check.h> diff --git a/package/kbd/patches/patch-tests_libkeymap-showmaps_c b/package/kbd/patches/patch-tests_libkeymap-showmaps_c new file mode 100644 index 000000000..29bc6dea9 --- /dev/null +++ b/package/kbd/patches/patch-tests_libkeymap-showmaps_c @@ -0,0 +1,7 @@ +--- kbd-2.0.1.orig/tests/libkeymap-showmaps.c 2013-10-07 16:13:31.000000000 +0200 ++++ kbd-2.0.1/tests/libkeymap-showmaps.c 2014-03-24 22:44:16.000000000 +0100 +@@ -1,3 +1,4 @@ ++#include <stdarg.h> + #include <stdio.h> + #include <stdlib.h> + #include <string.h> diff --git a/package/libatomic_ops/Makefile b/package/libatomic_ops/Makefile new file mode 100644 index 000000000..9ead522d7 --- /dev/null +++ b/package/libatomic_ops/Makefile @@ -0,0 +1,30 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include $(TOPDIR)/rules.mk + +PKG_NAME:= libatomic_ops +PKG_VERSION:= 7.4.0 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 59f9a7cc845dcc775e7b7901eb582766 +PKG_DESCR:= atomic operations library +PKG_SECTION:= libs +PKG_URL:= http://www.hboehm.info/gc/ +PKG_SITES:= http://www.hboehm.info/gc/gc_source/ +PKG_OPTS:= dev + +include $(TOPDIR)/mk/host.mk +include $(TOPDIR)/mk/package.mk + +$(eval $(call HOST_template,LIBATOMIC_OPS,libatomic_ops,$(PKG_VERSION)-${PKG_RELEASE})) +$(eval $(call PKG_template,LIBATOMIC_OPS,libatomic_ops,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) + +HOST_STYLE:= auto + +libatomic_ops-install: + $(INSTALL_DIR) $(IDIR_LIBATOMIC_OPS)/usr/lib + $(CP) $(WRKINST)/usr/lib/libatomic_ops*.so* \ + $(IDIR_LIBATOMIC_OPS)/usr/lib + +include ${TOPDIR}/mk/host-bottom.mk +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/libcdio/Makefile b/package/libcdio/Makefile index 5584063b1..5ec7ffbf4 100644 --- a/package/libcdio/Makefile +++ b/package/libcdio/Makefile @@ -4,11 +4,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:= libcdio -PKG_VERSION:= 0.90 -PKG_RELEASE:= 3 -PKG_MD5SUM:= 1b245b023fb03a58d030fd2800db3247 -PKG_DESCR:= a library for CD-ROM and CD image access +PKG_VERSION:= 0.92 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 86f3f2869c1d34e4c6e52db77992b918 +PKG_DESCR:= library for CD-ROM and CD image access PKG_SECTION:= libs +PKG_BUILDDEP:= libiconv-tiny PKG_URL:= http://www.gnu.org/software/libcdio PKG_SITES:= ${MASTER_SITE_GNU:=libcdio/} PKG_OPTS:= dev diff --git a/package/libcec/Makefile b/package/libcec/Makefile index 4f07c5bae..e4380c197 100644 --- a/package/libcec/Makefile +++ b/package/libcec/Makefile @@ -5,13 +5,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:= libcec PKG_VERSION:= 2.1.4 -PKG_RELEASE:= 2 +PKG_RELEASE:= 3 PKG_MD5SUM:= d65e52ab3295e9e4b73bf4580f3bd4f7 PKG_DESCR:= control your device with your TV remote control PKG_SECTION:= libs PKG_BUILDDEP:= autotool PKG_URL:= http://libcec.pulse-eight.com/ -PKG_SITES:= http://www.openadk.org/distfiles +PKG_SITES:= http://packages.pulse-eight.net/pulse/sources/libcec/ PKG_OPTS:= dev PKG_DEPENDS_RASPBERRY_PI:= bcm2835-vc diff --git a/package/libffi/Makefile b/package/libffi/Makefile index 0b316720d..a7e957582 100644 --- a/package/libffi/Makefile +++ b/package/libffi/Makefile @@ -10,6 +10,7 @@ PKG_MD5SUM:= 45f3b6dbc9ee7c7dfbbbc5feba571529 PKG_DESCR:= Foreign Function Interface library PKG_SECTION:= libs PKG_BUILDDEP:= autotool libffi-host +HOST_BUILDDEP:= autotool PKG_URL:= http://sourceware.org/libffi/ PKG_SITES:= ftp://sourceware.org/pub/libffi/ PKG_OPTS:= dev diff --git a/package/libgc/Makefile b/package/libgc/Makefile new file mode 100644 index 000000000..731c7f98b --- /dev/null +++ b/package/libgc/Makefile @@ -0,0 +1,35 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include $(TOPDIR)/rules.mk + +PKG_NAME:= libgc +PKG_VERSION:= 7.4.0 +PKG_RELEASE:= 2 +PKG_MD5SUM:= f40d9a47c90d60791eeecb484f8df5ee +PKG_DESCR:= garbage collector library +PKG_SECTION:= libs +PKG_BUILDDEP:= libatomic_ops +HOST_BUILDDEP:= libatomic_ops-host +PKG_URL:= http://www.hboehm.info/gc/ +PKG_SITES:= http://www.hboehm.info/gc/gc_source/ +PKG_OPTS:= dev + +DISTFILES= gc-${PKG_VERSION}.tar.gz +WRKDIST= ${WRKDIR}/gc-${PKG_VERSION} + +include $(TOPDIR)/mk/host.mk +include $(TOPDIR)/mk/package.mk + +$(eval $(call HOST_template,LIBGC,libgc,$(PKG_VERSION)-${PKG_RELEASE})) +$(eval $(call PKG_template,LIBGC,libgc,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) + +HOST_STYLE:= auto + +libgc-install: + $(INSTALL_DIR) $(IDIR_LIBGC)/usr/lib + $(CP) $(WRKINST)/usr/lib/libgc*.so* \ + $(IDIR_LIBGC)/usr/lib + +include ${TOPDIR}/mk/host-bottom.mk +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/libgc/patches/patch-os_dep_c b/package/libgc/patches/patch-os_dep_c new file mode 100644 index 000000000..6a5e00f87 --- /dev/null +++ b/package/libgc/patches/patch-os_dep_c @@ -0,0 +1,39 @@ +--- gc-7.4.0.orig/os_dep.c 2013-11-15 21:11:03.000000000 +0100 ++++ gc-7.4.0/os_dep.c 2014-04-10 07:14:09.000000000 +0200 +@@ -16,36 +16,6 @@ + + #include "private/gc_priv.h" + +-#if defined(LINUX) && !defined(POWERPC) && !defined(NO_SIGCONTEXT_H) +-# include <linux/version.h> +-# if (LINUX_VERSION_CODE <= 0x10400) +- /* Ugly hack to get struct sigcontext_struct definition. Required */ +- /* for some early 1.3.X releases. Will hopefully go away soon. */ +- /* in some later Linux releases, asm/sigcontext.h may have to */ +- /* be included instead. */ +-# define __KERNEL__ +-# include <asm/signal.h> +-# undef __KERNEL__ +-# else +- /* Kernels prior to 2.1.1 defined struct sigcontext_struct instead of */ +- /* struct sigcontext. libc6 (glibc2) uses "struct sigcontext" in */ +- /* prototypes, so we have to include the top-level sigcontext.h to */ +- /* make sure the former gets defined to be the latter if appropriate. */ +-# include <features.h> +-# if 2 <= __GLIBC__ +-# if 2 == __GLIBC__ && 0 == __GLIBC_MINOR__ +- /* glibc 2.1 no longer has sigcontext.h. But signal.h */ +- /* has the right declaration for glibc 2.1. */ +-# include <sigcontext.h> +-# endif /* 0 == __GLIBC_MINOR__ */ +-# else /* __GLIBC__ < 2 */ +- /* libc5 doesn't have <sigcontext.h>: go directly with the kernel */ +- /* one. Check LINUX_VERSION_CODE to see which we should reference. */ +-# include <asm/sigcontext.h> +-# endif /* __GLIBC__ < 2 */ +-# endif +-#endif /* LINUX && !POWERPC */ +- + #if !defined(OS2) && !defined(PCR) && !defined(AMIGA) && !defined(MACOS) \ + && !defined(MSWINCE) && !defined(__CC_ARM) + # include <sys/types.h> diff --git a/package/libjasper/Makefile b/package/libjasper/Makefile index fe9bb528f..e4b45a1fd 100644 --- a/package/libjasper/Makefile +++ b/package/libjasper/Makefile @@ -20,6 +20,8 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,LIBJASPER,libjasper,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) +XAKE_FLAGS+= GCC_HONOUR_COPTS=s + libjasper-install: $(INSTALL_DIR) $(IDIR_LIBJASPER)/usr/lib $(CP) $(WRKINST)/usr/lib/libjasper*.so* \ diff --git a/package/liblzo/Makefile b/package/liblzo/Makefile index 3f79d0317..cd6783111 100644 --- a/package/liblzo/Makefile +++ b/package/liblzo/Makefile @@ -9,7 +9,6 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 95380bd4081f85ef08c5209f4107e9f8 PKG_DESCR:= a real-time data compression library PKG_SECTION:= libs -PKG_BUILDDEP:= liblzo-host PKG_URL:= http://www.oberhumer.com/opensource/lzo PKG_SITES:= http://www.oberhumer.com/opensource/lzo/download/ PKG_LIBNAME:= liblzo diff --git a/package/libmodplug/Makefile b/package/libmodplug/Makefile index f08435ee4..421243c03 100644 --- a/package/libmodplug/Makefile +++ b/package/libmodplug/Makefile @@ -4,13 +4,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:= libmodplug -PKG_VERSION:= 0.8.8.4 -PKG_RELEASE:= 2 -PKG_MD5SUM:= fddc3c704c5489de2a3cf0fedfec59db +PKG_VERSION:= 0.8.8.5 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 5f30241db109d647781b784e62ddfaa1 PKG_DESCR:= a MOD player library PKG_SECTION:= libs PKG_URL:= http://modplug-xmms.sourceforge.net -PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=modplug-xmms/libmodplug/0.8.8.4/} +PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=modplug-xmms/libmodplug/0.8.8.5/} PKG_OPTS:= dev include $(TOPDIR)/mk/package.mk diff --git a/package/libnetfilter_conntrack/Makefile b/package/libnetfilter_conntrack/Makefile index 8de196436..90c74f5c1 100644 --- a/package/libnetfilter_conntrack/Makefile +++ b/package/libnetfilter_conntrack/Makefile @@ -4,13 +4,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:= libnetfilter_conntrack -PKG_VERSION:= 1.0.3 +PKG_VERSION:= 1.0.4 PKG_RELEASE:= 2 -PKG_MD5SUM:= 73394a3d8d0cfecc6abb6027b4792d52 +PKG_MD5SUM:= 18cf80c4b339a3285e78822dbd4f08d7 PKG_DESCR:= API to connection tracking state table PKG_SECTION:= libs -PKG_DEPENDS:= libnfnetlink -PKG_BUILDDEP:= libnfnetlink +PKG_DEPENDS:= libnfnetlink libmnl +PKG_BUILDDEP:= libnfnetlink libmnl PKG_URL:= http://www.netfilter.org/projects/libnetfilter_conntrack/ PKG_SITES:= http://www.netfilter.org/projects/libnetfilter_conntrack/files/ PKG_OPTS:= dev diff --git a/package/libnetfilter_conntrack/patches/patch-include_libnetfilter_conntrack_libnetfilter_conntrack_h b/package/libnetfilter_conntrack/patches/patch-include_libnetfilter_conntrack_libnetfilter_conntrack_h new file mode 100644 index 000000000..b8d557cb7 --- /dev/null +++ b/package/libnetfilter_conntrack/patches/patch-include_libnetfilter_conntrack_libnetfilter_conntrack_h @@ -0,0 +1,228 @@ +--- libnetfilter_conntrack-1.0.4.orig/include/libnetfilter_conntrack/libnetfilter_conntrack.h 2013-08-06 15:22:55.000000000 +0200 ++++ libnetfilter_conntrack-1.0.4/include/libnetfilter_conntrack/libnetfilter_conntrack.h 2014-04-10 14:29:23.000000000 +0200 +@@ -10,6 +10,7 @@ + #ifndef _LIBNETFILTER_CONNTRACK_H_ + #define _LIBNETFILTER_CONNTRACK_H_ + ++#include <stdint.h> + #include <netinet/in.h> + #include <libnfnetlink/linux_nfnetlink.h> + #include <libnfnetlink/libnfnetlink.h> +@@ -37,9 +38,9 @@ struct nfct_handle; + /* + * [Open|close] a conntrack handler + */ +-extern struct nfct_handle *nfct_open(u_int8_t, unsigned); ++extern struct nfct_handle *nfct_open(uint8_t, unsigned); + extern struct nfct_handle *nfct_open_nfnl(struct nfnl_handle *nfnlh, +- u_int8_t subsys_id, ++ uint8_t subsys_id, + unsigned int subscriptions); + extern int nfct_close(struct nfct_handle *cth); + +@@ -160,31 +161,31 @@ enum nf_conntrack_attr_grp { + }; + + struct nfct_attr_grp_ipv4 { +- u_int32_t src, dst; ++ uint32_t src, dst; + }; + + struct nfct_attr_grp_ipv6 { +- u_int32_t src[4], dst[4]; ++ uint32_t src[4], dst[4]; + }; + + struct nfct_attr_grp_port { +- u_int16_t sport, dport; ++ uint16_t sport, dport; + }; + + struct nfct_attr_grp_icmp { +- u_int16_t id; +- u_int8_t code, type; ++ uint16_t id; ++ uint8_t code, type; + }; + + struct nfct_attr_grp_ctrs { +- u_int64_t packets; +- u_int64_t bytes; ++ uint64_t packets; ++ uint64_t bytes; + }; + + union nfct_attr_grp_addr { +- u_int32_t ip; +- u_int32_t ip6[4]; +- u_int32_t addr[4]; ++ uint32_t ip; ++ uint32_t ip6[4]; ++ uint32_t addr[4]; + }; + + /* message type */ +@@ -302,19 +303,19 @@ extern void nfct_set_attr(struct nf_conn + + extern void nfct_set_attr_u8(struct nf_conntrack *ct, + const enum nf_conntrack_attr type, +- u_int8_t value); ++ uint8_t value); + + extern void nfct_set_attr_u16(struct nf_conntrack *ct, + const enum nf_conntrack_attr type, +- u_int16_t value); ++ uint16_t value); + + extern void nfct_set_attr_u32(struct nf_conntrack *ct, + const enum nf_conntrack_attr type, +- u_int32_t value); ++ uint32_t value); + + extern void nfct_set_attr_u64(struct nf_conntrack *ct, + const enum nf_conntrack_attr type, +- u_int64_t value); ++ uint64_t value); + + extern void nfct_set_attr_l(struct nf_conntrack *ct, + const enum nf_conntrack_attr type, +@@ -325,16 +326,16 @@ extern void nfct_set_attr_l(struct nf_co + extern const void *nfct_get_attr(const struct nf_conntrack *ct, + const enum nf_conntrack_attr type); + +-extern u_int8_t nfct_get_attr_u8(const struct nf_conntrack *ct, ++extern uint8_t nfct_get_attr_u8(const struct nf_conntrack *ct, + const enum nf_conntrack_attr type); + +-extern u_int16_t nfct_get_attr_u16(const struct nf_conntrack *ct, ++extern uint16_t nfct_get_attr_u16(const struct nf_conntrack *ct, + const enum nf_conntrack_attr type); + +-extern u_int32_t nfct_get_attr_u32(const struct nf_conntrack *ct, ++extern uint32_t nfct_get_attr_u32(const struct nf_conntrack *ct, + const enum nf_conntrack_attr type); + +-extern u_int64_t nfct_get_attr_u64(const struct nf_conntrack *ct, ++extern uint64_t nfct_get_attr_u64(const struct nf_conntrack *ct, + const enum nf_conntrack_attr type); + + /* checker */ +@@ -477,20 +478,20 @@ extern struct nfct_filter *nfct_filter_c + extern void nfct_filter_destroy(struct nfct_filter *filter); + + struct nfct_filter_proto { +- u_int16_t proto; +- u_int16_t state; ++ uint16_t proto; ++ uint16_t state; + }; + struct nfct_filter_ipv4 { +- u_int32_t addr; +- u_int32_t mask; ++ uint32_t addr; ++ uint32_t mask; + }; + struct nfct_filter_ipv6 { +- u_int32_t addr[4]; +- u_int32_t mask[4]; ++ uint32_t addr[4]; ++ uint32_t mask[4]; + }; + + enum nfct_filter_attr { +- NFCT_FILTER_L4PROTO = 0, /* u_int32_t */ ++ NFCT_FILTER_L4PROTO = 0, /* uint32_t */ + NFCT_FILTER_L4PROTO_STATE, /* struct nfct_filter_proto */ + NFCT_FILTER_SRC_IPV4, /* struct nfct_filter_ipv4 */ + NFCT_FILTER_DST_IPV4, /* struct nfct_filter_ipv4 */ +@@ -505,7 +506,7 @@ extern void nfct_filter_add_attr(struct + + extern void nfct_filter_add_attr_u32(struct nfct_filter *filter, + const enum nfct_filter_attr attr, +- const u_int32_t value); ++ const uint32_t value); + + enum nfct_filter_logic { + NFCT_FILTER_LOGIC_POSITIVE, +@@ -525,13 +526,13 @@ extern int nfct_filter_detach(int fd); + struct nfct_filter_dump; + + struct nfct_filter_dump_mark { +- u_int32_t val; +- u_int32_t mask; ++ uint32_t val; ++ uint32_t mask; + }; + + enum nfct_filter_dump_attr { + NFCT_FILTER_DUMP_MARK = 0, /* struct nfct_filter_dump_mark */ +- NFCT_FILTER_DUMP_L3NUM, /* u_int8_t */ ++ NFCT_FILTER_DUMP_L3NUM, /* uint8_t */ + NFCT_FILTER_DUMP_MAX + }; + +@@ -545,7 +546,7 @@ void nfct_filter_dump_set_attr(struct nf + + void nfct_filter_dump_set_attr_u8(struct nfct_filter_dump *filter_dump, + const enum nfct_filter_dump_attr type, +- u_int8_t data); ++ uint8_t data); + + /* low level API: netlink functions */ + +@@ -553,8 +554,8 @@ extern __attribute__((deprecated)) int + nfct_build_conntrack(struct nfnl_subsys_handle *ssh, + void *req, + size_t size, +- u_int16_t type, +- u_int16_t flags, ++ uint16_t type, ++ uint16_t flags, + const struct nf_conntrack *ct); + + extern __attribute__((deprecated)) +@@ -640,27 +641,27 @@ extern void nfexp_set_attr(struct nf_exp + + extern void nfexp_set_attr_u8(struct nf_expect *exp, + const enum nf_expect_attr type, +- u_int8_t value); ++ uint8_t value); + + extern void nfexp_set_attr_u16(struct nf_expect *exp, + const enum nf_expect_attr type, +- u_int16_t value); ++ uint16_t value); + + extern void nfexp_set_attr_u32(struct nf_expect *exp, + const enum nf_expect_attr type, +- u_int32_t value); ++ uint32_t value); + + /* getter */ + extern const void *nfexp_get_attr(const struct nf_expect *exp, + const enum nf_expect_attr type); + +-extern u_int8_t nfexp_get_attr_u8(const struct nf_expect *exp, ++extern uint8_t nfexp_get_attr_u8(const struct nf_expect *exp, + const enum nf_expect_attr type); + +-extern u_int16_t nfexp_get_attr_u16(const struct nf_expect *exp, ++extern uint16_t nfexp_get_attr_u16(const struct nf_expect *exp, + const enum nf_expect_attr type); + +-extern u_int32_t nfexp_get_attr_u32(const struct nf_expect *exp, ++extern uint32_t nfexp_get_attr_u32(const struct nf_expect *exp, + const enum nf_expect_attr type); + + /* checker */ +@@ -700,8 +701,8 @@ extern __attribute__((deprecated)) + int nfexp_build_expect(struct nfnl_subsys_handle *ssh, + void *req, + size_t size, +- u_int16_t type, +- u_int16_t flags, ++ uint16_t type, ++ uint16_t flags, + const struct nf_expect *exp); + + extern __attribute__((deprecated)) diff --git a/package/libnetfilter_conntrack/patches/patch-src_main_c b/package/libnetfilter_conntrack/patches/patch-src_main_c new file mode 100644 index 000000000..12ce50bc7 --- /dev/null +++ b/package/libnetfilter_conntrack/patches/patch-src_main_c @@ -0,0 +1,20 @@ +--- libnetfilter_conntrack-1.0.4.orig/src/main.c 2011-12-30 00:42:58.000000000 +0100 ++++ libnetfilter_conntrack-1.0.4/src/main.c 2014-04-10 14:29:50.000000000 +0200 +@@ -13,7 +13,7 @@ + #include "internal/internal.h" + + struct nfct_handle *nfct_open_nfnl(struct nfnl_handle *nfnlh, +- u_int8_t subsys_id, ++ uint8_t subsys_id, + unsigned int subscriptions) + { + struct nfct_handle *cth; +@@ -81,7 +81,7 @@ out_free: + * + * On error, NULL is returned and errno is explicitly set. + */ +-struct nfct_handle *nfct_open(u_int8_t subsys_id, unsigned subscriptions) ++struct nfct_handle *nfct_open(uint8_t subsys_id, unsigned subscriptions) + { + struct nfnl_handle *nfnlh = nfnl_open(); + struct nfct_handle *nfcth; diff --git a/package/libnetfilter_queue/Makefile b/package/libnetfilter_queue/Makefile index 40669556d..88ec8f129 100644 --- a/package/libnetfilter_queue/Makefile +++ b/package/libnetfilter_queue/Makefile @@ -21,6 +21,8 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,LIBNETFILTER_QUEUE,libnetfilter-queue,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) +TARGET_CPPFLAGS+= -D_GNU_SOURCE + libnetfilter-queue-install: $(INSTALL_DIR) $(IDIR_LIBNETFILTER_QUEUE)/usr/lib $(CP) $(WRKINST)/usr/lib/libnetfilter_queue*so* \ diff --git a/package/libnfnetlink/Makefile b/package/libnfnetlink/Makefile index 07fe6683a..0d4da94dd 100644 --- a/package/libnfnetlink/Makefile +++ b/package/libnfnetlink/Makefile @@ -5,9 +5,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:= libnfnetlink PKG_VERSION:= 1.0.1 -PKG_RELEASE:= 2 +PKG_RELEASE:= 5 PKG_MD5SUM:= 98927583d2016a9fb1936fed992e2c5e -PKG_DESCR:= low-level library for netfilter related kernel/userspace communication +PKG_DESCR:= netfilter related kernel/userspace communication PKG_SECTION:= libs PKG_URL:= http://www.netfilter.org/projects/libnfnetlink/ PKG_SITES:= http://www.netfilter.org/projects/libnfnetlink/files/ diff --git a/package/libnfnetlink/patches/patch-include_libnfnetlink_libnfnetlink_h b/package/libnfnetlink/patches/patch-include_libnfnetlink_libnfnetlink_h index 679be187d..d69bc16d0 100644 --- a/package/libnfnetlink/patches/patch-include_libnfnetlink_libnfnetlink_h +++ b/package/libnfnetlink/patches/patch-include_libnfnetlink_libnfnetlink_h @@ -1,10 +1,77 @@ --- libnfnetlink-1.0.1.orig/include/libnfnetlink/libnfnetlink.h 2010-05-09 23:31:56.000000000 +0200 -+++ libnfnetlink-1.0.1/include/libnfnetlink/libnfnetlink.h 2013-08-20 18:44:17.220339451 +0200 ++++ libnfnetlink-1.0.1/include/libnfnetlink/libnfnetlink.h 2014-04-10 07:47:04.000000000 +0200 @@ -15,6 +15,7 @@ #define aligned_u64 unsigned long long __attribute__((aligned(8))) #endif -+#include <sys/types.h> ++#include <stdint.h> #include <sys/socket.h> /* for sa_family_t */ #include <linux/netlink.h> #include <libnfnetlink/linux_nfnetlink.h> +@@ -55,7 +56,7 @@ struct nfnlhdr { + struct nfnl_callback { + int (*call)(struct nlmsghdr *nlh, struct nfattr *nfa[], void *data); + void *data; +- u_int16_t attr_count; ++ uint16_t attr_count; + }; + + struct nfnl_handle; +@@ -69,7 +70,7 @@ extern struct nfnl_handle *nfnl_open(voi + extern int nfnl_close(struct nfnl_handle *); + + extern struct nfnl_subsys_handle *nfnl_subsys_open(struct nfnl_handle *, +- u_int8_t, u_int8_t, ++ uint8_t, uint8_t, + unsigned int); + extern void nfnl_subsys_close(struct nfnl_subsys_handle *); + +@@ -88,8 +89,8 @@ extern int nfnl_sendiov(const struct nfn + const struct iovec *iov, unsigned int num, + unsigned int flags); + extern void nfnl_fill_hdr(struct nfnl_subsys_handle *, struct nlmsghdr *, +- unsigned int, u_int8_t, u_int16_t, u_int16_t, +- u_int16_t); ++ unsigned int, uint8_t, uint16_t, uint16_t, ++ uint16_t); + extern __attribute__((deprecated)) int + nfnl_talk(struct nfnl_handle *, struct nlmsghdr *, pid_t, + unsigned, struct nlmsghdr *, +@@ -103,8 +104,8 @@ nfnl_listen(struct nfnl_handle *, + /* receiving */ + extern ssize_t nfnl_recv(const struct nfnl_handle *h, unsigned char *buf, size_t len); + extern int nfnl_callback_register(struct nfnl_subsys_handle *, +- u_int8_t type, struct nfnl_callback *cb); +-extern int nfnl_callback_unregister(struct nfnl_subsys_handle *, u_int8_t type); ++ uint8_t type, struct nfnl_callback *cb); ++extern int nfnl_callback_unregister(struct nfnl_subsys_handle *, uint8_t type); + extern int nfnl_handle_packet(struct nfnl_handle *, char *buf, int len); + + /* parsing */ +@@ -180,12 +181,12 @@ extern int nfnl_query(struct nfnl_handle + + /* nfnl attribute handling functions */ + extern int nfnl_addattr_l(struct nlmsghdr *, int, int, const void *, int); +-extern int nfnl_addattr8(struct nlmsghdr *, int, int, u_int8_t); +-extern int nfnl_addattr16(struct nlmsghdr *, int, int, u_int16_t); +-extern int nfnl_addattr32(struct nlmsghdr *, int, int, u_int32_t); ++extern int nfnl_addattr8(struct nlmsghdr *, int, int, uint8_t); ++extern int nfnl_addattr16(struct nlmsghdr *, int, int, uint16_t); ++extern int nfnl_addattr32(struct nlmsghdr *, int, int, uint32_t); + extern int nfnl_nfa_addattr_l(struct nfattr *, int, int, const void *, int); +-extern int nfnl_nfa_addattr16(struct nfattr *, int, int, u_int16_t); +-extern int nfnl_nfa_addattr32(struct nfattr *, int, int, u_int32_t); ++extern int nfnl_nfa_addattr16(struct nfattr *, int, int, uint16_t); ++extern int nfnl_nfa_addattr32(struct nfattr *, int, int, uint32_t); + extern int nfnl_parse_attr(struct nfattr **, int, struct nfattr *, int); + #define nfnl_parse_nested(tb, max, nfa) \ + nfnl_parse_attr((tb), (max), NFA_DATA((nfa)), NFA_PAYLOAD((nfa))) +@@ -197,7 +198,7 @@ extern int nfnl_parse_attr(struct nfattr + ({ (tail)->nfa_len = (void *) NLMSG_TAIL(nlh) - (void *) tail; }) + + extern void nfnl_build_nfa_iovec(struct iovec *iov, struct nfattr *nfa, +- u_int16_t type, u_int32_t len, ++ uint16_t type, uint32_t len, + unsigned char *val); + extern unsigned int nfnl_rcvbufsiz(const struct nfnl_handle *h, + unsigned int size); diff --git a/package/libnfnetlink/patches/patch-include_libnfnetlink_linux_nfnetlink_compat_h b/package/libnfnetlink/patches/patch-include_libnfnetlink_linux_nfnetlink_compat_h new file mode 100644 index 000000000..2679e67c3 --- /dev/null +++ b/package/libnfnetlink/patches/patch-include_libnfnetlink_linux_nfnetlink_compat_h @@ -0,0 +1,22 @@ +--- libnfnetlink-1.0.1.orig/include/libnfnetlink/linux_nfnetlink_compat.h 2008-06-18 14:36:57.000000000 +0200 ++++ libnfnetlink-1.0.1/include/libnfnetlink/linux_nfnetlink_compat.h 2014-04-08 09:00:23.000000000 +0200 +@@ -3,6 +3,8 @@ + #ifndef __KERNEL__ + /* Old nfnetlink macros for userspace */ + ++#include <stdint.h> ++ + /* nfnetlink groups: Up to 32 maximum */ + #define NF_NETLINK_CONNTRACK_NEW 0x00000001 + #define NF_NETLINK_CONNTRACK_UPDATE 0x00000002 +@@ -20,8 +22,8 @@ + + struct nfattr + { +- u_int16_t nfa_len; +- u_int16_t nfa_type; /* we use 15 bits for the type, and the highest ++ uint16_t nfa_len; ++ uint16_t nfa_type; /* we use 15 bits for the type, and the highest + * bit to indicate whether the payload is nested */ + }; + diff --git a/package/libnfnetlink/patches/patch-include_libnfnetlink_linux_nfnetlink_h b/package/libnfnetlink/patches/patch-include_libnfnetlink_linux_nfnetlink_h new file mode 100644 index 000000000..86b231660 --- /dev/null +++ b/package/libnfnetlink/patches/patch-include_libnfnetlink_linux_nfnetlink_h @@ -0,0 +1,41 @@ +--- libnfnetlink-1.0.1.orig/include/libnfnetlink/linux_nfnetlink.h 2008-06-18 14:36:57.000000000 +0200 ++++ libnfnetlink-1.0.1/include/libnfnetlink/linux_nfnetlink.h 2014-04-08 09:31:12.000000000 +0200 +@@ -1,6 +1,6 @@ + #ifndef _NFNETLINK_H + #define _NFNETLINK_H +-#include <linux/types.h> ++#include <stdint.h> + #include <libnfnetlink/linux_nfnetlink_compat.h> + + enum nfnetlink_groups { +@@ -25,9 +25,9 @@ enum nfnetlink_groups { + /* General form of address family dependent message. + */ + struct nfgenmsg { +- u_int8_t nfgen_family; /* AF_xxx */ +- u_int8_t version; /* nfnetlink version */ +- u_int16_t res_id; /* resource id */ ++ uint8_t nfgen_family; /* AF_xxx */ ++ uint8_t version; /* nfnetlink version */ ++ uint16_t res_id; /* resource id */ + }; + + #define NFNETLINK_V0 0 +@@ -59,7 +59,7 @@ struct nfnl_callback + int (*call)(struct sock *nl, struct sk_buff *skb, + struct nlmsghdr *nlh, struct nlattr *cda[]); + const struct nla_policy *policy; /* netlink attribute policy */ +- const u_int16_t attr_count; /* number of nlattr's */ ++ const uint16_t attr_count; /* number of nlattr's */ + }; + + struct nfnetlink_subsystem +@@ -76,7 +76,7 @@ extern int nfnetlink_subsys_unregister(c + extern int nfnetlink_has_listeners(unsigned int group); + extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, + int echo); +-extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); ++extern int nfnetlink_unicast(struct sk_buff *skb, uint32_t pid, int flags); + + #define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ + MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) diff --git a/package/libnfnetlink/patches/patch-src_libnfnetlink_c b/package/libnfnetlink/patches/patch-src_libnfnetlink_c new file mode 100644 index 000000000..006da1f6d --- /dev/null +++ b/package/libnfnetlink/patches/patch-src_libnfnetlink_c @@ -0,0 +1,233 @@ +--- libnfnetlink-1.0.1.orig/src/libnfnetlink.c 2012-08-13 19:56:29.000000000 +0200 ++++ libnfnetlink-1.0.1/src/libnfnetlink.c 2014-04-10 07:37:41.000000000 +0200 +@@ -38,6 +38,7 @@ + + #include <stdlib.h> + #include <stdio.h> ++#include <stdint.h> + #include <unistd.h> + #include <errno.h> + #include <string.h> +@@ -72,9 +73,9 @@ + + struct nfnl_subsys_handle { + struct nfnl_handle *nfnlh; +- u_int32_t subscriptions; +- u_int8_t subsys_id; +- u_int8_t cb_count; ++ uint32_t subscriptions; ++ uint8_t subsys_id; ++ uint8_t cb_count; + struct nfnl_callback *cb; /* array of callbacks */ + }; + +@@ -86,11 +87,11 @@ struct nfnl_handle { + int fd; + struct sockaddr_nl local; + struct sockaddr_nl peer; +- u_int32_t subscriptions; +- u_int32_t seq; +- u_int32_t dump; +- u_int32_t rcv_buffer_size; /* for nfnl_catch */ +- u_int32_t flags; ++ uint32_t subscriptions; ++ uint32_t seq; ++ uint32_t dump; ++ uint32_t rcv_buffer_size; /* for nfnl_catch */ ++ uint32_t flags; + struct nlmsghdr *last_nlhdr; + struct nfnl_subsys_handle subsys[NFNL_MAX_SUBSYS+1]; + }; +@@ -145,7 +146,7 @@ unsigned int nfnl_portid(const struct nf + static int recalc_rebind_subscriptions(struct nfnl_handle *nfnlh) + { + int i, err; +- u_int32_t new_subscriptions = nfnlh->subscriptions; ++ uint32_t new_subscriptions = nfnlh->subscriptions; + + for (i = 0; i < NFNL_MAX_SUBSYS; i++) + new_subscriptions |= nfnlh->subsys[i].subscriptions; +@@ -273,8 +274,8 @@ void nfnl_set_rcv_buffer_size(struct nfn + * a valid address that points to a nfnl_subsys_handle structure is returned. + */ + struct nfnl_subsys_handle * +-nfnl_subsys_open(struct nfnl_handle *nfnlh, u_int8_t subsys_id, +- u_int8_t cb_count, u_int32_t subscriptions) ++nfnl_subsys_open(struct nfnl_handle *nfnlh, uint8_t subsys_id, ++ uint8_t cb_count, uint32_t subscriptions) + { + struct nfnl_subsys_handle *ssh; + +@@ -435,10 +436,10 @@ int nfnl_sendiov(const struct nfnl_handl + */ + void nfnl_fill_hdr(struct nfnl_subsys_handle *ssh, + struct nlmsghdr *nlh, unsigned int len, +- u_int8_t family, +- u_int16_t res_id, +- u_int16_t msg_type, +- u_int16_t msg_flags) ++ uint8_t family, ++ uint16_t res_id, ++ uint16_t msg_type, ++ uint16_t msg_flags) + { + assert(ssh); + assert(nlh); +@@ -848,14 +849,14 @@ int nfnl_nfa_addattr_l(struct nfattr *nf + } + + /** +- * nfnl_addattr8 - Add u_int8_t attribute to nlmsghdr ++ * nfnl_addattr8 - Add uint8_t attribute to nlmsghdr + * + * @n: netlink message header to which attribute is to be added + * @maxlen: maximum length of netlink message header + * @type: type of new attribute + * @data: content of new attribute + */ +-int nfnl_addattr8(struct nlmsghdr *n, int maxlen, int type, u_int8_t data) ++int nfnl_addattr8(struct nlmsghdr *n, int maxlen, int type, uint8_t data) + { + assert(n); + assert(maxlen > 0); +@@ -865,7 +866,7 @@ int nfnl_addattr8(struct nlmsghdr *n, in + } + + /** +- * nfnl_nfa_addattr16 - Add u_int16_t attribute to struct nfattr ++ * nfnl_nfa_addattr16 - Add uint16_t attribute to struct nfattr + * + * @nfa: struct nfattr + * @maxlen: maximal length of nfattr buffer +@@ -874,7 +875,7 @@ int nfnl_addattr8(struct nlmsghdr *n, in + * + */ + int nfnl_nfa_addattr16(struct nfattr *nfa, int maxlen, int type, +- u_int16_t data) ++ uint16_t data) + { + assert(nfa); + assert(maxlen > 0); +@@ -884,7 +885,7 @@ int nfnl_nfa_addattr16(struct nfattr *nf + } + + /** +- * nfnl_addattr16 - Add u_int16_t attribute to nlmsghdr ++ * nfnl_addattr16 - Add uint16_t attribute to nlmsghdr + * + * @n: netlink message header to which attribute is to be added + * @maxlen: maximum length of netlink message header +@@ -893,7 +894,7 @@ int nfnl_nfa_addattr16(struct nfattr *nf + * + */ + int nfnl_addattr16(struct nlmsghdr *n, int maxlen, int type, +- u_int16_t data) ++ uint16_t data) + { + assert(n); + assert(maxlen > 0); +@@ -903,7 +904,7 @@ int nfnl_addattr16(struct nlmsghdr *n, i + } + + /** +- * nfnl_nfa_addattr32 - Add u_int32_t attribute to struct nfattr ++ * nfnl_nfa_addattr32 - Add uint32_t attribute to struct nfattr + * + * @nfa: struct nfattr + * @maxlen: maximal length of nfattr buffer +@@ -912,7 +913,7 @@ int nfnl_addattr16(struct nlmsghdr *n, i + * + */ + int nfnl_nfa_addattr32(struct nfattr *nfa, int maxlen, int type, +- u_int32_t data) ++ uint32_t data) + { + assert(nfa); + assert(maxlen > 0); +@@ -922,7 +923,7 @@ int nfnl_nfa_addattr32(struct nfattr *nf + } + + /** +- * nfnl_addattr32 - Add u_int32_t attribute to nlmsghdr ++ * nfnl_addattr32 - Add uint32_t attribute to nlmsghdr + * + * @n: netlink message header to which attribute is to be added + * @maxlen: maximum length of netlink message header +@@ -931,7 +932,7 @@ int nfnl_nfa_addattr32(struct nfattr *nf + * + */ + int nfnl_addattr32(struct nlmsghdr *n, int maxlen, int type, +- u_int32_t data) ++ uint32_t data) + { + assert(n); + assert(maxlen > 0); +@@ -979,7 +980,7 @@ int nfnl_parse_attr(struct nfattr *tb[], + * + */ + void nfnl_build_nfa_iovec(struct iovec *iov, struct nfattr *nfa, +- u_int16_t type, u_int32_t len, unsigned char *val) ++ uint16_t type, uint32_t len, unsigned char *val) + { + assert(iov); + assert(nfa); +@@ -1114,7 +1115,7 @@ struct nlmsghdr *nfnl_get_msg_next(struc + * appropiately. + */ + int nfnl_callback_register(struct nfnl_subsys_handle *ssh, +- u_int8_t type, struct nfnl_callback *cb) ++ uint8_t type, struct nfnl_callback *cb) + { + assert(ssh); + assert(cb); +@@ -1137,7 +1138,7 @@ int nfnl_callback_register(struct nfnl_s + * On sucess, 0 is returned. On error, -1 is returned and errno is + * set appropiately. + */ +-int nfnl_callback_unregister(struct nfnl_subsys_handle *ssh, u_int8_t type) ++int nfnl_callback_unregister(struct nfnl_subsys_handle *ssh, uint8_t type) + { + assert(ssh); + +@@ -1160,8 +1161,8 @@ int nfnl_check_attributes(const struct n + assert(nfa); + + int min_len; +- u_int8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type); +- u_int8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type); ++ uint8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type); ++ uint8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type); + const struct nfnl_subsys_handle *ssh; + struct nfnl_callback *cb; + +@@ -1211,8 +1212,8 @@ static int __nfnl_handle_msg(struct nfnl + int len) + { + struct nfnl_subsys_handle *ssh; +- u_int8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type); +- u_int8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type); ++ uint8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type); ++ uint8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type); + int err = 0; + + if (subsys_id > NFNL_MAX_SUBSYS) +@@ -1242,7 +1243,7 @@ int nfnl_handle_packet(struct nfnl_handl + { + + while (len >= NLMSG_SPACE(0)) { +- u_int32_t rlen; ++ uint32_t rlen; + struct nlmsghdr *nlh = (struct nlmsghdr *)buf; + + if (nlh->nlmsg_len < sizeof(struct nlmsghdr) +@@ -1284,8 +1285,8 @@ static int nfnl_is_error(struct nfnl_han + static int nfnl_step(struct nfnl_handle *h, struct nlmsghdr *nlh) + { + struct nfnl_subsys_handle *ssh; +- u_int8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type); +- u_int8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type); ++ uint8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type); ++ uint8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type); + + /* Is this an error message? */ + if (nfnl_is_error(h, nlh)) { diff --git a/package/libnfs/Makefile b/package/libnfs/Makefile index 2ad21801f..6a6b9e69f 100644 --- a/package/libnfs/Makefile +++ b/package/libnfs/Makefile @@ -4,9 +4,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:= libnfs -PKG_VERSION:= 1.8.0 +PKG_VERSION:= 1.9.3 PKG_RELEASE:= 1 -PKG_MD5SUM:= 0f20c7c104aa2e2ee563169b7e164aab +PKG_MD5SUM:= a07656eeca58ad8d4870da546745628a PKG_DESCR:= NFS client library PKG_SECTION:= libs PKG_BUILDDEP:= autotool diff --git a/package/libpciaccess/Makefile b/package/libpciaccess/Makefile index 8b598d792..cc2df0005 100644 --- a/package/libpciaccess/Makefile +++ b/package/libpciaccess/Makefile @@ -4,9 +4,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:= libpciaccess -PKG_VERSION:= 0.13.1 -PKG_RELEASE:= 2 -PKG_MD5SUM:= 3a95b70913621840bf8af616ea01d7d9 +PKG_VERSION:= 0.13.2 +PKG_RELEASE:= 1 +PKG_MD5SUM:= c49bd638c78fa4124e11432c1a94b5f4 PKG_DESCR:= X.org PCI access library PKG_SECTION:= x11/libs PKG_SITES:= ${MASTER_SITE_XORG} diff --git a/package/libpciaccess/patches/patch-src_freebsd_pci_c b/package/libpciaccess/patches/patch-src_freebsd_pci_c new file mode 100644 index 000000000..3a1c22fd1 --- /dev/null +++ b/package/libpciaccess/patches/patch-src_freebsd_pci_c @@ -0,0 +1,18 @@ +--- libpciaccess-0.13.2.orig/src/freebsd_pci.c 2013-07-21 00:54:34.000000000 +0200 ++++ libpciaccess-0.13.2/src/freebsd_pci.c 2014-03-24 13:26:10.476152263 +0100 +@@ -579,6 +579,7 @@ pci_device_freebsd_open_legacy_io(struct + + ret->base = base; + ret->size = size; ++ ret->is_legacy = 1; + return ret; + #elif defined(PCI_MAGIC_IO_RANGE) + ret->memory = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, +@@ -588,6 +589,7 @@ pci_device_freebsd_open_legacy_io(struct + + ret->base = base; + ret->size = size; ++ ret->is_legacy = 1; + return ret; + #else + return NULL; diff --git a/package/libpciaccess/patches/patch-src_linux_sysfs_c b/package/libpciaccess/patches/patch-src_linux_sysfs_c index ad31ac509..eb91062c2 100644 --- a/package/libpciaccess/patches/patch-src_linux_sysfs_c +++ b/package/libpciaccess/patches/patch-src_linux_sysfs_c @@ -1,14 +1,11 @@ ---- libpciaccess-0.13.1.orig/src/linux_sysfs.c 2012-04-09 19:02:57.000000000 +0200 -+++ libpciaccess-0.13.1/src/linux_sysfs.c 2013-12-01 18:26:04.000000000 +0100 -@@ -34,6 +34,7 @@ - - #define _GNU_SOURCE - +--- libpciaccess-0.13.2.orig/src/linux_sysfs.c 2013-07-21 00:54:34.000000000 +0200 ++++ libpciaccess-0.13.2/src/linux_sysfs.c 2014-03-24 21:01:44.000000000 +0100 +@@ -41,11 +41,12 @@ + #include <sys/types.h> + #include <sys/stat.h> + #include <fcntl.h> +#include <limits.h> - #include <stdlib.h> - #include <string.h> - #include <stdio.h> -@@ -45,7 +46,7 @@ + #include <sys/mman.h> #include <dirent.h> #include <errno.h> @@ -17,3 +14,125 @@ #include <sys/io.h> #else #define inb(x) -1 +@@ -759,6 +760,7 @@ pci_device_linux_sysfs_open_device_io(st + + ret->base = base; + ret->size = size; ++ ret->is_legacy = 0; + + return ret; + } +@@ -796,6 +798,7 @@ pci_device_linux_sysfs_open_legacy_io(st + + ret->base = base; + ret->size = size; ++ ret->is_legacy = 1; + + return ret; + } +@@ -813,10 +816,14 @@ pci_device_linux_sysfs_read32(struct pci + { + uint32_t ret; + +- if (handle->fd > -1) +- pread(handle->fd, &ret, 4, port + handle->base); +- else ++ if (handle->fd > -1) { ++ if (handle->is_legacy) ++ pread(handle->fd, &ret, 4, port + handle->base); ++ else ++ pread(handle->fd, &ret, 4, port); ++ } else { + ret = inl(port + handle->base); ++ } + + return ret; + } +@@ -826,10 +833,14 @@ pci_device_linux_sysfs_read16(struct pci + { + uint16_t ret; + +- if (handle->fd > -1) +- pread(handle->fd, &ret, 2, port + handle->base); +- else ++ if (handle->fd > -1) { ++ if (handle->is_legacy) ++ pread(handle->fd, &ret, 2, port + handle->base); ++ else ++ pread(handle->fd, &ret, 2, port); ++ } else { + ret = inw(port + handle->base); ++ } + + return ret; + } +@@ -839,10 +850,14 @@ pci_device_linux_sysfs_read8(struct pci_ + { + uint8_t ret; + +- if (handle->fd > -1) +- pread(handle->fd, &ret, 1, port + handle->base); +- else ++ if (handle->fd > -1) { ++ if (handle->is_legacy) ++ pread(handle->fd, &ret, 1, port + handle->base); ++ else ++ pread(handle->fd, &ret, 1, port); ++ } else { + ret = inb(port + handle->base); ++ } + + return ret; + } +@@ -851,30 +866,42 @@ static void + pci_device_linux_sysfs_write32(struct pci_io_handle *handle, uint32_t port, + uint32_t data) + { +- if (handle->fd > -1) +- pwrite(handle->fd, &data, 4, port + handle->base); +- else ++ if (handle->fd > -1) { ++ if (handle->is_legacy) ++ pwrite(handle->fd, &data, 4, port + handle->base); ++ else ++ pwrite(handle->fd, &data, 4, port); ++ } else { + outl(data, port + handle->base); ++ } + } + + static void + pci_device_linux_sysfs_write16(struct pci_io_handle *handle, uint32_t port, + uint16_t data) + { +- if (handle->fd > -1) +- pwrite(handle->fd, &data, 2, port + handle->base); +- else ++ if (handle->fd > -1) { ++ if (handle->is_legacy) ++ pwrite(handle->fd, &data, 2, port + handle->base); ++ else ++ pwrite(handle->fd, &data, 2, port); ++ } else { + outw(data, port + handle->base); ++ } + } + + static void + pci_device_linux_sysfs_write8(struct pci_io_handle *handle, uint32_t port, + uint8_t data) + { +- if (handle->fd > -1) +- pwrite(handle->fd, &data, 1, port + handle->base); +- else ++ if (handle->fd > -1) { ++ if (handle->is_legacy) ++ pwrite(handle->fd, &data, 1, port + handle->base); ++ else ++ pwrite(handle->fd, &data, 1, port); ++ } else { + outb(data, port + handle->base); ++ } + } + + static int diff --git a/package/libpciaccess/patches/patch-src_netbsd_pci_c b/package/libpciaccess/patches/patch-src_netbsd_pci_c new file mode 100644 index 000000000..9b7a31b7e --- /dev/null +++ b/package/libpciaccess/patches/patch-src_netbsd_pci_c @@ -0,0 +1,18 @@ +--- libpciaccess-0.13.2.orig/src/netbsd_pci.c 2013-07-21 00:54:34.000000000 +0200 ++++ libpciaccess-0.13.2/src/netbsd_pci.c 2014-03-24 13:26:10.484152334 +0100 +@@ -733,6 +733,7 @@ pci_device_netbsd_open_legacy_io(struct + + ret->base = base; + ret->size = size; ++ ret->is_legacy = 1; + return ret; + #elif defined(__amd64__) + struct x86_64_iopl_args ia; +@@ -743,6 +744,7 @@ pci_device_netbsd_open_legacy_io(struct + + ret->base = base; + ret->size = size; ++ ret->is_legacy = 1; + return ret; + #else + return NULL; diff --git a/package/libpciaccess/patches/patch-src_openbsd_pci_c b/package/libpciaccess/patches/patch-src_openbsd_pci_c new file mode 100644 index 000000000..0c7180b72 --- /dev/null +++ b/package/libpciaccess/patches/patch-src_openbsd_pci_c @@ -0,0 +1,26 @@ +--- libpciaccess-0.13.2.orig/src/openbsd_pci.c 2013-07-21 00:54:34.000000000 +0200 ++++ libpciaccess-0.13.2/src/openbsd_pci.c 2014-03-24 13:26:10.484152334 +0100 +@@ -412,6 +412,7 @@ pci_device_openbsd_open_legacy_io(struct + + ret->base = base; + ret->size = size; ++ ret->is_legacy = 1; + return ret; + #elif defined(__amd64__) + struct amd64_iopl_args ia; +@@ -422,6 +423,7 @@ pci_device_openbsd_open_legacy_io(struct + + ret->base = base; + ret->size = size; ++ ret->is_legacy = 1; + return ret; + #elif defined(PCI_MAGIC_IO_RANGE) + ret->memory = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, +@@ -431,6 +433,7 @@ pci_device_openbsd_open_legacy_io(struct + + ret->base = base; + ret->size = size; ++ ret->is_legacy = 1; + return ret; + #else + return NULL; diff --git a/package/libpciaccess/patches/patch-src_pciaccess_private_h b/package/libpciaccess/patches/patch-src_pciaccess_private_h new file mode 100644 index 000000000..e3ec7d0f1 --- /dev/null +++ b/package/libpciaccess/patches/patch-src_pciaccess_private_h @@ -0,0 +1,10 @@ +--- libpciaccess-0.13.2.orig/src/pciaccess_private.h 2013-07-21 00:54:34.000000000 +0200 ++++ libpciaccess-0.13.2/src/pciaccess_private.h 2014-03-24 13:26:10.492152406 +0100 +@@ -109,6 +109,7 @@ struct pci_io_handle { + pciaddr_t size; + void *memory; + int fd; ++ int is_legacy; + }; + + struct pci_device_private { diff --git a/package/libpciaccess/patches/patch-src_solx_devfs_c b/package/libpciaccess/patches/patch-src_solx_devfs_c new file mode 100644 index 000000000..f6ee2c03e --- /dev/null +++ b/package/libpciaccess/patches/patch-src_solx_devfs_c @@ -0,0 +1,10 @@ +--- libpciaccess-0.13.2.orig/src/solx_devfs.c 2013-07-21 00:54:34.000000000 +0200 ++++ libpciaccess-0.13.2/src/solx_devfs.c 2014-03-24 13:26:10.496152442 +0100 +@@ -911,6 +911,7 @@ pci_device_solx_devfs_open_legacy_io(str + if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) == 0) { + ret->base = base; + ret->size = size; ++ ret->is_legacy = 1; + return ret; + } + #endif diff --git a/package/libpciaccess/patches/patch-src_x86_pci_c b/package/libpciaccess/patches/patch-src_x86_pci_c new file mode 100644 index 000000000..07c18d419 --- /dev/null +++ b/package/libpciaccess/patches/patch-src_x86_pci_c @@ -0,0 +1,10 @@ +--- libpciaccess-0.13.2.orig/src/x86_pci.c 2013-07-21 00:54:34.000000000 +0200 ++++ libpciaccess-0.13.2/src/x86_pci.c 2014-03-24 13:26:10.496152442 +0100 +@@ -558,6 +558,7 @@ pci_device_x86_open_legacy_io(struct pci + + ret->base = base; + ret->size = size; ++ ret->is_legacy = 1; + + return ret; + } diff --git a/package/libpthread/Makefile b/package/libpthread/Makefile index cdb84d5fe..50d8172d1 100644 --- a/package/libpthread/Makefile +++ b/package/libpthread/Makefile @@ -10,7 +10,7 @@ ifeq ($(ADK_TARGET_LIB_MUSL),y) include ${TOPDIR}/toolchain/musl/Makefile.inc endif ifeq ($(ADK_TARGET_LIB_UCLIBC),y) -include ${TOPDIR}/toolchain/uClibc/Makefile.inc +include ${TOPDIR}/toolchain/uclibc/Makefile.inc endif PKG_NAME:= libpthread @@ -36,6 +36,7 @@ libpthread-install: ifeq ($(ADK_TARGET_LIB_MUSL),) ${INSTALL_DIR} ${IDIR_LIBPTHREAD}/$(ADK_TARGET_LIBC_PATH) ${CP} ${STAGING_TARGET_DIR}/lib/libpthread*.so* ${IDIR_LIBPTHREAD}/$(ADK_TARGET_LIBC_PATH) + (cd ${IDIR_LIBPTHREAD}/$(ADK_TARGET_LIBC_PATH); ln -sf libpthread.so.0 libpthread.so) endif include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/libpthread/files/libpthread.postinst b/package/libpthread/files/libpthread.postinst deleted file mode 100644 index 76a6c81a4..000000000 --- a/package/libpthread/files/libpthread.postinst +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -if [ ! -z $IPKG_INSTROOT ];then - (cd $IPKG_INSTROOT/lib && ln -sf libpthread.so.0 libpthread.so) -fi diff --git a/package/librt/Makefile b/package/librt/Makefile index cf646672f..a9bd0f313 100644 --- a/package/librt/Makefile +++ b/package/librt/Makefile @@ -7,7 +7,7 @@ ifeq ($(ADK_TARGET_LIB_GLIBC),y) include ${TOPDIR}/toolchain/glibc/Makefile.inc endif ifeq ($(ADK_TARGET_LIB_UCLIBC),y) -include ${TOPDIR}/toolchain/uClibc/Makefile.inc +include ${TOPDIR}/toolchain/uclibc/Makefile.inc endif PKG_NAME:= librt diff --git a/package/libssp/Makefile b/package/libssp/Makefile index def4443e8..02d755b4b 100644 --- a/package/libssp/Makefile +++ b/package/libssp/Makefile @@ -7,11 +7,11 @@ ifeq ($(ADK_TARGET_LIB_GLIBC),y) include ${TOPDIR}/toolchain/glibc/Makefile.inc endif ifeq ($(ADK_TARGET_LIB_UCLIBC),y) -include ${TOPDIR}/toolchain/uClibc/Makefile.inc +include ${TOPDIR}/toolchain/uclibc/Makefile.inc endif PKG_NAME:= libssp -PKG_DESCR:= Stack smashing protection library +PKG_DESCR:= stack smashing protection library PKG_SECTION:= libs PKG_OPTS:= noremove diff --git a/package/libstdcxx/Makefile b/package/libstdcxx/Makefile index 84f0a7aec..ebfebcaf3 100644 --- a/package/libstdcxx/Makefile +++ b/package/libstdcxx/Makefile @@ -8,7 +8,7 @@ else ifeq ($(ADK_TARGET_LIB_MUSL),y) include ${TOPDIR}/toolchain/musl/Makefile.inc else -include ${TOPDIR}/toolchain/uClibc/Makefile.inc +include ${TOPDIR}/toolchain/uclibc/Makefile.inc endif endif diff --git a/package/libthread_db/Makefile b/package/libthread_db/Makefile index 773c4c8f2..dde7d45a8 100644 --- a/package/libthread_db/Makefile +++ b/package/libthread_db/Makefile @@ -10,7 +10,7 @@ ifeq ($(ADK_TARGET_LIB_MUSL),y) include ${TOPDIR}/toolchain/musl/Makefile.inc endif ifeq ($(ADK_TARGET_LIB_UCLIBC),y) -include ${TOPDIR}/toolchain/uClibc/Makefile.inc +include ${TOPDIR}/toolchain/uclibc/Makefile.inc endif PKG_NAME:= libthread-db diff --git a/package/libtirpc/Makefile b/package/libtirpc/Makefile index a1bfab5d1..61ae3a9b5 100644 --- a/package/libtirpc/Makefile +++ b/package/libtirpc/Makefile @@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk PKG_NAME:= libtirpc PKG_VERSION:= 0.2.3 -PKG_RELEASE:= 2 +PKG_RELEASE:= 3 PKG_MD5SUM:= b70e6c12a369a91e69fcc3b9feb23d61 PKG_DESCR:= a transport independent RPC library PKG_SECTION:= libs @@ -15,8 +15,6 @@ PKG_URL:= http://sourceforge.net/projects/libtirpc/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=libtirpc/} PKG_OPTS:= dev -PKG_LIBC_DEPENDS:= uclibc glibc - DISTFILES:= $(PKG_NAME)-$(PKG_VERSION).tar.bz2 include ${TOPDIR}/mk/package.mk diff --git a/package/libtirpc/patches/patch-src_auth_des_c b/package/libtirpc/patches/patch-src_auth_des_c new file mode 100644 index 000000000..d91177fdc --- /dev/null +++ b/package/libtirpc/patches/patch-src_auth_des_c @@ -0,0 +1,18 @@ +--- libtirpc-0.2.3.orig/src/auth_des.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/auth_des.c 2014-03-22 13:20:52.000000000 +0100 +@@ -38,7 +38,6 @@ + #include <string.h> + #include <stdlib.h> + #include <unistd.h> +-#include <sys/cdefs.h> + #include <rpc/des_crypt.h> + #include <syslog.h> + #include <rpc/types.h> +@@ -52,7 +51,6 @@ + + #if defined(LIBC_SCCS) && !defined(lint) + #endif +-#include <sys/cdefs.h> + + #define USEC_PER_SEC 1000000 + #define RTIME_TIMEOUT 5 /* seconds to wait for sync */ diff --git a/package/libtirpc/patches/patch-src_auth_none_c b/package/libtirpc/patches/patch-src_auth_none_c new file mode 100644 index 000000000..d8fd74f3d --- /dev/null +++ b/package/libtirpc/patches/patch-src_auth_none_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/auth_none.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/auth_none.c 2014-03-22 13:20:53.000000000 +0100 +@@ -31,7 +31,6 @@ + static char *sccsid = "@(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro"; + static char *sccsid = "@(#)auth_none.c 2.1 88/07/29 4.0 RPCSRC"; + #endif +-#include <sys/cdefs.h> + __FBSDID("$FreeBSD: src/lib/libc/rpc/auth_none.c,v 1.12 2002/03/22 23:18:35 obrien Exp $"); + */ + diff --git a/package/libtirpc/patches/patch-src_auth_time_c b/package/libtirpc/patches/patch-src_auth_time_c index 5ce7de419..b6319db96 100644 --- a/package/libtirpc/patches/patch-src_auth_time_c +++ b/package/libtirpc/patches/patch-src_auth_time_c @@ -1,6 +1,14 @@ ---- libtirpc-0.2.2.orig/src/auth_time.c 2011-05-02 14:10:40.000000000 +0200 -+++ libtirpc-0.2.2/src/auth_time.c 2012-03-22 19:02:30.422855534 +0100 -@@ -43,7 +43,7 @@ +--- libtirpc-0.2.3.orig/src/auth_time.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/auth_time.c 2014-03-22 13:20:53.000000000 +0100 +@@ -25,7 +25,6 @@ + * needed to deal with TCP connections. + */ + +-#include <sys/cdefs.h> + #include <stdio.h> + #include <syslog.h> + #include <string.h> +@@ -43,7 +42,7 @@ //#include <clnt_soc.h> #include <sys/select.h> #undef NIS @@ -9,7 +17,7 @@ #ifdef TESTING -@@ -138,6 +138,7 @@ free_eps(eps, num) +@@ -138,6 +137,7 @@ free_eps(eps, num) * NIS+ server will call __rpc_get_time_offset() with the nis_server * structure already populated. */ @@ -17,7 +25,7 @@ static nis_server * get_server(sin, host, srv, eps, maxep) struct sockaddr_in *sin; -@@ -491,3 +492,4 @@ error: +@@ -491,3 +491,4 @@ error: return (time_valid); } diff --git a/package/libtirpc/patches/patch-src_auth_unix_c b/package/libtirpc/patches/patch-src_auth_unix_c new file mode 100644 index 000000000..3d5fb990e --- /dev/null +++ b/package/libtirpc/patches/patch-src_auth_unix_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/auth_unix.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/auth_unix.c 2014-03-22 13:20:53.000000000 +0100 +@@ -26,7 +26,6 @@ + * POSSIBILITY OF SUCH DAMAGE. + */ + +-#include <sys/cdefs.h> + + /* + * auth_unix.c, Implements UNIX style authentication parameters. diff --git a/package/libtirpc/patches/patch-src_authdes_prot_c b/package/libtirpc/patches/patch-src_authdes_prot_c new file mode 100644 index 000000000..f829ed45e --- /dev/null +++ b/package/libtirpc/patches/patch-src_authdes_prot_c @@ -0,0 +1,7 @@ +--- libtirpc-0.2.3.orig/src/authdes_prot.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/authdes_prot.c 2014-03-22 13:20:53.000000000 +0100 +@@ -1,4 +1,3 @@ +-#include <sys/cdefs.h> + /* + * Copyright (c) 2009, Sun Microsystems, Inc. + * All rights reserved. diff --git a/package/libtirpc/patches/patch-src_authunix_prot_c b/package/libtirpc/patches/patch-src_authunix_prot_c new file mode 100644 index 000000000..178436474 --- /dev/null +++ b/package/libtirpc/patches/patch-src_authunix_prot_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/authunix_prot.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/authunix_prot.c 2014-03-22 13:20:53.000000000 +0100 +@@ -26,7 +26,6 @@ + * POSSIBILITY OF SUCH DAMAGE. + */ + +-#include <sys/cdefs.h> + + /* + * authunix_prot.c diff --git a/package/libtirpc/patches/patch-src_bindresvport_c b/package/libtirpc/patches/patch-src_bindresvport_c new file mode 100644 index 000000000..4e828a005 --- /dev/null +++ b/package/libtirpc/patches/patch-src_bindresvport_c @@ -0,0 +1,18 @@ +--- libtirpc-0.2.3.orig/src/bindresvport.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/bindresvport.c 2014-03-22 13:24:36.000000000 +0100 +@@ -26,7 +26,6 @@ + * POSSIBILITY OF SUCH DAMAGE. + */ + +-#include <sys/cdefs.h> + + /* + * Copyright (c) 1987 by Sun Microsystems, Inc. +@@ -38,6 +37,7 @@ + #include <sys/socket.h> + + #include <netinet/in.h> ++#include <netdb.h> + + #include <errno.h> + #include <string.h> diff --git a/package/libtirpc/patches/patch-src_clnt_bcast_c b/package/libtirpc/patches/patch-src_clnt_bcast_c new file mode 100644 index 000000000..e803b1721 --- /dev/null +++ b/package/libtirpc/patches/patch-src_clnt_bcast_c @@ -0,0 +1,22 @@ +--- libtirpc-0.2.3.orig/src/clnt_bcast.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/clnt_bcast.c 2014-03-22 14:19:29.000000000 +0100 +@@ -28,7 +28,6 @@ + /* + * Copyright (c) 1986-1991 by Sun Microsystems Inc. + */ +-#include <sys/cdefs.h> + + /* + * clnt_bcast.c +@@ -41,10 +40,8 @@ + */ + #include <sys/socket.h> + #include <sys/types.h> +-#include <sys/queue.h> + +-/* new queue functions */ +-#include <misc/queue.h> ++#include "queue.h" + + #include <net/if.h> + #include <netinet/in.h> diff --git a/package/libtirpc/patches/patch-src_clnt_perror_c b/package/libtirpc/patches/patch-src_clnt_perror_c new file mode 100644 index 000000000..5c3c9169a --- /dev/null +++ b/package/libtirpc/patches/patch-src_clnt_perror_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/clnt_perror.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/clnt_perror.c 2014-03-22 13:20:53.000000000 +0100 +@@ -27,7 +27,6 @@ + */ + + /* +-#include <sys/cdefs.h> + */ + /* + * clnt_perror.c diff --git a/package/libtirpc/patches/patch-src_clnt_simple_c b/package/libtirpc/patches/patch-src_clnt_simple_c new file mode 100644 index 000000000..8db2f1b8e --- /dev/null +++ b/package/libtirpc/patches/patch-src_clnt_simple_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/clnt_simple.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/clnt_simple.c 2014-03-22 13:20:53.000000000 +0100 +@@ -29,7 +29,6 @@ + * Copyright (c) 1986-1991 by Sun Microsystems Inc. + */ + +-#include <sys/cdefs.h> + + /* + * clnt_simple.c diff --git a/package/libtirpc/patches/patch-src_crypt_client_c b/package/libtirpc/patches/patch-src_crypt_client_c new file mode 100644 index 000000000..3768305f8 --- /dev/null +++ b/package/libtirpc/patches/patch-src_crypt_client_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/crypt_client.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/crypt_client.c 2014-03-22 13:20:53.000000000 +0100 +@@ -30,7 +30,6 @@ + * SUCH DAMAGE. + */ + +-#include <sys/cdefs.h> + + #include <err.h> + #include <sys/types.h> diff --git a/package/libtirpc/patches/patch-src_des_crypt_c b/package/libtirpc/patches/patch-src_des_crypt_c index 22c03d78b..c1c313dee 100644 --- a/package/libtirpc/patches/patch-src_des_crypt_c +++ b/package/libtirpc/patches/patch-src_des_crypt_c @@ -1,6 +1,10 @@ --- libtirpc-0.2.3.orig/src/des_crypt.c 2013-02-13 16:13:59.000000000 +0100 -+++ libtirpc-0.2.3/src/des_crypt.c 2013-08-12 16:47:07.000000000 +0200 -@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)des_crypt.c ++++ libtirpc-0.2.3/src/des_crypt.c 2014-03-22 13:20:53.000000000 +0100 +@@ -39,11 +39,10 @@ + static char sccsid[] = "@(#)des_crypt.c 2.2 88/08/10 4.0 RPCSRC; from 1.13 88/02/08 SMI"; + #endif + #endif +-#include <sys/cdefs.h> static int common_crypt( char *, char *, unsigned, unsigned, struct desparams * ); int (*__des_crypt_LOCAL)() = 0; @@ -9,7 +13,7 @@ /* * Copy 8 bytes */ -@@ -145,10 +145,6 @@ common_crypt(key, buf, len, mode, desp) +@@ -145,10 +144,6 @@ common_crypt(key, buf, len, mode, desp) if (!__des_crypt_LOCAL(buf, len, desp)) { return (DESERR_HWERROR); } diff --git a/package/libtirpc/patches/patch-src_des_soft_c b/package/libtirpc/patches/patch-src_des_soft_c new file mode 100644 index 000000000..675a6a265 --- /dev/null +++ b/package/libtirpc/patches/patch-src_des_soft_c @@ -0,0 +1,9 @@ +--- libtirpc-0.2.3.orig/src/des_soft.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/des_soft.c 2014-03-22 13:20:53.000000000 +0100 +@@ -1,5 +1,4 @@ +-//#include <sys/cdefs.h> +- ++// + /* + * Copyright (c) 2009, Sun Microsystems, Inc. + * All rights reserved. diff --git a/package/libtirpc/patches/patch-src_getnetconfig_c b/package/libtirpc/patches/patch-src_getnetconfig_c new file mode 100644 index 000000000..fb1f285a1 --- /dev/null +++ b/package/libtirpc/patches/patch-src_getnetconfig_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/getnetconfig.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/getnetconfig.c 2014-03-22 13:20:53.000000000 +0100 +@@ -32,7 +32,6 @@ + + #include <pthread.h> + #include <reentrant.h> +-#include <sys/cdefs.h> + #include <stdio.h> + #include <errno.h> + #include <netconfig.h> diff --git a/package/libtirpc/patches/patch-src_getnetpath_c b/package/libtirpc/patches/patch-src_getnetpath_c new file mode 100644 index 000000000..73788ea04 --- /dev/null +++ b/package/libtirpc/patches/patch-src_getnetpath_c @@ -0,0 +1,16 @@ +--- libtirpc-0.2.3.orig/src/getnetpath.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/getnetpath.c 2014-03-22 13:20:53.000000000 +0100 +@@ -25,13 +25,11 @@ + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +-#include <sys/cdefs.h> + + /* + * Copyright (c) 1989 by Sun Microsystems, Inc. + */ + +-#include <sys/cdefs.h> + #include <stdio.h> + #include <errno.h> + #include <netconfig.h> diff --git a/package/libtirpc/patches/patch-src_getpeereid_c b/package/libtirpc/patches/patch-src_getpeereid_c new file mode 100644 index 000000000..1af375563 --- /dev/null +++ b/package/libtirpc/patches/patch-src_getpeereid_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/getpeereid.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/getpeereid.c 2014-03-22 13:20:52.000000000 +0100 +@@ -24,7 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include <sys/cdefs.h> + + #include <sys/param.h> + #include <sys/socket.h> diff --git a/package/libtirpc/patches/patch-src_getpublickey_c b/package/libtirpc/patches/patch-src_getpublickey_c new file mode 100644 index 000000000..a41eca54a --- /dev/null +++ b/package/libtirpc/patches/patch-src_getpublickey_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/getpublickey.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/getpublickey.c 2014-03-22 13:20:53.000000000 +0100 +@@ -26,7 +26,6 @@ + * POSSIBILITY OF SUCH DAMAGE. + */ + /* +-#include <sys/cdefs.h> + */ + + /* diff --git a/package/libtirpc/patches/patch-src_key_call_c b/package/libtirpc/patches/patch-src_key_call_c new file mode 100644 index 000000000..f7e7fb44d --- /dev/null +++ b/package/libtirpc/patches/patch-src_key_call_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/key_call.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/key_call.c 2014-03-22 13:20:52.000000000 +0100 +@@ -30,7 +30,6 @@ + */ + + +-#include <sys/cdefs.h> + + /* + * key_call.c, Interface to keyserver diff --git a/package/libtirpc/patches/patch-src_key_prot_xdr_c b/package/libtirpc/patches/patch-src_key_prot_xdr_c new file mode 100644 index 000000000..5dcf3f0f8 --- /dev/null +++ b/package/libtirpc/patches/patch-src_key_prot_xdr_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/key_prot_xdr.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/key_prot_xdr.c 2014-03-22 13:20:53.000000000 +0100 +@@ -33,7 +33,6 @@ + */ + /* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */ + +-#include <sys/cdefs.h> + + /* + * Compiled from key_prot.x using rpcgen. diff --git a/package/libtirpc/patches/patch-src_mt_misc_c b/package/libtirpc/patches/patch-src_mt_misc_c new file mode 100644 index 000000000..27e711159 --- /dev/null +++ b/package/libtirpc/patches/patch-src_mt_misc_c @@ -0,0 +1,8 @@ +--- libtirpc-0.2.3.orig/src/mt_misc.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/mt_misc.c 2014-03-22 13:20:53.000000000 +0100 +@@ -1,5 +1,4 @@ + +-#include <sys/cdefs.h> + #include <pthread.h> + #include <reentrant.h> + #include <rpc/rpc.h> diff --git a/package/libtirpc/patches/patch-src_pmap_clnt_c b/package/libtirpc/patches/patch-src_pmap_clnt_c new file mode 100644 index 000000000..30b5deb86 --- /dev/null +++ b/package/libtirpc/patches/patch-src_pmap_clnt_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/pmap_clnt.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/pmap_clnt.c 2014-03-22 13:20:53.000000000 +0100 +@@ -26,7 +26,6 @@ + * POSSIBILITY OF SUCH DAMAGE. + */ + +-#include <sys/cdefs.h> + + /* + * pmap_clnt.c diff --git a/package/libtirpc/patches/patch-src_pmap_getmaps_c b/package/libtirpc/patches/patch-src_pmap_getmaps_c new file mode 100644 index 000000000..1d9c984be --- /dev/null +++ b/package/libtirpc/patches/patch-src_pmap_getmaps_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/pmap_getmaps.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/pmap_getmaps.c 2014-03-22 13:20:53.000000000 +0100 +@@ -26,7 +26,6 @@ + * POSSIBILITY OF SUCH DAMAGE. + */ + +-#include <sys/cdefs.h> + + /* + * pmap_getmap.c diff --git a/package/libtirpc/patches/patch-src_rpc_com_h b/package/libtirpc/patches/patch-src_rpc_com_h new file mode 100644 index 000000000..c327a0152 --- /dev/null +++ b/package/libtirpc/patches/patch-src_rpc_com_h @@ -0,0 +1,31 @@ +--- libtirpc-0.2.3.orig/src/rpc_com.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/rpc_com.h 2014-03-22 13:20:53.000000000 +0100 +@@ -40,7 +40,6 @@ + #ifndef _TIRPC_RPCCOM_H + #define _TIRPC_RPCCOM_H + +-#include <sys/cdefs.h> + + /* #pragma ident "@(#)rpc_com.h 1.11 93/07/05 SMI" */ + +@@ -54,7 +53,9 @@ + #define __RPC_GETXID(now) ((u_int32_t)getpid() ^ (u_int32_t)(now)->tv_sec ^ \ + (u_int32_t)(now)->tv_usec) + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern u_int __rpc_get_a_size(int); + extern int __rpc_dtbsize(void); + extern struct netconfig * __rpcgettp(int); +@@ -90,6 +91,8 @@ void __xprt_set_raddr(SVCXPRT *, const s + SVCXPRT **__svc_xports; + int __svc_maxrec; + +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* _TIRPC_RPCCOM_H */ diff --git a/package/libtirpc/patches/patch-src_rpc_generic_c b/package/libtirpc/patches/patch-src_rpc_generic_c new file mode 100644 index 000000000..aa567ce27 --- /dev/null +++ b/package/libtirpc/patches/patch-src_rpc_generic_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/rpc_generic.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/rpc_generic.c 2014-03-22 13:20:53.000000000 +0100 +@@ -29,7 +29,6 @@ + * Copyright (c) 1986-1991 by Sun Microsystems Inc. + */ + +-#include <sys/cdefs.h> + + /* + * rpc_generic.c, Miscl routines for RPC. diff --git a/package/libtirpc/patches/patch-src_rpcb_st_xdr_c b/package/libtirpc/patches/patch-src_rpcb_st_xdr_c new file mode 100644 index 000000000..30eeeee9d --- /dev/null +++ b/package/libtirpc/patches/patch-src_rpcb_st_xdr_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/rpcb_st_xdr.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/rpcb_st_xdr.c 2014-03-22 13:20:53.000000000 +0100 +@@ -35,7 +35,6 @@ + * routines used with the rpcbind stats facility. + */ + +-#include <sys/cdefs.h> + + #include <rpc/rpc.h> + diff --git a/package/libtirpc/patches/patch-src_rpcdname_c b/package/libtirpc/patches/patch-src_rpcdname_c new file mode 100644 index 000000000..b66b0a46f --- /dev/null +++ b/package/libtirpc/patches/patch-src_rpcdname_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/rpcdname.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/rpcdname.c 2014-03-22 13:20:53.000000000 +0100 +@@ -25,7 +25,6 @@ + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +-#include <sys/cdefs.h> + + /* + * rpcdname.c diff --git a/package/libtirpc/patches/patch-src_svc_dg_c b/package/libtirpc/patches/patch-src_svc_dg_c new file mode 100644 index 000000000..88622d951 --- /dev/null +++ b/package/libtirpc/patches/patch-src_svc_dg_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/svc_dg.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/svc_dg.c 2014-03-22 13:20:52.000000000 +0100 +@@ -31,7 +31,6 @@ + * Copyright (c) 1986-1991 by Sun Microsystems Inc. + */ + +-#include <sys/cdefs.h> + + /* + * svc_dg.c, Server side for connectionless RPC. diff --git a/package/libtirpc/patches/patch-src_svc_simple_c b/package/libtirpc/patches/patch-src_svc_simple_c new file mode 100644 index 000000000..ed994e4f5 --- /dev/null +++ b/package/libtirpc/patches/patch-src_svc_simple_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/svc_simple.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/svc_simple.c 2014-03-22 13:20:53.000000000 +0100 +@@ -29,7 +29,6 @@ + * Copyright (c) 1986-1991 by Sun Microsystems Inc. + */ + +-#include <sys/cdefs.h> + + /* + * svc_simple.c diff --git a/package/libtirpc/patches/patch-src_svc_vc_c b/package/libtirpc/patches/patch-src_svc_vc_c new file mode 100644 index 000000000..8e43f4b8d --- /dev/null +++ b/package/libtirpc/patches/patch-src_svc_vc_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/svc_vc.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/svc_vc.c 2014-03-22 13:20:53.000000000 +0100 +@@ -27,7 +27,6 @@ + * POSSIBILITY OF SUCH DAMAGE. + */ + +-#include <sys/cdefs.h> + + /* + * svc_vc.c, Server side for Connection Oriented based RPC. diff --git a/package/libtirpc/patches/patch-src_xdr_array_c b/package/libtirpc/patches/patch-src_xdr_array_c new file mode 100644 index 000000000..dfa17d673 --- /dev/null +++ b/package/libtirpc/patches/patch-src_xdr_array_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/xdr_array.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/xdr_array.c 2014-03-22 13:20:53.000000000 +0100 +@@ -27,7 +27,6 @@ + * POSSIBILITY OF SUCH DAMAGE. + */ + +-#include <sys/cdefs.h> + + /* + * xdr_array.c, Generic XDR routines impelmentation. diff --git a/package/libtirpc/patches/patch-src_xdr_c b/package/libtirpc/patches/patch-src_xdr_c new file mode 100644 index 000000000..22211757b --- /dev/null +++ b/package/libtirpc/patches/patch-src_xdr_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/xdr.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/xdr.c 2014-03-22 13:20:53.000000000 +0100 +@@ -26,7 +26,6 @@ + * POSSIBILITY OF SUCH DAMAGE. + */ + +-#include <sys/cdefs.h> + + /* + * xdr.c, Generic XDR routines implementation. diff --git a/package/libtirpc/patches/patch-src_xdr_float_c b/package/libtirpc/patches/patch-src_xdr_float_c new file mode 100644 index 000000000..db18981e1 --- /dev/null +++ b/package/libtirpc/patches/patch-src_xdr_float_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/xdr_float.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/xdr_float.c 2014-03-22 13:20:53.000000000 +0100 +@@ -27,7 +27,6 @@ + * POSSIBILITY OF SUCH DAMAGE. + */ + +-#include <sys/cdefs.h> + + /* + * xdr_float.c, Generic XDR routines implementation. diff --git a/package/libtirpc/patches/patch-src_xdr_mem_c b/package/libtirpc/patches/patch-src_xdr_mem_c new file mode 100644 index 000000000..670bba01e --- /dev/null +++ b/package/libtirpc/patches/patch-src_xdr_mem_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/xdr_mem.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/xdr_mem.c 2014-03-22 13:20:53.000000000 +0100 +@@ -26,7 +26,6 @@ + * POSSIBILITY OF SUCH DAMAGE. + */ + +-#include <sys/cdefs.h> + + /* + * xdr_mem.h, XDR implementation using memory buffers. diff --git a/package/libtirpc/patches/patch-src_xdr_rec_c b/package/libtirpc/patches/patch-src_xdr_rec_c new file mode 100644 index 000000000..f4a2672d3 --- /dev/null +++ b/package/libtirpc/patches/patch-src_xdr_rec_c @@ -0,0 +1,11 @@ +--- libtirpc-0.2.3.orig/src/xdr_rec.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/xdr_rec.c 2014-03-22 13:20:53.000000000 +0100 +@@ -27,8 +27,6 @@ + * POSSIBILITY OF SUCH DAMAGE. + */ + +-#include <sys/cdefs.h> +-#include <sys/cdefs.h> + + /* + * xdr_rec.c, Implements TCP/IP based XDR streams with a "record marking" diff --git a/package/libtirpc/patches/patch-src_xdr_reference_c b/package/libtirpc/patches/patch-src_xdr_reference_c new file mode 100644 index 000000000..a0b284380 --- /dev/null +++ b/package/libtirpc/patches/patch-src_xdr_reference_c @@ -0,0 +1,11 @@ +--- libtirpc-0.2.3.orig/src/xdr_reference.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/xdr_reference.c 2014-03-22 13:20:53.000000000 +0100 +@@ -26,8 +26,6 @@ + * POSSIBILITY OF SUCH DAMAGE. + */ + +-#include <sys/cdefs.h> +-#include <sys/cdefs.h> + + /* + * xdr_reference.c, Generic XDR routines impelmentation. diff --git a/package/libtirpc/patches/patch-src_xdr_sizeof_c b/package/libtirpc/patches/patch-src_xdr_sizeof_c new file mode 100644 index 000000000..0246ffa7d --- /dev/null +++ b/package/libtirpc/patches/patch-src_xdr_sizeof_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/xdr_sizeof.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/xdr_sizeof.c 2014-03-22 13:20:53.000000000 +0100 +@@ -34,7 +34,6 @@ + * when serialized using XDR. + */ + +-#include <sys/cdefs.h> + + #include "namespace.h" + #include <rpc/types.h> diff --git a/package/libtirpc/patches/patch-src_xdr_stdio_c b/package/libtirpc/patches/patch-src_xdr_stdio_c new file mode 100644 index 000000000..90dabf120 --- /dev/null +++ b/package/libtirpc/patches/patch-src_xdr_stdio_c @@ -0,0 +1,10 @@ +--- libtirpc-0.2.3.orig/src/xdr_stdio.c 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/src/xdr_stdio.c 2014-03-22 13:20:53.000000000 +0100 +@@ -26,7 +26,6 @@ + * POSSIBILITY OF SUCH DAMAGE. + */ + +-#include <sys/cdefs.h> + + /* + * xdr_stdio.c, XDR implementation on standard i/o file. diff --git a/package/libtirpc/patches/patch-tirpc_misc_event_h b/package/libtirpc/patches/patch-tirpc_misc_event_h new file mode 100644 index 000000000..7fc07813f --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_misc_event_h @@ -0,0 +1,24 @@ +--- libtirpc-0.2.3.orig/tirpc/misc/event.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/misc/event.h 2014-03-22 13:20:52.000000000 +0100 +@@ -186,15 +186,18 @@ extern int kqueue_del_filteropts(int fil + + #else /* !_KERNEL */ + +-#include <sys/cdefs.h> + struct timespec; + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + int kqueue(void); + int kevent(int kq, const struct kevent *changelist, int nchanges, + struct kevent *eventlist, int nevents, + const struct timespec *timeout); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* !_KERNEL */ + diff --git a/package/libtirpc/patches/patch-tirpc_netconfig_h b/package/libtirpc/patches/patch-tirpc_netconfig_h new file mode 100644 index 000000000..2f17d5fd4 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_netconfig_h @@ -0,0 +1,23 @@ +--- libtirpc-0.2.3.orig/tirpc/netconfig.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/netconfig.h 2014-03-22 13:20:52.000000000 +0100 +@@ -74,7 +74,9 @@ typedef struct { + #define NC_UDP "udp" + #define NC_ICMP "icmp" + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + + extern void *setnetconfig (void); + extern struct netconfig *getnetconfig (void *); +@@ -89,6 +91,8 @@ extern int endnetpath (void *); + extern void nc_perror (const char *); + extern char *nc_sperror (void); + +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* _NETCONFIG_H_ */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_auth_des_h b/package/libtirpc/patches/patch-tirpc_rpc_auth_des_h new file mode 100644 index 000000000..c072f8871 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_auth_des_h @@ -0,0 +1,32 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/auth_des.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/auth_des.h 2014-03-22 13:20:52.000000000 +0100 +@@ -114,17 +114,25 @@ struct authdes_verf { + * Map a des credential into a unix cred. + * + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern int authdes_getucred( struct authdes_cred *, uid_t *, gid_t *, int *, gid_t * ); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern bool_t xdr_authdes_cred(XDR *, struct authdes_cred *); + extern bool_t xdr_authdes_verf(XDR *, struct authdes_verf *); + extern int rtime(dev_t, struct netbuf *, int, struct timeval *, + struct timeval *); + extern void kgetnetname(char *); + extern enum auth_stat _svcauth_des(struct svc_req *, struct rpc_msg *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* ndef _TI_AUTH_DES_ */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_auth_gss_h b/package/libtirpc/patches/patch-tirpc_rpc_auth_gss_h new file mode 100644 index 000000000..2d1a07987 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_auth_gss_h @@ -0,0 +1,53 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/auth_gss.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/auth_gss.h 2014-03-22 13:20:52.000000000 +0100 +@@ -104,28 +104,32 @@ struct rpc_gss_init_res { + #define MAXSEQ 0x80000000 + + /* Prototypes. */ +-__BEGIN_DECLS +-bool_t xdr_rpc_gss_cred __P((XDR *xdrs, struct rpc_gss_cred *p)); +-bool_t xdr_rpc_gss_init_args __P((XDR *xdrs, gss_buffer_desc *p)); +-bool_t xdr_rpc_gss_init_res __P((XDR *xdrs, struct rpc_gss_init_res *p)); +-bool_t xdr_rpc_gss_data __P((XDR *xdrs, xdrproc_t xdr_func, ++#ifdef __cplusplus ++extern "C" { ++#endif ++bool_t xdr_rpc_gss_cred (XDR *xdrs, struct rpc_gss_cred *p); ++bool_t xdr_rpc_gss_init_args (XDR *xdrs, gss_buffer_desc *p); ++bool_t xdr_rpc_gss_init_res (XDR *xdrs, struct rpc_gss_init_res *p); ++bool_t xdr_rpc_gss_data (XDR *xdrs, xdrproc_t xdr_func, + caddr_t xdr_ptr, gss_ctx_id_t ctx, + gss_qop_t qop, rpc_gss_svc_t svc, +- u_int seq)); ++ u_int seq); + +-AUTH *authgss_create __P((CLIENT *, gss_name_t, +- struct rpc_gss_sec *)); +-AUTH *authgss_create_default __P((CLIENT *, char *, struct rpc_gss_sec *)); +-bool_t authgss_service __P((AUTH *auth, int svc)); +-bool_t authgss_get_private_data __P((AUTH *auth, +- struct authgss_private_data *)); +-bool_t authgss_free_private_data __P((struct authgss_private_data *)); ++AUTH *authgss_create (CLIENT *, gss_name_t, ++ struct rpc_gss_sec *); ++AUTH *authgss_create_default (CLIENT *, char *, struct rpc_gss_sec *); ++bool_t authgss_service (AUTH *auth, int svc); ++bool_t authgss_get_private_data (AUTH *auth, ++ struct authgss_private_data *); ++bool_t authgss_free_private_data (struct authgss_private_data *); + +-void gss_log_debug __P((const char *fmt, ...)); +-void gss_log_status __P((char *m, OM_uint32 major, +- OM_uint32 minor)); +-void gss_log_hexdump __P((const u_char *buf, int len, int offset)); ++void gss_log_debug (const char *fmt, ...); ++void gss_log_status (char *m, OM_uint32 major, ++ OM_uint32 minor); ++void gss_log_hexdump (const u_char *buf, int len, int offset); + +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* !_TIRPC_AUTH_GSS_H */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_auth_h b/package/libtirpc/patches/patch-tirpc_rpc_auth_h new file mode 100644 index 000000000..b000f85f7 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_auth_h @@ -0,0 +1,192 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/auth.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/auth.h 2014-03-22 13:20:52.000000000 +0100 +@@ -48,7 +48,6 @@ + + #include <rpc/xdr.h> + #include <rpc/clnt_stat.h> +-#include <sys/cdefs.h> + #include <sys/socket.h> + #include <sys/types.h> + #include <stdio.h> +@@ -165,9 +164,13 @@ union des_block { + char c[8]; + }; + typedef union des_block des_block; +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern bool_t xdr_des_block(XDR *, des_block *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * Authentication info. Opaque to client. +@@ -288,9 +291,13 @@ auth_put(AUTH *auth) + xfunc, xwhere)) + + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern struct opaque_auth _null_auth; +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * Any style authentication. These routines can be used by any +@@ -311,11 +318,15 @@ int authany_wrap(void), authany_unwrap(v + * int len; + * int *aup_gids; + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern AUTH *authunix_create(char *, uid_t, uid_t, int, uid_t *); + extern AUTH *authunix_create_default(void); /* takes no parameters */ + extern AUTH *authnone_create(void); /* takes no parameters */ +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + /* + * DES style authentication + * AUTH *authsecdes_create(servername, window, timehost, ckey) +@@ -324,15 +335,23 @@ __END_DECLS + * const char *timehost; - optional hostname to sync with + * des_block *ckey; - optional conversation key to use + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern AUTH *authdes_create (char *, u_int, struct sockaddr *, des_block *); + extern AUTH *authdes_seccreate (const char *, const u_int, const char *, + const des_block *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #define authsys_create(c,i1,i2,i3,ip) authunix_create((c),(i1),(i2),(i3),(ip)) + #define authsys_create_default() authunix_create_default() +@@ -340,36 +359,48 @@ __END_DECLS + /* + * Netname manipulation routines. + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern int getnetname(char *); + extern int host2netname(char *, const char *, const char *); + extern int user2netname(char *, const uid_t, const char *); + extern int netname2user(char *, uid_t *, gid_t *, int *, gid_t *); + extern int netname2host(char *, char *, const int); + extern void passwd2des ( char *, char * ); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * + * These routines interface to the keyserv daemon + * + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern int key_decryptsession(const char *, des_block *); + extern int key_encryptsession(const char *, des_block *); + extern int key_gendes(des_block *); + extern int key_setsecret(const char *); + extern int key_secretkey_is_set(void); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * Publickey routines. + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern int getpublickey (const char *, char *); + extern int getpublicandprivatekey (char *, char *); + extern int getsecretkey (char *, char *, char *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #ifdef KERBEROS + /* +@@ -382,10 +413,14 @@ __END_DECLS + * const char *timehost; - optional hostname to sync with + * int *status; - kerberos status returned + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern AUTH *authkerb_seccreate(const char *, const char *, const char *, + const u_int, const char *, int *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * Map a kerberos credential into a unix cred. +@@ -398,19 +433,27 @@ __END_DECLS + * int *groups; + * + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern int authkerb_getucred(/* struct svc_req *, uid_t *, gid_t *, + short *, int * */); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + #endif /* KERBEROS */ + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + struct svc_req; + struct rpc_msg; + enum auth_stat _svcauth_none (struct svc_req *, struct rpc_msg *); + enum auth_stat _svcauth_short (struct svc_req *, struct rpc_msg *); + enum auth_stat _svcauth_unix (struct svc_req *, struct rpc_msg *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #define AUTH_NONE 0 /* no authentication */ + #define AUTH_NULL 0 /* backward compatibility */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_auth_unix_h b/package/libtirpc/patches/patch-tirpc_rpc_auth_unix_h new file mode 100644 index 000000000..a0c70ece5 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_auth_unix_h @@ -0,0 +1,26 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/auth_unix.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/auth_unix.h 2014-03-22 13:20:52.000000000 +0100 +@@ -45,7 +45,6 @@ + + #ifndef _TIRPC_AUTH_UNIX_H + #define _TIRPC_AUTH_UNIX_H +-#include <sys/cdefs.h> + + /* The machine name is part of a credential; it may not exceed 255 bytes */ + #define MAX_MACHINE_NAME 255 +@@ -67,9 +66,13 @@ struct authunix_parms { + + #define authsys_parms authunix_parms + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern bool_t xdr_authunix_parms(XDR *, struct authunix_parms *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * If a response verifier has flavor AUTH_SHORT, diff --git a/package/libtirpc/patches/patch-tirpc_rpc_clnt_h b/package/libtirpc/patches/patch-tirpc_rpc_clnt_h new file mode 100644 index 000000000..ddd1f73ae --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_clnt_h @@ -0,0 +1,132 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/clnt.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/clnt.h 2014-03-22 13:20:52.000000000 +0100 +@@ -42,7 +42,6 @@ + #include <rpc/clnt_stat.h> + #include <rpc/auth.h> + +-#include <sys/cdefs.h> + #include <netconfig.h> + #include <sys/un.h> + +@@ -267,7 +266,9 @@ struct rpc_timers { + * Generic client creation routine. Supported protocols are those that + * belong to the nettype namespace (/etc/netconfig). + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern CLIENT *clnt_create(const char *, const rpcprog_t, const rpcvers_t, + const char *); + /* +@@ -414,32 +415,46 @@ extern CLIENT *clnt_dg_create(const int, + */ + extern CLIENT *clnt_raw_create(rpcprog_t, rpcvers_t); + +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + + /* + * Print why creation failed + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern void clnt_pcreateerror(const char *); /* stderr */ + extern char *clnt_spcreateerror(const char *); /* string */ +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * Like clnt_perror(), but is more verbose in its output + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern void clnt_perrno(enum clnt_stat); /* stderr */ + extern char *clnt_sperrno(enum clnt_stat); /* string */ +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * Print an English error message, given the client error code + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern void clnt_perror(CLIENT *, const char *); /* stderr */ + extern char *clnt_sperror(CLIENT *, const char *); /* string */ +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + + /* +@@ -450,9 +465,13 @@ struct rpc_createerr { + struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */ + }; + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern struct rpc_createerr *__rpc_createerr(void); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + #define get_rpc_createerr() (*(__rpc_createerr())) + #define rpc_createerr (*(__rpc_createerr())) + +@@ -469,12 +488,16 @@ __END_DECLS + * char *out; + * const char *nettype; + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern enum clnt_stat rpc_call(const char *, const rpcprog_t, + const rpcvers_t, const rpcproc_t, + const xdrproc_t, const char *, + const xdrproc_t, char *, const char *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * RPC broadcast interface +@@ -522,7 +545,9 @@ __END_DECLS + + typedef bool_t (*resultproc_t)(caddr_t, ...); + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern enum clnt_stat rpc_broadcast(const rpcprog_t, const rpcvers_t, + const rpcproc_t, const xdrproc_t, + caddr_t, const xdrproc_t, caddr_t, +@@ -532,7 +557,9 @@ extern enum clnt_stat rpc_broadcast_exp( + caddr_t, const xdrproc_t, caddr_t, + const resultproc_t, const int, + const int, const char *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* For backward compatibility */ + #include <rpc/clnt_soc.h> diff --git a/package/libtirpc/patches/patch-tirpc_rpc_clnt_soc_h b/package/libtirpc/patches/patch-tirpc_rpc_clnt_soc_h new file mode 100644 index 000000000..3112aeee5 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_clnt_soc_h @@ -0,0 +1,78 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/clnt_soc.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/clnt_soc.h 2014-03-22 13:20:52.000000000 +0100 +@@ -46,7 +46,6 @@ + * with TS-RPC. + */ + +-#include <sys/cdefs.h> + + #define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */ + +@@ -61,27 +60,39 @@ + * u_int sendsz; + * u_int recvsz; + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern CLIENT *clnttcp_create(struct sockaddr_in *, u_long, u_long, int *, + u_int, u_int); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * Raw (memory) rpc. + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern CLIENT *clntraw_create(u_long, u_long); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + + /* + IPv6 socket version + */ + #ifdef INET6 +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern CLIENT *clnttcp6_create(struct sockaddr_in6 *, u_long, u_long, int *, + u_int, u_int); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + #endif + + /* +@@ -105,7 +116,9 @@ __END_DECLS + * u_int sendsz; + * u_int recvsz; + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern CLIENT *clntudp_create(struct sockaddr_in *, u_long, u_long, + struct timeval, int *); + extern CLIENT *clntudp_bufcreate(struct sockaddr_in *, u_long, u_long, +@@ -116,7 +129,9 @@ extern CLIENT *clntudp6_create(struct so + extern CLIENT *clntudp6_bufcreate(struct sockaddr_in6 *, u_long, u_long, + struct timeval, int *, u_int, u_int); + #endif +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + + #endif /* _RPC_CLNT_SOC_H */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_des_crypt_h b/package/libtirpc/patches/patch-tirpc_rpc_des_crypt_h new file mode 100644 index 000000000..d55657f95 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_des_crypt_h @@ -0,0 +1,52 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/des_crypt.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/des_crypt.h 2014-03-22 13:20:52.000000000 +0100 +@@ -43,7 +43,6 @@ + #ifndef _DES_DES_CRYPT_H + #define _DES_DES_CRYPT_H + +-#include <sys/cdefs.h> + #include <rpc/rpc.h> + + #define DES_MAXDATA 8192 /* max bytes encrypted in one call */ +@@ -83,23 +82,35 @@ + /* + * Cipher Block Chaining mode + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + int cbc_crypt( char *, char *, unsigned int, unsigned int, char *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * Electronic Code Book mode + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + int ecb_crypt( char *, char *, unsigned int, unsigned int ); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * Set des parity for a key. + * DES parity is odd and in the low bit of each byte + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + void des_setparity( char *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* _DES_DES_CRYPT_H */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_nettype_h b/package/libtirpc/patches/patch-tirpc_rpc_nettype_h new file mode 100644 index 000000000..60759caad --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_nettype_h @@ -0,0 +1,20 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/nettype.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/nettype.h 2014-03-22 13:20:52.000000000 +0100 +@@ -53,11 +53,15 @@ + #define _RPC_TCP 7 + #define _RPC_UDP 8 + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern void *__rpc_setconf(const char *); + extern void __rpc_endconf(void *); + extern struct netconfig *__rpc_getconf(void *); + extern struct netconfig *__rpc_getconfip(const char *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* !_TIRPC_NETTYPE_H */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_pmap_clnt_h b/package/libtirpc/patches/patch-tirpc_rpc_pmap_clnt_h new file mode 100644 index 000000000..7fda59939 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_pmap_clnt_h @@ -0,0 +1,25 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/pmap_clnt.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/pmap_clnt.h 2014-03-22 13:20:52.000000000 +0100 +@@ -63,9 +63,10 @@ + + #ifndef _RPC_PMAP_CLNT_H_ + #define _RPC_PMAP_CLNT_H_ +-#include <sys/cdefs.h> + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern bool_t pmap_set(u_long, u_long, int, int); + extern bool_t pmap_unset(u_long, u_long); + extern struct pmaplist *pmap_getmaps(struct sockaddr_in *); +@@ -80,6 +81,8 @@ extern enum clnt_stat clnt_broadcast(u_l + resultproc_t); + extern u_short pmap_getport(struct sockaddr_in *, + u_long, u_long, u_int); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* !_RPC_PMAP_CLNT_H_ */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_pmap_prot_h b/package/libtirpc/patches/patch-tirpc_rpc_pmap_prot_h new file mode 100644 index 000000000..891991b98 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_pmap_prot_h @@ -0,0 +1,27 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/pmap_prot.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/pmap_prot.h 2014-03-22 13:20:52.000000000 +0100 +@@ -71,7 +71,6 @@ + + #ifndef _RPC_PMAP_PROT_H + #define _RPC_PMAP_PROT_H +-#include <sys/cdefs.h> + + #define PMAPPORT ((u_short)111) + #define PMAPPROG ((u_long)100000) +@@ -97,10 +96,14 @@ struct pmaplist { + struct pmaplist *pml_next; + }; + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern bool_t xdr_pmap(XDR *, struct pmap *); + extern bool_t xdr_pmaplist(XDR *, struct pmaplist **); + extern bool_t xdr_pmaplist_ptr(XDR *, struct pmaplist *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* !_RPC_PMAP_PROT_H */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_pmap_rmt_h b/package/libtirpc/patches/patch-tirpc_rpc_pmap_rmt_h new file mode 100644 index 000000000..98a494105 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_pmap_rmt_h @@ -0,0 +1,26 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/pmap_rmt.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/pmap_rmt.h 2014-03-22 13:20:52.000000000 +0100 +@@ -41,7 +41,6 @@ + + #ifndef _RPC_PMAP_RMT_H + #define _RPC_PMAP_RMT_H +-#include <sys/cdefs.h> + + struct rmtcallargs { + u_long prog, vers, proc, arglen; +@@ -56,9 +55,13 @@ struct rmtcallres { + xdrproc_t xdr_results; + }; + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern bool_t xdr_rmtcall_args(XDR *, struct rmtcallargs *); + extern bool_t xdr_rmtcallres(XDR *, struct rmtcallres *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* !_RPC_PMAP_RMT_H */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_rpc_com_h b/package/libtirpc/patches/patch-tirpc_rpc_rpc_com_h new file mode 100644 index 000000000..59f0283d3 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_rpc_com_h @@ -0,0 +1,31 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/rpc_com.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/rpc_com.h 2014-03-22 13:20:52.000000000 +0100 +@@ -41,7 +41,6 @@ + #ifndef _RPC_RPCCOM_H + #define _RPC_RPCCOM_H + +-#include <sys/cdefs.h> + + /* #pragma ident "@(#)rpc_com.h 1.11 93/07/05 SMI" */ + +@@ -55,7 +54,9 @@ + #define __RPC_GETXID(now) ((u_int32_t)getpid() ^ (u_int32_t)(now)->tv_sec ^ \ + (u_int32_t)(now)->tv_usec) + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern u_int __rpc_get_a_size(int); + extern int __rpc_dtbsize(void); + extern int _rpc_dtablesize(void); +@@ -77,6 +78,8 @@ bool_t rpc_control(int,void *); + + char *_get_next_token(char *, int); + +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* _RPC_RPCCOM_H */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_rpc_h b/package/libtirpc/patches/patch-tirpc_rpc_rpc_h new file mode 100644 index 000000000..7e1f000a2 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_rpc_h @@ -0,0 +1,44 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/rpc.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/rpc.h 2014-03-22 13:20:52.000000000 +0100 +@@ -79,9 +79,11 @@ + #define UDPMSGSIZE 8800 + #endif + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern int get_myaddress(struct sockaddr_in *); +-extern int bindresvport(int, struct sockaddr_in *) __THROW; ++extern int bindresvport(int, struct sockaddr_in *); + extern int registerrpc(int, int, int, char *(*)(char [UDPMSGSIZE]), + xdrproc_t, xdrproc_t); + extern int callrpc(const char *, int, int, int, xdrproc_t, void *, +@@ -93,18 +95,24 @@ struct netbuf *uaddr2taddr(const struct + + struct sockaddr; + extern int bindresvport_sa(int, struct sockaddr *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * The following are not exported interfaces, they are for internal library + * and rpcbind use only. Do not use, they may change without notice. + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + int __rpc_nconf2fd(const struct netconfig *); + int __rpc_nconf2fd_flags(const struct netconfig *, int); + int __rpc_nconf2sockinfo(const struct netconfig *, struct __rpc_sockinfo *); + int __rpc_fd2sockinfo(int, struct __rpc_sockinfo *); + u_int __rpc_get_t_size(int, int, int); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* !_RPC_RPC_H */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_rpc_msg_h b/package/libtirpc/patches/patch-tirpc_rpc_rpc_msg_h new file mode 100644 index 000000000..caee024d8 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_rpc_msg_h @@ -0,0 +1,23 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/rpc_msg.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/rpc_msg.h 2014-03-22 13:20:52.000000000 +0100 +@@ -161,7 +161,9 @@ struct rpc_msg { + #define acpted_rply ru.RM_rmb.ru.RP_ar + #define rjcted_rply ru.RM_rmb.ru.RP_dr + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + /* + * XDR routine to handle a rpc message. + * xdr_callmsg(xdrs, cmsg) +@@ -210,6 +212,8 @@ extern bool_t xdr_rejected_reply(XDR *, + * struct rpc_err *error; + */ + extern void _seterr_reply(struct rpc_msg *, struct rpc_err *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* !_TIRPC_RPC_MSG_H */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_rpcb_clnt_h b/package/libtirpc/patches/patch-tirpc_rpc_rpcb_clnt_h new file mode 100644 index 000000000..b0bc44ae6 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_rpcb_clnt_h @@ -0,0 +1,23 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/rpcb_clnt.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/rpcb_clnt.h 2014-03-22 13:20:52.000000000 +0100 +@@ -59,7 +59,9 @@ + + #include <rpc/types.h> + #include <rpc/rpcb_prot.h> +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern bool_t rpcb_set(const rpcprog_t, const rpcvers_t, + const struct netconfig *, const struct netbuf *); + extern bool_t rpcb_unset(const rpcprog_t, const rpcvers_t, +@@ -78,6 +80,8 @@ extern bool_t rpcb_getaddr(const rpcprog + extern bool_t rpcb_gettime(const char *, time_t *); + extern char *rpcb_taddr2uaddr(struct netconfig *, struct netbuf *); + extern struct netbuf *rpcb_uaddr2taddr(struct netconfig *, char *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* !_RPC_RPCB_CLNT_H */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_rpcent_h b/package/libtirpc/patches/patch-tirpc_rpc_rpcent_h new file mode 100644 index 000000000..badea8121 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_rpcent_h @@ -0,0 +1,31 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/rpcent.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/rpcent.h 2014-03-22 14:22:44.000000000 +0100 +@@ -44,10 +44,12 @@ + /* #pragma ident "@(#)rpcent.h 1.13 94/04/25 SMI" */ + /* @(#)rpcent.h 1.1 88/12/06 SMI */ + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + + /* These are defined in /usr/include/rpc/netdb.h */ +-#if 0 ++#if !defined(__GLIBC__) + struct rpcent { + char *r_name; /* name of server for this rpc program */ + char **r_aliases; /* alias list */ +@@ -60,8 +62,10 @@ extern struct rpcent *getrpcbynumber(int + extern struct rpcent *getrpcent(void); + #endif + +-extern void setrpcent(int) __THROW; +-extern void endrpcent(void) __THROW; +-__END_DECLS ++extern void setrpcent(int); ++extern void endrpcent(void); ++#ifdef __cplusplus ++} ++#endif + + #endif /* !_RPC_CENT_H */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_svc_auth_h b/package/libtirpc/patches/patch-tirpc_rpc_svc_auth_h new file mode 100644 index 000000000..1abf29cde --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_svc_auth_h @@ -0,0 +1,20 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/svc_auth.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/svc_auth.h 2014-03-22 13:20:52.000000000 +0100 +@@ -65,11 +65,15 @@ typedef struct SVCAUTH { + /* + * Server side authenticator + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern enum auth_stat _authenticate(struct svc_req *, struct rpc_msg *); + extern int svc_auth_reg(int, enum auth_stat (*)(struct svc_req *, + struct rpc_msg *)); + +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* !_RPC_SVC_AUTH_H */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_svc_h b/package/libtirpc/patches/patch-tirpc_rpc_svc_h new file mode 100644 index 000000000..fcaf5b172 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_svc_h @@ -0,0 +1,152 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/svc.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/svc.h 2014-03-22 13:20:52.000000000 +0100 +@@ -40,7 +40,6 @@ + + #ifndef _TIRPC_SVC_H + #define _TIRPC_SVC_H +-#include <sys/cdefs.h> + + /* + * This interface must manage two items concerning remote procedure calling: +@@ -200,11 +199,15 @@ struct svc_req { + * const struct netconfig *nconf; + */ + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern bool_t svc_reg(SVCXPRT *, const rpcprog_t, const rpcvers_t, + void (*)(struct svc_req *, SVCXPRT *), + const struct netconfig *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * Service un-registration +@@ -214,9 +217,13 @@ __END_DECLS + * const rpcvers_t vers; + */ + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern void svc_unreg(const rpcprog_t, const rpcvers_t); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * Transport registration. +@@ -224,9 +231,13 @@ __END_DECLS + * xprt_register(xprt) + * SVCXPRT *xprt; + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern void xprt_register(SVCXPRT *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * Transport un-register +@@ -234,9 +245,13 @@ __END_DECLS + * xprt_unregister(xprt) + * SVCXPRT *xprt; + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern void xprt_unregister(SVCXPRT *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + + /* +@@ -265,7 +280,9 @@ __END_DECLS + * deadlock the caller and server processes! + */ + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern bool_t svc_sendreply(SVCXPRT *, xdrproc_t, void *); + extern void svcerr_decode(SVCXPRT *); + extern void svcerr_weakauth(SVCXPRT *); +@@ -277,7 +294,9 @@ extern void svcerr_systemerr(SVCXPRT *); + extern int rpc_reg(rpcprog_t, rpcvers_t, rpcproc_t, + char *(*)(char *), xdrproc_t, xdrproc_t, + char *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * Lowest level dispatching -OR- who owns this process anyway. +@@ -306,11 +325,17 @@ extern int svc_fds; + * a small program implemented by the svc_rpc implementation itself; + * also see clnt.h for protocol numbers. + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern void rpctest_service(void); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern void svc_getreq(int); + extern void svc_getreqset(fd_set *); + extern void svc_getreq_common(int); +@@ -319,7 +344,9 @@ extern void svc_getreq_poll(struct pollf + + extern void svc_run(void); + extern void svc_exit(void); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * Socket to use on svcxxx_create call to get default socket +@@ -331,7 +358,9 @@ __END_DECLS + * These are the existing service side transport implementations + */ + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + /* + * Transport independent svc_create routine. + */ +@@ -427,7 +456,9 @@ int svc_dg_enablecache(SVCXPRT *, const + + int __rpc_get_local_uid(SVCXPRT *_transp, uid_t *_uid); + +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + + /* for backward compatibility */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_svc_soc_h b/package/libtirpc/patches/patch-tirpc_rpc_svc_soc_h new file mode 100644 index 000000000..9f7c22259 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_svc_soc_h @@ -0,0 +1,102 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/svc_soc.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/svc_soc.h 2014-03-22 13:20:52.000000000 +0100 +@@ -38,7 +38,6 @@ + + #ifndef _RPC_SVC_SOC_H + #define _RPC_SVC_SOC_H +-#include <sys/cdefs.h> + + /* #pragma ident "@(#)svc_soc.h 1.11 94/04/25 SMI" */ + /* svc_soc.h 1.8 89/05/01 SMI */ +@@ -64,10 +63,14 @@ + * void (*dispatch)(); + * int protocol; like TCP or UDP, zero means do not register + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern bool_t svc_register(SVCXPRT *, u_long, u_long, + void (*)(struct svc_req *, SVCXPRT *), int); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * Service un-registration +@@ -76,44 +79,64 @@ __END_DECLS + * u_long prog; + * u_long vers; + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern void svc_unregister(u_long, u_long); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + + /* + * Memory based rpc for testing and timing. + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern SVCXPRT *svcraw_create(void); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + + /* + * Udp based rpc. + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern SVCXPRT *svcudp_create(int); + extern SVCXPRT *svcudp_bufcreate(int, u_int, u_int); + extern int svcudp_enablecache(SVCXPRT *, u_long); + extern SVCXPRT *svcudp6_create(int); + extern SVCXPRT *svcudp6_bufcreate(int, u_int, u_int); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + + /* + * Tcp based rpc. + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern SVCXPRT *svctcp_create(int, u_int, u_int); + extern SVCXPRT *svctcp6_create(int, u_int, u_int); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * Fd based rpc. + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern SVCXPRT *svcfd_create(int, u_int, u_int); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* !_RPC_SVC_SOC_H */ diff --git a/package/libtirpc/patches/patch-tirpc_rpc_xdr_h b/package/libtirpc/patches/patch-tirpc_rpc_xdr_h new file mode 100644 index 000000000..0f43e3702 --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpc_xdr_h @@ -0,0 +1,53 @@ +--- libtirpc-0.2.3.orig/tirpc/rpc/xdr.h 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpc/xdr.h 2014-03-22 13:20:52.000000000 +0100 +@@ -40,7 +40,6 @@ + + #ifndef _TIRPC_XDR_H + #define _TIRPC_XDR_H +-#include <sys/cdefs.h> + #include <stdio.h> + #include <netinet/in.h> + +@@ -287,7 +286,9 @@ struct xdr_discrim { + /* + * These are the "generic" xdr routines. + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + extern bool_t xdr_void(void); + extern bool_t xdr_int(XDR *, int *); + extern bool_t xdr_u_int(XDR *, u_int *); +@@ -322,7 +323,9 @@ extern bool_t xdr_hyper(XDR *, quad_t *) + extern bool_t xdr_u_hyper(XDR *, u_quad_t *); + extern bool_t xdr_longlong_t(XDR *, quad_t *); + extern bool_t xdr_u_longlong_t(XDR *, u_quad_t *); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + /* + * Common opaque bytes objects used by many rpc protocols; +@@ -340,7 +343,9 @@ extern bool_t xdr_netobj(XDR *, struct + * These are the public routines for the various implementations of + * xdr streams. + */ +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + /* XDR using memory buffers */ + extern void xdrmem_create(XDR *, char *, u_int, enum xdr_op); + +@@ -361,6 +366,8 @@ extern bool_t xdrrec_skiprecord(XDR *); + /* true if no more input */ + extern bool_t xdrrec_eof(XDR *); + extern u_int xdrrec_readbytes(XDR *, caddr_t, u_int); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* !_TIRPC_XDR_H */ diff --git a/package/libtirpc/patches/patch-tirpc_rpcsvc_crypt_x b/package/libtirpc/patches/patch-tirpc_rpcsvc_crypt_x new file mode 100644 index 000000000..872800b1d --- /dev/null +++ b/package/libtirpc/patches/patch-tirpc_rpcsvc_crypt_x @@ -0,0 +1,12 @@ +--- libtirpc-0.2.3.orig/tirpc/rpcsvc/crypt.x 2013-02-13 16:13:59.000000000 +0100 ++++ libtirpc-0.2.3/tirpc/rpcsvc/crypt.x 2014-03-22 13:20:52.000000000 +0100 +@@ -31,8 +31,7 @@ + */ + + #ifndef RPC_HDR +-%#include <sys/cdefs.h> +-%__FBSDID("$FreeBSD: src/include/rpcsvc/crypt.x,v 1.5 2003/05/04 02:51:42 obrien Exp $"); ++%%__FBSDID("$FreeBSD: src/include/rpcsvc/crypt.x,v 1.5 2003/05/04 02:51:42 obrien Exp $"); + #endif + + /* diff --git a/package/libtirpc/src/src/queue.h b/package/libtirpc/src/src/queue.h new file mode 100644 index 000000000..daf4553d3 --- /dev/null +++ b/package/libtirpc/src/src/queue.h @@ -0,0 +1,574 @@ +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 THE REGENTS 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. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + */ + +#ifndef _SYS_QUEUE_H_ +#define _SYS_QUEUE_H_ + +/* + * This file defines five types of data structures: singly-linked lists, + * lists, simple queues, tail queues, and circular queues. + * + * A singly-linked list is headed by a single forward pointer. The + * elements are singly linked for minimum space and pointer manipulation + * overhead at the expense of O(n) removal for arbitrary elements. New + * elements can be added to the list after an existing element or at the + * head of the list. Elements being removed from the head of the list + * should use the explicit macro for this purpose for optimum + * efficiency. A singly-linked list may only be traversed in the forward + * direction. Singly-linked lists are ideal for applications with large + * datasets and few or no removals or for implementing a LIFO queue. + * + * A list is headed by a single forward pointer (or an array of forward + * pointers for a hash table header). The elements are doubly linked + * so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before + * or after an existing element or at the head of the list. A list + * may only be traversed in the forward direction. + * + * A simple queue is headed by a pair of pointers, one the head of the + * list and the other to the tail of the list. The elements are singly + * linked to save space, so elements can only be removed from the + * head of the list. New elements can be added to the list after + * an existing element, at the head of the list, or at the end of the + * list. A simple queue may only be traversed in the forward direction. + * + * A tail queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or + * after an existing element, at the head of the list, or at the end of + * the list. A tail queue may be traversed in either direction. + * + * A circle queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or after + * an existing element, at the head of the list, or at the end of the list. + * A circle queue may be traversed in either direction, but has a more + * complex end of list detection. + * + * For details on the use of these macros, see the queue(3) manual page. + */ + +/* + * List definitions. + */ +#define LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; /* first element */ \ +} + +#define LIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define LIST_ENTRY(type) \ +struct { \ + struct type *le_next; /* next element */ \ + struct type **le_prev; /* address of previous next element */ \ +} + +/* + * List functions. + */ +#define LIST_INIT(head) do { \ + (head)->lh_first = NULL; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_AFTER(listelm, elm, field) do { \ + if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ + (listelm)->field.le_next->field.le_prev = \ + &(elm)->field.le_next; \ + (listelm)->field.le_next = (elm); \ + (elm)->field.le_prev = &(listelm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.le_prev = (listelm)->field.le_prev; \ + (elm)->field.le_next = (listelm); \ + *(listelm)->field.le_prev = (elm); \ + (listelm)->field.le_prev = &(elm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.le_next = (head)->lh_first) != NULL) \ + (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ + (head)->lh_first = (elm); \ + (elm)->field.le_prev = &(head)->lh_first; \ +} while (/*CONSTCOND*/0) + +#define LIST_REMOVE(elm, field) do { \ + if ((elm)->field.le_next != NULL) \ + (elm)->field.le_next->field.le_prev = \ + (elm)->field.le_prev; \ + *(elm)->field.le_prev = (elm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_FOREACH(var, head, field) \ + for ((var) = ((head)->lh_first); \ + (var); \ + (var) = ((var)->field.le_next)) + +/* + * List access methods. + */ +#define LIST_EMPTY(head) ((head)->lh_first == NULL) +#define LIST_FIRST(head) ((head)->lh_first) +#define LIST_NEXT(elm, field) ((elm)->field.le_next) + + +/* + * Singly-linked List definitions. + */ +#define SLIST_HEAD(name, type) \ +struct name { \ + struct type *slh_first; /* first element */ \ +} + +#define SLIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define SLIST_ENTRY(type) \ +struct { \ + struct type *sle_next; /* next element */ \ +} + +/* + * Singly-linked List functions. + */ +#define SLIST_INIT(head) do { \ + (head)->slh_first = NULL; \ +} while (/*CONSTCOND*/0) + +#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ + (elm)->field.sle_next = (slistelm)->field.sle_next; \ + (slistelm)->field.sle_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define SLIST_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.sle_next = (head)->slh_first; \ + (head)->slh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define SLIST_REMOVE_HEAD(head, field) do { \ + (head)->slh_first = (head)->slh_first->field.sle_next; \ +} while (/*CONSTCOND*/0) + +#define SLIST_REMOVE(head, elm, type, field) do { \ + if ((head)->slh_first == (elm)) { \ + SLIST_REMOVE_HEAD((head), field); \ + } \ + else { \ + struct type *curelm = (head)->slh_first; \ + while(curelm->field.sle_next != (elm)) \ + curelm = curelm->field.sle_next; \ + curelm->field.sle_next = \ + curelm->field.sle_next->field.sle_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define SLIST_FOREACH(var, head, field) \ + for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next) + +/* + * Singly-linked List access methods. + */ +#define SLIST_EMPTY(head) ((head)->slh_first == NULL) +#define SLIST_FIRST(head) ((head)->slh_first) +#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) + + +/* + * Singly-linked Tail queue declarations. + */ +#define STAILQ_HEAD(name, type) \ +struct name { \ + struct type *stqh_first; /* first element */ \ + struct type **stqh_last; /* addr of last next element */ \ +} + +#define STAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).stqh_first } + +#define STAILQ_ENTRY(type) \ +struct { \ + struct type *stqe_next; /* next element */ \ +} + +/* + * Singly-linked Tail queue functions. + */ +#define STAILQ_INIT(head) do { \ + (head)->stqh_first = NULL; \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (head)->stqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.stqe_next = NULL; \ + *(head)->stqh_last = (elm); \ + (head)->stqh_last = &(elm)->field.stqe_next; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (listelm)->field.stqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define STAILQ_REMOVE_HEAD(head, field) do { \ + if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_REMOVE(head, elm, type, field) do { \ + if ((head)->stqh_first == (elm)) { \ + STAILQ_REMOVE_HEAD((head), field); \ + } else { \ + struct type *curelm = (head)->stqh_first; \ + while (curelm->field.stqe_next != (elm)) \ + curelm = curelm->field.stqe_next; \ + if ((curelm->field.stqe_next = \ + curelm->field.stqe_next->field.stqe_next) == NULL) \ + (head)->stqh_last = &(curelm)->field.stqe_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define STAILQ_FOREACH(var, head, field) \ + for ((var) = ((head)->stqh_first); \ + (var); \ + (var) = ((var)->field.stqe_next)) + +#define STAILQ_CONCAT(head1, head2) do { \ + if (!STAILQ_EMPTY((head2))) { \ + *(head1)->stqh_last = (head2)->stqh_first; \ + (head1)->stqh_last = (head2)->stqh_last; \ + STAILQ_INIT((head2)); \ + } \ +} while (/*CONSTCOND*/0) + +/* + * Singly-linked Tail queue access methods. + */ +#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) +#define STAILQ_FIRST(head) ((head)->stqh_first) +#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) + + +/* + * Simple queue definitions. + */ +#define SIMPLEQ_HEAD(name, type) \ +struct name { \ + struct type *sqh_first; /* first element */ \ + struct type **sqh_last; /* addr of last next element */ \ +} + +#define SIMPLEQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).sqh_first } + +#define SIMPLEQ_ENTRY(type) \ +struct { \ + struct type *sqe_next; /* next element */ \ +} + +/* + * Simple queue functions. + */ +#define SIMPLEQ_INIT(head) do { \ + (head)->sqh_first = NULL; \ + (head)->sqh_last = &(head)->sqh_first; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ + (head)->sqh_last = &(elm)->field.sqe_next; \ + (head)->sqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.sqe_next = NULL; \ + *(head)->sqh_last = (elm); \ + (head)->sqh_last = &(elm)->field.sqe_next; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ + (head)->sqh_last = &(elm)->field.sqe_next; \ + (listelm)->field.sqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_REMOVE_HEAD(head, field) do { \ + if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ + (head)->sqh_last = &(head)->sqh_first; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_REMOVE(head, elm, type, field) do { \ + if ((head)->sqh_first == (elm)) { \ + SIMPLEQ_REMOVE_HEAD((head), field); \ + } else { \ + struct type *curelm = (head)->sqh_first; \ + while (curelm->field.sqe_next != (elm)) \ + curelm = curelm->field.sqe_next; \ + if ((curelm->field.sqe_next = \ + curelm->field.sqe_next->field.sqe_next) == NULL) \ + (head)->sqh_last = &(curelm)->field.sqe_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_FOREACH(var, head, field) \ + for ((var) = ((head)->sqh_first); \ + (var); \ + (var) = ((var)->field.sqe_next)) + +/* + * Simple queue access methods. + */ +#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL) +#define SIMPLEQ_FIRST(head) ((head)->sqh_first) +#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) + + +/* + * Tail queue definitions. + */ +#define _TAILQ_HEAD(name, type, qual) \ +struct name { \ + qual type *tqh_first; /* first element */ \ + qual type *qual *tqh_last; /* addr of last next element */ \ +} +#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,) + +#define TAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).tqh_first } + +#define _TAILQ_ENTRY(type, qual) \ +struct { \ + qual type *tqe_next; /* next element */ \ + qual type *qual *tqe_prev; /* address of previous next element */\ +} +#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,) + +/* + * Tail queue functions. + */ +#define TAILQ_INIT(head) do { \ + (head)->tqh_first = NULL; \ + (head)->tqh_last = &(head)->tqh_first; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ + (head)->tqh_first->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_first = (elm); \ + (elm)->field.tqe_prev = &(head)->tqh_first; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.tqe_next = NULL; \ + (elm)->field.tqe_prev = (head)->tqh_last; \ + *(head)->tqh_last = (elm); \ + (head)->tqh_last = &(elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ + (elm)->field.tqe_next->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (listelm)->field.tqe_next = (elm); \ + (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ + (elm)->field.tqe_next = (listelm); \ + *(listelm)->field.tqe_prev = (elm); \ + (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_REMOVE(head, elm, field) do { \ + if (((elm)->field.tqe_next) != NULL) \ + (elm)->field.tqe_next->field.tqe_prev = \ + (elm)->field.tqe_prev; \ + else \ + (head)->tqh_last = (elm)->field.tqe_prev; \ + *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_FOREACH(var, head, field) \ + for ((var) = ((head)->tqh_first); \ + (var); \ + (var) = ((var)->field.tqe_next)) + +#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ + for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ + (var); \ + (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) + +#define TAILQ_CONCAT(head1, head2, field) do { \ + if (!TAILQ_EMPTY(head2)) { \ + *(head1)->tqh_last = (head2)->tqh_first; \ + (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ + (head1)->tqh_last = (head2)->tqh_last; \ + TAILQ_INIT((head2)); \ + } \ +} while (/*CONSTCOND*/0) + +/* + * Tail queue access methods. + */ +#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) +#define TAILQ_FIRST(head) ((head)->tqh_first) +#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) + +#define TAILQ_LAST(head, headname) \ + (*(((struct headname *)((head)->tqh_last))->tqh_last)) +#define TAILQ_PREV(elm, headname, field) \ + (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) + + +/* + * Circular queue definitions. + */ +#define CIRCLEQ_HEAD(name, type) \ +struct name { \ + struct type *cqh_first; /* first element */ \ + struct type *cqh_last; /* last element */ \ +} + +#define CIRCLEQ_HEAD_INITIALIZER(head) \ + { (void *)&head, (void *)&head } + +#define CIRCLEQ_ENTRY(type) \ +struct { \ + struct type *cqe_next; /* next element */ \ + struct type *cqe_prev; /* previous element */ \ +} + +/* + * Circular queue functions. + */ +#define CIRCLEQ_INIT(head) do { \ + (head)->cqh_first = (void *)(head); \ + (head)->cqh_last = (void *)(head); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + (elm)->field.cqe_next = (listelm)->field.cqe_next; \ + (elm)->field.cqe_prev = (listelm); \ + if ((listelm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (listelm)->field.cqe_next->field.cqe_prev = (elm); \ + (listelm)->field.cqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ + (elm)->field.cqe_next = (listelm); \ + (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ + if ((listelm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (listelm)->field.cqe_prev->field.cqe_next = (elm); \ + (listelm)->field.cqe_prev = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.cqe_next = (head)->cqh_first; \ + (elm)->field.cqe_prev = (void *)(head); \ + if ((head)->cqh_last == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (head)->cqh_first->field.cqe_prev = (elm); \ + (head)->cqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.cqe_next = (void *)(head); \ + (elm)->field.cqe_prev = (head)->cqh_last; \ + if ((head)->cqh_first == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (head)->cqh_last->field.cqe_next = (elm); \ + (head)->cqh_last = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_REMOVE(head, elm, field) do { \ + if ((elm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm)->field.cqe_prev; \ + else \ + (elm)->field.cqe_next->field.cqe_prev = \ + (elm)->field.cqe_prev; \ + if ((elm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm)->field.cqe_next; \ + else \ + (elm)->field.cqe_prev->field.cqe_next = \ + (elm)->field.cqe_next; \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_FOREACH(var, head, field) \ + for ((var) = ((head)->cqh_first); \ + (var) != (const void *)(head); \ + (var) = ((var)->field.cqe_next)) + +#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ + for ((var) = ((head)->cqh_last); \ + (var) != (const void *)(head); \ + (var) = ((var)->field.cqe_prev)) + +/* + * Circular queue access methods. + */ +#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) +#define CIRCLEQ_FIRST(head) ((head)->cqh_first) +#define CIRCLEQ_LAST(head) ((head)->cqh_last) +#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) +#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) + +#define CIRCLEQ_LOOP_NEXT(head, elm, field) \ + (((elm)->field.cqe_next == (void *)(head)) \ + ? ((head)->cqh_first) \ + : (elm->field.cqe_next)) +#define CIRCLEQ_LOOP_PREV(head, elm, field) \ + (((elm)->field.cqe_prev == (void *)(head)) \ + ? ((head)->cqh_last) \ + : (elm->field.cqe_prev)) + +#endif /* sys/queue.h */ diff --git a/package/libxml2/Makefile b/package/libxml2/Makefile index 76df60864..8c5ee7689 100644 --- a/package/libxml2/Makefile +++ b/package/libxml2/Makefile @@ -10,7 +10,8 @@ PKG_MD5SUM:= 9c0cfef285d5c4a5c80d00904ddab380 PKG_DESCR:= XML C parser and toolkit PKG_SECTION:= libs PKG_DEPENDS:= zlib -PKG_BUILDDEP:= autotool gettext-tiny bzip2-host python2-host libxml2-host zlib +PKG_BUILDDEP:= libxml2-host zlib +HOST_BUILDDEP:= python2-host PKG_URL:= http://www.xmlsoft.org/ PKG_SITES:= http://xmlsoft.org/sources/ PKG_OPTS:= dev diff --git a/package/logrotate/Makefile b/package/logrotate/Makefile index 32ced2e60..375746034 100644 --- a/package/logrotate/Makefile +++ b/package/logrotate/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= logrotate -PKG_VERSION:= 3.7.8 +PKG_VERSION:= 3.8.7 PKG_RELEASE:= 1 -PKG_MD5SUM:= b3589bea6d8d5afc8a84134fddaae973 +PKG_MD5SUM:= 99e08503ef24c3e2e3ff74cc5f3be213 PKG_DESCR:= logfile rotation utility PKG_SECTION:= misc PKG_DEPENDS:= libpopt diff --git a/package/logrotate/patches/patch-Makefile b/package/logrotate/patches/patch-Makefile index 755e612b1..c2b81fbbc 100644 --- a/package/logrotate/patches/patch-Makefile +++ b/package/logrotate/patches/patch-Makefile @@ -1,60 +1,33 @@ ---- logrotate-3.7.8.orig/Makefile 2008-05-19 12:25:54.000000000 +0200 -+++ logrotate-3.7.8/Makefile 2011-01-15 23:45:59.000000000 +0100 -@@ -1,10 +1,10 @@ +--- logrotate-3.8.7.orig/Makefile 2013-06-10 13:29:16.000000000 +0200 ++++ logrotate-3.8.7/Makefile 2014-03-23 15:16:09.000000000 +0100 +@@ -1,11 +1,11 @@ VERSION = $(shell awk '/Version:/ { print $$2 }' logrotate.spec) -OS_NAME = $(shell uname -s) +OS_NAME = Linux LFS = $(shell echo `getconf LFS_CFLAGS 2>/dev/null`) --CFLAGS = -Wall -D_GNU_SOURCE -D$(OS_NAME) -DVERSION=\"$(VERSION)\" $(RPM_OPT_FLAGS) $(LFS) -+CFLAGS ?= -Wall -D_GNU_SOURCE -D$(OS_NAME) -DVERSION=\"$(VERSION)\" $(RPM_OPT_FLAGS) $(LFS) + CFLAGS = -Wall -D_GNU_SOURCE -D$(OS_NAME) -DVERSION=\"$(VERSION)\" $(RPM_OPT_FLAGS) $(LFS) PROG = logrotate MAN = logrotate.8 + MAN5 = logrotate.conf.5 -LOADLIBES = -lpopt +LIBS = -lpopt SVNURL= svn+ssh://svn.fedorahosted.org/svn/logrotate SVNPUBURL = http://svn.fedorahosted.org/svn/logrotate SVNTAG = r$(subst .,-,$(VERSION)) -@@ -68,10 +68,7 @@ MANDIR = $(BASEDIR)/man - OBJS = logrotate.o log.o config.o basenames.o - SOURCES = $(subst .o,.c,$(OBJS) $(LIBOBJS)) +@@ -64,7 +64,7 @@ endif + # Red Hat Linux + ifeq ($(OS_NAME),Linux) + INSTALL = install +- BASEDIR = /usr ++ BASEDIR = $(DESTDIR)/usr + endif --ifeq ($(RPM_OPT_FLAGS),) --CFLAGS += -g --LDFLAGS = -g --endif -+LDFLAGS ?= - - ifeq (.depend,$(wildcard .depend)) - TARGET=$(PROG) -@@ -84,6 +81,7 @@ RCSVERSION = $(subst .,-,$(VERSION)) - all: $(TARGET) + # FreeBSD +@@ -117,6 +117,7 @@ RCSVERSION = $(subst .,-,$(VERSION)) + all: $(TARGET) pretest $(PROG): $(OBJS) + $(CC) $(LDFLAGS) -o $(PROG) $^ $(LIBS) clean: rm -f $(OBJS) $(PROG) core* .depend -@@ -96,16 +94,16 @@ test: $(TARGET) - (cd test; ./test) - - install: -- [ -d $(PREFIX)/$(BINDIR) ] || mkdir -p $(PREFIX)/$(BINDIR) -- [ -d $(PREFIX)/$(MANDIR) ] || mkdir -p $(PREFIX)/$(MANDIR) -- [ -d $(PREFIX)/$(MANDIR)/man8 ] || mkdir -p $(PREFIX)/$(MANDIR)/man8 -+ [ -d $(DESTDIR)/$(BINDIR) ] || mkdir -p $(DESTDIR)/$(BINDIR) -+ [ -d $(DESTDIR)/$(MANDIR) ] || mkdir -p $(DESTDIR)/$(MANDIR) -+ [ -d $(DESTDIR)/$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)/$(MANDIR)/man8 - - if [ "$(OS_NAME)" = HP-UX ]; then \ -- $(INSTALL) $(PROG) $(PREFIX)/$(BINDIR) 0755 bin bin; \ -- $(INSTALL) $(MAN) $(PREFIX)/$(MANDIR)/man`echo $(MAN) | sed "s/.*\.//"` 0644 bin bin; \ -+ $(INSTALL) $(PROG) $(DESTDIR)/$(BINDIR) 0755 bin bin; \ -+ $(INSTALL) $(MAN) $(DESTDIR)/$(MANDIR)/man`echo $(MAN) | sed "s/.*\.//"` 0644 bin bin; \ - else \ -- $(INSTALL) -m 755 $(PROG) $(PREFIX)/$(BINDIR); \ -- $(INSTALL) -m 644 $(MAN) $(PREFIX)/$(MANDIR)/man`echo $(MAN) | sed "s/.*\.//"`/$(MAN); \ -+ $(INSTALL) -m 755 $(PROG) $(DESTDIR)/$(BINDIR); \ -+ $(INSTALL) -m 644 $(MAN) $(DESTDIR)/$(MANDIR)/man`echo $(MAN) | sed "s/.*\.//"`/$(MAN); \ - fi - - co: diff --git a/package/logrotate/patches/patch-config_c b/package/logrotate/patches/patch-config_c new file mode 100644 index 000000000..ea58cd4ce --- /dev/null +++ b/package/logrotate/patches/patch-config_c @@ -0,0 +1,8 @@ +--- logrotate-3.8.7.orig/config.c 2013-07-31 13:34:31.000000000 +0200 ++++ logrotate-3.8.7/config.c 2014-03-23 15:11:39.000000000 +0100 +@@ -1,4 +1,4 @@ +-#include <sys/queue.h> ++#include "queue.h" + /* Alloca is defined in stdlib.h in NetBSD */ + #ifndef __NetBSD__ + #include <alloca.h> diff --git a/package/logrotate/patches/patch-logrotate_c b/package/logrotate/patches/patch-logrotate_c new file mode 100644 index 000000000..d2ee8dd83 --- /dev/null +++ b/package/logrotate/patches/patch-logrotate_c @@ -0,0 +1,8 @@ +--- logrotate-3.8.7.orig/logrotate.c 2013-10-10 10:43:36.000000000 +0200 ++++ logrotate-3.8.7/logrotate.c 2014-03-23 15:10:21.000000000 +0100 +@@ -1,4 +1,4 @@ +-#include <sys/queue.h> ++#include "queue.h" + /* alloca() is defined in stdlib.h in NetBSD */ + #ifndef __NetBSD__ + #include <alloca.h> diff --git a/package/logrotate/patches/patch-logrotate_h b/package/logrotate/patches/patch-logrotate_h new file mode 100644 index 000000000..7bc3c06ef --- /dev/null +++ b/package/logrotate/patches/patch-logrotate_h @@ -0,0 +1,11 @@ +--- logrotate-3.8.7.orig/logrotate.h 2013-06-10 13:29:16.000000000 +0200 ++++ logrotate-3.8.7/logrotate.h 2014-03-23 15:11:06.000000000 +0100 +@@ -2,7 +2,7 @@ + #define H_LOGROTATE + + #include <sys/types.h> +-#include <sys/queue.h> ++#include "queue.h" + #include <glob.h> + + #include "config.h" diff --git a/package/logrotate/src/queue.h b/package/logrotate/src/queue.h new file mode 100644 index 000000000..daf4553d3 --- /dev/null +++ b/package/logrotate/src/queue.h @@ -0,0 +1,574 @@ +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 THE REGENTS 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. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + */ + +#ifndef _SYS_QUEUE_H_ +#define _SYS_QUEUE_H_ + +/* + * This file defines five types of data structures: singly-linked lists, + * lists, simple queues, tail queues, and circular queues. + * + * A singly-linked list is headed by a single forward pointer. The + * elements are singly linked for minimum space and pointer manipulation + * overhead at the expense of O(n) removal for arbitrary elements. New + * elements can be added to the list after an existing element or at the + * head of the list. Elements being removed from the head of the list + * should use the explicit macro for this purpose for optimum + * efficiency. A singly-linked list may only be traversed in the forward + * direction. Singly-linked lists are ideal for applications with large + * datasets and few or no removals or for implementing a LIFO queue. + * + * A list is headed by a single forward pointer (or an array of forward + * pointers for a hash table header). The elements are doubly linked + * so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before + * or after an existing element or at the head of the list. A list + * may only be traversed in the forward direction. + * + * A simple queue is headed by a pair of pointers, one the head of the + * list and the other to the tail of the list. The elements are singly + * linked to save space, so elements can only be removed from the + * head of the list. New elements can be added to the list after + * an existing element, at the head of the list, or at the end of the + * list. A simple queue may only be traversed in the forward direction. + * + * A tail queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or + * after an existing element, at the head of the list, or at the end of + * the list. A tail queue may be traversed in either direction. + * + * A circle queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or after + * an existing element, at the head of the list, or at the end of the list. + * A circle queue may be traversed in either direction, but has a more + * complex end of list detection. + * + * For details on the use of these macros, see the queue(3) manual page. + */ + +/* + * List definitions. + */ +#define LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; /* first element */ \ +} + +#define LIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define LIST_ENTRY(type) \ +struct { \ + struct type *le_next; /* next element */ \ + struct type **le_prev; /* address of previous next element */ \ +} + +/* + * List functions. + */ +#define LIST_INIT(head) do { \ + (head)->lh_first = NULL; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_AFTER(listelm, elm, field) do { \ + if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ + (listelm)->field.le_next->field.le_prev = \ + &(elm)->field.le_next; \ + (listelm)->field.le_next = (elm); \ + (elm)->field.le_prev = &(listelm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.le_prev = (listelm)->field.le_prev; \ + (elm)->field.le_next = (listelm); \ + *(listelm)->field.le_prev = (elm); \ + (listelm)->field.le_prev = &(elm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.le_next = (head)->lh_first) != NULL) \ + (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ + (head)->lh_first = (elm); \ + (elm)->field.le_prev = &(head)->lh_first; \ +} while (/*CONSTCOND*/0) + +#define LIST_REMOVE(elm, field) do { \ + if ((elm)->field.le_next != NULL) \ + (elm)->field.le_next->field.le_prev = \ + (elm)->field.le_prev; \ + *(elm)->field.le_prev = (elm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_FOREACH(var, head, field) \ + for ((var) = ((head)->lh_first); \ + (var); \ + (var) = ((var)->field.le_next)) + +/* + * List access methods. + */ +#define LIST_EMPTY(head) ((head)->lh_first == NULL) +#define LIST_FIRST(head) ((head)->lh_first) +#define LIST_NEXT(elm, field) ((elm)->field.le_next) + + +/* + * Singly-linked List definitions. + */ +#define SLIST_HEAD(name, type) \ +struct name { \ + struct type *slh_first; /* first element */ \ +} + +#define SLIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define SLIST_ENTRY(type) \ +struct { \ + struct type *sle_next; /* next element */ \ +} + +/* + * Singly-linked List functions. + */ +#define SLIST_INIT(head) do { \ + (head)->slh_first = NULL; \ +} while (/*CONSTCOND*/0) + +#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ + (elm)->field.sle_next = (slistelm)->field.sle_next; \ + (slistelm)->field.sle_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define SLIST_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.sle_next = (head)->slh_first; \ + (head)->slh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define SLIST_REMOVE_HEAD(head, field) do { \ + (head)->slh_first = (head)->slh_first->field.sle_next; \ +} while (/*CONSTCOND*/0) + +#define SLIST_REMOVE(head, elm, type, field) do { \ + if ((head)->slh_first == (elm)) { \ + SLIST_REMOVE_HEAD((head), field); \ + } \ + else { \ + struct type *curelm = (head)->slh_first; \ + while(curelm->field.sle_next != (elm)) \ + curelm = curelm->field.sle_next; \ + curelm->field.sle_next = \ + curelm->field.sle_next->field.sle_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define SLIST_FOREACH(var, head, field) \ + for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next) + +/* + * Singly-linked List access methods. + */ +#define SLIST_EMPTY(head) ((head)->slh_first == NULL) +#define SLIST_FIRST(head) ((head)->slh_first) +#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) + + +/* + * Singly-linked Tail queue declarations. + */ +#define STAILQ_HEAD(name, type) \ +struct name { \ + struct type *stqh_first; /* first element */ \ + struct type **stqh_last; /* addr of last next element */ \ +} + +#define STAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).stqh_first } + +#define STAILQ_ENTRY(type) \ +struct { \ + struct type *stqe_next; /* next element */ \ +} + +/* + * Singly-linked Tail queue functions. + */ +#define STAILQ_INIT(head) do { \ + (head)->stqh_first = NULL; \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (head)->stqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.stqe_next = NULL; \ + *(head)->stqh_last = (elm); \ + (head)->stqh_last = &(elm)->field.stqe_next; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (listelm)->field.stqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define STAILQ_REMOVE_HEAD(head, field) do { \ + if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_REMOVE(head, elm, type, field) do { \ + if ((head)->stqh_first == (elm)) { \ + STAILQ_REMOVE_HEAD((head), field); \ + } else { \ + struct type *curelm = (head)->stqh_first; \ + while (curelm->field.stqe_next != (elm)) \ + curelm = curelm->field.stqe_next; \ + if ((curelm->field.stqe_next = \ + curelm->field.stqe_next->field.stqe_next) == NULL) \ + (head)->stqh_last = &(curelm)->field.stqe_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define STAILQ_FOREACH(var, head, field) \ + for ((var) = ((head)->stqh_first); \ + (var); \ + (var) = ((var)->field.stqe_next)) + +#define STAILQ_CONCAT(head1, head2) do { \ + if (!STAILQ_EMPTY((head2))) { \ + *(head1)->stqh_last = (head2)->stqh_first; \ + (head1)->stqh_last = (head2)->stqh_last; \ + STAILQ_INIT((head2)); \ + } \ +} while (/*CONSTCOND*/0) + +/* + * Singly-linked Tail queue access methods. + */ +#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) +#define STAILQ_FIRST(head) ((head)->stqh_first) +#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) + + +/* + * Simple queue definitions. + */ +#define SIMPLEQ_HEAD(name, type) \ +struct name { \ + struct type *sqh_first; /* first element */ \ + struct type **sqh_last; /* addr of last next element */ \ +} + +#define SIMPLEQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).sqh_first } + +#define SIMPLEQ_ENTRY(type) \ +struct { \ + struct type *sqe_next; /* next element */ \ +} + +/* + * Simple queue functions. + */ +#define SIMPLEQ_INIT(head) do { \ + (head)->sqh_first = NULL; \ + (head)->sqh_last = &(head)->sqh_first; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ + (head)->sqh_last = &(elm)->field.sqe_next; \ + (head)->sqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.sqe_next = NULL; \ + *(head)->sqh_last = (elm); \ + (head)->sqh_last = &(elm)->field.sqe_next; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ + (head)->sqh_last = &(elm)->field.sqe_next; \ + (listelm)->field.sqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_REMOVE_HEAD(head, field) do { \ + if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ + (head)->sqh_last = &(head)->sqh_first; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_REMOVE(head, elm, type, field) do { \ + if ((head)->sqh_first == (elm)) { \ + SIMPLEQ_REMOVE_HEAD((head), field); \ + } else { \ + struct type *curelm = (head)->sqh_first; \ + while (curelm->field.sqe_next != (elm)) \ + curelm = curelm->field.sqe_next; \ + if ((curelm->field.sqe_next = \ + curelm->field.sqe_next->field.sqe_next) == NULL) \ + (head)->sqh_last = &(curelm)->field.sqe_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_FOREACH(var, head, field) \ + for ((var) = ((head)->sqh_first); \ + (var); \ + (var) = ((var)->field.sqe_next)) + +/* + * Simple queue access methods. + */ +#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL) +#define SIMPLEQ_FIRST(head) ((head)->sqh_first) +#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) + + +/* + * Tail queue definitions. + */ +#define _TAILQ_HEAD(name, type, qual) \ +struct name { \ + qual type *tqh_first; /* first element */ \ + qual type *qual *tqh_last; /* addr of last next element */ \ +} +#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,) + +#define TAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).tqh_first } + +#define _TAILQ_ENTRY(type, qual) \ +struct { \ + qual type *tqe_next; /* next element */ \ + qual type *qual *tqe_prev; /* address of previous next element */\ +} +#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,) + +/* + * Tail queue functions. + */ +#define TAILQ_INIT(head) do { \ + (head)->tqh_first = NULL; \ + (head)->tqh_last = &(head)->tqh_first; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ + (head)->tqh_first->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_first = (elm); \ + (elm)->field.tqe_prev = &(head)->tqh_first; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.tqe_next = NULL; \ + (elm)->field.tqe_prev = (head)->tqh_last; \ + *(head)->tqh_last = (elm); \ + (head)->tqh_last = &(elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ + (elm)->field.tqe_next->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (listelm)->field.tqe_next = (elm); \ + (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ + (elm)->field.tqe_next = (listelm); \ + *(listelm)->field.tqe_prev = (elm); \ + (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_REMOVE(head, elm, field) do { \ + if (((elm)->field.tqe_next) != NULL) \ + (elm)->field.tqe_next->field.tqe_prev = \ + (elm)->field.tqe_prev; \ + else \ + (head)->tqh_last = (elm)->field.tqe_prev; \ + *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_FOREACH(var, head, field) \ + for ((var) = ((head)->tqh_first); \ + (var); \ + (var) = ((var)->field.tqe_next)) + +#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ + for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ + (var); \ + (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) + +#define TAILQ_CONCAT(head1, head2, field) do { \ + if (!TAILQ_EMPTY(head2)) { \ + *(head1)->tqh_last = (head2)->tqh_first; \ + (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ + (head1)->tqh_last = (head2)->tqh_last; \ + TAILQ_INIT((head2)); \ + } \ +} while (/*CONSTCOND*/0) + +/* + * Tail queue access methods. + */ +#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) +#define TAILQ_FIRST(head) ((head)->tqh_first) +#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) + +#define TAILQ_LAST(head, headname) \ + (*(((struct headname *)((head)->tqh_last))->tqh_last)) +#define TAILQ_PREV(elm, headname, field) \ + (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) + + +/* + * Circular queue definitions. + */ +#define CIRCLEQ_HEAD(name, type) \ +struct name { \ + struct type *cqh_first; /* first element */ \ + struct type *cqh_last; /* last element */ \ +} + +#define CIRCLEQ_HEAD_INITIALIZER(head) \ + { (void *)&head, (void *)&head } + +#define CIRCLEQ_ENTRY(type) \ +struct { \ + struct type *cqe_next; /* next element */ \ + struct type *cqe_prev; /* previous element */ \ +} + +/* + * Circular queue functions. + */ +#define CIRCLEQ_INIT(head) do { \ + (head)->cqh_first = (void *)(head); \ + (head)->cqh_last = (void *)(head); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + (elm)->field.cqe_next = (listelm)->field.cqe_next; \ + (elm)->field.cqe_prev = (listelm); \ + if ((listelm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (listelm)->field.cqe_next->field.cqe_prev = (elm); \ + (listelm)->field.cqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ + (elm)->field.cqe_next = (listelm); \ + (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ + if ((listelm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (listelm)->field.cqe_prev->field.cqe_next = (elm); \ + (listelm)->field.cqe_prev = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.cqe_next = (head)->cqh_first; \ + (elm)->field.cqe_prev = (void *)(head); \ + if ((head)->cqh_last == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (head)->cqh_first->field.cqe_prev = (elm); \ + (head)->cqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.cqe_next = (void *)(head); \ + (elm)->field.cqe_prev = (head)->cqh_last; \ + if ((head)->cqh_first == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (head)->cqh_last->field.cqe_next = (elm); \ + (head)->cqh_last = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_REMOVE(head, elm, field) do { \ + if ((elm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm)->field.cqe_prev; \ + else \ + (elm)->field.cqe_next->field.cqe_prev = \ + (elm)->field.cqe_prev; \ + if ((elm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm)->field.cqe_next; \ + else \ + (elm)->field.cqe_prev->field.cqe_next = \ + (elm)->field.cqe_next; \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_FOREACH(var, head, field) \ + for ((var) = ((head)->cqh_first); \ + (var) != (const void *)(head); \ + (var) = ((var)->field.cqe_next)) + +#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ + for ((var) = ((head)->cqh_last); \ + (var) != (const void *)(head); \ + (var) = ((var)->field.cqe_prev)) + +/* + * Circular queue access methods. + */ +#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) +#define CIRCLEQ_FIRST(head) ((head)->cqh_first) +#define CIRCLEQ_LAST(head) ((head)->cqh_last) +#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) +#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) + +#define CIRCLEQ_LOOP_NEXT(head, elm, field) \ + (((elm)->field.cqe_next == (void *)(head)) \ + ? ((head)->cqh_first) \ + : (elm->field.cqe_next)) +#define CIRCLEQ_LOOP_PREV(head, elm, field) \ + (((elm)->field.cqe_prev == (void *)(head)) \ + ? ((head)->cqh_last) \ + : (elm->field.cqe_prev)) + +#endif /* sys/queue.h */ diff --git a/package/lynx/Makefile b/package/lynx/Makefile index 77cb6ef3e..b15da35e6 100644 --- a/package/lynx/Makefile +++ b/package/lynx/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= lynx -PKG_VERSION:= 2.8.7 +PKG_VERSION:= 2.8.8 PKG_RELEASE:= 1 -PKG_MD5SUM:= e36d70f3f09b2d502055ca67f09e363c +PKG_MD5SUM:= 7caa6773f94e136556c1c30629fe1431 PKG_DESCR:= Standard text browser PKG_SECTION:= browser PKG_DEPENDS:= libncurses libopenssl zlib @@ -17,7 +17,7 @@ PKG_SITES:= http://lynx.isc.org/${PKG_NAME}${PKG_VERSION}/ PKG_NOPARALLEL:= 1 DISTFILES= ${PKG_NAME}${PKG_VERSION}.tar.gz -WRKDIST= ${WRKDIR}/lynx2-8-7 +WRKDIST= ${WRKDIR}/lynx2-8-8 include ${TOPDIR}/mk/package.mk diff --git a/package/lynx/patches/patch-WWW_Library_Implementation_HTUtils_h b/package/lynx/patches/patch-WWW_Library_Implementation_HTUtils_h index d16953cca..c8217b70e 100644 --- a/package/lynx/patches/patch-WWW_Library_Implementation_HTUtils_h +++ b/package/lynx/patches/patch-WWW_Library_Implementation_HTUtils_h @@ -1,6 +1,6 @@ ---- lynx2-8-7.orig/WWW/Library/Implementation/HTUtils.h 2009-05-25 23:05:31.000000000 +0200 -+++ lynx2-8-7/WWW/Library/Implementation/HTUtils.h 2010-05-29 12:56:42.125000000 +0200 -@@ -677,6 +677,8 @@ extern int WWW_TraceMask; +--- lynx2-8-8.orig/WWW/Library/Implementation/HTUtils.h 2014-02-05 01:50:18.000000000 +0100 ++++ lynx2-8-8/WWW/Library/Implementation/HTUtils.h 2014-03-21 22:14:07.000000000 +0100 +@@ -725,6 +725,8 @@ extern int WWW_TraceMask; #define SHORTENED_RBIND /* FIXME: do this in configure-script */ @@ -9,15 +9,15 @@ #ifdef USE_SSL #define free_func free__func -@@ -717,6 +719,7 @@ extern int WWW_TraceMask; +@@ -765,6 +767,7 @@ extern int WWW_TraceMask; #undef free_func #endif /* USE_SSL */ +#endif - #ifdef HAVE_LIBDMALLOC - #include <dmalloc.h> /* Gray Watson's library */ -@@ -747,11 +750,14 @@ extern "C" { + #ifdef HAVE_BSD_STDLIB_H + #include <bsd/stdlib.h> /* prototype for arc4random.h */ +@@ -801,11 +804,14 @@ extern "C" { extern FILE *TraceFP(void); diff --git a/package/lynx/patches/patch-makefile_in b/package/lynx/patches/patch-makefile_in new file mode 100644 index 000000000..5cb6b5962 --- /dev/null +++ b/package/lynx/patches/patch-makefile_in @@ -0,0 +1,11 @@ +--- lynx2-8-8.orig/makefile.in 2014-03-09 22:43:10.000000000 +0100 ++++ lynx2-8-8/makefile.in 2014-03-21 23:17:26.000000000 +0100 +@@ -210,7 +210,7 @@ SRC_CFLAGS = \ + WWWINC=$(WWW_DIR) \ + WWWLIB="../$(WWW_DIR)/libwww.a" + +-actual_PROG = `echo lynx| sed '$(transform)'` ++actual_PROG = lynx + binary_PROG = $(actual_PROG)$x + + all lynx$x: cfg_defs.h LYHelp.h diff --git a/package/lynx/patches/patch-src_chrtrans_makeuctb_c b/package/lynx/patches/patch-src_chrtrans_makeuctb_c index 9f23671e7..9972a6f8c 100644 --- a/package/lynx/patches/patch-src_chrtrans_makeuctb_c +++ b/package/lynx/patches/patch-src_chrtrans_makeuctb_c @@ -1,23 +1,10 @@ ---- lynx2-8-7.orig/src/chrtrans/makeuctb.c 2009-02-02 02:41:02.000000000 +0100 -+++ lynx2-8-7/src/chrtrans/makeuctb.c 2010-05-29 12:55:33.031250000 +0200 -@@ -18,6 +18,7 @@ - * version 2, or at your option any later version. - */ - -+ - #ifndef HAVE_CONFIG_H - /* override HTUtils.h fallbacks for cross-compiling */ - #undef HAVE_LSTAT -@@ -28,10 +29,12 @@ +--- lynx2-8-8.orig/src/chrtrans/makeuctb.c 2013-11-29 01:52:56.000000000 +0100 ++++ lynx2-8-8/src/chrtrans/makeuctb.c 2014-03-21 22:12:13.000000000 +0100 +@@ -28,6 +28,7 @@ #define DONT_USE_GETTEXT #define DONT_USE_SOCKS5 +#define DONT_USE_SSL #include <UCDefs.h> #include <UCkd.h> - #include <LYUtils.h> -+ - /* - * Don't try to use LYexit() since this is a standalone file. - */ diff --git a/package/lzma/Makefile b/package/lzma/Makefile new file mode 100644 index 000000000..7d2a2e653 --- /dev/null +++ b/package/lzma/Makefile @@ -0,0 +1,28 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include $(TOPDIR)/rules.mk + +PKG_NAME:= lzma +PKG_VERSION:= 4.32.7 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 2a748b77a2f8c3cbc322dbd0b4c9d06a +PKG_DESCR:= LZMA compression utility +PKG_SECTION:= archive +PKG_URL:= http://tukaani.org/lzma/ +PKG_SITES:= http://tukaani.org/lzma/ + +include $(TOPDIR)/mk/host.mk +include $(TOPDIR)/mk/package.mk + +$(eval $(call HOST_template,LZMA,lzma,$(PKG_VERSION)-${PKG_RELEASE})) +$(eval $(call PKG_template,LZMA,lzma,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) + +HOST_STYLE:= auto + +lzma-install: + $(INSTALL_DIR) $(IDIR_LZMA)/usr/bin + $(INSTALL_BIN) $(WRKINST)/usr/bin/lzma $(IDIR_LZMA)/usr/bin + +include ${TOPDIR}/mk/host-bottom.mk +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/lzop/Makefile b/package/lzop/Makefile index f939092a5..95278fcd3 100644 --- a/package/lzop/Makefile +++ b/package/lzop/Makefile @@ -11,15 +11,21 @@ PKG_DESCR:= LZO compression utility PKG_SECTION:= archive PKG_DEPENDS:= liblzo PKG_BUILDDEP:= liblzo +HOST_BUILDDEP:= liblzo-host PKG_URL:= http://www.lzop.org/ PKG_SITES:= http://www.lzop.org/download/ +include $(TOPDIR)/mk/host.mk include $(TOPDIR)/mk/package.mk +$(eval $(call HOST_template,LZOP,lzop,$(PKG_VERSION)-${PKG_RELEASE})) $(eval $(call PKG_template,LZOP,lzop,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +HOST_STYLE:= auto + lzop-install: $(INSTALL_DIR) $(IDIR_LZOP)/usr/bin $(INSTALL_BIN) $(WRKINST)/usr/bin/lzop $(IDIR_LZOP)/usr/bin +include ${TOPDIR}/mk/host-bottom.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/mkimage/Makefile b/package/mkimage/Makefile new file mode 100644 index 000000000..3d6fbc45d --- /dev/null +++ b/package/mkimage/Makefile @@ -0,0 +1,33 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include $(TOPDIR)/rules.mk + +PKG_NAME:= mkimage +PKG_VERSION:= 0.1 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 1b7a781fb4cf8938842279bd3e8ee852 +PKG_DESCR:= stripped down mkimage utility +PKG_SECTION:= misc + +NO_DISTFILES:= 1 + +PKG_CFLINE_MKIMAGE:= depends on ADK_HOST_ONLY + +include $(TOPDIR)/mk/host.mk +include $(TOPDIR)/mk/package.mk + +$(eval $(call HOST_template,MKIMAGE,mkimage,$(PKG_VERSION)-${PKG_RELEASE})) + +HOST_STYLE:= manual + +host-build: + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o ${WRKBUILD}/mkimage ${WRKBUILD}/mkimage.c ${WRKBUILD}/crc32.c + +mkimage-hostinstall: + ${INSTALL_DIR} ${STAGING_HOST_DIR}/usr/bin + ${INSTALL_BIN} ${WRKBUILD}/mkimage \ + ${STAGING_HOST_DIR}/usr/bin + +include ${TOPDIR}/mk/host-bottom.mk +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/mkimage/src/crc32.c b/package/mkimage/src/crc32.c new file mode 100644 index 000000000..067b3106c --- /dev/null +++ b/package/mkimage/src/crc32.c @@ -0,0 +1,200 @@ +/* + * This file is derived from crc32.c from the zlib-1.1.3 distribution + * by Jean-loup Gailly and Mark Adler. + */ + +/* crc32.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995-1998 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#define USE_HOSTCC + +#ifndef USE_HOSTCC /* Shut down "ANSI does not permit..." warnings */ +#include <common.h> /* to get command definitions like CFG_CMD_JFFS2 */ +#endif + +#include "zlib.h" + +#define local static +#define ZEXPORT /* empty */ +unsigned long crc32 (unsigned long, const unsigned char *, unsigned int); + +#ifdef DYNAMIC_CRC_TABLE + +local int crc_table_empty = 1; +local uLongf crc_table[256]; +local void make_crc_table OF((void)); + +/* + Generate a table for a byte-wise 32-bit CRC calculation on the polynomial: + x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. + + Polynomials over GF(2) are represented in binary, one bit per coefficient, + with the lowest powers in the most significant bit. Then adding polynomials + is just exclusive-or, and multiplying a polynomial by x is a right shift by + one. If we call the above polynomial p, and represent a byte as the + polynomial q, also with the lowest power in the most significant bit (so the + byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, + where a mod b means the remainder after dividing a by b. + + This calculation is done using the shift-register method of multiplying and + taking the remainder. The register is initialized to zero, and for each + incoming bit, x^32 is added mod p to the register if the bit is a one (where + x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by + x (which is shifting right by one and adding x^32 mod p if the bit shifted + out is a one). We start with the highest power (least significant bit) of + q and repeat for all eight bits of q. + + The table is simply the CRC of all possible eight bit values. This is all + the information needed to generate CRC's on data a byte at a time for all + combinations of CRC register values and incoming bytes. +*/ +local void make_crc_table() +{ + uLong c; + int n, k; + uLong poly; /* polynomial exclusive-or pattern */ + /* terms of polynomial defining this crc (except x^32): */ + static const Byte p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; + + /* make exclusive-or pattern from polynomial (0xedb88320L) */ + poly = 0L; + for (n = 0; n < sizeof(p)/sizeof(Byte); n++) + poly |= 1L << (31 - p[n]); + + for (n = 0; n < 256; n++) + { + c = (uLong)n; + for (k = 0; k < 8; k++) + c = c & 1 ? poly ^ (c >> 1) : c >> 1; + crc_table[n] = c; + } + crc_table_empty = 0; +} +#else +/* ======================================================================== + * Table of CRC-32's of all single-byte values (made by make_crc_table) + */ +local const uLongf crc_table[256] = { + 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, + 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, + 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, + 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, + 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, + 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, + 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, + 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, + 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, + 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, + 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, + 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, + 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, + 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, + 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, + 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, + 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, + 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, + 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, + 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, + 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, + 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, + 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, + 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, + 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, + 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, + 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, + 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, + 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, + 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, + 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, + 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, + 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, + 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, + 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, + 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, + 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, + 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, + 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, + 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, + 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, + 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, + 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, + 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, + 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, + 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, + 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, + 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, + 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, + 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, + 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, + 0x2d02ef8dL +}; +#endif + +#if 0 +/* ========================================================================= + * This function can be used by asm versions of crc32() + */ +const uLongf * ZEXPORT get_crc_table() +{ +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) make_crc_table(); +#endif + return (const uLongf *)crc_table; +} +#endif + +/* ========================================================================= */ +#define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8); +#define DO2(buf) DO1(buf); DO1(buf); +#define DO4(buf) DO2(buf); DO2(buf); +#define DO8(buf) DO4(buf); DO4(buf); + +/* ========================================================================= */ +uLong ZEXPORT crc32(crc, buf, len) + uLong crc; + const Bytef *buf; + uInt len; +{ +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif + crc = crc ^ 0xffffffffL; + while (len >= 8) + { + DO8(buf); + len -= 8; + } + if (len) do { + DO1(buf); + } while (--len); + return crc ^ 0xffffffffL; +} + +#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) || \ + ((CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY)) + +/* No ones complement version. JFFS2 (and other things ?) + * don't use ones compliment in their CRC calculations. + */ +uLong ZEXPORT crc32_no_comp(uLong crc, const Bytef *buf, uInt len) +{ +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif + while (len >= 8) + { + DO8(buf); + len -= 8; + } + if (len) do { + DO1(buf); + } while (--len); + + return crc; +} + +#endif /* CFG_CMD_JFFS2 */ diff --git a/package/mkimage/src/image.h b/package/mkimage/src/image.h new file mode 100644 index 000000000..cb62cde5b --- /dev/null +++ b/package/mkimage/src/image.h @@ -0,0 +1,161 @@ +/* + * (C) Copyright 2000-2005 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * 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 of + * the License, 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ******************************************************************** + * NOTE: This header file defines an interface to U-Boot. Including + * this (unmodified) header file in another file is considered normal + * use of U-Boot, and does *not* fall under the heading of "derived + * work". + ******************************************************************** + */ + +#ifndef __IMAGE_H__ +#define __IMAGE_H__ + +/* + * Operating System Codes + */ +#define IH_OS_INVALID 0 /* Invalid OS */ +#define IH_OS_OPENBSD 1 /* OpenBSD */ +#define IH_OS_NETBSD 2 /* NetBSD */ +#define IH_OS_FREEBSD 3 /* FreeBSD */ +#define IH_OS_4_4BSD 4 /* 4.4BSD */ +#define IH_OS_LINUX 5 /* Linux */ +#define IH_OS_SVR4 6 /* SVR4 */ +#define IH_OS_ESIX 7 /* Esix */ +#define IH_OS_SOLARIS 8 /* Solaris */ +#define IH_OS_IRIX 9 /* Irix */ +#define IH_OS_SCO 10 /* SCO */ +#define IH_OS_DELL 11 /* Dell */ +#define IH_OS_NCR 12 /* NCR */ +#define IH_OS_LYNXOS 13 /* LynxOS */ +#define IH_OS_VXWORKS 14 /* VxWorks */ +#define IH_OS_PSOS 15 /* pSOS */ +#define IH_OS_QNX 16 /* QNX */ +#define IH_OS_U_BOOT 17 /* Firmware */ +#define IH_OS_RTEMS 18 /* RTEMS */ +#define IH_OS_ARTOS 19 /* ARTOS */ +#define IH_OS_UNITY 20 /* Unity OS */ + +/* + * CPU Architecture Codes (supported by Linux) + */ +#define IH_CPU_INVALID 0 /* Invalid CPU */ +#define IH_CPU_ALPHA 1 /* Alpha */ +#define IH_CPU_ARM 2 /* ARM */ +#define IH_CPU_I386 3 /* Intel x86 */ +#define IH_CPU_IA64 4 /* IA64 */ +#define IH_CPU_MIPS 5 /* MIPS */ +#define IH_CPU_MIPS64 6 /* MIPS 64 Bit */ +#define IH_CPU_PPC 7 /* PowerPC */ +#define IH_CPU_S390 8 /* IBM S390 */ +#define IH_CPU_SH 9 /* SuperH */ +#define IH_CPU_SPARC 10 /* Sparc */ +#define IH_CPU_SPARC64 11 /* Sparc 64 Bit */ +#define IH_CPU_M68K 12 /* M68K */ +#define IH_CPU_NIOS 13 /* Nios-32 */ +#define IH_CPU_MICROBLAZE 14 /* MicroBlaze */ +#define IH_CPU_NIOS2 15 /* Nios-II */ +#define IH_CPU_BLACKFIN 16 /* Blackfin */ +#define IH_CPU_AVR32 17 /* AVR32 */ + +/* + * Image Types + * + * "Standalone Programs" are directly runnable in the environment + * provided by U-Boot; it is expected that (if they behave + * well) you can continue to work in U-Boot after return from + * the Standalone Program. + * "OS Kernel Images" are usually images of some Embedded OS which + * will take over control completely. Usually these programs + * will install their own set of exception handlers, device + * drivers, set up the MMU, etc. - this means, that you cannot + * expect to re-enter U-Boot except by resetting the CPU. + * "RAMDisk Images" are more or less just data blocks, and their + * parameters (address, size) are passed to an OS kernel that is + * being started. + * "Multi-File Images" contain several images, typically an OS + * (Linux) kernel image and one or more data images like + * RAMDisks. This construct is useful for instance when you want + * to boot over the network using BOOTP etc., where the boot + * server provides just a single image file, but you want to get + * for instance an OS kernel and a RAMDisk image. + * + * "Multi-File Images" start with a list of image sizes, each + * image size (in bytes) specified by an "uint32_t" in network + * byte order. This list is terminated by an "(uint32_t)0". + * Immediately after the terminating 0 follow the images, one by + * one, all aligned on "uint32_t" boundaries (size rounded up to + * a multiple of 4 bytes - except for the last file). + * + * "Firmware Images" are binary images containing firmware (like + * U-Boot or FPGA images) which usually will be programmed to + * flash memory. + * + * "Script files" are command sequences that will be executed by + * U-Boot's command interpreter; this feature is especially + * useful when you configure U-Boot to use a real shell (hush) + * as command interpreter (=> Shell Scripts). + */ + +#define IH_TYPE_INVALID 0 /* Invalid Image */ +#define IH_TYPE_STANDALONE 1 /* Standalone Program */ +#define IH_TYPE_KERNEL 2 /* OS Kernel Image */ +#define IH_TYPE_RAMDISK 3 /* RAMDisk Image */ +#define IH_TYPE_MULTI 4 /* Multi-File Image */ +#define IH_TYPE_FIRMWARE 5 /* Firmware Image */ +#define IH_TYPE_SCRIPT 6 /* Script file */ +#define IH_TYPE_FILESYSTEM 7 /* Filesystem Image (any type) */ +#define IH_TYPE_FLATDT 8 /* Binary Flat Device Tree Blob */ + +/* + * Compression Types + */ +#define IH_COMP_NONE 0 /* No Compression Used */ +#define IH_COMP_GZIP 1 /* gzip Compression Used */ +#define IH_COMP_BZIP2 2 /* bzip2 Compression Used */ +#define IH_COMP_LZMA 3 /* lzma Compression Used */ + +#define IH_MAGIC 0x27051956 /* Image Magic Number */ +#define IH_NMLEN 32 /* Image Name Length */ + +/* + * all data in network byte order (aka natural aka bigendian) + */ + +typedef struct image_header { + uint32_t ih_magic; /* Image Header Magic Number */ + uint32_t ih_hcrc; /* Image Header CRC Checksum */ + uint32_t ih_time; /* Image Creation Timestamp */ + uint32_t ih_size; /* Image Data Size */ + uint32_t ih_load; /* Data Load Address */ + uint32_t ih_ep; /* Entry Point Address */ + uint32_t ih_dcrc; /* Image Data CRC Checksum */ + uint8_t ih_os; /* Operating System */ + uint8_t ih_arch; /* CPU architecture */ + uint8_t ih_type; /* Image Type */ + uint8_t ih_comp; /* Compression Type */ + uint8_t ih_name[IH_NMLEN]; /* Image Name */ +} image_header_t; + + +#endif /* __IMAGE_H__ */ diff --git a/package/mkimage/src/mkimage.c b/package/mkimage/src/mkimage.c new file mode 100644 index 000000000..7c0432bad --- /dev/null +++ b/package/mkimage/src/mkimage.c @@ -0,0 +1,755 @@ +/* + * (C) Copyright 2000-2004 + * DENX Software Engineering + * Wolfgang Denk, wd@denx.de + * All rights reserved. + * + * 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 of + * the License, 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ +#ifdef __APPLE__ +#define __FreeBSD__ 10 +#endif + +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#ifndef __WIN32__ +#include <netinet/in.h> /* for host / network byte order conversions */ +#endif +#include <sys/mman.h> +#include <sys/stat.h> +#include <time.h> +#include <unistd.h> + +#if defined(__BEOS__) || defined(__NetBSD__) || defined(__APPLE__) +#include <inttypes.h> +#include <sys/types.h> +#endif +#ifdef __WIN32__ +typedef unsigned int __u32; + +#define SWAP_LONG(x) \ + ((__u32)( \ + (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ + (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \ + (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \ + (((__u32)(x) & (__u32)0xff000000UL) >> 24) )) +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; + +#define ntohl(a) SWAP_LONG(a) +#define htonl(a) SWAP_LONG(a) +#endif /* __WIN32__ */ + +#ifndef O_BINARY /* should be define'd on __WIN32__ */ +#define O_BINARY 0 +#endif + +#include "image.h" + +extern int errno; + +#ifndef MAP_FAILED +#define MAP_FAILED (-1) +#endif + +char *cmdname; + +extern unsigned long crc32 (unsigned long crc, const char *buf, unsigned int len); + +typedef struct table_entry { + int val; /* as defined in image.h */ + char *sname; /* short (input) name */ + char *lname; /* long (output) name */ +} table_entry_t; + +table_entry_t arch_name[] = { + { IH_CPU_INVALID, NULL, "Invalid CPU", }, + { IH_CPU_ALPHA, "alpha", "Alpha", }, + { IH_CPU_ARM, "arm", "ARM", }, + { IH_CPU_I386, "x86", "Intel x86", }, + { IH_CPU_IA64, "ia64", "IA64", }, + { IH_CPU_M68K, "m68k", "MC68000", }, + { IH_CPU_MICROBLAZE, "microblaze", "MicroBlaze", }, + { IH_CPU_MIPS, "mips", "MIPS", }, + { IH_CPU_MIPS64, "mips64", "MIPS 64 Bit", }, + { IH_CPU_NIOS, "nios", "NIOS", }, + { IH_CPU_NIOS2, "nios2", "NIOS II", }, + { IH_CPU_PPC, "ppc", "PowerPC", }, + { IH_CPU_S390, "s390", "IBM S390", }, + { IH_CPU_SH, "sh", "SuperH", }, + { IH_CPU_SPARC, "sparc", "SPARC", }, + { IH_CPU_SPARC64, "sparc64", "SPARC 64 Bit", }, + { IH_CPU_BLACKFIN, "blackfin", "Blackfin", }, + { IH_CPU_AVR32, "avr32", "AVR32", }, + { -1, "", "", }, +}; + +table_entry_t os_name[] = { + { IH_OS_INVALID, NULL, "Invalid OS", }, + { IH_OS_4_4BSD, "4_4bsd", "4_4BSD", }, + { IH_OS_ARTOS, "artos", "ARTOS", }, + { IH_OS_DELL, "dell", "Dell", }, + { IH_OS_ESIX, "esix", "Esix", }, + { IH_OS_FREEBSD, "freebsd", "FreeBSD", }, + { IH_OS_IRIX, "irix", "Irix", }, + { IH_OS_LINUX, "linux", "Linux", }, + { IH_OS_LYNXOS, "lynxos", "LynxOS", }, + { IH_OS_NCR, "ncr", "NCR", }, + { IH_OS_NETBSD, "netbsd", "NetBSD", }, + { IH_OS_OPENBSD, "openbsd", "OpenBSD", }, + { IH_OS_PSOS, "psos", "pSOS", }, + { IH_OS_QNX, "qnx", "QNX", }, + { IH_OS_RTEMS, "rtems", "RTEMS", }, + { IH_OS_SCO, "sco", "SCO", }, + { IH_OS_SOLARIS, "solaris", "Solaris", }, + { IH_OS_SVR4, "svr4", "SVR4", }, + { IH_OS_U_BOOT, "u-boot", "U-Boot", }, + { IH_OS_VXWORKS, "vxworks", "VxWorks", }, + { -1, "", "", }, +}; + +table_entry_t type_name[] = { + { IH_TYPE_INVALID, NULL, "Invalid Image", }, + { IH_TYPE_FILESYSTEM, "filesystem", "Filesystem Image", }, + { IH_TYPE_FIRMWARE, "firmware", "Firmware", }, + { IH_TYPE_KERNEL, "kernel", "Kernel Image", }, + { IH_TYPE_MULTI, "multi", "Multi-File Image", }, + { IH_TYPE_RAMDISK, "ramdisk", "RAMDisk Image", }, + { IH_TYPE_SCRIPT, "script", "Script", }, + { IH_TYPE_STANDALONE, "standalone", "Standalone Program", }, + { IH_TYPE_FLATDT, "flat_dt", "Flat Device Tree", }, + { -1, "", "", }, +}; + +table_entry_t comp_name[] = { + { IH_COMP_NONE, "none", "uncompressed", }, + { IH_COMP_BZIP2, "bzip2", "bzip2 compressed", }, + { IH_COMP_GZIP, "gzip", "gzip compressed", }, + { IH_COMP_LZMA, "lzma", "lzma compressed", }, + { -1, "", "", }, +}; + +static void copy_file (int, const char *, int); +static void usage (void); +static void print_header (image_header_t *); +static void print_type (image_header_t *); +static char *put_table_entry (table_entry_t *, char *, int); +static char *put_arch (int); +static char *put_type (int); +static char *put_os (int); +static char *put_comp (int); +static int get_table_entry (table_entry_t *, char *, char *); +static int get_arch(char *); +static int get_comp(char *); +static int get_os (char *); +static int get_type(char *); + + +char *datafile; +char *imagefile; + +int dflag = 0; +int eflag = 0; +int lflag = 0; +int vflag = 0; +int xflag = 0; +int opt_os = IH_OS_LINUX; +int opt_arch = IH_CPU_PPC; +int opt_type = IH_TYPE_KERNEL; +int opt_comp = IH_COMP_GZIP; + +image_header_t header; +image_header_t *hdr = &header; + +int +main (int argc, char **argv) +{ + int ifd; + uint32_t checksum; + uint32_t addr; + uint32_t ep; + struct stat sbuf; + unsigned char *ptr; + char *name = ""; + + cmdname = *argv; + + addr = ep = 0; + + while (--argc > 0 && **++argv == '-') { + while (*++*argv) { + switch (**argv) { + case 'l': + lflag = 1; + break; + case 'A': + if ((--argc <= 0) || + (opt_arch = get_arch(*++argv)) < 0) + usage (); + goto NXTARG; + case 'C': + if ((--argc <= 0) || + (opt_comp = get_comp(*++argv)) < 0) + usage (); + goto NXTARG; + case 'O': + if ((--argc <= 0) || + (opt_os = get_os(*++argv)) < 0) + usage (); + goto NXTARG; + case 'T': + if ((--argc <= 0) || + (opt_type = get_type(*++argv)) < 0) + usage (); + goto NXTARG; + + case 'a': + if (--argc <= 0) + usage (); + addr = strtoul (*++argv, (char **)&ptr, 16); + if (*ptr) { + fprintf (stderr, + "%s: invalid load address %s\n", + cmdname, *argv); + exit (EXIT_FAILURE); + } + goto NXTARG; + case 'd': + if (--argc <= 0) + usage (); + datafile = *++argv; + dflag = 1; + goto NXTARG; + case 'e': + if (--argc <= 0) + usage (); + ep = strtoul (*++argv, (char **)&ptr, 16); + if (*ptr) { + fprintf (stderr, + "%s: invalid entry point %s\n", + cmdname, *argv); + exit (EXIT_FAILURE); + } + eflag = 1; + goto NXTARG; + case 'n': + if (--argc <= 0) + usage (); + name = *++argv; + goto NXTARG; + case 'v': + vflag++; + break; + case 'x': + xflag++; + break; + default: + usage (); + } + } +NXTARG: ; + } + + if ((argc != 1) || ((lflag ^ dflag) == 0)) + usage(); + + if (!eflag) { + ep = addr; + /* If XIP, entry point must be after the U-Boot header */ + if (xflag) + ep += sizeof(image_header_t); + } + + /* + * If XIP, ensure the entry point is equal to the load address plus + * the size of the U-Boot header. + */ + if (xflag) { + if (ep != addr + sizeof(image_header_t)) { + fprintf (stderr, + "%s: For XIP, the entry point must be the load addr + %lu\n", + cmdname, + (unsigned long)sizeof(image_header_t)); + exit (EXIT_FAILURE); + } + } + + imagefile = *argv; + + if (lflag) { + ifd = open(imagefile, O_RDONLY|O_BINARY); + } else { + ifd = open(imagefile, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0666); + } + + if (ifd < 0) { + fprintf (stderr, "%s: Can't open %s: %s\n", + cmdname, imagefile, strerror(errno)); + exit (EXIT_FAILURE); + } + + if (lflag) { + int len; + char *data; + /* + * list header information of existing image + */ + if (fstat(ifd, &sbuf) < 0) { + fprintf (stderr, "%s: Can't stat %s: %s\n", + cmdname, imagefile, strerror(errno)); + exit (EXIT_FAILURE); + } + + if ((unsigned)sbuf.st_size < sizeof(image_header_t)) { + fprintf (stderr, + "%s: Bad size: \"%s\" is no valid image\n", + cmdname, imagefile); + exit (EXIT_FAILURE); + } + + ptr = (unsigned char *)mmap(0, sbuf.st_size, + PROT_READ, MAP_SHARED, ifd, 0); + if ((caddr_t)ptr == (caddr_t)-1) { + fprintf (stderr, "%s: Can't read %s: %s\n", + cmdname, imagefile, strerror(errno)); + exit (EXIT_FAILURE); + } + + /* + * create copy of header so that we can blank out the + * checksum field for checking - this can't be done + * on the PROT_READ mapped data. + */ + memcpy (hdr, ptr, sizeof(image_header_t)); + + if (ntohl(hdr->ih_magic) != IH_MAGIC) { + fprintf (stderr, + "%s: Bad Magic Number: \"%s\" is no valid image\n", + cmdname, imagefile); + exit (EXIT_FAILURE); + } + + data = (char *)hdr; + len = sizeof(image_header_t); + + checksum = ntohl(hdr->ih_hcrc); + hdr->ih_hcrc = htonl(0); /* clear for re-calculation */ + + if (crc32 (0, data, len) != checksum) { + fprintf (stderr, + "%s: ERROR: \"%s\" has bad header checksum!\n", + cmdname, imagefile); + exit (EXIT_FAILURE); + } + + data = (char *)(ptr + sizeof(image_header_t)); + len = sbuf.st_size - sizeof(image_header_t) ; + + if (crc32 (0, data, len) != ntohl(hdr->ih_dcrc)) { + fprintf (stderr, + "%s: ERROR: \"%s\" has corrupted data!\n", + cmdname, imagefile); + exit (EXIT_FAILURE); + } + + /* for multi-file images we need the data part, too */ + print_header ((image_header_t *)ptr); + + (void) munmap((void *)ptr, sbuf.st_size); + (void) close (ifd); + + exit (EXIT_SUCCESS); + } + + /* + * Must be -w then: + * + * write dummy header, to be fixed later + */ + memset (hdr, 0, sizeof(image_header_t)); + + if (write(ifd, hdr, sizeof(image_header_t)) != sizeof(image_header_t)) { + fprintf (stderr, "%s: Write error on %s: %s\n", + cmdname, imagefile, strerror(errno)); + exit (EXIT_FAILURE); + } + + if (opt_type == IH_TYPE_MULTI || opt_type == IH_TYPE_SCRIPT) { + char *file = datafile; + uint32_t size; + + for (;;) { + char *sep = NULL; + + if (file) { + if ((sep = strchr(file, ':')) != NULL) { + *sep = '\0'; + } + + if (stat (file, &sbuf) < 0) { + fprintf (stderr, "%s: Can't stat %s: %s\n", + cmdname, file, strerror(errno)); + exit (EXIT_FAILURE); + } + size = htonl(sbuf.st_size); + } else { + size = 0; + } + + if (write(ifd, (char *)&size, sizeof(size)) != sizeof(size)) { + fprintf (stderr, "%s: Write error on %s: %s\n", + cmdname, imagefile, strerror(errno)); + exit (EXIT_FAILURE); + } + + if (!file) { + break; + } + + if (sep) { + *sep = ':'; + file = sep + 1; + } else { + file = NULL; + } + } + + file = datafile; + + for (;;) { + char *sep = strchr(file, ':'); + if (sep) { + *sep = '\0'; + copy_file (ifd, file, 1); + *sep++ = ':'; + file = sep; + } else { + copy_file (ifd, file, 0); + break; + } + } + } else { + copy_file (ifd, datafile, 0); + } + + /* We're a bit of paranoid */ +#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__) + (void) fdatasync (ifd); +#else + (void) fsync (ifd); +#endif + + if (fstat(ifd, &sbuf) < 0) { + fprintf (stderr, "%s: Can't stat %s: %s\n", + cmdname, imagefile, strerror(errno)); + exit (EXIT_FAILURE); + } + + ptr = (unsigned char *)mmap(0, sbuf.st_size, + PROT_READ|PROT_WRITE, MAP_SHARED, ifd, 0); + if (ptr == (unsigned char *)MAP_FAILED) { + fprintf (stderr, "%s: Can't map %s: %s\n", + cmdname, imagefile, strerror(errno)); + exit (EXIT_FAILURE); + } + + hdr = (image_header_t *)ptr; + + checksum = crc32 (0, + (const char *)(ptr + sizeof(image_header_t)), + sbuf.st_size - sizeof(image_header_t) + ); + + /* Build new header */ + hdr->ih_magic = htonl(IH_MAGIC); + hdr->ih_time = htonl(sbuf.st_mtime); + hdr->ih_size = htonl(sbuf.st_size - sizeof(image_header_t)); + hdr->ih_load = htonl(addr); + hdr->ih_ep = htonl(ep); + hdr->ih_dcrc = htonl(checksum); + hdr->ih_os = opt_os; + hdr->ih_arch = opt_arch; + hdr->ih_type = opt_type; + hdr->ih_comp = opt_comp; + + strncpy((char *)hdr->ih_name, name, IH_NMLEN); + + checksum = crc32(0,(const char *)hdr,sizeof(image_header_t)); + + hdr->ih_hcrc = htonl(checksum); + + print_header (hdr); + + (void) munmap((void *)ptr, sbuf.st_size); + + /* We're a bit of paranoid */ +#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) && !defined(__FreeBSD__) + (void) fdatasync (ifd); +#else + (void) fsync (ifd); +#endif + + if (close(ifd)) { + fprintf (stderr, "%s: Write error on %s: %s\n", + cmdname, imagefile, strerror(errno)); + exit (EXIT_FAILURE); + } + + exit (EXIT_SUCCESS); +} + +static void +copy_file (int ifd, const char *datafile, int pad) +{ + int dfd; + struct stat sbuf; + unsigned char *ptr; + int tail; + int zero = 0; + int offset = 0; + int size; + + if (vflag) { + fprintf (stderr, "Adding Image %s\n", datafile); + } + + if ((dfd = open(datafile, O_RDONLY|O_BINARY)) < 0) { + fprintf (stderr, "%s: Can't open %s: %s\n", + cmdname, datafile, strerror(errno)); + exit (EXIT_FAILURE); + } + + if (fstat(dfd, &sbuf) < 0) { + fprintf (stderr, "%s: Can't stat %s: %s\n", + cmdname, datafile, strerror(errno)); + exit (EXIT_FAILURE); + } + + ptr = (unsigned char *)mmap(0, sbuf.st_size, + PROT_READ, MAP_SHARED, dfd, 0); + if (ptr == (unsigned char *)MAP_FAILED) { + fprintf (stderr, "%s: Can't read %s: %s\n", + cmdname, datafile, strerror(errno)); + exit (EXIT_FAILURE); + } + + if (xflag) { + unsigned char *p = NULL; + /* + * XIP: do not append the image_header_t at the + * beginning of the file, but consume the space + * reserved for it. + */ + + if ((unsigned)sbuf.st_size < sizeof(image_header_t)) { + fprintf (stderr, + "%s: Bad size: \"%s\" is too small for XIP\n", + cmdname, datafile); + exit (EXIT_FAILURE); + } + + for (p=ptr; p < ptr+sizeof(image_header_t); p++) { + if ( *p != 0xff ) { + fprintf (stderr, + "%s: Bad file: \"%s\" has invalid buffer for XIP\n", + cmdname, datafile); + exit (EXIT_FAILURE); + } + } + + offset = sizeof(image_header_t); + } + + size = sbuf.st_size - offset; + if (write(ifd, ptr + offset, size) != size) { + fprintf (stderr, "%s: Write error on %s: %s\n", + cmdname, imagefile, strerror(errno)); + exit (EXIT_FAILURE); + } + + if (pad && ((tail = size % 4) != 0)) { + + if (write(ifd, (char *)&zero, 4-tail) != 4-tail) { + fprintf (stderr, "%s: Write error on %s: %s\n", + cmdname, imagefile, strerror(errno)); + exit (EXIT_FAILURE); + } + } + + (void) munmap((void *)ptr, sbuf.st_size); + (void) close (dfd); +} + +void +usage () +{ + fprintf (stderr, "Usage: %s -l image\n" + " -l ==> list image header information\n" + " %s [-x] -A arch -O os -T type -C comp " + "-a addr -e ep -n name -d data_file[:data_file...] image\n", + cmdname, cmdname); + fprintf (stderr, " -A ==> set architecture to 'arch'\n" + " -O ==> set operating system to 'os'\n" + " -T ==> set image type to 'type'\n" + " -C ==> set compression type 'comp'\n" + " -a ==> set load address to 'addr' (hex)\n" + " -e ==> set entry point to 'ep' (hex)\n" + " -n ==> set image name to 'name'\n" + " -d ==> use image data from 'datafile'\n" + " -x ==> set XIP (execute in place)\n" + ); + exit (EXIT_FAILURE); +} + +static void +print_header (image_header_t *hdr) +{ + time_t timestamp; + uint32_t size; + + timestamp = (time_t)ntohl(hdr->ih_time); + size = ntohl(hdr->ih_size); + + printf ("Image Name: %.*s\n", IH_NMLEN, hdr->ih_name); + printf ("Created: %s", ctime(×tamp)); + printf ("Image Type: "); print_type(hdr); + printf ("Data Size: %d Bytes = %.2f kB = %.2f MB\n", + size, (double)size / 1.024e3, (double)size / 1.048576e6 ); + printf ("Load Address: 0x%08X\n", ntohl(hdr->ih_load)); + printf ("Entry Point: 0x%08X\n", ntohl(hdr->ih_ep)); + + if (hdr->ih_type == IH_TYPE_MULTI || hdr->ih_type == IH_TYPE_SCRIPT) { + int i, ptrs; + uint32_t pos; + uint32_t *len_ptr = (uint32_t *) ( + (unsigned long)hdr + sizeof(image_header_t) + ); + + /* determine number of images first (to calculate image offsets) */ + for (i=0; len_ptr[i]; ++i) /* null pointer terminates list */ + ; + ptrs = i; /* null pointer terminates list */ + + pos = sizeof(image_header_t) + ptrs * sizeof(long); + printf ("Contents:\n"); + for (i=0; len_ptr[i]; ++i) { + size = ntohl(len_ptr[i]); + + printf (" Image %d: %8d Bytes = %4d kB = %d MB\n", + i, size, size>>10, size>>20); + if (hdr->ih_type == IH_TYPE_SCRIPT && i > 0) { + /* + * the user may need to know offsets + * if planning to do something with + * multiple files + */ + printf (" Offset = %08X\n", pos); + } + /* copy_file() will pad the first files to even word align */ + size += 3; + size &= ~3; + pos += size; + } + } +} + + +static void +print_type (image_header_t *hdr) +{ + printf ("%s %s %s (%s)\n", + put_arch (hdr->ih_arch), + put_os (hdr->ih_os ), + put_type (hdr->ih_type), + put_comp (hdr->ih_comp) + ); +} + +static char *put_arch (int arch) +{ + return (put_table_entry(arch_name, "Unknown Architecture", arch)); +} + +static char *put_os (int os) +{ + return (put_table_entry(os_name, "Unknown OS", os)); +} + +static char *put_type (int type) +{ + return (put_table_entry(type_name, "Unknown Image", type)); +} + +static char *put_comp (int comp) +{ + return (put_table_entry(comp_name, "Unknown Compression", comp)); +} + +static char *put_table_entry (table_entry_t *table, char *msg, int type) +{ + for (; table->val>=0; ++table) { + if (table->val == type) + return (table->lname); + } + return (msg); +} + +static int get_arch(char *name) +{ + return (get_table_entry(arch_name, "CPU", name)); +} + + +static int get_comp(char *name) +{ + return (get_table_entry(comp_name, "Compression", name)); +} + + +static int get_os (char *name) +{ + return (get_table_entry(os_name, "OS", name)); +} + + +static int get_type(char *name) +{ + return (get_table_entry(type_name, "Image", name)); +} + +static int get_table_entry (table_entry_t *table, char *msg, char *name) +{ + table_entry_t *t; + int first = 1; + + for (t=table; t->val>=0; ++t) { + if (t->sname && strcasecmp(t->sname, name)==0) + return (t->val); + } + fprintf (stderr, "\nInvalid %s Type - valid names are", msg); + for (t=table; t->val>=0; ++t) { + if (t->sname == NULL) + continue; + fprintf (stderr, "%c %s", (first) ? ':' : ',', t->sname); + first = 0; + } + fprintf (stderr, "\n"); + return (-1); +} diff --git a/package/mksh/Makefile b/package/mksh/Makefile index 63d391e18..76f15499e 100644 --- a/package/mksh/Makefile +++ b/package/mksh/Makefile @@ -17,30 +17,39 @@ PKG_DFLT_MKSH:= y if !ADK_TOOLCHAIN_ONLY DISTFILES= ${PKG_NAME}-R${PKG_VERSION}.tgz WRKDIST= ${WRKDIR}/${PKG_NAME} +include ${TOPDIR}/mk/host.mk include ${TOPDIR}/mk/package.mk -$(eval $(call PKG_template,MKSH,mksh,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) - -ifeq ($(ADK_STATIC),y) -TARGET_CFLAGS+= -static -TARGET_LDFLAGS+= -static -endif +$(eval $(call HOST_template,MKSH,mksh,${PKG_VERSION}-${PKG_RELEASE})) +$(eval $(call PKG_template,MKSH,mksh,${PKG_VERSION}-${PKG_RELEASE},,${PKG_DESCR},${PKG_SECTION})) TARGET_CPPFLAGS+= -DMKSH_SMALL=1 TARGET_LDFLAGS+= -static-libgcc + +HOST_STYLE:= manual CONFIG_STYLE:= manual BUILD_STYLE:= manual INSTALL_STYLE:= manual +host-build: + cd ${WRKBUILD} && HAVE_CAN_FSTACKPROTECTORALL=0 \ + TARGET_OS=Linux ${BASH} ${WRKSRC}/Build.sh -Q -r -c lto + +mksh-hostinstall: + ${INSTALL_DIR} ${STAGING_HOST_DIR}/usr/bin + ${INSTALL_BIN} ${WRKBUILD}/mksh \ + ${STAGING_HOST_DIR}/usr/bin + do-build: cd ${WRKBUILD} && CC='${TARGET_CC}' CFLAGS='${TARGET_CFLAGS}' \ CPPFLAGS='${TARGET_CPPFLAGS}' LDFLAGS='${TARGET_LDFLAGS}' \ HAVE_CAN_FSTACKPROTECTORALL=0 \ TARGET_OS=Linux ${BASH} ${WRKSRC}/Build.sh -Q -r -c lto -do-install: +mksh-install: ${INSTALL_DIR} ${IDIR_MKSH}/bin ${IDIR_MKSH}/root ${INSTALL_BIN} ${WRKBUILD}/mksh ${IDIR_MKSH}/bin/ ${CP} ${WRKSRC}/dot.mkshrc ${IDIR_MKSH}/root/.mkshrc +include ${TOPDIR}/mk/host-bottom.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/moc/Makefile b/package/moc/Makefile index 11bc9243c..797e76b06 100644 --- a/package/moc/Makefile +++ b/package/moc/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= moc -PKG_VERSION:= 2.5.0-beta1 +PKG_VERSION:= 2.5.0-beta2 PKG_RELEASE:= 1 -PKG_MD5SUM:= 795ecba86847e082aa2f21937cc04804 +PKG_MD5SUM:= da87b90b57934234589b63e347921458 PKG_DESCR:= console music player PKG_SECTION:= multimedia PKG_DEPENDS:= libmad libvorbis libcurl libflac @@ -22,6 +22,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,MOC,moc,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CPPFLAGS+= -D_GNU_SOURCE -D_POSIX_SOURCE TARGET_LDFLAGS+= -ltinfo CONFIGURE_ARGS+= --without-jack \ --without-oss \ diff --git a/package/mpd/Makefile b/package/mpd/Makefile index 4c8ab359a..b104f00f5 100644 --- a/package/mpd/Makefile +++ b/package/mpd/Makefile @@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk PKG_NAME:= mpd PKG_VERSION:= 0.18.9 -PKG_RELEASE:= 1 +PKG_RELEASE:= 3 PKG_MD5SUM:= 0e5156a831d4302d2032998bcfd5c36f PKG_DESCR:= A music player daemon PKG_SECTION:= multimedia diff --git a/package/mpd/patches/patch-src_db_SimpleDatabasePlugin_cxx b/package/mpd/patches/patch-src_db_SimpleDatabasePlugin_cxx deleted file mode 100644 index 0f28de720..000000000 --- a/package/mpd/patches/patch-src_db_SimpleDatabasePlugin_cxx +++ /dev/null @@ -1,91 +0,0 @@ ---- mpd-0.18.5.orig/src/db/SimpleDatabasePlugin.cxx 2013-11-22 00:33:30.000000000 +0100 -+++ mpd-0.18.5/src/db/SimpleDatabasePlugin.cxx 2013-11-30 19:17:55.000000000 +0100 -@@ -35,6 +35,9 @@ - - #include <sys/types.h> - #include <errno.h> -+#include <sys/mount.h> -+#include <mntent.h> -+#include <string.h> - - static constexpr Domain simple_db_domain("simple_db"); - -@@ -95,8 +98,8 @@ SimpleDatabase::Check(Error &error) cons - return false; - } - -- /* Check if we can write to the directory */ -- if (!CheckAccess(dirPath, X_OK | W_OK)) { -+ /* Check if we can change into the directory */ -+ if (!CheckAccess(dirPath, X_OK)) { - const int e = errno; - const std::string dirPath_utf8 = dirPath.ToUTF8(); - error.FormatErrno(e, "Can't create db file in \"%s\"", -@@ -122,9 +125,9 @@ SimpleDatabase::Check(Error &error) cons - return false; - } - -- /* And check that we can write to it */ -- if (!CheckAccess(path, R_OK | W_OK)) { -- error.FormatErrno("Can't open db file \"%s\" for reading/writing", -+ /* And check that we can read it */ -+ if (!CheckAccess(path, R_OK)) { -+ error.FormatErrno("Can't open db file \"%s\" for reading", - path_utf8.c_str()); - return false; - } -@@ -281,6 +284,10 @@ SimpleDatabase::GetStats(const DatabaseS - bool - SimpleDatabase::Save(Error &error) - { -+ struct mntent *mnt; -+ int remount; -+ FILE *f; -+ - db_lock(); - - LogDebug(simple_db_domain, "removing empty directories from DB"); -@@ -293,6 +300,26 @@ SimpleDatabase::Save(Error &error) - - LogDebug(simple_db_domain, "writing DB"); - -+ remount = 0; -+ /* check if /data is mounted read-only */ -+ if ((f = setmntent("/proc/mounts", "r")) == NULL) -+ error.Format(simple_db_domain, "Checking /proc/mounts failed"); -+ -+ while ((mnt = getmntent(f)) != NULL) { -+ if (strcmp(mnt->mnt_dir, "/data") == 0 && -+ hasmntopt(mnt, MNTOPT_RO) != NULL) { -+ remount = 1; -+ } -+ } -+ endmntent(f); -+ -+ if (remount) { -+ if (mount("","/data",0,MS_REMOUNT,0)<0) { -+ error.Format(simple_db_domain, "Remounting /data rw failed"); -+ } -+ LogDebug(simple_db_domain, "Mounted /data successfully in read-write mode"); -+ } -+ - FILE *fp = FOpen(path, FOpenMode::WriteText); - if (!fp) { - error.FormatErrno("unable to write to db file \"%s\"", -@@ -310,6 +337,16 @@ SimpleDatabase::Save(Error &error) - - fclose(fp); - -+ if (remount) { -+ sync(); -+ if (mount("","/data",0,MS_REMOUNT|MS_RDONLY,0)<0) { -+ error.Format(simple_db_domain, "Remounting /data ro failed"); -+ } -+ LogDebug(simple_db_domain, "Mounted /data successfully in read-only mode"); -+ } -+ -+ LogDebug(simple_db_domain, "Successfully written database"); -+ - struct stat st; - if (StatFile(path, st)) - mtime = st.st_mtime; diff --git a/package/mpd/patches/patch-src_thread_Id_hxx b/package/mpd/patches/patch-src_thread_Id_hxx index dabee4007..21dd19846 100644 --- a/package/mpd/patches/patch-src_thread_Id_hxx +++ b/package/mpd/patches/patch-src_thread_Id_hxx @@ -1,5 +1,5 @@ ---- mpd-0.18.5.orig/src/thread/Id.hxx 2013-11-18 23:50:46.000000000 +0100 -+++ mpd-0.18.5/src/thread/Id.hxx 2013-11-29 20:50:36.000000000 +0100 +--- mpd-0.18.9.orig/src/thread/Id.hxx 2013-12-11 20:51:53.000000000 +0100 ++++ mpd-0.18.9/src/thread/Id.hxx 2014-03-26 09:04:04.000000000 +0100 @@ -84,7 +84,7 @@ public: #ifdef WIN32 return id == other.id; diff --git a/package/mpg123/Makefile b/package/mpg123/Makefile index 350a7a097..0fdbe17b4 100644 --- a/package/mpg123/Makefile +++ b/package/mpg123/Makefile @@ -4,9 +4,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:= mpg123 -PKG_VERSION:= 1.13.3 +PKG_VERSION:= 1.19.0 PKG_RELEASE:= 1 -PKG_MD5SUM:= b1f990ce76dcf2fdf9d53ac39fc6bc7e +PKG_MD5SUM:= 87731f1437cfd8c50537a606d81130e4 PKG_DESCR:= mp3 console player PKG_SECTION:= multimedia PKG_DEPENDS:= libpthread alsa-lib diff --git a/package/mplayer/Makefile b/package/mplayer/Makefile index a6851f3fa..0a98de806 100644 --- a/package/mplayer/Makefile +++ b/package/mplayer/Makefile @@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk PKG_NAME:= mplayer PKG_VERSION:= 1.1.1 -PKG_RELEASE:= 1 +PKG_RELEASE:= 2 PKG_MD5SUM:= 39dd55f30eb5403f219a606e79a6648a PKG_DESCR:= popular video player PKG_SECTION:= multimedia @@ -34,9 +34,8 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,MPLAYER,mplayer,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CC:= ${TARGET_COMPILER_PREFIX}gcc XAKE_FLAGS+= GCC_HONOUR_COPTS=s -# gcc 4.5 produces internal compiler error with -Os -#TARGET_CFLAGS:=$(subst Os,O2,$(TARGET_CFLAGS)) TARGET_CFLAGS+= -D_POSIX_SOURCE -D_GNU_SOURCE CONFIG_STYLE:= minimal diff --git a/package/mrd6/Makefile b/package/mrd6/Makefile index 46f7595c5..235fb0809 100644 --- a/package/mrd6/Makefile +++ b/package/mrd6/Makefile @@ -26,7 +26,7 @@ ifeq (${ADK_COMPILE_MRD6_WITH_UCLIBCXX},y) LIBRARIES:=-nodefaultlibs -luClibc++ endif -ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y) +ifeq ($(ADK_TOOLCHAIN_USE_SSP),y) LIBRARIES+=-lssp -lssp_nonshared endif diff --git a/package/mtd-utils/Makefile b/package/mtd-utils/Makefile new file mode 100644 index 000000000..19c81ae4a --- /dev/null +++ b/package/mtd-utils/Makefile @@ -0,0 +1,35 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include $(TOPDIR)/rules.mk + +PKG_NAME:= mtd-utils +PKG_VERSION:= 1.5.0 +PKG_RELEASE:= 1 +PKG_MD5SUM:= a4df1ad29684be79b0fa699bdae01faf +PKG_DESCR:= mtd-utils filesystem utilities +PKG_SECTION:= fs +HOST_BUILDDEP:= liblzo-host +PKG_SITES:= http://openadk.org/distfiles/ + +PKG_CFLINE_MTD_UTILS:= depends on ADK_HOST_ONLY + +include $(TOPDIR)/mk/host.mk +include $(TOPDIR)/mk/package.mk + +$(eval $(call HOST_template,MTD_UTILS,mtd-utils,$(PKG_VERSION)-${PKG_RELEASE})) + +HOST_STYLE:= manual +CPPFLAGS_FOR_BUILD+= -DWITHOUT_XATTR=1 -I./include + +host-build: + (cd ${WRKBUILD} && env ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \ + ${HOST_MAKE_FLAGS} ${HOST_ALL_TARGET}) + +mtd-utils-hostinstall: + ${INSTALL_DIR} ${STAGING_HOST_DIR}/usr/bin + ${INSTALL_BIN} ${WRKBUILD}/mkfs.jffs2 \ + ${STAGING_HOST_DIR}/usr/bin + +include ${TOPDIR}/mk/host-bottom.mk +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/mtd-utils/patches/patch-Makefile b/package/mtd-utils/patches/patch-Makefile new file mode 100644 index 000000000..53ed8640e --- /dev/null +++ b/package/mtd-utils/patches/patch-Makefile @@ -0,0 +1,65 @@ +--- mtd-utils-1.5.0.orig/Makefile 2012-05-07 09:19:39.000000000 +0200 ++++ mtd-utils-1.5.0/Makefile 2014-03-30 15:49:30.000000000 +0200 +@@ -16,27 +16,13 @@ endif + + TESTS = tests + +-MTD_BINS = \ +- ftl_format flash_erase nanddump doc_loadbios \ +- ftl_check mkfs.jffs2 flash_lock flash_unlock \ +- flash_otp_info flash_otp_dump mtd_debug flashcp nandwrite nandtest \ +- jffs2dump \ +- nftldump nftl_format docfdisk \ +- rfddump rfdformat \ +- serve_image recv_image \ +- sumtool jffs2reader +-UBI_BINS = \ +- ubiupdatevol ubimkvol ubirmvol ubicrc32 ubinfo ubiattach \ +- ubidetach ubinize ubiformat ubirename mtdinfo ubirsvol ++MTD_BINS = mkfs.jffs2 + + BINS = $(MTD_BINS) +-BINS += mkfs.ubifs/mkfs.ubifs +-BINS += $(addprefix ubi-utils/,$(UBI_BINS)) + SCRIPTS = flash_eraseall + + TARGETS = $(BINS) + TARGETS += lib/libmtd.a +-TARGETS += ubi-utils/libubi.a + + OBJDEPS = $(BUILDDIR)/include/version.h + +@@ -83,12 +69,12 @@ $(BUILDDIR)/include/version.h.tmp: + # + # Utils in top level + # +-obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o compr_lzo.o compr.o rbtree.o +-LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) $(LZOLDFLAGS) +-LDLIBS_mkfs.jffs2 = -lz $(LZOLDLIBS) ++obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o compr.o rbtree.o ++LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) ++LDLIBS_mkfs.jffs2 = -lz + +-LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS) +-LDLIBS_jffs2reader = -lz $(LZOLDLIBS) ++LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) ++LDLIBS_jffs2reader = -lz + + $(foreach v,$(MTD_BINS),$(eval $(call mkdep,,$(v)))) + +@@ -103,7 +89,7 @@ $(call _mkdep,lib/,libmtd.a) + # + obj-mkfs.ubifs = crc16.o lpt.o compr.o devtable.o \ + hashtable/hashtable.o hashtable/hashtable_itr.o +-LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid ++LDLIBS_mkfs.ubifs = -lz -lm -luuid + $(call mkdep,mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a) + + # +@@ -117,6 +103,3 @@ obj-libubigen.a = libubigen.o + obj-mtdinfo = libubigen.a + obj-ubinize = libubigen.a libiniparser.a + obj-ubiformat = libubigen.a libscan.a +- +-$(foreach v,libubi.a libubigen.a libiniparser.a libscan.a,$(eval $(call _mkdep,ubi-utils/,$(v)))) +-$(foreach v,$(UBI_BINS),$(eval $(call mkdep,ubi-utils/,$(v),libubi.a ubiutils-common.o))) diff --git a/package/mtd-utils/patches/patch-common_mk b/package/mtd-utils/patches/patch-common_mk new file mode 100644 index 000000000..6881db87e --- /dev/null +++ b/package/mtd-utils/patches/patch-common_mk @@ -0,0 +1,11 @@ +--- mtd-utils-1.5.0.orig/common.mk 2012-05-07 09:19:39.000000000 +0200 ++++ mtd-utils-1.5.0/common.mk 2014-03-30 15:49:26.000000000 +0200 +@@ -13,8 +13,6 @@ WFLAGS := -Wall \ + $(call cc-option,-Wwrite-strings) \ + $(call cc-option,-Wno-sign-compare) + CFLAGS += $(WFLAGS) +-SECTION_CFLAGS := $(call cc-option,-ffunction-sections -fdata-sections -Wl$(comma)--gc-sections) +-CFLAGS += $(SECTION_CFLAGS) + + ifneq ($(WITHOUT_LARGEFILE), 1) + CPPFLAGS += -D_FILE_OFFSET_BITS=64 diff --git a/package/mtd-utils/patches/patch-compr_c b/package/mtd-utils/patches/patch-compr_c new file mode 100644 index 000000000..c69e133b9 --- /dev/null +++ b/package/mtd-utils/patches/patch-compr_c @@ -0,0 +1,21 @@ +--- mtd-utils-1.5.0.orig/compr.c 2012-05-07 09:19:39.000000000 +0200 ++++ mtd-utils-1.5.0/compr.c 2014-03-30 15:49:30.000000000 +0200 +@@ -517,9 +517,6 @@ int jffs2_compressors_init(void) + #ifdef CONFIG_JFFS2_RTIME + jffs2_rtime_init(); + #endif +-#ifdef CONFIG_JFFS2_LZO +- jffs2_lzo_init(); +-#endif + return 0; + } + +@@ -531,8 +528,5 @@ int jffs2_compressors_exit(void) + #ifdef CONFIG_JFFS2_ZLIB + jffs2_zlib_exit(); + #endif +-#ifdef CONFIG_JFFS2_LZO +- jffs2_lzo_exit(); +-#endif + return 0; + } diff --git a/package/mtd-utils/patches/patch-compr_lzo_c b/package/mtd-utils/patches/patch-compr_lzo_c new file mode 100644 index 000000000..98f235c5b --- /dev/null +++ b/package/mtd-utils/patches/patch-compr_lzo_c @@ -0,0 +1,10 @@ +--- mtd-utils-1.5.0.orig/compr_lzo.c 2012-05-07 09:19:39.000000000 +0200 ++++ mtd-utils-1.5.0/compr_lzo.c 2014-03-30 15:49:26.000000000 +0200 +@@ -26,7 +26,6 @@ + #include <string.h> + + #ifndef WITHOUT_LZO +-#include <asm/types.h> + #include <linux/jffs2.h> + #include <lzo/lzo1x.h> + #include "compr.h" diff --git a/package/mtd-utils/patches/patch-compr_zlib_c b/package/mtd-utils/patches/patch-compr_zlib_c new file mode 100644 index 000000000..200bb55ce --- /dev/null +++ b/package/mtd-utils/patches/patch-compr_zlib_c @@ -0,0 +1,10 @@ +--- mtd-utils-1.5.0.orig/compr_zlib.c 2012-05-07 09:19:39.000000000 +0200 ++++ mtd-utils-1.5.0/compr_zlib.c 2014-03-30 15:49:26.000000000 +0200 +@@ -39,7 +39,6 @@ + #include <zlib.h> + #undef crc32 + #include <stdio.h> +-#include <asm/types.h> + #include <linux/jffs2.h> + #include "common.h" + #include "compr.h" diff --git a/package/mtd-utils/patches/patch-include_mtd_jffs2-user_h b/package/mtd-utils/patches/patch-include_mtd_jffs2-user_h new file mode 100644 index 000000000..1373b66f2 --- /dev/null +++ b/package/mtd-utils/patches/patch-include_mtd_jffs2-user_h @@ -0,0 +1,16 @@ +--- mtd-utils-1.5.0.orig/include/mtd/jffs2-user.h 2012-05-07 09:19:39.000000000 +0200 ++++ mtd-utils-1.5.0/include/mtd/jffs2-user.h 2014-03-30 15:49:26.000000000 +0200 +@@ -9,8 +9,13 @@ + + /* This file is blessed for inclusion by userspace */ + #include <linux/jffs2.h> ++#if defined(__APPLE__) ++#include "endian.h" ++#include "byteswap.h" ++#else + #include <endian.h> + #include <byteswap.h> ++#endif + + #undef cpu_to_je16 + #undef cpu_to_je32 diff --git a/package/mtd-utils/patches/patch-include_mtd_mtd-abi_h b/package/mtd-utils/patches/patch-include_mtd_mtd-abi_h new file mode 100644 index 000000000..9a95c4127 --- /dev/null +++ b/package/mtd-utils/patches/patch-include_mtd_mtd-abi_h @@ -0,0 +1,14 @@ +--- mtd-utils-1.5.0.orig/include/mtd/mtd-abi.h 2012-05-07 09:19:39.000000000 +0200 ++++ mtd-utils-1.5.0/include/mtd/mtd-abi.h 2014-03-30 15:49:26.000000000 +0200 +@@ -171,9 +171,9 @@ struct otp_info { + /* Get info about OOB modes (e.g., RAW, PLACE, AUTO) - legacy interface */ + #define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo) + /* Check if an eraseblock is bad */ +-#define MEMGETBADBLOCK _IOW('M', 11, __kernel_loff_t) ++#define MEMGETBADBLOCK _IOW('M', 11, off_t) + /* Mark an eraseblock as bad */ +-#define MEMSETBADBLOCK _IOW('M', 12, __kernel_loff_t) ++#define MEMSETBADBLOCK _IOW('M', 12, off_t) + /* Set OTP (One-Time Programmable) mode (factory vs. user) */ + #define OTPSELECT _IOR('M', 13, int) + /* Get number of OTP (One-Time Programmable) regions */ diff --git a/package/mtd-utils/patches/patch-include_mtd_ubi-media_h b/package/mtd-utils/patches/patch-include_mtd_ubi-media_h new file mode 100644 index 000000000..33feabf92 --- /dev/null +++ b/package/mtd-utils/patches/patch-include_mtd_ubi-media_h @@ -0,0 +1,18 @@ +--- mtd-utils-1.5.0.orig/include/mtd/ubi-media.h 2012-05-07 09:19:39.000000000 +0200 ++++ mtd-utils-1.5.0/include/mtd/ubi-media.h 2014-03-30 15:49:26.000000000 +0200 +@@ -30,7 +30,15 @@ + #ifndef __UBI_MEDIA_H__ + #define __UBI_MEDIA_H__ + ++#ifdef __linux__ + #include <asm/byteorder.h> ++#else ++#include <stdint.h> ++typedef uint8_t __u8; ++typedef uint16_t __be16; ++typedef uint32_t __be32; ++typedef uint64_t __be64; ++#endif + + /* The version of UBI images supported by this implementation */ + #define UBI_VERSION 1 diff --git a/package/mtd-utils/patches/patch-lib_libfec_c b/package/mtd-utils/patches/patch-lib_libfec_c new file mode 100644 index 000000000..7b198d0fb --- /dev/null +++ b/package/mtd-utils/patches/patch-lib_libfec_c @@ -0,0 +1,20 @@ +--- mtd-utils-1.5.0.orig/lib/libfec.c 2012-05-07 09:19:39.000000000 +0200 ++++ mtd-utils-1.5.0/lib/libfec.c 2014-03-30 15:49:26.000000000 +0200 +@@ -61,8 +61,6 @@ struct timeval { + }; + #define gettimeofday(x, dummy) { (x)->ticks = clock() ; } + #define DIFF_T(a,b) (1+ 1000000*(a.ticks - b.ticks) / CLOCKS_PER_SEC ) +-typedef unsigned long u_long ; +-typedef unsigned short u_short ; + #else /* typically, unix systems */ + #include <sys/time.h> + #define DIFF_T(a,b) \ +@@ -625,7 +623,7 @@ init_fec(void) + #define FEC_MAGIC 0xFECC0DEC + + struct fec_parms { +- u_long magic ; ++ unsigned long magic ; + int k, n ; /* parameters of the code */ + gf *enc_matrix ; + } ; diff --git a/package/mtd-utils/patches/patch-lib_libmtd_c b/package/mtd-utils/patches/patch-lib_libmtd_c new file mode 100644 index 000000000..af0f9a837 --- /dev/null +++ b/package/mtd-utils/patches/patch-lib_libmtd_c @@ -0,0 +1,38 @@ +--- mtd-utils-1.5.0.orig/lib/libmtd.c 2012-05-07 09:19:39.000000000 +0200 ++++ mtd-utils-1.5.0/lib/libmtd.c 2014-03-30 15:49:26.000000000 +0200 +@@ -1006,7 +1006,7 @@ out: + int mtd_is_bad(const struct mtd_dev_info *mtd, int fd, int eb) + { + int ret; +- loff_t seek; ++ off_t seek; + + ret = mtd_valid_erase_block(mtd, eb); + if (ret) +@@ -1015,7 +1015,7 @@ int mtd_is_bad(const struct mtd_dev_info + if (!mtd->bb_allowed) + return 0; + +- seek = (loff_t)eb * mtd->eb_size; ++ seek = (off_t)eb * mtd->eb_size; + ret = ioctl(fd, MEMGETBADBLOCK, &seek); + if (ret == -1) + return mtd_ioctl_error(mtd, eb, "MEMGETBADBLOCK"); +@@ -1025,7 +1025,7 @@ int mtd_is_bad(const struct mtd_dev_info + int mtd_mark_bad(const struct mtd_dev_info *mtd, int fd, int eb) + { + int ret; +- loff_t seek; ++ off_t seek; + + if (!mtd->bb_allowed) { + errno = EINVAL; +@@ -1036,7 +1036,7 @@ int mtd_mark_bad(const struct mtd_dev_in + if (ret) + return ret; + +- seek = (loff_t)eb * mtd->eb_size; ++ seek = (off_t)eb * mtd->eb_size; + ret = ioctl(fd, MEMSETBADBLOCK, &seek); + if (ret == -1) + return mtd_ioctl_error(mtd, eb, "MEMSETBADBLOCK"); diff --git a/package/mtd-utils/patches/patch-lib_libmtd_legacy_c b/package/mtd-utils/patches/patch-lib_libmtd_legacy_c new file mode 100644 index 000000000..bcd66374f --- /dev/null +++ b/package/mtd-utils/patches/patch-lib_libmtd_legacy_c @@ -0,0 +1,11 @@ +--- mtd-utils-1.5.0.orig/lib/libmtd_legacy.c 2012-05-07 09:19:39.000000000 +0200 ++++ mtd-utils-1.5.0/lib/libmtd_legacy.c 2014-03-30 15:49:26.000000000 +0200 +@@ -234,7 +234,7 @@ int legacy_get_dev_info(const char *node + struct stat st; + struct mtd_info_user ui; + int fd, ret; +- loff_t offs = 0; ++ off_t offs = 0; + struct proc_parse_info pi; + + if (stat(node, &st)) { diff --git a/package/mtd-utils/patches/patch-mkfs_jffs2_c b/package/mtd-utils/patches/patch-mkfs_jffs2_c new file mode 100644 index 000000000..766e2204a --- /dev/null +++ b/package/mtd-utils/patches/patch-mkfs_jffs2_c @@ -0,0 +1,15 @@ +--- mtd-utils-1.5.0.orig/mkfs.jffs2.c 2012-05-07 09:19:39.000000000 +0200 ++++ mtd-utils-1.5.0/mkfs.jffs2.c 2014-03-30 15:49:26.000000000 +0200 +@@ -70,7 +70,12 @@ + #include <sys/xattr.h> + #include <sys/acl.h> + #endif ++#if defined(__APPLE__) ++#include "endian.h" ++#include "byteswap.h" ++#else + #include <byteswap.h> ++#endif + #include <crc32.h> + #include <inttypes.h> + diff --git a/package/mtd-utils/patches/patch-rbtree_h b/package/mtd-utils/patches/patch-rbtree_h new file mode 100644 index 000000000..b7d34b937 --- /dev/null +++ b/package/mtd-utils/patches/patch-rbtree_h @@ -0,0 +1,12 @@ +--- mtd-utils-1.5.0.orig/rbtree.h 2012-05-07 09:19:39.000000000 +0200 ++++ mtd-utils-1.5.0/rbtree.h 2014-03-30 15:49:26.000000000 +0200 +@@ -94,8 +94,7 @@ static inline struct page * rb_insert_pa + #ifndef _LINUX_RBTREE_H + #define _LINUX_RBTREE_H + +-#include <linux/kernel.h> +-#include <linux/stddef.h> ++#include <stddef.h> + + struct rb_node + { diff --git a/package/mutt/Makefile b/package/mutt/Makefile index 0454d4627..05bb5096e 100644 --- a/package/mutt/Makefile +++ b/package/mutt/Makefile @@ -4,15 +4,16 @@ include ${TOPDIR}/rules.mk PKG_NAME:= mutt -PKG_VERSION:= 1.5.20 -PKG_RELEASE:= 2 -PKG_MD5SUM:= 027cdd9959203de0c3c64149a7ee351c -PKG_DESCR:= Mail text client +PKG_VERSION:= 1.5.23 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 11f5b6a3eeba1afa1257fe93c9f26bff +PKG_DESCR:= mail text client PKG_SECTION:= mail PKG_DEPENDS:= libncurses libopenssl PKG_BUILDDEP:= ncurses openssl PKG_URL:= http://www.mutt.org/ -PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=mutt/} +PKG_SITES:= ftp://ftp.mutt.org/mutt/devel/ \ + http://ftp.hi.is/pub/mutt/ include ${TOPDIR}/mk/package.mk diff --git a/package/mutt/patches/patch-Makefile_in b/package/mutt/patches/patch-Makefile_in index 3a6601abe..c4bcb93db 100644 --- a/package/mutt/patches/patch-Makefile_in +++ b/package/mutt/patches/patch-Makefile_in @@ -1,20 +1,20 @@ ---- mutt-1.5.20.orig/Makefile.in 2009-06-09 08:50:44.000000000 +0200 -+++ mutt-1.5.20/Makefile.in 2010-05-30 13:43:47.001613117 +0200 -@@ -155,7 +155,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGE - distdir dist dist-all distcheck +--- mutt-1.5.23.orig/Makefile.in 2014-03-12 17:26:44.000000000 +0100 ++++ mutt-1.5.23/Makefile.in 2014-03-27 11:06:17.000000000 +0100 +@@ -259,7 +259,7 @@ am__define_uniq_tagged_files = \ ETAGS = etags CTAGS = ctags + CSCOPE = cscope -DIST_SUBDIRS = m4 po intl doc contrib imap +DIST_SUBDIRS = m4 po intl contrib imap DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) -@@ -340,7 +340,7 @@ top_srcdir = @top_srcdir@ +@@ -451,7 +451,7 @@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.6 foreign @BUILD_IMAP_TRUE@IMAP_SUBDIR = imap @BUILD_IMAP_TRUE@IMAP_INCLUDES = -I$(top_srcdir)/imap -SUBDIRS = m4 po intl doc contrib $(IMAP_SUBDIR) +SUBDIRS = m4 po intl contrib $(IMAP_SUBDIR) bin_SCRIPTS = muttbug flea @SMIMEAUX_TARGET@ - BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h hcversion.h - mutt_SOURCES = \ + @BUILD_HCACHE_TRUE@HCVERSION = hcversion.h + BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h conststrings.c $(HCVERSION) diff --git a/package/mutt/patches/patch-mutt_ssl_c b/package/mutt/patches/patch-mutt_ssl_c deleted file mode 100644 index 160dc668c..000000000 --- a/package/mutt/patches/patch-mutt_ssl_c +++ /dev/null @@ -1,20 +0,0 @@ ---- mutt-1.5.20.orig/mutt_ssl.c 2009-06-10 07:08:29.000000000 +0200 -+++ mutt-1.5.20/mutt_ssl.c 2010-06-02 19:53:33.141613592 +0200 -@@ -652,7 +652,7 @@ static int check_host (X509 *x509cert, c - char *buf = NULL; - int bufsize; - /* needed to get the DNS subjectAltNames: */ -- STACK *subj_alt_names; -+ STACK_OF(GENERAL_NAME) *subj_alt_names; - int subj_alt_names_count; - GENERAL_NAME *subj_alt_name; - /* did we find a name matching hostname? */ -@@ -735,7 +735,7 @@ static int ssl_cache_trusted_cert (X509 - { - dprint (1, (debugfile, "trusted: %s\n", c->name)); - if (!SslSessionCerts) -- SslSessionCerts = sk_new_null(); -+ SslSessionCerts = sk_X509_new_null(); - return (sk_X509_push (SslSessionCerts, X509_dup(c))); - } - diff --git a/package/mysql/Makefile b/package/mysql/Makefile index 365dea844..4c8b0e919 100644 --- a/package/mysql/Makefile +++ b/package/mysql/Makefile @@ -4,91 +4,75 @@ include ${TOPDIR}/rules.mk PKG_NAME:= mysql -PKG_VERSION:= 5.1.61 -PKG_RELEASE:= 2 -PKG_MD5SUM:= 4efd10c69c4c99dbdb8fae3834a6d7b8 +PKG_VERSION:= 5.6.17 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 82114fa7c13fa3ca897b34666577d9f4 PKG_DESCR:= MySQL client library PKG_SECTION:= db PKG_DEPENDS:= libncurses zlib -PKG_BUILDDEP:= ncurses zlib readline +PKG_BUILDDEP:= cmake-host mysql-host ncurses zlib readline +HOST_BUILDDEP:= cmake-host PKG_URL:= http://www.mysql.com/ -PKG_SITES= ${MASTER_SITE_MYSQL:=Downloads/MySQL-5.1/} +PKG_SITES= ${MASTER_SITE_MYSQL:=Downloads/MySQL-5.6/} PKG_LIBNAME:= libmysqlclient PKG_OPTS:= dev -PKG_HOST_DEPENDS:= !cygwin - +include ${TOPDIR}/mk/host.mk include ${TOPDIR}/mk/package.mk +$(eval $(call HOST_template,MYSQL,mysql,${PKG_VERSION}-${PKG_RELEASE})) $(eval $(call PKG_template,LIBMYSQLCLIENT,libmysqlclient,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) -BUILD_STYLE:= manual -INSTALL_STYLE:= manual +HOST_STYLE:= manual +CONFIG_STYLE:= manual + +host-configure: + cd ${WRKBUILD} && PATH='${HOST_PATH}' \ + cmake . + +host-build: + cd ${WRKBUILD} && env ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \ + ${HOST_MAKE_FLAGS} ${HOST_ALL_TARGET} $(MAKE_TRACE) -CONFIGURE_ENV+= OPTIMIZE_CFLAGS="${TARGET_CFLAGS}" \ - OPTIMIZE_CXXFLAGS="${TARGET_CXXFLAGS}" \ - ac_cv_lib_nsl_gethostbyname_r=no \ - ac_cv_lib_nsl_yp_get_default_domain=no \ - ac_cv_sys_restartable_syscalls=yes \ - mysql_cv_sys_os=Linux \ - mysql_cv_compress=yes \ - ac_cv_sys_restartable_syscalls=no \ - ac_cv_conv_longlong_to_float=yes \ - mysql_cv_gcc_atomic_builtins=yes \ - mysql_cv_gethostname_style=glibc2 -CONFIGURE_ARGS+= --disable-assembler \ - --with-pthread \ - --with-atomic-ops=rwlocks \ - --with-unix-socket-path=/tmp/.mysql.sock \ - --with-named-thread-libs=-lpthread \ - --without-libwrap \ - --without-pstack \ - --with-low-memory \ - --without-server \ - --without-embedded-server \ - --without-query-cache \ - --without-ssl \ - --without-docs \ - --without-readline \ - --with-machine-type=${CPU_ARCH} -BUILD_LFLAGS= CC="${CC_FOR_BUILD}" \ - CXX='${CXX_FOR_BUILD}' \ - CFLAGS='${CFLAGS_FOR_BUILD} -DHOSTCOMPILE=1' \ - CXXFLAGS='${CXXFLAGS_FOR_BUILD}' \ - LDFLAGS='${LDFLAGS_FOR_BUILD}' \ - CPPFLAGS='${CPPFLAGS_FOR_BUILD}' \ - CXXLINK='${CXX_FOR_BUILD} ${CFLAGS_FOR_BUILD} ${LDFLAGS_FOR_BUILD} -o $$@' \ - LINK='${CC_FOR_BUILD} ${CFLAGS_FOR_BUILD} ${LDFLAGS_FOR_BUILD} -o $$@' -ifneq (${OStype},Linux) -BUILD_FLAGS+= LIBS='-lm -lz' -endif +mysql-hostinstall: + $(INSTALL_BIN) ${WRKBUILD}/extra/comp_err \ + $(STAGING_HOST_DIR)/usr/bin + $(INSTALL_BIN) ${WRKBUILD}/scripts/comp_sql \ + $(STAGING_HOST_DIR)/usr/bin + $(INSTALL_BIN) ${WRKBUILD}/sql/gen_lex_hash \ + $(STAGING_HOST_DIR)/usr/bin + $(INSTALL_BIN) ${WRKBUILD}/storage/perfschema/gen_pfs_lex_token \ + $(STAGING_HOST_DIR)/usr/bin -do-build: - ${MAKE} -C "${WRKBUILD}" \ - SUBDIRS="include" \ - DESTDIR="${WRKINST}" \ - all install - ${MAKE} -C "${WRKBUILD}/libmysql" \ - LINK="${CC_FOR_BUILD} -o conf_to_src -lc" \ - ${BUILD_FLAGS} \ - conf_to_src - ${MAKE} -C "${WRKBUILD}" \ - CFLAGS="${TARGET_CFLAGS}" \ - SUBDIRS="libmysql" \ - DESTDIR="${WRKINST}" \ - all install - ${MAKE} -C "${WRKBUILD}" \ - CFLAGS="${TARGET_CFLAGS}" \ - SUBDIRS="scripts" \ - DESTDIR="${WRKINST}" \ - bin_SCRIPTS="mysql_config" \ - all install +do-configure: + sed -e "s#@@TARGET_CC@@#$(TARGET_CC)#" \ + -e "s#@@TARGET_CXX@@#$(TARGET_CXX)#" \ + -e "s#@@TARGET_CFLAGS@@#$(TARGET_CFLAGS)#" \ + -e "s#@@TARGET_CXXFLAGS@@#$(TARGET_CXXFLAGS)#" \ + -e "s#@@STAGING_TARGET_DIR@@#$(STAGING_TARGET_DIR)#" \ + -e "s#@@STAGING_HOST_DIR@@#$(STAGING_HOST_DIR)#" \ + $(SCRIPT_DIR)/toolchain.cmake.in > $(SCRIPT_DIR)/toolchain.cmake + (cd ${WRKBUILD} && PATH='${HOST_PATH}' \ + cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr \ + -DCMAKE_TOOLCHAIN_FILE="$(SCRIPT_DIR)/toolchain.cmake" \ + -DWITH_EDITLINE=bundled \ + -DCURSES_LIBRARY="$(STAGING_TARGET_DIR)/usr/lib" \ + -DCURSES_INCLUDE_PATH="$(STAGING_TARGET_DIR)/usr/lib" \ + -DSTACK_DIRECTION=1 \ + .) + $(CP) $(STAGING_HOST_DIR)/usr/bin/comp_err \ + ${WRKBUILD}/extra/ + $(CP) $(STAGING_HOST_DIR)/usr/bin/comp_sql \ + ${WRKBUILD}/scripts/ + $(CP) $(STAGING_HOST_DIR)/usr/bin/gen_lex_hash \ + ${WRKBUILD}/sql/ + $(CP) $(STAGING_HOST_DIR)/usr/bin/gen_pfs_lex_token \ + ${WRKBUILD}/storage/perfschema/ libmysqlclient-install: ${INSTALL_DIR} ${IDIR_LIBMYSQLCLIENT}/usr/lib - ${CP} ${WRKINST}/usr/lib/mysql/libmysqlclient.so* \ + ${CP} ${WRKINST}/usr/lib/libmysqlclient.so* \ ${IDIR_LIBMYSQLCLIENT}/usr/lib - $(SED) "s,\(^pkgincludedir='\)\(.*\),\1${STAGING_TARGET_DIR}\2," \ - ${WRKINST}/usr/bin/mysql_config +include ${TOPDIR}/mk/host-bottom.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/mysql/patches/patch-cmake_os_Linux_cmake b/package/mysql/patches/patch-cmake_os_Linux_cmake new file mode 100644 index 000000000..be27d5517 --- /dev/null +++ b/package/mysql/patches/patch-cmake_os_Linux_cmake @@ -0,0 +1,17 @@ +--- mysql-5.6.17.orig/cmake/os/Linux.cmake 2014-03-14 20:07:26.000000000 +0100 ++++ mysql-5.6.17/cmake/os/Linux.cmake 2014-04-04 10:11:45.000000000 +0200 +@@ -23,14 +23,6 @@ SET(TARGET_OS_LINUX 1) + SET(HAVE_NPTL 1) + SET(_GNU_SOURCE 1) + +-# Fix CMake (< 2.8) flags. -rdynamic exports too many symbols. +-FOREACH(LANG C CXX) +- STRING(REPLACE "-rdynamic" "" +- CMAKE_SHARED_LIBRARY_LINK_${LANG}_FLAGS +- ${CMAKE_SHARED_LIBRARY_LINK_${LANG}_FLAGS} +- ) +-ENDFOREACH() +- + # Ensure we have clean build for shared libraries + # without unresolved symbols + # Not supported with AddressSanitizer diff --git a/package/mysql/patches/patch-cmd-line-utils_libedit_chartype_h b/package/mysql/patches/patch-cmd-line-utils_libedit_chartype_h new file mode 100644 index 000000000..73ece9904 --- /dev/null +++ b/package/mysql/patches/patch-cmd-line-utils_libedit_chartype_h @@ -0,0 +1,22 @@ +--- mysql-5.6.17.orig/cmd-line-utils/libedit/chartype.h 2014-03-14 20:07:26.000000000 +0100 ++++ mysql-5.6.17/cmd-line-utils/libedit/chartype.h 2014-04-05 06:38:33.000000000 +0200 +@@ -45,19 +45,6 @@ + * seems to actually advertise this properly, despite Unicode 3.1 having + * been around since 2001... */ + +-/* XXXMYSQL : Added FreeBSD & AIX to bypass this check. +- TODO : Verify if FreeBSD & AIX stores ISO 10646 in wchar_t. */ +-#if !defined(__NetBSD__) && !defined(__sun) \ +- && !(defined(__APPLE__) && defined(__MACH__)) \ +- && !defined(__FreeBSD__) && !defined(_AIX) +-#ifndef __STDC_ISO_10646__ +-/* In many places it is assumed that the first 127 code points are ASCII +- * compatible, so ensure wchar_t indeed does ISO 10646 and not some other +- * funky encoding that could break us in weird and wonderful ways. */ +- #error wchar_t must store ISO 10646 characters +-#endif +-#endif +- + /* Oh for a <uchar.h> with char32_t and __STDC_UTF_32__ in it... + * ref: ISO/IEC DTR 19769 + */ diff --git a/package/mysql/patches/patch-configure b/package/mysql/patches/patch-configure deleted file mode 100644 index 853c31f7f..000000000 --- a/package/mysql/patches/patch-configure +++ /dev/null @@ -1,365 +0,0 @@ ---- mysql-5.1.48.orig/configure 2010-06-03 17:54:47.000000000 +0200 -+++ mysql-5.1.48/configure 2011-01-15 12:58:47.000000000 +0100 -@@ -19764,15 +19764,6 @@ fi - - - --# Enable the abi_check rule only if gcc is available -- --if test "$GCC" != "yes" || expr "$CC" : ".*icc.*" --then -- ABI_CHECK="" --else -- ABI_CHECK="abi_check" --fi -- - - - # Look for PS usage. We use double dollar-signs in FIND_PROC because this -@@ -19825,45 +19816,7 @@ fi - $as_echo_n "checking \"how to check if pid exists\"... " >&6; } - PS=$ac_cv_path_PS - # Linux style --if $PS wwwp $$ 2> /dev/null | grep -- "$0" > /dev/null --then -- FIND_PROC="$PS wwwp \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null" --# Solaris --elif $PS -fp $$ 2> /dev/null | grep -- $0 > /dev/null --then -- FIND_PROC="$PS -p \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null" --# BSD style --elif $PS -uaxww 2> /dev/null | grep -- $0 > /dev/null --then -- FIND_PROC="$PS -uaxww | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null" --# SysV style --elif $PS -ef 2> /dev/null | grep -- $0 > /dev/null --then -- FIND_PROC="$PS -ef | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null" --# Do anybody use this? --elif $PS $$ 2> /dev/null | grep -- $0 > /dev/null --then -- FIND_PROC="$PS \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null" --else -- case $SYSTEM_TYPE in -- *freebsd*|*dragonfly*) -- FIND_PROC="$PS p \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null" -- ;; -- *darwin*) -- FIND_PROC="$PS -uaxww | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null" -- ;; -- *cygwin*) -- FIND_PROC="$PS -e | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null" -- ;; -- *netware*) -- FIND_PROC= -- ;; -- *) -- { { $as_echo "$as_me:$LINENO: error: Could not find the right ps and/or grep switches. Which OS is this? See the Installation chapter in the Reference Manual." >&5 --$as_echo "$as_me: error: Could not find the right ps and/or grep switches. Which OS is this? See the Installation chapter in the Reference Manual." >&2;} -- { (exit 1); exit 1; }; } -- esac --fi -+FIND_PROC="$PS wwwp \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null" - - { $as_echo "$as_me:$LINENO: result: \"$FIND_PROC\"" >&5 - $as_echo "\"$FIND_PROC\"" >&6; } -@@ -48273,197 +48226,14 @@ $as_echo "$as_me: error: unknown endiann - esac - - -- { $as_echo "$as_me:$LINENO: checking whether GCC atomic builtins are available" >&5 --$as_echo_n "checking whether GCC atomic builtins are available... " >&6; } -- # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not -- if test "$cross_compiling" = yes; then -- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 --$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} --{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling --See \`config.log' for more details." >&5 --$as_echo "$as_me: error: cannot run test program while cross compiling --See \`config.log' for more details." >&2;} -- { (exit 1); exit 1; }; }; } --else -- cat >conftest.$ac_ext <<_ACEOF --/* confdefs.h. */ --_ACEOF --cat confdefs.h >>conftest.$ac_ext --cat >>conftest.$ac_ext <<_ACEOF --/* end confdefs.h. */ -- -- int main() -- { -- long x; -- long y; -- long res; -- char c; -- -- x = 10; -- y = 123; -- res = __sync_bool_compare_and_swap(&x, x, y); -- if (!res || x != y) { -- return(1); -- } -- -- x = 10; -- y = 123; -- res = __sync_bool_compare_and_swap(&x, x + 1, y); -- if (res || x != 10) { -- return(1); -- } -- -- x = 10; -- y = 123; -- res = __sync_add_and_fetch(&x, y); -- if (res != 123 + 10 || x != 123 + 10) { -- return(1); -- } -- -- c = 10; -- res = __sync_lock_test_and_set(&c, 123); -- if (res != 10 || c != 123) { -- return(1); -- } -- -- return(0); -- } -- --_ACEOF --rm -f conftest$ac_exeext --if { (ac_try="$ac_link" --case "(($ac_try" in -- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; -- *) ac_try_echo=$ac_try;; --esac --eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" --$as_echo "$ac_try_echo") >&5 -- (eval "$ac_link") 2>&5 -- ac_status=$? -- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (case "(($ac_try" in -- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; -- *) ac_try_echo=$ac_try;; --esac --eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" --$as_echo "$ac_try_echo") >&5 -- (eval "$ac_try") 2>&5 -- ac_status=$? -- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- -- - cat >>confdefs.h <<\_ACEOF - #define HAVE_IB_GCC_ATOMIC_BUILTINS 1 - _ACEOF - -- { $as_echo "$as_me:$LINENO: result: yes" >&5 --$as_echo "yes" >&6; } -- --else -- $as_echo "$as_me: program exited with status $ac_status" >&5 --$as_echo "$as_me: failed program was:" >&5 --sed 's/^/| /' conftest.$ac_ext >&5 -- --( exit $ac_status ) -- -- { $as_echo "$as_me:$LINENO: result: no" >&5 --$as_echo "no" >&6; } -- -- --fi --rm -rf conftest.dSYM --rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext --fi -- -- -- -- { $as_echo "$as_me:$LINENO: checking whether pthread_t can be used by GCC atomic builtins" >&5 --$as_echo_n "checking whether pthread_t can be used by GCC atomic builtins... " >&6; } -- # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not -- if test "$cross_compiling" = yes; then -- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 --$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} --{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling --See \`config.log' for more details." >&5 --$as_echo "$as_me: error: cannot run test program while cross compiling --See \`config.log' for more details." >&2;} -- { (exit 1); exit 1; }; }; } --else -- cat >conftest.$ac_ext <<_ACEOF --/* confdefs.h. */ --_ACEOF --cat confdefs.h >>conftest.$ac_ext --cat >>conftest.$ac_ext <<_ACEOF --/* end confdefs.h. */ -- -- #include <pthread.h> -- #include <string.h> -- -- int main(int argc, char** argv) { -- pthread_t x1; -- pthread_t x2; -- pthread_t x3; -- -- memset(&x1, 0x0, sizeof(x1)); -- memset(&x2, 0x0, sizeof(x2)); -- memset(&x3, 0x0, sizeof(x3)); -- -- __sync_bool_compare_and_swap(&x1, x2, x3); -- -- return(0); -- } -- --_ACEOF --rm -f conftest$ac_exeext --if { (ac_try="$ac_link" --case "(($ac_try" in -- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; -- *) ac_try_echo=$ac_try;; --esac --eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" --$as_echo "$ac_try_echo") >&5 -- (eval "$ac_link") 2>&5 -- ac_status=$? -- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (case "(($ac_try" in -- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; -- *) ac_try_echo=$ac_try;; --esac --eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" --$as_echo "$ac_try_echo") >&5 -- (eval "$ac_try") 2>&5 -- ac_status=$? -- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- -- - cat >>confdefs.h <<\_ACEOF - #define HAVE_IB_ATOMIC_PTHREAD_T_GCC 1 - _ACEOF - -- { $as_echo "$as_me:$LINENO: result: yes" >&5 --$as_echo "yes" >&6; } -- --else -- $as_echo "$as_me: program exited with status $ac_status" >&5 --$as_echo "$as_me: failed program was:" >&5 --sed 's/^/| /' conftest.$ac_ext >&5 -- --( exit $ac_status ) -- -- { $as_echo "$as_me:$LINENO: result: no" >&5 --$as_echo "no" >&6; } -- -- --fi --rm -rf conftest.dSYM --rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext --fi -- -- - - { $as_echo "$as_me:$LINENO: checking whether Solaris libc atomic functions are available" >&5 - $as_echo_n "checking whether Solaris libc atomic functions are available... " >&6; } -@@ -48581,101 +48351,6 @@ fi - done - - -- { $as_echo "$as_me:$LINENO: checking whether pthread_t can be used by Solaris libc atomic functions" >&5 --$as_echo_n "checking whether pthread_t can be used by Solaris libc atomic functions... " >&6; } -- # either define HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS or not -- if test "$cross_compiling" = yes; then -- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 --$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} --{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling --See \`config.log' for more details." >&5 --$as_echo "$as_me: error: cannot run test program while cross compiling --See \`config.log' for more details." >&2;} -- { (exit 1); exit 1; }; }; } --else -- cat >conftest.$ac_ext <<_ACEOF --/* confdefs.h. */ --_ACEOF --cat confdefs.h >>conftest.$ac_ext --cat >>conftest.$ac_ext <<_ACEOF --/* end confdefs.h. */ -- -- #include <pthread.h> -- #include <string.h> -- -- int main(int argc, char** argv) { -- pthread_t x1; -- pthread_t x2; -- pthread_t x3; -- -- memset(&x1, 0x0, sizeof(x1)); -- memset(&x2, 0x0, sizeof(x2)); -- memset(&x3, 0x0, sizeof(x3)); -- -- if (sizeof(pthread_t) == 4) { -- -- atomic_cas_32(&x1, x2, x3); -- -- } else if (sizeof(pthread_t) == 8) { -- -- atomic_cas_64(&x1, x2, x3); -- -- } else { -- -- return(1); -- } -- -- return(0); -- } -- --_ACEOF --rm -f conftest$ac_exeext --if { (ac_try="$ac_link" --case "(($ac_try" in -- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; -- *) ac_try_echo=$ac_try;; --esac --eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" --$as_echo "$ac_try_echo") >&5 -- (eval "$ac_link") 2>&5 -- ac_status=$? -- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -- { (case "(($ac_try" in -- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; -- *) ac_try_echo=$ac_try;; --esac --eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" --$as_echo "$ac_try_echo") >&5 -- (eval "$ac_try") 2>&5 -- ac_status=$? -- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- -- --cat >>confdefs.h <<\_ACEOF --#define HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS 1 --_ACEOF -- -- { $as_echo "$as_me:$LINENO: result: yes" >&5 --$as_echo "yes" >&6; } -- --else -- $as_echo "$as_me: program exited with status $ac_status" >&5 --$as_echo "$as_me: failed program was:" >&5 --sed 's/^/| /' conftest.$ac_ext >&5 -- --( exit $ac_status ) -- -- { $as_echo "$as_me:$LINENO: result: no" >&5 --$as_echo "no" >&6; } -- -- --fi --rm -rf conftest.dSYM --rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext --fi -- - - - # this is needed to know which one of atomic_cas_32() or atomic_cas_64() diff --git a/package/mysql/patches/patch-include_config_h_in b/package/mysql/patches/patch-include_config_h_in deleted file mode 100644 index d9b28c419..000000000 --- a/package/mysql/patches/patch-include_config_h_in +++ /dev/null @@ -1,21 +0,0 @@ ---- mysql-5.1.48.orig/include/config.h.in 2010-06-03 17:54:04.000000000 +0200 -+++ mysql-5.1.48/include/config.h.in 2011-01-21 00:08:19.737408555 +0100 -@@ -856,7 +856,7 @@ - /* Define to 1 if you have the `strtoull' function. */ - #undef HAVE_STRTOULL - --/* Define to 1 if `st_rdev' is member of `struct stat'. */ -+/* Define to 1 if `struct stat' is a member of `st_rdev'. */ - #undef HAVE_STRUCT_STAT_ST_RDEV - - /* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use -@@ -1151,6 +1151,9 @@ - /* Define to the one symbol short name of this package. */ - #undef PACKAGE_TARNAME - -+/* Define to the home page for this package. */ -+#undef PACKAGE_URL -+ - /* Define to the version of this package. */ - #undef PACKAGE_VERSION - diff --git a/package/mysql/patches/patch-include_my_global_h b/package/mysql/patches/patch-include_my_global_h deleted file mode 100644 index 847554aae..000000000 --- a/package/mysql/patches/patch-include_my_global_h +++ /dev/null @@ -1,54 +0,0 @@ ---- mysql-5.1.48.orig/include/my_global.h 2010-06-03 17:50:27.000000000 +0200 -+++ mysql-5.1.48/include/my_global.h 2010-07-12 22:51:23.369609493 +0200 -@@ -18,6 +18,8 @@ - #ifndef _global_h - #define _global_h - -+#include <sys/param.h> -+ - /* - InnoDB depends on some MySQL internals which other plugins should not - need. This is because of InnoDB's foreign key support, "safe" binlog -@@ -428,7 +430,7 @@ C_MODE_END - #ifdef HAVE_FLOAT_H - #include <float.h> - #endif --#ifdef HAVE_FENV_H -+#if defined(HAVE_FENV_H) && !defined(BSD) - #include <fenv.h> /* For fesetround() */ - #endif - -@@ -458,15 +460,20 @@ C_MODE_END - #undef HAVE_ALLOCA - #undef HAVE_ALLOCA_H - #endif --#ifdef HAVE_ALLOCA_H -+#if defined(HAVE_ALLOCA_H) && !defined(BSD) - #include <alloca.h> - #endif - - #include <errno.h> /* Recommended by debian */ - /* We need the following to go around a problem with openssl on solaris */ -+#ifdef BSD -+#include <pwd.h> -+#include <unistd.h> -+#else - #if defined(HAVE_CRYPT_H) - #include <crypt.h> - #endif -+#endif - - /* - A lot of our programs uses asserts, so better to always include it -@@ -883,9 +890,11 @@ typedef SOCKET_SIZE_TYPE size_socket; - #endif /* HAVE_FINITE */ - #endif /* isfinite */ - -+/* - #ifndef HAVE_ISNAN - #define isnan(x) ((x) != (x)) - #endif -+*/ - - #ifdef HAVE_ISINF - /* Check if C compiler is affected by GCC bug #39228 */ diff --git a/package/mysql/patches/patch-ltmain_sh b/package/mysql/patches/patch-ltmain_sh deleted file mode 100644 index c5cb790cf..000000000 --- a/package/mysql/patches/patch-ltmain_sh +++ /dev/null @@ -1,11 +0,0 @@ ---- mysql-5.1.48.orig/ltmain.sh 2010-06-03 17:54:04.000000000 +0200 -+++ mysql-5.1.48/ltmain.sh 2011-01-15 13:03:34.000000000 +0100 -@@ -4765,7 +4765,7 @@ func_mode_link () - # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC - # @file GCC response files - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -- -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) -+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-fstack-protector*|-flto) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - func_append compile_command " $arg" diff --git a/package/mysql/patches/patch-scripts_mysql_config_sh b/package/mysql/patches/patch-scripts_mysql_config_sh deleted file mode 100644 index 3e1833199..000000000 --- a/package/mysql/patches/patch-scripts_mysql_config_sh +++ /dev/null @@ -1,11 +0,0 @@ ---- mysql-5.1.48.orig/scripts/mysql_config.sh 2010-06-03 17:50:21.000000000 +0200 -+++ mysql-5.1.48/scripts/mysql_config.sh 2011-01-21 00:32:53.596454498 +0100 -@@ -119,7 +119,7 @@ if [ -r "$pkglibdir/libmygcc.a" ]; then - embedded_libs="$embedded_libs -lmygcc " - fi - --cflags="-I$pkgincludedir @CFLAGS@ " #note: end space! -+cflags="-I$pkgincludedir" #note: end space! - include="-I$pkgincludedir" - - # Remove some options that a client doesn't have to care about diff --git a/package/mysql/patches/patch-sql_sql_builtin_cc b/package/mysql/patches/patch-sql_sql_builtin_cc deleted file mode 100644 index 785ae0024..000000000 --- a/package/mysql/patches/patch-sql_sql_builtin_cc +++ /dev/null @@ -1,15 +0,0 @@ ---- mysql-5.1.48.orig/sql/sql_builtin.cc 2010-06-03 17:57:58.000000000 +0200 -+++ mysql-5.1.48/sql/sql_builtin.cc 2010-07-12 22:52:33.577118523 +0200 -@@ -18,10 +18,10 @@ - typedef struct st_mysql_plugin builtin_plugin[]; - - extern builtin_plugin -- builtin_binlog_plugin, builtin_partition_plugin, builtin_csv_plugin, builtin_heap_plugin, builtin_myisam_plugin, builtin_myisammrg_plugin, builtin_ndbcluster_plugin; -+ builtin_binlog_plugin, builtin_csv_plugin, builtin_heap_plugin, builtin_myisam_plugin, builtin_myisammrg_plugin; - - struct st_mysql_plugin *mysqld_builtins[]= - { -- builtin_binlog_plugin, builtin_partition_plugin, builtin_csv_plugin, builtin_heap_plugin, builtin_myisam_plugin, builtin_myisammrg_plugin, builtin_ndbcluster_plugin,(struct st_mysql_plugin *)0 -+ builtin_binlog_plugin, builtin_csv_plugin, builtin_heap_plugin, builtin_myisam_plugin, builtin_myisammrg_plugin,(struct st_mysql_plugin *)0 - }; - diff --git a/package/nasm/Makefile b/package/nasm/Makefile index 39e451a70..656970558 100644 --- a/package/nasm/Makefile +++ b/package/nasm/Makefile @@ -4,9 +4,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:= nasm -PKG_VERSION:= 2.11 +PKG_VERSION:= 2.11.02 PKG_RELEASE:= 1 -PKG_MD5SUM:= a884450ee65201473af4d270bdc132f8 +PKG_MD5SUM:= 7d5408bf18aa1699ad6c17e5017f12c3 PKG_DESCR:= the netwide assembler PKG_SECTION:= lang PKG_BUILDDEP:= nasm-host diff --git a/package/net-tools/Makefile b/package/net-tools/Makefile index e550059a4..a83c0a6e0 100644 --- a/package/net-tools/Makefile +++ b/package/net-tools/Makefile @@ -23,7 +23,7 @@ $(eval $(call PKG_template,ARP,arp,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS}, CONFIG_STYLE:= manual INSTALL_STYLE:= manual -ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y) +ifeq ($(ADK_TOOLCHAIN_USE_SSP),y) TARGET_LDFLAGS+= -lssp endif diff --git a/package/nginx/Makefile b/package/nginx/Makefile index 98ba1bef8..25c413a25 100644 --- a/package/nginx/Makefile +++ b/package/nginx/Makefile @@ -4,10 +4,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:= nginx -PKG_VERSION:= 1.5.3 +PKG_VERSION:= 1.5.12 PKG_RELEASE:= 1 -PKG_MD5SUM:= 1e735dd6a6ade2b5c20e924b67c3d355 -PKG_DESCR:= powerful http reverse proxy +PKG_MD5SUM:= c21589daaec0743d6d4cdf41503ffd53 +PKG_DESCR:= powerful http reverse proxy and webserver PKG_SECTION:= proxy PKG_BUILDDEP:= openssl pcre zlib PKG_DEPENDS:= libopenssl libpcre libpthread zlib diff --git a/package/nmap/Makefile b/package/nmap/Makefile index 09035c248..cd2e690d7 100644 --- a/package/nmap/Makefile +++ b/package/nmap/Makefile @@ -21,7 +21,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,NMAP,nmap,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y) +ifeq ($(ADK_TOOLCHAIN_USE_SSP),y) LIBRARIES+=-lssp -lssp_nonshared endif diff --git a/package/ntfs-3g/Makefile b/package/ntfs-3g/Makefile index 5151bfd21..b893cdb53 100644 --- a/package/ntfs-3g/Makefile +++ b/package/ntfs-3g/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= ntfs-3g -PKG_VERSION:= 2013.1.13 +PKG_VERSION:= 2014.2.15 PKG_RELEASE:= 1 -PKG_MD5SUM:= 2d6fb47ddf62b51733227126fe9227fe +PKG_MD5SUM:= f11d563816249d730a00498983485f3a PKG_DESCR:= ntfs filesystem driver PKG_SECTION:= fs PKG_DEPENDS:= kmod-fuse-fs diff --git a/package/ntfs-3g/patches/patch-libfuse-lite_fusermount_c b/package/ntfs-3g/patches/patch-libfuse-lite_fusermount_c new file mode 100644 index 000000000..eb11b0bf0 --- /dev/null +++ b/package/ntfs-3g/patches/patch-libfuse-lite_fusermount_c @@ -0,0 +1,10 @@ +--- ntfs-3g_ntfsprogs-2014.2.15.orig/libfuse-lite/fusermount.c 2014-02-15 15:07:52.000000000 +0100 ++++ ntfs-3g_ntfsprogs-2014.2.15/libfuse-lite/fusermount.c 2014-03-23 09:53:10.000000000 +0100 +@@ -18,6 +18,7 @@ + #include <getopt.h> + #include <errno.h> + #include <fcntl.h> ++#include <paths.h> + #include <pwd.h> + + #ifdef __SOLARIS__ diff --git a/package/ntfs-3g/patches/patch-libfuse-lite_mount_util_c b/package/ntfs-3g/patches/patch-libfuse-lite_mount_util_c new file mode 100644 index 000000000..1a3d8e8c5 --- /dev/null +++ b/package/ntfs-3g/patches/patch-libfuse-lite_mount_util_c @@ -0,0 +1,10 @@ +--- ntfs-3g_ntfsprogs-2014.2.15.orig/libfuse-lite/mount_util.c 2014-02-15 15:07:52.000000000 +0100 ++++ ntfs-3g_ntfsprogs-2014.2.15/libfuse-lite/mount_util.c 2014-03-23 09:54:19.000000000 +0100 +@@ -12,6 +12,7 @@ + #include <unistd.h> + #include <stdlib.h> + #include <string.h> ++#include <paths.h> + #include <dirent.h> + #include <errno.h> + #include <limits.h> diff --git a/package/omxplayer/Makefile b/package/omxplayer/Makefile index 696f8901b..c36174f43 100644 --- a/package/omxplayer/Makefile +++ b/package/omxplayer/Makefile @@ -4,10 +4,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:= omxplayer -# actually d1a4a0e1030249e40e2e9bb04518f1b786b18488 from 7.01.2014 -PKG_VERSION:= 0.3 -PKG_RELEASE:= 1 -PKG_MD5SUM:= 1882cac6032baa59291068af30df1702 +# actually 1ca2f7adaa7f6a92410d9664e76c395537659dba from 07.04.2014 +PKG_VERSION:= 0.4 +PKG_RELEASE:= 2 +PKG_MD5SUM:= d4efff32305bd16315e6fa4f80ea2a98 PKG_DESCR:= video player for raspberry pi PKG_SECTION:= multimedia PKG_DEPENDS:= libffmpeg boost bcm2835-vc libfreetype libpcre diff --git a/package/omxplayer/patches/patch-Makefile b/package/omxplayer/patches/patch-Makefile index f7caae300..03a6f5e8b 100644 --- a/package/omxplayer/patches/patch-Makefile +++ b/package/omxplayer/patches/patch-Makefile @@ -1,14 +1,20 @@ ---- omxplayer-0.2.orig/Makefile 2013-10-11 15:17:41.000000000 +0200 -+++ omxplayer-0.2/Makefile 2013-10-11 15:30:49.000000000 +0200 +--- omxplayer-0.4.orig/Makefile 2014-04-07 13:50:34.000000000 +0200 ++++ omxplayer-0.4/Makefile 2014-04-07 16:25:29.144139758 +0200 @@ -2,9 +2,9 @@ include Makefile.include CFLAGS+=-std=c++0x -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -DTARGET_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CMAKE_CONFIG -D__VIDEOCORE4__ -U_FORTIFY_SOURCE -Wall -DHAVE_OMXLIB -DUSE_EXTERNAL_FFMPEG -DHAVE_LIBAVCODEC_AVCODEC_H -DHAVE_LIBAVUTIL_OPT_H -DHAVE_LIBAVUTIL_MEM_H -DHAVE_LIBAVUTIL_AVUTIL_H -DHAVE_LIBAVFORMAT_AVFORMAT_H -DHAVE_LIBAVFILTER_AVFILTER_H -DHAVE_LIBSWRESAMPLE_SWRESAMPLE_H -DOMX -DOMX_SKIP64BIT -ftree-vectorize -DUSE_EXTERNAL_OMX -DTARGET_RASPBERRY_PI -DUSE_EXTERNAL_LIBBCM_HOST --LDFLAGS+=-L./ -ldbus-1 -lc -lWFC -lGLESv2 -lEGL -lbcm_host -lopenmaxil -lfreetype -lz -Lffmpeg_compiled/usr/local/lib/ -+LDFLAGS+=-L./ -ldbus-1 -lc -lWFC -lGLESv2 -lEGL -lbcm_host -lopenmaxil -lfreetype -lz -lkhrn_static +-LDFLAGS+=-L./ -Lffmpeg_compiled/usr/local/lib/ -lc -lWFC -lGLESv2 -lEGL -lbcm_host -lopenmaxil -lfreetype -lz ++LDFLAGS+=-L./ -lc -lWFC -lGLESv2 -lEGL -lbcm_host -lopenmaxil -lfreetype -lz -lkhrn_static -INCLUDES+=-I./ -Ilinux -Iffmpeg_compiled/usr/local/include/ +INCLUDES+=-I./ -Ilinux DIST ?= omxplayer-dist +@@ -71,5 +71,4 @@ dist: omxplayer.bin + cp omxplayer omxplayer.bin $(DIST)/usr/bin + cp COPYING $(DIST)/usr/share/doc/ + cp README.md $(DIST)/usr/share/doc/README +- cp -a ffmpeg_compiled/usr/local/lib/*.so* $(DIST)/usr/lib/omxplayer/ + cd $(DIST); tar -czf ../$(DIST).tgz * diff --git a/package/openldap/Makefile b/package/openldap/Makefile index 1e45c66f8..391b7a832 100644 --- a/package/openldap/Makefile +++ b/package/openldap/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= openldap -PKG_VERSION:= 2.4.36 +PKG_VERSION:= 2.4.39 PKG_RELEASE:= 1 -PKG_MD5SUM:= 744701405d396b1fb9de6cb7a453c6e9 +PKG_MD5SUM:= b0d5ee4b252c841dec6b332d679cf943 PKG_DESCR:= OpenLDAP client libraries PKG_SECTION:= libs PKG_DEPENDS:= libopenssl libsasl2 libdb libpthread libuuid diff --git a/package/openssh/Makefile b/package/openssh/Makefile index 409e63c0a..7d80662e2 100644 --- a/package/openssh/Makefile +++ b/package/openssh/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= openssh -PKG_VERSION:= 6.5p1 +PKG_VERSION:= 6.6p1 PKG_RELEASE:= 1 -PKG_MD5SUM:= a084e7272b8cbd25afe0f5dce4802fef +PKG_MD5SUM:= 3e9800e6bca1fbac0eea4d41baa7f239 PKG_DESCR:= OpenSSH PKG_SECTION:= net/security PKG_BUILDDEP:= zlib openssl @@ -50,7 +50,7 @@ CONFIGURE_ARGS+= --with-kerberos5="${STAGING_TARGET_DIR}/usr" TARGET_LDFLAGS+= -L$(STAGING_TARGET_DIR)/usr/lib/heimdal -Wl,-rpath -Wl,/usr/lib/heimdal endif -ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y) +ifeq ($(ADK_TOOLCHAIN_USE_SSP),y) CONFIGURE_ARGS+= --with-stackprotect else CONFIGURE_ARGS+= --without-stackprotect diff --git a/package/openssh/patches/patch-digest_c b/package/openssh/patches/patch-digest-openssl_c index feead7711..dc8aeb4f6 100644 --- a/package/openssh/patches/patch-digest_c +++ b/package/openssh/patches/patch-digest-openssl_c @@ -1,5 +1,5 @@ ---- openssh-6.5p1.orig/digest.c 2014-01-20 02:41:53.000000000 +0100 -+++ openssh-6.5p1/digest.c 2014-02-11 17:41:23.000000000 +0100 +--- openssh-6.6p1.orig/digest-openssl.c 2014-02-04 01:25:45.000000000 +0100 ++++ openssh-6.6p1/digest-openssl.c 2014-03-24 13:42:01.000000000 +0100 @@ -44,7 +44,9 @@ struct ssh_digest { /* NB. Indexed directly by algorithm number */ const struct ssh_digest digests[] = { diff --git a/package/openssh/patches/patch-mac_c b/package/openssh/patches/patch-mac_c deleted file mode 100644 index 7812de4b2..000000000 --- a/package/openssh/patches/patch-mac_c +++ /dev/null @@ -1,24 +0,0 @@ -diff -Nur openssh-6.2p1.orig/mac.c openssh-6.2p1/mac.c ---- openssh-6.5p1.orig/mac.c 2014-01-10 00:37:05.000000000 +0100 -+++ openssh-6.5p1/mac.c 2014-02-11 15:26:16.000000000 +0100 -@@ -70,8 +70,10 @@ static const struct macalg macs[] = { - #endif - { "hmac-md5", SSH_EVP, EVP_md5, 0, 0, 0, 0 }, - { "hmac-md5-96", SSH_EVP, EVP_md5, 96, 0, 0, 0 }, -+#ifndef OPENSSL_NO_RIPEMD - { "hmac-ripemd160", SSH_EVP, EVP_ripemd160, 0, 0, 0, 0 }, - { "hmac-ripemd160@openssh.com", SSH_EVP, EVP_ripemd160, 0, 0, 0, 0 }, -+#endif - { "umac-64@openssh.com", SSH_UMAC, NULL, 0, 128, 64, 0 }, - { "umac-128@openssh.com", SSH_UMAC128, NULL, 0, 128, 128, 0 }, - -@@ -84,7 +86,9 @@ static const struct macalg macs[] = { - #endif - { "hmac-md5-etm@openssh.com", SSH_EVP, EVP_md5, 0, 0, 0, 1 }, - { "hmac-md5-96-etm@openssh.com", SSH_EVP, EVP_md5, 96, 0, 0, 1 }, -+#ifndef OPENSSL_NO_RIPEMD - { "hmac-ripemd160-etm@openssh.com", SSH_EVP, EVP_ripemd160, 0, 0, 0, 1 }, -+#endif - { "umac-64-etm@openssh.com", SSH_UMAC, NULL, 0, 128, 64, 1 }, - { "umac-128-etm@openssh.com", SSH_UMAC128, NULL, 0, 128, 128, 1 }, - diff --git a/package/openssl/Makefile b/package/openssl/Makefile index 4bca87621..145733c2a 100644 --- a/package/openssl/Makefile +++ b/package/openssl/Makefile @@ -4,10 +4,10 @@ include ${TOPDIR}/rules.mk PKG_NAME:= openssl -PKG_VERSION:= 1.0.1f -PKG_RELEASE:= 2 -PKG_MD5SUM:= f26b09c028a0541cab33da697d522b25 -PKG_DESCR:= OpenSSL (Secure Socket Layer) libraries +PKG_VERSION:= 1.0.1g +PKG_RELEASE:= 1 +PKG_MD5SUM:= de62b43dfcd858e66a74bee1c834e959 +PKG_DESCR:= Secure Socket Layer libraries PKG_SECTION:= libs PKG_DEPENDS:= zlib PKG_BUILDDEP:= zlib diff --git a/package/openswan/Makefile b/package/openswan/Makefile index efea0b004..a2ed17906 100644 --- a/package/openswan/Makefile +++ b/package/openswan/Makefile @@ -20,6 +20,9 @@ PKG_URL:= http://www.openswan.org/ PKG_SITES:= http://www.openswan.org/download/ PKG_NOPARALLEL:= 1 +# GLOB_BRACE usage +PKG_LIBC_DEPENDS:= uclibc glibc + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,OPENSWAN,openswan,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/openswan/patches/patch-include_arpa_nameser_h b/package/openswan/patches/patch-include_arpa_nameser_h new file mode 100644 index 000000000..a59cd15b2 --- /dev/null +++ b/package/openswan/patches/patch-include_arpa_nameser_h @@ -0,0 +1,128 @@ +--- openswan-2.6.38.orig/include/arpa/nameser.h 2012-03-23 22:33:43.000000000 +0100 ++++ openswan-2.6.38/include/arpa/nameser.h 2014-03-26 19:50:18.000000000 +0100 +@@ -55,7 +55,6 @@ + + #include <sys/param.h> + #include <sys/types.h> +-#include <sys/cdefs.h> + + /* + * Revision information. This is the release date in YYYYMMDD format. +@@ -505,62 +504,66 @@ typedef enum __ns_cert_types { + #define ns_makecanon __ns_makecanon + #define ns_samename __ns_samename + +-__BEGIN_DECLS +-int ns_msg_getflag __P((ns_msg, int)); +-u_int ns_get16 __P((const u_char *)); +-u_long ns_get32 __P((const u_char *)); +-void ns_put16 __P((u_int, u_char *)); +-void ns_put32 __P((u_long, u_char *)); +-int ns_initparse __P((const u_char *, int, ns_msg *)); +-int ns_skiprr __P((const u_char *, const u_char *, ns_sect, int)); +-int ns_parserr __P((ns_msg *, ns_sect, int, ns_rr *)); +-int ns_sprintrr __P((const ns_msg *, const ns_rr *, +- const char *, const char *, char *, size_t)); +-int ns_sprintrrf __P((const u_char *, size_t, const char *, ++#ifdef __cplusplus ++extern "C" { ++#endif ++int ns_msg_getflag (ns_msg, int); ++u_int ns_get16 (const u_char *); ++u_long ns_get32 (const u_char *); ++void ns_put16 (u_int, u_char *); ++void ns_put32 (u_long, u_char *); ++int ns_initparse (const u_char *, int, ns_msg *); ++int ns_skiprr (const u_char *, const u_char *, ns_sect, int); ++int ns_parserr (ns_msg *, ns_sect, int, ns_rr *); ++int ns_sprintrr (const ns_msg *, const ns_rr *, ++ const char *, const char *, char *, size_t); ++int ns_sprintrrf (const u_char *, size_t, const char *, + ns_class, ns_type, u_long, const u_char *, + size_t, const char *, const char *, +- char *, size_t)); +-int ns_format_ttl __P((u_long, char *, size_t)); +-int ns_parse_ttl __P((const char *, u_long *)); +-u_int32_t ns_datetosecs __P((const char *cp, int *errp)); +-int ns_name_ntol __P((const u_char *, u_char *, size_t)); +-int ns_name_ntop __P((const u_char *, char *, size_t)); +-int ns_name_pton __P((const char *, u_char *, size_t)); +-int ns_name_unpack __P((const u_char *, const u_char *, +- const u_char *, u_char *, size_t)); +-int ns_name_pack __P((const u_char *, u_char *, int, +- const u_char **, const u_char **)); +-int ns_name_uncompress __P((const u_char *, const u_char *, +- const u_char *, char *, size_t)); +-int ns_name_compress __P((const char *, u_char *, size_t, +- const u_char **, const u_char **)); +-int ns_name_skip __P((const u_char **, const u_char *)); +-void ns_name_rollback __P((const u_char *, const u_char **, +- const u_char **)); +-int ns_sign __P((u_char *, int *, int, int, void *, +- const u_char *, int, u_char *, int *, time_t)); +-int ns_sign2 __P((u_char *, int *, int, int, void *, ++ char *, size_t); ++int ns_format_ttl (u_long, char *, size_t); ++int ns_parse_ttl (const char *, u_long *); ++u_int32_t ns_datetosecs (const char *cp, int *errp); ++int ns_name_ntol (const u_char *, u_char *, size_t); ++int ns_name_ntop (const u_char *, char *, size_t); ++int ns_name_pton (const char *, u_char *, size_t); ++int ns_name_unpack (const u_char *, const u_char *, ++ const u_char *, u_char *, size_t); ++int ns_name_pack (const u_char *, u_char *, int, ++ const u_char **, const u_char **); ++int ns_name_uncompress (const u_char *, const u_char *, ++ const u_char *, char *, size_t); ++int ns_name_compress (const char *, u_char *, size_t, ++ const u_char **, const u_char **); ++int ns_name_skip (const u_char **, const u_char *); ++void ns_name_rollback (const u_char *, const u_char **, ++ const u_char **); ++int ns_sign (u_char *, int *, int, int, void *, ++ const u_char *, int, u_char *, int *, time_t); ++int ns_sign2 (u_char *, int *, int, int, void *, + const u_char *, int, u_char *, int *, time_t, +- u_char **, u_char **)); +-int ns_sign_tcp __P((u_char *, int *, int, int, +- ns_tcp_tsig_state *, int)); +-int ns_sign_tcp2 __P((u_char *, int *, int, int, ++ u_char **, u_char **); ++int ns_sign_tcp (u_char *, int *, int, int, ++ ns_tcp_tsig_state *, int); ++int ns_sign_tcp2 (u_char *, int *, int, int, + ns_tcp_tsig_state *, int, +- u_char **, u_char **)); +-int ns_sign_tcp_init __P((void *, const u_char *, int, +- ns_tcp_tsig_state *)); +-u_char *ns_find_tsig __P((u_char *, u_char *)); +-int ns_verify __P((u_char *, int *, void *, ++ u_char **, u_char **); ++int ns_sign_tcp_init (void *, const u_char *, int, ++ ns_tcp_tsig_state *); ++u_char *ns_find_tsig (u_char *, u_char *); ++int ns_verify (u_char *, int *, void *, + const u_char *, int, u_char *, int *, +- time_t *, int)); +-int ns_verify_tcp __P((u_char *, int *, ns_tcp_tsig_state *, int)); +-int ns_verify_tcp_init __P((void *, const u_char *, int, +- ns_tcp_tsig_state *)); +-int ns_samedomain __P((const char *, const char *)); +-int ns_subdomain __P((const char *, const char *)); +-int ns_makecanon __P((const char *, char *, size_t)); +-int ns_samename __P((const char *, const char *)); +-__END_DECLS ++ time_t *, int); ++int ns_verify_tcp (u_char *, int *, ns_tcp_tsig_state *, int); ++int ns_verify_tcp_init (void *, const u_char *, int, ++ ns_tcp_tsig_state *); ++int ns_samedomain (const char *, const char *); ++int ns_subdomain (const char *, const char *); ++int ns_makecanon (const char *, char *, size_t); ++int ns_samename (const char *, const char *); ++#ifdef __cplusplus ++} ++#endif + + #ifdef BIND_4_COMPAT + #include <arpa/nameser_compat.h> diff --git a/package/openswan/patches/patch-lib_libipsecconf_cmp_c b/package/openswan/patches/patch-lib_libipsecconf_cmp_c new file mode 100644 index 000000000..c9e93a241 --- /dev/null +++ b/package/openswan/patches/patch-lib_libipsecconf_cmp_c @@ -0,0 +1,11 @@ +--- openswan-2.6.38.orig/lib/libipsecconf/cmp.c 2012-03-23 22:33:43.000000000 +0100 ++++ openswan-2.6.38/lib/libipsecconf/cmp.c 2014-03-27 08:42:09.000000000 +0100 +@@ -15,7 +15,7 @@ + * + */ + +-#include <sys/queue.h> ++#include "queue.h" + #include <string.h> + + #include "ipsecconf/keywords.h" diff --git a/package/openswan/patches/patch-lib_libipsecconf_confread_c b/package/openswan/patches/patch-lib_libipsecconf_confread_c new file mode 100644 index 000000000..5d28ed79f --- /dev/null +++ b/package/openswan/patches/patch-lib_libipsecconf_confread_c @@ -0,0 +1,11 @@ +--- openswan-2.6.38.orig/lib/libipsecconf/confread.c 2012-03-23 22:33:43.000000000 +0100 ++++ openswan-2.6.38/lib/libipsecconf/confread.c 2014-03-26 21:15:56.000000000 +0100 +@@ -20,7 +20,7 @@ + #include <string.h> + #include <limits.h> + #include <assert.h> +-#include <sys/queue.h> ++#include "queue.h" + + #include "oswalloc.h" + diff --git a/package/openswan/patches/patch-lib_libipsecconf_confwrite_c b/package/openswan/patches/patch-lib_libipsecconf_confwrite_c new file mode 100644 index 000000000..d3fced0b3 --- /dev/null +++ b/package/openswan/patches/patch-lib_libipsecconf_confwrite_c @@ -0,0 +1,11 @@ +--- openswan-2.6.38.orig/lib/libipsecconf/confwrite.c 2012-03-23 22:33:43.000000000 +0100 ++++ openswan-2.6.38/lib/libipsecconf/confwrite.c 2014-03-26 21:19:22.000000000 +0100 +@@ -18,7 +18,7 @@ + #include <string.h> + #include <limits.h> + #include <assert.h> +-#include <sys/queue.h> ++#include "queue.h" + + #include "ipsecconf/parser.h" + #include "ipsecconf/confread.h" diff --git a/package/openswan/patches/patch-lib_libipsecconf_parser_l b/package/openswan/patches/patch-lib_libipsecconf_parser_l new file mode 100644 index 000000000..7c4bff2d3 --- /dev/null +++ b/package/openswan/patches/patch-lib_libipsecconf_parser_l @@ -0,0 +1,11 @@ +--- openswan-2.6.38.orig/lib/libipsecconf/parser.l 2012-03-23 22:33:43.000000000 +0100 ++++ openswan-2.6.38/lib/libipsecconf/parser.l 2014-03-27 08:47:12.000000000 +0100 +@@ -19,7 +19,7 @@ + * + */ + +-#include <sys/queue.h> ++#include "queue.h" + #include <string.h> + #include <stdlib.h> + #include <assert.h> diff --git a/package/openswan/patches/patch-lib_libipsecconf_parser_y b/package/openswan/patches/patch-lib_libipsecconf_parser_y new file mode 100644 index 000000000..81037eb64 --- /dev/null +++ b/package/openswan/patches/patch-lib_libipsecconf_parser_y @@ -0,0 +1,11 @@ +--- openswan-2.6.38.orig/lib/libipsecconf/parser.y 2012-03-23 22:33:43.000000000 +0100 ++++ openswan-2.6.38/lib/libipsecconf/parser.y 2014-03-27 08:44:37.000000000 +0100 +@@ -15,7 +15,7 @@ + * + */ + +-#include <sys/queue.h> ++#include "queue.h" + #include <stdio.h> + #include <stdlib.h> + #include <string.h> diff --git a/package/openswan/patches/patch-lib_libipsecconf_starterwhack_c b/package/openswan/patches/patch-lib_libipsecconf_starterwhack_c new file mode 100644 index 000000000..2bc7e6910 --- /dev/null +++ b/package/openswan/patches/patch-lib_libipsecconf_starterwhack_c @@ -0,0 +1,11 @@ +--- openswan-2.6.38.orig/lib/libipsecconf/starterwhack.c 2012-03-23 22:33:43.000000000 +0100 ++++ openswan-2.6.38/lib/libipsecconf/starterwhack.c 2014-03-26 21:21:22.000000000 +0100 +@@ -17,7 +17,7 @@ + #include <sys/types.h> + #include <sys/socket.h> + #include <sys/un.h> +-#include <sys/queue.h> ++#include "queue.h" + #include <stddef.h> + #include <stdio.h> + #include <stdlib.h> diff --git a/package/openswan/patches/patch-lib_libopenswan_kernel_alg_c b/package/openswan/patches/patch-lib_libopenswan_kernel_alg_c new file mode 100644 index 000000000..36cf64ee4 --- /dev/null +++ b/package/openswan/patches/patch-lib_libopenswan_kernel_alg_c @@ -0,0 +1,11 @@ +--- openswan-2.6.38.orig/lib/libopenswan/kernel_alg.c 2012-03-23 22:33:43.000000000 +0100 ++++ openswan-2.6.38/lib/libopenswan/kernel_alg.c 2014-03-26 20:04:18.000000000 +0100 +@@ -27,7 +27,7 @@ + #include <netinet/in.h> + #include <arpa/inet.h> + #include <unistd.h> +-#include <sys/queue.h> ++#include "queue.h" + + #include <openswan.h> + diff --git a/package/openswan/patches/patch-lib_libopenswan_oswlog_c b/package/openswan/patches/patch-lib_libopenswan_oswlog_c new file mode 100644 index 000000000..a093b4e1b --- /dev/null +++ b/package/openswan/patches/patch-lib_libopenswan_oswlog_c @@ -0,0 +1,11 @@ +--- openswan-2.6.38.orig/lib/libopenswan/oswlog.c 2012-03-23 22:33:43.000000000 +0100 ++++ openswan-2.6.38/lib/libopenswan/oswlog.c 2014-03-26 21:09:43.000000000 +0100 +@@ -24,7 +24,7 @@ + #include <string.h> + #include <unistd.h> + #include <signal.h> /* used only if MSG_NOSIGNAL not defined */ +-#include <sys/queue.h> ++#include "queue.h" + #include <libgen.h> + #include <sys/stat.h> + #include <sys/types.h> diff --git a/package/openswan/src/ports/linux/include/queue.h b/package/openswan/src/ports/linux/include/queue.h new file mode 100644 index 000000000..daf4553d3 --- /dev/null +++ b/package/openswan/src/ports/linux/include/queue.h @@ -0,0 +1,574 @@ +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 THE REGENTS 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. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + */ + +#ifndef _SYS_QUEUE_H_ +#define _SYS_QUEUE_H_ + +/* + * This file defines five types of data structures: singly-linked lists, + * lists, simple queues, tail queues, and circular queues. + * + * A singly-linked list is headed by a single forward pointer. The + * elements are singly linked for minimum space and pointer manipulation + * overhead at the expense of O(n) removal for arbitrary elements. New + * elements can be added to the list after an existing element or at the + * head of the list. Elements being removed from the head of the list + * should use the explicit macro for this purpose for optimum + * efficiency. A singly-linked list may only be traversed in the forward + * direction. Singly-linked lists are ideal for applications with large + * datasets and few or no removals or for implementing a LIFO queue. + * + * A list is headed by a single forward pointer (or an array of forward + * pointers for a hash table header). The elements are doubly linked + * so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before + * or after an existing element or at the head of the list. A list + * may only be traversed in the forward direction. + * + * A simple queue is headed by a pair of pointers, one the head of the + * list and the other to the tail of the list. The elements are singly + * linked to save space, so elements can only be removed from the + * head of the list. New elements can be added to the list after + * an existing element, at the head of the list, or at the end of the + * list. A simple queue may only be traversed in the forward direction. + * + * A tail queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or + * after an existing element, at the head of the list, or at the end of + * the list. A tail queue may be traversed in either direction. + * + * A circle queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or after + * an existing element, at the head of the list, or at the end of the list. + * A circle queue may be traversed in either direction, but has a more + * complex end of list detection. + * + * For details on the use of these macros, see the queue(3) manual page. + */ + +/* + * List definitions. + */ +#define LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; /* first element */ \ +} + +#define LIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define LIST_ENTRY(type) \ +struct { \ + struct type *le_next; /* next element */ \ + struct type **le_prev; /* address of previous next element */ \ +} + +/* + * List functions. + */ +#define LIST_INIT(head) do { \ + (head)->lh_first = NULL; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_AFTER(listelm, elm, field) do { \ + if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ + (listelm)->field.le_next->field.le_prev = \ + &(elm)->field.le_next; \ + (listelm)->field.le_next = (elm); \ + (elm)->field.le_prev = &(listelm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.le_prev = (listelm)->field.le_prev; \ + (elm)->field.le_next = (listelm); \ + *(listelm)->field.le_prev = (elm); \ + (listelm)->field.le_prev = &(elm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.le_next = (head)->lh_first) != NULL) \ + (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ + (head)->lh_first = (elm); \ + (elm)->field.le_prev = &(head)->lh_first; \ +} while (/*CONSTCOND*/0) + +#define LIST_REMOVE(elm, field) do { \ + if ((elm)->field.le_next != NULL) \ + (elm)->field.le_next->field.le_prev = \ + (elm)->field.le_prev; \ + *(elm)->field.le_prev = (elm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_FOREACH(var, head, field) \ + for ((var) = ((head)->lh_first); \ + (var); \ + (var) = ((var)->field.le_next)) + +/* + * List access methods. + */ +#define LIST_EMPTY(head) ((head)->lh_first == NULL) +#define LIST_FIRST(head) ((head)->lh_first) +#define LIST_NEXT(elm, field) ((elm)->field.le_next) + + +/* + * Singly-linked List definitions. + */ +#define SLIST_HEAD(name, type) \ +struct name { \ + struct type *slh_first; /* first element */ \ +} + +#define SLIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define SLIST_ENTRY(type) \ +struct { \ + struct type *sle_next; /* next element */ \ +} + +/* + * Singly-linked List functions. + */ +#define SLIST_INIT(head) do { \ + (head)->slh_first = NULL; \ +} while (/*CONSTCOND*/0) + +#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ + (elm)->field.sle_next = (slistelm)->field.sle_next; \ + (slistelm)->field.sle_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define SLIST_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.sle_next = (head)->slh_first; \ + (head)->slh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define SLIST_REMOVE_HEAD(head, field) do { \ + (head)->slh_first = (head)->slh_first->field.sle_next; \ +} while (/*CONSTCOND*/0) + +#define SLIST_REMOVE(head, elm, type, field) do { \ + if ((head)->slh_first == (elm)) { \ + SLIST_REMOVE_HEAD((head), field); \ + } \ + else { \ + struct type *curelm = (head)->slh_first; \ + while(curelm->field.sle_next != (elm)) \ + curelm = curelm->field.sle_next; \ + curelm->field.sle_next = \ + curelm->field.sle_next->field.sle_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define SLIST_FOREACH(var, head, field) \ + for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next) + +/* + * Singly-linked List access methods. + */ +#define SLIST_EMPTY(head) ((head)->slh_first == NULL) +#define SLIST_FIRST(head) ((head)->slh_first) +#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) + + +/* + * Singly-linked Tail queue declarations. + */ +#define STAILQ_HEAD(name, type) \ +struct name { \ + struct type *stqh_first; /* first element */ \ + struct type **stqh_last; /* addr of last next element */ \ +} + +#define STAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).stqh_first } + +#define STAILQ_ENTRY(type) \ +struct { \ + struct type *stqe_next; /* next element */ \ +} + +/* + * Singly-linked Tail queue functions. + */ +#define STAILQ_INIT(head) do { \ + (head)->stqh_first = NULL; \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (head)->stqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.stqe_next = NULL; \ + *(head)->stqh_last = (elm); \ + (head)->stqh_last = &(elm)->field.stqe_next; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (listelm)->field.stqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define STAILQ_REMOVE_HEAD(head, field) do { \ + if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_REMOVE(head, elm, type, field) do { \ + if ((head)->stqh_first == (elm)) { \ + STAILQ_REMOVE_HEAD((head), field); \ + } else { \ + struct type *curelm = (head)->stqh_first; \ + while (curelm->field.stqe_next != (elm)) \ + curelm = curelm->field.stqe_next; \ + if ((curelm->field.stqe_next = \ + curelm->field.stqe_next->field.stqe_next) == NULL) \ + (head)->stqh_last = &(curelm)->field.stqe_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define STAILQ_FOREACH(var, head, field) \ + for ((var) = ((head)->stqh_first); \ + (var); \ + (var) = ((var)->field.stqe_next)) + +#define STAILQ_CONCAT(head1, head2) do { \ + if (!STAILQ_EMPTY((head2))) { \ + *(head1)->stqh_last = (head2)->stqh_first; \ + (head1)->stqh_last = (head2)->stqh_last; \ + STAILQ_INIT((head2)); \ + } \ +} while (/*CONSTCOND*/0) + +/* + * Singly-linked Tail queue access methods. + */ +#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) +#define STAILQ_FIRST(head) ((head)->stqh_first) +#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) + + +/* + * Simple queue definitions. + */ +#define SIMPLEQ_HEAD(name, type) \ +struct name { \ + struct type *sqh_first; /* first element */ \ + struct type **sqh_last; /* addr of last next element */ \ +} + +#define SIMPLEQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).sqh_first } + +#define SIMPLEQ_ENTRY(type) \ +struct { \ + struct type *sqe_next; /* next element */ \ +} + +/* + * Simple queue functions. + */ +#define SIMPLEQ_INIT(head) do { \ + (head)->sqh_first = NULL; \ + (head)->sqh_last = &(head)->sqh_first; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ + (head)->sqh_last = &(elm)->field.sqe_next; \ + (head)->sqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.sqe_next = NULL; \ + *(head)->sqh_last = (elm); \ + (head)->sqh_last = &(elm)->field.sqe_next; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ + (head)->sqh_last = &(elm)->field.sqe_next; \ + (listelm)->field.sqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_REMOVE_HEAD(head, field) do { \ + if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ + (head)->sqh_last = &(head)->sqh_first; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_REMOVE(head, elm, type, field) do { \ + if ((head)->sqh_first == (elm)) { \ + SIMPLEQ_REMOVE_HEAD((head), field); \ + } else { \ + struct type *curelm = (head)->sqh_first; \ + while (curelm->field.sqe_next != (elm)) \ + curelm = curelm->field.sqe_next; \ + if ((curelm->field.sqe_next = \ + curelm->field.sqe_next->field.sqe_next) == NULL) \ + (head)->sqh_last = &(curelm)->field.sqe_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_FOREACH(var, head, field) \ + for ((var) = ((head)->sqh_first); \ + (var); \ + (var) = ((var)->field.sqe_next)) + +/* + * Simple queue access methods. + */ +#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL) +#define SIMPLEQ_FIRST(head) ((head)->sqh_first) +#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) + + +/* + * Tail queue definitions. + */ +#define _TAILQ_HEAD(name, type, qual) \ +struct name { \ + qual type *tqh_first; /* first element */ \ + qual type *qual *tqh_last; /* addr of last next element */ \ +} +#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,) + +#define TAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).tqh_first } + +#define _TAILQ_ENTRY(type, qual) \ +struct { \ + qual type *tqe_next; /* next element */ \ + qual type *qual *tqe_prev; /* address of previous next element */\ +} +#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,) + +/* + * Tail queue functions. + */ +#define TAILQ_INIT(head) do { \ + (head)->tqh_first = NULL; \ + (head)->tqh_last = &(head)->tqh_first; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ + (head)->tqh_first->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_first = (elm); \ + (elm)->field.tqe_prev = &(head)->tqh_first; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.tqe_next = NULL; \ + (elm)->field.tqe_prev = (head)->tqh_last; \ + *(head)->tqh_last = (elm); \ + (head)->tqh_last = &(elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ + (elm)->field.tqe_next->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (listelm)->field.tqe_next = (elm); \ + (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ + (elm)->field.tqe_next = (listelm); \ + *(listelm)->field.tqe_prev = (elm); \ + (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_REMOVE(head, elm, field) do { \ + if (((elm)->field.tqe_next) != NULL) \ + (elm)->field.tqe_next->field.tqe_prev = \ + (elm)->field.tqe_prev; \ + else \ + (head)->tqh_last = (elm)->field.tqe_prev; \ + *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_FOREACH(var, head, field) \ + for ((var) = ((head)->tqh_first); \ + (var); \ + (var) = ((var)->field.tqe_next)) + +#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ + for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ + (var); \ + (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) + +#define TAILQ_CONCAT(head1, head2, field) do { \ + if (!TAILQ_EMPTY(head2)) { \ + *(head1)->tqh_last = (head2)->tqh_first; \ + (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ + (head1)->tqh_last = (head2)->tqh_last; \ + TAILQ_INIT((head2)); \ + } \ +} while (/*CONSTCOND*/0) + +/* + * Tail queue access methods. + */ +#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) +#define TAILQ_FIRST(head) ((head)->tqh_first) +#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) + +#define TAILQ_LAST(head, headname) \ + (*(((struct headname *)((head)->tqh_last))->tqh_last)) +#define TAILQ_PREV(elm, headname, field) \ + (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) + + +/* + * Circular queue definitions. + */ +#define CIRCLEQ_HEAD(name, type) \ +struct name { \ + struct type *cqh_first; /* first element */ \ + struct type *cqh_last; /* last element */ \ +} + +#define CIRCLEQ_HEAD_INITIALIZER(head) \ + { (void *)&head, (void *)&head } + +#define CIRCLEQ_ENTRY(type) \ +struct { \ + struct type *cqe_next; /* next element */ \ + struct type *cqe_prev; /* previous element */ \ +} + +/* + * Circular queue functions. + */ +#define CIRCLEQ_INIT(head) do { \ + (head)->cqh_first = (void *)(head); \ + (head)->cqh_last = (void *)(head); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + (elm)->field.cqe_next = (listelm)->field.cqe_next; \ + (elm)->field.cqe_prev = (listelm); \ + if ((listelm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (listelm)->field.cqe_next->field.cqe_prev = (elm); \ + (listelm)->field.cqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ + (elm)->field.cqe_next = (listelm); \ + (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ + if ((listelm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (listelm)->field.cqe_prev->field.cqe_next = (elm); \ + (listelm)->field.cqe_prev = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.cqe_next = (head)->cqh_first; \ + (elm)->field.cqe_prev = (void *)(head); \ + if ((head)->cqh_last == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (head)->cqh_first->field.cqe_prev = (elm); \ + (head)->cqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.cqe_next = (void *)(head); \ + (elm)->field.cqe_prev = (head)->cqh_last; \ + if ((head)->cqh_first == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (head)->cqh_last->field.cqe_next = (elm); \ + (head)->cqh_last = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_REMOVE(head, elm, field) do { \ + if ((elm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm)->field.cqe_prev; \ + else \ + (elm)->field.cqe_next->field.cqe_prev = \ + (elm)->field.cqe_prev; \ + if ((elm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm)->field.cqe_next; \ + else \ + (elm)->field.cqe_prev->field.cqe_next = \ + (elm)->field.cqe_next; \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_FOREACH(var, head, field) \ + for ((var) = ((head)->cqh_first); \ + (var) != (const void *)(head); \ + (var) = ((var)->field.cqe_next)) + +#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ + for ((var) = ((head)->cqh_last); \ + (var) != (const void *)(head); \ + (var) = ((var)->field.cqe_prev)) + +/* + * Circular queue access methods. + */ +#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) +#define CIRCLEQ_FIRST(head) ((head)->cqh_first) +#define CIRCLEQ_LAST(head) ((head)->cqh_last) +#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) +#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) + +#define CIRCLEQ_LOOP_NEXT(head, elm, field) \ + (((elm)->field.cqe_next == (void *)(head)) \ + ? ((head)->cqh_first) \ + : (elm->field.cqe_next)) +#define CIRCLEQ_LOOP_PREV(head, elm, field) \ + (((elm)->field.cqe_prev == (void *)(head)) \ + ? ((head)->cqh_last) \ + : (elm->field.cqe_prev)) + +#endif /* sys/queue.h */ diff --git a/package/osiris/Makefile b/package/osiris/Makefile deleted file mode 100644 index c2921b37a..000000000 --- a/package/osiris/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# This file is part of the OpenADK project. OpenADK is copyrighted -# material, please see the LICENCE file in the top-level directory. - -include ${TOPDIR}/rules.mk - -PKG_NAME:= osiris -PKG_VERSION:= 4.2.3 -PKG_RELEASE:= 1 -PKG_MD5SUM:= 1951c7dc0fe729af9ffaf58910340d12 -PKG_DESCR:= Host Integrity Monitoring System (scanning agent) -PKG_SECTION:= admin -PKG_DEPENDS:= libopenssl libpthread -PKG_BUILDDEP:= openssl -PKG_URL:= http://osiris.shmoo.com/ -PKG_SITES:= http://openadk.org/distfiles/ - -include ${TOPDIR}/mk/package.mk - -$(eval $(call PKG_template,OSIRIS,osiris,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) - -CONFIGURE_ENV+= ac_cv_openssldir="${STAGING_TARGET_DIR}/usr" \ - ac_cv_have_accrights_in_msghdr=no \ - ac_cv_have_control_in_msghdr=yes -CONFIGURE_ARGS+= --with-osiris-user=root \ - --with-root-dir=/var/lib/osiris \ - --with-readline=no -XAKE_FLAGS+= ar=${TARGET_CROSS}ar \ - INTERACTIVE=0 -TARGET_CFLAGS+= -DOPENSSL_NO_RIPEMD - -post-configure: - (cd ${WRKDIST}/src/osirisd/modules && ./genmods.sh); - -osiris-install: - ${INSTALL_DIR} ${IDIR_OSIRIS}/usr/sbin - ${INSTALL_BIN} ${WRKINST}/usr/sbin/osirisd \ - ${IDIR_OSIRIS}/usr/sbin/ - -include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/osiris/files/osirisd.init b/package/osiris/files/osirisd.init deleted file mode 100644 index b412e7e73..000000000 --- a/package/osiris/files/osirisd.init +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -#PKG osirisd -#INIT 75 -. /etc/rc.conf - -case $1 in -autostop) ;; -autostart) - test x"${osirisd:-NO}" = x"NO" && exit 0 - exec sh $0 start - ;; -start) - [ -d /var/lib/osiris ] || mkdir -p /var/lib/osiris - /usr/sbin/osirisd - ;; -stop) - kill $(pgrep -f /usr/sbin/osirisd) - ;; -restart) - sh $0 stop - sh $0 start - ;; -*) - echo "Usage: $0 {start | stop | restart}" - exit 1 - ;; -esac -exit $? diff --git a/package/osiris/patches/patch-configure b/package/osiris/patches/patch-configure deleted file mode 100644 index 6dce9a8fb..000000000 --- a/package/osiris/patches/patch-configure +++ /dev/null @@ -1,113 +0,0 @@ ---- osiris-4.2.3.orig/configure 2006-07-28 01:57:51.000000000 +0200 -+++ osiris-4.2.3/configure 2011-01-21 20:40:11.234913757 +0100 -@@ -3403,7 +3403,7 @@ else - fi - - --OS_NAME=`uname` -+OS_NAME=Linux - AUTOHEADER=echo - - if test "x$prefix" = "xNONE" ; then -@@ -3573,7 +3573,6 @@ else - - for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do - CPPFLAGS="$saved_CPPFLAGS" -- LDFLAGS="$saved_LDFLAGS" - - # GOD DAMN FUCKING STATIC BINARIES ON SOLARIS CAN EAT MY ASS. - -@@ -3596,29 +3595,6 @@ else - if test ! -z "$ssldir" -a ! -d "$ssldir" ; then - continue; - fi -- if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then -- # Try to use $ssldir/lib if it exists, otherwise -- # $ssldir -- if test -d "$ssldir/lib" ; then -- LDFLAGS="-L$ssldir/lib $saved_LDFLAGS" -- if test ! -z "$need_dash_r" ; then -- LDFLAGS="-R$ssldir/lib $LDFLAGS" -- fi -- else -- LDFLAGS="-L$ssldir $saved_LDFLAGS" -- if test ! -z "$need_dash_r" ; then -- LDFLAGS="-R$ssldir $LDFLAGS" -- fi -- fi -- -- # Try to use $ssldir/include if it exists, otherwise -- # $ssldir -- if test -d "$ssldir/include" ; then -- CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS" -- else -- CPPFLAGS="-I$ssldir $saved_CPPFLAGS" -- fi -- fi - - # Basic test to check for compatible version and correct linking - -@@ -3694,34 +3670,6 @@ fi - echo "$as_me:$LINENO: result: $ac_cv_openssldir" >&5 - echo "${ECHO_T}$ac_cv_openssldir" >&6 - --if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then --# AC_DEFINE(HAVE_OPENSSL) -- ssldir=$ac_cv_openssldir -- if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then -- # Try to use $ssldir/lib if it exists, otherwise -- # $ssldir -- if test -d "$ssldir/lib" ; then -- LDFLAGS="-L$ssldir/lib $saved_LDFLAGS" -- if test ! -z "$need_dash_r" ; then -- LDFLAGS="-R$ssldir/lib $LDFLAGS" -- fi -- else -- LDFLAGS="-L$ssldir $saved_LDFLAGS" -- if test ! -z "$need_dash_r" ; then -- LDFLAGS="-R$ssldir $LDFLAGS" -- fi -- fi -- # Try to use $ssldir/include if it exists, otherwise -- # $ssldir -- if test -d "$ssldir/include" ; then -- CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS" -- else -- CPPFLAGS="-I$ssldir $saved_CPPFLAGS" -- fi -- fi --fi -- -- - case "$OS_NAME" in - SunOS*) - LIBS="$saved_LIBS $ssldir/lib/libssl.a $ssldir/lib/libcrypto.a" -@@ -3738,7 +3686,7 @@ CYGWIN*) - esac - - --DB_CONFIG_ARGS="--enable-shared=no --enable-static=yes" -+DB_CONFIG_ARGS="--enable-shared=no --enable-static=yes --target=${target_alias} --host=${host_alias} --build=${build_alias}" - - case "${OS_NAME}" in - MINGW32*) -@@ -4448,11 +4396,6 @@ cat >>confdefs.h <<_ACEOF - #define SYSTEM_LINUX 1 - _ACEOF - -- -- rc=`grep -c krb5 /usr/include/openssl/ssl.h` -- if test $rc -ne 0; then -- CPPFLAGS="-I/usr/kerberos/include/ ${CPPFLAGS}" -- fi - ;; - BSD*) - -@@ -11394,7 +11337,6 @@ chmod ug+x src/install/install.sh - echo " Osiris MD Directory: ${with_md_root_dir}" - echo " Osiris MD user: ${with_osiris_md_user}" - echo " Osiris MD config dir: ${with_md_conf_dir}" -- cd ./src/osirisd/modules;./genmods.sh;cd ../../.. - echo " ==> use one of the following targets:" - echo "" - echo " all: make everything, agent, CLI and management console." diff --git a/package/osiris/patches/patch-src_db-4_2_52_dist_configure b/package/osiris/patches/patch-src_db-4_2_52_dist_configure deleted file mode 100644 index 45c04bec4..000000000 --- a/package/osiris/patches/patch-src_db-4_2_52_dist_configure +++ /dev/null @@ -1,12 +0,0 @@ ---- osiris-4.2.3.orig/src/db-4.2.52/dist/configure 2006-07-28 01:57:51.000000000 +0200 -+++ osiris-4.2.3/src/db-4.2.52/dist/configure 2011-01-16 14:41:34.000000000 +0100 -@@ -3498,7 +3498,8 @@ freebsd*) - LDFLAGS="$LDFLAGS -pthread";; - gnu*|k*bsd*-gnu|linux*) - optimize_def="-O2" -- CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -D_REENTRANT";; -+ CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -D_REENTRANT" -+ LDFLAGS="$LDFLAGS -pthread";; - hpux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT";; - irix*) optimize_def="-O2" - CPPFLAGS="$CPPFLAGS -D_SGI_MP_SOURCE";; diff --git a/package/osiris/patches/patch-src_db-4_2_52_dist_ltmain_sh b/package/osiris/patches/patch-src_db-4_2_52_dist_ltmain_sh deleted file mode 100644 index 8b9084264..000000000 --- a/package/osiris/patches/patch-src_db-4_2_52_dist_ltmain_sh +++ /dev/null @@ -1,11 +0,0 @@ ---- osiris-4.2.3.orig/src/db-4.2.52/dist/ltmain.sh 2006-07-28 01:57:51.000000000 +0200 -+++ osiris-4.2.3/src/db-4.2.52/dist/ltmain.sh 2011-01-16 14:08:34.000000000 +0100 -@@ -1298,7 +1298,7 @@ EOF - # but this is not reliable with gcc because gcc may use -mfoo to - # select a different linker, different libraries, etc, while - # -Wl,-mfoo simply passes -mfoo to the linker. -- -m*) -+ -m*|-fstack-protector*|-flto) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` diff --git a/package/osiris/patches/patch-src_libosiris_Makefile_in b/package/osiris/patches/patch-src_libosiris_Makefile_in deleted file mode 100644 index 458fc8bbd..000000000 --- a/package/osiris/patches/patch-src_libosiris_Makefile_in +++ /dev/null @@ -1,41 +0,0 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- osiris-4.2.3.orig/src/libosiris/Makefile.in 2006-07-28 01:57:51.000000000 +0200 -+++ osiris-4.2.3/src/libosiris/Makefile.in 2014-01-03 17:24:45.000000000 +0100 -@@ -105,7 +105,7 @@ libosiris_a_SOURCES = list.c message.c s - filter_uid.c filter_gid.c filter_user.c \ - filter_group.c filter_header.c filter_file.c \ - filter_suffix.c filter_md5.c filter_sha.c \ -- filter_ripemd.c filter_sid.c filter_permissions.c \ -+ filter_sid.c filter_permissions.c \ - string_list.h ssl_utilities.h utilities.h \ - regex.h regex.c debug.h debug.c strcasestr.c \ - error.h strptime.h -@@ -128,11 +128,10 @@ am_libosiris_a_OBJECTS = list.$(OBJEXT) - filter_python.$(OBJEXT) filter_script.$(OBJEXT) \ - filter_gzip.$(OBJEXT) filter_zip.$(OBJEXT) filter_tar.$(OBJEXT) \ - filter_pgp.$(OBJEXT) filter_rpm.$(OBJEXT) filter_uid.$(OBJEXT) \ -- filter_gid.$(OBJEXT) filter_user.$(OBJEXT) \ -+ filter_gid.$(OBJEXT) filter_user.$(OBJEXT) filter_sid.$(OBJEXT) \ - filter_group.$(OBJEXT) filter_header.$(OBJEXT) \ - filter_file.$(OBJEXT) filter_suffix.$(OBJEXT) \ - filter_md5.$(OBJEXT) filter_sha.$(OBJEXT) \ -- filter_ripemd.$(OBJEXT) filter_sid.$(OBJEXT) \ - filter_permissions.$(OBJEXT) regex.$(OBJEXT) debug.$(OBJEXT) \ - strcasestr.$(OBJEXT) - libosiris_a_OBJECTS = $(am_libosiris_a_OBJECTS) -@@ -158,7 +157,6 @@ am__depfiles_maybe = depfiles - @AMDEP_TRUE@ ./$(DEPDIR)/filter_permissions.Po \ - @AMDEP_TRUE@ ./$(DEPDIR)/filter_pgp.Po \ - @AMDEP_TRUE@ ./$(DEPDIR)/filter_python.Po \ --@AMDEP_TRUE@ ./$(DEPDIR)/filter_ripemd.Po \ - @AMDEP_TRUE@ ./$(DEPDIR)/filter_rpm.Po \ - @AMDEP_TRUE@ ./$(DEPDIR)/filter_script.Po \ - @AMDEP_TRUE@ ./$(DEPDIR)/filter_sgid.Po \ -@@ -224,7 +222,6 @@ distclean-compile: - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_permissions.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_pgp.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_python.Po@am__quote@ --@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_ripemd.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_rpm.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_script.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_sgid.Po@am__quote@ diff --git a/package/osiris/patches/patch-src_libosiris_configuration_c b/package/osiris/patches/patch-src_libosiris_configuration_c deleted file mode 100644 index f4b164b52..000000000 --- a/package/osiris/patches/patch-src_libosiris_configuration_c +++ /dev/null @@ -1,27 +0,0 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- osiris-4.2.3.orig/src/libosiris/configuration.c 2006-07-28 01:57:51.000000000 +0200 -+++ osiris-4.2.3/src/libosiris/configuration.c 2009-05-10 21:06:49.000000000 +0200 -@@ -105,9 +105,11 @@ static struct keywords hash_keywords[] = - { "sha1", HASH_SHA }, - { "sha-1", HASH_SHA }, - -+#ifndef OPENSSL_NO_RIPEMD - { "ripemd", HASH_RIPEMD }, - { "ripemd-160", HASH_RIPEMD }, - { "ripemd160", HASH_RIPEMD }, -+#endif - - { NULL, 0 } - }; -@@ -119,9 +121,11 @@ static char * valid_hash_values[] = - "sha", - "sha1", - "sha-1", -+#ifndef OPENSSL_NO_RIPEMD - "ripemd", - "ripemd160", - "ripemd-160", -+#endif - NULL - }; - diff --git a/package/osiris/patches/patch-src_libosiris_configuration_h b/package/osiris/patches/patch-src_libosiris_configuration_h deleted file mode 100644 index 6cf7c3540..000000000 --- a/package/osiris/patches/patch-src_libosiris_configuration_h +++ /dev/null @@ -1,13 +0,0 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- osiris-4.2.3.orig/src/libosiris/configuration.h 2006-07-28 01:57:51.000000000 +0200 -+++ osiris-4.2.3/src/libosiris/configuration.h 2009-05-10 21:19:28.000000000 +0200 -@@ -45,7 +45,9 @@ - #define HASH_DEFAULT HASH_MD5 - #define HASH_MD5 1 - #define HASH_SHA 2 -+#ifndef OPENSSL_NO_RIPEMD - #define HASH_RIPEMD 3 -+#endif - - /* config keyword types */ - diff --git a/package/osiris/patches/patch-src_libosiris_filter_c b/package/osiris/patches/patch-src_libosiris_filter_c deleted file mode 100644 index d7306ea14..000000000 --- a/package/osiris/patches/patch-src_libosiris_filter_c +++ /dev/null @@ -1,35 +0,0 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- osiris-4.2.3.orig/src/libosiris/filter.c 2006-07-28 01:57:51.000000000 +0200 -+++ osiris-4.2.3/src/libosiris/filter.c 2009-05-10 21:02:44.000000000 +0200 -@@ -66,7 +66,9 @@ static struct keywords filter_keywords[] - { "suffix", FILTER_TYPE_SUFFIX }, - { "md5", FILTER_TYPE_MD5 }, - { "sha", FILTER_TYPE_SHA }, -+#ifndef OPENSSL_NO_RIPEMD - { "ripemd", FILTER_TYPE_RIPEMD }, -+#endif - { "permissions", FILTER_TYPE_PERMISSIONS }, - { NULL, 0 } - }; -@@ -179,9 +181,11 @@ int setup_filter_function( OSI_FILTER *a - action_filter->perform = filter_sha; - break; - -+#ifndef OPENSSL_NO_RIPEMD - case FILTER_TYPE_RIPEMD: - action_filter->perform = filter_ripemd; - break; -+#endif - - case FILTER_TYPE_PERMISSIONS: - action_filter->perform = filter_permissions; -@@ -220,7 +224,9 @@ osi_bool filter_is_dynamic( int filter_t - case FILTER_TYPE_SUFFIX: - case FILTER_TYPE_MD5: - case FILTER_TYPE_SHA: -+#ifndef OPENSSL_NO_RIPEMD - case FILTER_TYPE_RIPEMD: -+#endif - case FILTER_TYPE_PERMISSIONS: - - return TRUE; diff --git a/package/osiris/patches/patch-src_libosiris_filter_h b/package/osiris/patches/patch-src_libosiris_filter_h deleted file mode 100644 index c7463306d..000000000 --- a/package/osiris/patches/patch-src_libosiris_filter_h +++ /dev/null @@ -1,23 +0,0 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- osiris-4.2.3.orig/src/libosiris/filter.h 2006-07-28 01:57:51.000000000 +0200 -+++ osiris-4.2.3/src/libosiris/filter.h 2009-05-10 21:15:10.000000000 +0200 -@@ -61,7 +61,9 @@ - #define FILTER_TYPE_SUFFIX 19 - #define FILTER_TYPE_MD5 20 - #define FILTER_TYPE_SHA 21 -+#ifndef OPENSSL_NO_RIPEMD - #define FILTER_TYPE_RIPEMD 22 -+#endif - #define FILTER_TYPE_PERMISSIONS 23 - #define FILTER_TYPE_SID 24 - -@@ -143,7 +145,9 @@ osi_bool filter_file( const char *file_p - osi_bool filter_suffix( const char *file_path, FILTER_CONTEXT *context ); - osi_bool filter_md5( const char *file_path, FILTER_CONTEXT *context ); - osi_bool filter_sha( const char *file_path, FILTER_CONTEXT *context ); -+#ifndef OPENSSL_NO_RIPEMD - osi_bool filter_ripemd( const char *file_path, FILTER_CONTEXT *context ); -+#endif - osi_bool filter_permissions( const char *file_path, FILTER_CONTEXT *context ); - - #endif diff --git a/package/osiris/patches/patch-src_libosiris_osi_common_h b/package/osiris/patches/patch-src_libosiris_osi_common_h deleted file mode 100644 index b30462a3c..000000000 --- a/package/osiris/patches/patch-src_libosiris_osi_common_h +++ /dev/null @@ -1,10 +0,0 @@ ---- osiris-4.2.3.orig/src/libosiris/osi_common.h 2006-07-28 01:57:51.000000000 +0200 -+++ osiris-4.2.3/src/libosiris/osi_common.h 2014-01-03 17:33:53.000000000 +0100 -@@ -31,6 +31,7 @@ - #ifndef OSI_COMMON_H - #define OSI_COMMON_H - -+#include <sys/types.h> - #include "config.h" - - /* for atomic_t */ diff --git a/package/osiris/patches/patch-src_libosiris_ssl_utilities_c b/package/osiris/patches/patch-src_libosiris_ssl_utilities_c deleted file mode 100644 index 47563591b..000000000 --- a/package/osiris/patches/patch-src_libosiris_ssl_utilities_c +++ /dev/null @@ -1,30 +0,0 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- osiris-4.2.3.orig/src/libosiris/ssl_utilities.c 2006-07-28 01:57:51.000000000 +0200 -+++ osiris-4.2.3/src/libosiris/ssl_utilities.c 2009-05-10 20:41:31.000000000 +0200 -@@ -51,7 +51,9 @@ - #include <openssl/rand.h> - #include <openssl/md5.h> - #include <openssl/sha.h> -+#ifndef OPENSSL_NO_RIPEMD - #include <openssl/ripemd.h> -+#endif - - #ifdef WIN32 - #include <winsock.h> -@@ -337,6 +339,7 @@ int hash_file_sha( const char *file_path - return -1; - } - -+#ifndef OPENSSL_NO_RIPEMD - /****************************************************************************** - ** - ** Function: hash_file_ripemd -@@ -433,7 +436,7 @@ int hash_file_ripemd( const char *file_p - - return -1; - } -- -+#endif - - /****************************************************************************** - ** diff --git a/package/osiris/patches/patch-src_libosiris_ssl_utilities_h b/package/osiris/patches/patch-src_libosiris_ssl_utilities_h deleted file mode 100644 index 668096983..000000000 --- a/package/osiris/patches/patch-src_libosiris_ssl_utilities_h +++ /dev/null @@ -1,14 +0,0 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- osiris-4.2.3.orig/src/libosiris/ssl_utilities.h 2006-07-28 01:57:51.000000000 +0200 -+++ osiris-4.2.3/src/libosiris/ssl_utilities.h 2009-05-10 20:42:04.000000000 +0200 -@@ -59,8 +59,10 @@ int hash_file_md5( const char *file_path - int hash_file_sha( const char *file_path, FILE *file, - char *buffer, int buffer_size ); - -+#ifndef OPENSSL_NO_RIPEMD - int hash_file_ripemd( const char *file_path, FILE *file, - char *buffer, int buffer_size ); -+#endif - - /* random SSL utilities. */ - diff --git a/package/osiris/patches/patch-src_libosiris_utilities_c b/package/osiris/patches/patch-src_libosiris_utilities_c deleted file mode 100644 index ec5a26ee7..000000000 --- a/package/osiris/patches/patch-src_libosiris_utilities_c +++ /dev/null @@ -1,13 +0,0 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- osiris-4.2.3.orig/src/libosiris/utilities.c 2006-07-28 01:57:51.000000000 +0200 -+++ osiris-4.2.3/src/libosiris/utilities.c 2009-05-10 20:37:18.000000000 +0200 -@@ -60,7 +60,9 @@ - - #include <openssl/md5.h> - #include <openssl/sha.h> -+#ifndef OPENSSL_NO_RIPEMD - #include <openssl/ripemd.h> -+#endif - - #include "utilities.h" - #include "error.h" diff --git a/package/osiris/patches/patch-src_osirisd_modules_Makefile_am b/package/osiris/patches/patch-src_osirisd_modules_Makefile_am deleted file mode 100644 index 332a866d5..000000000 --- a/package/osiris/patches/patch-src_osirisd_modules_Makefile_am +++ /dev/null @@ -1,11 +0,0 @@ ---- osiris-4.2.3.orig/src/osirisd/modules/Makefile.am 2006-07-28 01:57:51.000000000 +0200 -+++ osiris-4.2.3/src/osirisd/modules/Makefile.am 2011-01-21 20:47:14.568658281 +0100 -@@ -11,7 +11,7 @@ INCLUDES = -I$(top_srcdir)/src \ - noinst_SCRIPTS = modules - - unused.o: -- $(CC) -c unused.c -+ $(CC) $(CFLAGS) -c unused.c - - libmodules_a_DEPENDENCIES = unused.o - diff --git a/package/osiris/patches/patch-src_osirisd_modules_Makefile_in b/package/osiris/patches/patch-src_osirisd_modules_Makefile_in deleted file mode 100644 index 459702dec..000000000 --- a/package/osiris/patches/patch-src_osirisd_modules_Makefile_in +++ /dev/null @@ -1,11 +0,0 @@ ---- osiris-4.2.3.orig/src/osirisd/modules/Makefile.in 2006-07-28 01:57:51.000000000 +0200 -+++ osiris-4.2.3/src/osirisd/modules/Makefile.in 2011-01-21 20:47:02.618658788 +0100 -@@ -254,7 +254,7 @@ uninstall-am: uninstall-info-am - - - unused.o: -- $(CC) -c unused.c -+ $(CC) $(CFLAGS) -c unused.c - - modules: - ./genmods.sh diff --git a/package/osiris/patches/patch-src_osirisd_scanner_c b/package/osiris/patches/patch-src_osirisd_scanner_c deleted file mode 100644 index ee3927bf0..000000000 --- a/package/osiris/patches/patch-src_osirisd_scanner_c +++ /dev/null @@ -1,33 +0,0 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- osiris-4.2.3.orig/src/osirisd/scanner.c 2006-07-28 01:57:51.000000000 +0200 -+++ osiris-4.2.3/src/osirisd/scanner.c 2009-05-10 20:43:04.000000000 +0200 -@@ -839,12 +839,14 @@ void populate_scan_record( SCANNER *scan - MAX_CHECKSUM_LENGTH ); - break; - -+#ifndef OPENSSL_NO_RIPEMD - case HASH_RIPEMD: - - rc = hash_file_ripemd( scan_record->path, file_handle, - scan_record->checksum, - MAX_CHECKSUM_LENGTH ); - break; -+#endif - - default: - -@@ -987,12 +989,14 @@ void populate_scan_record( SCANNER *scan - MAX_CHECKSUM_LENGTH ); - break; - -+#ifndef OPENSSL_NO_RIPEMD - case HASH_RIPEMD: - - rc = hash_file_ripemd( scan_record->path, file_handle, - scan_record->checksum, - MAX_CHECKSUM_LENGTH ); - break; -+#endif - - default: - diff --git a/package/osiris/patches/patch-src_osirismd_md_control_c b/package/osiris/patches/patch-src_osirismd_md_control_c deleted file mode 100644 index 0c33533c8..000000000 --- a/package/osiris/patches/patch-src_osirismd_md_control_c +++ /dev/null @@ -1,16 +0,0 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- osiris-4.2.3.orig/src/osirismd/md_control.c 2006-12-05 13:02:48.000000000 +0100 -+++ osiris-4.2.3/src/osirismd/md_control.c 2009-05-10 21:28:06.000000000 +0200 -@@ -3259,9 +3259,9 @@ osi_bool generate_session_key_hash( unsi - int index; - char checksum[41]; - -- SHA_Init( &context ); -- SHA_Update( &context, key, (unsigned long)keysize ); -- SHA_Final( &( digest[0] ), &context ); -+ SHA1_Init( &context ); -+ SHA1_Update( &context, key, (unsigned long)keysize ); -+ SHA1_Final( &( digest[0] ), &context ); - - for ( index = 0; index < SHA_DIGEST_LENGTH; index++ ) - { diff --git a/package/pcre/Makefile b/package/pcre/Makefile index 12738c2cb..174315a81 100644 --- a/package/pcre/Makefile +++ b/package/pcre/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= pcre -PKG_VERSION:= 8.31 -PKG_RELEASE:= 2 -PKG_MD5SUM:= fab1bb3b91a4c35398263a5c1e0858c1 +PKG_VERSION:= 8.34 +PKG_RELEASE:= 1 +PKG_MD5SUM:= eb34b2c9c727fd64940d6fd9a00995eb PKG_DESCR:= a Perl Compatible Regular Expression library PKG_SECTION:= libs PKG_BUILDDEPS:= gettext-tiny @@ -22,11 +22,15 @@ ifeq ($(ADK_STATIC),y) PKG_OPTS+= libmix endif +include ${TOPDIR}/mk/host.mk include ${TOPDIR}/mk/package.mk +$(eval $(call HOST_template,PCRE,pcre,${PKG_VERSION}-${PKG_RELEASE})) $(eval $(call PKG_template,LIBPCRE,libpcre,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) $(eval $(call PKG_template,LIBPCRECPP,libpcrecpp,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBPCRECPP},${PKG_SECTION})) +HOST_STYLE:= auto +CONFIGURE_ARGS+= --enable-utf XAKE_FLAGS+= ${TARGET_CONFIGURE_OPTS} libpcre-install: @@ -37,4 +41,5 @@ libpcrecpp-install: ${INSTALL_DIR} ${IDIR_LIBPCRECPP}/usr/lib ${CP} ${WRKINST}/usr/lib/libpcrecpp.so* ${IDIR_LIBPCRECPP}/usr/lib +include ${TOPDIR}/mk/host-bottom.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/php/Makefile b/package/php/Makefile index 0972517d5..b5cb01aac 100644 --- a/package/php/Makefile +++ b/package/php/Makefile @@ -4,9 +4,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:= php -PKG_VERSION:= 5.5.10 +PKG_VERSION:= 5.5.11 PKG_RELEASE:= 1 -PKG_MD5SUM:= e760656f7cf2f05158f73da75e8b720b +PKG_MD5SUM:= 9156fcd4b254cbfa9a7535f931da29d5 PKG_DESCR:= PHP language interpreter PKG_SECTION:= lang PKG_DEPENDS:= libpthread librt libgcc diff --git a/package/pixman/Makefile b/package/pixman/Makefile index 5cb1821d9..6d5cd5aec 100644 --- a/package/pixman/Makefile +++ b/package/pixman/Makefile @@ -4,10 +4,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:= pixman -PKG_VERSION:= 0.30.0 -PKG_RELEASE:= 2 -PKG_MD5SUM:= ae7ac97921dfa59086ca2231621a79c7 -PKG_DESCR:= Pixel manipulation library +PKG_VERSION:= 0.32.4 +PKG_RELEASE:= 1 +PKG_MD5SUM:= eba449138b972fbf4547a8c152fea162 +PKG_DESCR:= pixel manipulation library PKG_SECTION:= x11/libs PKG_BUILDDEP:= libpng PKG_SITES:= http://www.cairographics.org/releases/ diff --git a/package/pixman/patches/patch-Makefile_in b/package/pixman/patches/patch-Makefile_in new file mode 100644 index 000000000..cebc19113 --- /dev/null +++ b/package/pixman/patches/patch-Makefile_in @@ -0,0 +1,11 @@ +--- pixman-0.32.4.orig/Makefile.in 2013-11-18 03:11:20.000000000 +0100 ++++ pixman-0.32.4/Makefile.in 2014-03-30 21:54:18.000000000 +0200 +@@ -369,7 +369,7 @@ target_alias = @target_alias@ + top_build_prefix = @top_build_prefix@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ +-SUBDIRS = pixman demos test ++SUBDIRS = pixman + pkgconfigdir = $(libdir)/pkgconfig + pkgconfig_DATA = pixman-1.pc + GPGKEY = 3892336E diff --git a/package/pkgconf/Makefile b/package/pkgconf/Makefile index b1131003a..8dbc5e32a 100644 --- a/package/pkgconf/Makefile +++ b/package/pkgconf/Makefile @@ -4,16 +4,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:= pkgconf -PKG_VERSION:= 0.9.3 +PKG_VERSION:= 0.9.5 PKG_RELEASE:= 1 -PKG_MD5SUM:= 52c553bad686f8be1556b58bc1925f4f +PKG_MD5SUM:= babb4e02f0fb8f4044ee95ad2241a676 PKG_DESCR:= smart pkg-config replacement PKG_SECTION:= lang PKG_URL:= https://github.com/pkgconf/pkgconf PKG_SITES:= http://rabbit.dereferenced.org/~nenolod/distfiles/ -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 - include $(TOPDIR)/mk/host.mk include $(TOPDIR)/mk/package.mk @@ -24,6 +22,7 @@ HOST_STYLE:= auto hostpost-install: (cd $(STAGING_HOST_DIR)/usr/bin && ln -sf pkgconf pkg-config) + (cd $(STAGING_HOST_DIR)/usr/bin && ln -sf pkgconf $(GNU_TARGET_NAME)-pkg-config) pkgconf-install: $(INSTALL_DIR) $(IDIR_PKGCONF)/usr/bin diff --git a/package/postfix/Makefile b/package/postfix/Makefile index e95cc4c9c..c68d69e91 100644 --- a/package/postfix/Makefile +++ b/package/postfix/Makefile @@ -4,9 +4,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:= postfix -PKG_VERSION:= 2.10.2 +PKG_VERSION:= 2.11.0 PKG_RELEASE:= 1 -PKG_MD5SUM:= 109e753aecafe487207b425dd46e6ee9 +PKG_MD5SUM:= 25fe7dd05f81cc0755131beecee046fd PKG_DESCR:= Postfix MTA PKG_SECTION:= mail PKG_BUILDDEP:= tinycdb diff --git a/package/postfix/patches/patch-makedefs b/package/postfix/patches/patch-makedefs index d39cec8a9..e4052d8dd 100644 --- a/package/postfix/patches/patch-makedefs +++ b/package/postfix/patches/patch-makedefs @@ -1,6 +1,6 @@ ---- postfix-2.10.2.orig/makedefs 2013-02-04 02:33:13.000000000 +0100 -+++ postfix-2.10.2/makedefs 2013-10-10 16:28:03.000000000 +0200 -@@ -366,16 +366,7 @@ EOF +--- postfix-2.11.0.orig/makedefs 2014-01-05 18:18:56.000000000 +0100 ++++ postfix-2.11.0/makedefs 2014-03-25 08:55:06.000000000 +0100 +@@ -382,16 +382,7 @@ EOF SYSLIBS="-ldb" ;; esac @@ -17,4 +17,4 @@ + SYSLIBS="-lresolv" ;; GNU.0*|GNU/kFreeBSD.[567]*) - SYSTYPE=GNU0 + SYSTYPE=GNU0 diff --git a/package/postfix/patches/patch-src_posttls-finger_posttls-finger_c b/package/postfix/patches/patch-src_posttls-finger_posttls-finger_c new file mode 100644 index 000000000..6f0e74fab --- /dev/null +++ b/package/postfix/patches/patch-src_posttls-finger_posttls-finger_c @@ -0,0 +1,10 @@ +--- postfix-2.11.0.orig/src/posttls-finger/posttls-finger.c 2013-12-16 17:06:33.000000000 +0100 ++++ postfix-2.11.0/src/posttls-finger/posttls-finger.c 2014-03-25 08:58:04.000000000 +0100 +@@ -290,6 +290,7 @@ + */ + #include <sys_defs.h> + #include <stdarg.h> ++#include <stdio.h> + #include <string.h> + #include <ctype.h> + #include <stdlib.h> diff --git a/package/postfix/patches/patch-src_util_sys_defs_h b/package/postfix/patches/patch-src_util_sys_defs_h index ecc7fc219..85974664e 100644 --- a/package/postfix/patches/patch-src_util_sys_defs_h +++ b/package/postfix/patches/patch-src_util_sys_defs_h @@ -1,13 +1,21 @@ ---- postfix-2.10.2.orig/src/util/sys_defs.h 2012-09-25 01:53:56.000000000 +0200 -+++ postfix-2.10.2/src/util/sys_defs.h 2013-10-10 16:30:37.000000000 +0200 -@@ -753,8 +753,8 @@ extern int initgroups(const char *, int) - #define DEF_MAILBOX_LOCK "fcntl, dotlock" /* RedHat >= 4.x */ +--- postfix-2.11.0.orig/src/util/sys_defs.h 2013-09-29 22:51:55.000000000 +0200 ++++ postfix-2.11.0/src/util/sys_defs.h 2014-03-26 19:38:02.000000000 +0100 +@@ -46,7 +46,7 @@ #define HAS_FSYNC #define HAS_DB --#define DEF_DB_TYPE "hash" --#define ALIAS_DB_MAP "hash:/etc/aliases" + #define HAS_SA_LEN +-#define NATIVE_DB_TYPE "hash" ++#define NATIVE_DB_TYPE "cdb" + #if (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 104250000) + #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/mail/aliases" /* sendmail 8.10 */ + #endif +@@ -54,7 +54,8 @@ + #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/mail/aliases" /* OpenBSD 2.7 */ + #endif + #ifndef ALIAS_DB_MAP +-#define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/aliases" +#define DEF_DB_TYPE "cdb" -+#define ALIAS_DB_MAP "cdb:/etc/postfix/aliases" - #ifndef NO_NIS - #define HAS_NIS ++#define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/postfix/aliases" #endif + #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) + #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin" diff --git a/package/postgresql/Makefile b/package/postgresql/Makefile index 34e75aea7..e1a101a4f 100644 --- a/package/postgresql/Makefile +++ b/package/postgresql/Makefile @@ -4,14 +4,14 @@ include ${TOPDIR}/rules.mk PKG_NAME:= postgresql -PKG_VERSION:= 9.1.1 -PKG_RELEASE:= 2 -PKG_MD5SUM:= 93b293bd735bb99258c1bad7bc9b8f6c +PKG_VERSION:= 9.3.4 +PKG_RELEASE:= 1 +PKG_MD5SUM:= d9be740a612f8a0b9ea61dd524abfa4c PKG_DESCR:= PostgreSQL database library PKG_SECTION:= db PKG_BUILDDEP:= zlib PKG_URL:= http://www.postgresql.org/ -PKG_SITES:= http://ftp.postgresql.org/pub/source/v9.1.1/ +PKG_SITES:= http://ftp.postgresql.org/pub/source/v9.3.4/ PKG_LIBNAME:= libpq PKG_OPTS:= dev diff --git a/package/python2/Makefile b/package/python2/Makefile index fe284da9d..b5aac2032 100644 --- a/package/python2/Makefile +++ b/package/python2/Makefile @@ -5,11 +5,12 @@ include ${TOPDIR}/rules.mk PKG_NAME:= python2 PKG_VERSION:= 2.7.5 -PKG_RELEASE:= 11 +PKG_RELEASE:= 12 PKG_MD5SUM:= b4f01a1d0ba0b46b05c73b2ac909b1df PKG_DESCR:= Python scripting language (Version 2) PKG_SECTION:= lang -PKG_BUILDDEP:= autotool libffi bzip2-host python2-host +PKG_BUILDDEP:= libffi python2-host +HOST_BUILDDEP:= libffi-host bzip2-host autotool PKG_DEPENDS:= libpthread libffi libgcc PKG_URL:= http://www.python.org/ PKG_SITES:= http://www.python.org/ftp/python/${PKG_VERSION}/ @@ -96,18 +97,20 @@ CONFIGURE_ARGS:= --with-threads \ --without-cxx-main HOST_STYLE:= auto -HOST_CONFIGURE_ARGS:= --with-threads \ +HOST_CONFIGURE_ARGS+= --with-threads \ --disable-ipv6 \ --disable-shared \ --disable-toolbox-glue \ --without-cxx-main CFLAGS_FOR_BUILD+= -fPIC -post-extract: +hostpre-configure: $(CP) $(TOPDIR)/package/python2/files/patch-Lib_distutils_sysconfig_py $(WRKBUILD) $(SED) "s#@@STAGING_TARGET_DIR@@#$(STAGING_TARGET_DIR)#" $(WRKBUILD)/patch-Lib_distutils_sysconfig_py $(SED) "s#@@STAGING_HOST_DIR@@#$(STAGING_HOST_DIR)#" $(WRKBUILD)/patch-Lib_distutils_sysconfig_py - (cd $(WRKBUILD) && patch -p0 <$(WRKBUILD)/patch-Lib_distutils_sysconfig_py) + (cd $(WRKBUILD) && patch -p0 < patch-Lib_distutils_sysconfig_py) + $(SED) "s#@EXENAME@#$(STAGING_HOST_DIR)/usr/bin/python#" \ + $(WRKBUILD)/Misc/python-config.in hostpost-install: $(INSTALL_BIN) ${WRKBUILD}/Parser/pgen \ @@ -119,6 +122,10 @@ hostpost-install: patch -p0 < $(WRKBUILD)/python-config.patch) pre-configure: + $(CP) $(TOPDIR)/package/python2/files/patch-Lib_distutils_sysconfig_py $(WRKBUILD) + $(SED) "s#@@STAGING_TARGET_DIR@@#$(STAGING_TARGET_DIR)#" $(WRKBUILD)/patch-Lib_distutils_sysconfig_py + $(SED) "s#@@STAGING_HOST_DIR@@#$(STAGING_HOST_DIR)#" $(WRKBUILD)/patch-Lib_distutils_sysconfig_py + (cd $(WRKBUILD) && patch -p0 <$(WRKBUILD)/patch-Lib_distutils_sysconfig_py) $(SED) "s#@EXENAME@#$(STAGING_HOST_DIR)/usr/bin/python#" \ $(WRKBUILD)/Misc/python-config.in diff --git a/package/python3/Makefile b/package/python3/Makefile index 3d7158443..e939a9155 100644 --- a/package/python3/Makefile +++ b/package/python3/Makefile @@ -4,15 +4,16 @@ include ${TOPDIR}/rules.mk PKG_NAME:= python3 -PKG_VERSION:= 3.3.2 -PKG_RELEASE:= 3 -PKG_MD5SUM:= 0a2ea57f6184baf45b150aee53c0c8da +PKG_VERSION:= 3.4.0 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 77c22725e14af3d71022cbfdebff4903 PKG_DESCR:= Python scripting language (Version 3) PKG_SECTION:= lang PKG_DEPENDS:= libpthread libgcc libffi PKG_BUILDDEP:= python3-host libffi +HOST_BUILDDEP:= libffi-host PKG_URL:= http://www.python.org/ -PKG_SITES:= http://www.python.org/ftp/python/${PKG_VERSION}/ +PKG_SITES:= http://legacy.python.org/ftp/python/${PKG_VERSION}/ PKG_HOST_DEPENDS:= !netbsd !openbsd !cygwin @@ -44,7 +45,7 @@ PKGFD_MOD_SSL:= OpenSSL support PKGFB_MOD_SSL:= openssl PKGFS_MOD_SSL:= libopenssl -DISTFILES= Python-${PKG_VERSION}.tgz +DISTFILES= Python-${PKG_VERSION}.tar.xz WRKDIST= ${WRKDIR}/Python-${PKG_VERSION} include ${TOPDIR}/mk/host.mk @@ -55,9 +56,9 @@ define PKG_mod_template INSTALL_MODS_$${ADK_PACKAGE_${1}}+= ${2}-install ${2}-install: - ${INSTALL_DIR} $$(IDIR_$(1))/usr/lib/python3.3/lib-dynload + ${INSTALL_DIR} $$(IDIR_$(1))/usr/lib/python3.4/lib-dynload for m in ${2}; do \ - ${INSTALL_DATA} $(WRKINST)/usr/lib/python3.3/lib-dynload/$$$${m}*.so $$(IDIR_$(1))/usr/lib/python3.3/lib-dynload ;\ + ${INSTALL_DATA} $(WRKINST)/usr/lib/python3.4/lib-dynload/$$$${m}*.so $$(IDIR_$(1))/usr/lib/python3.4/lib-dynload ;\ done endef @@ -84,6 +85,7 @@ $(eval $(call PKG_mod_template,PYTHON3_MOD_SSL,_ssl)) $(eval $(call PKG_mod_template,PYTHON3_MOD_READLINE,readline)) MAKE_ENV+= HOSTPGEN=$(STAGING_HOST_DIR)/usr/bin/pgen3 +FAKE_FLAGS+= ENSUREPIP=no CONFIGURE_ARGS:= --with-threads \ --with-system-ffi \ --with-system-expat \ @@ -97,21 +99,21 @@ HOST_STYLE:= auto HOST_CONFIGURE_ARGS+= --without-cxx-main \ --with-threads -hostpost-install: - $(INSTALL_BIN) ${WRKBUILD}/Parser/pgen \ - $(STAGING_HOST_DIR)/usr/bin/pgen3 +#hostpost-install: +# $(INSTALL_BIN) ${WRKBUILD}/Parser/pgen \ +# $(STAGING_HOST_DIR)/usr/bin/pgen3 python3-install: ${INSTALL_MODS_y} ${INSTALL_MODS_m} ${INSTALL_DIR} ${IDIR_PYTHON3}/usr/bin ${IDIR_PYTHON3}/usr/lib - ${INSTALL_DIR} ${IDIR_PYTHON3}/usr/lib/python3.3 - ${INSTALL_DIR} ${IDIR_PYTHON3}/usr/include/python3.3m + ${INSTALL_DIR} ${IDIR_PYTHON3}/usr/lib/python3.4 + ${INSTALL_DIR} ${IDIR_PYTHON3}/usr/include/python3.4m ${INSTALL_BIN} ${WRKINST}/usr/bin/python3 ${IDIR_PYTHON3}/usr/bin ${CP} ${WRKINST}/usr/lib/libpython*.so* ${IDIR_PYTHON3}/usr/lib - ${CP} ${WRKINST}/usr/lib/python3.3/* ${IDIR_PYTHON3}/usr/lib/python3.3 - ${CP} ${WRKINST}/usr/include/python3.3m/pyconfig.h \ - ${IDIR_PYTHON3}/usr/include/python3.3m + ${CP} ${WRKINST}/usr/lib/python3.4/* ${IDIR_PYTHON3}/usr/lib/python3.4 + ${CP} ${WRKINST}/usr/include/python3.4m/pyconfig.h \ + ${IDIR_PYTHON3}/usr/include/python3.4m @-for i in zlib _bz2 _curses _ssl _gdbm _sqlite pyexpat readline; do \ - rm ${IDIR_PYTHON3}/usr/lib/python3.3/lib-dynload/$${i}*so; \ + rm ${IDIR_PYTHON3}/usr/lib/python3.4/lib-dynload/$${i}*so; \ done include ${TOPDIR}/mk/host-bottom.mk diff --git a/package/python3/patches/patch-Makefile_pre_in b/package/python3/patches/patch-Makefile_pre_in deleted file mode 100644 index 5a4077eba..000000000 --- a/package/python3/patches/patch-Makefile_pre_in +++ /dev/null @@ -1,70 +0,0 @@ ---- Python-3.3.2.orig/Makefile.pre.in 2013-05-15 18:32:57.000000000 +0200 -+++ Python-3.3.2/Makefile.pre.in 2013-10-29 07:56:46.000000000 +0100 -@@ -70,9 +70,9 @@ MAKESETUP= $(srcdir)/Modules/makese - OPT= @OPT@ - BASECFLAGS= @BASECFLAGS@ - BASECPPFLAGS= @BASECPPFLAGS@ --CONFIGURE_CFLAGS= @CFLAGS@ --CONFIGURE_CPPFLAGS= @CPPFLAGS@ --CONFIGURE_LDFLAGS= @LDFLAGS@ -+CONFIGURE_CFLAGS= -+CONFIGURE_CPPFLAGS= -+CONFIGURE_LDFLAGS= - # Avoid assigning CFLAGS, LDFLAGS, etc. so users can use them on the - # command line to append to these values without stomping the pre-set - # values. -@@ -249,6 +249,7 @@ LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@ - ########################################################################## - # Parser - PGEN= Parser/pgen$(EXE) -+HOSTPGEN?= ./Parser/pgen$(EXE) - - PSRCS= \ - Parser/acceler.c \ -@@ -493,7 +494,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.tx - *) quiet="";; \ - esac; \ - $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ -- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build -+ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py build - - # Build static library - # avoid long command lines, same as LIBRARY_OBJS -@@ -669,7 +670,7 @@ $(IO_OBJS): $(IO_H) - $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS) - @$(MKDIR_P) Include - $(MAKE) $(PGEN) -- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) -+ $(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) - $(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS) - $(MAKE) $(GRAMMAR_H) - touch $(GRAMMAR_C) -@@ -1112,28 +1113,6 @@ libinstall: build_all $(srcdir)/Lib/$(PL - $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ - $(DESTDIR)$(LIBDEST)/distutils/tests ; \ - fi -- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ -- -d $(LIBDEST) -f \ -- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ -- $(DESTDIR)$(LIBDEST) -- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \ -- -d $(LIBDEST) -f \ -- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ -- $(DESTDIR)$(LIBDEST) -- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ -- -d $(LIBDEST)/site-packages -f \ -- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages -- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \ -- -d $(LIBDEST)/site-packages -f \ -- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages -- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt -- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt - - # Create the PLATDIR source directory, if one wasn't distributed.. - $(srcdir)/Lib/$(PLATDIR): diff --git a/package/python3/patches/patch-Modules_posixmodule_c b/package/python3/patches/patch-Modules_posixmodule_c deleted file mode 100644 index 537958513..000000000 --- a/package/python3/patches/patch-Modules_posixmodule_c +++ /dev/null @@ -1,20 +0,0 @@ ---- Python-3.3.2.orig/Modules/posixmodule.c 2013-05-15 18:32:59.000000000 +0200 -+++ Python-3.3.2/Modules/posixmodule.c 2014-01-06 18:59:54.000000000 +0100 -@@ -7679,7 +7679,7 @@ PyDoc_STRVAR(posix_close__doc__, - Close a file descriptor (for low level IO)."); - - static PyObject * --posix_close(PyObject *self, PyObject *args) -+posix_pyclose(PyObject *self, PyObject *args) - { - int fd, res; - if (!PyArg_ParseTuple(args, "i:close", &fd)) -@@ -11082,7 +11082,7 @@ static PyMethodDef posix_methods[] = { - {"open", (PyCFunction)posix_open,\ - METH_VARARGS | METH_KEYWORDS, - posix_open__doc__}, -- {"close", posix_close, METH_VARARGS, posix_close__doc__}, -+ {"close", posix_pyclose, METH_VARARGS, posix_close__doc__}, - {"closerange", posix_closerange, METH_VARARGS, posix_closerange__doc__}, - {"device_encoding", device_encoding, METH_VARARGS, device_encoding__doc__}, - {"dup", posix_dup, METH_VARARGS, posix_dup__doc__}, diff --git a/package/qemu/Makefile b/package/qemu/Makefile index 4c2067ac9..b4c20b14e 100644 --- a/package/qemu/Makefile +++ b/package/qemu/Makefile @@ -4,13 +4,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:= qemu -PKG_VERSION:= 1.7.0 -PKG_RELEASE:= 1 -PKG_MD5SUM:= 32893941d40d052a5e649efcf06aca06 +PKG_VERSION:= 1.7.1 +PKG_RELEASE:= 2 +PKG_MD5SUM:= 9541063d999cf9659ed7fdce71314f31 PKG_DESCR:= cpu and system emulator PKG_SECTION:= misc -PKG_DEPENDS:= zlib libsdl libpng -PKG_BUILDDEP:= gettext-tiny libiconv-tiny glib-host qemu-host zlib sdl libpng +PKG_DEPENDS:= zlib glib +PKG_BUILDDEP:= gettext-tiny libiconv-tiny +PKG_BUILDDEP+= zlib glib +HOST_BUILDDEP:= glib-host PKG_URL:= http://wwww.qemu.org/ PKG_SITES:= http://wiki.qemu.org/download/ @@ -24,18 +26,23 @@ include $(TOPDIR)/mk/package.mk $(eval $(call HOST_template,QEMU,qemu,$(PKG_VERSION)-${PKG_RELEASE})) $(eval $(call PKG_template,QEMU,qemu,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) -TARGET_LDFLAGS+= -pthread -lm -lrt +ifeq ($(ADK_TARGET_LIB_MUSL),y) +TARGET_CFLAGS+= -DF_EXLCK=4 -DF_SHLCK=8 -D__SIGRTMIN=32 -D__SIGRTMAX=\(NSIG-1\) +endif CONFIG_STYLE:= minimal CONFIGURE_ARGS+= --host-cc=$(CC_FOR_BUILD) \ + --cross-prefix=$(GNU_TARGET_NAME)- \ --prefix=/usr \ --sysconfdir=/etc \ --enable-kvm \ --disable-docs \ + --disable-sdl \ --bindir=/usr/bin +CFLAGS_FOR_BUILD+= -DNATIVE HOST_STYLE:= manual HOST_CONFIGURE_ARGS+= --host-cc=$(CC_FOR_BUILD) \ + --prefix=${STAGING_HOST_DIR}/usr \ --disable-docs \ --disable-werror \ --disable-system \ @@ -43,17 +50,17 @@ HOST_CONFIGURE_ARGS+= --host-cc=$(CC_FOR_BUILD) \ host-configure: cd ${WRKBUILD}; rm -f config.{cache,status}; \ - env ${HOST_CONFIGURE_ENV} \ - ${BASH} ${WRKSRC}/${CONFIGURE_PROG} \ - ${HOST_CONFIGURE_ARGS} $(MAKE_TRACE) + env ${HOST_CONFIGURE_ENV} \ + ${BASH} ${WRKSRC}/${CONFIGURE_PROG} \ + ${HOST_CONFIGURE_ARGS} $(MAKE_TRACE) host-build: cd ${WRKBUILD} && env ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \ - ${HOST_MAKE_FLAGS} ${HOST_ALL_TARGET} $(MAKE_TRACE) - + ${HOST_MAKE_FLAGS} ${HOST_ALL_TARGET} $(MAKE_TRACE) + qemu-hostinstall: cd ${WRKBUILD} && env ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \ - DESTDIR='$(STAGING_HOST_DIR)' ${HOST_FAKE_FLAGS} ${HOST_INSTALL_TARGET} $(MAKE_TRACE) + ${HOST_FAKE_FLAGS} ${HOST_INSTALL_TARGET} $(MAKE_TRACE) qemu-install: $(INSTALL_DIR) $(IDIR_QEMU)/usr/share/qemu diff --git a/package/qemu/patches/patch-linux-user_syscall_c b/package/qemu/patches/patch-linux-user_syscall_c index 1eba70417..11188ca90 100644 --- a/package/qemu/patches/patch-linux-user_syscall_c +++ b/package/qemu/patches/patch-linux-user_syscall_c @@ -1,22 +1,35 @@ ---- qemu-1.7.0.orig/linux-user/syscall.c 2013-11-27 23:15:55.000000000 +0100 -+++ qemu-1.7.0/linux-user/syscall.c 2014-01-31 09:51:34.051058876 +0100 -@@ -64,6 +64,7 @@ int __clone2(int (*fn)(void *), void *ch +--- qemu-1.7.1.orig/linux-user/syscall.c 2014-03-25 15:01:10.000000000 +0100 ++++ qemu-1.7.1/linux-user/syscall.c 2014-04-04 16:51:08.292546548 +0200 +@@ -63,6 +63,7 @@ int __clone2(int (*fn)(void *), void *ch + //#include <sys/user.h> #include <netinet/ip.h> #include <netinet/tcp.h> - #include <linux/wireless.h> +#include <linux/version.h> + #include <linux/wireless.h> #include <linux/icmp.h> #include "qemu-common.h" - #ifdef TARGET_GPROF -@@ -94,7 +95,11 @@ int __clone2(int (*fn)(void *), void *ch +@@ -94,7 +95,15 @@ int __clone2(int (*fn)(void *), void *ch #include <linux/utsname.h> #include <linux/cdrom.h> #include <linux/hdreg.h> ++#ifdef NATIVE +#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,11,0) #include <linux/soundcard.h> +#else +#include <linux/soundcard.h.oss3> +#endif ++#else ++#include <linux/soundcard.h> ++#endif #include <linux/kd.h> #include <linux/mtio.h> #include <linux/fs.h> +@@ -400,7 +409,7 @@ static int sys_inotify_init1(int flags) + #endif + #define __NR_sys_ppoll __NR_ppoll + _syscall5(int, sys_ppoll, struct pollfd *, fds, nfds_t, nfds, +- struct timespec *, timeout, const __sigset_t *, sigmask, ++ struct timespec *, timeout, const sigset_t *, sigmask, + size_t, sigsetsize) + #endif + diff --git a/package/qemu/patches/patch-util_qemu-openpty_c b/package/qemu/patches/patch-util_qemu-openpty_c new file mode 100644 index 000000000..ed524628a --- /dev/null +++ b/package/qemu/patches/patch-util_qemu-openpty_c @@ -0,0 +1,11 @@ +--- qemu-1.7.0.orig/util/qemu-openpty.c 2013-11-27 23:15:55.000000000 +0100 ++++ qemu-1.7.0/util/qemu-openpty.c 2014-03-14 09:05:17.280258135 +0100 +@@ -35,7 +35,7 @@ + #include "config-host.h" + #include "qemu-common.h" + +-#if defined(__GLIBC__) ++#if defined(__linux__) + # include <pty.h> + #elif defined CONFIG_BSD + # include <termios.h> diff --git a/package/radvd/Makefile b/package/radvd/Makefile index 1dd5b6ccf..dc927a628 100644 --- a/package/radvd/Makefile +++ b/package/radvd/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= radvd -PKG_VERSION:= 1.9.7 +PKG_VERSION:= 1.10.0 PKG_RELEASE:= 1 -PKG_MD5SUM:= 85141c7dc7d35e5499e16052742f1040 +PKG_MD5SUM:= 5ef15bc6c8316dba02147065f8dfdad3 PKG_DESCR:= Routing Advertisement Daemon for IPv6 PKG_SECTION:= ipv6 PKG_DEPENDS:= kmod-ipv6 libdaemon diff --git a/package/rdate/Makefile b/package/rdate/Makefile index a37cbdfbc..30848af15 100644 --- a/package/rdate/Makefile +++ b/package/rdate/Makefile @@ -7,7 +7,7 @@ PKG_NAME:= rdate PKG_VERSION:= 20070817 PKG_RELEASE:= 4 PKG_MD5SUM:= 9a6489d7de4311678a3fab001bb503df -PKG_DESCR:= A small rdate and NTP client +PKG_DESCR:= small rdate and NTP client PKG_SECTION:= ntp PKG_SITES:= ${MASTER_SITE_MIRBSD:distfiles/=dist/mir/rdate/} diff --git a/package/rng-tools/Makefile b/package/rng-tools/Makefile index 26ad29821..0daf65bf7 100644 --- a/package/rng-tools/Makefile +++ b/package/rng-tools/Makefile @@ -4,15 +4,16 @@ include $(TOPDIR)/rules.mk PKG_NAME:= rng-tools -PKG_VERSION:= 2 -PKG_RELEASE:= 2 -PKG_MD5SUM:= 63d503191eabed630324c104cc024475 -PKG_DESCR:= Daemon to use hardware random number generators. +PKG_VERSION:= 4 +PKG_RELEASE:= 1 +PKG_MD5SUM:= ae89dbfcf08bdfbea19066cfbf599127 +PKG_DESCR:= daemon to use hardware random number generators. PKG_SECTION:= crypto PKG_URL:= http://gkernel.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=gkernel/} -PKG_LIBC_DEPENDS:= glibc musl +# argp.h required +PKG_LIBC_DEPENDS:= glibc include $(TOPDIR)/mk/package.mk diff --git a/package/rrdcollect/Makefile b/package/rrdcollect/Makefile index c437d5399..39a4d3b2a 100644 --- a/package/rrdcollect/Makefile +++ b/package/rrdcollect/Makefile @@ -4,15 +4,17 @@ include ${TOPDIR}/rules.mk PKG_NAME:= rrdcollect -PKG_VERSION:= 0.2.9 +PKG_VERSION:= 0.2.10 PKG_RELEASE:= 1 -PKG_MD5SUM:= 1e94eb0f8d55ebf0f042c10baebc2d3d +PKG_MD5SUM:= 138e21fc9f2de0b8b6c89f1506394ef8 PKG_DESCR:= Round-Robin Database (RRD) collecting daemon PKG_SECTION:= admin PKG_DEPENDS:= librrd PKG_BUILDDEP:= rrdtool PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=rrdcollect/} +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 + ifneq (${ADK_PACKAGE_LIBRRD},) RRDTOOL_LIBS:= -lart_lgpl_2 -lfreetype -lpng endif @@ -25,8 +27,8 @@ CONFIGURE_ENV+= LIBS="${RRDTOOL_LIBS} -lz" \ ac_cv_func_malloc_0_nonnull=yes CONFIGURE_ARGS+= --enable-exec \ --without-rrdtool \ - --with-librrd \ - --without-libpcre + --without-libpcre \ + --with-librrd TARGET_CPPFLAGS+= -DSOCKET_COMM rrdcollect-install: diff --git a/package/samba/Makefile b/package/samba/Makefile index 34cbeec8a..433aba3cd 100644 --- a/package/samba/Makefile +++ b/package/samba/Makefile @@ -20,6 +20,14 @@ PKGSS_SAMBA_CLIENT:= libreadline samba-lib PKGSD_SAMBA_PASSWD:= SMB password utility PKGSD_SAMBA_LIB:= SMB libraries +PKG_FLAVOURS_SAMBA:= WITH_WINBIND WITH_LDAP +PKGFD_WITH_WINBIND:= enable winbind support +PKGFS_WITH_WINBIND:= libkrb5 +PKGFB_WITH_WINBIND:= krb5 +PKGFD_WITH_LDAP:= enable LDAP support +PKGFS_WITH_LDAP:= libopenldap +PKGFB_WITH_LDAP:= openldap + WRKSRC= ${WRKDIST}/source3 include ${TOPDIR}/mk/package.mk @@ -29,9 +37,25 @@ $(eval $(call PKG_template,SAMBA_CLIENT,samba-client,${PKG_VERSION}-${PKG_RELEAS $(eval $(call PKG_template,SAMBA_PASSWD,samba-passwd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_SAMBA_PASSWD},${PKG_SECTION})) $(eval $(call PKG_template,SAMBA_LIB,samba-lib,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_SAMBA_LIB},${PKG_SECTION})) -#TARGET_LDFLAGS+= -Wl,-rpath -Wl,/usr/lib/samba +ifneq ($(ADK_PACKAGE_SAMBA_WITH_WINBIND),) +CONFIGURE_ARGS+= --with-winbind \ + --with-krb5="$(STAGING_TARGET_DIR)/usr" +else +CONFIGURE_ARGS+= --without-winbind +endif + +ifneq ($(ADK_PACKAGE_SAMBA_WITH_LDAP),) +CONFIGURE_ARGS+= --with-ldap +else +CONFIGURE_ARGS+= --with-ldap=no +endif + CONFIGURE_ENV+= samba_cv_CC_NEGATIVE_ENUM_VALUES=no \ samba_cv_USE_SETRESUID=no \ + samba_cv_HAVE_WRFILE_KEYTAB=yes \ + ac_cv_func_ext_krb5_enctype_to_string=yes \ + smb_krb5_cv_enctype_to_string_takes_krb5_context_arg=yes \ + smb_krb5_cv_enctype_to_string_takes_size_t_arg=no \ ac_cv_lib_ext_nsl_connect=no \ ac_cv_search_yp_get_default_domain=no \ ac_cv_lib_ext_nsl_gethostbyname=no \ @@ -44,12 +68,10 @@ CONFIGURE_ARGS+= --libdir=/usr/lib \ --with-privatedir=/etc/samba \ --with-libiconv=/dev/null \ --with-syslog \ - --without-winbind \ --disable-cups \ --disable-swat \ --disable-avahi \ --with-utmp=no \ - --with-ldap=no \ --without-cluster-support \ --without-sendfile-support diff --git a/package/scons/Makefile b/package/scons/Makefile index d379eb8a4..5f2e3b7c3 100644 --- a/package/scons/Makefile +++ b/package/scons/Makefile @@ -5,11 +5,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:= scons PKG_VERSION:= 2.3.0 -PKG_RELEASE:= 1 +PKG_RELEASE:= 2 PKG_MD5SUM:= 083ce5624d6adcbdaf2526623f456ca9 PKG_DESCR:= a software construction tool PKG_SECTION:= lang -HOST_BUILDDEP:= bzip2-host python2-host +HOST_BUILDDEP:= python2-host PKG_URL:= http://www.scons.org PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=scons/} @@ -23,7 +23,8 @@ $(eval $(call HOST_template,SCONS,scons,$(PKG_VERSION)-${PKG_RELEASE})) HOST_STYLE:= manual scons-hostinstall: - (cd $(WRKBUILD); PATH='$(TARGET_PATH)' python setup.py install --prefix=$(STAGING_HOST_DIR)/) + (cd $(WRKBUILD); PATH='$(HOST_PATH)' python setup.py install \ + --prefix=$(STAGING_HOST_DIR)/usr) include ${TOPDIR}/mk/host-bottom.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/shat/Makefile b/package/shat/Makefile index a28087c75..3bc6fc9ff 100644 --- a/package/shat/Makefile +++ b/package/shat/Makefile @@ -7,10 +7,12 @@ PKG_NAME:= shat PKG_VERSION:= 0.9.7 PKG_RELEASE:= 1 PKG_MD5SUM:= da06846f35838b14d1513523dad84d24 -PKG_DESCR:= Source Hardware Address Translation - a tool for nomadic routing +PKG_DESCR:= a tool for nomadic routing PKG_SECTION:= net/misc PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=shat/} +PKG_LIBC_DEPENDS:= uclibc glibc + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,SHAT,shat,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/siproxd/Makefile b/package/siproxd/Makefile index 34c835f30..2ece50985 100644 --- a/package/siproxd/Makefile +++ b/package/siproxd/Makefile @@ -4,13 +4,13 @@ include ${TOPDIR}/rules.mk PKG_NAME:= siproxd -PKG_VERSION:= 0.7.1 +PKG_VERSION:= 0.8.1 PKG_RELEASE:= 1 -PKG_MD5SUM:= 45e5a44803181e2bf3361d562060c904 +PKG_MD5SUM:= 1a6f9d13aeb2d650375c9a346ac6cbaf PKG_DESCR:= a SIP (Session Initiation Protocol) proxy PKG_SECTION:= proxy PKG_DEPENDS:= libosip2 libpthread -PKG_BUILDDEP:= libosip2 +PKG_BUILDDEP:= autotool libosip2 PKG_URL:= http://siproxd.sourceforge.net PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=siproxd/} @@ -18,6 +18,8 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,SIPROXD,siproxd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +AUTOTOOL_STYLE:= autoreconf + siproxd-install: ${INSTALL_DIR} ${IDIR_SIPROXD}/usr/sbin ${IDIR_SIPROXD}/etc ${INSTALL_DATA} ${WRKINST}/etc/siproxd.conf.example \ diff --git a/package/siproxd/patches/patch-libltdl_ltmain_sh b/package/siproxd/patches/patch-libltdl_ltmain_sh deleted file mode 100644 index 84bfc305b..000000000 --- a/package/siproxd/patches/patch-libltdl_ltmain_sh +++ /dev/null @@ -1,11 +0,0 @@ ---- siproxd-0.7.1.orig/libltdl/ltmain.sh 2008-02-02 18:16:31.000000000 +0100 -+++ siproxd-0.7.1/libltdl/ltmain.sh 2011-01-17 12:14:25.000000000 +0100 -@@ -1298,7 +1298,7 @@ EOF - # but this is not reliable with gcc because gcc may use -mfoo to - # select a different linker, different libraries, etc, while - # -Wl,-mfoo simply passes -mfoo to the linker. -- -m*) -+ -m*|-fstack-protector*|-flto) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` diff --git a/package/siproxd/patches/patch-scripts_ltmain_sh b/package/siproxd/patches/patch-scripts_ltmain_sh deleted file mode 100644 index 79b49713d..000000000 --- a/package/siproxd/patches/patch-scripts_ltmain_sh +++ /dev/null @@ -1,11 +0,0 @@ ---- siproxd-0.7.1.orig/scripts/ltmain.sh 2008-01-27 17:35:27.000000000 +0100 -+++ siproxd-0.7.1/scripts/ltmain.sh 2011-01-17 12:17:22.000000000 +0100 -@@ -1301,7 +1301,7 @@ EOF - # but this is not reliable with gcc because gcc may use -mfoo to - # select a different linker, different libraries, etc, while - # -Wl,-mfoo simply passes -mfoo to the linker. -- -m*) -+ -m*|-fstack-protector*|-flto) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` diff --git a/package/siproxd/patches/patch-src_resolve_c b/package/siproxd/patches/patch-src_resolve_c new file mode 100644 index 000000000..aaa381969 --- /dev/null +++ b/package/siproxd/patches/patch-src_resolve_c @@ -0,0 +1,10 @@ +--- siproxd-0.8.1.orig/src/resolve.c 2011-05-28 17:47:15.000000000 +0200 ++++ siproxd-0.8.1/src/resolve.c 2014-03-26 18:37:07.000000000 +0100 +@@ -20,6 +20,7 @@ + + #include "config.h" + ++#include <sys/types.h> + #include <arpa/inet.h> + #include <netinet/in.h> + diff --git a/package/socat/Makefile b/package/socat/Makefile index 4969a6d85..9311ddbcb 100644 --- a/package/socat/Makefile +++ b/package/socat/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= socat -PKG_VERSION:= 1.7.2.3 +PKG_VERSION:= 1.7.2.4 PKG_RELEASE:= 1 -PKG_MD5SUM:= 6943f7a5e1ffd553ad2a900bbf05b83a +PKG_MD5SUM:= 2a15dc3362f49d543abdbacc267d0a41 PKG_DESCR:= A multipurpose relay (SOcket CAT) PKG_SECTION:= net/misc PKG_DEPENDS:= libpthread @@ -22,7 +22,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,SOCAT,socat,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -CONFIGURE_ENV+= sc_cv_termios_ispeed="no" \ +CONFIGURE_ENV+= sc_cv_termios_ispeed=no \ sc_cv_sys_crdly_shift=9 \ sc_cv_sys_tabdly_shift=11 \ sc_cv_sys_csize_shift=4 diff --git a/package/socat/patches/501-honor_ldflags.patch b/package/socat/patches/patch-Makefile_in index 87c777067..e8e979607 100644 --- a/package/socat/patches/501-honor_ldflags.patch +++ b/package/socat/patches/patch-Makefile_in @@ -1,6 +1,5 @@ -diff -ruN socat-1.4-old/Makefile.in socat-1.4-new/Makefile.in ---- socat-1.7.2.2.orig/Makefile.in 2011-12-06 08:45:03.000000000 +0100 -+++ socat-1.7.2.2/Makefile.in 2013-12-24 16:37:21.000000000 +0100 +--- socat-1.7.2.4.orig/Makefile.in 2014-03-09 15:48:44.000000000 +0100 ++++ socat-1.7.2.4/Makefile.in 2014-03-22 12:13:46.000000000 +0100 @@ -38,7 +38,8 @@ INSTALL = @INSTALL@ #0 CFLAGS = @CFLAGS@ $(CCOPTS) $(DEFS) $(INCLS) diff --git a/package/socat/patches/patch-configure b/package/socat/patches/patch-configure new file mode 100644 index 000000000..75b014290 --- /dev/null +++ b/package/socat/patches/patch-configure @@ -0,0 +1,23 @@ +--- socat-1.7.2.4.orig/configure 2014-03-09 20:57:51.000000000 +0100 ++++ socat-1.7.2.4/configure 2014-03-22 12:20:13.000000000 +0100 +@@ -3347,18 +3347,8 @@ fi + # fail + + +- +-if test "$CC" = "gcc"; then +- CFLAGS="$CFLAGS -D_GNU_SOURCE -Wall -Wno-parentheses" +- ERRONWARN="-Werror -O0" +-elif test "$CC" = "clang"; then +- CFLAGS="$CFLAGS -D_GNU_SOURCE -Wall -Wno-parentheses" +- ERRONWARN="-Werror -O0" +-#elif Sun Studio +-# ERRONWARN="-errwarn" +-else +- ERRONWARN= +-fi ++CFLAGS="$CFLAGS -D_GNU_SOURCE -Wall -Wno-parentheses" ++ERRONWARN="-Werror -O0" + export CFLAGS + + diff --git a/package/sox/Makefile b/package/sox/Makefile index 2f5436146..af30a9199 100644 --- a/package/sox/Makefile +++ b/package/sox/Makefile @@ -4,10 +4,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:= sox -PKG_VERSION:= 14.3.2 -PKG_RELEASE:= 1 -PKG_MD5SUM:= e9d35cf3b0f8878596e0b7c49f9e8302 -PKG_DESCR:= Swiss Army knife of sound processing programs +PKG_VERSION:= 14.4.1 +PKG_RELEASE:= 2 +PKG_MD5SUM:= 670307f40763490a2bc0d1f322071e7a +PKG_DESCR:= swiss army knife of sound processing programs PKG_SECTION:= multimedia PKG_BUILDDEP:= zlib libmad lame alsa-lib libid3tag PKG_DEPENDS:= zlib libmad liblame alsa-lib libid3tag diff --git a/package/sox/patches/patch-ltmain_sh b/package/sox/patches/patch-ltmain_sh deleted file mode 100644 index 722e3e762..000000000 --- a/package/sox/patches/patch-ltmain_sh +++ /dev/null @@ -1,11 +0,0 @@ ---- sox-14.3.2.orig/ltmain.sh 2011-01-04 06:04:29.000000000 +0100 -+++ sox-14.3.2/ltmain.sh 2011-03-06 00:04:37.000000000 +0100 -@@ -5091,7 +5091,7 @@ func_mode_link () - # @file GCC response files - # -tp=* Portland pgcc target processor selection - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -- -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*) -+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|-fstack-protector*|-flto*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - func_append compile_command " $arg" diff --git a/package/sox/patches/patch-src_formats_c b/package/sox/patches/patch-src_formats_c index fc298ba8e..8ad23c63b 100644 --- a/package/sox/patches/patch-src_formats_c +++ b/package/sox/patches/patch-src_formats_c @@ -1,20 +1,20 @@ ---- sox-14.3.1.orig/src/formats.c 2010-01-02 01:07:28.000000000 +0100 -+++ sox-14.3.1/src/formats.c 2011-03-01 22:15:05.000000000 +0100 -@@ -399,7 +399,7 @@ static void UNUSED rewind_pipe(FILE * fp +--- sox-14.4.1.orig/src/formats.c 2013-01-13 20:57:39.000000000 +0100 ++++ sox-14.4.1/src/formats.c 2014-03-29 15:00:39.000000000 +0100 +@@ -409,7 +409,7 @@ static void UNUSED rewind_pipe(FILE * fp #if defined _FSTDIO || defined _NEWLIB_VERSION || defined __APPLE__ - fp->_p -= AUTO_DETECT_SIZE; - fp->_r += AUTO_DETECT_SIZE; + fp->_p -= PIPE_AUTO_DETECT_SIZE; + fp->_r += PIPE_AUTO_DETECT_SIZE; -#elif defined __GLIBC__ +#elif defined __GLIBC__ && ! defined __UCLIBC__ fp->_IO_read_ptr = fp->_IO_read_base; - #elif defined _MSC_VER || defined __MINGW_H || defined _ISO_STDIO_ISO_H + #elif defined _MSC_VER || defined _WIN32 || defined _WIN64 || defined _ISO_STDIO_ISO_H fp->_ptr = fp->_base; -@@ -407,7 +407,7 @@ static void UNUSED rewind_pipe(FILE * fp +@@ -417,7 +417,7 @@ static void UNUSED rewind_pipe(FILE * fp /* To fix this #error, either simply remove the #error line and live without * file-type detection with pipes, or add support for your compiler in the - * lines above. Test with cat monkey.au | ./sox --info - */ + * lines above. Test with cat monkey.wav | ./sox --info - */ - #error FIX NEEDED HERE -+/* #error FIX NEEDED HERE */ ++ //#error FIX NEEDED HERE #define NO_REWIND_PIPE (void)fp; #endif diff --git a/package/squashfs/Makefile b/package/squashfs/Makefile new file mode 100644 index 000000000..8478f6c57 --- /dev/null +++ b/package/squashfs/Makefile @@ -0,0 +1,38 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include $(TOPDIR)/rules.mk + +PKG_NAME:= squashfs +PKG_VERSION:= 4.2 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 1b7a781fb4cf8938842279bd3e8ee852 +PKG_DESCR:= squashfs filesystem utilities +HOST_BUILDDEP:= xz-host +PKG_SECTION:= fs +PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=squashfs/} + +DISTFILES:= ${PKG_NAME}${PKG_VERSION}.tar.gz +WRKDIST= ${WRKDIR}/$(PKG_NAME)${PKG_VERSION} + +PKG_CFLINE_SQUASHFS:= depends on ADK_HOST_ONLY + +include $(TOPDIR)/mk/host.mk +include $(TOPDIR)/mk/package.mk + +$(eval $(call HOST_template,SQUASHFS,squashfs,$(PKG_VERSION)-${PKG_RELEASE})) + +HOST_STYLE:= manual +HOST_MAKE_FLAGS+= XATTR_SUPPORT=0 XZ_SUPPORT=1 EXTRA_LDFLAGS=$(LDFLAGS_FOR_BUILD) + +host-build: + (cd ${WRKBUILD}/squashfs-tools && env ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \ + ${HOST_MAKE_FLAGS} ${HOST_ALL_TARGET}) + +squashfs-hostinstall: + ${INSTALL_DIR} ${STAGING_HOST_DIR}/usr/bin + ${INSTALL_BIN} ${WRKBUILD}/squashfs-tools/mksquashfs \ + ${STAGING_HOST_DIR}/usr/bin + +include ${TOPDIR}/mk/host-bottom.mk +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/squashfs/patches/patch-squashfs-tools_Makefile b/package/squashfs/patches/patch-squashfs-tools_Makefile new file mode 100644 index 000000000..cc764141f --- /dev/null +++ b/package/squashfs/patches/patch-squashfs-tools_Makefile @@ -0,0 +1,11 @@ +--- squashfs4.2.orig/squashfs-tools/Makefile 2011-02-28 21:04:15.000000000 +0100 ++++ squashfs4.2/squashfs-tools/Makefile 2014-03-29 15:02:11.000000000 +0100 +@@ -93,7 +93,7 @@ XATTR_DEFAULT = 1 + # End of BUILD options section # + ############################################### + +-INCLUDEDIR = -I. ++INCLUDEDIR = -I. $(CPPFLAGS_FOR_BUILD) + INSTALL_DIR = /usr/local/bin + + MKSQUASHFS_OBJS = mksquashfs.o read_fs.o sort.o swap.o pseudo.o compressor.o diff --git a/package/squashfs/patches/patch-squashfs-tools_mksquashfs_c b/package/squashfs/patches/patch-squashfs-tools_mksquashfs_c new file mode 100644 index 000000000..877894c6c --- /dev/null +++ b/package/squashfs/patches/patch-squashfs-tools_mksquashfs_c @@ -0,0 +1,47 @@ +--- squashfs4.2.orig/squashfs-tools/mksquashfs.c 2011-02-28 23:24:09.000000000 +0100 ++++ squashfs4.2/squashfs-tools/mksquashfs.c 2014-03-29 15:02:16.000000000 +0100 +@@ -60,6 +60,10 @@ + #include <sys/sysinfo.h> + #endif + ++#ifndef FNM_EXTMATCH ++#define FNM_EXTMATCH 0 ++#endif ++ + #ifdef SQUASHFS_TRACE + #define TRACE(s, args...) \ + do { \ +@@ -721,13 +725,13 @@ void cache_block_put(struct file_buffer + + (((char *)A) - data_cache))) + + +-inline void inc_progress_bar() ++static inline void inc_progress_bar() + { + cur_uncompressed ++; + } + + +-inline void update_progress_bar() ++static inline void update_progress_bar() + { + pthread_mutex_lock(&progress_mutex); + pthread_cond_signal(&progress_wait); +@@ -735,7 +739,7 @@ inline void update_progress_bar() + } + + +-inline void waitforthread(int i) ++static inline void waitforthread(int i) + { + TRACE("Waiting for thread %d\n", i); + while(thread[i] != 0) +@@ -3340,7 +3344,7 @@ struct inode_info *lookup_inode(struct s + } + + +-inline void add_dir_entry(char *name, char *pathname, struct dir_info *sub_dir, ++static inline void add_dir_entry(char *name, char *pathname, struct dir_info *sub_dir, + struct inode_info *inode_info, struct dir_info *dir) + { + if((dir->count % DIR_ENTRIES) == 0) { diff --git a/package/squashfs/patches/patch-squashfs-tools_unsquashfs_c b/package/squashfs/patches/patch-squashfs-tools_unsquashfs_c new file mode 100644 index 000000000..d57b184de --- /dev/null +++ b/package/squashfs/patches/patch-squashfs-tools_unsquashfs_c @@ -0,0 +1,39 @@ +--- squashfs4.2.orig/squashfs-tools/unsquashfs.c 2011-02-28 23:27:06.000000000 +0100 ++++ squashfs4.2/squashfs-tools/unsquashfs.c 2014-03-29 15:02:16.000000000 +0100 +@@ -29,7 +29,13 @@ + #include "compressor.h" + #include "xattr.h" + ++#ifndef FNM_EXTMATCH ++#define FNM_EXTMATCH 0 ++#endif ++ ++#ifdef __linux__ + #include <sys/sysinfo.h> ++#endif + #include <sys/types.h> + + struct cache *fragment_cache, *data_cache; +@@ -1810,7 +1816,7 @@ void initialise_threads(int fragment_buf + "\n"); + + if(processors == -1) { +-#ifndef linux ++#if 0 + int mib[2]; + size_t len = sizeof(processors); + +@@ -1821,11 +1827,13 @@ void initialise_threads(int fragment_buf + mib[1] = HW_NCPU; + #endif + ++#ifdef __linux__ + if(sysctl(mib, 2, &processors, &len, NULL, 0) == -1) { + ERROR("Failed to get number of available processors. " + "Defaulting to 1\n"); + processors = 1; + } ++#endif + #else + processors = sysconf(_SC_NPROCESSORS_ONLN); + #endif diff --git a/package/squid/Makefile b/package/squid/Makefile index f8e6aaf72..d3471bdce 100644 --- a/package/squid/Makefile +++ b/package/squid/Makefile @@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk PKG_NAME:= squid PKG_VERSION:= 3.4.4 -PKG_RELEASE:= 2 +PKG_RELEASE:= 3 PKG_MD5SUM:= b36ab3696485a86b43d9194ac9b6b7fe PKG_DESCR:= squid web and cache proxy PKG_SECTION:= proxy diff --git a/package/squid/patches/patch-lib_rfcnb_rfcnb-io_c b/package/squid/patches/patch-lib_rfcnb_rfcnb-io_c new file mode 100644 index 000000000..32faad55f --- /dev/null +++ b/package/squid/patches/patch-lib_rfcnb_rfcnb-io_c @@ -0,0 +1,11 @@ +--- squid-3.4.4.orig/lib/rfcnb/rfcnb-io.c 2014-03-09 10:40:56.000000000 +0100 ++++ squid-3.4.4/lib/rfcnb/rfcnb-io.c 2014-03-27 09:28:30.000000000 +0100 +@@ -30,7 +30,7 @@ + #include "rfcnb/rfcnb-util.h" + #include "rfcnb/std-includes.h" + #include <sys/uio.h> +-#include <sys/signal.h> ++#include <signal.h> + + #if HAVE_STRING_H + #include <string.h> diff --git a/package/sudo/Makefile b/package/sudo/Makefile index bc1ba138d..ea4bb908c 100644 --- a/package/sudo/Makefile +++ b/package/sudo/Makefile @@ -4,9 +4,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:= sudo -PKG_VERSION:= 1.7.4p4 +PKG_VERSION:= 1.8.10 PKG_RELEASE:= 2 -PKG_MD5SUM:= 55d9906535d70a1de347cd3d3550ee87 +PKG_MD5SUM:= 954d64906c3f6e2436f33445a049c58b PKG_DESCR:= su do PKG_SECTION:= admin PKG_URL:= http://www.courtesan.com/sudo/ @@ -16,9 +16,16 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,SUDO,sudo,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +CPPFLAGS_FOR_BUILD+= -I../ -I../include CONFIGURE_ARGS+= --without-pam \ - --with-env-editor \ - --with-timedir=/var/run + --without-sendmail \ + --with-env-editor + +ifeq ($(ADK_TOOLCHAIN_USE_SSP),y) +CONFIGURE_ARGS+= --enable-hardening +else +CONFIGURE_ARGS+= --disable-hardening +endif sudo-install: $(INSTALL_DIR) $(IDIR_SUDO)/usr/bin diff --git a/package/sudo/patches/patch-compat_Makefile_in b/package/sudo/patches/patch-compat_Makefile_in new file mode 100644 index 000000000..e52c8a62c --- /dev/null +++ b/package/sudo/patches/patch-compat_Makefile_in @@ -0,0 +1,15 @@ +--- sudo-1.8.10.orig/compat/Makefile.in 2014-03-07 22:51:19.000000000 +0100 ++++ sudo-1.8.10/compat/Makefile.in 2014-03-24 15:58:28.000000000 +0100 +@@ -96,10 +96,10 @@ signame.c: mksigname + ./mksigname > $@ + + mksiglist: $(srcdir)/mksiglist.c $(srcdir)/mksiglist.h $(incdir)/missing.h $(top_builddir)/config.h +- $(CC) $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/mksiglist.c -o $@ ++ $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/mksiglist.c -o $@ + + mksigname: $(srcdir)/mksigname.c $(srcdir)/mksigname.h $(incdir)/missing.h $(top_builddir)/config.h +- $(CC) $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/mksigname.c -o $@ ++ $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/mksigname.c -o $@ + + fnm_test: fnm_test.o libreplace.la + $(LIBTOOL) --mode=link $(CC) -o $@ fnm_test.o libreplace.la $(PIE_LDFLAGS) $(SSP_LDFLAGS) diff --git a/package/sudo/patches/patch-plugins_sudoers_match_c b/package/sudo/patches/patch-plugins_sudoers_match_c new file mode 100644 index 000000000..57c49e55b --- /dev/null +++ b/package/sudo/patches/patch-plugins_sudoers_match_c @@ -0,0 +1,54 @@ +--- sudo-1.8.10.orig/plugins/sudoers/match.c 2014-03-07 22:51:19.000000000 +0100 ++++ sudo-1.8.10/plugins/sudoers/match.c 2014-03-24 16:16:24.000000000 +0100 +@@ -122,10 +122,12 @@ userlist_matches(const struct passwd *pw + case ALL: + matched = !m->negated; + break; ++#if 0 + case NETGROUP: + if (netgr_matches(m->name, NULL, NULL, pw->pw_name)) + matched = !m->negated; + break; ++#endif + case USERGROUP: + if (usergr_matches(m->name, pw->pw_name, pw)) + matched = !m->negated; +@@ -178,10 +180,12 @@ runaslist_matches(const struct member_li + case ALL: + user_matched = !m->negated; + break; ++#if 0 + case NETGROUP: + if (netgr_matches(m->name, NULL, NULL, runas_pw->pw_name)) + user_matched = !m->negated; + break; ++#endif + case USERGROUP: + if (usergr_matches(m->name, runas_pw->pw_name, runas_pw)) + user_matched = !m->negated; +@@ -278,10 +282,12 @@ hostlist_matches(const struct member_lis + case ALL: + matched = !m->negated; + break; ++#if 0 + case NETGROUP: + if (netgr_matches(m->name, user_runhost, user_srunhost, NULL)) + matched = !m->negated; + break; ++#endif + case NTWKADDR: + if (addr_matches(m->name)) + matched = !m->negated; +@@ -930,6 +936,7 @@ sudo_getdomainname(void) + * else return false. Either of "lhost", "shost" or "user" may be NULL + * in which case that argument is not checked... + */ ++#if 0 + bool + netgr_matches(const char *netgr, const char *lhost, const char *shost, const char *user) + { +@@ -972,3 +979,4 @@ netgr_matches(const char *netgr, const c + + debug_return_bool(rc); + } ++#endif diff --git a/package/syslinux/Makefile b/package/syslinux/Makefile index b84c0b9ad..00168274b 100644 --- a/package/syslinux/Makefile +++ b/package/syslinux/Makefile @@ -4,29 +4,36 @@ include $(TOPDIR)/rules.mk PKG_NAME:= syslinux -PKG_VERSION:= 4.03 +PKG_VERSION:= 6.02 PKG_RELEASE:= 1 -PKG_MD5SUM:= 086ac1c569d226a5e2ae3d605de09a1d +PKG_MD5SUM:= 1df6ff6e4a82b9d7d71a9e7cb5851a5f PKG_DESCR:= lightweight bootloaders -PKG_SECTION:= misc -PKG_BUILDDEP:= nasm +PKG_SECTION:= boot +HOST_BUILDDEP:= nasm-host PKG_URL:= http://syslinux.zytor.com/wiki/index.php/The_Syslinux_Project PKG_SITES:= http://www.kernel.org/pub/linux/utils/boot/syslinux/ -PKG_ARCH_DEPENDS:= native -PKG_HOST_DEPENDS:= !darwin !netbsd !openbsd !cygwin !freebsd +PKG_CFLINE_SYSLINUX:= depends on ADK_HOST_ONLY +include $(TOPDIR)/mk/host.mk include $(TOPDIR)/mk/package.mk -$(eval $(call PKG_template,SYSLINUX,syslinux,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call HOST_template,SYSLINUX,syslinux,$(PKG_VERSION)-${PKG_RELEASE})) -CONFIG_STYLE:= manual -FAKE_FLAGS+= INSTALLROOT=${WRKINST} -TARGET_CFLAGS+= -std=c99 +HOST_STYLE:= manual +HOST_ALL_TARGET:= bios installer -syslinux-install: - $(INSTALL_DIR) $(IDIR_SYSLINUX)/usr/bin - $(INSTALL_BIN) $(WRKINST)/usr/bin/syslinux \ - $(IDIR_SYSLINUX)/usr/bin +host-build: + (cd ${WRKBUILD} && env ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \ + ${HOST_MAKE_FLAGS} ${HOST_ALL_TARGET}) +syslinux-hostinstall: + $(INSTALL_DIR) $(STAGING_HOST_DIR)/usr/bin + $(INSTALL_DIR) $(STAGING_HOST_DIR)/usr/share/syslinux + $(CP) $(WRKBUILD)/bios/core/isolinux.bin \ + $(STAGING_HOST_DIR)/usr/share/syslinux + $(CP) $(WRKBUILD)/bios/com32/elflink/ldlinux/ldlinux.c32 \ + $(STAGING_HOST_DIR)/usr/share/syslinux + +include ${TOPDIR}/mk/host-bottom.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/tcl/Makefile b/package/tcl/Makefile index df231ffdc..9a01a2978 100644 --- a/package/tcl/Makefile +++ b/package/tcl/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= tcl -PKG_VERSION:= 8.5.9 -PKG_RELEASE:= 2 -PKG_MD5SUM:= 8512d8db3233041dd68a81476906012a +PKG_VERSION:= 8.6.1 +PKG_RELEASE:= 1 +PKG_MD5SUM:= aae4b701ee527c6e4e1a6f9c7399882e PKG_DESCR:= TCL scripting language PKG_SECTION:= lang PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=tcl/} @@ -35,6 +35,6 @@ tcl-install: cd ${IDIR_TCL}/usr/bin && ln -sf tclsh8.5 tclsh ${CP} ${WRKINST}/usr/lib/*.so* ${IDIR_TCL}/usr/lib ${CP} ${WRKINST}/usr/lib/tcl8 ${IDIR_TCL}/usr/lib - ${CP} ${WRKINST}/usr/lib/tcl8.5 ${IDIR_TCL}/usr/lib + ${CP} ${WRKINST}/usr/lib/tcl8.6 ${IDIR_TCL}/usr/lib include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/tcl/patches/patch-unix_Makefile_in b/package/tcl/patches/patch-unix_Makefile_in deleted file mode 100644 index 38340c80b..000000000 --- a/package/tcl/patches/patch-unix_Makefile_in +++ /dev/null @@ -1,21 +0,0 @@ ---- tcl8.5.9.orig/unix/Makefile.in 2010-09-08 19:40:48.000000000 +0200 -+++ tcl8.5.9/unix/Makefile.in 2014-01-20 11:13:05.000000000 +0100 -@@ -101,7 +101,8 @@ CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@ - #CFLAGS = $(CFLAGS_DEBUG) - #CFLAGS = $(CFLAGS_OPTIMIZE) - #CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE) --CFLAGS = @CFLAGS_DEFAULT@ @CFLAGS@ -+#CFLAGS = @CFLAGS_DEFAULT@ @CFLAGS@ -+CFLAGS = @CFLAGS@ - - # Flags to pass to the linker - LDFLAGS_DEBUG = @LDFLAGS_DEBUG@ -@@ -737,7 +738,7 @@ install-binaries: binaries - fi - @EXTRA_INSTALL_BINARIES@ - --install-libraries: libraries $(INSTALL_TZDATA) install-msgs -+install-libraries: libraries - @for i in "$(INCLUDE_INSTALL_DIR)" "$(SCRIPT_INSTALL_DIR)"; \ - do \ - if [ ! -d "$$i" ] ; then \ diff --git a/package/tinyproxy/Makefile b/package/tinyproxy/Makefile index 1de352fc3..624e9ef3f 100644 --- a/package/tinyproxy/Makefile +++ b/package/tinyproxy/Makefile @@ -4,31 +4,21 @@ include ${TOPDIR}/rules.mk PKG_NAME:= tinyproxy -PKG_VERSION:= 1.6.5 +PKG_VERSION:= 1.8.3 PKG_RELEASE:= 2 -PKG_MD5SUM:= 2b2862ba33d2939e4572688d442ba415 -PKG_DESCR:= Tinyproxy is a lightweight HTTP and HTTPS proxy. +PKG_MD5SUM:= eca927f7f6a9ce8394b2b256361978a7 +PKG_DESCR:= lightweight HTTP and HTTPS proxy +PKG_BUILDDEP:= autotool PKG_SECTION:= proxy PKG_URL:= https://www.banu.com/tinyproxy/ -PKG_SITES:= https://www.banu.com/pub/tinyproxy/1.6/ +PKG_SITES:= https://www.banu.com/pub/tinyproxy/1.8/ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,TINYPROXY,tinyproxy,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -CONFIGURE_ENV+= ac_cv_header_libintl_h=no \ - ac_cv_lib_nsl_gethostbyaddr=no \ - ac_cv_lib_nsl_gethostname=no - -ifeq (${ADK_COMPILE_TINYPROXY_WITH_TRANSPARENT_PROXY},y) -CONFIGURE_ARGS+= --enable-transparent-proxy -endif -ifneq (${ADK_COMPILE_TINYPROXY_WITH_UPSTREAM},y) -CONFIGURE_ARGS+= --disable-upstream -endif -ifneq (${ADK_COMPILE_TINYPROXY_WITH_FILTER},y) -CONFIGURE_ARGS+= --disable-filter -endif +AUTOTOOL_STYLE:= autoreconf +CONFIGURE_ARGS+= --disable-regexcheck tinyproxy-install: ${INSTALL_DIR} ${IDIR_TINYPROXY}/usr/sbin \ @@ -44,7 +34,5 @@ tinyproxy-install: ${IDIR_TINYPROXY}/usr/share/tinyproxy/ ${INSTALL_DATA} ${WRKINST}/usr/share/tinyproxy/stats.html \ ${IDIR_TINYPROXY}/usr/share/tinyproxy/ - ${INSTALL_DATA} ${WRKINST}/usr/share/tinyproxy/HTML_VARIABLES \ - ${IDIR_TINYPROXY}/usr/share/tinyproxy/ include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/tinyproxy/patches/patch-Makefile_am b/package/tinyproxy/patches/patch-Makefile_am new file mode 100644 index 000000000..443ae2e78 --- /dev/null +++ b/package/tinyproxy/patches/patch-Makefile_am @@ -0,0 +1,10 @@ +--- tinyproxy-1.8.3.orig/Makefile.am 2011-08-16 14:14:34.000000000 +0200 ++++ tinyproxy-1.8.3/Makefile.am 2014-04-07 08:43:20.000000000 +0200 +@@ -2,7 +2,6 @@ SUBDIRS = \ + src \ + data \ + etc \ +- docs \ + m4macros \ + tests + diff --git a/package/tinyproxy/patches/patch-configure b/package/tinyproxy/patches/patch-configure deleted file mode 100644 index d332d18ae..000000000 --- a/package/tinyproxy/patches/patch-configure +++ /dev/null @@ -1,24 +0,0 @@ ---- tinyproxy-1.6.5.orig/configure 2009-09-29 05:28:04.000000000 +0200 -+++ tinyproxy-1.6.5/configure 2009-11-15 21:05:10.000000000 +0100 -@@ -5162,9 +5162,9 @@ _ACEOF - fi - - # Check whether --enable-static was given. --if test "${enable_static+set}" = set; then -- enableval=$enable_static; LDFLAGS="-static $LDFLAGS" --fi -+#if test "${enable_static+set}" = set; then -+# enableval=$enable_static; LDFLAGS="-static $LDFLAGS" -+#fi - - - -@@ -10015,7 +10015,7 @@ if test x"$debug_enabled" = x"yes" ; the - LEX_FLAGS="--warn --debug" - fi - else -- CFLAGS="-O2 -DNDEBUG $CFLAGS" -+ CFLAGS="$CFLAGS" - YFLAGS="-d" - fi - diff --git a/package/tinyproxy/patches/patch-configure_ac b/package/tinyproxy/patches/patch-configure_ac new file mode 100644 index 000000000..b3fd83dc9 --- /dev/null +++ b/package/tinyproxy/patches/patch-configure_ac @@ -0,0 +1,27 @@ +--- tinyproxy-1.8.3.orig/configure.ac 2011-08-16 14:14:58.000000000 +0200 ++++ tinyproxy-1.8.3/configure.ac 2014-04-07 08:43:06.000000000 +0200 +@@ -282,24 +282,12 @@ AC_SUBST(CPPFLAGS) + AC_SUBST(LIBS) + AC_SUBST(ADDITIONAL_OBJECTS) + +-# Check for asciidoc +-AC_PATH_PROG(A2X, a2x, no) +-AM_CONDITIONAL(HAVE_A2X, test "x$A2X" != "xno") +-if test x"$A2X" = x"no"; then +- AC_MSG_ERROR([Test for asciidoc failed. See the file 'INSTALL' for help.]) +-fi +- + AC_CONFIG_FILES([ + Makefile + src/Makefile + data/Makefile + data/templates/Makefile + etc/Makefile +-docs/Makefile +-docs/man5/Makefile +-docs/man5/tinyproxy.conf.txt +-docs/man8/Makefile +-docs/man8/tinyproxy.txt + m4macros/Makefile + tests/Makefile + tests/scripts/Makefile diff --git a/package/uclibc/Makefile b/package/uclibc/Makefile index d48e7552f..95c7bb94d 100644 --- a/package/uclibc/Makefile +++ b/package/uclibc/Makefile @@ -2,7 +2,7 @@ # material, please see the LICENCE file in the top-level directory. include $(TOPDIR)/rules.mk -include $(TOPDIR)/toolchain/uClibc/Makefile.inc +include $(TOPDIR)/toolchain/uclibc/Makefile.inc PKG_NAME:= uClibc PKG_DESCR:= embedded C library diff --git a/package/vlc/Makefile b/package/vlc/Makefile index 67f0ec763..74ab64ef7 100644 --- a/package/vlc/Makefile +++ b/package/vlc/Makefile @@ -4,10 +4,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:= vlc -PKG_VERSION:= 2.1.1 +PKG_VERSION:= 2.1.4 PKG_RELEASE:= 1 -PKG_MD5SUM:= 1331cd853d56762c96afcb92dd498348 -PKG_DESCR:= Media Player +PKG_MD5SUM:= 7ed67d22f7425011078772bfc62ac222 +PKG_DESCR:= popular media player PKG_SECTION:= multimedia PKG_BUILDDEP:= ffmpeg xcb-util libtheora libgcrypt libmad PKG_DEPENDS:= libffmpeg xcb-util libtheora libgcrypt @@ -23,6 +23,7 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,VLC,vlc,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CPPFLAGS+= -D_GNU_SOURCE -D_POSIX_SOURCE TARGET_CFLAGS+= -fPIC CONFIGURE_ENV+= ac_cv_func_sched_getaffinity=no CONFIGURE_ARGS+= --disable-lua \ diff --git a/package/vlc/patches/patch-modules_text_renderer_freetype_c b/package/vlc/patches/patch-modules_text_renderer_freetype_c deleted file mode 100644 index 0c25fcfdf..000000000 --- a/package/vlc/patches/patch-modules_text_renderer_freetype_c +++ /dev/null @@ -1,11 +0,0 @@ ---- vlc-2.1.1.orig/modules/text_renderer/freetype.c 2013-09-12 17:18:34.000000000 +0200 -+++ vlc-2.1.1/modules/text_renderer/freetype.c 2013-12-10 10:13:38.000000000 +0100 -@@ -90,7 +90,7 @@ - #endif - - /* Freetype */ --#include <freetype/ftsynth.h> -+#include <ftsynth.h> - #include FT_FREETYPE_H - #include FT_GLYPH_H - #include FT_STROKER_H diff --git a/package/w3m/Makefile b/package/w3m/Makefile new file mode 100644 index 000000000..cd0ae7913 --- /dev/null +++ b/package/w3m/Makefile @@ -0,0 +1,31 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include $(TOPDIR)/rules.mk + +PKG_NAME:= w3m +PKG_VERSION:= 0.5.3 +PKG_RELEASE:= 3 +PKG_MD5SUM:= 1b845a983a50b8dec0169ac48479eacc +PKG_DESCR:= console web browser +PKG_SECTION:= browser +PKG_DEPENDS:= libgc libncurses +PKG_BUILDDEP:= libgc-host libgc ncurses +PKG_URL:= http://w3m.sourceforge.net/ +PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=w3m/} + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,W3M,w3m,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) + +TARGET_LDFLAGS+= -lncurses -ltinfo +CONFIGURE_ENV+= ac_cv_func_setpgrp_void=yes +CONFIGURE_ARGS+= --with-termlib=ncurses \ + --enable-image=no + +w3m-install: + $(INSTALL_DIR) $(IDIR_W3M)/usr/bin + $(INSTALL_BIN) $(WRKINST)/usr/bin/w3m \ + $(IDIR_W3M)/usr/bin + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/w3m/patches/patch-Makefile_in b/package/w3m/patches/patch-Makefile_in new file mode 100644 index 000000000..d8058d0e9 --- /dev/null +++ b/package/w3m/patches/patch-Makefile_in @@ -0,0 +1,35 @@ +--- w3m-0.5.3.orig/Makefile.in 2011-01-04 10:22:18.000000000 +0100 ++++ w3m-0.5.3/Makefile.in 2014-04-08 21:21:10.000000000 +0200 +@@ -176,8 +176,20 @@ functable.c: funcname.tab mktable$(EXT) + ./mktable$(EXT) 100 functable.tab > $@ + -rm -f functable.tab + +-mktable$(EXT): mktable.o dummy.o Str.o hash.o myctype.o +- $(CC) $(CFLAGS) -o mktable mktable.o dummy.o Str.o hash.o myctype.o $(LDFLAGS) $(LIBS) $(GC_LIBS) ++Str-host.o: ++ $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -c -o $@ $(srcdir)/Str.c ++ ++hash-host.o: ++ $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -c -o $@ $(srcdir)/hash.c ++ ++myctype-host.o: ++ $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -c -o $@ $(srcdir)/myctype.c ++ ++mktable-host.o: ++ $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -c -o $@ $(srcdir)/mktable.c ++ ++mktable$(EXT): mktable-host.o dummy-host.o Str-host.o hash-host.o myctype-host.o ++ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o mktable mktable-host.o dummy-host.o Str-host.o hash-host.o myctype-host.o $(LDFLAGS_FOR_BUILD) $(LIBS) $(GC_LIBS) + + $(BOOKMARKER): w3mbookmark.o dummy.o $(ALIB) + $(CC) $(CFLAGS) -o $(BOOKMARKER) w3mbookmark.o dummy.o $(LDFLAGS) $(LIBS) $(EXT_LIBS) +@@ -194,6 +206,9 @@ inflate.o: inflate.c + libwc/libwc.a: libwc + libwc: + (cd libwc && $(MAKE) CC='$(CC0)' OPTS='$(OPTS)') ++ ++dummy-host.o: entity.c ++ $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -DDUMMY -c -o $@ $? + + dummy.o: entity.c + $(CC) $(CFLAGS) -DDUMMY -c -o $@ $? diff --git a/package/w3m/patches/patch-istream_c b/package/w3m/patches/patch-istream_c new file mode 100644 index 000000000..83743eda0 --- /dev/null +++ b/package/w3m/patches/patch-istream_c @@ -0,0 +1,38 @@ +--- w3m-0.5.3.orig/istream.c 2011-01-04 10:22:22.000000000 +0100 ++++ w3m-0.5.3/istream.c 2014-04-08 19:58:01.000000000 +0200 +@@ -22,8 +22,8 @@ + static void basic_close(int *handle); + static int basic_read(int *handle, char *buf, int len); + +-static void file_close(struct file_handle *handle); +-static int file_read(struct file_handle *handle, char *buf, int len); ++static void file_close(struct wfile_handle *handle); ++static int file_read(struct wfile_handle *handle, char *buf, int len); + + static int str_read(Str handle, char *buf, int len); + +@@ -114,7 +114,7 @@ newFileStream(FILE * f, void (*closep) ( + stream = New(union input_stream); + init_base_stream(&stream->base, STREAM_BUF_SIZE); + stream->file.type = IST_FILE; +- stream->file.handle = New(struct file_handle); ++ stream->file.handle = New(struct wfile_handle); + stream->file.handle->f = f; + if (closep) + stream->file.handle->close = closep; +@@ -658,13 +658,13 @@ basic_read(int *handle, char *buf, int l + } + + static void +-file_close(struct file_handle *handle) ++file_close(struct wfile_handle *handle) + { + handle->close(handle->f); + } + + static int +-file_read(struct file_handle *handle, char *buf, int len) ++file_read(struct wfile_handle *handle, char *buf, int len) + { + return fread(buf, 1, len, handle->f); + } diff --git a/package/w3m/patches/patch-istream_h b/package/w3m/patches/patch-istream_h new file mode 100644 index 000000000..b6a6a867b --- /dev/null +++ b/package/w3m/patches/patch-istream_h @@ -0,0 +1,20 @@ +--- w3m-0.5.3.orig/istream.h 2003-10-20 18:41:56.000000000 +0200 ++++ w3m-0.5.3/istream.h 2014-04-08 19:57:31.000000000 +0200 +@@ -20,7 +20,7 @@ struct stream_buffer { + + typedef struct stream_buffer *StreamBuffer; + +-struct file_handle { ++struct wfile_handle { + FILE *f; + void (*close) (); + }; +@@ -53,7 +53,7 @@ struct base_stream { + + struct file_stream { + struct stream_buffer stream; +- struct file_handle *handle; ++ struct wfile_handle *handle; + char type; + char iseos; + int (*read) (); diff --git a/package/w3m/patches/patch-main_c b/package/w3m/patches/patch-main_c new file mode 100644 index 000000000..9f14ab1c1 --- /dev/null +++ b/package/w3m/patches/patch-main_c @@ -0,0 +1,11 @@ +--- w3m-0.5.3.orig/main.c 2011-01-04 10:42:19.000000000 +0100 ++++ w3m-0.5.3/main.c 2014-04-08 19:59:04.000000000 +0200 +@@ -833,7 +833,7 @@ main(int argc, char **argv, char **envp) + mySignal(SIGPIPE, SigPipe); + #endif + +- orig_GC_warn_proc = GC_set_warn_proc(wrap_GC_warn_proc); ++ GC_set_warn_proc(wrap_GC_warn_proc); + err_msg = Strnew(); + if (load_argc == 0) { + /* no URL specified */ diff --git a/package/watchdog/Makefile b/package/watchdog/Makefile index a4c6d44a5..a8486dd6a 100644 --- a/package/watchdog/Makefile +++ b/package/watchdog/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= watchdog -PKG_VERSION:= 5.7 -PKG_RELEASE:= 3 -PKG_MD5SUM:= 31766450ecfc9aff70fe966c0b9df06d +PKG_VERSION:= 5.13 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 153455f008f1cf8f65f6ad9586a21ff1 PKG_DESCR:= watchdog daemon PKG_SECTION:= utils PKG_DEPENDS:= libtirpc @@ -17,6 +17,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,WATCHDOG,watchdog,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CPPFLAGS+= -D_GNU_SOURCE TARGET_CFLAGS+= -I$(STAGING_TARGET_DIR)/usr/include/tirpc TARGET_LDFLAGS+= -ltirpc diff --git a/package/watchdog/patches/patch-include_extern_h b/package/watchdog/patches/patch-include_extern_h new file mode 100644 index 000000000..aea373525 --- /dev/null +++ b/package/watchdog/patches/patch-include_extern_h @@ -0,0 +1,9 @@ +--- watchdog-5.13.orig/include/extern.h 2013-02-01 12:15:44.000000000 +0100 ++++ watchdog-5.13/include/extern.h 2014-03-22 15:41:57.000000000 +0100 +@@ -1,5 +1,6 @@ + #include <netinet/in.h> + #include <stdio.h> ++#include <time.h> + + /* external variables */ + extern int softboot, watchdog, temp, maxtemp, tint, lastts, nrts; diff --git a/package/watchdog/patches/patch-src_memory_c b/package/watchdog/patches/patch-src_memory_c new file mode 100644 index 000000000..06540812e --- /dev/null +++ b/package/watchdog/patches/patch-src_memory_c @@ -0,0 +1,11 @@ +--- watchdog-5.13.orig/src/memory.c 2013-02-01 12:15:44.000000000 +0100 ++++ watchdog-5.13/src/memory.c 2014-03-22 16:07:15.000000000 +0100 +@@ -81,7 +81,7 @@ int check_memory(void) + syslog(LOG_INFO, "currently there are %d kB of free memory available", free); + #endif /* USE_SYSLOG */ + +- if (free < minpages * (EXEC_PAGESIZE / 1024)) { ++ if (free < minpages * (4096 / 1024)) { + #if USE_SYSLOG + syslog(LOG_ERR, "memory %d kB is less than %d pages", free, minpages); + #endif /* USE_SYSLOG */ diff --git a/package/watchdog/patches/patch-src_mntent_c b/package/watchdog/patches/patch-src_mntent_c deleted file mode 100644 index f2277bdbf..000000000 --- a/package/watchdog/patches/patch-src_mntent_c +++ /dev/null @@ -1,11 +0,0 @@ ---- watchdog-5.7.orig/src/mntent.c 2010-01-06 13:42:08.000000000 +0100 -+++ watchdog-5.7/src/mntent.c 2010-02-06 04:39:34.804334839 +0100 -@@ -157,7 +157,7 @@ my_getmntent (mntFILE *mfp) { - if (fgets (buf, sizeof(buf), mfp->mntent_fp) == NULL) - return NULL; - -- s = index (buf, '\n'); -+ s = strchr (buf, '\n'); - if (s == NULL) { - /* extremely long line - assume file was corrupted */ - mfp->mntent_errs = 1; diff --git a/package/watchdog/patches/patch-src_net_c b/package/watchdog/patches/patch-src_net_c new file mode 100644 index 000000000..da56cf791 --- /dev/null +++ b/package/watchdog/patches/patch-src_net_c @@ -0,0 +1,10 @@ +--- watchdog-5.13.orig/src/net.c 2013-02-01 12:15:44.000000000 +0100 ++++ watchdog-5.13/src/net.c 2014-03-22 16:18:27.000000000 +0100 +@@ -6,6 +6,7 @@ + + #include <errno.h> + #include <sys/time.h> ++#include <sys/types.h> + #include <netinet/ip.h> + #include <netinet/ip_icmp.h> + diff --git a/package/watchdog/patches/patch-src_shutdown_c b/package/watchdog/patches/patch-src_shutdown_c new file mode 100644 index 000000000..90ba0ee3c --- /dev/null +++ b/package/watchdog/patches/patch-src_shutdown_c @@ -0,0 +1,18 @@ +--- watchdog-5.13.orig/src/shutdown.c 2013-02-01 12:15:44.000000000 +0100 ++++ watchdog-5.13/src/shutdown.c 2014-03-22 16:29:44.000000000 +0100 +@@ -186,6 +186,7 @@ static void mnt_off() + FILE *fp; + struct mntent *mnt; + ++#if defined __GLIBC__ + fp = setmntent(MNTTAB, "r"); + /* in some rare cases fp might be NULL so be careful */ + while (fp != NULL && ((mnt = getmntent(fp)) != (struct mntent *) 0)) { +@@ -241,6 +242,7 @@ static void mnt_off() + #endif + } + endmntent(fp); ++#endif + } + + /* Parts of the following two functions are taken from Miquel van */ diff --git a/package/watchdog/patches/patch-src_umount_c b/package/watchdog/patches/patch-src_umount_c deleted file mode 100644 index 6b5a82c1f..000000000 --- a/package/watchdog/patches/patch-src_umount_c +++ /dev/null @@ -1,11 +0,0 @@ ---- watchdog-5.7.orig/src/umount.c 2010-01-06 13:42:08.000000000 +0100 -+++ watchdog-5.7/src/umount.c 2010-02-06 04:39:47.664334843 +0100 -@@ -212,7 +212,7 @@ umount_one (const char *spec, const char - if (res < 0) - umnt_err2 = errno; - /* Do not complain about remote NFS mount points */ -- if (errno == ENOENT && index(spec, ':')) -+ if (errno == ENOENT && strchr(spec, ':')) - umnt_err2 = 0; - } - } diff --git a/package/xbmc/Makefile b/package/xbmc/Makefile index fed181d92..e8fc5cc40 100644 --- a/package/xbmc/Makefile +++ b/package/xbmc/Makefile @@ -69,6 +69,7 @@ CONFIGURE_ARGS+= --disable-optical-drive \ --enable-libbluray \ --enable-external-libraries \ --enable-rtmp \ + --enable-libcec \ --disable-libusb \ --disable-libcap \ --disable-sdl \ diff --git a/package/xf86-video-fbdev/Makefile b/package/xf86-video-fbdev/Makefile index cf24b3358..b14e8eaa8 100644 --- a/package/xf86-video-fbdev/Makefile +++ b/package/xf86-video-fbdev/Makefile @@ -4,9 +4,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:= xf86-video-fbdev -PKG_VERSION:= 0.4.2 +PKG_VERSION:= 0.4.4 PKG_RELEASE:= 1 -PKG_MD5SUM:= a94011aac77eb9cd6d46bf0af0dbc631 +PKG_MD5SUM:= 2b5e6dd218243cf96c1a4090596a6bba PKG_DESCR:= X11 driver for Linux Framebuffer devices PKG_SECTION:= x11/drivers PKG_DEPENDS:= xorg-server diff --git a/package/xinetd/Makefile b/package/xinetd/Makefile index 42e3f7b83..deae22563 100644 --- a/package/xinetd/Makefile +++ b/package/xinetd/Makefile @@ -4,18 +4,19 @@ include $(TOPDIR)/rules.mk PKG_NAME:= xinetd -PKG_VERSION:= 2.3.14 +PKG_VERSION:= 2.3.15 PKG_RELEASE:= 1 -PKG_MD5SUM:= 567382d7972613090215c6c54f9b82d9 +PKG_MD5SUM:= 77358478fd58efa6366accae99b8b04c PKG_DESCR:= a powerful and secure superserver PKG_SECTION:= net/misc PKG_URL:= http://www.xinetd.org/ -PKG_SITES:= http://www.xinetd.org/ +PKG_SITES:= ftp://mirror.ovh.net/gentoo-distfiles/distfiles/ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,XINETD,xinetd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +CONFIGURE_ENV+= xinetd_cv_type_rlim_t=yes CONFIGURE_ARGS+= --without-libwrap \ --with-loadavg ALL_TARGET:= build diff --git a/package/xinetd/patches/patch-Makefile_in b/package/xinetd/patches/patch-Makefile_in index a89962c2e..bfc02b9ab 100644 --- a/package/xinetd/patches/patch-Makefile_in +++ b/package/xinetd/patches/patch-Makefile_in @@ -1,14 +1,5 @@ ---- xinetd-2.3.14.orig/Makefile.in 2003-08-15 16:00:45.000000000 +0200 -+++ xinetd-2.3.14/Makefile.in 2011-01-22 20:53:07.924898364 +0100 -@@ -14,7 +14,7 @@ topdir = @top_srcdir@ - - LIBS = -lsio -lstr -lmisc -lxlog -lportable -lpset @LIBS@ - --CFLAGS += @CFLAGS@ -+CFLAGS = @CFLAGS@ - DCFLAGS = -Wall -Wredundant-decls -W -Wfloat-equal -Wundef -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Wmissing-format-attribute -Wshadow -Wpointer-arith -g - - +--- xinetd-2.3.15.orig/Makefile.in 2007-09-20 19:01:52.000000000 +0200 ++++ xinetd-2.3.15/Makefile.in 2014-03-23 22:50:01.000000000 +0100 @@ -75,15 +75,15 @@ dlibxlog: dlibsio dlibstr install: build diff --git a/package/xinetd/patches/patch-xinetd_confparse_c b/package/xinetd/patches/patch-xinetd_confparse_c new file mode 100644 index 000000000..e6aa32e68 --- /dev/null +++ b/package/xinetd/patches/patch-xinetd_confparse_c @@ -0,0 +1,18 @@ +--- xinetd-2.3.15.orig/xinetd/confparse.c 2007-09-20 16:58:27.000000000 +0200 ++++ xinetd-2.3.15/xinetd/confparse.c 2014-03-23 22:39:37.000000000 +0100 +@@ -746,6 +746,7 @@ static status_e check_entry( struct serv + } + + /* #ifndef NO_RPC */ ++#if 0 + #if defined(HAVE_RPC_RPCENT_H) || defined(HAVE_NETDB_H) + if ( SC_IS_RPC( scp ) && !SC_IS_UNLISTED( scp ) ) + { +@@ -760,6 +761,7 @@ static status_e check_entry( struct serv + } + else + #endif /* ! NO_RPC */ ++#endif + { + if ( !SC_IS_UNLISTED( scp ) ) + { diff --git a/package/xterm/Makefile b/package/xterm/Makefile index 10bfaf21a..6575fae60 100644 --- a/package/xterm/Makefile +++ b/package/xterm/Makefile @@ -4,9 +4,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:= xterm -PKG_VERSION:= 297 -PKG_RELEASE:= 2 -PKG_MD5SUM:= 45610ae6fe90cf086fcd75b9cb97bbaf +PKG_VERSION:= 303 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 48f6d49b2b6b6933d501d767cbed9254 PKG_DESCR:= Terminal Emulator for X Windows PKG_SECTION:= x11/apps PKG_DEPENDS:= libxaw libxt libncurses libxft fontconfig diff --git a/package/xz/Makefile b/package/xz/Makefile index 1793f8eaf..ac68ff653 100644 --- a/package/xz/Makefile +++ b/package/xz/Makefile @@ -13,13 +13,18 @@ PKG_URL:= http://tukaani.org/xz/ PKG_SITES:= http://tukaani.org/xz/ PKG_OPTS:= dev +include ${TOPDIR}/mk/host.mk include ${TOPDIR}/mk/package.mk +$(eval $(call HOST_template,XZ,xz,${PKG_VERSION}-${PKG_RELEASE})) $(eval $(call PKG_template,XZ,xz,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) +HOST_STYLE:= auto + xz-install: ${INSTALL_DIR} ${IDIR_XZ}/usr/bin ${IDIR_XZ}/usr/lib ${CP} ${WRKINST}/usr/bin/* ${IDIR_XZ}/usr/bin ${CP} ${WRKINST}/usr/lib/*.so* ${IDIR_XZ}/usr/lib +include ${TOPDIR}/mk/host-bottom.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/zile/Makefile b/package/zile/Makefile new file mode 100644 index 000000000..0a8711548 --- /dev/null +++ b/package/zile/Makefile @@ -0,0 +1,31 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include $(TOPDIR)/rules.mk + +PKG_NAME:= zile +PKG_VERSION:= 2.4.11 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 7a460ccec64e3bec2835697b2eae533c +PKG_DESCR:= tiny emacs clone +PKG_SECTION:= editor +PKG_DEPENDS:= libgc +PKG_BUILDDEP:= autotool libgc +PKG_URL:= http://www.gnu.org/software/zile/ +PKG_SITES:= ${MASTER_SITE_GNU:=zile/} + +PKG_LIBC_DEPENDS:= glibc + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,ZILE,zile,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) + +AUTOTOOL_STYLE:= autoreconf +TARGET_LDFLAGS+= -ltinfo + +zile-install: + $(INSTALL_DIR) $(IDIR_ZILE)/usr/bin + $(INSTALL_BIN) $(WRKINST)/usr/bin/zile \ + $(IDIR_ZILE)/usr/bin + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/zile/patches/patch-Makefile_am b/package/zile/patches/patch-Makefile_am new file mode 100644 index 000000000..4d25fc5f0 --- /dev/null +++ b/package/zile/patches/patch-Makefile_am @@ -0,0 +1,23 @@ +--- zile-2.4.11.orig/Makefile.am 2014-02-24 22:42:16.000000000 +0100 ++++ zile-2.4.11/Makefile.am 2014-04-08 14:25:07.000000000 +0200 +@@ -36,12 +36,10 @@ PERL_BUILDTIME = \ + + EXTRA_DIST = \ + FAQ \ +- build-aux/zile-help2man-wrapper \ + $(PERL_BUILDTIME) + + doc_DATA = AUTHORS FAQ NEWS + +-include doc/Makefile.am + include src/Makefile.am + include tests/Makefile.am + +@@ -49,7 +47,6 @@ PRODUCTIONSOURCES = \ + configure.ac \ + Makefile.am \ + $(PERL_BUILDTIME) \ +- doc/Makefile.am \ + src/Makefile.am \ + $(src_zile_base_SOURCE_FILES) \ + src/tbl_opts.h.in |