diff options
198 files changed, 12643 insertions, 4301 deletions
diff --git a/.gitignore b/.gitignore index 4f602504a..51956e85e 100644 --- a/.gitignore +++ b/.gitignore @@ -23,9 +23,11 @@ /.busyboxcfg /.rebuild.* /.defconfig +/.adkinit /all.config /target_*/ /host_*/ +/jhost/ /pkg_*/ /root_*/ /bin/ @@ -40,8 +42,10 @@ /package/*/Config.in.lib /package/*/Config.in.kmod /tools_build/ +/jtools_build/ /extra/ /.menu +/.adkinit /target/*/Config.in.systems /target/*/sys-enabled /target/packages/pkg-enabled @@ -1,7 +1,6 @@ -- enable and test gcj -- port cacao -- port LXDE - port openjdk +- port LXDE +- toolchain rebuild when changes to config require it - add and test brcm 2.6 wireless support - man pages in ipkg/tgz packages (automatic) - automate /etc handling via conffiles diff --git a/jtools/Makefile b/jtools/Makefile new file mode 100644 index 000000000..23c90534f --- /dev/null +++ b/jtools/Makefile @@ -0,0 +1,29 @@ +# 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 + +TARGETS:= +ifneq ($(ADK_PACKAGE_OPENJDK),) +TARGETS+=fastjar gcj classpath ecj +endif + +TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS)) +TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) + +all: install +compile: +install: $(TARGETS_INSTALL) +clean: $(TARGETS_CLEAN) + +%-compile: $(TOOLS_BUILD_DIR) + $(TRACE) "jtools/$(patsubst %-compile,%,$@)/compile " + $(MAKE) -C $(patsubst %-compile,%,$@) compile + +%-install: + $(TRACE) "jtools/$(patsubst %-install,%,$@)/install " + $(MAKE) -C $(patsubst %-install,%,$@) install + +%-clean: + $(TRACE) "jtools/$(patsubst %-clean,%,$@)/clean " + $(MAKE) -C $(patsubst %-clean,%,$@) clean diff --git a/jtools/classpath/Makefile b/jtools/classpath/Makefile new file mode 100644 index 000000000..d4421bf9a --- /dev/null +++ b/jtools/classpath/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:= classpath +PKG_VERSION:= 0.98 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 90c6571b8b0309e372faa0f9f6255ea9 +PKG_SITES:= ${MASTER_SITE_GNU:=classpath/} + +include ../rules.mk + +install: ${STAGING_JAVA_HOST_DIR}/usr/share/classpath/glibj.zip + +$(WRKBUILD)/.configured: ${WRKDIST}/.prepared + (cd $(WRKBUILD); ./configure --prefix=${STAGING_JAVA_HOST_DIR}/usr \ + --disable-local-sockets \ + --disable-alsa \ + --disable-gconf-peer \ + --disable-gtk-peer \ + --disable-qt-peer \ + --disable-dssi \ + --disable-plugin \ + --disable-examples \ + --disable-gjdoc \ + --with-jar=no \ + --disable-Werror) + touch $@ + +$(WRKBUILD)/.compiled: ${WRKDIST}/.configured + ${MAKE} -C ${WRKBUILD} + touch $@ + +${STAGING_JAVA_HOST_DIR}/usr/share/classpath/glibj.zip: $(WRKBUILD)/.compiled + ${MAKE} -C ${WRKBUILD} install + +include $(TOPDIR)/mk/tools.mk diff --git a/jtools/ecj/Makefile b/jtools/ecj/Makefile new file mode 100644 index 000000000..a67e9ebd8 --- /dev/null +++ b/jtools/ecj/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:= ecj +PKG_VERSION:= 1 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 63220327925ace13756ae334c55a3baa + +include ../rules.mk + +install: ${STAGING_JAVA_HOST_DIR}/usr/bin/ecj + +${STAGING_JAVA_HOST_DIR}/usr/bin/ecj: + env \ + DYLD_LIBRARY_PATH=$(STAGING_JAVA_HOST_DIR)/usr/lib:$(STAGING_JAVA_HOST_DIR)/usr/lib64 \ + LD_LIBRARY_PATH=$(STAGING_JAVA_HOST_DIR)/usr/lib:$(STAGING_JAVA_HOST_DIR)/usr/lib64 \ + PATH=$(STAGING_JAVA_HOST_DIR)/usr/bin:$$PATH \ + $(STAGING_JAVA_HOST_DIR)/usr/bin/gcj -g -O2 -findirect-dispatch \ + -o ${STAGING_JAVA_HOST_DIR}/usr/bin/ecj.native \ + --main=org.eclipse.jdt.internal.compiler.batch.Main \ + $(TOPDIR)/jtools_build/gcc-4.5.2/ecj.jar + $(CP) $(TOPDIR)/jtools_build/gcc-4.5.2/ecj.jar ${STAGING_JAVA_HOST_DIR}/usr/share/ecj.jar + echo "env LD_LIBRARY_PATH=$(STAGING_JAVA_HOST_DIR)/usr/lib:$(STAGING_JAVA_HOST_DIR)/usr/lib64 ${STAGING_JAVA_HOST_DIR}/usr/bin/ecj.native \$$@" > \ + ${STAGING_JAVA_HOST_DIR}/usr/bin/ecj + chmod u+x ${STAGING_JAVA_HOST_DIR}/usr/bin/ecj + # put a wrapper for java here + echo "env LD_LIBRARY_PATH=$(STAGING_JAVA_HOST_DIR)/usr/lib:$(STAGING_JAVA_HOST_DIR)/usr/lib64 ${STAGING_JAVA_HOST_DIR}/usr/bin/gij \$$@" > \ + ${STAGING_JAVA_HOST_DIR}/usr/bin/java + chmod u+x ${STAGING_JAVA_HOST_DIR}/usr/bin/java + +include $(TOPDIR)/mk/tools.mk diff --git a/jtools/fastjar/Makefile b/jtools/fastjar/Makefile new file mode 100644 index 000000000..744776eac --- /dev/null +++ b/jtools/fastjar/Makefile @@ -0,0 +1,27 @@ +# 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:= fastjar +PKG_VERSION:= 0.94 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 14d4bdfac236e347d806c6743dba48c6 +PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=fastjar/} + +include ../rules.mk + +install: ${STAGING_JAVA_HOST_DIR}/usr/bin/fastjar + +$(WRKBUILD)/.configured: ${WRKDIST}/.prepared + (cd $(WRKBUILD); ./configure --prefix=/usr); + touch $@ + +$(WRKBUILD)/.compiled: ${WRKDIST}/.configured + ${MAKE} -C ${WRKBUILD} $(MAKE_TRACE) + touch $@ + +${STAGING_JAVA_HOST_DIR}/usr/bin/fastjar: $(WRKBUILD)/.compiled + ${MAKE} -C ${WRKBUILD} DESTDIR=$(STAGING_JAVA_HOST_DIR) install $(MAKE_TRACE) + +include $(TOPDIR)/mk/tools.mk diff --git a/jtools/gcj/Makefile b/jtools/gcj/Makefile new file mode 100644 index 000000000..7ccd03c15 --- /dev/null +++ b/jtools/gcj/Makefile @@ -0,0 +1,50 @@ +# 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:= gcj +PKG_VERSION:= 4.5.2 +PKG_RELEASE:= 1 +PKG_MD5SUM:= d6559145853fbaaa0fd7556ed93bce9a +PKG_SITES:= ${MASTER_SITE_GNU:=gcc/gcc-${PKG_VERSION}/} +DISTFILES:= gcc-$(PKG_VERSION).tar.bz2 + +WRKDIST= ${WRKDIR}/gcc-${PKG_VERSION} + +include ../rules.mk + +GCJ_ENV+= JAR=no + +install: ${STAGING_JAVA_HOST_DIR}/usr/bin/gcj + +$(WRKBUILD)/.configured: ${WRKDIST}/.prepared + (cd $(WRKBUILD); \ + wget -O ecj.jar ftp://sourceware.org/pub/java/ecj-latest.jar; \ + env ${GCJ_ENV} ./configure \ + --prefix=/usr \ + --enable-java-home \ + --enable-languages=java \ + --with-ffi \ + --with-mpc=$(STAGING_HOST_DIR)/usr \ + --with-mpfr=$(STAGING_HOST_DIR)/usr \ + --with-gmp=$(STAGING_HOST_DIR)/usr \ + --disable-libmudflap \ + --disable-libgomp \ + --disable-biarch \ + --disable-decimal-float \ + --disable-multilib \ + --disable-bootstrap \ + ); + touch $@ + +$(WRKBUILD)/.compiled: ${WRKDIST}/.configured + env ${GCJ_ENV} ${MAKE} -C ${WRKBUILD} $(MAKE_TRACE) + touch $@ + +${STAGING_JAVA_HOST_DIR}/usr/bin/gcj: $(WRKBUILD)/.compiled + $(INSTALL_DIR) ${STAGING_JAVA_HOST_DIR} + env ${GCJ_ENV} ${MAKE} -C ${WRKBUILD} \ + DESTDIR=$(STAGING_JAVA_HOST_DIR) install $(MAKE_TRACE) + +include $(TOPDIR)/mk/tools.mk diff --git a/jtools/rules.mk b/jtools/rules.mk new file mode 100644 index 000000000..7b1d8e866 --- /dev/null +++ b/jtools/rules.mk @@ -0,0 +1,7 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +WRKDIR_BASE= ${JTOOLS_BUILD_DIR} +WRKDIR= ${WRKDIR_BASE} + +include ${TOPDIR}/mk/buildhlp.mk diff --git a/mk/build.mk b/mk/build.mk index 62c9245cf..635d8bc63 100644 --- a/mk/build.mk +++ b/mk/build.mk @@ -123,9 +123,9 @@ ifeq ($(ADK_NATIVE),y) $(MAKE) -f mk/build.mk toolchain/kernel-headers-prepare tools/install target/config-prepare target/compile package/compile root_clean package/install package_index target/install else ifeq ($(ADK_TOOLCHAIN_ONLY),y) - $(MAKE) -f mk/build.mk toolchain/install tools/install package/compile + $(MAKE) -f mk/build.mk toolchain/install tools/install jtools/install package/compile else - $(MAKE) -f mk/build.mk toolchain/install tools/install target/config-prepare target/compile package/compile root_clean package/install target/install package_index + $(MAKE) -f mk/build.mk toolchain/install tools/install jtools/install target/config-prepare target/compile package/compile root_clean package/install target/install package_index endif endif @@ -136,7 +136,7 @@ ifeq ($(ADK_TARGET_PACKAGE_IPKG),y) endif ${STAGING_DIR} ${STAGING_DIR}/etc ${STAGING_HOST_DIR}: - mkdir -p ${STAGING_DIR}/{bin,etc,lib,usr/include,usr/lib/pkgconfig} \ + mkdir -p ${STAGING_DIR}/{bin,etc,lib,usr/bin,usr/include,usr/lib/pkgconfig} \ ${STAGING_HOST_DIR}/{bin,lib,usr/bin,usr/lib} ${STAGING_DIR}/etc/ipkg.conf: ${STAGING_DIR}/etc @@ -157,6 +157,9 @@ toolchain/%: ${STAGING_DIR} tools/%: $(MAKE) -C tools $(patsubst tools/%,%,$@) +jtools/%: + $(MAKE) -C jtools $(patsubst jtools/%,%,$@) + image: $(MAKE) -C target image @@ -210,7 +213,7 @@ clean: @$(TRACE) clean $(MAKE) -C $(CONFIG) clean for d in ${STAGING_PKG_DIR}; do \ - for f in $$(ls $$d/[a-z]* 2>/dev/null); do \ + for f in $$(ls $$d/[a-z]*|grep -v [A-Z] 2>/dev/null); do \ while read file ; do \ rm ${STAGING_DIR}/$$file 2>/dev/null;\ done < $$f ; \ @@ -231,7 +234,7 @@ cleandir: rm -rf $(BUILD_DIR_PFX) $(BIN_DIR_PFX) $(TARGET_DIR_PFX) \ ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d rm -rf $(TOOLCHAIN_BUILD_DIR_PFX) $(STAGING_HOST_DIR_PFX) $(TOOLS_BUILD_DIR) - rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX) + rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX) $(JTOOLS_BUILD_DIR) $(STAGING_JAVA_HOST_DIR) rm -f .menu .tmpconfig.h .rebuild* ${TOPDIR}/package/Depends.mk ${TOPDIR}/prereq.mk cleantarget: @@ -245,9 +248,9 @@ distclean: @$(TRACE) distclean @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE) @rm -rf $(BUILD_DIR_PFX) $(BIN_DIR_PFX) $(TARGET_DIR_PFX) $(DISTDIR) \ - ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d + ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d $(JTOOLS_BUILD_DIR) @rm -rf $(TOOLCHAIN_BUILD_DIR_PFX) $(STAGING_HOST_DIR_PFX) $(TOOLS_BUILD_DIR) - @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX) + @rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX) $(STAGING_JAVA_HOST_DIR) @rm -f .adkinit .config* .defconfig .tmpconfig.h all.config ${TOPDIR}/prereq.mk \ .menu ${TOPDIR}/package/Depends.mk .ADK_HAVE_DOT_CONFIG .rebuild.* @@ -474,9 +477,9 @@ _mconfig2: ${CONFIG}/conf modconfig .menu distclean: @$(MAKE) -C $(CONFIG) clean @rm -rf $(BUILD_DIR_PFX) $(BIN_DIR_PFX) $(TARGET_DIR_PFX) $(DISTDIR) \ - ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d + ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d $(JTOOLS_BUILD_DIR) @rm -rf $(TOOLCHAIN_BUILD_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(TOOLS_BUILD_DIR) - @rm -rf $(STAGING_HOST_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX) + @rm -rf $(STAGING_HOST_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX) $(STAGING_JAVA_HOST_DIR) @rm -f .adkinit .config* .defconfig .tmpconfig.h all.config ${TOPDIR}/prereq.mk \ .menu .rebuild.* ${TOPDIR}/package/Depends.mk .ADK_HAVE_DOT_CONFIG diff --git a/mk/buildhlp.mk b/mk/buildhlp.mk index 2cb4f1714..3c79fc1e8 100644 --- a/mk/buildhlp.mk +++ b/mk/buildhlp.mk @@ -47,7 +47,11 @@ ${WRKDIST}/.extract_done: ${_CHECKSUM_COOKIE} ifeq (${_CHECKSUM_COOKIE},) rm -rf ${WRKDIST} ${WRKSRC} ${WRKBUILD} endif +ifeq ($(EXTRACT_OVERRIDE),1) + ${MAKE} do-extract +else ${EXTRACT_CMD} +endif @${MAKE} post-extract $(MAKE_TRACE) touch $@ diff --git a/mk/package.mk b/mk/package.mk index 4d8383388..0bb7ead83 100644 --- a/mk/package.mk +++ b/mk/package.mk @@ -183,7 +183,7 @@ ifeq (,$(filter noremove,$(7))) fi endif @rm -f '$${STAGING_PKG_DIR}/$(1)' - @-cd $${IDIR_$(1)}; \ + -@cd $${IDIR_$(1)}; \ x=$$$$(find tmp var -mindepth 1 2>/dev/null); if [[ -n $$$$x ]]; then \ echo 'WARNING: $${IPKG_$(1)} installs files into a' \ 'ramdisk location:' >&2; \ @@ -194,7 +194,7 @@ endif -exec echo 'WARNING: $${IPKG_$(1)} installs files in /lib -' \ ' fix this!' >&2 \; -quit 2>/dev/null; fi; \ find usr ! -type d 2>/dev/null | \ - grep -E -v -e '^usr/share' -e '^usr/man' -e '^usr/info' -e '^usr/lib/libc.so' -e '^usr/lib/pkgconfig' -e '^usr/bin/[a-z0-9-]+-config' | \ + grep -E -v -e '^usr/lib/pkgconfig' -e '^usr/share' -e '^usr/doc' -e '^usr/src' -e '^usr/man' -e '^usr/info' -e '^usr/lib/libc.so' -e '^usr/bin/[a-z0-9-]+-config' | \ tee '$${STAGING_PKG_DIR}/$(1)' | \ $(TOOLS_DIR)/cpio -padlmu '$${STAGING_DIR}' @cd '$${STAGING_DIR}'; grep 'usr/lib/.*\.la$$$$' \ @@ -230,7 +230,8 @@ ifeq (,$(filter noremove,$(7))) done <'$${STAGING_PKG_DIR}/$(1)'; \ fi endif - @rm -f '$${STAGING_PKG_DIR}/$(1)' + echo "Removing:" + rm -f '$${STAGING_PKG_DIR}/$(1)' $$(INFO_$(1)): $$(IPKG_$(1)) $(PKG_INSTALL) $$(IPKG_$(1)) diff --git a/mk/pkg-bottom.mk b/mk/pkg-bottom.mk index ff7bd5638..0735a8c14 100644 --- a/mk/pkg-bottom.mk +++ b/mk/pkg-bottom.mk @@ -72,10 +72,7 @@ else ifeq ($(strip ${CONFIG_STYLE}),) done; cd ${WRKBUILD}; rm -f config.{cache,status}; \ env ${CONFIGURE_ENV} \ - ${BASH} ${WRKSRC}/${CONFIGURE_PROG} \ - --build=${GNU_HOST_NAME} \ - --host=${GNU_TARGET_NAME} \ - --target=${GNU_TARGET_NAME} \ + ${BASH} ${WRKSRC}/${CONFIGURE_PROG} ${CONFIGURE_TRIPLE} \ --program-prefix= \ --program-suffix= \ --prefix=/usr \ @@ -175,7 +172,7 @@ endif -exec echo 'WARNING: ${PKG_NAME} installs files in /lib -' \ ' fix this!' >&2 \; -quit 2>/dev/null; fi;\ find usr ! -type d 2>/dev/null | \ - grep -E -v -e '^usr/share' -e '^usr/man' -e '^usr/info' -e '^usr/lib/libc.so' -e '^usr/lib/pkgconfig' -e '^usr/bin/[a-z0-9-]+-config' | \ + grep -E -v -e '^usr/lib/pkgconfig' -e '^usr/share' -e '^usr/src' -e '^usr/doc' -e '^usr/local' -e '^usr/man' -e '^usr/info' -e '^usr/lib/libc.so' -e '^usr/bin/[a-z0-9-]+-config' -e '^/usr/lib/libpthread_nonshared.a' | \ tee '${STAGING_PKG_DIR}/${PKG_NAME}' | \ $(TOOLS_DIR)/cpio -padlmu '${STAGING_DIR}' @cd '${STAGING_DIR}'; grep 'usr/lib/.*\.la$$' \ diff --git a/mk/vars.mk b/mk/vars.mk index e5959f203..bb66a5e32 100644 --- a/mk/vars.mk +++ b/mk/vars.mk @@ -18,8 +18,9 @@ STAGING_PKG_DIR:= ${BASE_DIR}/pkg_${ADK_TARGET_SYSTEM}_${CPU_ARCH}_${ADK_TARGET_ STAGING_PKG_DIR_PFX:= ${BASE_DIR}/pkg_* STAGING_HOST_DIR:= ${BASE_DIR}/host_${CPU_ARCH}_${ADK_TARGET_LIBC} STAGING_HOST_DIR_PFX:= ${BASE_DIR}/host_* +STAGING_JAVA_HOST_DIR:= ${BASE_DIR}/jhost # use headers and foo-config from system -ifneq ($(ADK_NATIVE),) +ifeq ($(ADK_NATIVE),y) STAGING_TARGET_DIR:= SCRIPT_TARGET_DIR:= /usr/bin else @@ -34,6 +35,7 @@ STAGING_HOST2TARGET:= ../target_${CPU_ARCH}_${ADK_TARGET_LIBC} TOOLCHAIN_BUILD_DIR= $(BASE_DIR)/toolchain_build_${CPU_ARCH}_${ADK_TARGET_LIBC} TOOLCHAIN_BUILD_DIR_PFX=$(BASE_DIR)/toolchain_build_* TOOLS_BUILD_DIR= $(BASE_DIR)/tools_build +JTOOLS_BUILD_DIR= $(BASE_DIR)/jtools_build TOOLS_DIR:= $(BASE_DIR)/bin/tools SCRIPT_DIR:= $(BASE_DIR)/scripts BIN_DIR:= $(BASE_DIR)/bin/${ADK_TARGET_SYSTEM}_${CPU_ARCH}_${ADK_TARGET_LIBC} @@ -48,9 +50,11 @@ GNU_TARGET_NAME= $(CPU_ARCH)-$(ADK_VENDOR)-linux ifeq ($(ADK_NATIVE),y) TARGET_CROSS:= TARGET_COMPILER_PREFIX?= +CONFIGURE_TRIPLE:= else TARGET_CROSS:= $(STAGING_HOST_DIR)/bin/$(REAL_GNU_TARGET_NAME)- TARGET_COMPILER_PREFIX?=${TARGET_CROSS} +CONFIGURE_TRIPLE:= --build=${GNU_HOST_NAME} --host=${GNU_TARGET_NAME} --target=${GNU_TARGET_NAME} endif ifneq ($(strip ${ADK_USE_CCACHE}),) @@ -89,6 +93,7 @@ endif ifneq ($(ADK_TOOLCHAIN_GCC_USE_LTO),) TARGET_CFLAGS+= -flto +TARGET_CXXFLAGS+= -flto TARGET_LDFLAGS+= -flto endif @@ -198,7 +203,7 @@ QUIET:= else QUIET:= --quiet endif -FETCH_CMD?= wget --timeout=30 $(QUIET) +FETCH_CMD?= wget --timeout=30 -t 3 $(QUIET) ifeq ($(ADK_HOST_CYGWIN),y) EXEEXT:= .exe diff --git a/package/ConsoleKit/Makefile b/package/ConsoleKit/Makefile new file mode 100644 index 000000000..4480df4ef --- /dev/null +++ b/package/ConsoleKit/Makefile @@ -0,0 +1,25 @@ +# 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:= ConsoleKit +PKG_VERSION:= 0.4.4 +PKG_RELEASE:= 1 +PKG_MD5SUM:= b57eb18eae8c4d3631d5f4f030218a29 +PKG_DESCR:= a framework for defining and tracking users, login sessions and seats +PKG_SECTION:= misc +PKG_BUILDDEP:= dbus-glib +PKG_URL:= http://www.freedesktop.org/wiki/Software/ConsoleKit +PKG_SITES:= http://www.freedesktop.org/software/ConsoleKit/dist/ + +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,CONSOLEKIT,consolekit,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) + +consolekit-install: + $(INSTALL_DIR) $(IDIR_CONSOLEKIT)/usr/lib + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/ConsoleKit/patches/patch-config_sub b/package/ConsoleKit/patches/patch-config_sub new file mode 100644 index 000000000..de7e0d8b1 --- /dev/null +++ b/package/ConsoleKit/patches/patch-config_sub @@ -0,0 +1,243 @@ +--- ConsoleKit-0.4.4.orig/config.sub 2011-02-17 00:44:31.000000000 +0100 ++++ ConsoleKit-0.4.4/config.sub 2010-11-26 15:32:59.100676381 +0100 +@@ -1,10 +1,10 @@ + #! /bin/sh + # Configuration validation subroutine script. + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + # Free Software Foundation, Inc. + +-timestamp='2009-11-20' ++timestamp='2008-09-08' + + # This file is (in principle) common to ALL GNU software. + # The presence of a machine in this file suggests that SOME GNU software +@@ -32,16 +32,13 @@ timestamp='2009-11-20' + + + # Please send patches to <config-patches@gnu.org>. Submit a context +-# diff and a properly formatted GNU ChangeLog entry. ++# diff and a properly formatted ChangeLog entry. + # + # Configuration subroutine to validate and canonicalize a configuration type. + # Supply the specified configuration type as an argument. + # If it is invalid, we print an error message on stderr and exit with code 1. + # Otherwise, we print the canonical config type on stdout and succeed. + +-# You can get the latest version of this script from: +-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +- + # This file is supposed to be the same for all GNU packages + # and recognize all the CPU types, system types and aliases + # that are meaningful with *any* GNU software. +@@ -125,7 +122,6 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^- + case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ +- kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` +@@ -152,13 +148,10 @@ case $os in + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ +- -apple | -axis | -knuth | -cray | -microblaze) ++ -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; +- -bluegene*) +- os=-cnk +- ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 +@@ -251,12 +244,11 @@ case $basic_machine in + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ +- | d10v | d30v | dlx | dsp16xx \ ++ | d10v | d30v | dlx | dsp16xx | dvp \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ +- | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ +@@ -278,7 +270,6 @@ case $basic_machine in + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ +- | moxie \ + | mt \ + | msp430 \ + | nios | nios2 \ +@@ -287,22 +278,20 @@ case $basic_machine in + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ +- | rx \ + | score \ +- | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ ++ | sh | sh[1234] | sh[24]a | sh[24]a*eb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ +- | ubicom32 \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; +- m6811 | m68hc11 | m6812 | m68hc12 | picochip) ++ m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none +@@ -342,10 +331,9 @@ case $basic_machine in + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ +- | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ +- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ ++ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ +@@ -373,8 +361,8 @@ case $basic_machine in + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ +- | romp-* | rs6000-* | rx-* \ +- | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ ++ | romp-* | rs6000-* \ ++ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]a*eb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ +@@ -382,7 +370,6 @@ case $basic_machine in + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | tron-* \ +- | ubicom32-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ +@@ -456,10 +443,6 @@ case $basic_machine in + basic_machine=m68k-apollo + os=-bsd + ;; +- aros) +- basic_machine=i386-pc +- os=-aros +- ;; + aux) + basic_machine=m68k-apple + os=-aux +@@ -476,10 +459,6 @@ case $basic_machine in + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; +- bluegene*) +- basic_machine=powerpc-ibm +- os=-cnk +- ;; + c90) + basic_machine=c90-cray + os=-unicos +@@ -732,9 +711,6 @@ case $basic_machine in + basic_machine=ns32k-utek + os=-sysv + ;; +- microblaze) +- basic_machine=microblaze-xilinx +- ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 +@@ -750,6 +726,24 @@ case $basic_machine in + basic_machine=m68k-atari + os=-mint + ;; ++ mipsEE* | ee | ps2) ++ basic_machine=mips64r5900el-scei ++ case $os in ++ -linux*) ++ ;; ++ *) ++ os=-elf ++ ;; ++ esac ++ ;; ++ iop) ++ basic_machine=mipsel-scei ++ os=-irx ++ ;; ++ dvp) ++ basic_machine=dvp-scei ++ os=-elf ++ ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; +@@ -1206,7 +1200,7 @@ case $basic_machine in + we32k) + basic_machine=we32k-att + ;; +- sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) ++ sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) +@@ -1256,9 +1250,6 @@ case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. +- -auroraux) +- os=-auroraux +- ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; +@@ -1279,11 +1270,10 @@ case $os in + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ +- | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ +- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ +- | -sym* | -kopensolaris* \ ++ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ ++ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ +- | -aos* | -aros* \ ++ | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ +@@ -1302,7 +1292,7 @@ case $os in + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ +- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) ++ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -irx*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) +@@ -1632,7 +1622,7 @@ case $basic_machine in + -sunos*) + vendor=sun + ;; +- -cnk*|-aix*) ++ -aix*) + vendor=ibm + ;; + -beos*) diff --git a/package/ConsoleKit/patches/patch-libck-connector_ck-connector_pc_in b/package/ConsoleKit/patches/patch-libck-connector_ck-connector_pc_in new file mode 100644 index 000000000..27ad033b7 --- /dev/null +++ b/package/ConsoleKit/patches/patch-libck-connector_ck-connector_pc_in @@ -0,0 +1,11 @@ +--- ConsoleKit-0.4.4.orig/libck-connector/ck-connector.pc.in 2011-01-20 19:21:19.000000000 +0100 ++++ ConsoleKit-0.4.4/libck-connector/ck-connector.pc.in 2011-03-17 23:08:52.363370559 +0100 +@@ -1,7 +1,7 @@ + prefix=@prefix@ + exec_prefix=@prefix@ + libdir=@libdir@ +-includedir=@prefix@/include ++includedir=${prefix}/include + libexecdir=@libexecdir@ + + Name: ck-connector diff --git a/package/DirectFB/patches/patch-include_directfb_build_h b/package/DirectFB/patches/patch-include_directfb_build_h new file mode 100644 index 000000000..87eca8617 --- /dev/null +++ b/package/DirectFB/patches/patch-include_directfb_build_h @@ -0,0 +1,11 @@ +--- DirectFB-1.4.11.orig/include/directfb_build.h 2010-11-15 22:35:45.000000000 +0100 ++++ DirectFB-1.4.11/include/directfb_build.h 2011-03-28 22:30:51.451811000 +0200 +@@ -29,7 +29,7 @@ + #ifndef __DIRECTFB_BUILD_H__ + #define __DIRECTFB_BUILD_H__ + +-#define DIRECTFB_BUILD_VOODOO (1) ++#define DIRECTFB_BUILD_VOODOO (0) + #define DIRECTFB_BUILD_PURE_VOODOO (0) + + #endif /* __DIRECTFB_BUILD_H__ */ diff --git a/package/DirectFB/patches/patch-interfaces_IDirectFBImageProvider_idirectfbimageprovider_png_c b/package/DirectFB/patches/patch-interfaces_IDirectFBImageProvider_idirectfbimageprovider_png_c new file mode 100644 index 000000000..b35c6137e --- /dev/null +++ b/package/DirectFB/patches/patch-interfaces_IDirectFBImageProvider_idirectfbimageprovider_png_c @@ -0,0 +1,138 @@ +--- DirectFB-1.4.11.orig/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c 2010-10-31 09:49:49.000000000 +0100 ++++ DirectFB-1.4.11/interfaces/IDirectFBImageProvider/idirectfbimageprovider_png.c 2011-03-29 10:57:18.433069010 +0200 +@@ -207,7 +207,7 @@ Construct( IDirectFBImageProvider *thiz, + if (!data->png_ptr) + goto error; + +- if (setjmp( data->png_ptr->jmpbuf )) { ++ if (png_jmpbuf( data->png_ptr )) { + D_ERROR( "ImageProvider/PNG: Error reading header!\n" ); + goto error; + } +@@ -292,7 +292,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDi + rect = dst_data->area.wanted; + } + +- if (setjmp( data->png_ptr->jmpbuf )) { ++ if (png_jmpbuf( data->png_ptr )) { + D_ERROR( "ImageProvider/PNG: Error during decoding!\n" ); + + if (data->stage < STAGE_IMAGE) +@@ -327,6 +327,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDi + } + else { + CoreSurfaceBufferLock lock; ++ png_byte bit_depth = png_get_bit_depth( data->png_ptr, data->info_ptr ); + + ret = dfb_surface_lock_buffer( dst_surface, CSBR_BACK, CSAID_CPU, CSAF_WRITE, &lock ); + if (ret) +@@ -334,7 +335,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDi + + switch (data->color_type) { + case PNG_COLOR_TYPE_PALETTE: +- if (dst_surface->config.format == DSPF_LUT8 && data->info_ptr->bit_depth == 8) { ++ if (dst_surface->config.format == DSPF_LUT8 && bit_depth == 8) { + /* + * Special indexed PNG to LUT8 loading. + */ +@@ -377,7 +378,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDi + } + else { + if (data->color_type == PNG_COLOR_TYPE_GRAY) { +- int num = 1 << data->info_ptr->bit_depth; ++ int num = 1 << bit_depth; + + for (x=0; x<num; x++) { + int value = x * 255 / (num - 1); +@@ -386,7 +387,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDi + } + } + +- switch (data->info_ptr->bit_depth) { ++ switch (bit_depth) { + case 8: + for (y=0; y<data->height; y++) { + u8 *S = data->image + data->pitch * y; +@@ -441,7 +442,7 @@ IDirectFBImageProvider_PNG_RenderTo( IDi + + default: + D_ERROR( "ImageProvider/PNG: Unsupported indexed bit depth %d!\n", +- data->info_ptr->bit_depth ); ++ bit_depth ); + } + + dfb_scale_linear_32( image_argb, data->width, data->height, +@@ -594,16 +595,26 @@ png_info_callback( png_structp png_read_ + NULL, NULL, NULL ); + + if (png_get_valid( data->png_ptr, data->info_ptr, PNG_INFO_tRNS )) { ++ png_bytep trans; ++ png_color_16p trans_color; ++ int num_trans; ++ ++ png_get_tRNS( data->png_ptr, data->info_ptr, &trans, &num_trans, &trans_color ); ++ + data->color_keyed = true; + + /* generate color key based on palette... */ + if (data->color_type == PNG_COLOR_TYPE_PALETTE) { + u32 key; +- png_colorp palette = data->info_ptr->palette; +- png_bytep trans = data->info_ptr->trans_alpha; +- int num_colors = MIN( MAXCOLORMAPSIZE, +- data->info_ptr->num_palette ); +- u8 cmap[3][num_colors]; ++ png_colorp palette; ++ int num_colors; ++ u8 *cmap[3]; ++ ++ png_get_PLTE( data->png_ptr, data->info_ptr, &palette, &num_colors ); ++ num_colors = MIN( MAXCOLORMAPSIZE, num_colors ); ++ cmap[0] = alloca (num_colors); ++ cmap[1] = alloca (num_colors); ++ cmap[2] = alloca (num_colors); + + for (i=0; i<num_colors; i++) { + cmap[0][i] = palette[i].red; +@@ -613,7 +624,7 @@ png_info_callback( png_structp png_read_ + + key = FindColorKey( num_colors, &cmap[0][0] ); + +- for (i=0; i<data->info_ptr->num_trans; i++) { ++ for (i=0; i<num_trans; i++) { + if (!trans[i]) { + palette[i].red = (key & 0xff0000) >> 16; + palette[i].green = (key & 0x00ff00) >> 8; +@@ -625,20 +636,23 @@ png_info_callback( png_structp png_read_ + } + else { + /* ...or based on trans rgb value */ +- png_color_16p trans = &data->info_ptr->trans_color; +- +- data->color_key = (((trans->red & 0xff00) << 8) | +- ((trans->green & 0xff00)) | +- ((trans->blue & 0xff00) >> 8)); ++ data->color_key = (((trans_color->red & 0xff00) << 8) | ++ ((trans_color->green & 0xff00)) | ++ ((trans_color->blue & 0xff00) >> 8)); + } + } + + switch (data->color_type) { + case PNG_COLOR_TYPE_PALETTE: { +- png_colorp palette = data->info_ptr->palette; +- png_bytep trans = data->info_ptr->trans_alpha; +- int num_trans = data->info_ptr->num_trans; +- int num_colors = MIN( MAXCOLORMAPSIZE, data->info_ptr->num_palette ); ++ png_colorp palette; ++ png_bytep trans; ++ png_color_16p trans_color; ++ int num_trans; ++ int num_colors; ++ ++ png_get_PLTE( data->png_ptr, data->info_ptr, &palette, &num_colors ); ++ num_colors = MIN( MAXCOLORMAPSIZE, num_colors ); ++ png_get_tRNS( data->png_ptr, data->info_ptr, &trans, &num_trans, &trans_color ); + + for (i=0; i<num_colors; i++) { + data->colors[i].a = (i < num_trans) ? trans[i] : 0xff; diff --git a/package/DirectFB/patches/patch-tools_directfb-csource_c b/package/DirectFB/patches/patch-tools_directfb-csource_c new file mode 100644 index 000000000..84711d86f --- /dev/null +++ b/package/DirectFB/patches/patch-tools_directfb-csource_c @@ -0,0 +1,48 @@ +--- DirectFB-1.4.11.orig/tools/directfb-csource.c 2010-10-31 09:49:49.000000000 +0100 ++++ DirectFB-1.4.11/tools/directfb-csource.c 2011-03-29 10:57:18.453068981 +0200 +@@ -338,7 +338,7 @@ static DFBResult load_image (const char + if (!png_ptr) + goto cleanup; + +- if (setjmp (png_ptr->jmpbuf)) { ++ if (setjmp (png_jmpbuf (png_ptr))) { + if (desc->preallocated[0].data) { + free (desc->preallocated[0].data); + desc->preallocated[0].data = NULL; +@@ -405,17 +405,22 @@ static DFBResult load_image (const char + } + + switch (src_format) { +- case DSPF_LUT8: +- if (info_ptr->num_palette) { ++ case DSPF_LUT8: { ++ png_colorp png_palette; ++ int num_palette; ++ ++ png_get_PLTE( png_ptr, info_ptr, &png_palette, &num_palette ); ++ ++ if (num_palette) { + png_byte *alpha; + int i, num; + +- *palette_size = MIN (info_ptr->num_palette, 256); ++ *palette_size = MIN (num_palette, 256); + for (i = 0; i < *palette_size; i++) { + palette[i].a = 0xFF; +- palette[i].r = info_ptr->palette[i].red; +- palette[i].g = info_ptr->palette[i].green; +- palette[i].b = info_ptr->palette[i].blue; ++ palette[i].r = png_palette[i].red; ++ palette[i].g = png_palette[i].green; ++ palette[i].b = png_palette[i].blue; + } + if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) { + png_get_tRNS (png_ptr, info_ptr, &alpha, &num, NULL); +@@ -424,6 +429,7 @@ static DFBResult load_image (const char + } + } + break; ++ } + case DSPF_RGB32: + png_set_filler (png_ptr, 0xFF, + #ifdef WORDS_BIGENDIAN diff --git a/package/DirectFB/patches/patch-tools_mkdfiff_c b/package/DirectFB/patches/patch-tools_mkdfiff_c new file mode 100644 index 000000000..f321f8a84 --- /dev/null +++ b/package/DirectFB/patches/patch-tools_mkdfiff_c @@ -0,0 +1,11 @@ +--- DirectFB-1.4.11.orig/tools/mkdfiff.c 2010-10-31 09:49:49.000000000 +0100 ++++ DirectFB-1.4.11/tools/mkdfiff.c 2011-03-29 10:57:18.503068913 +0200 +@@ -97,7 +97,7 @@ load_image (const char *filen + if (!png_ptr) + goto cleanup; + +- if (setjmp (png_ptr->jmpbuf)) { ++ if (setjmp (png_jmpbuf (png_ptr))) { + if (desc->preallocated[0].data) { + free (desc->preallocated[0].data); + desc->preallocated[0].data = NULL; diff --git a/package/DirectFB/patches/patch-tools_mkdgifft_cpp b/package/DirectFB/patches/patch-tools_mkdgifft_cpp new file mode 100644 index 000000000..33e8285e9 --- /dev/null +++ b/package/DirectFB/patches/patch-tools_mkdgifft_cpp @@ -0,0 +1,11 @@ +--- DirectFB-1.4.11.orig/tools/mkdgifft.cpp 2010-10-31 09:52:08.000000000 +0100 ++++ DirectFB-1.4.11/tools/mkdgifft.cpp 2011-03-29 10:57:18.581810094 +0200 +@@ -595,7 +595,7 @@ load_image (const char *filen + if (!png_ptr) + goto cleanup; + +- if (setjmp (png_ptr->jmpbuf)) { ++ if (setjmp (png_jmpbuf (png_ptr))) { + if (desc->preallocated[0].data) { + free (desc->preallocated[0].data); + desc->preallocated[0].data = NULL; diff --git a/package/ImageMagick/Makefile b/package/ImageMagick/Makefile index fce893764..3ff05701d 100644 --- a/package/ImageMagick/Makefile +++ b/package/ImageMagick/Makefile @@ -36,6 +36,7 @@ $(eval $(call PKG_template,LIBIMAGEMAGICK,libimagemagick,$(PKG_VERSION)-${PKG_RE $(eval $(call PKG_template,CONVERT,convert,$(PKG_VERSION)-${PKG_RELEASE},${PKGSS_CONVERT},${PKGSD_CONVERT},${PKGSC_CONVERT})) $(eval $(call PKG_template,DISPLAY,display,$(PKG_VERSION)-${PKG_RELEASE},${PKGSS_DISPLAY},${PKGSD_DISPLAY},${PKGSC_DISPLAY})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --with-magick-plus-plus=no \ --without-gslib \ --without-dps \ diff --git a/package/MesaLib/Makefile b/package/MesaLib/Makefile index 3ad50203f..479ad854d 100644 --- a/package/MesaLib/Makefile +++ b/package/MesaLib/Makefile @@ -35,6 +35,8 @@ $(eval $(call PKG_template,MESALIB_DEV,mesalib-dev,$(PKG_VERSION)-${PKG_RELEASE} $(eval $(call PKG_template,GLXINFO,glxinfo,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_GLXINFO},${PKGSC_GLXINFO})) $(eval $(call PKG_template,GLXGEARS,glxgears,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_GLXGEARS},${PKGSC_GLXGEARS})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) + ifeq (${ADK_TARGET_SYSTEM_IBM_X40},y) DRI_DRIVERS:=i915 endif diff --git a/package/alsa-lib/Makefile b/package/alsa-lib/Makefile index 7ea5606fa..cddbb0e69 100644 --- a/package/alsa-lib/Makefile +++ b/package/alsa-lib/Makefile @@ -34,5 +34,7 @@ alsa-lib-dev-install: ${INSTALL_DIR} ${IDIR_ALSA_LIB_DEV}/usr/include/{sys,alsa} ${CP} ${WRKINST}/usr/include/sys/*.h ${IDIR_ALSA_LIB_DEV}/usr/include/sys ${CP} ${WRKINST}/usr/include/alsa/*.h ${IDIR_ALSA_LIB_DEV}/usr/include/alsa + ${INSTALL_DIR} ${IDIR_ALSA_LIB_DEV}/usr/lib/pkgconfig + $(CP) $(WRKINST)/usr/lib/pkgconfig/*.pc ${IDIR_ALSA_LIB_DEV}/usr/lib/pkgconfig include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/apr/Makefile b/package/apr/Makefile index 9d93e72ed..4d5f90ba2 100644 --- a/package/apr/Makefile +++ b/package/apr/Makefile @@ -25,6 +25,8 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,APR,apr,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,APR_DEV,apr-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_APR_DEV},${PKGSC_APR_DEV})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) + # uClibc setpgrp does not take arguments CONFIGURE_ENV+= ac_cv_func_setpgrp_void=yes CONFIGURE_ENV+= ac_cv_sizeof_size_t=4 diff --git a/package/avahi/patches/patch-ltmain_sh b/package/avahi/patches/patch-ltmain_sh new file mode 100644 index 000000000..ce05ad8f1 --- /dev/null +++ b/package/avahi/patches/patch-ltmain_sh @@ -0,0 +1,11 @@ +--- avahi-0.6.28.orig/ltmain.sh 2010-10-05 02:05:01.069018301 +0200 ++++ avahi-0.6.28/ltmain.sh 2011-03-25 18:53:20.684620818 +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/beecrypt/Makefile b/package/beecrypt/Makefile index 333434a37..5e1e71e50 100644 --- a/package/beecrypt/Makefile +++ b/package/beecrypt/Makefile @@ -15,13 +15,14 @@ PKG_NEED_CXX:= 1 include $(TOPDIR)/mk/package.mk -$(eval $(call PKG_template,BEECRYPT,$(PKG_NAME),$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call PKG_template,BEECRYPT,beecrypt,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --without-cplusplus \ --without-python \ --without-java -post-install: +beecrypt-install: $(INSTALL_DIR) $(IDIR_BEECRYPT)/usr/lib $(CP) $(WRKINST)/usr/lib/libbeecrypt*.so* \ $(IDIR_BEECRYPT)/usr/lib diff --git a/package/beecrypt/patches/patch-include_beecrypt_gnu_h b/package/beecrypt/patches/patch-include_beecrypt_gnu_h new file mode 100644 index 000000000..41b1f5953 --- /dev/null +++ b/package/beecrypt/patches/patch-include_beecrypt_gnu_h @@ -0,0 +1,11 @@ +--- beecrypt-4.2.1.orig/include/beecrypt/gnu.h 2009-07-12 09:19:44.000000000 +0200 ++++ beecrypt-4.2.1/include/beecrypt/gnu.h 2011-03-29 11:18:21.031808259 +0200 +@@ -72,7 +72,7 @@ typedef pthread_t bc_threadid_t; + * make assumptions about the size set by the configure script + */ + #if !defined(MP_WBITS) +-# define MP_WBITS 64U ++# define MP_WBITS 32U + #endif + + #endif diff --git a/package/beecrypt/patches/patch-ltmain_sh b/package/beecrypt/patches/patch-ltmain_sh new file mode 100644 index 000000000..f018ba5c1 --- /dev/null +++ b/package/beecrypt/patches/patch-ltmain_sh @@ -0,0 +1,11 @@ +--- beecrypt-4.2.1.orig/ltmain.sh 2009-07-11 18:02:10.000000000 +0200 ++++ beecrypt-4.2.1/ltmain.sh 2011-03-29 11:27:09.431818481 +0200 +@@ -4772,7 +4772,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/bind/Makefile b/package/bind/Makefile index dd994b87e..920aba93a 100644 --- a/package/bind/Makefile +++ b/package/bind/Makefile @@ -51,6 +51,7 @@ $(eval $(call PKG_template,BIND_HOST,bind-host,${PKG_VERSION}-${PKG_RELEASE},${P $(eval $(call PKG_template,BIND_DIG,bind-dig,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_BIND_DIG},${PKGSD_BIND_DIG},${PKGSC_BIND_DIG})) $(eval $(call PKG_template,LIBBIND,libbind,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_LIBBIND},${PKGSC_LIBBIND})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --with-randomdev=/dev/urandom \ --disable-threads \ --with-openssl=${STAGING_TARGET_DIR}/usr \ diff --git a/package/binutils/Makefile b/package/binutils/Makefile index 7bbe48e0d..96c6a4f67 100644 --- a/package/binutils/Makefile +++ b/package/binutils/Makefile @@ -19,6 +19,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,BINUTILS,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,LIBBFD,libbfd,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_LIBBFD},${PKGSC_LIBBFD})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) TARGET_CFLAGS+= -fPIC CONFIGURE_ARGS+= --disable-werror \ --host=$(REAL_GNU_TARGET_NAME) \ diff --git a/package/bluez/Makefile b/package/bluez/Makefile index aae196ad6..509520b0c 100644 --- a/package/bluez/Makefile +++ b/package/bluez/Makefile @@ -21,6 +21,7 @@ $(eval $(call PKG_template,BLUEZ,bluez,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPEN ifeq ($(ADK_STATIC),y) XAKE_FLAGS+= CCLD="$(TARGET_CC) -all-static -pthread" endif +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ENV+= ac_cv_prog_cc_pie=no CONFIGURE_ARGS+= --enable-tools \ --enable-alsa \ diff --git a/package/cairo/Makefile b/package/cairo/Makefile index a3d957acd..b15efd5e2 100644 --- a/package/cairo/Makefile +++ b/package/cairo/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= cairo -PKG_VERSION:= 1.8.10 +PKG_VERSION:= 1.10.2 PKG_RELEASE:= 1 -PKG_MD5SUM:= b60a82f405f9400bbfdcf850b1728d25 +PKG_MD5SUM:= f101a9e88b783337b20b2e26dfd26d5f PKG_DESCR:= cairo graphics library PKG_SECTION:= libs PKG_DEPENDS:= fontconfig libfreetype libpng libx11 pixman @@ -27,6 +27,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,CAIRO,cairo,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) $(eval $(call PKG_template,CAIRO_DEV,cairo-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_CAIRO_DEV},${PKGSC_CAIRO_DEV},${PKG_OPTS})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --enable-ft=yes \ --enable-xlib=yes diff --git a/package/cairo/patches/patch-src_cairo-features_h b/package/cairo/patches/patch-src_cairo-features_h deleted file mode 100644 index 6466deec7..000000000 --- a/package/cairo/patches/patch-src_cairo-features_h +++ /dev/null @@ -1,15 +0,0 @@ ---- cairo-1.8.10.orig/src/cairo-features.h 2010-02-19 22:34:38.000000000 +0100 -+++ cairo-1.8.10/src/cairo-features.h 2011-01-14 20:12:28.000000000 +0100 -@@ -10,11 +10,11 @@ - #define CAIRO_HAS_SVG_SURFACE 1 - #define CAIRO_HAS_USER_FONT 1 - #define CAIRO_HAS_XLIB_SURFACE 1 --#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1 - - /*#undef CAIRO_HAS_QUARTZ_FONT */ - /*#undef CAIRO_HAS_QUARTZ_SURFACE */ - /*#undef CAIRO_HAS_WIN32_FONT */ - /*#undef CAIRO_HAS_WIN32_SURFACE */ -+/*#undef CAIRO_HAS_XLIB_XRENDER_SURFACE */ - - #endif diff --git a/package/ccid/Makefile b/package/ccid/Makefile index 185401e79..1dfa252c0 100644 --- a/package/ccid/Makefile +++ b/package/ccid/Makefile @@ -19,6 +19,7 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,CCID,$(PKG_NAME),$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --enable-twinserial post-install: diff --git a/package/collectd/Makefile b/package/collectd/Makefile index 277e061cf..211955af9 100644 --- a/package/collectd/Makefile +++ b/package/collectd/Makefile @@ -100,6 +100,7 @@ CONFIGURE_ARGS+= --disable-apache \ --without-libiptc \ --with-nan-emulation +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) XAKE_FLAGS+= LIBS='-lm' post-install: diff --git a/package/cryptsetup/Makefile b/package/cryptsetup/Makefile index 8ab2f397d..491814c63 100644 --- a/package/cryptsetup/Makefile +++ b/package/cryptsetup/Makefile @@ -24,6 +24,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,CRYPTSETUP,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --disable-selinux \ --disable-static diff --git a/package/cups/Makefile b/package/cups/Makefile index d57bda49a..762f1832a 100644 --- a/package/cups/Makefile +++ b/package/cups/Makefile @@ -43,7 +43,11 @@ CONFIGURE_ARGS+= --with-cups-user=cups \ --disable-ssl FAKE_FLAGS+= DSTROOT="${WRKINST}" STRIP="/bin/true" +ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y) +XAKE_FLAGS+= OPTIM='-fPIC -fstack-protector' +else XAKE_FLAGS+= OPTIM='-fPIC' +endif post-install: ${INSTALL_DIR} ${IDIR_CUPS}/usr/bin diff --git a/package/curl/Makefile b/package/curl/Makefile index f360a1e6b..d189d8704 100644 --- a/package/curl/Makefile +++ b/package/curl/Makefile @@ -30,6 +30,7 @@ $(eval $(call PKG_template,CURL,curl,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS $(eval $(call PKG_template,LIBCURL,libcurl,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_LIBCURL},${PKGSD_LIBCURL},${PKGSC_LIBCURL})) $(eval $(call PKG_template,LIBCURL_DEV,libcurl-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBCURL_DEV},${PKGSC_LIBCURL_DEV})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ENV+= curl_typeof_curl_socklen_t=socklen_t CONFIGURE_ARGS+= --disable-thread \ --enable-cookies \ diff --git a/package/cxxtools/Makefile b/package/cxxtools/Makefile index 812d17ea2..916bf8c94 100644 --- a/package/cxxtools/Makefile +++ b/package/cxxtools/Makefile @@ -24,6 +24,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,CXXTOOLS,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,CXXTOOLS_DEV,${PKG_NAME}-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) ifeq (${ADK_COMPILE_CXXTOOLS_WITH_UCLIBCXX},y) TARGET_CXXFLAGS+= -fno-builtin -nostdinc++ \ -I${STAGING_TARGET_DIR}/usr/include/uClibc++ -Wl,-E diff --git a/package/cxxtools/patches/patch-ltmain_sh b/package/cxxtools/patches/patch-ltmain_sh new file mode 100644 index 000000000..e25e29b9e --- /dev/null +++ b/package/cxxtools/patches/patch-ltmain_sh @@ -0,0 +1,11 @@ +--- cxxtools-1.4.8.orig/ltmain.sh 2007-08-14 20:05:31.000000000 +0200 ++++ cxxtools-1.4.8/ltmain.sh 2011-03-28 20:40:30.691818463 +0200 +@@ -1663,7 +1663,7 @@ EOF + # -F/path gives path to uninstalled frameworks, gcc on darwin + # @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) + + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. diff --git a/package/cyrus-sasl/Makefile b/package/cyrus-sasl/Makefile index c914941e9..9fd2e6f8b 100644 --- a/package/cyrus-sasl/Makefile +++ b/package/cyrus-sasl/Makefile @@ -4,13 +4,13 @@ include ${TOPDIR}/rules.mk PKG_NAME:= cyrus-sasl -PKG_VERSION:= 2.1.22 +PKG_VERSION:= 2.1.23 PKG_RELEASE:= 1 -PKG_MD5SUM:= 45dde9d19193ae9dd388eb68b2027bc9 +PKG_MD5SUM:= 2eb0e48106f0e9cd8001e654f267ecbc PKG_DESCR:= a general purpose authentication library PKG_SECTION:= libs -PKG_DEPENDS:= libopenssl PKG_BUILDDEP:= openssl +PKG_DEPENDS:= libopenssl PKG_URL:= http://asg.web.cmu.edu/sasl/ PKG_SITES:= http://ftp.andrew.cmu.edu/pub/cyrus-mail/ PKG_NOPARALLEL:= 1 @@ -24,33 +24,34 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBSASL2,libsasl2,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,LIBSASL2_DEV,libsasl2-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBSASL2_DEV},${PKGSC_LIBSASL2_DEV})) -CONFIGURE_ARGS+= --disable-sample \ - --enable-staticdlopen \ +CONFIGURE_ARGS+= --enable-staticdlopen \ + --enable-cram \ + --enable-plain \ + --enable-anon \ + --enable-digest \ + --with-ipctype=unix \ + --with-devrandom="/dev/urandom" \ + --with-openssl="${STAGING_TARGET_DIR}/usr" \ + --disable-sample \ --disable-java \ --disable-alwaystrue \ --disable-checkapop \ - --enable-cram \ - --enable-digest \ --disable-otp \ --disable-srp \ --disable-srp-setpass \ --disable-krb4 \ --disable-gssapi \ --disable-gss_mutexes \ - --enable-plain \ - --enable-anon \ --disable-login \ --disable-ntlm \ --disable-sql \ + --disable-static \ --without-dblib \ --without-gdbm \ - --with-devrandom="/dev/urandom" \ --without-pam \ --without-saslauthd \ --without-authdaemond \ --without-pwcheck \ - --with-ipctype=unix \ - --with-openssl="${STAGING_TARGET_DIR}/usr" \ --without-des \ --without-opie \ --without-ldap \ @@ -59,8 +60,7 @@ CONFIGURE_ARGS+= --disable-sample \ --without-sqlite \ --without-rc4 \ --without-dmalloc \ - --without-sfio \ - --disable-static + --without-sfio pre-build: ${MAKE} -C ${WRKBUILD}/include \ diff --git a/package/cyrus-sasl/patches/patch-config_ltmain_sh b/package/cyrus-sasl/patches/patch-config_ltmain_sh new file mode 100644 index 000000000..01b5a992c --- /dev/null +++ b/package/cyrus-sasl/patches/patch-config_ltmain_sh @@ -0,0 +1,14 @@ +--- cyrus-sasl-2.1.23.orig/config/ltmain.sh 2003-07-02 15:29:00.000000000 +0200 ++++ cyrus-sasl-2.1.23/config/ltmain.sh 2011-03-30 21:20:59.111809629 +0200 +@@ -1081,6 +1081,11 @@ compiler." + esac + ;; + ++ -fstack-protector*|-flto*) ++ linkopts="$linkopts $arg" ++ continue ++ ;; ++ + -l*) + if test "$arg" = "-lc"; then + case "$host" in diff --git a/package/db/Makefile b/package/db/Makefile index 4b6a64643..ce03351b0 100644 --- a/package/db/Makefile +++ b/package/db/Makefile @@ -24,6 +24,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBDB,libdb,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,LIBDB_DEV,libdb-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBDB_DEV},${PKGSC_LIBDB_DEV})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_PROG:= dist/configure CONFIGURE_ARGS+= --enable-smallbuild \ --disable-debug_rop \ diff --git a/package/dbus-glib/Makefile b/package/dbus-glib/Makefile index 3ab81d067..f998edca1 100644 --- a/package/dbus-glib/Makefile +++ b/package/dbus-glib/Makefile @@ -23,6 +23,7 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,DBUS_GLIB,dbus-glib,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,DBUS_GLIB_DEV,dbus-glib-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_DBUS_GLIB_DEV},${PKGSC_DBUS_GLIB_DEV})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --disable-checks CONFIGURE_ENV+= ac_cv_have_abstract_sockets=no diff --git a/package/dbus/Makefile b/package/dbus/Makefile index fb4f05b67..a86beb442 100644 --- a/package/dbus/Makefile +++ b/package/dbus/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= dbus -PKG_VERSION:= 1.2.24 +PKG_VERSION:= 1.4.6 PKG_RELEASE:= 1 -PKG_MD5SUM:= 565346cecd9cfecf1463540c6086cc2c +PKG_MD5SUM:= 99b165f727dd8a5c4b7e2c20a8bf5db6 PKG_DESCR:= DBUS library PKG_SECTION:= libs PKG_DEPENDS:= libexpat @@ -27,11 +27,13 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,DBUS,dbus,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) $(eval $(call PKG_template,DBUS_DEV,dbus-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_DBUS_DEV},${PKGSC_DBUS_DEV},${PKG_OPTS})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --disable-tests \ --disable-abstract-sockets \ --without-x \ --enable-checks \ --with-xml=expat \ + --with-session-socket-dir=/var/tmp \ --disable-dnotify \ --disable-kqueue \ --disable-xml-docs \ diff --git a/package/dbus/files/dbus.init b/package/dbus/files/dbus.init index 4a1bac9e9..0ccdaad2a 100644 --- a/package/dbus/files/dbus.init +++ b/package/dbus/files/dbus.init @@ -11,10 +11,10 @@ autostart) ;; start) mkdir -p /var/run/dbus - /usr/sbin/dbus-daemon --config-file=/etc/dbus-1/system.conf + /usr/bin/dbus-daemon --config-file=/etc/dbus-1/system.conf ;; stop) - kill $(pgrep -f /usr/sbin/dbus-daemon) + kill $(pgrep -f /usr/bin/dbus-daemon) ;; restart) sh $0 stop diff --git a/package/dbus/patches/patch-configure b/package/dbus/patches/patch-configure deleted file mode 100644 index 18acacbc8..000000000 --- a/package/dbus/patches/patch-configure +++ /dev/null @@ -1,22 +0,0 @@ ---- dbus-1.2.24.orig/configure 2010-03-23 20:11:22.000000000 +0100 -+++ dbus-1.2.24/configure 2011-01-14 19:21:37.000000000 +0100 -@@ -25294,19 +25294,6 @@ if test "x$GCC" = "xyes"; then - ;; - esac - -- case " $CFLAGS " in -- *[\ \ ]-fPIE[\ \ ]*) ;; -- *) if cc_supports_flag -fPIE; then -- PIE_CFLAGS="-fPIE" -- if ld_supports_flag -z,relro; then -- PIE_LDFLAGS="-pie -Wl,-z,relro" -- else -- PIE_LDFLAGS="-pie" -- fi -- fi -- ;; -- esac -- - ### Disabled warnings, and compiler flag overrides - - # Let's just ignore unused for now diff --git a/package/dbus/patches/patch-ltmain_sh b/package/dbus/patches/patch-ltmain_sh deleted file mode 100644 index c594b88f2..000000000 --- a/package/dbus/patches/patch-ltmain_sh +++ /dev/null @@ -1,39 +0,0 @@ ---- dbus-1.2.24.orig/ltmain.sh 2010-03-12 23:22:29.000000000 +0100 -+++ dbus-1.2.24/ltmain.sh 2011-01-14 19:22:39.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" -@@ -5516,27 +5516,6 @@ func_mode_link () - esac - fi - -- # Hardcode the library path. -- # Skip directories that are in the system default run-time -- # search path. -- case " $sys_lib_dlsearch_path " in -- *" $absdir "*) ;; -- *) -- case "$compile_rpath " in -- *" $absdir "*) ;; -- *) compile_rpath="$compile_rpath $absdir" -- esac -- ;; -- esac -- case " $sys_lib_dlsearch_path " in -- *" $libdir "*) ;; -- *) -- case "$finalize_rpath " in -- *" $libdir "*) ;; -- *) finalize_rpath="$finalize_rpath $libdir" -- esac -- ;; -- esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && diff --git a/package/dillo/patches/patch-configure b/package/dillo/patches/patch-configure index 233acb5a8..222be7882 100644 --- a/package/dillo/patches/patch-configure +++ b/package/dillo/patches/patch-configure @@ -1,5 +1,5 @@ --- dillo-2.2.orig/configure 2010-02-11 11:19:59.000000000 +0100 -+++ dillo-2.2/configure 2011-01-07 21:35:04.000000000 +0100 ++++ dillo-2.2/configure 2011-03-28 02:30:04.373370428 +0200 @@ -5830,11 +5830,6 @@ typedef unsigned char bool_t; _______EOF @@ -12,3 +12,15 @@ for ac_func in gethostbyname do : ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" +@@ -6215,9 +6210,9 @@ if test "x$enable_png" = "xyes"; then + $as_echo_n "checking for libpng-config... " >&6; } + + if test -z "$PNG_CONFIG"; then +- PNG_CONFIG=`which libpng12-config` ++ PNG_CONFIG=`which libpng-config` + if test -z "$PNG_CONFIG"; then +- PNG_CONFIG=`which libpng-config` ++ PNG_CONFIG=`which libpng15-config` + fi + if test -z "$PNG_CONFIG"; then + PNG_CONFIG=`which libpng10-config` diff --git a/package/elinks/Makefile b/package/elinks/Makefile index ee0e2798a..f3709cd27 100644 --- a/package/elinks/Makefile +++ b/package/elinks/Makefile @@ -23,6 +23,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,ELINKS,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) INSTALL_STYLE:= manual +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) TARGET_CFLAGS+= -fPIC CONFIGURE_ENV+= $(shell echo ac_cv_file_./features.conf | tr [:blank:]-/. _)=yes CONFIGURE_ENV+= $(shell echo ac_cv_file_${WRKBUILD}/features.conf | tr [:blank:]-/. _)=yes diff --git a/package/faad2/Makefile b/package/faad2/Makefile index dab8ab734..9d2be1fe8 100644 --- a/package/faad2/Makefile +++ b/package/faad2/Makefile @@ -18,6 +18,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBFAAD2,libfaad2,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) # check for lrintf fails on Darwin, don't know why CONFIGURE_ENV+= ac_cv_c99_lrintf=yes CONFIGURE_ARGS+= --without-mpeg4ip \ diff --git a/package/ffmpeg/Makefile b/package/ffmpeg/Makefile index 9c7099d77..be732ea31 100644 --- a/package/ffmpeg/Makefile +++ b/package/ffmpeg/Makefile @@ -27,6 +27,8 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,FFMPEG,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(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_TARGET_CPU_WITH_MMX),y) CONFIGURE_CPU_OPTS:= --enable-mmx else diff --git a/package/file/patches/autotool.patch b/package/file/patches/autotool.patch index b5c145a8d..296506ea7 100644 --- a/package/file/patches/autotool.patch +++ b/package/file/patches/autotool.patch @@ -58647,7 +58647,7 @@ diff -Nur file-5.04.orig/ltmain.sh file-5.04/ltmain.sh + # -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/firefox/Makefile b/package/firefox/Makefile index 2053a117a..338821492 100644 --- a/package/firefox/Makefile +++ b/package/firefox/Makefile @@ -4,16 +4,16 @@ include $(TOPDIR)/rules.mk PKG_NAME:= firefox -PKG_VERSION:= 3.6.15 +PKG_VERSION:= 4.0 PKG_RELEASE:= 1 -PKG_MD5SUM:= fcf8042948d91f1f3d9c33599b79cf35 +PKG_MD5SUM:= 3468a2c463b4fc2788ba621e4b511c30 PKG_DESCR:= graphical webbrowser PKG_SECTION:= x11/apps -PKG_DEPENDS:= libpthread alsa-lib dbus-glib glib libgtk libnotify -PKG_DEPENDS+= nspr nss libjpeg libatk pango cairo libxt libx11 libstdcxx +PKG_DEPENDS:= libpthread alsa-lib dbus-glib glib libgtk libpng libtiff libnotify +PKG_DEPENDS+= nspr nss libjpeg libatk pango cairo libxt libx11 libstdcxx hicolor-icon-theme PKG_DEPENDS+= libxdamage libxfixes libidl libsqlite libxcomposite gdk-pixbuf -PKG_BUILDDEP:= alsa-lib dbus-glib glib gtk+ libnotify libIDL libX11 -PKG_BUILDDEP+= nspr nss jpeg libXt fontconfig sqlite atk +PKG_BUILDDEP:= alsa-lib dbus-glib glib gtk+ libIDL libX11 MesaLib libtiff gdk-pixbuf +PKG_BUILDDEP+= nspr nss jpeg libXt fontconfig sqlite atk libpng hicolor-icon-theme libnotify PKG_URL:= http://www.mozilla.org/ PKG_SITES:= http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${PKG_VERSION}/source/ PKG_NOPARALLEL:= 1 @@ -23,7 +23,7 @@ PKG_ARCH_DEPENDS:= x86 x86_64 mips mipsel mips64 mips64el native PKG_HOST_DEPENDS:= !netbsd !freebsd !openbsd !cygwin DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.source.tar.bz2 -WRKDIST= ${WRKDIR}/mozilla-1.9.2 +WRKDIST= ${WRKDIR}/mozilla-2.0 include $(TOPDIR)/mk/package.mk @@ -39,7 +39,9 @@ endif CONFIGURE_ENV+= CROSS_COMPILE=1 \ HOST_CC="${CC_FOR_BUILD}" \ + HOST_CPPFLAGS="${CPPFLAGS_FOR_BUILD}" \ HOST_CFLAGS="${CFLAGS_FOR_BUILD}" \ + HOST_LDFLAGS="${LDLAGS_FOR_BUILD}" \ HOST_CXX="${CXX_FOR_BUILD}" \ HOST_CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \ BUILD_LIBIDL_CONFIG="${BUILD_LIBIDL_CONFIG}" \ @@ -47,11 +49,16 @@ CONFIGURE_ENV+= CROSS_COMPILE=1 \ HOST_RANLIB="ranlib" HOST_AR="ar" \ CPPFLAGS="-I${STAGING_TARGET_DIR}/usr/include/freetype2" \ ac_cv_sqlite_secure_delete=yes \ + ac_cv_sqlite_threadsafe=yes \ + ac_cv_sqlite_enable_fts3=yes \ + ac_cv_sqlite_enable_unlock_notify=yes \ ac_cv_thread_keyword=no \ ac_cv_sizeof_int_p=4 CONFIGURE_ARGS+= --enable-application=browser \ --enable-official-branding \ --with-system-zlib \ + --with-system-cairo \ + --with-system-pixman \ --with-system-jpeg \ --with-system-png \ --with-system-nss \ @@ -60,6 +67,8 @@ CONFIGURE_ARGS+= --enable-application=browser \ --with-libIDL-prefix=${STAGING_TARGET_DIR}/usr \ --with-glib-prefix=${STAGING_TARGET_DIR}/usr \ --enable-libxul \ + --enable-libnotify \ + --enable-dbus \ --disable-tests \ --disable-libconic \ --disable-static \ @@ -72,7 +81,7 @@ CONFIGURE_ARGS+= --enable-application=browser \ --disable-jemalloc \ --disable-crashreporter -XAKE_FLAGS+= OS_RELEASE="2.6" +XAKE_FLAGS+= OS_RELEASE="2.6" HOST_CC=$(CC_FOR_BUILD) HOST_LDFLAGS=$(LDFLAGS_FOR_BUILD) XAKE_FLAGS+= ARCHFLAG="${TARGET_CFLAGS} ${TARGET_CPPFLAGS} ${TARGET_LDFLAGS}" firefox-install: diff --git a/package/firefox/patches/patch-configure b/package/firefox/patches/patch-configure index 6ab49e7f0..733e4aa4c 100644 --- a/package/firefox/patches/patch-configure +++ b/package/firefox/patches/patch-configure @@ -1,52 +1,45 @@ ---- mozilla-1.9.2.orig/configure 2010-12-03 16:57:11.000000000 +0100 -+++ mozilla-1.9.2/configure 2010-12-29 21:52:34.000000000 +0100 -@@ -3970,7 +3970,7 @@ else - echo "$ac_t""yes" 1>&6 - fi - -- for ac_prog in $PYTHON python2.5 python2.4 python -+ for ac_prog in $PYTHON python2.6 python2.5 python2.4 python - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 -@@ -5625,7 +5625,6 @@ DIRENT_INO=d_ino - CYGWIN_WRAPPER= - WIN_TOP_SRC= - MOZ_USER_DIR=".mozilla" --HOST_AR='$(AR)' - HOST_AR_FLAGS='$(AR_FLAGS)' - - MOZ_JPEG_CFLAGS= -@@ -17895,7 +17894,7 @@ echo "configure:17889: checking for SQLI - else - - if test "$cross_compiling" = yes; then -- ac_cv_sqlite_secure_delete=no -+ ac_cv_sqlite_secure_delete=yes - - else - cat > conftest.$ac_ext <<EOF -@@ -21460,18 +21459,11 @@ fi +--- mozilla-2.0.orig/configure 2011-03-19 00:48:56.000000000 +0100 ++++ mozilla-2.0/configure 2011-04-07 18:48:49.000000000 +0200 +@@ -1588,7 +1588,7 @@ test -n "$HOST_CXX" || HOST_CXX="""" + HOST_CXXFLAGS="$CXXFLAGS" fi + if test -z "$HOST_LDFLAGS"; then +- HOST_LDFLAGS="$LDFLAGS" ++ HOST_LDFLAGS="$LDFLAGS_FOR_BUILD" + fi + if test -z "$HOST_AR_FLAGS"; then + HOST_AR_FLAGS="$AR_FLAGS" +@@ -22573,15 +22573,6 @@ if test "${with_libIDL+set}" = set; then fi --if test -n "$CROSS_COMPILE"; then -- if test -z "$HOST_LIBIDL_CONFIG"; then + +-if test -z "$CROSS_COMPILE"; then +- if test -z "$HOST_LIBIDL_CONFIG"; then - HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG" - fi -- if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then -- HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags` -- HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs` -- else -- HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS" -- HOST_LIBIDL_LIBS="$LIBIDL_LIBS" +- if test -z "$HOST_LIBIDL_PREFIX"; then +- HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX" - fi -fi +- + if test "$SKIP_IDL_CHECK" = "no" + then + _LIBIDL_FOUND= +@@ -22788,6 +22779,7 @@ fi + fi + fi + ++ + # Check whether --with-glib-prefix or --without-glib-prefix was given. + if test "${with_glib_prefix+set}" = set; then + withval="$with_glib_prefix" +@@ -23542,6 +23534,9 @@ else + LIBIDL_LIBS="$HOST_LIBIDL_LIBS" + fi + +HOST_LIBIDL_CFLAGS=`env PKG_CONFIG_LIBDIR=${PKG_HOSTLIB_DIR} ${BUILD_LIBIDL_CONFIG} --cflags` +HOST_LIBIDL_LIBS=`env PKG_CONFIG_LIBDIR=${PKG_HOSTLIB_DIR} ${BUILD_LIBIDL_CONFIG} --libs` + -+echo "host libidl cflags: ${HOST_LIBIDL_CFLAGS}" -+echo "host libidl libs: ${HOST_LIBIDL_LIBS}" - if test -z "$SKIP_PATH_CHECKS"; then - if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then + if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then + if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then diff --git a/package/firefox/patches/patch-content_base_public_nsContentUtils_h b/package/firefox/patches/patch-content_base_public_nsContentUtils_h new file mode 100644 index 000000000..0d5d389a4 --- /dev/null +++ b/package/firefox/patches/patch-content_base_public_nsContentUtils_h @@ -0,0 +1,11 @@ +--- mozilla-2.0.orig/content/base/public/nsContentUtils.h 2011-03-19 00:33:33.000000000 +0100 ++++ mozilla-2.0/content/base/public/nsContentUtils.h 2011-03-27 21:49:48.303361341 +0200 +@@ -1942,7 +1942,7 @@ inline NS_HIDDEN_(PRBool) NS_FloatIsFini + #ifdef WIN32 + return _finite(f); + #else +- return finite(f); ++ return isfinite(f); + #endif + } + diff --git a/package/firefox/patches/patch-content_base_src_nsContentSink_cpp b/package/firefox/patches/patch-content_base_src_nsContentSink_cpp deleted file mode 100644 index a97306351..000000000 --- a/package/firefox/patches/patch-content_base_src_nsContentSink_cpp +++ /dev/null @@ -1,10 +0,0 @@ ---- mozilla-1.9.2.orig/content/base/src/nsContentSink.cpp 2010-10-27 05:01:11.000000000 +0200 -+++ mozilla-1.9.2/content/base/src/nsContentSink.cpp 2010-11-11 22:40:48.404995720 +0100 -@@ -1973,7 +1973,6 @@ nsIAtom** const kDefaultAllowedAttribute - &nsGkAtoms::nowrap, - &nsGkAtoms::open, - &nsGkAtoms::optimum, -- &nsGkAtoms::pattern, - &nsGkAtoms::placeholder, - &nsGkAtoms::pointSize, - &nsGkAtoms::prompt, diff --git a/package/firefox/patches/patch-content_canvas_src_nsCanvasRenderingContext2D_cpp b/package/firefox/patches/patch-content_canvas_src_nsCanvasRenderingContext2D_cpp new file mode 100644 index 000000000..bd9eacb42 --- /dev/null +++ b/package/firefox/patches/patch-content_canvas_src_nsCanvasRenderingContext2D_cpp @@ -0,0 +1,11 @@ +--- mozilla-2.0.orig/content/canvas/src/nsCanvasRenderingContext2D.cpp 2011-03-19 00:33:34.000000000 +0100 ++++ mozilla-2.0/content/canvas/src/nsCanvasRenderingContext2D.cpp 2011-03-27 22:36:34.953370738 +0200 +@@ -159,7 +159,7 @@ DoubleIsFinite(double d) + // NOTE: '!!' casts an int to bool without spamming MSVC warning C4800. + return !!_finite(d); + #else +- return finite(d); ++ return isfinite(d); + #endif + } + diff --git a/package/firefox/patches/patch-content_media_nsAudioStream_cpp b/package/firefox/patches/patch-content_media_nsAudioStream_cpp deleted file mode 100644 index 1452b9b6b..000000000 --- a/package/firefox/patches/patch-content_media_nsAudioStream_cpp +++ /dev/null @@ -1,11 +0,0 @@ ---- mozilla-1.9.2.orig/content/media/nsAudioStream.cpp 2010-04-02 18:02:19.000000000 +0200 -+++ mozilla-1.9.2/content/media/nsAudioStream.cpp 2010-06-11 21:28:33.522214080 +0200 -@@ -246,7 +246,7 @@ float nsAudioStream::GetPosition() - #if defined(XP_WIN) - positionType = SA_POSITION_WRITE_HARDWARE; - #endif -- PRInt64 position = 0; -+ int64_t position = 0; - if (sa_stream_get_position(static_cast<sa_stream_t*>(mAudioHandle), - positionType, &position) == SA_SUCCESS) { - return (position / float(mRate) / mChannels / sizeof(short)); diff --git a/package/firefox/patches/patch-gfx_qcms_iccread_c b/package/firefox/patches/patch-gfx_qcms_iccread_c deleted file mode 100644 index ea9ab6234..000000000 --- a/package/firefox/patches/patch-gfx_qcms_iccread_c +++ /dev/null @@ -1,18 +0,0 @@ ---- mozilla-1.9.2.orig/gfx/qcms/iccread.c 2010-04-02 18:02:27.000000000 +0200 -+++ mozilla-1.9.2/gfx/qcms/iccread.c 2010-04-30 14:00:52.430967966 +0200 -@@ -23,6 +23,7 @@ - #include <math.h> - #include <assert.h> - #include <stdlib.h> -+#include <stdio.h> - #include "qcmsint.h" - - //XXX: use a better typename -@@ -771,7 +772,6 @@ void qcms_profile_release(qcms_profile * - qcms_profile_fini(profile); - } - --#include <stdio.h> - qcms_profile* qcms_profile_from_file(FILE *file) - { - uint32_t length, remaining_length; diff --git a/package/firefox/patches/patch-gfx_qcms_qcmstypes_h b/package/firefox/patches/patch-gfx_qcms_qcmstypes_h deleted file mode 100644 index 80f68661a..000000000 --- a/package/firefox/patches/patch-gfx_qcms_qcmstypes_h +++ /dev/null @@ -1,26 +0,0 @@ ---- mozilla-1.9.2.orig/gfx/qcms/qcmstypes.h 2010-04-02 18:02:27.000000000 +0200 -+++ mozilla-1.9.2/gfx/qcms/qcmstypes.h 2010-04-30 17:58:33.490975825 +0200 -@@ -11,22 +11,12 @@ - /* int_types.h gets included somehow, so avoid redefining the types differently */ - #include <sys/int_types.h> - #else --typedef PRInt8 int8_t; --typedef PRUint8 uint8_t; --typedef PRInt16 int16_t; --typedef PRUint16 uint16_t; --typedef PRInt32 int32_t; --typedef PRUint32 uint32_t; --typedef PRInt64 int64_t; --typedef PRUint64 uint64_t; -- -+#include <stdint.h> - #ifdef __OS2__ - /* OS/2's stdlib typdefs uintptr_t. So we'll just include that so we don't collide */ - #include <stdlib.h> - #elif defined(__FreeBSD__) - /* FreeBSD typedefs uintptr_t in /usr/include/sys/types.h */ --#else --typedef PRUptrdiff uintptr_t; - #endif - #endif - diff --git a/package/firefox/patches/patch-ipc_chromium_src_base_debug_util_posix_cc b/package/firefox/patches/patch-ipc_chromium_src_base_debug_util_posix_cc index 833e94185..cc75305d9 100644 --- a/package/firefox/patches/patch-ipc_chromium_src_base_debug_util_posix_cc +++ b/package/firefox/patches/patch-ipc_chromium_src_base_debug_util_posix_cc @@ -1,29 +1,24 @@ ---- mozilla-1.9.2.orig/ipc/chromium/src/base/debug_util_posix.cc 2010-10-27 05:01:17.000000000 +0200 -+++ mozilla-1.9.2/ipc/chromium/src/base/debug_util_posix.cc 2010-11-12 11:53:10.614327269 +0100 -@@ -114,6 +114,9 @@ void DebugUtil::BreakDebugger() { - } - - StackTrace::StackTrace() { -+#ifdef CHROMIUM_MOZILLA_BUILD -+ return; -+#else +--- mozilla-2.0.orig/ipc/chromium/src/base/debug_util_posix.cc 2011-03-19 00:33:46.000000000 +0100 ++++ mozilla-2.0/ipc/chromium/src/base/debug_util_posix.cc 2011-04-07 20:17:31.000000000 +0200 +@@ -119,11 +119,7 @@ StackTrace::StackTrace() { const int kMaxCallers = 256; void* callers[kMaxCallers]; -@@ -128,11 +131,16 @@ StackTrace::StackTrace() { - } else { - trace_.resize(0); - } -+#endif - } +-#ifndef ANDROID +- int count = backtrace(callers, kMaxCallers); +-#else + int count = 0; +-#endif + + // Though the backtrace API man page does not list any possible negative + // return values, we still still exclude them because they would break the +@@ -138,9 +134,6 @@ StackTrace::StackTrace() { void StackTrace::PrintBacktrace() { -+#ifdef CHROMIUM_MOZILLA_BUILD -+ return; -+#else fflush(stderr); - backtrace_symbols_fd(&trace_[0], trace_.size(), STDERR_FILENO); -+#endif +-#ifndef ANDROID +- backtrace_symbols_fd(&trace_[0], trace_.size(), STDERR_FILENO); +-#endif } void StackTrace::OutputToStream(std::ostream* os) { diff --git a/package/firefox/patches/patch-js_src_ctypes_CTypes_cpp b/package/firefox/patches/patch-js_src_ctypes_CTypes_cpp new file mode 100644 index 000000000..0df200fbf --- /dev/null +++ b/package/firefox/patches/patch-js_src_ctypes_CTypes_cpp @@ -0,0 +1,11 @@ +--- mozilla-2.0.orig/js/src/ctypes/CTypes.cpp 2011-03-19 00:33:47.000000000 +0100 ++++ mozilla-2.0/js/src/ctypes/CTypes.cpp 2011-03-27 20:35:10.553370360 +0200 +@@ -464,7 +464,7 @@ static inline bool FloatIsFinite(jsdoubl + #ifdef WIN32 + return _finite(f) != 0; + #else +- return finite(f); ++ return isfinite(f); + #endif + } + diff --git a/package/firefox/patches/patch-js_src_jsnum_h b/package/firefox/patches/patch-js_src_jsnum_h index af999878c..54c7064cf 100644 --- a/package/firefox/patches/patch-js_src_jsnum_h +++ b/package/firefox/patches/patch-js_src_jsnum_h @@ -1,6 +1,6 @@ ---- mozilla-1.9.2.orig/js/src/jsnum.h 2010-04-02 18:02:28.000000000 +0200 -+++ mozilla-1.9.2/js/src/jsnum.h 2010-04-11 14:04:14.000000000 +0200 -@@ -98,7 +98,7 @@ JSDOUBLE_IS_FINITE(jsdouble d) +--- mozilla-2.0.orig/js/src/jsnum.h 2011-03-19 00:33:50.000000000 +0100 ++++ mozilla-2.0/js/src/jsnum.h 2011-03-27 20:18:21.253370504 +0200 +@@ -101,7 +101,7 @@ JSDOUBLE_IS_FINITE(jsdouble d) #ifdef WIN32 return _finite(d); #else diff --git a/package/firefox/patches/patch-modules_libpr0n_decoders_nsPNGDecoder_cpp b/package/firefox/patches/patch-modules_libpr0n_decoders_nsPNGDecoder_cpp new file mode 100644 index 000000000..9534c92bd --- /dev/null +++ b/package/firefox/patches/patch-modules_libpr0n_decoders_nsPNGDecoder_cpp @@ -0,0 +1,12 @@ +--- mozilla-2.0.orig/modules/libpr0n/decoders/nsPNGDecoder.cpp 2011-03-19 00:34:02.000000000 +0100 ++++ mozilla-2.0/modules/libpr0n/decoders/nsPNGDecoder.cpp 2011-03-27 22:30:41.783370593 +0200 +@@ -386,7 +386,8 @@ PNGGetColorProfile(png_structp png_ptr, + // First try to see if iCCP chunk is present + if (png_get_valid(png_ptr, info_ptr, PNG_INFO_iCCP)) { + png_uint_32 profileLen; +- char *profileData, *profileName; ++ png_byte *profileData; ++ char *profileName; + int compression; + + png_get_iCCP(png_ptr, info_ptr, &profileName, &compression, diff --git a/package/firefox/patches/patch-security_coreconf_Linux_mk b/package/firefox/patches/patch-security_coreconf_Linux_mk index 26a3dc8f3..32aaf4633 100644 --- a/package/firefox/patches/patch-security_coreconf_Linux_mk +++ b/package/firefox/patches/patch-security_coreconf_Linux_mk @@ -1,5 +1,5 @@ ---- mozilla-1.9.2.orig/security/coreconf/Linux.mk 2010-12-03 16:48:49.000000000 +0100 -+++ mozilla-1.9.2/security/coreconf/Linux.mk 2011-01-20 20:18:26.904905227 +0100 +--- mozilla-2.0.orig/security/coreconf/Linux.mk 2011-03-19 00:34:04.000000000 +0100 ++++ mozilla-2.0/security/coreconf/Linux.mk 2011-03-28 13:44:58.221818344 +0200 @@ -46,9 +46,9 @@ ifeq ($(USE_PTHREADS),1) IMPL_STRATEGY = _PTH endif diff --git a/package/firefox/patches/patch-security_coreconf_command_mk b/package/firefox/patches/patch-security_coreconf_command_mk index fcf73b8a8..3b4ddc1be 100644 --- a/package/firefox/patches/patch-security_coreconf_command_mk +++ b/package/firefox/patches/patch-security_coreconf_command_mk @@ -1,5 +1,5 @@ ---- mozilla-1.9.2.orig/security/coreconf/command.mk 2010-12-03 16:48:49.000000000 +0100 -+++ mozilla-1.9.2/security/coreconf/command.mk 2011-01-20 20:18:56.214904993 +0100 +--- mozilla-2.0.orig/security/coreconf/command.mk 2011-03-19 00:34:04.000000000 +0100 ++++ mozilla-2.0/security/coreconf/command.mk 2011-03-28 13:45:21.461818772 +0200 @@ -48,7 +48,7 @@ LINK_EXE = $(LINK) $(OS_LFLAGS) $(L CFLAGS = $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \ $(XCFLAGS) diff --git a/package/firefox/patches/patch-security_nss_lib_freebl_stubs_c b/package/firefox/patches/patch-security_nss_lib_freebl_stubs_c deleted file mode 100644 index 233823c91..000000000 --- a/package/firefox/patches/patch-security_nss_lib_freebl_stubs_c +++ /dev/null @@ -1,11 +0,0 @@ ---- mozilla-1.9.2.orig/security/nss/lib/freebl/stubs.c 2010-04-02 18:03:06.000000000 +0200 -+++ mozilla-1.9.2/security/nss/lib/freebl/stubs.c 2010-04-11 15:37:04.000000000 +0200 -@@ -530,7 +530,7 @@ freebl_InitNSSUtil(void *lib) - * fetch the library if it's loaded. For NSS it should already be loaded - */ - #define freebl_getLibrary(libName) \ -- dlopen (libName, RTLD_LAZY|RTLD_NOLOAD) -+ dlopen (libName, RTLD_LAZY) - - #define freebl_releaseLibrary(lib) \ - if (lib) dlclose(lib) diff --git a/package/firefox/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptc_platforms_unixish_x86_h b/package/firefox/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptc_platforms_unixish_x86_h new file mode 100644 index 000000000..0b2443c1e --- /dev/null +++ b/package/firefox/patches/patch-xpcom_reflect_xptcall_src_md_unix_xptc_platforms_unixish_x86_h @@ -0,0 +1,20 @@ +--- mozilla-2.0.orig/xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h 2011-03-19 00:34:13.000000000 +0100 ++++ mozilla-2.0/xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h 2011-04-07 19:02:44.000000000 +0200 +@@ -67,6 +67,9 @@ + * + */ + ++#define CFRONT_STYLE_THIS_ADJUST ++ ++#if 0 + #if defined(LINUX) || (defined(__GLIBC__) && (defined(__FreeBSD_kernel__) || defined(__GNU__))) + + #if (__GNUC__ == 2) && (__GNUC_MINOR__ <= 7) +@@ -159,6 +162,7 @@ + #else + #error "need a platform define if using unixish x86 code" + #endif ++#endif + + /***************************************************************************/ + diff --git a/package/firefox/patches/patch-xpcom_threads_nsThread_cpp b/package/firefox/patches/patch-xpcom_threads_nsThread_cpp new file mode 100644 index 000000000..ca4be566b --- /dev/null +++ b/package/firefox/patches/patch-xpcom_threads_nsThread_cpp @@ -0,0 +1,33 @@ +--- mozilla-2.0.orig/xpcom/threads/nsThread.cpp 2011-03-19 00:34:14.000000000 +0100 ++++ mozilla-2.0/xpcom/threads/nsThread.cpp 2011-03-27 21:47:15.633370362 +0200 +@@ -46,10 +46,13 @@ + #include "prlog.h" + #include "nsThreadUtilsInternal.h" + ++#include <features.h> ++ + #define HAVE_UALARM _BSD_SOURCE || (_XOPEN_SOURCE >= 500 || \ + _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED) && \ + !(_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700) + ++#if !defined(__UCLIBC__) + #if defined(XP_UNIX) && !defined(ANDROID) && !defined(DEBUG) && HAVE_UALARM \ + && defined(_GNU_SOURCE) + # define MOZ_CANARY +@@ -59,6 +62,7 @@ + # include <fcntl.h> + # include "nsXULAppAPI.h" + #endif ++#endif + + #include "mozilla/FunctionTimer.h" + #if defined(NS_FUNCTION_TIMER) && defined(_MSC_VER) +@@ -562,7 +566,7 @@ void canary_alarm_handler (int signum) + const char msg[29] = "event took too long to run:\n"; + // use write to be safe in the signal handler + write(Canary::sOutputFD, msg, sizeof(msg)); +- backtrace_symbols_fd(array, backtrace(array, 30), Canary::sOutputFD); ++ //backtrace_symbols_fd(array, backtrace(array, 30), Canary::sOutputFD); + } + + #endif diff --git a/package/fltk/Makefile b/package/fltk/Makefile index bc0607942..59c6cdcff 100644 --- a/package/fltk/Makefile +++ b/package/fltk/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 3 PKG_MD5SUM:= 557544badbacca4ee1ebb2448f6e1f8a PKG_DESCR:= fast light toolkit PKG_SECTION:= libs -PKG_BUILDDEP:= libX11 libXi MesaLib freeglut +PKG_BUILDDEP:= libX11 libXi MesaLib freeglut freetype PKG_URL:= http://www.fltk.org/ PKG_SITES:= http://ftp.funet.fi/pub/mirrors/ftp.easysw.com/pub/fltk/snapshots/ PKG_NEED_CXX:= 1 @@ -27,16 +27,18 @@ $(eval $(call PKG_template,LIBFLTK,libfltk,$(PKG_VERSION)-${PKG_RELEASE},${PKG_D LIBRARIES:=-nodefaultlibs -luClibc++ -lgcc -lm ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y) -LIBRARIES+=-lssp +LIBRARIES+=-lssp -lssp_nonshared endif +CONFIGURE_ARGS+= --disable-xinerama + ifeq ($(ADK_COMPILE_LIBFLTK_WITH_UCLIBCXX),y) -CONFIGURE_ENV+= CXXFLAGS="-fno-threadsafe-statics -fno-builtin -nostdinc++ \ +CONFIGURE_ENV+= CXXFLAGS="${TARGET_CXXFLAGS} -fno-threadsafe-statics -fno-builtin -nostdinc++ \ -I${STAGING_TARGET_DIR}/usr/include/uClibc++" \ LIBS="$(LIBRARIES)" endif -post-install: +libfltk-install: $(INSTALL_DIR) $(IDIR_LIBFLTK)/usr/lib $(CP) ${WRKINST}/usr/lib/libfltk*.so* $(IDIR_LIBFLTK)/usr/lib diff --git a/package/fltk/patches/patch-OpenGL_Makefile b/package/fltk/patches/patch-OpenGL_Makefile new file mode 100644 index 000000000..71ac77285 --- /dev/null +++ b/package/fltk/patches/patch-OpenGL_Makefile @@ -0,0 +1,11 @@ +--- fltk-2.0.x-r7513.orig/OpenGL/Makefile 2008-08-05 01:03:58.000000000 +0200 ++++ fltk-2.0.x-r7513/OpenGL/Makefile 2011-03-25 13:56:09.304620874 +0100 +@@ -102,7 +102,7 @@ include makedepend + + ../lib/$(DSONAME): $(OBJECTS) + echo $(DSOCOMMAND) $@ ... +- $(DSOCOMMAND) $@ $(OBJECTS) ++ $(DSOCOMMAND) $@ $(OBJECTS) $(LDLIBS) + $(RM) ../lib/$(DSOLINK) + $(LN) $(DSONAME) ../lib/$(DSOLINK) + diff --git a/package/fltk/patches/patch-configure b/package/fltk/patches/patch-configure index d8d16bd72..613c7b595 100644 --- a/package/fltk/patches/patch-configure +++ b/package/fltk/patches/patch-configure @@ -1,5 +1,5 @@ --- fltk-2.0.x-r7513.orig/configure 2010-04-16 10:02:53.000000000 +0200 -+++ fltk-2.0.x-r7513/configure 2010-12-05 21:10:58.000000000 +0100 ++++ fltk-2.0.x-r7513/configure 2011-03-25 13:52:41.555870814 +0100 @@ -1770,7 +1770,7 @@ FL_API_VERSION=${FL_MAJOR_VERSION}.${FL_ @@ -9,3 +9,12 @@ uversion=`uname -r | sed -e '1,$s/[^0-9]//g'` case $uname in IRIX*) +@@ -1922,7 +1922,7 @@ if test x$enable_shared = xyes; then + ;; + Linux* | *BSD*) + # DSOCOMMAND="\$(CXX) -Wl,-soname,\$@ \$(LDLIBS) -shared -fPIC $DEBUGFLAG -o" +- DSOCOMMAND="\$(CXX) \$(LDLIBS) -shared -fPIC $DEBUGFLAG -o" ++ DSOCOMMAND="\$(CXX) -shared -fPIC $DEBUGFLAG -o" + if test "$libdir" != "/usr/lib"; then + DSOLINK="-Wl,-rpath,$libdir" + fi diff --git a/package/fltk/patches/patch-images_Makefile b/package/fltk/patches/patch-images_Makefile new file mode 100644 index 000000000..ddd993d18 --- /dev/null +++ b/package/fltk/patches/patch-images_Makefile @@ -0,0 +1,11 @@ +--- fltk-2.0.x-r7513.orig/images/Makefile 2008-08-05 01:03:58.000000000 +0200 ++++ fltk-2.0.x-r7513/images/Makefile 2011-03-25 13:53:36.614620804 +0100 +@@ -109,7 +109,7 @@ include makedepend + + ../lib/$(DSONAME): $(OBJECTS) + echo $(DSOCOMMAND) $@ ... +- $(DSOCOMMAND) $@ $(OBJECTS) ++ $(DSOCOMMAND) $@ $(OBJECTS) $(LDLIBS) + $(RM) ../lib/$(DSOLINK) + $(LN) $(DSONAME) ../lib/$(DSOLINK) + diff --git a/package/fltk/patches/patch-makeinclude_in b/package/fltk/patches/patch-makeinclude_in index 7c2fd2f8b..46a7d397f 100644 --- a/package/fltk/patches/patch-makeinclude_in +++ b/package/fltk/patches/patch-makeinclude_in @@ -1,5 +1,5 @@ --- fltk-2.0.x-r7513.orig/makeinclude.in 2006-04-11 00:06:06.000000000 +0200 -+++ fltk-2.0.x-r7513/makeinclude.in 2010-06-13 17:18:11.503473158 +0200 ++++ fltk-2.0.x-r7513/makeinclude.in 2011-03-25 12:03:06.633370885 +0100 @@ -45,7 +45,7 @@ NROFF = @NROFF@ RM = rm -f RMDIR = rm -rf @@ -9,3 +9,12 @@ # compiler names: CC = @CC@ +@@ -115,7 +115,7 @@ CAT1EXT = @CAT1EXT@ + CAT3EXT = @CAT3EXT@ + + # Be quiet when building... +-.SILENT: ++#.SILENT: + + # Build commands and filename extensions... + .SUFFIXES: .0 .1 .3 .c .cxx .h .fl .man .o .z $(EXEEXT) diff --git a/package/fontconfig/Makefile b/package/fontconfig/Makefile index 691d12369..449703864 100644 --- a/package/fontconfig/Makefile +++ b/package/fontconfig/Makefile @@ -27,6 +27,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,FONTCONFIG,fontconfig,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) $(eval $(call PKG_template,FONTCONFIG_DEV,fontconfig-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_FONTCONFIG_DEV},${PKGSC_FONTCONFIG_DEV},${PKG_OPTS})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) TARGET_LDFLAGS+= -liconv CONFIGURE_ARGS+= --with-arch=${ARCH} \ --disable-docs diff --git a/package/freeradius-client/Makefile b/package/freeradius-client/Makefile index eecc9f3ee..6a38be64f 100644 --- a/package/freeradius-client/Makefile +++ b/package/freeradius-client/Makefile @@ -22,6 +22,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,FREERADIUS_CLIENT,freeradius-client,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,LIBFREERADIUS_CLIENT,libfreeradius-client,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION_LIB})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ENV+= ac_cv_func_uname=no post-install: diff --git a/package/fuse/patches/patch-include_config_h_in b/package/fuse/patches/patch-include_config_h_in new file mode 100644 index 000000000..ea12b31d2 --- /dev/null +++ b/package/fuse/patches/patch-include_config_h_in @@ -0,0 +1,25 @@ +--- fuse-2.7.4.orig/include/config.h.in 2008-07-25 20:19:18.000000000 +0200 ++++ fuse-2.7.4/include/config.h.in 2011-03-28 21:38:57.561810080 +0200 +@@ -33,10 +33,10 @@ + /* Define to 1 if you have the <string.h> header file. */ + #undef HAVE_STRING_H + +-/* Define to 1 if `st_atim' is member of `struct stat'. */ ++/* Define to 1 if `st_atim' is a member of `struct stat'. */ + #undef HAVE_STRUCT_STAT_ST_ATIM + +-/* Define to 1 if `st_atimespec' is member of `struct stat'. */ ++/* Define to 1 if `st_atimespec' is a member of `struct stat'. */ + #undef HAVE_STRUCT_STAT_ST_ATIMESPEC + + /* Define to 1 if you have the <sys/stat.h> header file. */ +@@ -76,6 +76,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/fuse/patches/patch-ltmain_sh b/package/fuse/patches/patch-ltmain_sh new file mode 100644 index 000000000..52c9d35f2 --- /dev/null +++ b/package/fuse/patches/patch-ltmain_sh @@ -0,0 +1,11 @@ +--- fuse-2.7.4.orig/ltmain.sh 2005-12-26 22:43:10.000000000 +0100 ++++ fuse-2.7.4/ltmain.sh 2011-03-28 21:40:27.271818746 +0200 +@@ -3292,7 +3292,7 @@ func_mode_link () + # compiler args for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ +- -t[45]*|-txscale*|@*) ++ -t[45]*|-txscale*|@*|-fstack-protector*|-flto) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + compile_command="$compile_command $arg" diff --git a/package/gcc/Makefile b/package/gcc/Makefile index fec6661e3..3f50b9e91 100644 --- a/package/gcc/Makefile +++ b/package/gcc/Makefile @@ -16,8 +16,9 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,GCC,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) -TARGET_CFLAGS:= '' TARGET_CPPFLAGS:= '' +TARGET_CFLAGS:= '' +TARGET_CXXFLAGS:= $(filter-out -fstack-protector,$(TARGET_CXXFLAGS)) ifeq ($(ADK_LINUX_64),y) CONFIGURE_ARGS+= --with-abi=64 diff --git a/package/gconf/Makefile b/package/gconf/Makefile index dd47682c2..6f449ec8e 100644 --- a/package/gconf/Makefile +++ b/package/gconf/Makefile @@ -10,8 +10,8 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= de83e70453910ac62f9ee2a86444bdab PKG_DESCR:= a system for storing application preferences PKG_SECTION:= libs -PKG_BUILDDEP:= dbus dbus-glib -PKG_DEPENDS:= dbus dbus-glib +PKG_BUILDDEP:= dbus dbus-glib orbit2 +PKG_DEPENDS:= dbus dbus-glib orbit2 PKG_URL:= http://projects.gnome.org/gconf/ PKG_SITES:= ftp://ftp.gnome.org//pub/GNOME/sources/GConf/${PKG_EXTRAVER}/ @@ -25,5 +25,14 @@ gconf-install: $(INSTALL_DIR) $(IDIR_GCONF)/usr/lib $(INSTALL_BIN) $(WRKINST)/usr/lib/libgconf*.so* \ $(IDIR_GCONF)/usr/lib + $(INSTALL_DIR) $(IDIR_GCONF)/usr/lib/GConf/2 + $(CP) $(WRKINST)/usr/lib/GConf/2/*.so \ + $(IDIR_GCONF)/usr/lib/GConf/2 + $(INSTALL_DIR) $(IDIR_GCONF)/usr/libexec + $(INSTALL_BIN) $(WRKINST)/usr/libexec/gconfd-2 \ + $(IDIR_GCONF)/usr/libexec + $(INSTALL_DIR) $(IDIR_GCONF)/usr/share/dbus-1/services + $(CP) $(WRKINST)/usr/share/dbus-1/services/* \ + $(IDIR_GCONF)/usr/share/dbus-1/services include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/gdb/Makefile b/package/gdb/Makefile index d14a71761..c29c48e65 100644 --- a/package/gdb/Makefile +++ b/package/gdb/Makefile @@ -16,6 +16,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,GDB,gdb,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) TARGET_CFLAGS+= ${TARGET_CPPFLAGS} -fPIC CONFIGURE_ARGS+= --without-uiout --enable-gdbmi \ --disable-tui --disable-gdbtk --without-x \ diff --git a/package/gdk-pixbuf/Makefile b/package/gdk-pixbuf/Makefile index da0d89f94..5b747b23c 100644 --- a/package/gdk-pixbuf/Makefile +++ b/package/gdk-pixbuf/Makefile @@ -4,12 +4,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:= gdk-pixbuf -PKG_VERSION:= 2.23.0 -PKG_RELEASE:= 2 -PKG_MD5SUM:= a7d6c5f2fe2d481149ed3ba807b5c043 +PKG_VERSION:= 2.23.1 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 74818d3ac4d7ebaf6bf24883c171a885 PKG_DESCR:= GDK pixbuf library -PKG_BUILDDEP:= jpeg libtiff PKG_SECTION:= libs +PKG_BUILDDEP:= jpeg libtiff PKG_SITES:= http://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/2.23/ PKG_NEED_CXX:= 1 diff --git a/package/giflib/Makefile b/package/giflib/Makefile new file mode 100644 index 000000000..1259c92f9 --- /dev/null +++ b/package/giflib/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:= giflib +PKG_VERSION:= 4.1.6 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 4ff2ecec336b9724c5190f06e8a40f9e +PKG_DESCR:= GIF graphics library +PKG_SECTION:= libs +PKG_URL:= http://sourceforge.net/projects/giflib/ +PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=giflib/giflib%204.x/$(PKG_NAME)-$(PKG_VERSION)/} + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,GIFLIB,giflib,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) + +giflib-install: + $(INSTALL_DIR) $(IDIR_GIFLIB)/usr/lib + $(INSTALL_BIN) $(WRKINST)/usr/lib/libgif.so* \ + $(IDIR_GIFLIB)/usr/lib + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/glib/Makefile b/package/glib/Makefile index e0b0d1dc6..4bd99944c 100644 --- a/package/glib/Makefile +++ b/package/glib/Makefile @@ -28,6 +28,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,GLIB,glib,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) $(eval $(call PKG_template,GLIB_DEV,glib-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_GLIB_DEV},${PKGSC_GLIB_DEV},${PKG_OPTS})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --enable-debug=no \ --disable-mem-pools \ --disable-rebuilds \ @@ -45,7 +46,6 @@ pre-configure: ifneq ($(OStype),Darwin) (cd ${WRKBUILD}; rm -rf config.{cache,status}; \ ./configure --prefix=$(STAGING_HOST_DIR) \ - --with-libiconv=gnu \ ); ${MAKE} -C ${WRKBUILD} V=1 $(CP) ${WRKBUILD}/gio/.libs/glib-compile-schemas ${STAGING_HOST_DIR}/bin diff --git a/package/gmp/patches/autotool.patch b/package/gmp/patches/autotool.patch index 07f04f08f..fe7b9eddd 100644 --- a/package/gmp/patches/autotool.patch +++ b/package/gmp/patches/autotool.patch @@ -78350,7 +78350,7 @@ diff -Nur gmp-4.3.2.orig/ltmain.sh gmp-4.3.2/ltmain.sh + # -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/gnutls/Makefile b/package/gnutls/Makefile index 2257a1596..bd4fc9f81 100644 --- a/package/gnutls/Makefile +++ b/package/gnutls/Makefile @@ -31,6 +31,7 @@ $(eval $(call PKG_template,GNUTLS_UTILS,gnutls-utils,${PKG_VERSION}-${PKG_RELEAS $(eval $(call PKG_template,LIBGNUTLS_EXTRA,libgnutls-extra,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKGSC_LIBGNUTLS_EXTRA})) $(eval $(call PKG_template,LIBGNUTLS_OPENSSL,libgnutls-openssl,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKGSC_LIBGNUTLS_OPENSSL})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --without-libopencdk-prefix \ --disable-camellia \ --with-libgcrypt-prefix=${STAGING_TARGET_DIR}/usr \ diff --git a/package/gpsd/Makefile b/package/gpsd/Makefile index 49660d151..397460f67 100644 --- a/package/gpsd/Makefile +++ b/package/gpsd/Makefile @@ -25,6 +25,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,GPSD,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,GPSD_CLIENTS,gpsd-clients,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_GPSD_CLIENTS},${PKG_SECTION})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ENV+= EGREP="grep -E" \ CPP="$(TARGET_CC) -E" \ ac_cv_func_strlcpy=no \ diff --git a/package/gtk+/Makefile b/package/gtk+/Makefile index 47fad3fa0..e1c0eb5de 100644 --- a/package/gtk+/Makefile +++ b/package/gtk+/Makefile @@ -4,10 +4,10 @@ include ${TOPDIR}/rules.mk PKG_NAME:= gtk+ -PKG_VERSION:= 2.18.6 -PKG_EXTRAVER:= 2.18 -PKG_RELEASE:= 2 -PKG_MD5SUM:= f98617af9f6be3065f64248f78dae2b7 +PKG_VERSION:= 2.24.3 +PKG_EXTRAVER:= 2.24 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 2c9f2dc5768480bedf26c6dfc3f7c254 PKG_DESCR:= GTK+ library PKG_SECTION:= libs PKG_DEPENDS:= glib diff --git a/package/gtk+/patches/patch-Makefile_in b/package/gtk+/patches/patch-Makefile_in index 5f732adc4..01b7c66da 100644 --- a/package/gtk+/patches/patch-Makefile_in +++ b/package/gtk+/patches/patch-Makefile_in @@ -1,13 +1,13 @@ ---- gtk+-2.18.6.orig/Makefile.in 2010-01-11 22:11:32.000000000 +0100 -+++ gtk+-2.18.6/Makefile.in 2011-01-19 15:27:36.616158611 +0100 -@@ -467,8 +467,8 @@ XVFB_START = \ +--- gtk+-2.24.3.orig/Makefile.in 2011-03-14 18:10:47.000000000 +0100 ++++ gtk+-2.24.3/Makefile.in 2011-03-18 00:48:15.433370501 +0100 +@@ -457,8 +457,8 @@ XVFB_START = \ || { echo "Gtk+Tests:ERROR: Failed to start Xvfb environment for X11 target tests."; exit 1; } \ && DISPLAY=:$$XID && export DISPLAY --SRC_SUBDIRS = gdk-pixbuf gdk gtk modules demos tests perf contrib --SUBDIRS = po po-properties $(SRC_SUBDIRS) docs m4macros -+SRC_SUBDIRS = gdk-pixbuf gdk gtk modules -+SUBDIRS = po po-properties $(SRC_SUBDIRS) m4macros +-SRC_SUBDIRS = gdk gtk modules demos tests perf +-SUBDIRS = po po-properties $(SRC_SUBDIRS) docs m4macros build ++SRC_SUBDIRS = gdk gtk modules perf ++SUBDIRS = po po-properties $(SRC_SUBDIRS) m4macros build # require automake 1.4 AUTOMAKE_OPTIONS = 1.7 diff --git a/package/gtk+/patches/patch-ltmain_sh b/package/gtk+/patches/patch-ltmain_sh index 77ed2f207..8104e4837 100644 --- a/package/gtk+/patches/patch-ltmain_sh +++ b/package/gtk+/patches/patch-ltmain_sh @@ -1,11 +1,11 @@ ---- gtk+-2.18.6.orig/ltmain.sh 2009-12-02 12:35:38.000000000 +0100 -+++ gtk+-2.18.6/ltmain.sh 2011-01-19 15:27:06.368658496 +0100 -@@ -4765,7 +4765,7 @@ func_mode_link () - # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC - # @file GCC response files +--- gtk+-2.24.3.orig/ltmain.sh 2011-02-08 13:25:07.000000000 +0100 ++++ gtk+-2.24.3/ltmain.sh 2011-03-18 00:44:15.143369818 +0100 +@@ -5840,7 +5840,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*|@*) -+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-fstack-protector*|-flto) + -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/heimdal/Makefile b/package/heimdal/Makefile index 68d329112..785dfeefb 100644 --- a/package/heimdal/Makefile +++ b/package/heimdal/Makefile @@ -38,6 +38,7 @@ $(eval $(call PKG_template,HEIMDAL_SERVER,heimdal-server,$(PKG_VERSION)-${PKG_RE $(eval $(call PKG_template,LIBHEIMDAL,libheimdal,$(PKG_VERSION)-${PKG_RELEASE},,${PKGSD_LIBHEIMDAL},${PKGSC_LIBHEIMDAL})) $(eval $(call PKG_template,LIBHEIMDAL_CLIENT,libheimdal-client,$(PKG_VERSION)-${PKG_RELEASE},,${PKGSD_LIBHEIMDAL_CLIENT},${PKGSC_LIBHEIMDAL_CLIENT})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_OPTS:= --with-hdbdir=/etc/heimdal \ --disable-otp \ --disable-ndbm-db \ diff --git a/package/hicolor-icon-theme/Makefile b/package/hicolor-icon-theme/Makefile new file mode 100644 index 000000000..8a8c7f658 --- /dev/null +++ b/package/hicolor-icon-theme/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:= hicolor-icon-theme +PKG_VERSION:= 0.12 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 55cafbcef8bcf7107f6d502149eb4d87 +PKG_DESCR:= Hicolor Icon Theme +PKG_SECTION:= x11/misc +PKG_URL:= http://icon-theme.freedesktop.org/ +PKG_SITES:= http://icon-theme.freedesktop.org/releases/ + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,HICOLOR_ICON_THEME,hicolor-icon-theme,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) + +hicolor-icon-theme-install: + $(INSTALL_DIR) $(IDIR_HICOLOR_ICON_THEME)/usr/share/icons + $(CP) $(WRKINST)/usr/share/icons/* \ + $(IDIR_HICOLOR_ICON_THEME)/usr/share/icons + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/imlib2/Makefile b/package/imlib2/Makefile index 166d9cd40..12deefa5f 100644 --- a/package/imlib2/Makefile +++ b/package/imlib2/Makefile @@ -16,9 +16,11 @@ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=enlightenment/} include $(TOPDIR)/mk/package.mk -$(eval $(call PKG_template,IMLIB2,$(PKG_NAME),$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call PKG_template,IMLIB2,imlib2,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -post-install: +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) + +imlib2-install: $(INSTALL_DIR) $(IDIR_IMLIB2)/usr/lib/imlib2/{filters,loaders} ${CP} $(WRKINST)/usr/lib/libImlib2.so* $(IDIR_IMLIB2)/usr/lib ${CP} $(WRKINST)/usr/lib/imlib2/filters/*.so \ diff --git a/package/imlib2/patches/patch-src_modules_loaders_loader_png_c b/package/imlib2/patches/patch-src_modules_loaders_loader_png_c new file mode 100644 index 000000000..b5bfacbf6 --- /dev/null +++ b/package/imlib2/patches/patch-src_modules_loaders_loader_png_c @@ -0,0 +1,72 @@ +--- imlib2-1.4.4.orig/src/modules/loaders/loader_png.c 2010-02-11 21:02:11.000000000 +0100 ++++ imlib2-1.4.4/src/modules/loaders/loader_png.c 2011-03-29 21:33:23.221818699 +0200 +@@ -58,7 +58,7 @@ load(ImlibImage * im, ImlibProgressFunct + fclose(f); + return 0; + } +- if (setjmp(png_ptr->jmpbuf)) ++ if (setjmp(png_jmpbuf(png_ptr))) + { + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + fclose(f); +@@ -238,7 +238,7 @@ save(ImlibImage * im, ImlibProgressFunct + png_structp png_ptr; + png_infop info_ptr; + DATA32 *ptr; +- int x, y, j; ++ int x, y, j, interlace; + png_bytep row_ptr, data = NULL; + png_color_8 sig_bit; + int pl = 0; +@@ -265,7 +265,7 @@ save(ImlibImage * im, ImlibProgressFunct + png_destroy_write_struct(&png_ptr, (png_infopp) NULL); + return 0; + } +- if (setjmp(png_ptr->jmpbuf)) ++ if (setjmp(png_jmpbuf(png_ptr))) + { + fclose(f); + png_destroy_write_struct(&png_ptr, (png_infopp) & info_ptr); +@@ -274,11 +274,11 @@ save(ImlibImage * im, ImlibProgressFunct + } + + /* check whether we should use interlacing */ ++ interlace = PNG_INTERLACE_NONE; + if ((tag = __imlib_GetTag(im, "interlacing")) && tag->val) + { + #ifdef PNG_WRITE_INTERLACING_SUPPORTED +- png_ptr->interlaced = PNG_INTERLACE_ADAM7; +- num_passes = png_set_interlace_handling(png_ptr); ++ interlace = PNG_INTERLACE_ADAM7; + #endif + } + +@@ -286,7 +286,7 @@ save(ImlibImage * im, ImlibProgressFunct + if (im->flags & F_HAS_ALPHA) + { + png_set_IHDR(png_ptr, info_ptr, im->w, im->h, 8, +- PNG_COLOR_TYPE_RGB_ALPHA, png_ptr->interlaced, ++ PNG_COLOR_TYPE_RGB_ALPHA, interlace, + PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + #ifdef WORDS_BIGENDIAN + png_set_swap_alpha(png_ptr); +@@ -297,7 +297,7 @@ save(ImlibImage * im, ImlibProgressFunct + else + { + png_set_IHDR(png_ptr, info_ptr, im->w, im->h, 8, PNG_COLOR_TYPE_RGB, +- png_ptr->interlaced, PNG_COMPRESSION_TYPE_BASE, ++ interlace, PNG_COMPRESSION_TYPE_BASE, + PNG_FILTER_TYPE_BASE); + data = malloc(im->w * 3 * sizeof(char)); + } +@@ -344,6 +344,10 @@ save(ImlibImage * im, ImlibProgressFunct + png_set_shift(png_ptr, &sig_bit); + png_set_packing(png_ptr); + ++#ifdef PNG_WRITE_INTERLACING_SUPPORTED ++ num_passes = png_set_interlace_handling(png_ptr); ++#endif ++ + for (pass = 0; pass < num_passes; pass++) + { + ptr = im->data; diff --git a/package/iperf/Makefile b/package/iperf/Makefile index b2d01f86d..154175fc5 100644 --- a/package/iperf/Makefile +++ b/package/iperf/Makefile @@ -19,6 +19,9 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,IPERF,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) +TARGET_CXXFLAGS:= $(filter-out -flto,$(TARGET_CXXFLAGS)) + ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y) TARGET_LDFLAGS+= -lssp endif diff --git a/package/ipsec-tools/Makefile b/package/ipsec-tools/Makefile index f3ed9dfa8..54f155f89 100644 --- a/package/ipsec-tools/Makefile +++ b/package/ipsec-tools/Makefile @@ -4,13 +4,13 @@ include ${TOPDIR}/rules.mk PKG_NAME:= ipsec-tools -PKG_VERSION:= 0.7.2 +PKG_VERSION:= 0.8.0 PKG_RELEASE:= 1 -PKG_MD5SUM:= 72861f005746ee27984b2ee715ecc629 +PKG_MD5SUM:= b79aae3055a51f8de5c0f1b8ca6cf619 PKG_DESCR:= IPsec management tools PKG_SECTION:= net/security -PKG_DEPENDS:= libopenssl PKG_BUILDDEP:= openssl +PKG_DEPENDS:= libopenssl PKG_URL:= http://ipsec-tools.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=ipsec-tools/} @@ -24,6 +24,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,IPSEC_TOOLS,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --with-kernel-headers="${LINUX_DIR}/include" \ --without-readline \ --disable-security-context \ diff --git a/package/ipsec-tools/patches/patch-configure b/package/ipsec-tools/patches/patch-configure index 29e65cf5b..87bfb96a4 100644 --- a/package/ipsec-tools/patches/patch-configure +++ b/package/ipsec-tools/patches/patch-configure @@ -1,7 +1,6 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- ipsec-tools-0.7.2.orig/configure 2009-04-21 16:41:45.000000000 +0200 -+++ ipsec-tools-0.7.2/configure 2009-05-29 15:28:06.991791782 +0200 -@@ -11963,7 +11963,7 @@ echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } +--- ipsec-tools-0.8.0.orig/configure 2011-03-18 14:27:41.000000000 +0100 ++++ ipsec-tools-0.8.0/configure 2011-03-31 13:16:18.091819156 +0200 +@@ -11535,7 +11535,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; } @@ -10,3 +9,30 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ case $host in *netbsd*) +@@ -12286,7 +12286,7 @@ $as_echo "$as_me: WARNING: Using a gener + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if printf accepts %z" >&5 + $as_echo_n "checking if printf accepts %z... " >&6; } + saved_CFLAGS=$CFLAGS +-CFLAGS="$CFLAGS -Wall -Werror" ++CFLAGS="$CFLAGS -Wall" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + +@@ -13739,7 +13739,7 @@ $as_echo "#define HAVE_LIBLDAP /**/" >>c + LIBS="$LIBS -L$libldap_dir/lib -R$libldap_dir/lib -lldap" + + saved_CFLAGS=$CFLAGS +- CFLAGS="$CFLAGS -Wall -Werror" ++ CFLAGS="$CFLAGS -Wall" + saved_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $CPPFLAGS_ADD" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +@@ -13852,7 +13852,7 @@ $as_echo "#define HAVE_GSSAPI /**/" >>co + + # Check if iconv 2nd argument needs const + saved_CFLAGS=$CFLAGS +- CFLAGS="$CFLAGS -Wall -Werror" ++ CFLAGS="$CFLAGS -Wall" + saved_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $CPPFLAGS_ADD" + ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default" diff --git a/package/ipsec-tools/patches/patch-ltmain_sh b/package/ipsec-tools/patches/patch-ltmain_sh index f0e98067d..9771c2407 100644 --- a/package/ipsec-tools/patches/patch-ltmain_sh +++ b/package/ipsec-tools/patches/patch-ltmain_sh @@ -1,6 +1,6 @@ ---- ipsec-tools-0.7.2.orig/ltmain.sh 2009-04-21 16:41:43.000000000 +0200 -+++ ipsec-tools-0.7.2/ltmain.sh 2011-01-15 21:50:23.000000000 +0100 -@@ -4238,7 +4238,7 @@ func_mode_link () +--- ipsec-tools-0.8.0.orig/ltmain.sh 2011-03-18 14:27:39.000000000 +0100 ++++ ipsec-tools-0.8.0/ltmain.sh 2011-03-31 13:16:42.511821748 +0200 +@@ -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*| \ diff --git a/package/ipsec-tools/patches/patch-src_racoon_algorithm_c b/package/ipsec-tools/patches/patch-src_racoon_algorithm_c index 351ce1771..82a3d057b 100644 --- a/package/ipsec-tools/patches/patch-src_racoon_algorithm_c +++ b/package/ipsec-tools/patches/patch-src_racoon_algorithm_c @@ -1,6 +1,5 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- ipsec-tools-0.7.2.orig/src/racoon/algorithm.c 2006-10-06 14:02:27.000000000 +0200 -+++ ipsec-tools-0.7.2/src/racoon/algorithm.c 2009-05-29 15:51:03.662094000 +0200 +--- ipsec-tools-0.8.0.orig/src/racoon/algorithm.c 2006-10-06 14:02:27.000000000 +0200 ++++ ipsec-tools-0.8.0/src/racoon/algorithm.c 2011-03-31 13:22:28.381818558 +0200 @@ -111,9 +111,11 @@ static struct enc_algorithm oakley_encde eay_idea_encrypt, eay_idea_decrypt, eay_idea_weakkey, eay_idea_keylen, }, diff --git a/package/ipsec-tools/patches/patch-src_racoon_cftoken_c b/package/ipsec-tools/patches/patch-src_racoon_cftoken_c deleted file mode 100644 index 29bdf1a77..000000000 --- a/package/ipsec-tools/patches/patch-src_racoon_cftoken_c +++ /dev/null @@ -1,2026 +0,0 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- ipsec-tools-0.7.2.orig/src/racoon/cftoken.c 2008-07-23 13:49:19.000000000 +0200 -+++ ipsec-tools-0.7.2/src/racoon/cftoken.c 2009-05-29 15:50:16.982910033 +0200 -@@ -8,7 +8,7 @@ - #define FLEX_SCANNER - #define YY_FLEX_MAJOR_VERSION 2 - #define YY_FLEX_MINOR_VERSION 5 --#define YY_FLEX_SUBMINOR_VERSION 34 -+#define YY_FLEX_SUBMINOR_VERSION 35 - #if YY_FLEX_SUBMINOR_VERSION > 0 - #define FLEX_BETA - #endif -@@ -178,13 +178,6 @@ extern FILE *yyin, *yyout; - - #define unput(c) yyunput( c, (yytext_ptr) ) - --/* The following is because we cannot portably get our hands on size_t -- * (without autoconf's help, which isn't available because we want -- * flex-generated scanners to compile on their own). -- * Given that the standard has decreed that size_t exists since 1989, -- * I guess we can afford to depend on it. Manoj. -- */ -- - #ifndef YY_TYPEDEF_YY_SIZE_T - #define YY_TYPEDEF_YY_SIZE_T - typedef size_t yy_size_t; -@@ -1634,6 +1627,7 @@ static struct include_stack { - static int incstackp = 0; - - static int yy_first_time = 1; -+int yywrap(void) { return 1; } - /* common seciton */ - /*octet (([01]?{digit}?{digit})|((2([0-4]{digit}))|(25[0-5]))) */ - -@@ -1642,7 +1636,7 @@ static int yy_first_time = 1; - - - --#line 1646 "cftoken.c" -+#line 1640 "cftoken.c" - - #define INITIAL 0 - #define S_INI 1 -@@ -1679,6 +1673,35 @@ static int yy_first_time = 1; - - static int yy_init_globals (void ); - -+/* Accessor methods to globals. -+ These are made visible to non-reentrant scanners for convenience. */ -+ -+int yylex_destroy (void ); -+ -+int yyget_debug (void ); -+ -+void yyset_debug (int debug_flag ); -+ -+YY_EXTRA_TYPE yyget_extra (void ); -+ -+void yyset_extra (YY_EXTRA_TYPE user_defined ); -+ -+FILE *yyget_in (void ); -+ -+void yyset_in (FILE * in_str ); -+ -+FILE *yyget_out (void ); -+ -+void yyset_out (FILE * out_str ); -+ -+int yyget_leng (void ); -+ -+char *yyget_text (void ); -+ -+int yyget_lineno (void ); -+ -+void yyset_lineno (int line_number ); -+ - /* Macros after this point can all be overridden by user definitions in - * section 1. - */ -@@ -1814,7 +1837,7 @@ YY_DECL - register char *yy_cp, *yy_bp; - register int yy_act; - --#line 142 "cftoken.l" -+#line 143 "cftoken.l" - - - if (yy_first_time) { -@@ -1824,7 +1847,7 @@ YY_DECL - - - /* privsep */ --#line 1828 "cftoken.c" -+#line 1851 "cftoken.c" - - if ( !(yy_init) ) - { -@@ -1915,1028 +1938,1028 @@ do_action: /* This label is used only to - - case 1: - YY_RULE_SETUP --#line 151 "cftoken.l" -+#line 152 "cftoken.l" - { BEGIN S_PRIV; YYDB; return(PRIVSEP); } - YY_BREAK - case 2: - YY_RULE_SETUP --#line 152 "cftoken.l" -+#line 153 "cftoken.l" - { return(BOC); } - YY_BREAK - case 3: - YY_RULE_SETUP --#line 153 "cftoken.l" -+#line 154 "cftoken.l" - { YYD; return(USER); } - YY_BREAK - case 4: - YY_RULE_SETUP --#line 154 "cftoken.l" -+#line 155 "cftoken.l" - { YYD; return(GROUP); } - YY_BREAK - case 5: - YY_RULE_SETUP --#line 155 "cftoken.l" -+#line 156 "cftoken.l" - { YYD; return(CHROOT); } - YY_BREAK - case 6: - YY_RULE_SETUP --#line 156 "cftoken.l" -+#line 157 "cftoken.l" - { BEGIN S_INI; return(EOC); } - YY_BREAK - /* path */ - case 7: - YY_RULE_SETUP --#line 159 "cftoken.l" -+#line 160 "cftoken.l" - { BEGIN S_PTH; YYDB; return(PATH); } - YY_BREAK - case 8: - YY_RULE_SETUP --#line 160 "cftoken.l" -+#line 161 "cftoken.l" - { YYD; yylval.num = LC_PATHTYPE_INCLUDE; - return(PATHTYPE); } - YY_BREAK - case 9: - YY_RULE_SETUP --#line 162 "cftoken.l" -+#line 163 "cftoken.l" - { YYD; yylval.num = LC_PATHTYPE_PSK; - return(PATHTYPE); } - YY_BREAK - case 10: - YY_RULE_SETUP --#line 164 "cftoken.l" -+#line 165 "cftoken.l" - { YYD; yylval.num = LC_PATHTYPE_CERT; - return(PATHTYPE); } - YY_BREAK - case 11: - YY_RULE_SETUP --#line 166 "cftoken.l" -+#line 167 "cftoken.l" - { YYD; yylval.num = LC_PATHTYPE_SCRIPT; - return(PATHTYPE); } - YY_BREAK - case 12: - YY_RULE_SETUP --#line 168 "cftoken.l" -+#line 169 "cftoken.l" - { YYD; yylval.num = LC_PATHTYPE_BACKUPSA; - return(PATHTYPE); } - YY_BREAK - case 13: - YY_RULE_SETUP --#line 170 "cftoken.l" -+#line 171 "cftoken.l" - { YYD; yylval.num = LC_PATHTYPE_PIDFILE; - return(PATHTYPE); } - YY_BREAK - case 14: - YY_RULE_SETUP --#line 172 "cftoken.l" -+#line 173 "cftoken.l" - { BEGIN S_INI; YYDB; return(EOS); } - YY_BREAK - /* include */ - case 15: - YY_RULE_SETUP --#line 175 "cftoken.l" -+#line 176 "cftoken.l" - { YYDB; return(INCLUDE); } - YY_BREAK - /* self information */ - case 16: - YY_RULE_SETUP --#line 178 "cftoken.l" -+#line 179 "cftoken.l" - { BEGIN S_INF; YYDB; yywarn("it is obsoleted. use \"my_identifier\" in each remote directives."); return(IDENTIFIER); } - YY_BREAK - case 17: - YY_RULE_SETUP --#line 179 "cftoken.l" -+#line 180 "cftoken.l" - { BEGIN S_INI; return(EOS); } - YY_BREAK - /* special */ - case 18: - YY_RULE_SETUP --#line 182 "cftoken.l" -+#line 183 "cftoken.l" - { YYDB; return(COMPLEX_BUNDLE); } - YY_BREAK - /* logging */ - case 19: - YY_RULE_SETUP --#line 185 "cftoken.l" -+#line 186 "cftoken.l" - { BEGIN S_LOG; YYDB; return(LOGGING); } - YY_BREAK - case 20: - YY_RULE_SETUP --#line 186 "cftoken.l" -+#line 187 "cftoken.l" - { YYD; yylval.num = LLV_ERROR; return(LOGLEV); } - YY_BREAK - case 21: - YY_RULE_SETUP --#line 187 "cftoken.l" -+#line 188 "cftoken.l" - { YYD; yylval.num = LLV_WARNING; return(LOGLEV); } - YY_BREAK - case 22: - YY_RULE_SETUP --#line 188 "cftoken.l" -+#line 189 "cftoken.l" - { YYD; yylval.num = LLV_NOTIFY; return(LOGLEV); } - YY_BREAK - case 23: - YY_RULE_SETUP --#line 189 "cftoken.l" -+#line 190 "cftoken.l" - { YYD; yylval.num = LLV_INFO; return(LOGLEV); } - YY_BREAK - case 24: - YY_RULE_SETUP --#line 190 "cftoken.l" -+#line 191 "cftoken.l" - { YYD; yylval.num = LLV_DEBUG; return(LOGLEV); } - YY_BREAK - case 25: - YY_RULE_SETUP --#line 191 "cftoken.l" -+#line 192 "cftoken.l" - { YYD; yylval.num = LLV_DEBUG2; return(LOGLEV); } - YY_BREAK - case 26: - YY_RULE_SETUP --#line 192 "cftoken.l" -+#line 193 "cftoken.l" - { YYD; yywarn("it is obsoleted. use \"debug2\""); yylval.num = LLV_DEBUG2; return(LOGLEV); } - YY_BREAK - case 27: - YY_RULE_SETUP --#line 193 "cftoken.l" -+#line 194 "cftoken.l" - { YYD; yywarn("it is obsoleted. use \"debug2\""); yylval.num = LLV_DEBUG2; return(LOGLEV); } - YY_BREAK - case 28: - YY_RULE_SETUP --#line 194 "cftoken.l" -+#line 195 "cftoken.l" - { BEGIN S_INI; return(EOS); } - YY_BREAK - /* padding */ - case 29: - YY_RULE_SETUP --#line 197 "cftoken.l" -+#line 198 "cftoken.l" - { BEGIN S_PAD; YYDB; return(PADDING); } - YY_BREAK - case 30: - YY_RULE_SETUP --#line 198 "cftoken.l" -+#line 199 "cftoken.l" - { return(BOC); } - YY_BREAK - case 31: - YY_RULE_SETUP --#line 199 "cftoken.l" -+#line 200 "cftoken.l" - { YYD; return(PAD_RANDOMIZE); } - YY_BREAK - case 32: - YY_RULE_SETUP --#line 200 "cftoken.l" -+#line 201 "cftoken.l" - { YYD; return(PAD_RANDOMIZELEN); } - YY_BREAK - case 33: - YY_RULE_SETUP --#line 201 "cftoken.l" -+#line 202 "cftoken.l" - { YYD; return(PAD_MAXLEN); } - YY_BREAK - case 34: - YY_RULE_SETUP --#line 202 "cftoken.l" -+#line 203 "cftoken.l" - { YYD; return(PAD_STRICT); } - YY_BREAK - case 35: - YY_RULE_SETUP --#line 203 "cftoken.l" -+#line 204 "cftoken.l" - { YYD; return(PAD_EXCLTAIL); } - YY_BREAK - case 36: - YY_RULE_SETUP --#line 204 "cftoken.l" -+#line 205 "cftoken.l" - { BEGIN S_INI; return(EOC); } - YY_BREAK - /* listen */ - case 37: - YY_RULE_SETUP --#line 207 "cftoken.l" -+#line 208 "cftoken.l" - { BEGIN S_LST; YYDB; return(LISTEN); } - YY_BREAK - case 38: - YY_RULE_SETUP --#line 208 "cftoken.l" -+#line 209 "cftoken.l" - { return(BOC); } - YY_BREAK - case 39: - YY_RULE_SETUP --#line 209 "cftoken.l" -+#line 210 "cftoken.l" - { YYD; return(X_ISAKMP); } - YY_BREAK - case 40: - YY_RULE_SETUP --#line 210 "cftoken.l" -+#line 211 "cftoken.l" - { YYD; return(X_ISAKMP_NATT); } - YY_BREAK - case 41: - YY_RULE_SETUP --#line 211 "cftoken.l" -+#line 212 "cftoken.l" - { YYD; return(X_ADMIN); } - YY_BREAK - case 42: - YY_RULE_SETUP --#line 212 "cftoken.l" -+#line 213 "cftoken.l" - { YYD; return(ADMINSOCK); } - YY_BREAK - case 43: - YY_RULE_SETUP --#line 213 "cftoken.l" -+#line 214 "cftoken.l" - { YYD; return(DISABLED); } - YY_BREAK - case 44: - YY_RULE_SETUP --#line 214 "cftoken.l" -+#line 215 "cftoken.l" - { YYD; return(STRICT_ADDRESS); } - YY_BREAK - case 45: - YY_RULE_SETUP --#line 215 "cftoken.l" -+#line 216 "cftoken.l" - { BEGIN S_INI; return(EOC); } - YY_BREAK - /* ldap config */ - case 46: - YY_RULE_SETUP --#line 218 "cftoken.l" -+#line 219 "cftoken.l" - { BEGIN S_LDAP; YYDB; return(LDAPCFG); } - YY_BREAK - case 47: - YY_RULE_SETUP --#line 219 "cftoken.l" -+#line 220 "cftoken.l" - { return(BOC); } - YY_BREAK - case 48: - YY_RULE_SETUP --#line 220 "cftoken.l" -+#line 221 "cftoken.l" - { YYD; return(LDAP_PVER); } - YY_BREAK - case 49: - YY_RULE_SETUP --#line 221 "cftoken.l" -+#line 222 "cftoken.l" - { YYD; return(LDAP_HOST); } - YY_BREAK - case 50: - YY_RULE_SETUP --#line 222 "cftoken.l" -+#line 223 "cftoken.l" - { YYD; return(LDAP_PORT); } - YY_BREAK - case 51: - YY_RULE_SETUP --#line 223 "cftoken.l" -+#line 224 "cftoken.l" - { YYD; return(LDAP_BASE); } - YY_BREAK - case 52: - YY_RULE_SETUP --#line 224 "cftoken.l" -+#line 225 "cftoken.l" - { YYD; return(LDAP_SUBTREE); } - YY_BREAK - case 53: - YY_RULE_SETUP --#line 225 "cftoken.l" -+#line 226 "cftoken.l" - { YYD; return(LDAP_BIND_DN); } - YY_BREAK - case 54: - YY_RULE_SETUP --#line 226 "cftoken.l" -+#line 227 "cftoken.l" - { YYD; return(LDAP_BIND_PW); } - YY_BREAK - case 55: - YY_RULE_SETUP --#line 227 "cftoken.l" -+#line 228 "cftoken.l" - { YYD; return(LDAP_ATTR_USER); } - YY_BREAK - case 56: - YY_RULE_SETUP --#line 228 "cftoken.l" -+#line 229 "cftoken.l" - { YYD; return(LDAP_ATTR_ADDR); } - YY_BREAK - case 57: - YY_RULE_SETUP --#line 229 "cftoken.l" -+#line 230 "cftoken.l" - { YYD; return(LDAP_ATTR_MASK); } - YY_BREAK - case 58: - YY_RULE_SETUP --#line 230 "cftoken.l" -+#line 231 "cftoken.l" - { YYD; return(LDAP_ATTR_GROUP); } - YY_BREAK - case 59: - YY_RULE_SETUP --#line 231 "cftoken.l" -+#line 232 "cftoken.l" - { YYD; return(LDAP_ATTR_MEMBER); } - YY_BREAK - case 60: - YY_RULE_SETUP --#line 232 "cftoken.l" -+#line 233 "cftoken.l" - { BEGIN S_INI; return(EOC); } - YY_BREAK - /* mode_cfg */ - case 61: - YY_RULE_SETUP --#line 235 "cftoken.l" -+#line 236 "cftoken.l" - { BEGIN S_CFG; YYDB; return(MODECFG); } - YY_BREAK - case 62: - YY_RULE_SETUP --#line 236 "cftoken.l" -+#line 237 "cftoken.l" - { return(BOC); } - YY_BREAK - case 63: - YY_RULE_SETUP --#line 237 "cftoken.l" -+#line 238 "cftoken.l" - { YYD; return(CFG_NET4); } - YY_BREAK - case 64: - YY_RULE_SETUP --#line 238 "cftoken.l" -+#line 239 "cftoken.l" - { YYD; return(CFG_MASK4); } - YY_BREAK - case 65: - YY_RULE_SETUP --#line 239 "cftoken.l" -+#line 240 "cftoken.l" - { YYD; return(CFG_DNS4); } - YY_BREAK - case 66: - YY_RULE_SETUP --#line 240 "cftoken.l" -+#line 241 "cftoken.l" - { YYD; return(CFG_NBNS4); } - YY_BREAK - case 67: - YY_RULE_SETUP --#line 241 "cftoken.l" -+#line 242 "cftoken.l" - { YYD; return(CFG_NBNS4); } - YY_BREAK - case 68: - YY_RULE_SETUP --#line 242 "cftoken.l" -+#line 243 "cftoken.l" - { YYD; return(CFG_DEFAULT_DOMAIN); } - YY_BREAK - case 69: - YY_RULE_SETUP --#line 243 "cftoken.l" -+#line 244 "cftoken.l" - { YYD; return(CFG_AUTH_SOURCE); } - YY_BREAK - case 70: - YY_RULE_SETUP --#line 244 "cftoken.l" -+#line 245 "cftoken.l" - { YYD; return(CFG_AUTH_GROUPS); } - YY_BREAK - case 71: - YY_RULE_SETUP --#line 245 "cftoken.l" -+#line 246 "cftoken.l" - { YYD; return(CFG_GROUP_SOURCE); } - YY_BREAK - case 72: - YY_RULE_SETUP --#line 246 "cftoken.l" -+#line 247 "cftoken.l" - { YYD; return(CFG_CONF_SOURCE); } - YY_BREAK - case 73: - YY_RULE_SETUP --#line 247 "cftoken.l" -+#line 248 "cftoken.l" - { YYD; return(CFG_ACCOUNTING); } - YY_BREAK - case 74: - YY_RULE_SETUP --#line 248 "cftoken.l" -+#line 249 "cftoken.l" - { YYD; return(CFG_SYSTEM); } - YY_BREAK - case 75: - YY_RULE_SETUP --#line 249 "cftoken.l" -+#line 250 "cftoken.l" - { YYD; return(CFG_LOCAL); } - YY_BREAK - case 76: - YY_RULE_SETUP --#line 250 "cftoken.l" -+#line 251 "cftoken.l" - { YYD; return(CFG_NONE); } - YY_BREAK - case 77: - YY_RULE_SETUP --#line 251 "cftoken.l" -+#line 252 "cftoken.l" - { YYD; return(CFG_RADIUS); } - YY_BREAK - case 78: - YY_RULE_SETUP --#line 252 "cftoken.l" -+#line 253 "cftoken.l" - { YYD; return(CFG_PAM); } - YY_BREAK - case 79: - YY_RULE_SETUP --#line 253 "cftoken.l" -+#line 254 "cftoken.l" - { YYD; return(CFG_LDAP); } - YY_BREAK - case 80: - YY_RULE_SETUP --#line 254 "cftoken.l" -+#line 255 "cftoken.l" - { YYD; return(CFG_POOL_SIZE); } - YY_BREAK - case 81: - YY_RULE_SETUP --#line 255 "cftoken.l" -+#line 256 "cftoken.l" - { YYD; return(CFG_MOTD); } - YY_BREAK - case 82: - YY_RULE_SETUP --#line 256 "cftoken.l" -+#line 257 "cftoken.l" - { YYD; return(CFG_AUTH_THROTTLE); } - YY_BREAK - case 83: - YY_RULE_SETUP --#line 257 "cftoken.l" -+#line 258 "cftoken.l" - { YYD; return(CFG_SPLIT_NETWORK); } - YY_BREAK - case 84: - YY_RULE_SETUP --#line 258 "cftoken.l" -+#line 259 "cftoken.l" - { YYD; return(CFG_SPLIT_LOCAL); } - YY_BREAK - case 85: - YY_RULE_SETUP --#line 259 "cftoken.l" -+#line 260 "cftoken.l" - { YYD; return(CFG_SPLIT_INCLUDE); } - YY_BREAK - case 86: - YY_RULE_SETUP --#line 260 "cftoken.l" -+#line 261 "cftoken.l" - { YYD; return(CFG_SPLIT_DNS); } - YY_BREAK - case 87: - YY_RULE_SETUP --#line 261 "cftoken.l" -+#line 262 "cftoken.l" - { YYD; return(CFG_PFS_GROUP); } - YY_BREAK - case 88: - YY_RULE_SETUP --#line 262 "cftoken.l" -+#line 263 "cftoken.l" - { YYD; return(CFG_SAVE_PASSWD); } - YY_BREAK - case 89: - YY_RULE_SETUP --#line 263 "cftoken.l" -+#line 264 "cftoken.l" - { YYD; return(COMMA); } - YY_BREAK - case 90: - YY_RULE_SETUP --#line 264 "cftoken.l" -+#line 265 "cftoken.l" - { BEGIN S_INI; return(EOC); } - YY_BREAK - /* timer */ - case 91: - YY_RULE_SETUP --#line 267 "cftoken.l" -+#line 268 "cftoken.l" - { BEGIN S_RTRY; YYDB; return(RETRY); } - YY_BREAK - case 92: - YY_RULE_SETUP --#line 268 "cftoken.l" -+#line 269 "cftoken.l" - { return(BOC); } - YY_BREAK - case 93: - YY_RULE_SETUP --#line 269 "cftoken.l" -+#line 270 "cftoken.l" - { YYD; return(RETRY_COUNTER); } - YY_BREAK - case 94: - YY_RULE_SETUP --#line 270 "cftoken.l" -+#line 271 "cftoken.l" - { YYD; return(RETRY_INTERVAL); } - YY_BREAK - case 95: - YY_RULE_SETUP --#line 271 "cftoken.l" -+#line 272 "cftoken.l" - { YYD; return(RETRY_PERSEND); } - YY_BREAK - case 96: - YY_RULE_SETUP --#line 272 "cftoken.l" -+#line 273 "cftoken.l" - { YYD; return(RETRY_PHASE1); } - YY_BREAK - case 97: - YY_RULE_SETUP --#line 273 "cftoken.l" -+#line 274 "cftoken.l" - { YYD; return(RETRY_PHASE2); } - YY_BREAK - case 98: - YY_RULE_SETUP --#line 274 "cftoken.l" -+#line 275 "cftoken.l" - { YYD; return(NATT_KA); } - YY_BREAK - case 99: - YY_RULE_SETUP --#line 275 "cftoken.l" -+#line 276 "cftoken.l" - { BEGIN S_INI; return(EOC); } - YY_BREAK - /* sainfo */ - case 100: - YY_RULE_SETUP --#line 278 "cftoken.l" -+#line 279 "cftoken.l" - { BEGIN S_SAINF; YYDB; return(SAINFO); } - YY_BREAK - case 101: - YY_RULE_SETUP --#line 279 "cftoken.l" -+#line 280 "cftoken.l" - { YYD; return(ANONYMOUS); } - YY_BREAK - case 102: - YY_RULE_SETUP --#line 280 "cftoken.l" -+#line 281 "cftoken.l" - { YYD; return(PORTANY); } - YY_BREAK - case 103: - YY_RULE_SETUP --#line 281 "cftoken.l" -+#line 282 "cftoken.l" - { YYD; return(ANY); } - YY_BREAK - case 104: - YY_RULE_SETUP --#line 282 "cftoken.l" -+#line 283 "cftoken.l" - { YYD; return(FROM); } - YY_BREAK - case 105: - YY_RULE_SETUP --#line 283 "cftoken.l" -+#line 284 "cftoken.l" - { YYD; return(GROUP); } - YY_BREAK - /* sainfo spec */ - case 106: - YY_RULE_SETUP --#line 285 "cftoken.l" -+#line 286 "cftoken.l" - { BEGIN S_SAINFS; return(BOC); } - YY_BREAK - case 107: - YY_RULE_SETUP --#line 286 "cftoken.l" -+#line 287 "cftoken.l" - { BEGIN S_INI; return(EOS); } - YY_BREAK - case 108: - YY_RULE_SETUP --#line 287 "cftoken.l" -+#line 288 "cftoken.l" - { BEGIN S_INI; return(EOC); } - YY_BREAK - case 109: - YY_RULE_SETUP --#line 288 "cftoken.l" -+#line 289 "cftoken.l" - { YYD; return(PFS_GROUP); } - YY_BREAK - case 110: - YY_RULE_SETUP --#line 289 "cftoken.l" -+#line 290 "cftoken.l" - { YYD; return(REMOTEID); } - YY_BREAK - case 111: - YY_RULE_SETUP --#line 290 "cftoken.l" -+#line 291 "cftoken.l" - { YYD; yywarn("it is obsoleted. use \"my_identifier\"."); return(IDENTIFIER); } - YY_BREAK - case 112: - YY_RULE_SETUP --#line 291 "cftoken.l" -+#line 292 "cftoken.l" - { YYD; return(MY_IDENTIFIER); } - YY_BREAK - case 113: - YY_RULE_SETUP --#line 292 "cftoken.l" -+#line 293 "cftoken.l" - { YYD; return(LIFETIME); } - YY_BREAK - case 114: - YY_RULE_SETUP --#line 293 "cftoken.l" -+#line 294 "cftoken.l" - { YYD; return(LIFETYPE_TIME); } - YY_BREAK - case 115: - YY_RULE_SETUP --#line 294 "cftoken.l" -+#line 295 "cftoken.l" - { YYD; return(LIFETYPE_BYTE); } - YY_BREAK - case 116: - YY_RULE_SETUP --#line 295 "cftoken.l" -+#line 296 "cftoken.l" - { YYD; yylval.num = algclass_ipsec_enc; return(ALGORITHM_CLASS); } - YY_BREAK - case 117: - YY_RULE_SETUP --#line 296 "cftoken.l" -+#line 297 "cftoken.l" - { YYD; yylval.num = algclass_ipsec_auth; return(ALGORITHM_CLASS); } - YY_BREAK - case 118: - YY_RULE_SETUP --#line 297 "cftoken.l" -+#line 298 "cftoken.l" - { YYD; yylval.num = algclass_ipsec_comp; return(ALGORITHM_CLASS); } - YY_BREAK - case 119: - YY_RULE_SETUP --#line 298 "cftoken.l" -+#line 299 "cftoken.l" - { YYD; return(COMMA); } - YY_BREAK - /* remote */ - case 120: - YY_RULE_SETUP --#line 301 "cftoken.l" -+#line 302 "cftoken.l" - { BEGIN S_RMT; YYDB; return(REMOTE); } - YY_BREAK - case 121: - YY_RULE_SETUP --#line 302 "cftoken.l" -+#line 303 "cftoken.l" - { YYD; return(ANONYMOUS); } - YY_BREAK - case 122: - YY_RULE_SETUP --#line 303 "cftoken.l" -+#line 304 "cftoken.l" - { YYD; return(INHERIT); } - YY_BREAK - /* remote spec */ - case 123: - YY_RULE_SETUP --#line 305 "cftoken.l" -+#line 306 "cftoken.l" - { BEGIN S_RMTS; return(BOC); } - YY_BREAK - case 124: - YY_RULE_SETUP --#line 306 "cftoken.l" -+#line 307 "cftoken.l" - { BEGIN S_INI; return(EOC); } - YY_BREAK - case 125: - YY_RULE_SETUP --#line 307 "cftoken.l" -+#line 308 "cftoken.l" - { YYD; return(EXCHANGE_MODE); } - YY_BREAK - case 126: - YY_RULE_SETUP --#line 308 "cftoken.l" -+#line 309 "cftoken.l" - { YYD; /* XXX ignored, but to be handled. */ ; } - YY_BREAK - case 127: - YY_RULE_SETUP --#line 309 "cftoken.l" -+#line 310 "cftoken.l" - { YYD; yylval.num = ISAKMP_ETYPE_BASE; return(EXCHANGETYPE); } - YY_BREAK - case 128: - YY_RULE_SETUP --#line 310 "cftoken.l" -+#line 311 "cftoken.l" - { YYD; yylval.num = ISAKMP_ETYPE_IDENT; return(EXCHANGETYPE); } - YY_BREAK - case 129: - YY_RULE_SETUP --#line 311 "cftoken.l" -+#line 312 "cftoken.l" - { YYD; yylval.num = ISAKMP_ETYPE_AGG; return(EXCHANGETYPE); } - YY_BREAK - case 130: - YY_RULE_SETUP --#line 312 "cftoken.l" -+#line 313 "cftoken.l" - { YYD; return(DOI); } - YY_BREAK - case 131: - YY_RULE_SETUP --#line 313 "cftoken.l" -+#line 314 "cftoken.l" - { YYD; yylval.num = IPSEC_DOI; return(DOITYPE); } - YY_BREAK - case 132: - YY_RULE_SETUP --#line 314 "cftoken.l" -+#line 315 "cftoken.l" - { YYD; return(SITUATION); } - YY_BREAK - case 133: - YY_RULE_SETUP --#line 315 "cftoken.l" -+#line 316 "cftoken.l" - { YYD; yylval.num = IPSECDOI_SIT_IDENTITY_ONLY; return(SITUATIONTYPE); } - YY_BREAK - case 134: - YY_RULE_SETUP --#line 316 "cftoken.l" -+#line 317 "cftoken.l" - { YYD; yylval.num = IPSECDOI_SIT_SECRECY; return(SITUATIONTYPE); } - YY_BREAK - case 135: - YY_RULE_SETUP --#line 317 "cftoken.l" -+#line 318 "cftoken.l" - { YYD; yylval.num = IPSECDOI_SIT_INTEGRITY; return(SITUATIONTYPE); } - YY_BREAK - case 136: - YY_RULE_SETUP --#line 318 "cftoken.l" -+#line 319 "cftoken.l" - { YYD; yywarn("it is obsoleted. use \"my_identifier\"."); return(IDENTIFIER); } - YY_BREAK - case 137: - YY_RULE_SETUP --#line 319 "cftoken.l" -+#line 320 "cftoken.l" - { YYD; return(MY_IDENTIFIER); } - YY_BREAK - case 138: - YY_RULE_SETUP --#line 320 "cftoken.l" -+#line 321 "cftoken.l" - { YYD; return(XAUTH_LOGIN); /* formerly identifier type login */ } - YY_BREAK - case 139: - YY_RULE_SETUP --#line 321 "cftoken.l" -+#line 322 "cftoken.l" - { YYD; return(PEERS_IDENTIFIER); } - YY_BREAK - case 140: - YY_RULE_SETUP --#line 322 "cftoken.l" -+#line 323 "cftoken.l" - { YYD; return(VERIFY_IDENTIFIER); } - YY_BREAK - case 141: - YY_RULE_SETUP --#line 323 "cftoken.l" -+#line 324 "cftoken.l" - { YYD; return(CERTIFICATE_TYPE); } - YY_BREAK - case 142: - YY_RULE_SETUP --#line 324 "cftoken.l" -+#line 325 "cftoken.l" - { YYD; return(CA_TYPE); } - YY_BREAK - case 143: - YY_RULE_SETUP --#line 325 "cftoken.l" -+#line 326 "cftoken.l" - { YYD; yylval.num = ISAKMP_CERT_X509SIGN; return(CERT_X509); } - YY_BREAK - case 144: - YY_RULE_SETUP --#line 326 "cftoken.l" -+#line 327 "cftoken.l" - { YYD; yylval.num = ISAKMP_CERT_PLAINRSA; return(CERT_PLAINRSA); } - YY_BREAK - case 145: - YY_RULE_SETUP --#line 327 "cftoken.l" -+#line 328 "cftoken.l" - { YYD; return(PEERS_CERTFILE); } - YY_BREAK - case 146: - YY_RULE_SETUP --#line 328 "cftoken.l" -+#line 329 "cftoken.l" - { YYD; return(DNSSEC); } - YY_BREAK - case 147: - YY_RULE_SETUP --#line 329 "cftoken.l" -+#line 330 "cftoken.l" - { YYD; return(VERIFY_CERT); } - YY_BREAK - case 148: - YY_RULE_SETUP --#line 330 "cftoken.l" -+#line 331 "cftoken.l" - { YYD; return(SEND_CERT); } - YY_BREAK - case 149: - YY_RULE_SETUP --#line 331 "cftoken.l" -+#line 332 "cftoken.l" - { YYD; return(SEND_CR); } - YY_BREAK - case 150: - YY_RULE_SETUP --#line 332 "cftoken.l" -+#line 333 "cftoken.l" - { YYD; return(DH_GROUP); } - YY_BREAK - case 151: - YY_RULE_SETUP --#line 333 "cftoken.l" -+#line 334 "cftoken.l" - { YYD; return(NONCE_SIZE); } - YY_BREAK - case 152: - YY_RULE_SETUP --#line 334 "cftoken.l" -+#line 335 "cftoken.l" - { YYD; return(GENERATE_POLICY); } - YY_BREAK - case 153: - YY_RULE_SETUP --#line 335 "cftoken.l" -+#line 336 "cftoken.l" - { YYD; yylval.num = GENERATE_POLICY_UNIQUE; return(GENERATE_LEVEL); } - YY_BREAK - case 154: - YY_RULE_SETUP --#line 336 "cftoken.l" -+#line 337 "cftoken.l" - { YYD; yylval.num = GENERATE_POLICY_REQUIRE; return(GENERATE_LEVEL); } - YY_BREAK - case 155: - YY_RULE_SETUP --#line 337 "cftoken.l" -+#line 338 "cftoken.l" - { YYD; yywarn("it is obsoleted. use \"support_proxy\"."); return(SUPPORT_PROXY); } - YY_BREAK - case 156: - YY_RULE_SETUP --#line 338 "cftoken.l" -+#line 339 "cftoken.l" - { YYD; return(SUPPORT_PROXY); } - YY_BREAK - case 157: - YY_RULE_SETUP --#line 339 "cftoken.l" -+#line 340 "cftoken.l" - { YYD; return(INITIAL_CONTACT); } - YY_BREAK - case 158: - YY_RULE_SETUP --#line 340 "cftoken.l" -+#line 341 "cftoken.l" - { YYD; return(NAT_TRAVERSAL); } - YY_BREAK - case 159: - YY_RULE_SETUP --#line 341 "cftoken.l" -+#line 342 "cftoken.l" - { YYD; return(REMOTE_FORCE_LEVEL); } - YY_BREAK - case 160: - YY_RULE_SETUP --#line 342 "cftoken.l" -+#line 343 "cftoken.l" - { YYD; return(PROPOSAL_CHECK); } - YY_BREAK - case 161: - YY_RULE_SETUP --#line 343 "cftoken.l" -+#line 344 "cftoken.l" - { YYD; yylval.num = PROP_CHECK_OBEY; return(PROPOSAL_CHECK_LEVEL); } - YY_BREAK - case 162: - YY_RULE_SETUP --#line 344 "cftoken.l" -+#line 345 "cftoken.l" - { YYD; yylval.num = PROP_CHECK_STRICT; return(PROPOSAL_CHECK_LEVEL); } - YY_BREAK - case 163: - YY_RULE_SETUP --#line 345 "cftoken.l" -+#line 346 "cftoken.l" - { YYD; yylval.num = PROP_CHECK_EXACT; return(PROPOSAL_CHECK_LEVEL); } - YY_BREAK - case 164: - YY_RULE_SETUP --#line 346 "cftoken.l" -+#line 347 "cftoken.l" - { YYD; yylval.num = PROP_CHECK_CLAIM; return(PROPOSAL_CHECK_LEVEL); } - YY_BREAK - case 165: - YY_RULE_SETUP --#line 347 "cftoken.l" -+#line 348 "cftoken.l" - { YYD; return(KEEPALIVE); } - YY_BREAK - case 166: - YY_RULE_SETUP --#line 348 "cftoken.l" -+#line 349 "cftoken.l" - { YYD; return(PASSIVE); } - YY_BREAK - case 167: - YY_RULE_SETUP --#line 349 "cftoken.l" -+#line 350 "cftoken.l" - { YYD; return(LIFETIME); } - YY_BREAK - case 168: - YY_RULE_SETUP --#line 350 "cftoken.l" -+#line 351 "cftoken.l" - { YYD; return(LIFETYPE_TIME); } - YY_BREAK - case 169: - YY_RULE_SETUP --#line 351 "cftoken.l" -+#line 352 "cftoken.l" - { YYD; return(LIFETYPE_BYTE); } - YY_BREAK - case 170: - YY_RULE_SETUP --#line 352 "cftoken.l" -+#line 353 "cftoken.l" - { YYD; return(DPD); } - YY_BREAK - case 171: - YY_RULE_SETUP --#line 353 "cftoken.l" -+#line 354 "cftoken.l" - { YYD; return(DPD_DELAY); } - YY_BREAK - case 172: - YY_RULE_SETUP --#line 354 "cftoken.l" -+#line 355 "cftoken.l" - { YYD; return(DPD_RETRY); } - YY_BREAK - case 173: - YY_RULE_SETUP --#line 355 "cftoken.l" -+#line 356 "cftoken.l" - { YYD; return(DPD_MAXFAIL); } - YY_BREAK - case 174: - YY_RULE_SETUP --#line 356 "cftoken.l" -+#line 357 "cftoken.l" - { YYD; return(PH1ID); } - YY_BREAK - case 175: - YY_RULE_SETUP --#line 357 "cftoken.l" -+#line 358 "cftoken.l" - { YYD; return(IKE_FRAG); } - YY_BREAK - case 176: - YY_RULE_SETUP --#line 358 "cftoken.l" -+#line 359 "cftoken.l" - { YYD; return(ESP_FRAG); } - YY_BREAK - case 177: - YY_RULE_SETUP --#line 359 "cftoken.l" -+#line 360 "cftoken.l" - { YYD; return(SCRIPT); } - YY_BREAK - case 178: - YY_RULE_SETUP --#line 360 "cftoken.l" -+#line 361 "cftoken.l" - { YYD; return(PHASE1_UP); } - YY_BREAK - case 179: - YY_RULE_SETUP --#line 361 "cftoken.l" -+#line 362 "cftoken.l" - { YYD; return(PHASE1_DOWN); } - YY_BREAK - case 180: - YY_RULE_SETUP --#line 362 "cftoken.l" -+#line 363 "cftoken.l" - { YYD; return(MODE_CFG); } - YY_BREAK - case 181: - YY_RULE_SETUP --#line 363 "cftoken.l" -+#line 364 "cftoken.l" - { YYD; return(WEAK_PHASE1_CHECK); } - YY_BREAK - /* remote proposal */ - case 182: - YY_RULE_SETUP --#line 365 "cftoken.l" -+#line 366 "cftoken.l" - { BEGIN S_RMTP; YYDB; return(PROPOSAL); } - YY_BREAK - case 183: - YY_RULE_SETUP --#line 366 "cftoken.l" -+#line 367 "cftoken.l" - { return(BOC); } - YY_BREAK - case 184: - YY_RULE_SETUP --#line 367 "cftoken.l" -+#line 368 "cftoken.l" - { BEGIN S_RMTS; return(EOC); } - YY_BREAK - case 185: - YY_RULE_SETUP --#line 368 "cftoken.l" -+#line 369 "cftoken.l" - { YYD; return(LIFETIME); } - YY_BREAK - case 186: - YY_RULE_SETUP --#line 369 "cftoken.l" -+#line 370 "cftoken.l" - { YYD; return(LIFETYPE_TIME); } - YY_BREAK - case 187: - YY_RULE_SETUP --#line 370 "cftoken.l" -+#line 371 "cftoken.l" - { YYD; return(LIFETYPE_BYTE); } - YY_BREAK - case 188: - YY_RULE_SETUP --#line 371 "cftoken.l" -+#line 372 "cftoken.l" - { YYD; yylval.num = algclass_isakmp_enc; return(ALGORITHM_CLASS); } - YY_BREAK - case 189: - YY_RULE_SETUP --#line 372 "cftoken.l" -+#line 373 "cftoken.l" - { YYD; yylval.num = algclass_isakmp_ameth; return(ALGORITHM_CLASS); } - YY_BREAK - case 190: - YY_RULE_SETUP --#line 373 "cftoken.l" -+#line 374 "cftoken.l" - { YYD; yylval.num = algclass_isakmp_hash; return(ALGORITHM_CLASS); } - YY_BREAK - case 191: - YY_RULE_SETUP --#line 374 "cftoken.l" -+#line 375 "cftoken.l" - { YYD; return(DH_GROUP); } - YY_BREAK - case 192: - YY_RULE_SETUP --#line 375 "cftoken.l" -+#line 376 "cftoken.l" - { YYD; return(GSS_ID); } - YY_BREAK - case 193: - YY_RULE_SETUP --#line 376 "cftoken.l" -+#line 377 "cftoken.l" - { YYD; return(GSS_ID); } /* for back compatibility */ - YY_BREAK - /* GSS ID encoding type (global) */ - case 194: - YY_RULE_SETUP --#line 379 "cftoken.l" -+#line 380 "cftoken.l" - { BEGIN S_GSSENC; YYDB; return(GSS_ID_ENC); } - YY_BREAK - case 195: - YY_RULE_SETUP --#line 380 "cftoken.l" -+#line 381 "cftoken.l" - { YYD; yylval.num = LC_GSSENC_LATIN1; - return(GSS_ID_ENCTYPE); } - YY_BREAK - case 196: - YY_RULE_SETUP --#line 382 "cftoken.l" -+#line 383 "cftoken.l" - { YYD; yylval.num = LC_GSSENC_UTF16LE; - return(GSS_ID_ENCTYPE); } - YY_BREAK - case 197: - YY_RULE_SETUP --#line 384 "cftoken.l" -+#line 385 "cftoken.l" - { BEGIN S_INI; YYDB; return(EOS); } - YY_BREAK - /* parameter */ - case 198: - YY_RULE_SETUP --#line 387 "cftoken.l" -+#line 388 "cftoken.l" - { YYD; yylval.num = TRUE; return(SWITCH); } - YY_BREAK - case 199: - YY_RULE_SETUP --#line 388 "cftoken.l" -+#line 389 "cftoken.l" - { YYD; yylval.num = FALSE; return(SWITCH); } - YY_BREAK - /* prefix */ - case 200: - YY_RULE_SETUP --#line 391 "cftoken.l" -+#line 392 "cftoken.l" - { - YYD; - yytext++; -@@ -2947,7 +2970,7 @@ YY_RULE_SETUP - /* port number */ - case 201: - YY_RULE_SETUP --#line 399 "cftoken.l" -+#line 400 "cftoken.l" - { - char *p = yytext; - YYD; -@@ -2961,7 +2984,7 @@ YY_RULE_SETUP - /* address range */ - case 202: - YY_RULE_SETUP --#line 410 "cftoken.l" -+#line 411 "cftoken.l" - { - YYD; - yytext++; -@@ -2977,318 +3000,318 @@ YY_RULE_SETUP - /* upper protocol */ - case 203: - YY_RULE_SETUP --#line 423 "cftoken.l" -+#line 424 "cftoken.l" - { YYD; yylval.num = IPPROTO_ESP; return(UL_PROTO); } - YY_BREAK - case 204: - YY_RULE_SETUP --#line 424 "cftoken.l" -+#line 425 "cftoken.l" - { YYD; yylval.num = IPPROTO_AH; return(UL_PROTO); } - YY_BREAK - case 205: - YY_RULE_SETUP --#line 425 "cftoken.l" -+#line 426 "cftoken.l" - { YYD; yylval.num = IPPROTO_IPCOMP; return(UL_PROTO); } - YY_BREAK - case 206: - YY_RULE_SETUP --#line 426 "cftoken.l" -+#line 427 "cftoken.l" - { YYD; yylval.num = IPPROTO_ICMP; return(UL_PROTO); } - YY_BREAK - case 207: - YY_RULE_SETUP --#line 427 "cftoken.l" -+#line 428 "cftoken.l" - { YYD; yylval.num = IPPROTO_ICMPV6; return(UL_PROTO); } - YY_BREAK - case 208: - YY_RULE_SETUP --#line 428 "cftoken.l" -+#line 429 "cftoken.l" - { YYD; yylval.num = IPPROTO_TCP; return(UL_PROTO); } - YY_BREAK - case 209: - YY_RULE_SETUP --#line 429 "cftoken.l" -+#line 430 "cftoken.l" - { YYD; yylval.num = IPPROTO_UDP; return(UL_PROTO); } - YY_BREAK - /* algorithm type */ - case 210: - YY_RULE_SETUP --#line 432 "cftoken.l" -+#line 433 "cftoken.l" - { YYD; yylval.num = algtype_des_iv64; return(ALGORITHMTYPE); } - YY_BREAK - case 211: - YY_RULE_SETUP --#line 433 "cftoken.l" -+#line 434 "cftoken.l" - { YYD; yylval.num = algtype_des; return(ALGORITHMTYPE); } - YY_BREAK - case 212: - YY_RULE_SETUP --#line 434 "cftoken.l" -+#line 435 "cftoken.l" - { YYD; yylval.num = algtype_3des; return(ALGORITHMTYPE); } - YY_BREAK - case 213: - YY_RULE_SETUP --#line 435 "cftoken.l" -+#line 436 "cftoken.l" - { YYD; yylval.num = algtype_rc5; return(ALGORITHMTYPE); } - YY_BREAK - case 214: - YY_RULE_SETUP --#line 436 "cftoken.l" -+#line 437 "cftoken.l" - { YYD; yylval.num = algtype_idea; return(ALGORITHMTYPE); } - YY_BREAK - case 215: - YY_RULE_SETUP --#line 437 "cftoken.l" -+#line 438 "cftoken.l" - { YYD; yylval.num = algtype_cast128; return(ALGORITHMTYPE); } - YY_BREAK - case 216: - YY_RULE_SETUP --#line 438 "cftoken.l" -+#line 439 "cftoken.l" - { YYD; yylval.num = algtype_blowfish; return(ALGORITHMTYPE); } - YY_BREAK - case 217: - YY_RULE_SETUP --#line 439 "cftoken.l" -+#line 440 "cftoken.l" - { YYD; yylval.num = algtype_3idea; return(ALGORITHMTYPE); } - YY_BREAK - case 218: - YY_RULE_SETUP --#line 440 "cftoken.l" -+#line 441 "cftoken.l" - { YYD; yylval.num = algtype_des_iv32; return(ALGORITHMTYPE); } - YY_BREAK - case 219: - YY_RULE_SETUP --#line 441 "cftoken.l" -+#line 442 "cftoken.l" - { YYD; yylval.num = algtype_rc4; return(ALGORITHMTYPE); } - YY_BREAK - case 220: - YY_RULE_SETUP --#line 442 "cftoken.l" -+#line 443 "cftoken.l" - { YYD; yylval.num = algtype_null_enc; return(ALGORITHMTYPE); } - YY_BREAK - case 221: - YY_RULE_SETUP --#line 443 "cftoken.l" -+#line 444 "cftoken.l" - { YYD; yylval.num = algtype_null_enc; return(ALGORITHMTYPE); } - YY_BREAK - case 222: - YY_RULE_SETUP --#line 444 "cftoken.l" -+#line 445 "cftoken.l" - { YYD; yylval.num = algtype_aes; return(ALGORITHMTYPE); } - YY_BREAK - case 223: - YY_RULE_SETUP --#line 445 "cftoken.l" -+#line 446 "cftoken.l" - { YYD; yylval.num = algtype_aes; return(ALGORITHMTYPE); } - YY_BREAK - case 224: - YY_RULE_SETUP --#line 446 "cftoken.l" -+#line 447 "cftoken.l" - { YYD; yylval.num = algtype_twofish; return(ALGORITHMTYPE); } - YY_BREAK - case 225: - YY_RULE_SETUP --#line 447 "cftoken.l" -+#line 448 "cftoken.l" - { YYD; yylval.num = algtype_camellia; return(ALGORITHMTYPE); } - YY_BREAK - case 226: - YY_RULE_SETUP --#line 448 "cftoken.l" -+#line 449 "cftoken.l" - { YYD; yylval.num = algtype_non_auth; return(ALGORITHMTYPE); } - YY_BREAK - case 227: - YY_RULE_SETUP --#line 449 "cftoken.l" -+#line 450 "cftoken.l" - { YYD; yylval.num = algtype_hmac_md5; return(ALGORITHMTYPE); } - YY_BREAK - case 228: - YY_RULE_SETUP --#line 450 "cftoken.l" -+#line 451 "cftoken.l" - { YYD; yylval.num = algtype_hmac_sha1; return(ALGORITHMTYPE); } - YY_BREAK - case 229: - YY_RULE_SETUP --#line 451 "cftoken.l" -+#line 452 "cftoken.l" - { YYD; yylval.num = algtype_hmac_sha2_256; return(ALGORITHMTYPE); } - YY_BREAK - case 230: - YY_RULE_SETUP --#line 452 "cftoken.l" -+#line 453 "cftoken.l" - { YYD; yylval.num = algtype_hmac_sha2_256; return(ALGORITHMTYPE); } - YY_BREAK - case 231: - YY_RULE_SETUP --#line 453 "cftoken.l" -+#line 454 "cftoken.l" - { YYD; yylval.num = algtype_hmac_sha2_384; return(ALGORITHMTYPE); } - YY_BREAK - case 232: - YY_RULE_SETUP --#line 454 "cftoken.l" -+#line 455 "cftoken.l" - { YYD; yylval.num = algtype_hmac_sha2_384; return(ALGORITHMTYPE); } - YY_BREAK - case 233: - YY_RULE_SETUP --#line 455 "cftoken.l" -+#line 456 "cftoken.l" - { YYD; yylval.num = algtype_hmac_sha2_512; return(ALGORITHMTYPE); } - YY_BREAK - case 234: - YY_RULE_SETUP --#line 456 "cftoken.l" -+#line 457 "cftoken.l" - { YYD; yylval.num = algtype_hmac_sha2_512; return(ALGORITHMTYPE); } - YY_BREAK - case 235: - YY_RULE_SETUP --#line 457 "cftoken.l" -+#line 458 "cftoken.l" - { YYD; yylval.num = algtype_des_mac; return(ALGORITHMTYPE); } - YY_BREAK - case 236: - YY_RULE_SETUP --#line 458 "cftoken.l" -+#line 459 "cftoken.l" - { YYD; yylval.num = algtype_kpdk; return(ALGORITHMTYPE); } - YY_BREAK - case 237: - YY_RULE_SETUP --#line 459 "cftoken.l" -+#line 460 "cftoken.l" - { YYD; yylval.num = algtype_md5; return(ALGORITHMTYPE); } - YY_BREAK - case 238: - YY_RULE_SETUP --#line 460 "cftoken.l" -+#line 461 "cftoken.l" - { YYD; yylval.num = algtype_sha1; return(ALGORITHMTYPE); } - YY_BREAK - case 239: - YY_RULE_SETUP --#line 461 "cftoken.l" -+#line 462 "cftoken.l" - { YYD; yylval.num = algtype_tiger; return(ALGORITHMTYPE); } - YY_BREAK - case 240: - YY_RULE_SETUP --#line 462 "cftoken.l" -+#line 463 "cftoken.l" - { YYD; yylval.num = algtype_sha2_256; return(ALGORITHMTYPE); } - YY_BREAK - case 241: - YY_RULE_SETUP --#line 463 "cftoken.l" -+#line 464 "cftoken.l" - { YYD; yylval.num = algtype_sha2_256; return(ALGORITHMTYPE); } - YY_BREAK - case 242: - YY_RULE_SETUP --#line 464 "cftoken.l" -+#line 465 "cftoken.l" - { YYD; yylval.num = algtype_sha2_384; return(ALGORITHMTYPE); } - YY_BREAK - case 243: - YY_RULE_SETUP --#line 465 "cftoken.l" -+#line 466 "cftoken.l" - { YYD; yylval.num = algtype_sha2_384; return(ALGORITHMTYPE); } - YY_BREAK - case 244: - YY_RULE_SETUP --#line 466 "cftoken.l" -+#line 467 "cftoken.l" - { YYD; yylval.num = algtype_sha2_512; return(ALGORITHMTYPE); } - YY_BREAK - case 245: - YY_RULE_SETUP --#line 467 "cftoken.l" -+#line 468 "cftoken.l" - { YYD; yylval.num = algtype_sha2_512; return(ALGORITHMTYPE); } - YY_BREAK - case 246: - YY_RULE_SETUP --#line 468 "cftoken.l" -+#line 469 "cftoken.l" - { YYD; yylval.num = algtype_oui; return(ALGORITHMTYPE); } - YY_BREAK - case 247: - YY_RULE_SETUP --#line 469 "cftoken.l" -+#line 470 "cftoken.l" - { YYD; yylval.num = algtype_deflate; return(ALGORITHMTYPE); } - YY_BREAK - case 248: - YY_RULE_SETUP --#line 470 "cftoken.l" -+#line 471 "cftoken.l" - { YYD; yylval.num = algtype_lzs; return(ALGORITHMTYPE); } - YY_BREAK - case 249: - YY_RULE_SETUP --#line 471 "cftoken.l" -+#line 472 "cftoken.l" - { YYD; yylval.num = algtype_modp768; return(ALGORITHMTYPE); } - YY_BREAK - case 250: - YY_RULE_SETUP --#line 472 "cftoken.l" -+#line 473 "cftoken.l" - { YYD; yylval.num = algtype_modp1024; return(ALGORITHMTYPE); } - YY_BREAK - case 251: - YY_RULE_SETUP --#line 473 "cftoken.l" -+#line 474 "cftoken.l" - { YYD; yylval.num = algtype_modp1536; return(ALGORITHMTYPE); } - YY_BREAK - case 252: - YY_RULE_SETUP --#line 474 "cftoken.l" -+#line 475 "cftoken.l" - { YYD; yylval.num = algtype_ec2n155; return(ALGORITHMTYPE); } - YY_BREAK - case 253: - YY_RULE_SETUP --#line 475 "cftoken.l" -+#line 476 "cftoken.l" - { YYD; yylval.num = algtype_ec2n185; return(ALGORITHMTYPE); } - YY_BREAK - case 254: - YY_RULE_SETUP --#line 476 "cftoken.l" -+#line 477 "cftoken.l" - { YYD; yylval.num = algtype_modp2048; return(ALGORITHMTYPE); } - YY_BREAK - case 255: - YY_RULE_SETUP --#line 477 "cftoken.l" -+#line 478 "cftoken.l" - { YYD; yylval.num = algtype_modp3072; return(ALGORITHMTYPE); } - YY_BREAK - case 256: - YY_RULE_SETUP --#line 478 "cftoken.l" -+#line 479 "cftoken.l" - { YYD; yylval.num = algtype_modp4096; return(ALGORITHMTYPE); } - YY_BREAK - case 257: - YY_RULE_SETUP --#line 479 "cftoken.l" -+#line 480 "cftoken.l" - { YYD; yylval.num = algtype_modp6144; return(ALGORITHMTYPE); } - YY_BREAK - case 258: - YY_RULE_SETUP --#line 480 "cftoken.l" -+#line 481 "cftoken.l" - { YYD; yylval.num = algtype_modp8192; return(ALGORITHMTYPE); } - YY_BREAK - case 259: - YY_RULE_SETUP --#line 481 "cftoken.l" -+#line 482 "cftoken.l" - { YYD; yylval.num = algtype_psk; return(ALGORITHMTYPE); } - YY_BREAK - case 260: - YY_RULE_SETUP --#line 482 "cftoken.l" -+#line 483 "cftoken.l" - { YYD; yylval.num = algtype_rsasig; return(ALGORITHMTYPE); } - YY_BREAK - case 261: - YY_RULE_SETUP --#line 483 "cftoken.l" -+#line 484 "cftoken.l" - { YYD; yylval.num = algtype_dsssig; return(ALGORITHMTYPE); } - YY_BREAK - case 262: - YY_RULE_SETUP --#line 484 "cftoken.l" -+#line 485 "cftoken.l" - { YYD; yylval.num = algtype_rsaenc; return(ALGORITHMTYPE); } - YY_BREAK - case 263: - YY_RULE_SETUP --#line 485 "cftoken.l" -+#line 486 "cftoken.l" - { YYD; yylval.num = algtype_rsarev; return(ALGORITHMTYPE); } - YY_BREAK - case 264: - YY_RULE_SETUP --#line 486 "cftoken.l" -+#line 487 "cftoken.l" - { YYD; yylval.num = algtype_gssapikrb; return(ALGORITHMTYPE); } - YY_BREAK - case 265: - YY_RULE_SETUP --#line 487 "cftoken.l" -+#line 488 "cftoken.l" - { - #ifdef ENABLE_HYBRID - YYD; yylval.num = algtype_hybrid_rsa_s; return(ALGORITHMTYPE); -@@ -3299,7 +3322,7 @@ YY_RULE_SETUP - YY_BREAK - case 266: - YY_RULE_SETUP --#line 494 "cftoken.l" -+#line 495 "cftoken.l" - { - #ifdef ENABLE_HYBRID - YYD; yylval.num = algtype_hybrid_dss_s; return(ALGORITHMTYPE); -@@ -3310,7 +3333,7 @@ YY_RULE_SETUP - YY_BREAK - case 267: - YY_RULE_SETUP --#line 501 "cftoken.l" -+#line 502 "cftoken.l" - { - #ifdef ENABLE_HYBRID - YYD; yylval.num = algtype_hybrid_rsa_c; return(ALGORITHMTYPE); -@@ -3321,7 +3344,7 @@ YY_RULE_SETUP - YY_BREAK - case 268: - YY_RULE_SETUP --#line 508 "cftoken.l" -+#line 509 "cftoken.l" - { - #ifdef ENABLE_HYBRID - YYD; yylval.num = algtype_hybrid_dss_c; return(ALGORITHMTYPE); -@@ -3332,7 +3355,7 @@ YY_RULE_SETUP - YY_BREAK - case 269: - YY_RULE_SETUP --#line 515 "cftoken.l" -+#line 516 "cftoken.l" - { - #ifdef ENABLE_HYBRID - YYD; yylval.num = algtype_xauth_psk_s; return(ALGORITHMTYPE); -@@ -3343,7 +3366,7 @@ YY_RULE_SETUP - YY_BREAK - case 270: - YY_RULE_SETUP --#line 522 "cftoken.l" -+#line 523 "cftoken.l" - { - #ifdef ENABLE_HYBRID - YYD; yylval.num = algtype_xauth_psk_c; return(ALGORITHMTYPE); -@@ -3354,7 +3377,7 @@ YY_RULE_SETUP - YY_BREAK - case 271: - YY_RULE_SETUP --#line 529 "cftoken.l" -+#line 530 "cftoken.l" - { - #ifdef ENABLE_HYBRID - YYD; yylval.num = algtype_xauth_rsa_s; return(ALGORITHMTYPE); -@@ -3365,7 +3388,7 @@ YY_RULE_SETUP - YY_BREAK - case 272: - YY_RULE_SETUP --#line 536 "cftoken.l" -+#line 537 "cftoken.l" - { - #ifdef ENABLE_HYBRID - YYD; yylval.num = algtype_xauth_rsa_c; return(ALGORITHMTYPE); -@@ -3377,105 +3400,105 @@ YY_RULE_SETUP - /* identifier type */ - case 273: - YY_RULE_SETUP --#line 546 "cftoken.l" -+#line 547 "cftoken.l" - { YYD; yywarn("it is obsoleted."); return(VENDORID); } - YY_BREAK - case 274: - YY_RULE_SETUP --#line 547 "cftoken.l" -+#line 548 "cftoken.l" - { YYD; yylval.num = IDTYPE_USERFQDN; return(IDENTIFIERTYPE); } - YY_BREAK - case 275: - YY_RULE_SETUP --#line 548 "cftoken.l" -+#line 549 "cftoken.l" - { YYD; yylval.num = IDTYPE_FQDN; return(IDENTIFIERTYPE); } - YY_BREAK - case 276: - YY_RULE_SETUP --#line 549 "cftoken.l" -+#line 550 "cftoken.l" - { YYD; yylval.num = IDTYPE_KEYID; return(IDENTIFIERTYPE); } - YY_BREAK - case 277: - YY_RULE_SETUP --#line 550 "cftoken.l" -+#line 551 "cftoken.l" - { YYD; yylval.num = IDTYPE_ADDRESS; return(IDENTIFIERTYPE); } - YY_BREAK - case 278: - YY_RULE_SETUP --#line 551 "cftoken.l" -+#line 552 "cftoken.l" - { YYD; yylval.num = IDTYPE_SUBNET; return(IDENTIFIERTYPE); } - YY_BREAK - case 279: - YY_RULE_SETUP --#line 552 "cftoken.l" -+#line 553 "cftoken.l" - { YYD; yylval.num = IDTYPE_ASN1DN; return(IDENTIFIERTYPE); } - YY_BREAK - case 280: - YY_RULE_SETUP --#line 553 "cftoken.l" -+#line 554 "cftoken.l" - { YYD; yywarn("certname will be obsoleted in near future."); yylval.num = IDTYPE_ASN1DN; return(IDENTIFIERTYPE); } - YY_BREAK - /* identifier qualifier */ - case 281: - YY_RULE_SETUP --#line 556 "cftoken.l" -+#line 557 "cftoken.l" - { YYD; yylval.num = IDQUAL_TAG; return(IDENTIFIERQUAL); } - YY_BREAK - case 282: - YY_RULE_SETUP --#line 557 "cftoken.l" -+#line 558 "cftoken.l" - { YYD; yylval.num = IDQUAL_FILE; return(IDENTIFIERQUAL); } - YY_BREAK - /* units */ - case 283: - YY_RULE_SETUP --#line 560 "cftoken.l" -+#line 561 "cftoken.l" - { YYD; return(UNITTYPE_BYTE); } - YY_BREAK - case 284: - YY_RULE_SETUP --#line 561 "cftoken.l" -+#line 562 "cftoken.l" - { YYD; return(UNITTYPE_KBYTES); } - YY_BREAK - case 285: - YY_RULE_SETUP --#line 562 "cftoken.l" -+#line 563 "cftoken.l" - { YYD; return(UNITTYPE_MBYTES); } - YY_BREAK - case 286: - YY_RULE_SETUP --#line 563 "cftoken.l" -+#line 564 "cftoken.l" - { YYD; return(UNITTYPE_TBYTES); } - YY_BREAK - case 287: - YY_RULE_SETUP --#line 564 "cftoken.l" -+#line 565 "cftoken.l" - { YYD; return(UNITTYPE_SEC); } - YY_BREAK - case 288: - YY_RULE_SETUP --#line 565 "cftoken.l" -+#line 566 "cftoken.l" - { YYD; return(UNITTYPE_MIN); } - YY_BREAK - case 289: - YY_RULE_SETUP --#line 566 "cftoken.l" -+#line 567 "cftoken.l" - { YYD; return(UNITTYPE_HOUR); } - YY_BREAK - /* boolean */ - case 290: - YY_RULE_SETUP --#line 569 "cftoken.l" -+#line 570 "cftoken.l" - { YYD; yylval.num = TRUE; return(BOOLEAN); } - YY_BREAK - case 291: - YY_RULE_SETUP --#line 570 "cftoken.l" -+#line 571 "cftoken.l" - { YYD; yylval.num = FALSE; return(BOOLEAN); } - YY_BREAK - case 292: - YY_RULE_SETUP --#line 572 "cftoken.l" -+#line 573 "cftoken.l" - { - char *bp; - -@@ -3486,7 +3509,7 @@ YY_RULE_SETUP - YY_BREAK - case 293: - YY_RULE_SETUP --#line 580 "cftoken.l" -+#line 581 "cftoken.l" - { - char *p; - -@@ -3512,7 +3535,7 @@ YY_RULE_SETUP - case 294: - /* rule 294 can match eol */ - YY_RULE_SETUP --#line 602 "cftoken.l" -+#line 603 "cftoken.l" - { - char *p = yytext; - -@@ -3532,7 +3555,7 @@ YY_RULE_SETUP - YY_BREAK - case 295: - YY_RULE_SETUP --#line 619 "cftoken.l" -+#line 620 "cftoken.l" - { - YYD; - -@@ -3566,7 +3589,7 @@ case YY_STATE_EOF(S_RMTS): - case YY_STATE_EOF(S_RMTP): - case YY_STATE_EOF(S_SA): - case YY_STATE_EOF(S_GSSENC): --#line 632 "cftoken.l" -+#line 633 "cftoken.l" - { - yy_delete_buffer(YY_CURRENT_BUFFER); - incstackp--; -@@ -3594,36 +3617,36 @@ case YY_STATE_EOF(S_GSSENC): - /* ... */ - case 296: - YY_RULE_SETUP --#line 657 "cftoken.l" -+#line 658 "cftoken.l" - { ; } - YY_BREAK - case 297: - /* rule 297 can match eol */ - YY_RULE_SETUP --#line 658 "cftoken.l" -+#line 659 "cftoken.l" - { incstack[incstackp].lineno++; } - YY_BREAK - case 298: - YY_RULE_SETUP --#line 659 "cftoken.l" -+#line 660 "cftoken.l" - { YYD; } - YY_BREAK - case 299: - YY_RULE_SETUP --#line 660 "cftoken.l" -+#line 661 "cftoken.l" - { return(EOS); } - YY_BREAK - case 300: - YY_RULE_SETUP --#line 661 "cftoken.l" -+#line 662 "cftoken.l" - { yymore(); } - YY_BREAK - case 301: - YY_RULE_SETUP --#line 663 "cftoken.l" -+#line 664 "cftoken.l" - ECHO; - YY_BREAK --#line 3627 "cftoken.c" -+#line 3650 "cftoken.c" - - case YY_END_OF_BUFFER: - { -@@ -4171,9 +4194,19 @@ static void yy_load_buffer_state (void) - yyfree((void *) b ); - } - --#ifndef __cplusplus -+#ifndef _UNISTD_H /* assume unistd.h has isatty() for us */ -+#ifdef __cplusplus -+extern "C" { -+#endif -+#ifdef __THROW /* this is a gnuism */ -+extern int isatty (int ) __THROW; -+#else - extern int isatty (int ); --#endif /* __cplusplus */ -+#endif -+#ifdef __cplusplus -+} -+#endif -+#endif - - /* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, -@@ -4619,7 +4652,7 @@ void yyfree (void * ptr ) - - #define YYTABLES_NAME "yytables" - --#line 663 "cftoken.l" -+#line 664 "cftoken.l" - - - diff --git a/package/ipsec-tools/patches/patch-src_racoon_cftoken_l b/package/ipsec-tools/patches/patch-src_racoon_cftoken_l deleted file mode 100644 index 8ada6f602..000000000 --- a/package/ipsec-tools/patches/patch-src_racoon_cftoken_l +++ /dev/null @@ -1,11 +0,0 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- ipsec-tools-0.7.2.orig/src/racoon/cftoken.l 2007-09-03 20:07:29.000000000 +0200 -+++ ipsec-tools-0.7.2/src/racoon/cftoken.l 2009-05-29 15:46:06.836399719 +0200 -@@ -104,6 +104,7 @@ static struct include_stack { - static int incstackp = 0; - - static int yy_first_time = 1; -+int yywrap(void) { return 1; } - %} - - /* common seciton */ diff --git a/package/ipsec-tools/patches/patch-src_racoon_crypto_openssl_c b/package/ipsec-tools/patches/patch-src_racoon_crypto_openssl_c index 76c6a62cc..cc10bca3b 100644 --- a/package/ipsec-tools/patches/patch-src_racoon_crypto_openssl_c +++ b/package/ipsec-tools/patches/patch-src_racoon_crypto_openssl_c @@ -1,6 +1,5 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- ipsec-tools-0.7.2.orig/src/racoon/crypto_openssl.c 2009-04-20 15:33:30.000000000 +0200 -+++ ipsec-tools-0.7.2/src/racoon/crypto_openssl.c 2009-05-29 15:31:04.728378359 +0200 +--- ipsec-tools-0.8.0.orig/src/racoon/crypto_openssl.c 2010-10-20 15:40:02.000000000 +0200 ++++ ipsec-tools-0.8.0/src/racoon/crypto_openssl.c 2011-03-31 13:22:18.821818767 +0200 @@ -63,8 +63,12 @@ #ifdef HAVE_OPENSSL_ENGINE_H #include <openssl/engine.h> @@ -14,7 +13,7 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ #include <openssl/err.h> #ifdef HAVE_OPENSSL_RC5_H #include <openssl/rc5.h> -@@ -1347,6 +1351,7 @@ eay_idea_keylen(len) +@@ -1405,6 +1409,7 @@ eay_idea_keylen(len) } #endif @@ -22,7 +21,7 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ /* * BLOWFISH-CBC */ -@@ -1381,6 +1386,7 @@ eay_bf_keylen(len) +@@ -1439,6 +1444,7 @@ eay_bf_keylen(len) return -1; return len; } @@ -30,7 +29,7 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ #ifdef HAVE_OPENSSL_RC5_H /* -@@ -1492,6 +1498,7 @@ eay_3des_keylen(len) +@@ -1550,6 +1556,7 @@ eay_3des_keylen(len) return 192; } @@ -38,7 +37,7 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ /* * CAST-CBC */ -@@ -1526,6 +1533,7 @@ eay_cast_keylen(len) +@@ -1584,6 +1591,7 @@ eay_cast_keylen(len) return -1; return len; } diff --git a/package/ipsec-tools/patches/patch-src_racoon_eaytest_c b/package/ipsec-tools/patches/patch-src_racoon_eaytest_c index a7d7807c4..86a5ff77e 100644 --- a/package/ipsec-tools/patches/patch-src_racoon_eaytest_c +++ b/package/ipsec-tools/patches/patch-src_racoon_eaytest_c @@ -1,7 +1,6 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- ipsec-tools-0.7.2.orig/src/racoon/eaytest.c 2008-07-16 10:50:02.000000000 +0200 -+++ ipsec-tools-0.7.2/src/racoon/eaytest.c 2009-05-29 15:33:04.286374004 +0200 -@@ -683,19 +683,23 @@ ciphertest(ac, av) +--- ipsec-tools-0.8.0.orig/src/racoon/eaytest.c 2010-01-18 00:02:48.000000000 +0100 ++++ ipsec-tools-0.8.0/src/racoon/eaytest.c 2011-03-31 13:23:53.361808366 +0200 +@@ -684,19 +684,23 @@ ciphertest(ac, av) eay_aes_encrypt, eay_aes_decrypt) < 0) return -1; diff --git a/package/ipsec-tools/patches/patch-src_racoon_isakmp_xauth_c b/package/ipsec-tools/patches/patch-src_racoon_isakmp_xauth_c index 7b612f035..63825a34d 100644 --- a/package/ipsec-tools/patches/patch-src_racoon_isakmp_xauth_c +++ b/package/ipsec-tools/patches/patch-src_racoon_isakmp_xauth_c @@ -1,7 +1,6 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- ipsec-tools-0.7.2.orig/src/racoon/isakmp_xauth.c 2009-04-20 15:35:36.000000000 +0200 -+++ ipsec-tools-0.7.2/src/racoon/isakmp_xauth.c 2009-05-29 15:56:30.460377529 +0200 -@@ -585,7 +585,7 @@ PAM_conv(msg_count, msg, rsp, dontcare) +--- ipsec-tools-0.8.0.orig/src/racoon/isakmp_xauth.c 2011-03-14 16:50:36.000000000 +0100 ++++ ipsec-tools-0.8.0/src/racoon/isakmp_xauth.c 2011-03-31 13:23:58.351808486 +0200 +@@ -655,7 +655,7 @@ PAM_conv(msg_count, msg, rsp, dontcare) if ((reply = racoon_malloc(sizeof(*reply) * msg_count)) == NULL) return PAM_CONV_ERR; diff --git a/package/ipsec-tools/patches/patch-src_racoon_pfkey_c b/package/ipsec-tools/patches/patch-src_racoon_pfkey_c index cedbc5cdd..d0c416d83 100644 --- a/package/ipsec-tools/patches/patch-src_racoon_pfkey_c +++ b/package/ipsec-tools/patches/patch-src_racoon_pfkey_c @@ -1,7 +1,6 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- ipsec-tools-0.7.2.orig/src/racoon/pfkey.c 2008-12-08 07:06:24.000000000 +0100 -+++ ipsec-tools-0.7.2/src/racoon/pfkey.c 2009-05-29 15:48:49.201433105 +0200 -@@ -3008,12 +3008,12 @@ addnewsp(mhp) +--- ipsec-tools-0.8.0.orig/src/racoon/pfkey.c 2011-03-15 14:20:14.000000000 +0100 ++++ ipsec-tools-0.8.0/src/racoon/pfkey.c 2011-03-31 13:24:03.781819000 +0200 +@@ -3855,12 +3855,12 @@ addnewsp(mhp, local, remote) struct sockaddr *paddr; paddr = (struct sockaddr *)(xisr + 1); diff --git a/package/ipsec-tools/patches/patch-src_racoon_privsep_c b/package/ipsec-tools/patches/patch-src_racoon_privsep_c index c69abd264..e8f678186 100644 --- a/package/ipsec-tools/patches/patch-src_racoon_privsep_c +++ b/package/ipsec-tools/patches/patch-src_racoon_privsep_c @@ -1,7 +1,6 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- ipsec-tools-0.7.2.orig/src/racoon/privsep.c 2008-12-08 07:06:24.000000000 +0100 -+++ ipsec-tools-0.7.2/src/racoon/privsep.c 2009-05-29 15:55:47.787585131 +0200 -@@ -323,7 +323,7 @@ privsep_init(void) +--- ipsec-tools-0.8.0.orig/src/racoon/privsep.c 2011-03-06 09:28:10.000000000 +0100 ++++ ipsec-tools-0.8.0/src/racoon/privsep.c 2011-03-31 13:24:07.981813178 +0200 +@@ -359,7 +359,7 @@ privsep_init(void) strerror(errno)); goto out; } @@ -10,7 +9,7 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ reply->hdr.ac_cmd = combuf->hdr.ac_cmd; reply->hdr.ac_len = sizeof(*reply); -@@ -421,7 +421,7 @@ privsep_init(void) +@@ -457,7 +457,7 @@ privsep_init(void) strerror(errno)); goto out; } @@ -19,7 +18,7 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ /* -@@ -716,7 +716,7 @@ privsep_eay_get_pkcs1privkey(path) +@@ -903,7 +903,7 @@ privsep_eay_get_pkcs1privkey(path) "Cannot allocate memory: %s\n", strerror(errno)); return NULL; } @@ -28,7 +27,7 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ msg->hdr.ac_cmd = PRIVSEP_EAY_GET_PKCS1PRIVKEY; msg->hdr.ac_len = len; msg->bufs.buflen[0] = len - sizeof(*msg); -@@ -797,7 +797,7 @@ privsep_script_exec(script, name, envp) +@@ -953,7 +953,7 @@ privsep_script_exec(script, name, envp) return -1; } @@ -37,7 +36,7 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ msg->hdr.ac_cmd = PRIVSEP_SCRIPT_EXEC; msg->hdr.ac_len = sizeof(*msg); -@@ -906,7 +906,7 @@ privsep_getpsk(str, keylen) +@@ -1062,7 +1062,7 @@ privsep_getpsk(str, keylen) "Cannot allocate memory: %s\n", strerror(errno)); return NULL; } @@ -46,7 +45,7 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ msg->hdr.ac_cmd = PRIVSEP_GETPSK; msg->hdr.ac_len = len; -@@ -960,7 +960,7 @@ privsep_xauth_login_system(usr, pwd) +@@ -1334,7 +1334,7 @@ privsep_xauth_login_system(usr, pwd) "Cannot allocate memory: %s\n", strerror(errno)); return -1; } @@ -55,7 +54,7 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ msg->hdr.ac_cmd = PRIVSEP_XAUTH_LOGIN_SYSTEM; msg->hdr.ac_len = len; -@@ -1014,7 +1014,7 @@ privsep_accounting_system(port, raddr, u +@@ -1389,7 +1389,7 @@ privsep_accounting_system(port, raddr, u "Cannot allocate memory: %s\n", strerror(errno)); return -1; } @@ -64,7 +63,7 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ msg->hdr.ac_cmd = PRIVSEP_ACCOUNTING_SYSTEM; msg->hdr.ac_len = len; msg->bufs.buflen[0] = sizeof(port); -@@ -1187,7 +1187,7 @@ privsep_accounting_pam(port, inout) +@@ -1643,7 +1643,7 @@ privsep_accounting_pam(port, inout) "Cannot allocate memory: %s\n", strerror(errno)); return -1; } @@ -73,7 +72,7 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ msg->hdr.ac_cmd = PRIVSEP_ACCOUNTING_PAM; msg->hdr.ac_len = len; msg->bufs.buflen[0] = sizeof(port); -@@ -1248,7 +1248,7 @@ privsep_xauth_login_pam(port, raddr, usr +@@ -1705,7 +1705,7 @@ privsep_xauth_login_pam(port, raddr, usr "Cannot allocate memory: %s\n", strerror(errno)); return -1; } @@ -82,7 +81,7 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $ msg->hdr.ac_cmd = PRIVSEP_XAUTH_LOGIN_PAM; msg->hdr.ac_len = len; msg->bufs.buflen[0] = sizeof(port); -@@ -1312,7 +1312,7 @@ privsep_cleanup_pam(port) +@@ -1770,7 +1770,7 @@ privsep_cleanup_pam(port) "Cannot allocate memory: %s\n", strerror(errno)); return; } diff --git a/package/ipsec-tools/patches/patch-src_racoon_racoonctl_c b/package/ipsec-tools/patches/patch-src_racoon_racoonctl_c index d5d6267c6..3b998fe24 100644 --- a/package/ipsec-tools/patches/patch-src_racoon_racoonctl_c +++ b/package/ipsec-tools/patches/patch-src_racoon_racoonctl_c @@ -1,7 +1,6 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- ipsec-tools-0.7.2.orig/src/racoon/racoonctl.c 2009-04-20 15:32:57.000000000 +0200 -+++ ipsec-tools-0.7.2/src/racoon/racoonctl.c 2009-05-29 15:57:45.600377208 +0200 -@@ -785,7 +785,7 @@ f_vpnc(ac, av) +--- ipsec-tools-0.8.0.orig/src/racoon/racoonctl.c 2010-11-12 10:08:26.000000000 +0100 ++++ ipsec-tools-0.8.0/src/racoon/racoonctl.c 2011-03-31 13:24:13.201808233 +0200 +@@ -693,7 +693,7 @@ f_vpnc(ac, av) errx(1, "cannot read source address"); /* We get "ip[port]" strip the port */ diff --git a/package/ipsec-tools/patches/patch-src_setkey_token_c b/package/ipsec-tools/patches/patch-src_setkey_token_c deleted file mode 100644 index 1c0231885..000000000 --- a/package/ipsec-tools/patches/patch-src_setkey_token_c +++ /dev/null @@ -1,707 +0,0 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- ipsec-tools-0.7.2.orig/src/setkey/token.c 2008-07-23 10:26:58.000000000 +0200 -+++ ipsec-tools-0.7.2/src/setkey/token.c 2009-05-29 15:26:39.126303087 +0200 -@@ -8,7 +8,7 @@ - #define FLEX_SCANNER - #define YY_FLEX_MAJOR_VERSION 2 - #define YY_FLEX_MINOR_VERSION 5 --#define YY_FLEX_SUBMINOR_VERSION 34 -+#define YY_FLEX_SUBMINOR_VERSION 35 - #if YY_FLEX_SUBMINOR_VERSION > 0 - #define FLEX_BETA - #endif -@@ -178,13 +178,6 @@ extern FILE *yyin, *yyout; - - #define unput(c) yyunput( c, (yytext_ptr) ) - --/* The following is because we cannot portably get our hands on size_t -- * (without autoconf's help, which isn't available because we want -- * flex-generated scanners to compile on their own). -- * Given that the standard has decreed that size_t exists since 1989, -- * I guess we can afford to depend on it. Manoj. -- */ -- - #ifndef YY_TYPEDEF_YY_SIZE_T - #define YY_TYPEDEF_YY_SIZE_T - typedef size_t yy_size_t; -@@ -1069,9 +1062,10 @@ char *yytext; - #if defined(SADB_X_EALG_AES) && ! defined(SADB_X_EALG_AESCBC) - #define SADB_X_EALG_AESCBC SADB_X_EALG_AES - #endif -+int yywrap(void) { return 1; } - /* common section */ - --#line 1075 "token.c" -+#line 1069 "token.c" - - #define INITIAL 0 - #define S_PL 1 -@@ -1092,6 +1086,35 @@ char *yytext; - - static int yy_init_globals (void ); - -+/* Accessor methods to globals. -+ These are made visible to non-reentrant scanners for convenience. */ -+ -+int yylex_destroy (void ); -+ -+int yyget_debug (void ); -+ -+void yyset_debug (int debug_flag ); -+ -+YY_EXTRA_TYPE yyget_extra (void ); -+ -+void yyset_extra (YY_EXTRA_TYPE user_defined ); -+ -+FILE *yyget_in (void ); -+ -+void yyset_in (FILE * in_str ); -+ -+FILE *yyget_out (void ); -+ -+void yyset_out (FILE * out_str ); -+ -+int yyget_leng (void ); -+ -+char *yyget_text (void ); -+ -+int yyget_lineno (void ); -+ -+void yyset_lineno (int line_number ); -+ - /* Macros after this point can all be overridden by user definitions in - * section 1. - */ -@@ -1227,10 +1250,10 @@ YY_DECL - register char *yy_cp, *yy_bp; - register int yy_act; - --#line 114 "token.l" -+#line 115 "token.l" - - --#line 1234 "token.c" -+#line 1257 "token.c" - - if ( !(yy_init) ) - { -@@ -1321,84 +1344,84 @@ do_action: /* This label is used only to - - case 1: - YY_RULE_SETUP --#line 116 "token.l" -+#line 117 "token.l" - { return(ADD); } - YY_BREAK - case 2: - YY_RULE_SETUP --#line 117 "token.l" -+#line 118 "token.l" - { return(DELETE); } - YY_BREAK - case 3: - YY_RULE_SETUP --#line 118 "token.l" -+#line 119 "token.l" - { return(DELETEALL); } - YY_BREAK - case 4: - YY_RULE_SETUP --#line 119 "token.l" -+#line 120 "token.l" - { return(GET); } - YY_BREAK - case 5: - YY_RULE_SETUP --#line 120 "token.l" -+#line 121 "token.l" - { return(FLUSH); } - YY_BREAK - case 6: - YY_RULE_SETUP --#line 121 "token.l" -+#line 122 "token.l" - { return(DUMP); } - YY_BREAK - case 7: - YY_RULE_SETUP --#line 122 "token.l" -+#line 123 "token.l" - { return(EXIT); } - YY_BREAK - case 8: - YY_RULE_SETUP --#line 123 "token.l" -+#line 124 "token.l" - { return(EXIT); } - YY_BREAK - case 9: - YY_RULE_SETUP --#line 124 "token.l" -+#line 125 "token.l" - { return(EXIT); } - YY_BREAK - /* for management SPD */ - case 10: - YY_RULE_SETUP --#line 127 "token.l" -+#line 128 "token.l" - { return(SPDADD); } - YY_BREAK - case 11: - YY_RULE_SETUP --#line 128 "token.l" -+#line 129 "token.l" - { return(SPDDELETE); } - YY_BREAK - case 12: - YY_RULE_SETUP --#line 129 "token.l" -+#line 130 "token.l" - { return(SPDDUMP); } - YY_BREAK - case 13: - YY_RULE_SETUP --#line 130 "token.l" -+#line 131 "token.l" - { return(SPDFLUSH); } - YY_BREAK - case 14: - YY_RULE_SETUP --#line 131 "token.l" -+#line 132 "token.l" - { return(TAGGED); } - YY_BREAK - case 15: - YY_RULE_SETUP --#line 132 "token.l" -+#line 133 "token.l" - { BEGIN S_PL; return(F_POLICY); } - YY_BREAK - case 16: - /* rule 16 can match eol */ - YY_RULE_SETUP --#line 133 "token.l" -+#line 134 "token.l" - { - yymore(); - -@@ -1420,13 +1443,13 @@ YY_RULE_SETUP - YY_BREAK - case 17: - YY_RULE_SETUP --#line 151 "token.l" -+#line 152 "token.l" - { BEGIN INITIAL; return(EOT); } - YY_BREAK - /* address resolution flags */ - case 18: - YY_RULE_SETUP --#line 154 "token.l" -+#line 155 "token.l" - { - yylval.val.len = strlen(yytext); - yylval.val.buf = strdup(yytext); -@@ -1438,37 +1461,37 @@ YY_RULE_SETUP - /* security protocols */ - case 19: - YY_RULE_SETUP --#line 163 "token.l" -+#line 164 "token.l" - { yylval.num = 0; return(PR_AH); } - YY_BREAK - case 20: - YY_RULE_SETUP --#line 164 "token.l" -+#line 165 "token.l" - { yylval.num = 0; return(PR_ESP); } - YY_BREAK - case 21: - YY_RULE_SETUP --#line 165 "token.l" -+#line 166 "token.l" - { yylval.num = 1; return(PR_AH); } - YY_BREAK - case 22: - YY_RULE_SETUP --#line 166 "token.l" -+#line 167 "token.l" - { yylval.num = 1; return(PR_ESP); } - YY_BREAK - case 23: - YY_RULE_SETUP --#line 167 "token.l" -+#line 168 "token.l" - { yylval.num = 0; return(PR_ESPUDP); } - YY_BREAK - case 24: - YY_RULE_SETUP --#line 168 "token.l" -+#line 169 "token.l" - { yylval.num = 0; return(PR_IPCOMP); } - YY_BREAK - case 25: - YY_RULE_SETUP --#line 169 "token.l" -+#line 170 "token.l" - { - yylval.num = 0; return(PR_TCP); - } -@@ -1476,72 +1499,72 @@ YY_RULE_SETUP - /* authentication alogorithm */ - case 26: - YY_RULE_SETUP --#line 174 "token.l" -+#line 175 "token.l" - { BEGIN S_AUTHALG; return(F_AUTH); } - YY_BREAK - case 27: - YY_RULE_SETUP --#line 175 "token.l" -+#line 176 "token.l" - { yylval.num = SADB_AALG_MD5HMAC; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK - case 28: - YY_RULE_SETUP --#line 176 "token.l" -+#line 177 "token.l" - { yylval.num = SADB_AALG_SHA1HMAC; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK - case 29: - YY_RULE_SETUP --#line 177 "token.l" -+#line 178 "token.l" - { yylval.num = SADB_X_AALG_MD5; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK - case 30: - YY_RULE_SETUP --#line 178 "token.l" -+#line 179 "token.l" - { yylval.num = SADB_X_AALG_SHA; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK - case 31: - YY_RULE_SETUP --#line 179 "token.l" -+#line 180 "token.l" - { yylval.num = SADB_X_AALG_SHA2_256; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK - case 32: - YY_RULE_SETUP --#line 180 "token.l" -+#line 181 "token.l" - { yylval.num = SADB_X_AALG_SHA2_256; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK - case 33: - YY_RULE_SETUP --#line 181 "token.l" -+#line 182 "token.l" - { yylval.num = SADB_X_AALG_SHA2_384; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK - case 34: - YY_RULE_SETUP --#line 182 "token.l" -+#line 183 "token.l" - { yylval.num = SADB_X_AALG_SHA2_384; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK - case 35: - YY_RULE_SETUP --#line 183 "token.l" -+#line 184 "token.l" - { yylval.num = SADB_X_AALG_SHA2_512; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK - case 36: - YY_RULE_SETUP --#line 184 "token.l" -+#line 185 "token.l" - { yylval.num = SADB_X_AALG_SHA2_512; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK - case 37: - YY_RULE_SETUP --#line 185 "token.l" -+#line 186 "token.l" - { yylval.num = SADB_X_AALG_RIPEMD160HMAC; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK - case 38: - YY_RULE_SETUP --#line 186 "token.l" -+#line 187 "token.l" - { yylval.num = SADB_X_AALG_AES_XCBC_MAC; BEGIN INITIAL; return(ALG_AUTH); } - YY_BREAK - case 39: - YY_RULE_SETUP --#line 187 "token.l" -+#line 188 "token.l" - { - #ifdef SADB_X_AALG_TCP_MD5 - yylval.num = SADB_X_AALG_TCP_MD5; -@@ -1552,63 +1575,63 @@ YY_RULE_SETUP - YY_BREAK - case 40: - YY_RULE_SETUP --#line 194 "token.l" -+#line 195 "token.l" - { yylval.num = SADB_X_AALG_NULL; BEGIN INITIAL; return(ALG_AUTH_NOKEY); } - YY_BREAK - /* encryption alogorithm */ - case 41: - YY_RULE_SETUP --#line 197 "token.l" -+#line 198 "token.l" - { BEGIN S_ENCALG; return(F_ENC); } - YY_BREAK - case 42: - YY_RULE_SETUP --#line 198 "token.l" -+#line 199 "token.l" - { yylval.num = SADB_EALG_DESCBC; BEGIN INITIAL; return(ALG_ENC); } - YY_BREAK - case 43: - YY_RULE_SETUP --#line 199 "token.l" -+#line 200 "token.l" - { yylval.num = SADB_EALG_3DESCBC; BEGIN INITIAL; return(ALG_ENC); } - YY_BREAK - case 44: - YY_RULE_SETUP --#line 200 "token.l" -+#line 201 "token.l" - { yylval.num = SADB_EALG_NULL; BEGIN INITIAL; return(ALG_ENC_NOKEY); } - YY_BREAK - case 45: - YY_RULE_SETUP --#line 201 "token.l" -+#line 202 "token.l" - { yylval.num = SADB_EALG_NULL; BEGIN INITIAL; return(ALG_ENC_OLD); } - YY_BREAK - case 46: - YY_RULE_SETUP --#line 202 "token.l" -+#line 203 "token.l" - { yylval.num = SADB_X_EALG_BLOWFISHCBC; BEGIN INITIAL; return(ALG_ENC); } - YY_BREAK - case 47: - YY_RULE_SETUP --#line 203 "token.l" -+#line 204 "token.l" - { yylval.num = SADB_X_EALG_CAST128CBC; BEGIN INITIAL; return(ALG_ENC); } - YY_BREAK - case 48: - YY_RULE_SETUP --#line 204 "token.l" -+#line 205 "token.l" - { yylval.num = SADB_EALG_DESCBC; BEGIN INITIAL; return(ALG_ENC_DESDERIV); } - YY_BREAK - case 49: - YY_RULE_SETUP --#line 205 "token.l" -+#line 206 "token.l" - { yylval.num = SADB_EALG_DESCBC; BEGIN INITIAL; return(ALG_ENC_DES32IV); } - YY_BREAK - case 50: - YY_RULE_SETUP --#line 206 "token.l" -+#line 207 "token.l" - { yylval.num = SADB_X_EALG_TWOFISHCBC; BEGIN INITIAL; return(ALG_ENC); } - YY_BREAK - case 51: - YY_RULE_SETUP --#line 207 "token.l" -+#line 208 "token.l" - { - #ifdef SADB_X_EALG_AESCBC - yylval.num = SADB_X_EALG_AESCBC; BEGIN INITIAL; return(ALG_ENC); -@@ -1617,7 +1640,7 @@ YY_RULE_SETUP - YY_BREAK - case 52: - YY_RULE_SETUP --#line 212 "token.l" -+#line 213 "token.l" - { - #ifdef SADB_X_EALG_AESCBC - yylval.num = SADB_X_EALG_AESCBC; BEGIN INITIAL; return(ALG_ENC); -@@ -1626,12 +1649,12 @@ YY_RULE_SETUP - YY_BREAK - case 53: - YY_RULE_SETUP --#line 217 "token.l" -+#line 218 "token.l" - { yylval.num = SADB_X_EALG_AESCTR; BEGIN INITIAL; return(ALG_ENC); } - YY_BREAK - case 54: - YY_RULE_SETUP --#line 218 "token.l" -+#line 219 "token.l" - { - #ifdef SADB_X_EALG_CAMELLIACBC - yylval.num = SADB_X_EALG_CAMELLIACBC; BEGIN INITIAL; return(ALG_ENC); -@@ -1641,152 +1664,152 @@ YY_RULE_SETUP - /* compression algorithms */ - case 55: - YY_RULE_SETUP --#line 225 "token.l" -+#line 226 "token.l" - { return(F_COMP); } - YY_BREAK - case 56: - YY_RULE_SETUP --#line 226 "token.l" -+#line 227 "token.l" - { yylval.num = SADB_X_CALG_OUI; return(ALG_COMP); } - YY_BREAK - case 57: - YY_RULE_SETUP --#line 227 "token.l" -+#line 228 "token.l" - { yylval.num = SADB_X_CALG_DEFLATE; return(ALG_COMP); } - YY_BREAK - case 58: - YY_RULE_SETUP --#line 228 "token.l" -+#line 229 "token.l" - { yylval.num = SADB_X_CALG_LZS; return(ALG_COMP); } - YY_BREAK - case 59: - YY_RULE_SETUP --#line 229 "token.l" -+#line 230 "token.l" - { return(F_RAWCPI); } - YY_BREAK - /* extension */ - case 60: - YY_RULE_SETUP --#line 232 "token.l" -+#line 233 "token.l" - { return(F_MODE); } - YY_BREAK - case 61: - YY_RULE_SETUP --#line 233 "token.l" -+#line 234 "token.l" - { yylval.num = IPSEC_MODE_TRANSPORT; return(MODE); } - YY_BREAK - case 62: - YY_RULE_SETUP --#line 234 "token.l" -+#line 235 "token.l" - { yylval.num = IPSEC_MODE_TUNNEL; return(MODE); } - YY_BREAK - case 63: - YY_RULE_SETUP --#line 235 "token.l" -+#line 236 "token.l" - { return(F_REQID); } - YY_BREAK - case 64: - YY_RULE_SETUP --#line 236 "token.l" -+#line 237 "token.l" - { return(F_EXT); } - YY_BREAK - case 65: - YY_RULE_SETUP --#line 237 "token.l" -+#line 238 "token.l" - { yylval.num = SADB_X_EXT_PRAND; return(EXTENSION); } - YY_BREAK - case 66: - YY_RULE_SETUP --#line 238 "token.l" -+#line 239 "token.l" - { yylval.num = SADB_X_EXT_PSEQ; return(EXTENSION); } - YY_BREAK - case 67: - YY_RULE_SETUP --#line 239 "token.l" -+#line 240 "token.l" - { yylval.num = SADB_X_EXT_PZERO; return(EXTENSION); } - YY_BREAK - case 68: - YY_RULE_SETUP --#line 240 "token.l" -+#line 241 "token.l" - { return(NOCYCLICSEQ); } - YY_BREAK - case 69: - YY_RULE_SETUP --#line 241 "token.l" -+#line 242 "token.l" - { return(F_REPLAY); } - YY_BREAK - case 70: - YY_RULE_SETUP --#line 242 "token.l" -+#line 243 "token.l" - { return(F_LIFETIME_HARD); } - YY_BREAK - case 71: - YY_RULE_SETUP --#line 243 "token.l" -+#line 244 "token.l" - { return(F_LIFETIME_SOFT); } - YY_BREAK - case 72: - YY_RULE_SETUP --#line 244 "token.l" -+#line 245 "token.l" - { return(F_LIFEBYTE_HARD); } - YY_BREAK - case 73: - YY_RULE_SETUP --#line 245 "token.l" -+#line 246 "token.l" - { return(F_LIFEBYTE_SOFT); } - YY_BREAK - case 74: - YY_RULE_SETUP --#line 246 "token.l" -+#line 247 "token.l" - { return(SECURITY_CTX); } - YY_BREAK - /* ... */ - case 75: - YY_RULE_SETUP --#line 249 "token.l" -+#line 250 "token.l" - { return(ANY); } - YY_BREAK - case 76: - YY_RULE_SETUP --#line 250 "token.l" -+#line 251 "token.l" - { } - YY_BREAK - case 77: - /* rule 77 can match eol */ - YY_RULE_SETUP --#line 251 "token.l" -+#line 252 "token.l" - { lineno++; } - YY_BREAK - case 78: - YY_RULE_SETUP --#line 252 "token.l" -+#line 253 "token.l" - - YY_BREAK - case 79: - YY_RULE_SETUP --#line 253 "token.l" -+#line 254 "token.l" - { return(EOT); } - YY_BREAK - /* for address parameters: /prefix, [port] */ - case 80: - YY_RULE_SETUP --#line 256 "token.l" -+#line 257 "token.l" - { return SLASH; } - YY_BREAK - case 81: - YY_RULE_SETUP --#line 257 "token.l" -+#line 258 "token.l" - { return BLCL; } - YY_BREAK - case 82: - YY_RULE_SETUP --#line 258 "token.l" -+#line 259 "token.l" - { return ELCL; } - YY_BREAK - /* parameter */ - case 83: - YY_RULE_SETUP --#line 261 "token.l" -+#line 262 "token.l" - { - char *bp; - -@@ -1796,7 +1819,7 @@ YY_RULE_SETUP - YY_BREAK - case 84: - YY_RULE_SETUP --#line 268 "token.l" -+#line 269 "token.l" - { - yylval.val.buf = strdup(yytext + 2); - if (!yylval.val.buf) -@@ -1809,7 +1832,7 @@ YY_RULE_SETUP - case 85: - /* rule 85 can match eol */ - YY_RULE_SETUP --#line 277 "token.l" -+#line 278 "token.l" - { - char *p = yytext; - while (*++p != '"') ; -@@ -1825,7 +1848,7 @@ YY_RULE_SETUP - YY_BREAK - case 86: - YY_RULE_SETUP --#line 290 "token.l" -+#line 291 "token.l" - { - yylval.val.len = yyleng; - yylval.val.buf = strdup(yytext); -@@ -1836,7 +1859,7 @@ YY_RULE_SETUP - YY_BREAK - case 87: - YY_RULE_SETUP --#line 298 "token.l" -+#line 299 "token.l" - { - yylval.val.len = yyleng; - yylval.val.buf = strdup(yytext); -@@ -1847,7 +1870,7 @@ YY_RULE_SETUP - YY_BREAK - case 88: - YY_RULE_SETUP --#line 306 "token.l" -+#line 307 "token.l" - { - yyfatal("Syntax error"); - /*NOTREACHED*/ -@@ -1855,10 +1878,10 @@ YY_RULE_SETUP - YY_BREAK - case 89: - YY_RULE_SETUP --#line 311 "token.l" -+#line 312 "token.l" - ECHO; - YY_BREAK --#line 1862 "token.c" -+#line 1885 "token.c" - case YY_STATE_EOF(INITIAL): - case YY_STATE_EOF(S_PL): - case YY_STATE_EOF(S_AUTHALG): -@@ -2411,9 +2434,19 @@ static void yy_load_buffer_state (void) - yyfree((void *) b ); - } - --#ifndef __cplusplus -+#ifndef _UNISTD_H /* assume unistd.h has isatty() for us */ -+#ifdef __cplusplus -+extern "C" { -+#endif -+#ifdef __THROW /* this is a gnuism */ -+extern int isatty (int ) __THROW; -+#else - extern int isatty (int ); --#endif /* __cplusplus */ -+#endif -+#ifdef __cplusplus -+} -+#endif -+#endif - - /* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, -@@ -2859,7 +2892,7 @@ void yyfree (void * ptr ) - - #define YYTABLES_NAME "yytables" - --#line 311 "token.l" -+#line 312 "token.l" - - - diff --git a/package/ipsec-tools/patches/patch-src_setkey_token_l b/package/ipsec-tools/patches/patch-src_setkey_token_l deleted file mode 100644 index e0697835c..000000000 --- a/package/ipsec-tools/patches/patch-src_setkey_token_l +++ /dev/null @@ -1,11 +0,0 @@ -$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ ---- ipsec-tools-0.7.2.orig/src/setkey/token.l 2007-08-01 13:52:23.000000000 +0200 -+++ ipsec-tools-0.7.2/src/setkey/token.l 2009-05-29 15:25:54.760377400 +0200 -@@ -86,6 +86,7 @@ - #if defined(SADB_X_EALG_AES) && ! defined(SADB_X_EALG_AESCBC) - #define SADB_X_EALG_AESCBC SADB_X_EALG_AES - #endif -+int yywrap(void) { return 1; } - %} - - /* common section */ diff --git a/package/iptraf/Makefile b/package/iptraf/Makefile index ef289ae37..9c167c60b 100644 --- a/package/iptraf/Makefile +++ b/package/iptraf/Makefile @@ -22,6 +22,8 @@ CONFIG_STYLE:= manual BUILD_STYLE:= manual INSTALL_STYLE:= manual +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) + do-build: ${MAKE} -C ${WRKBUILD}/src \ ${TARGET_CONFIGURE_OPTS} \ diff --git a/package/jpeg/Makefile b/package/jpeg/Makefile index 4f12836d5..d91f59ea4 100644 --- a/package/jpeg/Makefile +++ b/package/jpeg/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= jpeg -PKG_VERSION:= 8b +PKG_VERSION:= 8c PKG_RELEASE:= 1 -PKG_MD5SUM:= e022acbc5b36cd2cb70785f5b575661e +PKG_MD5SUM:= a2c10c04f396a9ce72894beb18b4e1f9 PKG_DESCR:= The Independent JPEG Groups JPEG runtime library PKG_SECTION:= libs PKG_URL:= http://www.ijg.org/ diff --git a/package/jpeg/patches/patch-ltmain_sh b/package/jpeg/patches/patch-ltmain_sh index 3b71ada5f..9ac6b5178 100644 --- a/package/jpeg/patches/patch-ltmain_sh +++ b/package/jpeg/patches/patch-ltmain_sh @@ -1,11 +1,11 @@ ---- jpeg-8b.orig/ltmain.sh 2010-05-02 18:49:25.000000000 +0200 -+++ jpeg-8b/ltmain.sh 2011-01-14 00:16:39.000000000 +0100 -@@ -4765,7 +4765,7 @@ func_mode_link () - # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC - # @file GCC response files +--- jpeg-8c.orig/ltmain.sh 2010-11-17 22:41:29.000000000 +0100 ++++ jpeg-8c/ltmain.sh 2011-04-07 11:28:48.000000000 +0200 +@@ -5840,7 +5840,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*|@*) -+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-fstack-protector*|-flto) + -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/lame/Makefile b/package/lame/Makefile index 4f18aa165..f0a17f483 100644 --- a/package/lame/Makefile +++ b/package/lame/Makefile @@ -19,12 +19,16 @@ PKGSC_LIBLAME:= libs include $(TOPDIR)/mk/package.mk -$(eval $(call PKG_template,LAME,${PKG_NAME},$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call PKG_template,LAME,lame,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,LIBLAME,liblame,$(PKG_VERSION)-${PKG_RELEASE},,${PKGSD_LIBLAME},${PKGSC_LIBLAME})) -post-install: +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) + +lame-install: $(INSTALL_DIR) $(IDIR_LAME)/usr/bin - $(INSTALL_BIN) $(WRKINST)/usr/bin/lame $(IDIR_LAME)/usr/bin/ + $(INSTALL_BIN) $(WRKINST)/usr/bin/lame $(IDIR_LAME)/usr/bin + +liblame-install: $(INSTALL_DIR) $(IDIR_LIBLAME)/usr/lib $(CP) $(WRKINST)/usr/lib/libmp3lame.so* $(IDIR_LIBLAME)/usr/lib diff --git a/package/libICE/Makefile b/package/libICE/Makefile index 183543a2c..eb4cf1740 100644 --- a/package/libICE/Makefile +++ b/package/libICE/Makefile @@ -21,6 +21,8 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,LIBICE,libice,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,LIBICE_DEV,libice-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBICE_DEV},${PKGSC_LIBICE_DEV})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) + libice-install: ${INSTALL_DIR} ${IDIR_LIBICE}/usr/lib ${CP} ${WRKINST}/usr/lib/libICE.so* ${IDIR_LIBICE}/usr/lib diff --git a/package/libIDL/Makefile b/package/libIDL/Makefile index b26fd863d..8ffb0fe31 100644 --- a/package/libIDL/Makefile +++ b/package/libIDL/Makefile @@ -29,6 +29,9 @@ libidl-install: $(IDIR_LIBIDL)/usr/lib libidl-dev-install: + $(INSTALL_DIR) $(IDIR_LIBIDL_DEV)/usr/include + $(CP) $(WRKINST)/usr/include/* \ + $(IDIR_LIBIDL_DEV)/usr/include $(INSTALL_DIR) $(IDIR_LIBIDL_DEV)/usr/bin ${INSTALL_BIN} ${WRKINST}/usr/bin/libIDL-config-2 \ $(IDIR_LIBIDL_DEV)/usr/bin diff --git a/package/libXft/Makefile b/package/libXft/Makefile index 50f3fc68d..89a513cb3 100644 --- a/package/libXft/Makefile +++ b/package/libXft/Makefile @@ -21,6 +21,7 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,LIBXFT,libxft,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,LIBXFT_DEV,libxft-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBXFT_DEV},${PKGSC_LIBXFT_DEV})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --disable-malloc0returnsnull \ --disable-install-makestrs diff --git a/package/libXinerama/Makefile b/package/libXinerama/Makefile new file mode 100644 index 000000000..08b9a0ed0 --- /dev/null +++ b/package/libXinerama/Makefile @@ -0,0 +1,37 @@ +# 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:= libXinerama +PKG_VERSION:= 1.1 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 42b9fc01984c452ee416076c0977b0b3 +PKG_DESCR:= Xinerama library +PKG_SECTION:= x11/libs +PKG_BUILDDEP:= xineramaproto +PKG_SITES:= ${MASTER_SITE_XORG} + +PKG_SUBPKGS:= LIBXINERAMA LIBXINERAMA_DEV +PKGSD_LIBXINERAMA_DEV:= Xinerama headers +PKGSC_LIBXINERAMA_DEV:= x11/devel + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,LIBXINERAMA,libxinerama,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call PKG_template,LIBXINERAMA_DEV,libxinerama-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBXINERAMA_DEV},${PKGSC_LIBXINERAMA_DEV})) + +CONFIGURE_ARGS+= --disable-malloc0returnsnull + +libxinerama-install: + ${INSTALL_DIR} ${IDIR_LIBXINERAMA}/usr/lib + ${CP} ${WRKINST}/usr/lib/libXinerama.so* ${IDIR_LIBXINERAMA}/usr/lib + +libxinerama-dev-install: + ${INSTALL_DIR} ${IDIR_LIBXINERAMA_DEV}/usr/include + ${CP} ${WRKINST}/usr/include/* ${IDIR_LIBXINERAMA_DEV}/usr/include + ${INSTALL_DIR} ${IDIR_LIBXINERAMA_DEV}/usr/lib/pkgconfig + ${INSTALL_DATA} ${WRKINST}/usr/lib/pkgconfig/*.pc \ + ${IDIR_LIBXINERAMA_DEV}/usr/lib/pkgconfig + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/libXp/Makefile b/package/libXp/Makefile new file mode 100644 index 000000000..d01c734a0 --- /dev/null +++ b/package/libXp/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:= libXp +PKG_VERSION:= 1.0.1 +PKG_RELEASE:= 1 +PKG_MD5SUM:= a960c831f11e6b4249fde78a5b969000 +PKG_DESCR:= X Print library +PKG_SECTION:= x11/libs +PKG_BUILDDEP:= libXext printproto +PKG_SITES:= ${MASTER_SITE_XORG} + +PKG_SUBPKGS:= LIBXP LIBXP_DEV +PKGSD_LIBXP_DEV:= X Print headers +PKGSC_LIBXP_DEV:= x11/devel + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,LIBXP,libpt,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call PKG_template,LIBXP_DEV,libpt-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBXP_DEV},${PKGSC_LIBXP_DEV})) + +libxp-install: + ${INSTALL_DIR} ${IDIR_LIBXP}/usr/lib + ${CP} ${WRKINST}/usr/lib/libXp.so* ${IDIR_LIBXP}/usr/lib + +libxp-dev-install: + ${INSTALL_DIR} ${IDIR_LIBXP_DEV}/usr/include + ${CP} ${WRKINST}/usr/include/* ${IDIR_LIBXP_DEV}/usr/include + ${INSTALL_DIR} ${IDIR_LIBXP_DEV}/usr/lib/pkgconfig + ${INSTALL_DATA} ${WRKINST}/usr/lib/pkgconfig/*.pc \ + ${IDIR_LIBXP_DEV}/usr/lib/pkgconfig + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/libXt/Makefile b/package/libXt/Makefile index 559c19521..325e829ca 100644 --- a/package/libXt/Makefile +++ b/package/libXt/Makefile @@ -21,6 +21,7 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,LIBXT,libxt,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,LIBXT_DEV,libxt-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBXT_DEV},${PKGSC_LIBXT_DEV})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --disable-malloc0returnsnull libxt-install: diff --git a/package/libXtst/Makefile b/package/libXtst/Makefile new file mode 100644 index 000000000..821bf5dee --- /dev/null +++ b/package/libXtst/Makefile @@ -0,0 +1,37 @@ +# 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:= libXtst +PKG_VERSION:= 1.2.0 +PKG_RELEASE:= 1 +PKG_MD5SUM:= fd94ddca70e10eef4640e1f57b0301ee +PKG_DESCR:= Xtst library +PKG_SECTION:= x11/libs +PKG_BUILDDEP:= recordproto libXi +PKG_SITES:= ${MASTER_SITE_XORG} + +PKG_SUBPKGS:= LIBXTST LIBXTST_DEV +PKGSD_LIBXTST_DEV:= Xtst headers +PKGSC_LIBXTST_DEV:= x11/devel + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,LIBXTST,libxtst,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call PKG_template,LIBXTST_DEV,libxtst-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBXTST_DEV},${PKGSC_LIBXTST_DEV})) + +CONFIGURE_ARGS+= --disable-malloc0returnsnull + +libxtst-install: + ${INSTALL_DIR} ${IDIR_LIBXTST}/usr/lib + ${CP} ${WRKINST}/usr/lib/libXtst.so* ${IDIR_LIBXTST}/usr/lib + +libxtst-dev-install: + ${INSTALL_DIR} ${IDIR_LIBXTST_DEV}/usr/include + ${CP} ${WRKINST}/usr/include/* ${IDIR_LIBXTST_DEV}/usr/include + ${INSTALL_DIR} ${IDIR_LIBXTST_DEV}/usr/lib/pkgconfig + ${INSTALL_DATA} ${WRKINST}/usr/lib/pkgconfig/*.pc \ + ${IDIR_LIBXTST_DEV}/usr/lib/pkgconfig + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/libdnet/Makefile b/package/libdnet/Makefile index aaaf74aff..78e218cd4 100644 --- a/package/libdnet/Makefile +++ b/package/libdnet/Makefile @@ -21,6 +21,7 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,LIBDNET,libdnet,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,LIBDNET_DEV,libdnet-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBDNET_DEV},${PKGSC_LIBDNET_DEV})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ENV+= ac_cv_dnet_bsd_bpf=no CONFIGURE_ARGS+= --without-check diff --git a/package/libevent/Makefile b/package/libevent/Makefile index 43452e092..4b6077b5d 100644 --- a/package/libevent/Makefile +++ b/package/libevent/Makefile @@ -21,6 +21,8 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,LIBEVENT,libevent,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,LIBEVENT_DEV,libevent-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBEVENT_DEV},${PKGSC_LIBEVENT_DEV})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) + libevent-install: $(INSTALL_DIR) $(IDIR_LIBEVENT)/usr/lib $(CP) $(WRKINST)/usr/lib/libevent*.so* $(IDIR_LIBEVENT)/usr/lib diff --git a/package/libgd/patches/patch-config_hin b/package/libgd/patches/patch-config_hin new file mode 100644 index 000000000..e5752c060 --- /dev/null +++ b/package/libgd/patches/patch-config_hin @@ -0,0 +1,12 @@ +--- gd-2.0.35.orig/config.hin 2006-10-09 16:22:22.000000000 +0200 ++++ gd-2.0.35/config.hin 2011-04-01 13:40:40.551811181 +0200 +@@ -99,6 +99,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/libgd/patches/patch-config_ltmain_sh b/package/libgd/patches/patch-config_ltmain_sh new file mode 100644 index 000000000..9e40639f8 --- /dev/null +++ b/package/libgd/patches/patch-config_ltmain_sh @@ -0,0 +1,11 @@ +--- gd-2.0.35.orig/config/ltmain.sh 2006-10-09 16:22:22.000000000 +0200 ++++ gd-2.0.35/config/ltmain.sh 2011-04-01 14:15:35.561818573 +0200 +@@ -1671,7 +1671,7 @@ EOF + # -pg 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*|-pg| \ +- -t[45]*|-txscale*|@*) ++ -t[45]*|-txscale*|@*|-fstack-protector*|-flto*) + + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. diff --git a/package/libiconv/Makefile b/package/libiconv/Makefile index f27df06c1..645cf3338 100644 --- a/package/libiconv/Makefile +++ b/package/libiconv/Makefile @@ -25,6 +25,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBICONV,libiconv,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) $(eval $(call PKG_template,LIBICONV_DEV,libiconv-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBICONV_DEV},${PKGSC_LIBICONV_DEV})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) TARGET_CFLAGS+= -fPIC FAKE_FLAGS+= libdir="${WRKINST}/usr/lib" \ includedir="${WRKINST}/usr/include" \ diff --git a/package/libnet/Makefile b/package/libnet/Makefile index 7023e0b40..9e6b7663f 100644 --- a/package/libnet/Makefile +++ b/package/libnet/Makefile @@ -24,6 +24,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBNET,libnet,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,LIBNET_DEV,libnet-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBNET_DEV},${PKGSC_LIBNET_DEV})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) ENDIAN:=lil ifeq (${CPU_ARCH},mips) ENDIAN:=big diff --git a/package/libnfsidmap/patches/patch-ltmain_sh b/package/libnfsidmap/patches/patch-ltmain_sh new file mode 100644 index 000000000..9f0a7c0d7 --- /dev/null +++ b/package/libnfsidmap/patches/patch-ltmain_sh @@ -0,0 +1,11 @@ +--- libnfsidmap-0.24.orig/ltmain.sh 2010-12-08 19:02:47.000000000 +0100 ++++ libnfsidmap-0.24/ltmain.sh 2011-04-01 14:32:08.651808966 +0200 +@@ -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/libpng/Makefile b/package/libpng/Makefile index ed5808ecf..2deced6df 100644 --- a/package/libpng/Makefile +++ b/package/libpng/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= libpng -PKG_VERSION:= 1.2.44 -PKG_RELEASE:= 3 -PKG_MD5SUM:= 89b62f8daaeeab1342e307d6d1411ff1 +PKG_VERSION:= 1.5.1 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 220035f111ea045a51e290906025e8b5 PKG_DESCR:= A library for reading/writing PNG images PKG_SECTION:= libs PKG_DEPENDS:= zlib @@ -27,14 +27,15 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBPNG,libpng,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) $(eval $(call PKG_template,LIBPNG_DEV,libpng-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBPNG_DEV},${PKGSC_LIBPNG_DEV},${PKG_OPTS})) +#TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) + libpng-install: ${INSTALL_DIR} ${IDIR_LIBPNG}/usr/lib - ${CP} ${WRKINST}/usr/lib/libpng{,12}.so* ${IDIR_LIBPNG}/usr/lib + ${CP} ${WRKINST}/usr/lib/libpng*.so* ${IDIR_LIBPNG}/usr/lib libpng-dev-install: - ${INSTALL_DIR} ${IDIR_LIBPNG_DEV}/usr/include/libpng12 - ${CP} ${WRKINST}/usr/include/*.h ${IDIR_LIBPNG_DEV}/usr/include - ${CP} ${WRKINST}/usr/include/libpng12/*.h ${IDIR_LIBPNG_DEV}/usr/include/libpng12 + ${INSTALL_DIR} ${IDIR_LIBPNG_DEV}/usr/include + ${CP} ${WRKINST}/usr/include/* ${IDIR_LIBPNG_DEV}/usr/include ${INSTALL_DIR} ${IDIR_LIBPNG_DEV}/usr/lib/pkgconfig ${CP} ${WRKINST}/usr/lib/pkgconfig/*.pc \ ${IDIR_LIBPNG_DEV}/usr/lib/pkgconfig diff --git a/package/libpng/patches/001-apng.patch b/package/libpng/patches/001-apng.patch index 3af4a0547..3b68eea9f 100644 --- a/package/libpng/patches/001-apng.patch +++ b/package/libpng/patches/001-apng.patch @@ -1,51 +1,7 @@ -diff -Nur libpng-1.2.44.orig/png.c libpng-1.2.44/png.c ---- libpng-1.2.44.orig/png.c 2010-06-26 02:31:14.000000000 +0200 -+++ libpng-1.2.44/png.c 2010-07-08 21:21:33.745873377 +0200 -@@ -56,6 +56,11 @@ - PNG_tIME; - PNG_tRNS; - PNG_zTXt; -+#ifdef PNG_APNG_SUPPORTED -+PNG_acTL; -+PNG_fcTL; -+PNG_fdAT; -+#endif - - #ifdef PNG_READ_SUPPORTED - /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ -diff -Nur libpng-1.2.44.orig/pngconf.h libpng-1.2.44/pngconf.h ---- libpng-1.2.44.orig/pngconf.h 2010-06-26 02:31:14.000000000 +0200 -+++ libpng-1.2.44/pngconf.h 2010-07-08 21:21:33.906029659 +0200 -@@ -951,6 +951,10 @@ - # define PNG_NO_READ_tEXt - # define PNG_NO_READ_zTXt - #endif -+#ifndef PNG_NO_READ_APNG -+# define PNG_READ_APNG_SUPPORTED -+# define PNG_APNG_SUPPORTED -+#endif - #ifndef PNG_NO_READ_bKGD - # define PNG_READ_bKGD_SUPPORTED - # define PNG_bKGD_SUPPORTED -@@ -1177,6 +1181,14 @@ - # define PNG_TEXT_SUPPORTED - # endif - #endif -+#ifndef PNG_NO_WRITE_APNG -+# ifndef PNG_WRITE_APNG_SUPPORTED -+# define PNG_WRITE_APNG_SUPPORTED -+# endif -+# ifndef PNG_APNG_SUPPORTED -+# define PNG_APNG_SUPPORTED -+# endif -+#endif - - #ifdef PNG_WRITE_tIME_SUPPORTED - # ifndef PNG_NO_CONVERT_tIME -diff -Nur libpng-1.2.44.orig/pngget.c libpng-1.2.44/pngget.c ---- libpng-1.2.44.orig/pngget.c 2010-06-26 02:31:14.000000000 +0200 -+++ libpng-1.2.44/pngget.c 2010-07-08 21:21:33.676118515 +0200 -@@ -842,6 +842,167 @@ +diff -Nur libpng-1.5.1.orig/pngget.c libpng-1.5.1/pngget.c +--- libpng-1.5.1.orig/pngget.c 2011-02-03 05:58:17.000000000 +0100 ++++ libpng-1.5.1/pngget.c 2011-03-27 19:43:38.404620874 +0200 +@@ -937,6 +937,167 @@ } #endif @@ -55,7 +11,7 @@ diff -Nur libpng-1.2.44.orig/pngget.c libpng-1.2.44/pngget.c + png_uint_32 *num_frames, png_uint_32 *num_plays) +{ + png_debug1(1, "in %s retrieval function", "acTL"); -+ ++ + if (png_ptr != NULL && info_ptr != NULL && + (info_ptr->valid & PNG_INFO_acTL) && + num_frames != NULL && num_plays != NULL) @@ -64,7 +20,7 @@ diff -Nur libpng-1.2.44.orig/pngget.c libpng-1.2.44/pngget.c + *num_plays = info_ptr->num_plays; + return (1); + } -+ ++ + return (0); +} + @@ -72,7 +28,7 @@ diff -Nur libpng-1.2.44.orig/pngget.c libpng-1.2.44/pngget.c +png_get_num_frames(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_get_num_frames()"); -+ ++ + if (png_ptr != NULL && info_ptr != NULL) + return (info_ptr->num_frames); + return (0); @@ -82,7 +38,7 @@ diff -Nur libpng-1.2.44.orig/pngget.c libpng-1.2.44/pngget.c +png_get_num_plays(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_get_num_plays()"); -+ ++ + if (png_ptr != NULL && info_ptr != NULL) + return (info_ptr->num_plays); + return (0); @@ -96,7 +52,7 @@ diff -Nur libpng-1.2.44.orig/pngget.c libpng-1.2.44/pngget.c + png_byte *dispose_op, png_byte *blend_op) +{ + png_debug1(1, "in %s retrieval function", "fcTL"); -+ ++ + if (png_ptr != NULL && info_ptr != NULL && + (info_ptr->valid & PNG_INFO_fcTL) && + width != NULL && height != NULL && @@ -114,7 +70,7 @@ diff -Nur libpng-1.2.44.orig/pngget.c libpng-1.2.44/pngget.c + *blend_op = info_ptr->next_frame_blend_op; + return (1); + } -+ ++ + return (0); +} + @@ -122,7 +78,7 @@ diff -Nur libpng-1.2.44.orig/pngget.c libpng-1.2.44/pngget.c +png_get_next_frame_width(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_get_next_frame_width()"); -+ ++ + if (png_ptr != NULL && info_ptr != NULL) + return (info_ptr->next_frame_width); + return (0); @@ -132,7 +88,7 @@ diff -Nur libpng-1.2.44.orig/pngget.c libpng-1.2.44/pngget.c +png_get_next_frame_height(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_get_next_frame_height()"); -+ ++ + if (png_ptr != NULL && info_ptr != NULL) + return (info_ptr->next_frame_height); + return (0); @@ -142,7 +98,7 @@ diff -Nur libpng-1.2.44.orig/pngget.c libpng-1.2.44/pngget.c +png_get_next_frame_x_offset(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_get_next_frame_x_offset()"); -+ ++ + if (png_ptr != NULL && info_ptr != NULL) + return (info_ptr->next_frame_x_offset); + return (0); @@ -152,7 +108,7 @@ diff -Nur libpng-1.2.44.orig/pngget.c libpng-1.2.44/pngget.c +png_get_next_frame_y_offset(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_get_next_frame_y_offset()"); -+ ++ + if (png_ptr != NULL && info_ptr != NULL) + return (info_ptr->next_frame_y_offset); + return (0); @@ -162,7 +118,7 @@ diff -Nur libpng-1.2.44.orig/pngget.c libpng-1.2.44/pngget.c +png_get_next_frame_delay_num(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_get_next_frame_delay_num()"); -+ ++ + if (png_ptr != NULL && info_ptr != NULL) + return (info_ptr->next_frame_delay_num); + return (0); @@ -172,7 +128,7 @@ diff -Nur libpng-1.2.44.orig/pngget.c libpng-1.2.44/pngget.c +png_get_next_frame_delay_den(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_get_next_frame_delay_den()"); -+ ++ + if (png_ptr != NULL && info_ptr != NULL) + return (info_ptr->next_frame_delay_den); + return (0); @@ -182,7 +138,7 @@ diff -Nur libpng-1.2.44.orig/pngget.c libpng-1.2.44/pngget.c +png_get_next_frame_dispose_op(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_get_next_frame_dispose_op()"); -+ ++ + if (png_ptr != NULL && info_ptr != NULL) + return (info_ptr->next_frame_dispose_op); + return (0); @@ -192,7 +148,7 @@ diff -Nur libpng-1.2.44.orig/pngget.c libpng-1.2.44/pngget.c +png_get_next_frame_blend_op(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_get_next_frame_blend_op()"); -+ ++ + if (png_ptr != NULL && info_ptr != NULL) + return (info_ptr->next_frame_blend_op); + return (0); @@ -202,41 +158,32 @@ diff -Nur libpng-1.2.44.orig/pngget.c libpng-1.2.44/pngget.c +png_get_first_frame_is_hidden(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_first_frame_is_hidden()"); -+ ++ + if (png_ptr != NULL) + return (png_byte)(png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN); -+ ++ + return 0; +} +#endif /* PNG_APNG_SUPPORTED */ + #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED - png_uint_32 PNGAPI - png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr, -diff -Nur libpng-1.2.44.orig/png.h libpng-1.2.44/png.h ---- libpng-1.2.44.orig/png.h 2010-06-26 02:31:14.000000000 +0200 -+++ libpng-1.2.44/png.h 2010-07-08 21:21:33.796029652 +0200 -@@ -1041,6 +1041,19 @@ - png_fixed_point int_y_blue PNG_DEPSTRUCT; + int PNGAPI + png_get_unknown_chunks(png_const_structp png_ptr, png_const_infop info_ptr, +diff -Nur libpng-1.5.1.orig/png.h libpng-1.5.1/png.h +--- libpng-1.5.1.orig/png.h 2011-02-03 05:58:16.000000000 +0100 ++++ libpng-1.5.1/png.h 2011-03-27 19:43:38.414620995 +0200 +@@ -404,6 +404,10 @@ + # include "pnglibconf.h" #endif -+#ifdef PNG_APNG_SUPPORTED -+ png_uint_32 num_frames; /* including default image */ -+ png_uint_32 num_plays; -+ png_uint_32 next_frame_width; -+ png_uint_32 next_frame_height; -+ png_uint_32 next_frame_x_offset; -+ png_uint_32 next_frame_y_offset; -+ png_uint_16 next_frame_delay_num; -+ png_uint_16 next_frame_delay_den; -+ png_byte next_frame_dispose_op; -+ png_byte next_frame_blend_op; -+#endif -+ - } png_info; - - typedef png_info FAR * png_infop; -@@ -1142,6 +1155,10 @@ ++#define PNG_APNG_SUPPORTED ++#define PNG_READ_APNG_SUPPORTED ++#define PNG_WRITE_APNG_SUPPORTED ++ + #ifndef PNG_VERSION_INFO_ONLY + /* Standard header files (not needed for the version info) */ + # ifdef PNG_SETJMP_SUPPORTED +@@ -766,6 +770,10 @@ #define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */ #define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */ #define PNG_INFO_IDAT 0x8000L /* ESR, 1.0.6 */ @@ -247,257 +194,149 @@ diff -Nur libpng-1.2.44.orig/png.h libpng-1.2.44/png.h /* This is used for the transformation routines, as some of them * change these values for the row. It also should enable using -@@ -1182,6 +1199,10 @@ - typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop)); - typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep, - png_uint_32, int)); +@@ -811,6 +819,10 @@ + (png_structp, png_infop), ); + typedef PNG_CALLBACK(void, *png_progressive_row_ptr, + (png_structp, png_bytep, png_uint_32, int), ); +#ifdef PNG_APNG_SUPPORTED -+typedef void (PNGAPI *png_progressive_frame_ptr) PNGARG((png_structp, -+ png_uint_32)); ++typedef PNG_CALLBACK(void, *png_progressive_frame_ptr, (png_structp, ++ png_uint_32),); +#endif #endif #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ -@@ -1527,6 +1548,39 @@ - png_uint_32 user_height_max PNG_DEPSTRUCT; - #endif +@@ -1242,6 +1254,18 @@ + PNG_EXPORT(60, void, png_write_image, + (png_structp png_ptr, png_bytepp image)); -+#ifdef PNG_APNG_SUPPORTED -+ png_uint_32 apng_flags; -+ png_uint_32 next_seq_num; /* next fcTL/fdAT chunk sequence number */ -+ png_uint_32 first_frame_width; -+ png_uint_32 first_frame_height; -+ -+#ifdef PNG_READ_APNG_SUPPORTED -+ png_uint_32 num_frames_read; /* incremented after all image data of */ -+ /* a frame is read */ -+#ifdef PNG_PROGRESSIVE_READ_SUPPORTED -+ png_progressive_frame_ptr frame_info_fn; /* frame info read callback */ -+ png_progressive_frame_ptr frame_end_fn; /* frame data read callback */ -+#endif -+#endif -+ +#ifdef PNG_WRITE_APNG_SUPPORTED -+ png_uint_32 num_frames_to_write; -+ png_uint_32 num_frames_written; -+#endif -+ -+/* For png_struct.apng_flags: */ -+#define PNG_FIRST_FRAME_HIDDEN 0x0001 -+ -+/* dispose_op flags from inside fcTL */ -+#define PNG_DISPOSE_OP_NONE 0x00 -+#define PNG_DISPOSE_OP_BACKGROUND 0x01 -+#define PNG_DISPOSE_OP_PREVIOUS 0x02 -+ -+/* blend_op flags from inside fcTL */ -+#define PNG_BLEND_OP_SOURCE 0x00 -+#define PNG_BLEND_OP_OVER 0x01 -+#endif /* PNG_APNG_SUPPORTED */ -+ - /* New member added in libpng-1.0.25 and 1.2.17 */ - #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED - /* Storage for unknown chunk that the library doesn't recognize. */ -@@ -1861,6 +1915,18 @@ - extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr, - png_bytepp image)); - -+#ifdef PNG_WRITE_APNG_SUPPORTED -+extern PNG_EXPORT (void,png_write_frame_head) PNGARG((png_structp png_ptr, -+ png_infop png_info, png_bytepp row_pointers, -+ png_uint_32 width, png_uint_32 height, -+ png_uint_32 x_offset, png_uint_32 y_offset, -+ png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op, -+ png_byte blend_op)); ++PNG_EXPORT(1001, void, png_write_frame_head, (png_structp png_ptr, ++ png_infop info_ptr, png_bytepp row_pointers, ++ png_uint_32 width, png_uint_32 height, ++ png_uint_32 x_offset, png_uint_32 y_offset, ++ png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op, ++ png_byte blend_op)); + -+extern PNG_EXPORT (void,png_write_frame_tail) PNGARG((png_structp png_ptr, -+ png_infop png_info)); ++PNG_EXPORT(1002, void, png_write_frame_tail, (png_structp png_ptr, ++ png_infop info_ptr)); +#endif -+ - /* Writes the end of the PNG file. */ - extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr, - png_infop info_ptr)); -@@ -2114,6 +2180,11 @@ - png_voidp progressive_ptr, - png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, - png_progressive_end_ptr end_fn)); ++ + /* Write the end of the PNG file. */ + PNG_EXPORT(61, void, png_write_end, + (png_structp png_ptr, png_infop info_ptr)); +@@ -1496,6 +1520,11 @@ + PNG_EXPORT(90, void, png_set_progressive_read_fn, (png_structp png_ptr, + png_voidp progressive_ptr, png_progressive_info_ptr info_fn, + png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn)); +#ifdef PNG_READ_APNG_SUPPORTED -+extern PNG_EXPORT(void,png_set_progressive_frame_fn) PNGARG((png_structp png_ptr, -+ png_progressive_frame_ptr frame_info_fn, -+ png_progressive_frame_ptr frame_end_fn)); ++PNG_EXPORT(1003, void, png_set_progressive_frame_fn, (png_structp png_ptr, ++ png_progressive_frame_ptr frame_info_fn, ++ png_progressive_frame_ptr frame_end_fn)); +#endif /* Returns the user pointer associated with the push read functions */ - extern PNG_EXPORT(png_voidp,png_get_progressive_ptr) -@@ -2554,6 +2625,59 @@ - #endif - #endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */ + PNG_EXPORT(91, png_voidp, png_get_progressive_ptr, (png_const_structp png_ptr)); +@@ -1970,6 +1999,62 @@ + int unit, png_const_charp swidth, png_const_charp sheight)); + #endif /* PNG_sCAL_SUPPORTED */ +#ifdef PNG_APNG_SUPPORTED -+extern PNG_EXPORT(png_uint_32,png_get_acTL) PNGARG((png_structp png_ptr, ++PNG_EXPORT(1004, png_uint_32, png_get_acTL, (png_structp png_ptr, + png_infop info_ptr, png_uint_32 *num_frames, png_uint_32 *num_plays)); -+extern PNG_EXPORT(png_uint_32,png_set_acTL) PNGARG((png_structp png_ptr, ++PNG_EXPORT(1005, png_uint_32, png_set_acTL, (png_structp png_ptr, + png_infop info_ptr, png_uint_32 num_frames, png_uint_32 num_plays)); -+extern PNG_EXPORT(png_uint_32,png_get_num_frames) PNGARG((png_structp png_ptr, ++PNG_EXPORT(1006, png_uint_32, png_get_num_frames, (png_structp png_ptr, ++ png_infop info_ptr)); ++PNG_EXPORT(1007, png_uint_32,png_get_num_plays, (png_structp png_ptr, + png_infop info_ptr)); -+extern PNG_EXPORT(png_uint_32,png_get_num_plays) -+ PNGARG((png_structp png_ptr, png_infop info_ptr)); + -+extern PNG_EXPORT(png_uint_32,png_get_next_frame_fcTL) -+ PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 *width, -+ png_uint_32 *height, png_uint_32 *x_offset, png_uint_32 *y_offset, ++PNG_EXPORT(1008, png_uint_32, png_get_next_frame_fcTL, ++ (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width, ++ png_uint_32 *height, png_uint_32 *x_offset, png_uint_32 *y_offset, + png_uint_16 *delay_num, png_uint_16 *delay_den, png_byte *dispose_op, + png_byte *blend_op)); -+extern PNG_EXPORT(png_uint_32,png_set_next_frame_fcTL) -+ PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 width, -+ png_uint_32 height, png_uint_32 x_offset, png_uint_32 y_offset, ++PNG_EXPORT(1009, png_uint_32, png_set_next_frame_fcTL, ++ (png_structp png_ptr, png_infop info_ptr, png_uint_32 width, ++ png_uint_32 height, png_uint_32 x_offset, png_uint_32 y_offset, + png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op, + png_byte blend_op)); -+extern PNG_EXPORT(void,png_ensure_fcTL_is_valid) -+ PNGARG((png_structp png_ptr, -+ png_uint_32 width, png_uint_32 height, -+ png_uint_32 x_offset, png_uint_32 y_offset, -+ png_uint_16 delay_num, png_uint_16 delay_den, -+ png_byte dispose_op, png_byte blend_op)); -+extern PNG_EXPORT(png_uint_32,png_get_next_frame_width) -+ PNGARG((png_structp png_ptr, png_infop info_ptr)); -+extern PNG_EXPORT(png_uint_32,png_get_next_frame_height) -+ PNGARG((png_structp png_ptr, png_infop info_ptr)); -+extern PNG_EXPORT(png_uint_32,png_get_next_frame_x_offset) -+ PNGARG((png_structp png_ptr, png_infop info_ptr)); -+extern PNG_EXPORT(png_uint_32,png_get_next_frame_y_offset) -+ PNGARG((png_structp png_ptr, png_infop info_ptr)); -+extern PNG_EXPORT(png_uint_16,png_get_next_frame_delay_num) -+ PNGARG((png_structp png_ptr, png_infop info_ptr)); -+extern PNG_EXPORT(png_uint_16,png_get_next_frame_delay_den) -+ PNGARG((png_structp png_ptr, png_infop info_ptr)); -+extern PNG_EXPORT(png_byte,png_get_next_frame_dispose_op) -+ PNGARG((png_structp png_ptr, png_infop info_ptr)); -+extern PNG_EXPORT(png_byte,png_get_next_frame_blend_op) -+ PNGARG((png_structp png_ptr, png_infop info_ptr)); -+extern PNG_EXPORT(png_byte,png_get_first_frame_is_hidden) -+ PNGARG((png_structp png_ptr, png_infop info_ptr)); -+extern PNG_EXPORT(png_uint_32,png_set_first_frame_is_hidden) -+ PNGARG((png_structp png_ptr, png_infop info_ptr, png_byte is_hidden)); ++PNG_EXPORT(1010, png_uint_32, png_get_next_frame_width, ++ (png_structp png_ptr, png_infop info_ptr)); ++PNG_EXPORT(1011, png_uint_32, png_get_next_frame_height, ++ (png_structp png_ptr, png_infop info_ptr)); ++PNG_EXPORT(1012, png_uint_32, png_get_next_frame_x_offset, ++ (png_structp png_ptr, png_infop info_ptr)); ++PNG_EXPORT(1013, png_uint_32, png_get_next_frame_y_offset, ++ (png_structp png_ptr, png_infop info_ptr)); ++PNG_EXPORT(1014, png_uint_16, png_get_next_frame_delay_num, ++ (png_structp png_ptr, png_infop info_ptr)); ++PNG_EXPORT(1015, png_uint_16, png_get_next_frame_delay_den, ++ (png_structp png_ptr, png_infop info_ptr)); ++PNG_EXPORT(1016, png_byte, png_get_next_frame_dispose_op, ++ (png_structp png_ptr, png_infop info_ptr)); ++PNG_EXPORT(1017, png_byte, png_get_next_frame_blend_op, ++ (png_structp png_ptr, png_infop info_ptr)); ++PNG_EXPORT(1018, png_byte, png_get_first_frame_is_hidden, ++ (png_structp png_ptr, png_infop info_ptr)); ++PNG_EXPORT(1019, png_uint_32, png_set_first_frame_is_hidden, ++ (png_structp png_ptr, png_infop info_ptr, png_byte is_hidden)); ++ ++/* dispose_op flags from inside fcTL */ ++#define PNG_DISPOSE_OP_NONE 0x00 ++#define PNG_DISPOSE_OP_BACKGROUND 0x01 ++#define PNG_DISPOSE_OP_PREVIOUS 0x02 ++ ++/* blend_op flags from inside fcTL */ ++#define PNG_BLEND_OP_SOURCE 0x00 ++#define PNG_BLEND_OP_OVER 0x01 +#endif /* PNG_APNG_SUPPORTED */ + +#ifdef PNG_READ_APNG_SUPPORTED -+extern PNG_EXPORT(void,png_read_frame_head) PNGARG((png_structp png_ptr, ++PNG_EXPORT(1020, void, png_read_frame_head, (png_structp png_ptr, + png_infop info_ptr)); +#endif + #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED /* Provide a list of chunks and how they are to be handled, if the built-in handling or default unknown chunk handling is not desired. Any chunks not -@@ -2918,6 +3042,10 @@ - #define PNG_BACKGROUND_IS_GRAY 0x800 - #define PNG_HAVE_PNG_SIGNATURE 0x1000 - #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */ -+#ifdef PNG_APNG_SUPPORTED -+#define PNG_HAVE_acTL 0x4000 -+#define PNG_HAVE_fcTL 0x8000L -+#endif - - /* Flags for the transformations the PNG library does on the image data */ - #define PNG_BGR 0x0001 -@@ -3060,6 +3188,11 @@ - #define PNG_tIME png_byte png_tIME[5] = {116, 73, 77, 69, '\0'} - #define PNG_tRNS png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'} - #define PNG_zTXt png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'} -+#ifdef PNG_APNG_SUPPORTED -+#define PNG_acTL png_byte png_acTL[5] = { 97, 99, 84, 76, '\0'} -+#define PNG_fcTL png_byte png_fcTL[5] = {102, 99, 84, 76, '\0'} -+#define PNG_fdAT png_byte png_fdAT[5] = {102, 100, 65, 84, '\0'} -+#endif - - #ifdef PNG_USE_GLOBAL_ARRAYS - PNG_EXPORT_VAR (png_byte FARDATA) png_IHDR[5]; -@@ -3083,6 +3216,11 @@ - PNG_EXPORT_VAR (png_byte FARDATA) png_tIME[5]; - PNG_EXPORT_VAR (png_byte FARDATA) png_tRNS[5]; - PNG_EXPORT_VAR (png_byte FARDATA) png_zTXt[5]; -+#ifdef PNG_APNG_SUPPORTED -+PNG_EXPORT_VAR (png_byte FARDATA) png_acTL[5]; -+PNG_EXPORT_VAR (png_byte FARDATA) png_fcTL[5]; -+PNG_EXPORT_VAR (png_byte FARDATA) png_fdAT[5]; -+#endif - #endif /* PNG_USE_GLOBAL_ARRAYS */ - - #if defined(PNG_1_0_X) || defined (PNG_1_2_X) -@@ -3365,6 +3503,17 @@ - #endif +diff -Nur libpng-1.5.1.orig/pnginfo.h libpng-1.5.1/pnginfo.h +--- libpng-1.5.1.orig/pnginfo.h 2011-02-03 05:58:17.000000000 +0100 ++++ libpng-1.5.1/pnginfo.h 2011-03-27 19:43:38.543370848 +0200 +@@ -266,5 +266,18 @@ + png_bytepp row_pointers; /* the image bits */ #endif -+#ifdef PNG_WRITE_APNG_SUPPORTED -+PNG_EXTERN void png_write_acTL PNGARG((png_structp png_ptr, -+ png_uint_32 num_frames, png_uint_32 num_plays)); -+ -+PNG_EXTERN void png_write_fcTL PNGARG((png_structp png_ptr, -+ png_uint_32 width, png_uint_32 height, -+ png_uint_32 x_offset, png_uint_32 y_offset, -+ png_uint_16 delay_num, png_uint_16 delay_den, -+ png_byte dispose_op, png_byte blend_op)); -+#endif -+ - /* Called when finished processing a row of data */ - PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)) PNG_PRIVATE; - -@@ -3417,6 +3566,20 @@ - PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr, - png_infop info_ptr)) PNG_PRIVATE; - -+#ifdef PNG_READ_APNG_SUPPORTED -+/* Private, reset some things to become ready for reading next frame */ -+PNG_EXTERN void png_read_reset PNGARG((png_structp png_ptr)); -+PNG_EXTERN void png_read_reinit PNGARG((png_structp png_ptr, -+ png_infop info_ptr)); -+PNG_EXTERN void png_progressive_read_reset PNGARG((png_structp png_ptr)); -+#endif -+#ifdef PNG_WRITE_APNG_SUPPORTED -+/* Private, reset some things to become ready for writing next frame */ -+PNG_EXTERN void png_write_reset PNGARG((png_structp png_ptr)); -+PNG_EXTERN void png_write_reinit PNGARG((png_structp png_ptr, -+ png_infop info_ptr, png_uint_32 width, png_uint_32 height)); -+#endif -+ - /* These are the functions that do the transformations */ - #ifdef PNG_READ_FILLER_SUPPORTED - PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info, -@@ -3640,6 +3803,18 @@ - png_uint_32 length)) PNG_PRIVATE; - #endif - -+#ifdef PNG_READ_APNG_SUPPORTED -+PNG_EXTERN void png_handle_acTL PNGARG((png_structp png_ptr, png_infop info_ptr, -+ png_uint_32 length)); -+PNG_EXTERN void png_handle_fcTL PNGARG((png_structp png_ptr, png_infop info_ptr, -+ png_uint_32 length)); -+PNG_EXTERN void png_have_info PNGARG((png_structp png_ptr, png_infop info_ptr)); -+PNG_EXTERN void png_handle_fdAT PNGARG((png_structp png_ptr, png_infop info_ptr, -+ png_uint_32 length)); -+PNG_EXTERN void png_ensure_sequence_number PNGARG((png_structp png_ptr, -+ png_uint_32 length)); ++#ifdef PNG_APNG_SUPPORTED ++ png_uint_32 num_frames; /* including default image */ ++ png_uint_32 num_plays; ++ png_uint_32 next_frame_width; ++ png_uint_32 next_frame_height; ++ png_uint_32 next_frame_x_offset; ++ png_uint_32 next_frame_y_offset; ++ png_uint_16 next_frame_delay_num; ++ png_uint_16 next_frame_delay_den; ++ png_byte next_frame_dispose_op; ++ png_byte next_frame_blend_op; +#endif + - PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 length)) PNG_PRIVATE; - -diff -Nur libpng-1.2.44.orig/pngpread.c libpng-1.2.44/pngpread.c ---- libpng-1.2.44.orig/pngpread.c 2010-06-26 02:31:14.000000000 +0200 -+++ libpng-1.2.44/pngpread.c 2010-07-08 21:21:33.947205863 +0200 -@@ -206,6 +206,11 @@ + }; + #endif /* PNGINFO_H */ +diff -Nur libpng-1.5.1.orig/pngpread.c libpng-1.5.1/pngpread.c +--- libpng-1.5.1.orig/pngpread.c 2011-02-03 05:58:17.000000000 +0100 ++++ libpng-1.5.1/pngpread.c 2011-03-27 19:43:38.673370990 +0200 +@@ -263,6 +263,11 @@ #ifdef PNG_READ_zTXt_SUPPORTED - PNG_CONST PNG_zTXt; + PNG_zTXt; #endif +#ifdef PNG_READ_APNG_SUPPORTED -+ PNG_CONST PNG_acTL; -+ PNG_CONST PNG_fcTL; -+ PNG_CONST PNG_fdAT; ++ PNG_acTL; ++ PNG_fcTL; ++ PNG_fdAT; +#endif - #endif /* PNG_USE_LOCAL_ARRAYS */ /* First we make sure we have enough data for the 4 byte chunk name -@@ -232,6 +237,103 @@ + * and the 4 byte chunk length before proceeding with decoding the +@@ -288,6 +293,103 @@ png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; } @@ -510,7 +349,7 @@ diff -Nur libpng-1.2.44.orig/pngpread.c libpng-1.2.44/pngpread.c + /* Discard trailing IDATs for the first frame */ + if (png_ptr->mode & PNG_HAVE_fcTL || png_ptr->num_frames_read > 1) + png_error(png_ptr, "out of place IDAT"); -+ ++ + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); @@ -528,13 +367,13 @@ diff -Nur libpng-1.2.44.orig/pngpread.c libpng-1.2.44/pngpread.c + return; + } + png_ensure_sequence_number(png_ptr, 4); -+ ++ + if (!(png_ptr->mode & PNG_HAVE_fcTL)) + { + /* Discard trailing fdATs for frames other than the first */ + if (png_ptr->num_frames_read < 2) + png_error(png_ptr, "out of place fdAT"); -+ ++ + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); @@ -550,7 +389,7 @@ diff -Nur libpng-1.2.44.orig/pngpread.c libpng-1.2.44/pngpread.c + png_ptr->idat_size = png_ptr->push_length - 4; + png_ptr->mode |= PNG_HAVE_IDAT; + png_ptr->process_mode = PNG_READ_IDAT_MODE; -+ ++ + return; + } + } @@ -561,23 +400,23 @@ diff -Nur libpng-1.2.44.orig/pngpread.c libpng-1.2.44/pngpread.c + png_push_save_buffer(png_ptr); + return; + } -+ ++ + png_read_reset(png_ptr); + png_ptr->mode &= ~PNG_HAVE_fcTL; -+ ++ + png_handle_fcTL(png_ptr, info_ptr, png_ptr->push_length); -+ ++ + if (!(png_ptr->mode & PNG_HAVE_fcTL)) + png_error(png_ptr, "missing required fcTL chunk"); -+ ++ + png_read_reinit(png_ptr, info_ptr); + png_progressive_read_reset(png_ptr); -+ ++ + if (png_ptr->frame_info_fn != NULL) + (*(png_ptr->frame_info_fn))(png_ptr, png_ptr->num_frames_read); -+ ++ + png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; -+ ++ + return; + } + else @@ -593,16 +432,16 @@ diff -Nur libpng-1.2.44.orig/pngpread.c libpng-1.2.44/pngpread.c + png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; + return; + } -+ ++ + return; + } +#endif /* PNG_READ_APNG_SUPPORTED */ + if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) - if (png_ptr->mode & PNG_AFTER_IDAT) - png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT; -@@ -327,6 +429,9 @@ - png_error(png_ptr, "Too many IDAT's found"); + if (png_ptr->mode & PNG_AFTER_IDAT) + png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT; +@@ -383,6 +485,9 @@ + png_benign_error(png_ptr, "Too many IDATs found"); } +#ifdef PNG_READ_APNG_SUPPORTED @@ -611,7 +450,7 @@ diff -Nur libpng-1.2.44.orig/pngpread.c libpng-1.2.44/pngpread.c png_ptr->idat_size = png_ptr->push_length; png_ptr->mode |= PNG_HAVE_IDAT; png_ptr->process_mode = PNG_READ_IDAT_MODE; -@@ -559,6 +664,38 @@ +@@ -615,6 +720,38 @@ } #endif @@ -650,17 +489,14 @@ diff -Nur libpng-1.2.44.orig/pngpread.c libpng-1.2.44/pngpread.c else { if (png_ptr->push_length + 4 > png_ptr->buffer_size) -@@ -738,13 +875,17 @@ +@@ -810,11 +947,15 @@ png_push_read_IDAT(png_structp png_ptr) { - #ifdef PNG_USE_LOCAL_ARRAYS -- PNG_CONST PNG_IDAT; -+ PNG_IDAT; + PNG_IDAT; +#ifdef PNG_READ_APNG_SUPPORTED + PNG_fdAT; + PNG_IEND; +#endif - #endif if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER)) { png_byte chunk_length[4]; @@ -670,13 +506,13 @@ diff -Nur libpng-1.2.44.orig/pngpread.c libpng-1.2.44/pngpread.c { png_push_save_buffer(png_ptr); return; -@@ -756,15 +897,62 @@ +@@ -826,17 +967,64 @@ png_crc_read(png_ptr, png_ptr->chunk_name, 4); png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; - if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) +#ifdef PNG_READ_APNG_SUPPORTED -+ if (png_memcmp(png_ptr->chunk_name, (png_bytep)png_fdAT, 4) ++ if (png_memcmp(png_ptr->chunk_name, png_fdAT, 4) + && png_ptr->num_frames_read > 0) + { + if (png_ptr->flags & PNG_FLAG_ZLIB_FINISHED) @@ -712,8 +548,10 @@ diff -Nur libpng-1.2.44.orig/pngpread.c libpng-1.2.44/pngpread.c + ) { png_ptr->process_mode = PNG_READ_CHUNK_MODE; + if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) png_error(png_ptr, "Not enough compressed data"); + +#ifdef PNG_READ_APNG_SUPPORTED + if (png_ptr->frame_end_fn != NULL) + (*(png_ptr->frame_end_fn))(png_ptr, png_ptr->num_frames_read); @@ -734,7 +572,7 @@ diff -Nur libpng-1.2.44.orig/pngpread.c libpng-1.2.44/pngpread.c } if (png_ptr->idat_size && png_ptr->save_buffer_size) { -@@ -1763,6 +1951,17 @@ +@@ -1843,6 +2031,17 @@ png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer); } @@ -750,25 +588,119 @@ diff -Nur libpng-1.2.44.orig/pngpread.c libpng-1.2.44/pngpread.c +#endif + png_voidp PNGAPI - png_get_progressive_ptr(png_structp png_ptr) + png_get_progressive_ptr(png_const_structp png_ptr) { -diff -Nur libpng-1.2.44.orig/pngread.c libpng-1.2.44/pngread.c ---- libpng-1.2.44.orig/pngread.c 2010-06-26 02:31:14.000000000 +0200 -+++ libpng-1.2.44/pngread.c 2010-07-08 21:21:33.676118515 +0200 -@@ -437,6 +437,11 @@ +diff -Nur libpng-1.5.1.orig/pngpriv.h libpng-1.5.1/pngpriv.h +--- libpng-1.5.1.orig/pngpriv.h 2011-02-03 05:58:17.000000000 +0100 ++++ libpng-1.5.1/pngpriv.h 2011-03-27 19:43:38.503370856 +0200 +@@ -275,6 +275,10 @@ + #define PNG_BACKGROUND_IS_GRAY 0x800 + #define PNG_HAVE_PNG_SIGNATURE 0x1000 + #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */ ++#ifdef PNG_APNG_SUPPORTED ++#define PNG_HAVE_acTL 0x4000 ++#define PNG_HAVE_fcTL 0x8000L ++#endif + + /* Flags for the transformations the PNG library does on the image data */ + #define PNG_BGR 0x0001 +@@ -457,6 +461,14 @@ + #define PNG_tIME PNG_CONST png_byte png_tIME[5] = {116, 73, 77, 69, '\0'} + #define PNG_tRNS PNG_CONST png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'} + #define PNG_zTXt PNG_CONST png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'} ++#ifdef PNG_APNG_SUPPORTED ++#define PNG_acTL PNG_CONST png_byte png_acTL[5] = { 97, 99, 84, 76, '\0'} ++#define PNG_fcTL PNG_CONST png_byte png_fcTL[5] = {102, 99, 84, 76, '\0'} ++#define PNG_fdAT PNG_CONST png_byte png_fdAT[5] = {102, 100, 65, 84, '\0'} ++ ++/* For png_struct.apng_flags: */ ++#define PNG_FIRST_FRAME_HIDDEN 0x0001 ++#endif + + + /* Inhibit C++ name-mangling for libpng functions but not for system calls. */ +@@ -696,6 +708,17 @@ + int unit, png_const_charp width, png_const_charp height)); + #endif + ++#ifdef PNG_WRITE_APNG_SUPPORTED ++PNG_EXTERN void png_write_acTL PNGARG((png_structp png_ptr, ++ png_uint_32 num_frames, png_uint_32 num_plays)); ++ ++PNG_EXTERN void png_write_fcTL PNGARG((png_structp png_ptr, ++ png_uint_32 width, png_uint_32 height, ++ png_uint_32 x_offset, png_uint_32 y_offset, ++ png_uint_16 delay_num, png_uint_16 delay_den, ++ png_byte dispose_op, png_byte blend_op)); ++#endif ++ + /* Called when finished processing a row of data */ + PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)); + +@@ -744,6 +767,20 @@ + PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr, + png_infop info_ptr)); + ++#ifdef PNG_READ_APNG_SUPPORTED ++/* Private, reset some things to become ready for reading next frame */ ++PNG_EXTERN void png_read_reset PNGARG((png_structp png_ptr)); ++PNG_EXTERN void png_read_reinit PNGARG((png_structp png_ptr, ++ png_infop info_ptr)); ++PNG_EXTERN void png_progressive_read_reset PNGARG((png_structp png_ptr)); ++#endif ++#ifdef PNG_WRITE_APNG_SUPPORTED ++/* Private, reset some things to become ready for writing next frame */ ++PNG_EXTERN void png_write_reset PNGARG((png_structp png_ptr)); ++PNG_EXTERN void png_write_reinit PNGARG((png_structp png_ptr, ++ png_infop info_ptr, png_uint_32 width, png_uint_32 height)); ++#endif ++ + /* These are the functions that do the transformations */ + #ifdef PNG_READ_FILLER_SUPPORTED + PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info, +@@ -972,6 +1009,25 @@ + png_uint_32 length)); + #endif + ++#ifdef PNG_READ_APNG_SUPPORTED ++PNG_EXTERN void png_handle_acTL PNGARG((png_structp png_ptr, png_infop info_ptr, ++ png_uint_32 length)); ++PNG_EXTERN void png_handle_fcTL PNGARG((png_structp png_ptr, png_infop info_ptr, ++ png_uint_32 length)); ++PNG_EXTERN void png_have_info PNGARG((png_structp png_ptr, png_infop info_ptr)); ++PNG_EXTERN void png_handle_fdAT PNGARG((png_structp png_ptr, png_infop info_ptr, ++ png_uint_32 length)); ++PNG_EXTERN void png_ensure_sequence_number PNGARG((png_structp png_ptr, ++ png_uint_32 length)); ++#endif ++#ifdef PNG_APNG_SUPPORTED ++PNG_EXTERN void png_ensure_fcTL_is_valid PNGARG((png_structp png_ptr, ++ png_uint_32 width, png_uint_32 height, ++ png_uint_32 x_offset, png_uint_32 y_offset, ++ png_uint_16 delay_num, png_uint_16 delay_den, ++ png_byte dispose_op, png_byte blend_op)); ++#endif ++ + PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); + +diff -Nur libpng-1.5.1.orig/pngread.c libpng-1.5.1/pngread.c +--- libpng-1.5.1.orig/pngread.c 2011-02-03 05:58:17.000000000 +0100 ++++ libpng-1.5.1/pngread.c 2011-03-27 19:43:38.383370613 +0200 +@@ -292,6 +292,11 @@ #ifdef PNG_READ_zTXt_SUPPORTED - PNG_CONST PNG_zTXt; + PNG_zTXt; #endif +#ifdef PNG_READ_APNG_SUPPORTED -+ PNG_CONST PNG_acTL; -+ PNG_CONST PNG_fcTL; -+ PNG_CONST PNG_fdAT; ++ PNG_acTL; ++ PNG_fcTL; ++ PNG_fdAT; +#endif - #endif /* PNG_USE_LOCAL_ARRAYS */ png_uint_32 length = png_read_chunk_header(png_ptr); PNG_CONST png_bytep chunk_name = png_ptr->chunk_name; -@@ -481,6 +486,9 @@ - !(png_ptr->mode & PNG_HAVE_PLTE)) + +@@ -344,6 +349,9 @@ + !(png_ptr->mode & PNG_HAVE_PLTE)) png_error(png_ptr, "Missing PLTE before IDAT"); +#ifdef PNG_READ_APNG_SUPPORTED @@ -777,10 +709,10 @@ diff -Nur libpng-1.2.44.orig/pngread.c libpng-1.2.44/pngread.c png_ptr->idat_size = length; png_ptr->mode |= PNG_HAVE_IDAT; break; -@@ -553,12 +561,97 @@ - else if (!png_memcmp(chunk_name, png_iTXt, 4)) +@@ -434,12 +442,96 @@ png_handle_iTXt(png_ptr, info_ptr, length); #endif + +#ifdef PNG_READ_APNG_SUPPORTED + else if (!png_memcmp(chunk_name, png_acTL, 4)) + png_handle_acTL(png_ptr, info_ptr, length); @@ -789,6 +721,7 @@ diff -Nur libpng-1.2.44.orig/pngread.c libpng-1.2.44/pngread.c + else if (!png_memcmp(chunk_name, png_fdAT, 4)) + png_handle_fdAT(png_ptr, info_ptr, length); +#endif ++ else png_handle_unknown(png_ptr, info_ptr, length); } @@ -800,39 +733,37 @@ diff -Nur libpng-1.2.44.orig/pngread.c libpng-1.2.44/pngread.c +png_read_frame_head(png_structp png_ptr, png_infop info_ptr) +{ + png_byte have_chunk_after_DAT; /* after IDAT or after fdAT */ -+ ++ + png_debug(0, "Reading frame head"); -+ ++ + if (!(png_ptr->mode & PNG_HAVE_acTL)) + png_error(png_ptr, "attempt to png_read_frame_head() but " + "no acTL present"); -+ ++ + /* do nothing for the main IDAT */ + if (png_ptr->num_frames_read == 0) + return; -+ ++ + png_crc_finish(png_ptr, 0); /* CRC from last IDAT or fdAT chunk */ -+ ++ + png_read_reset(png_ptr); + png_ptr->mode &= ~PNG_HAVE_fcTL; -+ ++ + have_chunk_after_DAT = 0; + for (;;) + { -+#ifdef PNG_USE_LOCAL_ARRAYS + PNG_IDAT; + PNG_fdAT; + PNG_fcTL; -+#endif + png_byte chunk_length[4]; + png_uint_32 length; -+ ++ + png_read_data(png_ptr, chunk_length, 4); + length = png_get_uint_31(png_ptr, chunk_length); -+ ++ + png_reset_crc(png_ptr); + png_crc_read(png_ptr, png_ptr->chunk_name, 4); -+ ++ + if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + { + /* discard trailing IDATs for the first frame */ @@ -848,7 +779,7 @@ diff -Nur libpng-1.2.44.orig/pngread.c libpng-1.2.44/pngread.c + else if (!png_memcmp(png_ptr->chunk_name, png_fdAT, 4)) + { + png_ensure_sequence_number(png_ptr, length); -+ ++ + /* discard trailing fdATs for frames other than the first */ + if (!have_chunk_after_DAT && png_ptr->num_frames_read > 1) + png_crc_finish(png_ptr, length - 4); @@ -856,7 +787,7 @@ diff -Nur libpng-1.2.44.orig/pngread.c libpng-1.2.44/pngread.c + { + png_ptr->idat_size = length - 4; + png_ptr->mode |= PNG_HAVE_IDAT; -+ ++ + break; + } + else @@ -875,18 +806,18 @@ diff -Nur libpng-1.2.44.orig/pngread.c libpng-1.2.44/pngread.c /* Optional call to update the users info_ptr structure */ void PNGAPI png_read_update_info(png_structp png_ptr, png_infop info_ptr) -@@ -599,6 +692,10 @@ +@@ -488,6 +580,10 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) { - PNG_CONST PNG_IDAT; + PNG_IDAT; +#ifdef PNG_READ_APNG_SUPPORTED -+ PNG_CONST PNG_fdAT; -+ PNG_CONST PNG_IEND; ++ PNG_fdAT; ++ PNG_IEND; +#endif PNG_CONST int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, - 0xff}; + 0xff}; PNG_CONST int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff}; -@@ -734,13 +831,39 @@ +@@ -642,13 +738,39 @@ { if (!(png_ptr->zstream.avail_in)) { @@ -919,17 +850,17 @@ diff -Nur libpng-1.2.44.orig/pngread.c libpng-1.2.44/pngread.c + bytes_to_skip = png_ptr->idat_size; + continue; + } -+ ++ + png_ensure_sequence_number(png_ptr, png_ptr->idat_size); -+ ++ + png_ptr->idat_size -= 4; + } +#endif } png_ptr->zstream.avail_in = (uInt)png_ptr->zbuf_size; png_ptr->zstream.next_in = png_ptr->zbuf; -@@ -758,6 +881,9 @@ - png_error(png_ptr, "Extra compressed data"); +@@ -668,6 +790,9 @@ + png_benign_error(png_ptr, "Extra compressed data"); png_ptr->mode |= PNG_AFTER_IDAT; png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; +#ifdef PNG_READ_APNG_SUPPORTED @@ -937,23 +868,23 @@ diff -Nur libpng-1.2.44.orig/pngread.c libpng-1.2.44/pngread.c +#endif break; } - if (ret != Z_OK) -@@ -1015,6 +1141,11 @@ + +@@ -952,6 +1077,11 @@ #ifdef PNG_READ_zTXt_SUPPORTED - PNG_CONST PNG_zTXt; + PNG_zTXt; #endif +#ifdef PNG_READ_APNG_SUPPORTED -+ PNG_CONST PNG_acTL; -+ PNG_CONST PNG_fcTL; -+ PNG_CONST PNG_fdAT; ++ PNG_acTL; ++ PNG_fcTL; ++ PNG_fdAT; +#endif - #endif /* PNG_USE_LOCAL_ARRAYS */ png_uint_32 length = png_read_chunk_header(png_ptr); PNG_CONST png_bytep chunk_name = png_ptr->chunk_name; -@@ -1115,6 +1246,14 @@ - else if (!png_memcmp(chunk_name, png_iTXt, 4)) + +@@ -1073,6 +1203,15 @@ png_handle_iTXt(png_ptr, info_ptr, length); #endif + +#ifdef PNG_READ_APNG_SUPPORTED + else if (!png_memcmp(chunk_name, png_acTL, 4)) + png_handle_acTL(png_ptr, info_ptr, length); @@ -962,13 +893,14 @@ diff -Nur libpng-1.2.44.orig/pngread.c libpng-1.2.44/pngread.c + else if (!png_memcmp(chunk_name, png_fdAT, 4)) + png_handle_fdAT(png_ptr, info_ptr, length); +#endif ++ else png_handle_unknown(png_ptr, info_ptr, length); } while (!(png_ptr->mode & PNG_HAVE_IEND)); -diff -Nur libpng-1.2.44.orig/pngrtran.c libpng-1.2.44/pngrtran.c ---- libpng-1.2.44.orig/pngrtran.c 2010-06-26 02:31:14.000000000 +0200 -+++ libpng-1.2.44/pngrtran.c 2010-07-08 21:21:34.149609181 +0200 -@@ -1352,7 +1352,7 @@ +diff -Nur libpng-1.5.1.orig/pngrtran.c libpng-1.5.1/pngrtran.c +--- libpng-1.5.1.orig/pngrtran.c 2011-02-03 05:58:17.000000000 +0100 ++++ libpng-1.5.1/pngrtran.c 2011-03-27 19:43:38.813371313 +0200 +@@ -1425,7 +1425,7 @@ * pixels. This check added to libpng-1.2.19 */ #if (PNG_WARN_UNINITIALIZED_ROW==1) @@ -977,10 +909,10 @@ diff -Nur libpng-1.2.44.orig/pngrtran.c libpng-1.2.44/pngrtran.c #else png_warning(png_ptr, "Uninitialized row"); #endif -diff -Nur libpng-1.2.44.orig/pngrutil.c libpng-1.2.44/pngrutil.c ---- libpng-1.2.44.orig/pngrutil.c 2010-06-26 02:31:14.000000000 +0200 -+++ libpng-1.2.44/pngrutil.c 2010-07-08 21:21:34.045873588 +0200 -@@ -460,6 +460,11 @@ +diff -Nur libpng-1.5.1.orig/pngrutil.c libpng-1.5.1/pngrutil.c +--- libpng-1.5.1.orig/pngrutil.c 2011-02-03 05:58:17.000000000 +0100 ++++ libpng-1.5.1/pngrutil.c 2011-03-27 19:43:38.743371274 +0200 +@@ -569,6 +569,11 @@ filter_type = buf[11]; interlace_type = buf[12]; @@ -992,7 +924,7 @@ diff -Nur libpng-1.2.44.orig/pngrutil.c libpng-1.2.44/pngrutil.c /* Set internal variables */ png_ptr->width = width; png_ptr->height = height; -@@ -2348,6 +2353,172 @@ +@@ -2492,6 +2497,172 @@ } #endif @@ -1004,7 +936,7 @@ diff -Nur libpng-1.2.44.orig/pngrutil.c libpng-1.2.44/pngrutil.c + png_uint_32 num_frames; + png_uint_32 num_plays; + png_uint_32 didSet; -+ ++ + png_debug(1, "in png_handle_acTL"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) @@ -1029,13 +961,13 @@ diff -Nur libpng-1.2.44.orig/pngrutil.c libpng-1.2.44/pngrutil.c + png_crc_finish(png_ptr, length); + return; + } -+ ++ + png_crc_read(png_ptr, data, 8); + png_crc_finish(png_ptr, 0); -+ ++ + num_frames = png_get_uint_31(png_ptr, data); + num_plays = png_get_uint_31(png_ptr, data + 4); -+ ++ + /* the set function will do error checking on num_frames */ + didSet = png_set_acTL(png_ptr, info_ptr, num_frames, num_plays); + if(didSet) @@ -1132,7 +1064,7 @@ diff -Nur libpng-1.2.44.orig/pngrutil.c libpng-1.2.44/pngrutil.c +png_handle_fdAT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_ensure_sequence_number(png_ptr, length); -+ ++ + /* This function is only called from png_read_end(), png_read_info(), + * and png_push_read_chunk() which means that: + * - the user doesn't want to read this frame @@ -1147,25 +1079,25 @@ diff -Nur libpng-1.2.44.orig/pngrutil.c libpng-1.2.44/pngrutil.c +{ + png_byte data[4]; + png_uint_32 sequence_number; -+ ++ + if (length < 4) + png_error(png_ptr, "invalid fcTL or fdAT chunk found"); -+ ++ + png_crc_read(png_ptr, data, 4); + sequence_number = png_get_uint_31(png_ptr, data); -+ ++ + if (sequence_number != png_ptr->next_seq_num) + png_error(png_ptr, "fcTL or fdAT chunk with out-of-order sequence " + "number found"); -+ ++ + png_ptr->next_seq_num++; +} +#endif /* PNG_READ_APNG_SUPPORTED */ + /* This function is called when we haven't found a handler for a - chunk. If there isn't a problem with the chunk itself (ie bad - chunk name, CRC, or a critical chunk), the chunk is silently ignored -@@ -3379,4 +3550,75 @@ + * chunk. If there isn't a problem with the chunk itself (ie bad + * chunk name, CRC, or a critical chunk), the chunk is silently ignored +@@ -3613,4 +3784,73 @@ png_ptr->flags |= PNG_FLAG_ROW_INIT; } @@ -1191,14 +1123,13 @@ diff -Nur libpng-1.2.44.orig/pngrutil.c libpng-1.2.44/pngrutil.c + png_ptr->height = info_ptr->next_frame_height; + png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,png_ptr->width); + if (png_ptr->prev_row) -+ png_memset_check(png_ptr, png_ptr->prev_row, 0, png_ptr->rowbytes + 1); ++ png_memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1); +} + +/* same as png_read_reset() but for the progressive reader */ +void /* PRIVATE */ +png_progressive_read_reset(png_structp png_ptr) +{ -+#ifdef PNG_USE_LOCAL_ARRAYS + /* start of interlace block */ + const int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; + @@ -1210,8 +1141,7 @@ diff -Nur libpng-1.2.44.orig/pngrutil.c libpng-1.2.44/pngrutil.c + + /* offset to next interlace block in the y direction */ + const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; -+#endif -+ ++ + if (png_ptr->interlaced) + { + if (!(png_ptr->transformations & PNG_INTERLACE)) @@ -1241,11 +1171,11 @@ diff -Nur libpng-1.2.44.orig/pngrutil.c libpng-1.2.44/pngrutil.c +} +#endif /* PNG_READ_APNG_SUPPORTED */ #endif /* PNG_READ_SUPPORTED */ -diff -Nur libpng-1.2.44.orig/pngset.c libpng-1.2.44/pngset.c ---- libpng-1.2.44.orig/pngset.c 2010-06-26 02:31:14.000000000 +0200 -+++ libpng-1.2.44/pngset.c 2010-07-08 21:21:33.996027603 +0200 -@@ -266,6 +266,11 @@ - info_ptr->rowbytes = (png_size_t)0; +diff -Nur libpng-1.5.1.orig/pngset.c libpng-1.5.1/pngset.c +--- libpng-1.5.1.orig/pngset.c 2011-02-03 05:58:17.000000000 +0100 ++++ libpng-1.5.1/pngset.c 2011-03-27 19:43:38.733370835 +0200 +@@ -211,6 +211,11 @@ + info_ptr->rowbytes = 0; else info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width); + @@ -1256,7 +1186,7 @@ diff -Nur libpng-1.2.44.orig/pngset.c libpng-1.2.44/pngset.c } #ifdef PNG_oFFs_SUPPORTED -@@ -960,6 +965,142 @@ +@@ -954,6 +959,142 @@ } #endif /* PNG_sPLT_SUPPORTED */ @@ -1293,12 +1223,12 @@ diff -Nur libpng-1.2.44.orig/pngset.c libpng-1.2.44/pngset.c + "> 2^31-1"); + return (0); + } -+ ++ + info_ptr->num_frames = num_frames; + info_ptr->num_plays = num_plays; -+ ++ + info_ptr->valid |= PNG_INFO_acTL; -+ ++ + return (1); +} + @@ -1319,10 +1249,10 @@ diff -Nur libpng-1.2.44.orig/pngset.c libpng-1.2.44/pngset.c + "ignored"); + return (0); + } -+ ++ + png_ensure_fcTL_is_valid(png_ptr, width, height, x_offset, y_offset, + delay_num, delay_den, dispose_op, blend_op); -+ ++ + if (blend_op == PNG_BLEND_OP_OVER) + { + if (!(png_ptr->color_type & PNG_COLOR_MASK_ALPHA) && @@ -1342,13 +1272,13 @@ diff -Nur libpng-1.2.44.orig/pngset.c libpng-1.2.44/pngset.c + info_ptr->next_frame_delay_den = delay_den; + info_ptr->next_frame_dispose_op = dispose_op; + info_ptr->next_frame_blend_op = blend_op; -+ ++ + info_ptr->valid |= PNG_INFO_fcTL; -+ ++ + return (1); +} + -+void PNGAPI ++void /* PRIVATE */ +png_ensure_fcTL_is_valid(png_structp png_ptr, + png_uint_32 width, png_uint_32 height, + png_uint_32 x_offset, png_uint_32 y_offset, @@ -1383,15 +1313,15 @@ diff -Nur libpng-1.2.44.orig/pngset.c libpng-1.2.44/pngset.c + png_byte is_hidden) +{ + png_debug(1, "in png_first_frame_is_hidden()"); -+ ++ + if (png_ptr == NULL) + return 0; -+ ++ + if(is_hidden) + png_ptr->apng_flags |= PNG_FIRST_FRAME_HIDDEN; + else + png_ptr->apng_flags &= ~PNG_FIRST_FRAME_HIDDEN; -+ ++ + return 1; +} +#endif /* PNG_APNG_SUPPORTED */ @@ -1399,10 +1329,41 @@ diff -Nur libpng-1.2.44.orig/pngset.c libpng-1.2.44/pngset.c #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED void PNGAPI png_set_unknown_chunks(png_structp png_ptr, -diff -Nur libpng-1.2.44.orig/pngwrite.c libpng-1.2.44/pngwrite.c ---- libpng-1.2.44.orig/pngwrite.c 2010-06-26 02:31:14.000000000 +0200 -+++ libpng-1.2.44/pngwrite.c 2010-07-08 21:21:33.847089331 +0200 -@@ -57,6 +57,10 @@ +diff -Nur libpng-1.5.1.orig/pngstruct.h libpng-1.5.1/pngstruct.h +--- libpng-1.5.1.orig/pngstruct.h 2011-02-03 05:58:17.000000000 +0100 ++++ libpng-1.5.1/pngstruct.h 2011-03-27 19:43:38.603370828 +0200 +@@ -287,6 +287,27 @@ + png_alloc_size_t user_chunk_malloc_max; + #endif + ++#ifdef PNG_APNG_SUPPORTED ++ png_uint_32 apng_flags; ++ png_uint_32 next_seq_num; /* next fcTL/fdAT chunk sequence number */ ++ png_uint_32 first_frame_width; ++ png_uint_32 first_frame_height; ++ ++#ifdef PNG_READ_APNG_SUPPORTED ++ png_uint_32 num_frames_read; /* incremented after all image data of */ ++ /* a frame is read */ ++#ifdef PNG_PROGRESSIVE_READ_SUPPORTED ++ png_progressive_frame_ptr frame_info_fn; /* frame info read callback */ ++ png_progressive_frame_ptr frame_end_fn; /* frame data read callback */ ++#endif ++#endif ++ ++#ifdef PNG_WRITE_APNG_SUPPORTED ++ png_uint_32 num_frames_to_write; ++ png_uint_32 num_frames_written; ++#endif ++#endif /* PNG_APNG_SUPPORTED */ ++ + /* New member added in libpng-1.0.25 and 1.2.17 */ + #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED + /* Storage for unknown chunk that the library doesn't recognize. */ +diff -Nur libpng-1.5.1.orig/pngwrite.c libpng-1.5.1/pngwrite.c +--- libpng-1.5.1.orig/pngwrite.c 2011-02-03 05:58:17.000000000 +0100 ++++ libpng-1.5.1/pngwrite.c 2011-03-27 19:43:38.643370780 +0200 +@@ -58,6 +58,10 @@ /* The rest of these check to see if the valid field has the appropriate * flag set, and if it does, writes the chunk. */ @@ -1412,9 +1373,9 @@ diff -Nur libpng-1.2.44.orig/pngwrite.c libpng-1.2.44/pngwrite.c +#endif #ifdef PNG_WRITE_gAMA_SUPPORTED if (info_ptr->valid & PNG_INFO_gAMA) - { -@@ -319,6 +323,10 @@ - return; + png_write_gAMA_fixed(png_ptr, info_ptr->gamma); +@@ -300,6 +304,10 @@ + if (!(png_ptr->mode & PNG_HAVE_IDAT)) png_error(png_ptr, "No IDATs written into file"); +#ifdef PNG_WRITE_APNG_SUPPORTED @@ -1424,8 +1385,8 @@ diff -Nur libpng-1.2.44.orig/pngwrite.c libpng-1.2.44/pngwrite.c /* See if user wants us to write information chunks */ if (info_ptr != NULL) -@@ -1589,4 +1597,39 @@ - params = params; +@@ -1602,4 +1610,39 @@ + PNG_UNUSED(params) } #endif + @@ -1438,16 +1399,16 @@ diff -Nur libpng-1.2.44.orig/pngwrite.c libpng-1.2.44/pngwrite.c + png_byte blend_op) +{ + png_debug(1, "in png_write_frame_head"); -+ ++ + /* there is a chance this has been set after png_write_info was called, + * so it would be set but not written. is there a way to be sure? */ + if (!(info_ptr->valid & PNG_INFO_acTL)) + png_error(png_ptr, "png_write_frame_head(): acTL not set"); -+ ++ + png_write_reset(png_ptr); -+ ++ + png_write_reinit(png_ptr, info_ptr, width, height); -+ ++ + if ( !(png_ptr->num_frames_written == 0 && + (png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN) ) ) + png_write_fcTL(png_ptr, width, height, x_offset, y_offset, @@ -1455,21 +1416,21 @@ diff -Nur libpng-1.2.44.orig/pngwrite.c libpng-1.2.44/pngwrite.c +} + +void PNGAPI -+png_write_frame_tail(png_structp png_ptr, png_infop png_info) ++png_write_frame_tail(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_write_frame_tail"); -+ ++ + png_ptr->num_frames_written++; +} +#endif /* PNG_WRITE_APNG_SUPPORTED */ + #endif /* PNG_WRITE_SUPPORTED */ -diff -Nur libpng-1.2.44.orig/pngwutil.c libpng-1.2.44/pngwutil.c ---- libpng-1.2.44.orig/pngwutil.c 2010-06-26 02:31:14.000000000 +0200 -+++ libpng-1.2.44/pngwutil.c 2010-07-08 21:21:34.095873630 +0200 -@@ -516,6 +516,11 @@ +diff -Nur libpng-1.5.1.orig/pngwutil.c libpng-1.5.1/pngwutil.c +--- libpng-1.5.1.orig/pngwutil.c 2011-02-03 05:58:17.000000000 +0100 ++++ libpng-1.5.1/pngwutil.c 2011-03-27 19:43:38.803370805 +0200 +@@ -596,6 +596,11 @@ /* Write the chunk */ - png_write_chunk(png_ptr, (png_bytep)png_IHDR, buf, (png_size_t)13); + png_write_chunk(png_ptr, png_IHDR, buf, (png_size_t)13); +#ifdef PNG_WRITE_APNG_SUPPORTED + png_ptr->first_frame_width = width; @@ -1479,38 +1440,38 @@ diff -Nur libpng-1.2.44.orig/pngwutil.c libpng-1.2.44/pngwutil.c /* Initialize zlib with PNG info */ png_ptr->zstream.zalloc = png_zalloc; png_ptr->zstream.zfree = png_zfree; -@@ -641,6 +646,9 @@ +@@ -742,6 +747,9 @@ + png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length) { - #ifdef PNG_USE_LOCAL_ARRAYS PNG_IDAT; +#ifdef PNG_WRITE_APNG_SUPPORTED + PNG_fdAT; +#endif - #endif png_debug(1, "in png_write_IDAT"); -@@ -686,7 +694,28 @@ - "Invalid zlib compression method or flags in IDAT"); + +@@ -791,7 +799,28 @@ + "Invalid zlib compression method or flags in IDAT"); } +#ifdef PNG_WRITE_APNG_SUPPORTED + if(png_ptr->num_frames_written == 0) +#endif - png_write_chunk(png_ptr, (png_bytep)png_IDAT, data, length); + png_write_chunk(png_ptr, png_IDAT, data, length); +#ifdef PNG_WRITE_APNG_SUPPORTED + else + { + png_byte buf[4]; -+ -+ png_write_chunk_start(png_ptr, (png_bytep)png_fdAT, 4 + length); -+ ++ ++ png_write_chunk_start(png_ptr, png_fdAT, 4 + length); ++ + png_save_uint_32(buf, png_ptr->next_seq_num); + png_write_chunk_data(png_ptr, buf, 4); -+ ++ + png_write_chunk_data(png_ptr, data, length); -+ ++ + png_write_chunk_end(png_ptr); -+ ++ + png_ptr->next_seq_num++; + } +#endif @@ -1518,7 +1479,7 @@ diff -Nur libpng-1.2.44.orig/pngwutil.c libpng-1.2.44/pngwutil.c png_ptr->mode |= PNG_HAVE_IDAT; } -@@ -1754,6 +1783,70 @@ +@@ -1769,6 +1798,66 @@ } #endif @@ -1527,22 +1488,20 @@ diff -Nur libpng-1.2.44.orig/pngwutil.c libpng-1.2.44/pngwutil.c +png_write_acTL(png_structp png_ptr, + png_uint_32 num_frames, png_uint_32 num_plays) +{ -+#ifdef PNG_USE_LOCAL_ARRAYS + PNG_acTL; -+#endif + png_byte data[16]; -+ ++ + png_debug(1, "in png_write_acTL"); -+ ++ + png_ptr->num_frames_to_write = num_frames; -+ ++ + if (png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN) + num_frames--; -+ ++ + png_save_uint_32(data, num_frames); + png_save_uint_32(data + 4, num_plays); -+ -+ png_write_chunk(png_ptr, (png_bytep)png_acTL, data, (png_size_t)8); ++ ++ png_write_chunk(png_ptr, png_acTL, data, (png_size_t)8); +} + +void /* PRIVATE */ @@ -1551,13 +1510,11 @@ diff -Nur libpng-1.2.44.orig/pngwutil.c libpng-1.2.44/pngwutil.c + png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op, + png_byte blend_op) +{ -+#ifdef PNG_USE_LOCAL_ARRAYS + PNG_fcTL; -+#endif + png_byte data[26]; -+ ++ + png_debug(1, "in png_write_fcTL"); -+ ++ + if (png_ptr->num_frames_written == 0 && (x_offset != 0 || y_offset != 0)) + png_error(png_ptr, "x and/or y offset for the first frame aren't 0"); + if (png_ptr->num_frames_written == 0 && @@ -1565,11 +1522,11 @@ diff -Nur libpng-1.2.44.orig/pngwutil.c libpng-1.2.44/pngwutil.c + height != png_ptr->first_frame_height)) + png_error(png_ptr, "width and/or height in the first frame's fcTL " + "don't match the ones in IHDR"); -+ ++ + /* more error checking */ + png_ensure_fcTL_is_valid(png_ptr, width, height, x_offset, y_offset, + delay_num, delay_den, dispose_op, blend_op); -+ ++ + png_save_uint_32(data, png_ptr->next_seq_num); + png_save_uint_32(data + 4, width); + png_save_uint_32(data + 8, height); @@ -1579,9 +1536,9 @@ diff -Nur libpng-1.2.44.orig/pngwutil.c libpng-1.2.44/pngwutil.c + png_save_uint_16(data + 22, delay_den); + data[24] = dispose_op; + data[25] = blend_op; -+ -+ png_write_chunk(png_ptr, (png_bytep)png_fcTL, data, (png_size_t)26); -+ ++ ++ png_write_chunk(png_ptr, png_fcTL, data, (png_size_t)26); ++ + png_ptr->next_seq_num++; +} +#endif /* PNG_WRITE_APNG_SUPPORTED */ @@ -1589,18 +1546,18 @@ diff -Nur libpng-1.2.44.orig/pngwutil.c libpng-1.2.44/pngwutil.c /* Initializes the row writing capability of libpng */ void /* PRIVATE */ png_write_start_row(png_structp png_ptr) -@@ -2159,8 +2252,8 @@ +@@ -2203,8 +2292,8 @@ #ifndef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED if (png_ptr->row_number == 0 && filter_to_do == PNG_ALL_FILTERS) { -- /* These will never be selected so we need not test them. */ -- filter_to_do &= ~(PNG_FILTER_UP | PNG_FILTER_PAETH); -+ /* These use previous row */ -+ filter_to_do &= ~(PNG_FILTER_UP | PNG_FILTER_AVG | PNG_FILTER_PAETH); +- /* These will never be selected so we need not test them. */ +- filter_to_do &= ~(PNG_FILTER_UP | PNG_FILTER_PAETH); ++ /* These use previous row */ ++ filter_to_do &= ~(PNG_FILTER_UP | PNG_FILTER_AVG | PNG_FILTER_PAETH); } - #endif + #endif -@@ -2829,4 +2922,39 @@ +@@ -2945,4 +3034,39 @@ } #endif } @@ -1627,12 +1584,12 @@ diff -Nur libpng-1.2.44.orig/pngwutil.c libpng-1.2.44/pngwutil.c + height > png_ptr->first_frame_height) + png_error(png_ptr, "width and/or height for a frame greater than" + "the ones in IHDR"); -+ ++ + png_set_IHDR(png_ptr, info_ptr, width, height, + info_ptr->bit_depth, info_ptr->color_type, + info_ptr->interlace_type, info_ptr->compression_type, + info_ptr->filter_type); -+ ++ + png_ptr->width = width; + png_ptr->height = height; + png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, width); diff --git a/package/libpng/patches/patch-ltmain_sh b/package/libpng/patches/patch-ltmain_sh index 3dc47967e..8ead586e9 100644 --- a/package/libpng/patches/patch-ltmain_sh +++ b/package/libpng/patches/patch-ltmain_sh @@ -1,11 +1,11 @@ ---- libpng-1.2.44.orig/ltmain.sh 2009-11-22 15:45:24.000000000 +0100 -+++ libpng-1.2.44/ltmain.sh 2011-01-14 00:13:24.000000000 +0100 -@@ -4765,7 +4765,7 @@ func_mode_link () - # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC - # @file GCC response files +--- libpng-1.5.1.orig/ltmain.sh 2011-02-03 05:58:21.000000000 +0100 ++++ libpng-1.5.1/ltmain.sh 2011-03-27 19:35:09.613370655 +0200 +@@ -5840,7 +5840,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*|@*) -+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-fstack-protector*|-flto) + -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/libpri/patches/patch-Makefile b/package/libpri/patches/patch-Makefile index 743924088..811ef59a9 100644 --- a/package/libpri/patches/patch-Makefile +++ b/package/libpri/patches/patch-Makefile @@ -1,5 +1,5 @@ --- libpri-1.4.10.2.orig/Makefile 2008-08-06 20:20:51.000000000 +0200 -+++ libpri-1.4.10.2/Makefile 2011-01-21 14:32:08.278658337 +0100 ++++ libpri-1.4.10.2/Makefile 2011-04-01 14:39:42.851818751 +0200 @@ -31,8 +31,8 @@ CC=gcc GREP=grep AWK=awk @@ -30,11 +30,13 @@ %.lo: %.c $(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $< -@@ -146,7 +147,6 @@ $(STATIC_LIBRARY): $(STATIC_OBJS) +@@ -145,8 +146,7 @@ $(STATIC_LIBRARY): $(STATIC_OBJS) + ranlib $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY): $(DYNAMIC_OBJS) - $(CC) -shared $(SOFLAGS) -o $@ $(DYNAMIC_OBJS) +- $(CC) -shared $(SOFLAGS) -o $@ $(DYNAMIC_OBJS) - $(LDCONFIG) $(LDCONFIG_FLAGS) . ++ $(CC) -shared $(SOFLAGS) $(LDFLAGS) -o $@ $(DYNAMIC_OBJS) ln -sf libpri.so.$(SONAME) libpri.so version.c: FORCE diff --git a/package/libpthread/Makefile b/package/libpthread/Makefile index 169db676a..4d61d570a 100644 --- a/package/libpthread/Makefile +++ b/package/libpthread/Makefile @@ -20,19 +20,21 @@ endif PKG_NAME:= libpthread PKG_DESCR:= POSIX threading library PKG_SECTION:= libs +PKG_OPTS:= noremove NO_DISTFILES:= 1 PKG_SUBPKGS:= LIBPTHREAD LIBPTHREAD_DEV +PKGSC_LIBPTHREAD_DEV:= devel ifeq ($(ADK_STATIC),y) -PKG_OPTS:= libonly +PKG_OPTS+= libonly endif include ${TOPDIR}/mk/package.mk -$(eval $(call PKG_template,LIBPTHREAD,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) -$(eval $(call PKG_template,LIBPTHREAD_DEV,${PKG_NAME}-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) +$(eval $(call PKG_template,LIBPTHREAD,libpthread,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) +$(eval $(call PKG_template,LIBPTHREAD_DEV,libpthread-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKGSC_LIBPTHREAD_DEV},${PKG_OPTS})) CONFIG_STYLE:= manual BUILD_STYLE:= manual @@ -46,9 +48,9 @@ endif libpthread-dev-install: ifeq ($(ADK_NATIVE),) - ${INSTALL_DIR} ${IDIR_LIBPTHREAD}/usr/lib - ${CP} ./files/libpthread.so.$(ARCH) ${IDIR_LIBPTHREAD}/usr/lib/libpthread.so - ${CP} ${STAGING_TARGET_DIR}/usr/lib/libpthread_nonshared.a ${IDIR_LIBPTHREAD}/usr/lib + ${INSTALL_DIR} ${IDIR_LIBPTHREAD_DEV}/usr/lib + ${CP} ./files/libpthread.so.$(ARCH) ${IDIR_LIBPTHREAD_DEV}/usr/lib/libpthread.so + ${CP} ${STAGING_TARGET_DIR}/usr/lib/libpthread_nonshared.a ${IDIR_LIBPTHREAD_DEV}/usr/lib endif include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/libtiff/Makefile b/package/libtiff/Makefile index 68d1b442c..896b4073a 100644 --- a/package/libtiff/Makefile +++ b/package/libtiff/Makefile @@ -26,6 +26,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBTIFF,libtiff,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) $(eval $(call PKG_template,LIBTIFF_DEV,libtiff-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBTIFF_DEV},${PKGSC_LIBTIFF_DEV},${PKG_OPTS})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --disable-cxx \ --disable-rpath diff --git a/package/libtool/patches/patch-libltdl_config_ltmain_m4sh b/package/libtool/patches/patch-libltdl_config_ltmain_m4sh new file mode 100644 index 000000000..a1650449e --- /dev/null +++ b/package/libtool/patches/patch-libltdl_config_ltmain_m4sh @@ -0,0 +1,11 @@ +--- libtool-2.4.orig/libltdl/config/ltmain.m4sh 2010-09-22 16:45:18.000000000 +0200 ++++ libtool-2.4/libltdl/config/ltmain.m4sh 2011-03-29 22:49:51.801818754 +0200 +@@ -5051,7 +5051,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/libtool/patches/patch-libltdl_config_ltmain_sh b/package/libtool/patches/patch-libltdl_config_ltmain_sh deleted file mode 100644 index bc46ecca5..000000000 --- a/package/libtool/patches/patch-libltdl_config_ltmain_sh +++ /dev/null @@ -1,31 +0,0 @@ ---- libtool-2.4.orig/libltdl/config/ltmain.sh 2010-09-22 16:45:43.000000000 +0200 -+++ libtool-2.4/libltdl/config/ltmain.sh 2011-01-15 12:03:36.000000000 +0100 -@@ -136,15 +136,15 @@ progpath="$0" - - : ${CP="cp -f"} - test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} --: ${EGREP="grep -E"} --: ${FGREP="grep -F"} --: ${GREP="grep"} -+: ${EGREP="/usr/bin/grep -E"} -+: ${FGREP="/usr/bin/grep -F"} -+: ${GREP="/usr/bin/grep"} - : ${LN_S="ln -s"} - : ${MAKE="make"} - : ${MKDIR="mkdir"} - : ${MV="mv -f"} - : ${RM="rm -f"} --: ${SED="sed"} -+: ${SED="/Volumes/adk/openadk/scripts/sed"} - : ${SHELL="${CONFIG_SHELL-/bin/sh}"} - : ${Xsed="$SED -e 1s/^X//"} - -@@ -5840,7 +5840,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/libupnp/Makefile b/package/libupnp/Makefile index 3726fd926..44352b17b 100644 --- a/package/libupnp/Makefile +++ b/package/libupnp/Makefile @@ -24,6 +24,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBUPNP,libupnp,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,LIBUPNP_DEV,libupnp-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBUPNP_DEV},${PKGSC_LIBUPNP_DEV})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) TARGET_CFLAGS+= -fPIC CONFIGURE_ARGS+= --disable-samples diff --git a/package/libxcb/Makefile b/package/libxcb/Makefile index a50dec13f..cf292f384 100644 --- a/package/libxcb/Makefile +++ b/package/libxcb/Makefile @@ -24,11 +24,12 @@ $(eval $(call PKG_template,LIBXCB_DEV,${PKG_NAME}-dev,${PKG_VERSION}-${PKG_RELEA include $(TOPDIR)/mk/python.mk +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ENV+= PYTHON=$(PYTHON) libxcb-install: ${INSTALL_DIR} ${IDIR_LIBXCB}/usr/lib - ${CP} ${WRKINST}/usr/lib/libxcb*.so* ${IDIR_LIBXCB}/usr/lib/ + ${CP} ${WRKINST}/usr/lib/libxcb*.so* ${IDIR_LIBXCB}/usr/lib libxcb-dev-install: ${INSTALL_DIR} ${IDIR_LIBXCB_DEV}/usr/include diff --git a/package/libxml2/Makefile b/package/libxml2/Makefile index 19f12828d..01d4ba466 100644 --- a/package/libxml2/Makefile +++ b/package/libxml2/Makefile @@ -23,6 +23,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBXML2,libxml2,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,LIBXML2_DEV,libxml2-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBXML2_DEV},${PKGSC_LIBXML2_DEV})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --without-c14n \ --without-catalog \ --without-debug \ diff --git a/package/links/patches/patch-png_c b/package/links/patches/patch-png_c new file mode 100644 index 000000000..ff067ba86 --- /dev/null +++ b/package/links/patches/patch-png_c @@ -0,0 +1,38 @@ +--- links-2.2.orig/png.c 2005-01-02 20:03:34.000000000 +0100 ++++ links-2.2/png.c 2011-04-01 15:01:25.801818815 +0200 +@@ -48,7 +48,7 @@ void img_my_png_warning(png_structp a, p + /* Error for from-web PNG images. */ + void img_my_png_error(png_structp png_ptr, png_const_charp error_string) + { +- longjmp(png_ptr->jmpbuf,1); ++ longjmp(png_jmpbuf(png_ptr),1); + } + + void png_info_callback(png_structp png_ptr, png_infop info_ptr) +@@ -203,7 +203,7 @@ void png_start(struct cached_image *cimg + #ifdef DEBUG + if (!info_ptr) internal ("png_create_info_struct failed\n"); + #endif /* #ifdef DEBUG */ +- if (setjmp(png_ptr->jmpbuf)){ ++ if (setjmp(png_jmpbuf(png_ptr))){ + error: + png_destroy_read_struct(&png_ptr, &info_ptr, + (png_infopp)NULL); +@@ -213,7 +213,7 @@ error: + png_set_progressive_read_fn(png_ptr, NULL, + png_info_callback, png_row_callback, + png_end_callback); +- if (setjmp(png_ptr->jmpbuf)) goto error; ++ if (setjmp(png_jmpbuf(png_ptr))) goto error; + decoder=mem_alloc(sizeof(*decoder)); + decoder->png_ptr=png_ptr; + decoder->info_ptr=info_ptr; +@@ -232,7 +232,7 @@ void png_restart(struct cached_image *ci + png_ptr=((struct png_decoder *)(cimg->decoder))->png_ptr; + info_ptr=((struct png_decoder *)(cimg->decoder))->info_ptr; + end_callback_hit=0; +- if (setjmp(png_ptr->jmpbuf)){ ++ if (setjmp(png_jmpbuf(png_ptr))){ + img_end(cimg); + return; + } diff --git a/package/lxappearance/Makefile b/package/lxappearance/Makefile new file mode 100644 index 000000000..7dea43fe5 --- /dev/null +++ b/package/lxappearance/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:= lxappearance +PKG_VERSION:= 0.5.0 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 7eabab6f4a358dbc6a84e260a0e7f6c2 +PKG_DESCR:= LXDE ... +PKG_SECTION:= x11/lxde +PKG_URL:= http://lxde.org/ +PKG_SITES:= http://netcologne.dl.sourceforge.net/project/lxde/LXAppearance/ + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,LXAPPEARANCE,lxappearance,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) + +XAKE_FLAGS+= CPPFLAGS_FOR_BUILD="-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include" + +lxappearance-install: + $(INSTALL_DIR) $(IDIR_LXAPPEARANCE)/usr/bin + $(INSTALL_BIN) $(WRKINST)/usr/bin/lxappearance \ + $(IDIR_LXAPPEARANCE)/usr/bin + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/lxappearance/patches/patch-src_Makefile_in b/package/lxappearance/patches/patch-src_Makefile_in new file mode 100644 index 000000000..409681df8 --- /dev/null +++ b/package/lxappearance/patches/patch-src_Makefile_in @@ -0,0 +1,36 @@ +--- lxappearance-0.5.0.orig/src/Makefile.in 2010-10-12 17:20:51.000000000 +0200 ++++ lxappearance-0.5.0/src/Makefile.in 2011-03-18 00:11:21.983370811 +0100 +@@ -68,8 +68,8 @@ lxappearance_LINK = $(CCLD) $(lxappearan + am_xml_purge_OBJECTS = xml_purge-xml-purge.$(OBJEXT) + xml_purge_OBJECTS = $(am_xml_purge_OBJECTS) + xml_purge_DEPENDENCIES = $(am__DEPENDENCIES_1) +-xml_purge_LINK = $(CCLD) $(xml_purge_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ +- $(LDFLAGS) -o $@ ++xml_purge_LINK = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) \ ++ -o $@ + DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) + depcomp = $(SHELL) $(top_srcdir)/depcomp + am__depfiles_maybe = depfiles +@@ -347,7 +347,7 @@ lxappearance$(EXEEXT): $(lxappearance_OB + $(lxappearance_LINK) $(lxappearance_OBJECTS) $(lxappearance_LDADD) $(LIBS) + xml-purge$(EXEEXT): $(xml_purge_OBJECTS) $(xml_purge_DEPENDENCIES) + @rm -f xml-purge$(EXEEXT) +- $(xml_purge_LINK) $(xml_purge_OBJECTS) $(xml_purge_LDADD) $(LIBS) ++ $(xml_purge_LINK) $(xml_purge_OBJECTS) $(LIBS) -lgmodule-2.0 -lglib-2.0 + + mostlyclean-compile: + -rm -f *.$(OBJEXT) +@@ -492,11 +492,11 @@ lxappearance-plugin.obj: plugin.c + @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lxappearance_CFLAGS) $(CFLAGS) -c -o lxappearance-plugin.obj `if test -f 'plugin.c'; then $(CYGPATH_W) 'plugin.c'; else $(CYGPATH_W) '$(srcdir)/plugin.c'; fi` + + xml_purge-xml-purge.o: $(top_srcdir)/src/xml-purge.c +-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xml_purge_CFLAGS) $(CFLAGS) -MT xml_purge-xml-purge.o -MD -MP -MF $(DEPDIR)/xml_purge-xml-purge.Tpo -c -o xml_purge-xml-purge.o `test -f '$(top_srcdir)/src/xml-purge.c' || echo '$(srcdir)/'`$(top_srcdir)/src/xml-purge.c ++@am__fastdepCC_TRUE@ $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -MT xml_purge-xml-purge.o -MD -MP -MF $(DEPDIR)/xml_purge-xml-purge.Tpo -c -o xml_purge-xml-purge.o `test -f '$(top_srcdir)/src/xml-purge.c' || echo '$(srcdir)/'`$(top_srcdir)/src/xml-purge.c + @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xml_purge-xml-purge.Tpo $(DEPDIR)/xml_purge-xml-purge.Po + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/src/xml-purge.c' object='xml_purge-xml-purge.o' libtool=no @AMDEPBACKSLASH@ + @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xml_purge_CFLAGS) $(CFLAGS) -c -o xml_purge-xml-purge.o `test -f '$(top_srcdir)/src/xml-purge.c' || echo '$(srcdir)/'`$(top_srcdir)/src/xml-purge.c ++@am__fastdepCC_FALSE@ $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -c -o xml_purge-xml-purge.o `test -f '$(top_srcdir)/src/xml-purge.c' || echo '$(srcdir)/'`$(top_srcdir)/src/xml-purge.c + + xml_purge-xml-purge.obj: $(top_srcdir)/src/xml-purge.c + @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xml_purge_CFLAGS) $(CFLAGS) -MT xml_purge-xml-purge.obj -MD -MP -MF $(DEPDIR)/xml_purge-xml-purge.Tpo -c -o xml_purge-xml-purge.obj `if test -f '$(top_srcdir)/src/xml-purge.c'; then $(CYGPATH_W) '$(top_srcdir)/src/xml-purge.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/src/xml-purge.c'; fi` diff --git a/package/lxdm/Makefile b/package/lxdm/Makefile new file mode 100644 index 000000000..f809888d8 --- /dev/null +++ b/package/lxdm/Makefile @@ -0,0 +1,34 @@ +# 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:= lxdm +PKG_VERSION:= 0.3.0 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 1d0688e088edab7c3c563263eb2f9654 +PKG_DESCR:= LXDE display manager +PKG_SECTION:= x11/lxde +PKG_BUILDDEP:= libX11 glib gtk+ ConsoleKit +PKG_DEPENDS:= libx11 glib libgtk consolekit +PKG_URL:= http://lxde.org/ +PKG_SITES:= http://openadk.org/distfiles/ + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,LXDM,lxdm,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) + +lxdm-install: + $(INSTALL_DIR) $(IDIR_LXDM)/etc + $(CP) $(WRKINST)/etc/* $(IDIR_LXDM)/etc + $(INSTALL_DIR) $(IDIR_LXDM)/usr/libexec + $(CP) $(WRKINST)/usr/libexec/* \ + $(IDIR_LXDM)/usr/libexec + $(INSTALL_DIR) $(IDIR_LXDM)/usr/sbin + $(INSTALL_BIN) $(WRKINST)/usr/sbin/lxdm* \ + $(IDIR_LXDM)/usr/sbin + $(INSTALL_DIR) $(IDIR_LXDM)/usr/share/lxdm/themes + $(CP) $(WRKINST)/usr/share/lxdm/themes/* \ + $(IDIR_LXDM)/usr/share/lxdm/themes + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/lxdm/patches/patch-src_lxdm_c b/package/lxdm/patches/patch-src_lxdm_c new file mode 100644 index 000000000..b5eeaa4de --- /dev/null +++ b/package/lxdm/patches/patch-src_lxdm_c @@ -0,0 +1,43 @@ +--- lxdm-0.3.0.orig/src/lxdm.c 2010-09-24 17:43:49.000000000 +0200 ++++ lxdm-0.3.0/src/lxdm.c 2011-03-17 23:15:35.093370316 +0100 +@@ -51,8 +51,6 @@ + #include <sys/ioctl.h> + #include <sys/stat.h> + +-#include <execinfo.h> +- + #include <utmp.h> + + #if HAVE_LIBPAM +@@ -150,6 +148,7 @@ void stop_pid(int pid) + while( waitpid(-1, 0, WNOHANG) > 0 ) ; + } + ++#if HAVE_LIBPAM + static void close_pam_session(pam_handle_t *pamh) + { + int err; +@@ -159,6 +158,7 @@ static void close_pam_session(pam_handle + pam_end(pamh, err); + pamh = NULL; + } ++#endif + + static LXSession *lxsession_find_greeter(void) + { +@@ -1480,6 +1480,7 @@ int lxdm_do_auto_login(void) + + static void log_sigsegv(void) + { ++/* + void *array[40]; + size_t size; + char **bt_strs; +@@ -1492,6 +1493,7 @@ static void log_sigsegv(void) + fprintf(stderr, "%s\n", bt_strs[i]); + + free(bt_strs); ++*/ + } + + static void sigsegv_handler(int sig) diff --git a/package/lxsession/Makefile b/package/lxsession/Makefile new file mode 100644 index 000000000..cfdc47ddc --- /dev/null +++ b/package/lxsession/Makefile @@ -0,0 +1,27 @@ +# 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:= lxsession +PKG_VERSION:= 0.4.5 +PKG_RELEASE:= 1 +PKG_MD5SUM:= d5cd0cb733748191b2c7371c9efda155 +PKG_DESCR:= LXDE session manager +PKG_SECTION:= x11/lxde +PKG_URL:= http://lxde.org/ +PKG_SITES:= http://sourceforge.net/projects/lxde/files/LXSession%20%28session%20manager%29/LXSession%200.4.5/ + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,LXSESSION,lxsession,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) + +lxsession-install: + $(INSTALL_DIR) $(IDIR_LXSESSION)/usr/bin + $(INSTALL_BIN) $(WRKINST)/usr/bin/lxsession* \ + $(IDIR_LXSESSION)/usr/bin + $(INSTALL_DIR) $(IDIR_LXSESSION)/usr/share/lxsession/images + $(CP) $(WRKINST)/usr/share/lxsession/images/* \ + $(IDIR_LXSESSION)/usr/share/lxsession/images + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/lxterminal/Makefile b/package/lxterminal/Makefile new file mode 100644 index 000000000..80ce979d3 --- /dev/null +++ b/package/lxterminal/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:= lxterminal +PKG_VERSION:= 0.1.9 +PKG_RELEASE:= 1 +PKG_MD5SUM:= cb10cc667611dce3c141294712049c43 +PKG_DESCR:= LXDE terminal +PKG_SECTION:= x11/lxde +PKG_BUILDDEP:= vte +PKG_DEPENDS:= vte +PKG_URL:= http://lxde.org/ +PKG_SITES:= http://netcologne.dl.sourceforge.net/project/lxde/LXTerminal%20%28terminal%20emulator%29/LXTerminal%200.1.9/ + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,LXTERMINAL,lxterminal,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) + +lxterminal-install: + $(INSTALL_DIR) $(IDIR_LXTERMINAL)/usr/bin + $(INSTALL_BIN) $(WRKINST)/usr/bin/lxterminal \ + $(IDIR_LXTERMINAL)/usr/bin + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/lxterminal/patches/patch-src_Makefile_in b/package/lxterminal/patches/patch-src_Makefile_in new file mode 100644 index 000000000..f9285dc4a --- /dev/null +++ b/package/lxterminal/patches/patch-src_Makefile_in @@ -0,0 +1,45 @@ +--- lxterminal-0.1.9.orig/src/Makefile.in 2010-09-01 14:23:17.000000000 +0200 ++++ lxterminal-0.1.9/src/Makefile.in 2011-03-18 11:44:58.343370425 +0100 +@@ -55,8 +55,8 @@ lxterminal_DEPENDENCIES = $(am__DEPENDEN + am_xml_purge_OBJECTS = xml_purge-xml-purge.$(OBJEXT) + xml_purge_OBJECTS = $(am_xml_purge_OBJECTS) + xml_purge_DEPENDENCIES = +-xml_purge_LINK = $(CCLD) $(xml_purge_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ +- $(LDFLAGS) -o $@ ++xml_purge_LINK = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) \ ++ -o $@ + DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) + depcomp = $(SHELL) $(top_srcdir)/depcomp + am__depfiles_maybe = depfiles +@@ -215,8 +215,6 @@ lxterminal_LDADD = \ + $(INTLLIBS) + + xml_purge_SOURCES = xml-purge.c +-xml_purge_CFLAGS = @CFLAGS@ +-xml_purge_LDADD = @LIBS@ + all: all-am + + .SUFFIXES: +@@ -296,7 +294,7 @@ lxterminal$(EXEEXT): $(lxterminal_OBJECT + $(LINK) $(lxterminal_OBJECTS) $(lxterminal_LDADD) $(LIBS) + xml-purge$(EXEEXT): $(xml_purge_OBJECTS) $(xml_purge_DEPENDENCIES) + @rm -f xml-purge$(EXEEXT) +- $(xml_purge_LINK) $(xml_purge_OBJECTS) $(xml_purge_LDADD) $(LIBS) ++ $(xml_purge_LINK) $(xml_purge_OBJECTS) + + mostlyclean-compile: + -rm -f *.$(OBJEXT) +@@ -325,11 +323,11 @@ distclean-compile: + @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + + xml_purge-xml-purge.o: xml-purge.c +-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xml_purge_CFLAGS) $(CFLAGS) -MT xml_purge-xml-purge.o -MD -MP -MF $(DEPDIR)/xml_purge-xml-purge.Tpo -c -o xml_purge-xml-purge.o `test -f 'xml-purge.c' || echo '$(srcdir)/'`xml-purge.c ++@am__fastdepCC_TRUE@ $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -MT xml_purge-xml-purge.o -MD -MP -MF $(DEPDIR)/xml_purge-xml-purge.Tpo -c -o xml_purge-xml-purge.o `test -f 'xml-purge.c' || echo '$(srcdir)/'`xml-purge.c + @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xml_purge-xml-purge.Tpo $(DEPDIR)/xml_purge-xml-purge.Po + @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xml-purge.c' object='xml_purge-xml-purge.o' libtool=no @AMDEPBACKSLASH@ + @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xml_purge_CFLAGS) $(CFLAGS) -c -o xml_purge-xml-purge.o `test -f 'xml-purge.c' || echo '$(srcdir)/'`xml-purge.c ++@am__fastdepCC_FALSE@ $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -c -o xml_purge-xml-purge.o `test -f 'xml-purge.c' || echo '$(srcdir)/'`xml-purge.c + + xml_purge-xml-purge.obj: xml-purge.c + @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xml_purge_CFLAGS) $(CFLAGS) -MT xml_purge-xml-purge.obj -MD -MP -MF $(DEPDIR)/xml_purge-xml-purge.Tpo -c -o xml_purge-xml-purge.obj `if test -f 'xml-purge.c'; then $(CYGPATH_W) 'xml-purge.c'; else $(CYGPATH_W) '$(srcdir)/xml-purge.c'; fi` diff --git a/package/mpfr/Makefile b/package/mpfr/Makefile index 77f2c1d6a..c350828a3 100644 --- a/package/mpfr/Makefile +++ b/package/mpfr/Makefile @@ -12,6 +12,8 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,MPFR,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) + post-install: ${INSTALL_DIR} ${IDIR_MPFR}/usr/lib ${CP} ${WRKINST}/usr/lib/libmpfr.so* ${IDIR_MPFR}/usr/lib/ diff --git a/package/mplayer/Makefile b/package/mplayer/Makefile index 7ccde9e74..3b08057da 100644 --- a/package/mplayer/Makefile +++ b/package/mplayer/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= mplayer -PKG_VERSION:= 1.0-32749 -PKG_RELEASE:= 2 -PKG_MD5SUM:= aadc5d8cca503c8b18b3ed00b3a52cf5 +PKG_VERSION:= 1.0rc4 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 1699c94de39da9c4c5d34e8f58e418f0 PKG_DESCR:= popular video player PKG_SECTION:= multimedia PKG_DEPENDS:= alsa-lib libjpeg libfaad2 libmad libncurses @@ -15,7 +15,11 @@ PKG_DEPENDS+= libx11 libxau libxdmcp libxext libxv zlib PKG_BUILDDEP:= alsa-lib libmad libvorbis faad2 ncurses zlib PKG_BUILDDEP+= libX11 libXv libpng libXext PKG_URL:= http://www.mplayerhq.hu/ -PKG_SITES:= http://openadk.org/distfiles/ +#PKG_SITES:= http://openadk.org/distfiles/ +PKG_SITES:= http://www.mplayerhq.hu/MPlayer/releases/ + +DISTFILES:= MPlayer-$(PKG_VERSION).tar.bz2 +WRKDIST= ${WRKDIR}/MPlayer-$(PKG_VERSION) PKG_ARCH_DEPENDS:= x86 x86_64 mips mipsel mips64 mips64el diff --git a/package/mplayer/patches/patch-Makefile b/package/mplayer/patches/patch-Makefile index 3f57255db..9c8e32783 100644 --- a/package/mplayer/patches/patch-Makefile +++ b/package/mplayer/patches/patch-Makefile @@ -1,11 +1,11 @@ ---- mplayer-1.0-32749.orig/Makefile 2011-01-03 11:27:11.000000000 +0100 -+++ mplayer-1.0-32749/Makefile 2011-02-05 18:20:49.000000000 +0100 -@@ -816,7 +816,7 @@ mencoder$(EXESUF) mplayer$(EXESUF): +--- MPlayer-1.0rc4.orig/Makefile 2010-07-29 19:08:19.000000000 +0200 ++++ MPlayer-1.0rc4/Makefile 2011-04-01 16:14:58.571818417 +0200 +@@ -851,7 +851,7 @@ mencoder$(EXESUF) mplayer$(EXESUF): $(CC) -o $@ $^ $(EXTRALIBS) codec-cfg$(EXESUF): codec-cfg.c codec-cfg.h help_mp.h -- $(HOST_CC) -O -DCODECS2HTML -I. -Iffmpeg -o $@ $< -+ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -O -DCODECS2HTML -I. -Iffmpeg -o $@ $< +- $(HOST_CC) -O -DCODECS2HTML -I. -o $@ $< ++ $(CC_FOR_BUILD) -O -DCODECS2HTML -I. -o $@ $< codecs.conf.h: codec-cfg$(EXESUF) etc/codecs.conf ./$^ > $@ diff --git a/package/mplayer/patches/patch-configure b/package/mplayer/patches/patch-configure index eb33a8720..2fe0e1e10 100644 --- a/package/mplayer/patches/patch-configure +++ b/package/mplayer/patches/patch-configure @@ -1,6 +1,6 @@ ---- mplayer-1.0-32749.orig/configure 2011-01-03 11:27:11.000000000 +0100 -+++ mplayer-1.0-32749/configure 2011-01-09 00:35:20.000000000 +0100 -@@ -2554,7 +2554,7 @@ else +--- MPlayer-1.0rc4.orig/configure 2010-07-29 02:31:57.000000000 +0200 ++++ MPlayer-1.0rc4/configure 2011-04-01 16:12:17.224319163 +0200 +@@ -2556,7 +2556,7 @@ else fi cflag_check -mno-omit-leaf-frame-pointer && cflags_no_omit_leaf_frame_pointer="-mno-omit-leaf-frame-pointer" diff --git a/package/mplayer/patches/patch-libmpcodecs_vd_mpng_c b/package/mplayer/patches/patch-libmpcodecs_vd_mpng_c new file mode 100644 index 000000000..c783ec100 --- /dev/null +++ b/package/mplayer/patches/patch-libmpcodecs_vd_mpng_c @@ -0,0 +1,39 @@ +--- MPlayer-1.0rc4.orig/libmpcodecs/vd_mpng.c 2010-02-26 16:01:37.000000000 +0100 ++++ MPlayer-1.0rc4/libmpcodecs/vd_mpng.c 2011-04-01 16:23:04.381818599 +0200 +@@ -74,7 +74,7 @@ static int pngLength; + + static void pngReadFN( png_structp pngstr,png_bytep buffer,png_size_t size ) + { +- char * p = pngstr->io_ptr; ++ char * p = png_get_io_ptr(pngstr); + if(size>pngLength-pngPointer && pngLength>=pngPointer) size=pngLength-pngPointer; + fast_memcpy( buffer,(char *)&p[pngPointer],size ); + pngPointer+=size; +@@ -90,6 +90,7 @@ static mp_image_t* decode(sh_video_t *sh + png_uint_32 png_width=0,png_height=0; + int depth,color; + png_uint_32 i; ++ png_byte color_type; + mp_image_t* mpi; + + int cols; +@@ -111,7 +112,9 @@ static mp_image_t* decode(sh_video_t *sh + png_get_IHDR( png,info,&png_width,&png_height,&depth,&color,NULL,NULL,NULL ); + png_set_bgr( png ); + +- switch( info->color_type ) { ++ color_type=png_get_color_type(png, info); ++ ++ switch( color_type ) { + case PNG_COLOR_TYPE_GRAY_ALPHA: + mp_msg( MSGT_DECVIDEO,MSGL_INFO,"Sorry gray scaled png with alpha channel not supported at moment.\n" ); + break; +@@ -128,7 +131,7 @@ static mp_image_t* decode(sh_video_t *sh + out_fmt=IMGFMT_BGR24; + break; + default: +- mp_msg( MSGT_DECVIDEO,MSGL_INFO,"Sorry, unsupported PNG colorspace: %d.\n" ,info->color_type); ++ mp_msg( MSGT_DECVIDEO,MSGL_INFO,"Sorry, unsupported PNG colorspace: %d.\n" ,color_type); + } + + // (re)init libvo if image parameters changed (width/height/colorspace) diff --git a/package/ncurses/Makefile b/package/ncurses/Makefile index a89ea7c91..e9aaddf9a 100644 --- a/package/ncurses/Makefile +++ b/package/ncurses/Makefile @@ -64,7 +64,7 @@ pre-configure: find ${WRKBUILD} -name *.o -exec rm {} \; find ${WRKBUILD} -name *.a -exec rm {} \; -post-install: +libncurses-install: # this is installed as libncurses - make libcurses a "link" rm -f ${WRKINST}/usr/lib/libcurses.so* echo 'GROUP(-lncurses)' >${WRKINST}/usr/lib/libcurses.so diff --git a/package/nss/Makefile b/package/nss/Makefile index 6d6dccdf7..7455b1d37 100644 --- a/package/nss/Makefile +++ b/package/nss/Makefile @@ -6,6 +6,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:= nss PKG_VERSION:= 3.12.9 PKG_RELEASE:= 1 +PKG_MAJ_VERSION:= 3 +PKG_MIN_VERSION:= 12 +PKG_PATCH_VERSION:= 9 PKG_MD5SUM:= bd32f183ca28440c1744650be31a9ccc PKG_DESCR:= Network Security Services (NSS) library PKG_SECTION:= libs @@ -37,16 +40,27 @@ TARGET_LDFLAGS+= -ldl -pthread XAKE_FLAGS+= SOURCE_MD_DIR=${WRKDIST}/dist DIST=${WRKDIST}/dist XAKE_FLAGS+= ARCHFLAG="${TARGET_CFLAGS} ${TARGET_CPPFLAGS} ${TARGET_LDFLAGS}" -XAKE_FLAGS+= OS_TEST=${CPU_ARCH} NSS_DISABLE_DBM=1 OS_TARGET=Linux OS_RELEASE=2.6 OS_ARCH=Linux +XAKE_FLAGS+= NSS_DISABLE_DBM=1 OS_TEST=${CPU_ARCH} OS_TARGET=Linux OS_RELEASE=2.6 OS_ARCH=Linux XAKE_FLAGS+= ARTOOL="${TARGET_CROSS}ar" RANLIB="${TARGET_CROSS}ranlib" ALL_TARGET:= build_coreconf all post-install: + $(INSTALL_DIR) $(WRKINST)/usr/lib/pkgconfig + sed 's/@VERSION@/$(PKG_VERSION)/' ./files/nss.pc.in > $(WRKINST)/usr/lib/pkgconfig/nss.pc + $(INSTALL_DIR) $(WRKINST)/usr/bin + sed -e 's/@MOD_MAJOR_VERSION@/$(PKG_MAJ_VERSION)/' \ + -e 's/@MOD_MINOR_VERSION@/$(PKG_MIN_VERSION)/' \ + -e 's/@MOD_PATCH_VERSION@/$(PKG_PATCH_VERSION)/' \ + ./files/nss-config.in > $(WRKINST)/usr/bin/nss-config $(INSTALL_DIR) $(IDIR_NSS)/usr/lib ${INSTALL_DATA} ${WRKDIST}/dist/lib/lib{ssl3,smime3,nss3,nssutil3}.so \ $(IDIR_NSS)/usr/lib ${INSTALL_DIR} ${STAGING_TARGET_DIR}/usr/include/nss ${INSTALL_DATA} ${WRKDIST}/mozilla/dist/public/nss/* \ ${STAGING_TARGET_DIR}/usr/include/nss + # needed for firefox 4 + ${INSTALL_DIR} ${STAGING_TARGET_DIR}/usr/lib + $(INSTALL_DATA) ${WRKDIST}/dist/lib/libcrmf.a \ + ${STAGING_TARGET_DIR}/usr/lib include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/nss/files/nss-config.in b/package/nss/files/nss-config.in new file mode 100644 index 000000000..d47cddc06 --- /dev/null +++ b/package/nss/files/nss-config.in @@ -0,0 +1,145 @@ +#!/bin/sh + +prefix=/usr + +major_version=@MOD_MAJOR_VERSION@ +minor_version=@MOD_MINOR_VERSION@ +patch_version=@MOD_PATCH_VERSION@ + +usage() +{ + cat <<EOF +Usage: nss-config [OPTIONS] [LIBRARIES] +Options: + [--prefix[=DIR]] + [--exec-prefix[=DIR]] + [--includedir[=DIR]] + [--libdir[=DIR]] + [--version] + [--libs] + [--cflags] +Dynamic Libraries: + nss + nssutil + ssl + smime +EOF + exit $1 +} + +if test $# -eq 0; then + usage 1 1>&2 +fi + +lib_ssl=yes +lib_smime=yes +lib_nss=yes +lib_nssutil=yes + +while test $# -gt 0; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --prefix=*) + prefix=$optarg + ;; + --prefix) + echo_prefix=yes + ;; + --exec-prefix=*) + exec_prefix=$optarg + ;; + --exec-prefix) + echo_exec_prefix=yes + ;; + --includedir=*) + includedir=$optarg + ;; + --includedir) + echo_includedir=yes + ;; + --libdir=*) + libdir=$optarg + ;; + --libdir) + echo_libdir=yes + ;; + --version) + echo ${major_version}.${minor_version}.${patch_version} + ;; + --cflags) + echo_cflags=yes + ;; + --libs) + echo_libs=yes + ;; + ssl) + lib_ssl=yes + ;; + smime) + lib_smime=yes + ;; + nss) + lib_nss=yes + ;; + nssutil) + lib_nssutil=yes + ;; + *) + usage 1 1>&2 + ;; + esac + shift +done + +# Set variables that may be dependent upon other variables +if test -z "$exec_prefix"; then + exec_prefix=${prefix} +fi +if test -z "$includedir"; then + includedir=${prefix}/include/nss +fi +if test -z "$libdir"; then + libdir=${exec_prefix}/lib +fi + +if test "$echo_prefix" = "yes"; then + echo $prefix +fi + +if test "$echo_exec_prefix" = "yes"; then + echo $exec_prefix +fi + +if test "$echo_includedir" = "yes"; then + echo $includedir +fi + +if test "$echo_libdir" = "yes"; then + echo $libdir +fi + +if test "$echo_cflags" = "yes"; then + echo -I$includedir +fi + +if test "$echo_libs" = "yes"; then + libdirs="-L$libdir" + if test -n "$lib_ssl"; then + libdirs="$libdirs -lssl${major_version}" + fi + if test -n "$lib_smime"; then + libdirs="$libdirs -lsmime${major_version}" + fi + if test -n "$lib_nss"; then + libdirs="$libdirs -lnss${major_version}" + fi + if test -n "$lib_nssutil"; then + libdirs="$libdirs -lnssutil${major_version}" + fi + echo $libdirs +fi + diff --git a/package/nss/files/nss.pc.in b/package/nss/files/nss.pc.in new file mode 100644 index 000000000..e27783f64 --- /dev/null +++ b/package/nss/files/nss.pc.in @@ -0,0 +1,11 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include/nss + +Name: NSS +Description: Mozilla Network Security Services +Version: @VERSION@ +Requires: nspr +Libs: -L${libdir} -lnss3 -lnssutil3 -lsmime3 -lssl3 +Cflags: -I${includedir} diff --git a/package/opencdk/Makefile b/package/opencdk/Makefile index aa3373cc5..96a11c03a 100644 --- a/package/opencdk/Makefile +++ b/package/opencdk/Makefile @@ -22,6 +22,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBOPENCDK,libopencdk,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --with-libgcrypt-prefix='${STAGING_TARGET_DIR}/usr' post-install: diff --git a/package/openjdk/Makefile b/package/openjdk/Makefile index 73812e426..8802ee529 100644 --- a/package/openjdk/Makefile +++ b/package/openjdk/Makefile @@ -7,25 +7,43 @@ PKG_NAME:= openjdk PKG_VERSION:= 6 PKG_EXTRAVER:= b22-28_feb_2011 PKG_RELEASE:= 1 -PKG_MD5SUM:= 2d2bbbb0f9b81f1fec41ec730da8a933 fd3f35e8a8a2ef9a64c035ed66cea06d +PKG_MD5SUM:= 2d2bbbb0f9b81f1fec41ec730da8a933 \ + fd3f35e8a8a2ef9a64c035ed66cea06d \ + ef7a8b3624ea904bf584bc46d79b5e75 \ + bc95c133620bd68c161cac9891592901 \ + 91adfd41e6f001add4f92ae31216b1e3 \ + d526d0848c88607ce4e3a0a4edb75d50 PKG_DESCR:= OpenJDK Java VM PKG_SECTION:= lang -PKG_BUILDDEP:= xproto jpeg zlib libX11 libpng freetype +PKG_BUILDDEP:= alsa-lib xproto jpeg zlib libX11 libpng freetype cups +PKG_BUILDDEP+= libXt libXp libXinerama libXrender libXtst PKG_URL:= http://openjdk.org/ PKG_SITES:= http://download.java.net/openjdk/jdk6/promoted/b22/ \ + http://mirror.netcologne.de/apache.org/xml/xalan-j/binaries/ \ + http://icedtea.classpath.org/download/drops/ \ http://icedtea.classpath.org/download/source/ # autotools infrastructure for OpenJDK ICEDTEA_NAME:= icedtea6 ICEDTEA_VERSION:= 1.10 -DISTFILES:= $(PKG_NAME)-$(PKG_VERSION)-src-$(PKG_EXTRAVER).tar.gz $(ICEDTEA_NAME)-$(ICEDTEA_VERSION).tar.gz -NO_DISTFILES:= 1 +# bootstrap JARs +XALAN_NAME= xalan-j +XALAN_VERSION= 2_7_0 + +# override generic extraction +EXTRACT_OVERRIDE:= 1 +DISTFILES:= $(PKG_NAME)-$(PKG_VERSION)-src-$(PKG_EXTRAVER).tar.gz \ + $(ICEDTEA_NAME)-$(ICEDTEA_VERSION).tar.gz \ + jaxp144_01.zip \ + jdk6-jaf-b20.zip \ + jdk6-jaxws-b20.zip \ + ${XALAN_NAME}_${XALAN_VERSION}-bin.tar.gz + WRKDIST= ${WRKDIR} +WRKSRC= ${WRKDIST}/${ICEDTEA_NAME}-${ICEDTEA_VERSION} PKG_SUBPKGS:= OPENJDK -PKG_CFLINE_OPENJDK:= select ADK_TOOLCHAIN_GCC_JAVA - PKG_CHOICES_OPENJDK:= ZERO SHARK CACAO JAMVM PKGCD_ZERO:= zero-assembly backend PKGCD_SHARK:= JIT backend @@ -36,49 +54,75 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,OPENJDK,openjdk,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +BUILD_STYLE:= manual +INSTALL_STYLE:= manual +TARGET_CFLAGS:= $(filter-out -fhonour-copts,$(TARGET_CFLAGS)) + ifeq ($(ADK_PACKAGE_OPENJDK_ZERO),y) CONFIGURE_ARGS+= --enable-zero endif ifeq ($(ADK_PACKAGE_OPENJDK_SHARK),y) -CONFIGURE_ARGS+= --enable-shark +CONFIGURE_ARGS+= --enable-shark endif +BOOTSTRAPJDK:= ${WRKDIST}/bootstrap-jdk CONFIGURE_ARGS+= --disable-docs \ --enable-bootstrap \ - --disable-openjdk-cross-compilation \ - --with-jdk-home=$(STAGING_HOST_DIR)/lib/jvm \ - --with-xalan2-jar=/usr/share/java/xalan.jar \ - --with-xalan2-serializer-jar=/usr/share/java/serializer.jar \ - --with-xerces2-jar=/usr/share/java/xercesImpl.jar \ - --with-ecj-jar=$(TOPDIR)/dl/ecj.jar \ - --with-gcj \ - --without-rhino \ - --disable-xrender \ - --disable-nss + --enable-openjdk-cross-compilation \ + --with-cc-for-build=$(CC_FOR_BUILD) \ + --with-openjdk-src-dir=$(WRKDIST)/$(PKG_NAME)-$(PKG_VERSION) \ + --with-xalan2-jar=${WRKDIST}/${XALAN_NAME}_${XALAN_VERSION}/xalan.jar \ + --with-xalan2-serializer-jar=${WRKDIST}/${XALAN_NAME}_${XALAN_VERSION}/serializer.jar \ + --with-xerces2-jar=${WRKDIST}/${XALAN_NAME}_${XALAN_VERSION}/xercesImpl.jar \ + --with-jdk-home=$(BOOTSTRAPJDK) \ + --with-java=$(BOOTSTRAPJDK)/bin/java \ + --with-javac=$(BOOTSTRAPJDK)/bin/javac \ + --with-javah=$(BOOTSTRAPJDK)/bin/javah \ + --with-jar=$(BOOTSTRAPJDK)/bin/jar \ + --with-rmic=$(BOOTSTRAPJDK)/bin/rmic \ + --with-native2ascii=$(BOOTSTRAPJDK)/bin/native2ascii \ + --without-rhino + +OPENJDK_NATIVE_ENV+= JAVACFLAGS="-cp ${STAGING_JAVA_HOST_DIR}/usr/share/java/libgcj-4.5.2.jar" +OPENJDK_NATIVE_ENV+= DYLD_LIBRARY_PATH=$(STAGING_JAVA_HOST_DIR)/usr/lib:$(STAGING_JAVA_HOST_DIR)/usr/lib64 +OPENJDK_NATIVE_ENV+= LD_LIBRARY_PATH=$(STAGING_JAVA_HOST_DIR)/usr/lib:$(STAGING_JAVA_HOST_DIR)/usr/lib64 +OPENJDK_NATIVE_ENV+= ADK_ECJ=$(STAGING_JAVA_HOST_DIR)/usr/bin/ecj + +OPENJDK_BUILD_ENV+= ALT_COMPILER_PATH=$(STAGING_HOST_DIR)/$(REAL_GNU_TARGET_NAME)/bin do-extract: - (cd ${WRKBUILD}; mkdir $(PKG_NAME)-$(PKG_VERSION) ; tar xzf $(TOPDIR)/dl/$(PKG_NAME)-$(PKG_VERSION)-src-$(PKG_EXTRAVER).tar.gz -C $(PKG_NAME)-$(PKG_VERSION)) - (cd $(WRKBUILD); tar xzf $(TOPDIR)/dl/$(ICEDTEA_NAME)-$(ICEDTEA_VERSION).tar.gz) + cd ${WRKDIST}; mkdir $(PKG_NAME)-$(PKG_VERSION); \ + tar xzf $(TOPDIR)/dl/$(PKG_NAME)-$(PKG_VERSION)-src-$(PKG_EXTRAVER).tar.gz -C $(PKG_NAME)-$(PKG_VERSION) + cd $(WRKDIST); tar xzf $(TOPDIR)/dl/$(ICEDTEA_NAME)-$(ICEDTEA_VERSION).tar.gz + cd ${WRKDIST}; tar xzf ${TOPDIR}/dl/${XALAN_NAME}_${XALAN_VERSION}-bin.tar.gz + mkdir -p ${WRKBUILD}/drops + cd ${TOPDIR}/dl; cp jaxp144_01.zip jdk6-jaf-b20.zip jdk6-jaxws-b20.zip \ + ${WRKBUILD}/drops pre-configure: - (cd ${WRKBUILD}/$(ICEDTEA_NAME)-$(ICEDTEA_VERSION); rm -rf config.{cache,status} ; \ - ./configure \ - --enable-bootstrap \ - --enable-zero \ - --disable-docs \ - --disable-openjdk-cross-compilation \ - --with-openjdk-src-dir=$(WRKBUILD)/$(PKG_NAME)-$(PKG_VERSION) \ - --with-jdk-home=$(STAGING_HOST_DIR)/lib/jvm \ - --with-xalan2-jar=/usr/share/java/xalan.jar \ - --with-xalan2-serializer-jar=/usr/share/java/serializer.jar \ - --with-xerces2-jar=/usr/share/java/xercesImpl.jar \ - --with-ecj-jar=$(TOPDIR)/dl/ecj.jar \ - --with-gcj \ - --without-rhino \ - --disable-xrender \ - --disable-nss \ - ); - (cd $(WRKBUILD)/$(ICEDTEA_NAME)-$(ICEDTEA_VERSION) ; ${MAKE} ) + cd ${WRKBUILD}; rm -rf config.{cache,status}; \ + export ${OPENJDK_NATIVE_ENV}; ./configure \ + --enable-bootstrap \ + --enable-zero \ + --disable-openjdk-cross-compilation \ + --with-openjdk-src-dir=$(WRKDIST)/$(PKG_NAME)-$(PKG_VERSION) \ + --with-jdk-home=$(STAGING_JAVA_HOST_DIR)/usr/lib/jvm \ + --with-java=$(STAGING_JAVA_HOST_DIR)/usr/bin/java \ + --with-javac=$(STAGING_JAVA_HOST_DIR)/usr/bin/ecj \ + --with-gcj=$(STAGING_JAVA_HOST_DIR)/usr/bin/gcj \ + --with-ecj-jar=${STAGING_JAVA_HOST_DIR}/usr/share/ecj.jar \ + --with-xalan2-jar=${WRKDIST}/${XALAN_NAME}_${XALAN_VERSION}/xalan.jar \ + --with-xalan2-serializer-jar=${WRKDIST}/${XALAN_NAME}_${XALAN_VERSION}/serializer.jar \ + --with-xerces2-jar=${WRKDIST}/${XALAN_NAME}_${XALAN_VERSION}/xercesImpl.jar \ + --without-rhino \ + --disable-docs \ + && $(MAKE) && $(CP) $(WRKSRC)/openjdk.build/j2sdk-image ${WRKDIST}/bootstrap-jdk && $(MAKE) clean && rm -rf ${WRKBUILD}/openjdk-old + +do-build: + cd ${WRKBUILD}; export $(OPENJDK_BUILD_ENV); make + +do-install: + cd ${WRKBUILD}; make install openjdk-install: $(INSTALL_DIR) $(IDIR_OPENJDK)/usr/bin diff --git a/package/openjdk/patches/patch-icedtea6-1_10_Makefile_in b/package/openjdk/patches/patch-icedtea6-1_10_Makefile_in index 7e19f5159..50667a68a 100644 --- a/package/openjdk/patches/patch-icedtea6-1_10_Makefile_in +++ b/package/openjdk/patches/patch-icedtea6-1_10_Makefile_in @@ -1,5 +1,5 @@ ---- w-openjdk-6-1.orig/icedtea6-1.10/Makefile.in 2011-03-02 20:48:45.161291458 +0100 -+++ w-openjdk-6-1/icedtea6-1.10/Makefile.in 2011-03-28 17:00:03.591807998 +0200 +--- w-openjdk-6-1.orig/icedtea6-1.10/Makefile.in 2011-03-02 20:48:45.000000000 +0100 ++++ w-openjdk-6-1/icedtea6-1.10/Makefile.in 2011-04-02 23:33:17.000000000 +0200 @@ -1329,7 +1329,7 @@ stamps/extract-openjdk.stamp: stamps/dow @OPENJDK_SRC_DIR_FOUND_TRUE@ cp -pPR $(OPENJDK_SRC_DIR_LINK) $(OPENJDK_SRC_DIR) openjdk ; \ @OPENJDK_SRC_DIR_FOUND_TRUE@ fi @@ -18,12 +18,24 @@ fi mkdir -p stamps touch stamps/extract-ecj.stamp -@@ -1644,7 +1644,7 @@ clean-patch-ecj: +@@ -1642,11 +1642,15 @@ clean-patch-ecj: + # =========================== + stamps/native-ecj.stamp: - mkdir -p stamps ; \ - if test "x$(GCJ)" != "xno"; then \ +- mkdir -p stamps ; \ +- if test "x$(GCJ)" != "xno"; then \ - $(GCJ) $(IT_CFLAGS) -Wl,-Bsymbolic -findirect-dispatch -o native-ecj \ -+ $(GCJ) -static $(IT_CFLAGS) -Wl,-Bsymbolic -findirect-dispatch -o native-ecj \ - --main=org.eclipse.jdt.internal.compiler.batch.Main ${ECJ_JAR} ; \ - fi ; \ +- --main=org.eclipse.jdt.internal.compiler.batch.Main ${ECJ_JAR} ; \ +- fi ; \ ++ mkdir -p stamps ; \ ++ if test -n "${ADK_ECJ}" && test -x "${ADK_ECJ}"; then \ ++ ln -s "${ADK_ECJ}" native-ecj; \ ++ else \ ++ if test "x$(GCJ)" != "xno"; then \ ++ $(GCJ) $(IT_CFLAGS) -Wl,-Bsymbolic -findirect-dispatch -o native-ecj \ ++ --main=org.eclipse.jdt.internal.compiler.batch.Main ${ECJ_JAR} ; \ ++ fi ; \ ++ fi; \ touch stamps/native-ecj.stamp + + clean-native-ecj: diff --git a/package/openjdk/patches/patch-icedtea6-1_10_configure b/package/openjdk/patches/patch-icedtea6-1_10_configure deleted file mode 100644 index d9b96d1d4..000000000 --- a/package/openjdk/patches/patch-icedtea6-1_10_configure +++ /dev/null @@ -1,479 +0,0 @@ ---- w-openjdk-6-1.orig/icedtea6-1.10/configure 2011-03-02 20:48:44.321157333 +0100 -+++ w-openjdk-6-1/icedtea6-1.10/configure 2011-03-28 15:30:08.791808629 +0200 -@@ -10805,22 +10805,6 @@ fi - - - --for ac_header in cups/cups.h cups/ppd.h --do : -- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` --ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" --if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : -- cat >>confdefs.h <<_ACEOF --#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 --_ACEOF -- -- --else -- as_fn_error $? "\"CUPS headers were not found - -- try installing cups-devel.\"" "$LINENO" 5 --fi -- --done - - for ac_header in X11/X.h - do : -@@ -10879,46 +10863,6 @@ else - as_fn_error $? "\"libjpeg not found - try installing libjpeg-devel\"" "$LINENO" 5 - fi - --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lgif" >&5 --$as_echo_n "checking for main in -lgif... " >&6; } --if ${ac_cv_lib_gif_main+:} false; then : -- $as_echo_n "(cached) " >&6 --else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lgif $LIBS" --cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ -- -- --int --main () --{ --return main (); -- ; -- return 0; --} --_ACEOF --if ac_fn_c_try_link "$LINENO"; then : -- ac_cv_lib_gif_main=yes --else -- ac_cv_lib_gif_main=no --fi --rm -f core conftest.err conftest.$ac_objext \ -- conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gif_main" >&5 --$as_echo "$ac_cv_lib_gif_main" >&6; } --if test "x$ac_cv_lib_gif_main" = xyes; then : -- cat >>confdefs.h <<_ACEOF --#define HAVE_LIBGIF 1 --_ACEOF -- -- LIBS="-lgif $LIBS" -- --else -- as_fn_error $? "\"giflib not found - try installing giflib-devel\"" "$LINENO" 5 --fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lz" >&5 - $as_echo_n "checking for main in -lz... " >&6; } -@@ -11040,156 +10984,9 @@ fi - - - --pkg_failed=no --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XT" >&5 --$as_echo_n "checking for XT... " >&6; } -- --if test -n "$XT_CFLAGS"; then -- pkg_cv_XT_CFLAGS="$XT_CFLAGS" -- elif test -n "$PKG_CONFIG"; then -- if test -n "$PKG_CONFIG" && \ -- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xt\""; } >&5 -- ($PKG_CONFIG --exists --print-errors "xt") 2>&5 -- ac_status=$? -- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -- test $ac_status = 0; }; then -- pkg_cv_XT_CFLAGS=`$PKG_CONFIG --cflags "xt" 2>/dev/null` --else -- pkg_failed=yes --fi -- else -- pkg_failed=untried --fi --if test -n "$XT_LIBS"; then -- pkg_cv_XT_LIBS="$XT_LIBS" -- elif test -n "$PKG_CONFIG"; then -- if test -n "$PKG_CONFIG" && \ -- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xt\""; } >&5 -- ($PKG_CONFIG --exists --print-errors "xt") 2>&5 -- ac_status=$? -- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -- test $ac_status = 0; }; then -- pkg_cv_XT_LIBS=`$PKG_CONFIG --libs "xt" 2>/dev/null` --else -- pkg_failed=yes --fi -- else -- pkg_failed=untried --fi -- -- -- --if test $pkg_failed = yes; then -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 --$as_echo "no" >&6; } -- --if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then -- _pkg_short_errors_supported=yes --else -- _pkg_short_errors_supported=no --fi -- if test $_pkg_short_errors_supported = yes; then -- XT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "xt" 2>&1` -- else -- XT_PKG_ERRORS=`$PKG_CONFIG --print-errors "xt" 2>&1` -- fi -- # Put the nasty error message in config.log where it belongs -- echo "$XT_PKG_ERRORS" >&5 -- -- XT_FOUND=no --elif test $pkg_failed = untried; then -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 --$as_echo "no" >&6; } -- XT_FOUND=no --else -- XT_CFLAGS=$pkg_cv_XT_CFLAGS -- XT_LIBS=$pkg_cv_XT_LIBS -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 --$as_echo "yes" >&6; } -- XT_FOUND=yes --fi --if test "x${XT_FOUND}" = xno --then -- as_fn_error $? "Could not find Xt - \ -- Try installing libXt-devel." "$LINENO" 5 --fi -- -- -- -- --pkg_failed=no --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XP" >&5 --$as_echo_n "checking for XP... " >&6; } -- --if test -n "$XP_CFLAGS"; then -- pkg_cv_XP_CFLAGS="$XP_CFLAGS" -- elif test -n "$PKG_CONFIG"; then -- if test -n "$PKG_CONFIG" && \ -- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xp\""; } >&5 -- ($PKG_CONFIG --exists --print-errors "xp") 2>&5 -- ac_status=$? -- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -- test $ac_status = 0; }; then -- pkg_cv_XP_CFLAGS=`$PKG_CONFIG --cflags "xp" 2>/dev/null` --else -- pkg_failed=yes --fi -- else -- pkg_failed=untried --fi --if test -n "$XP_LIBS"; then -- pkg_cv_XP_LIBS="$XP_LIBS" -- elif test -n "$PKG_CONFIG"; then -- if test -n "$PKG_CONFIG" && \ -- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xp\""; } >&5 -- ($PKG_CONFIG --exists --print-errors "xp") 2>&5 -- ac_status=$? -- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -- test $ac_status = 0; }; then -- pkg_cv_XP_LIBS=`$PKG_CONFIG --libs "xp" 2>/dev/null` --else -- pkg_failed=yes --fi -- else -- pkg_failed=untried --fi -- -- - --if test $pkg_failed = yes; then -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 --$as_echo "no" >&6; } - --if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then -- _pkg_short_errors_supported=yes --else -- _pkg_short_errors_supported=no --fi -- if test $_pkg_short_errors_supported = yes; then -- XP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "xp" 2>&1` -- else -- XP_PKG_ERRORS=`$PKG_CONFIG --print-errors "xp" 2>&1` -- fi -- # Put the nasty error message in config.log where it belongs -- echo "$XP_PKG_ERRORS" >&5 - -- XP_FOUND=no --elif test $pkg_failed = untried; then -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 --$as_echo "no" >&6; } -- XP_FOUND=no --else -- XP_CFLAGS=$pkg_cv_XP_CFLAGS -- XP_LIBS=$pkg_cv_XP_LIBS -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 --$as_echo "yes" >&6; } -- XP_FOUND=yes --fi --if test "x${XP_FOUND}" = xno --then -- as_fn_error $? "Could not find Xp - \ -- Try installing libXp-devel." "$LINENO" 5 --fi - - - -@@ -11271,83 +11068,6 @@ fi - - - --pkg_failed=no --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINERAMA" >&5 --$as_echo_n "checking for XINERAMA... " >&6; } -- --if test -n "$XINERAMA_CFLAGS"; then -- pkg_cv_XINERAMA_CFLAGS="$XINERAMA_CFLAGS" -- elif test -n "$PKG_CONFIG"; then -- if test -n "$PKG_CONFIG" && \ -- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xinerama\""; } >&5 -- ($PKG_CONFIG --exists --print-errors "xinerama") 2>&5 -- ac_status=$? -- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -- test $ac_status = 0; }; then -- pkg_cv_XINERAMA_CFLAGS=`$PKG_CONFIG --cflags "xinerama" 2>/dev/null` --else -- pkg_failed=yes --fi -- else -- pkg_failed=untried --fi --if test -n "$XINERAMA_LIBS"; then -- pkg_cv_XINERAMA_LIBS="$XINERAMA_LIBS" -- elif test -n "$PKG_CONFIG"; then -- if test -n "$PKG_CONFIG" && \ -- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xinerama\""; } >&5 -- ($PKG_CONFIG --exists --print-errors "xinerama") 2>&5 -- ac_status=$? -- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -- test $ac_status = 0; }; then -- pkg_cv_XINERAMA_LIBS=`$PKG_CONFIG --libs "xinerama" 2>/dev/null` --else -- pkg_failed=yes --fi -- else -- pkg_failed=untried --fi -- -- -- --if test $pkg_failed = yes; then -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 --$as_echo "no" >&6; } -- --if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then -- _pkg_short_errors_supported=yes --else -- _pkg_short_errors_supported=no --fi -- if test $_pkg_short_errors_supported = yes; then -- XINERAMA_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "xinerama" 2>&1` -- else -- XINERAMA_PKG_ERRORS=`$PKG_CONFIG --print-errors "xinerama" 2>&1` -- fi -- # Put the nasty error message in config.log where it belongs -- echo "$XINERAMA_PKG_ERRORS" >&5 -- -- XINERAMA_FOUND=no --elif test $pkg_failed = untried; then -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 --$as_echo "no" >&6; } -- XINERAMA_FOUND=no --else -- XINERAMA_CFLAGS=$pkg_cv_XINERAMA_CFLAGS -- XINERAMA_LIBS=$pkg_cv_XINERAMA_LIBS -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 --$as_echo "yes" >&6; } -- XINERAMA_FOUND=yes -- --fi --if test "x${XINERAMA_FOUND}" = xno --then -- as_fn_error $? "Could not find Xinerama - \ -- Try installing libXinerama-devel." "$LINENO" 5 --fi -- -- -- - if test "x${ENABLE_XRENDER}" = "xyes" - then - -@@ -11610,79 +11330,6 @@ fi - - - --pkg_failed=no --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XTST" >&5 --$as_echo_n "checking for XTST... " >&6; } -- --if test -n "$XTST_CFLAGS"; then -- pkg_cv_XTST_CFLAGS="$XTST_CFLAGS" -- elif test -n "$PKG_CONFIG"; then -- if test -n "$PKG_CONFIG" && \ -- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xtst\""; } >&5 -- ($PKG_CONFIG --exists --print-errors "xtst") 2>&5 -- ac_status=$? -- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -- test $ac_status = 0; }; then -- pkg_cv_XTST_CFLAGS=`$PKG_CONFIG --cflags "xtst" 2>/dev/null` --else -- pkg_failed=yes --fi -- else -- pkg_failed=untried --fi --if test -n "$XTST_LIBS"; then -- pkg_cv_XTST_LIBS="$XTST_LIBS" -- elif test -n "$PKG_CONFIG"; then -- if test -n "$PKG_CONFIG" && \ -- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xtst\""; } >&5 -- ($PKG_CONFIG --exists --print-errors "xtst") 2>&5 -- ac_status=$? -- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -- test $ac_status = 0; }; then -- pkg_cv_XTST_LIBS=`$PKG_CONFIG --libs "xtst" 2>/dev/null` --else -- pkg_failed=yes --fi -- else -- pkg_failed=untried --fi -- -- -- --if test $pkg_failed = yes; then -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 --$as_echo "no" >&6; } -- --if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then -- _pkg_short_errors_supported=yes --else -- _pkg_short_errors_supported=no --fi -- if test $_pkg_short_errors_supported = yes; then -- XTST_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "xtst" 2>&1` -- else -- XTST_PKG_ERRORS=`$PKG_CONFIG --print-errors "xtst" 2>&1` -- fi -- # Put the nasty error message in config.log where it belongs -- echo "$XTST_PKG_ERRORS" >&5 -- -- XTST_FOUND=no --elif test $pkg_failed = untried; then -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 --$as_echo "no" >&6; } -- XTST_FOUND=no --else -- XTST_CFLAGS=$pkg_cv_XTST_CFLAGS -- XTST_LIBS=$pkg_cv_XTST_LIBS -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 --$as_echo "yes" >&6; } -- XTST_FOUND=yes --fi --if test "x${XTST_FOUND}" = xno --then -- as_fn_error $? "Could not find Xtst - \ -- Try installing libXtst-devel." "$LINENO" 5 --fi - - - -@@ -11764,85 +11411,6 @@ fi - - - --if test "x${BUILD_OS_DIR}" = "xlinux" --then -- --pkg_failed=no --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ALSA" >&5 --$as_echo_n "checking for ALSA... " >&6; } -- --if test -n "$ALSA_CFLAGS"; then -- pkg_cv_ALSA_CFLAGS="$ALSA_CFLAGS" -- elif test -n "$PKG_CONFIG"; then -- if test -n "$PKG_CONFIG" && \ -- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"alsa\""; } >&5 -- ($PKG_CONFIG --exists --print-errors "alsa") 2>&5 -- ac_status=$? -- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -- test $ac_status = 0; }; then -- pkg_cv_ALSA_CFLAGS=`$PKG_CONFIG --cflags "alsa" 2>/dev/null` --else -- pkg_failed=yes --fi -- else -- pkg_failed=untried --fi --if test -n "$ALSA_LIBS"; then -- pkg_cv_ALSA_LIBS="$ALSA_LIBS" -- elif test -n "$PKG_CONFIG"; then -- if test -n "$PKG_CONFIG" && \ -- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"alsa\""; } >&5 -- ($PKG_CONFIG --exists --print-errors "alsa") 2>&5 -- ac_status=$? -- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -- test $ac_status = 0; }; then -- pkg_cv_ALSA_LIBS=`$PKG_CONFIG --libs "alsa" 2>/dev/null` --else -- pkg_failed=yes --fi -- else -- pkg_failed=untried --fi -- -- -- --if test $pkg_failed = yes; then -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 --$as_echo "no" >&6; } -- --if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then -- _pkg_short_errors_supported=yes --else -- _pkg_short_errors_supported=no --fi -- if test $_pkg_short_errors_supported = yes; then -- ALSA_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "alsa" 2>&1` -- else -- ALSA_PKG_ERRORS=`$PKG_CONFIG --print-errors "alsa" 2>&1` -- fi -- # Put the nasty error message in config.log where it belongs -- echo "$ALSA_PKG_ERRORS" >&5 -- -- ALSA_FOUND=no --elif test $pkg_failed = untried; then -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 --$as_echo "no" >&6; } -- ALSA_FOUND=no --else -- ALSA_CFLAGS=$pkg_cv_ALSA_CFLAGS -- ALSA_LIBS=$pkg_cv_ALSA_LIBS -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 --$as_echo "yes" >&6; } -- ALSA_FOUND=yes --fi -- if test "x${ALSA_FOUND}" = xno -- then -- as_fn_error $? "Could not find alsa - \ -- Try installing alsa-lib-devel." "$LINENO" 5 -- fi -- -- --fi - - if test "x${enable_pulse_java}" = "xyes" - then diff --git a/package/openldap/Makefile b/package/openldap/Makefile index a935994cb..bd2492ad0 100644 --- a/package/openldap/Makefile +++ b/package/openldap/Makefile @@ -4,9 +4,9 @@ include ${TOPDIR}/rules.mk PKG_NAME:= openldap -PKG_VERSION:= 2.4.24 +PKG_VERSION:= 2.4.25 PKG_RELEASE:= 1 -PKG_MD5SUM:= 116fe1e23a7b67686d5e62274367e6c0 +PKG_MD5SUM:= ec63f9c2add59f323a0459128846905b PKG_DESCR:= OpenLDAP client libraries PKG_SECTION:= libs PKG_DEPENDS:= libopenssl libsasl2 diff --git a/package/openldap/patches/patch-build_ltmain_sh b/package/openldap/patches/patch-build_ltmain_sh index 5876849e1..3b48ef1c9 100644 --- a/package/openldap/patches/patch-build_ltmain_sh +++ b/package/openldap/patches/patch-build_ltmain_sh @@ -1,6 +1,6 @@ ---- openldap-2.4.23.orig/build/ltmain.sh 2010-04-13 22:22:21.000000000 +0200 -+++ openldap-2.4.23/build/ltmain.sh 2011-01-15 12:35:41.000000000 +0100 -@@ -1668,7 +1668,7 @@ EOF +--- openldap-2.4.25.orig/build/ltmain.sh 2011-01-05 00:49:25.000000000 +0100 ++++ openldap-2.4.25/build/ltmain.sh 2011-03-30 18:26:08.621808325 +0200 +@@ -1668,7 +1672,7 @@ EOF # -pg 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*|-pg| \ diff --git a/package/orbit2/Makefile b/package/orbit2/Makefile index db64efe10..491163cde 100644 --- a/package/orbit2/Makefile +++ b/package/orbit2/Makefile @@ -14,9 +14,14 @@ PKG_BUILDDEP:= libIDL PKG_URL:= http://projects.gnome.org/ORBit2/ PKG_SITES:= ftp://ftp.gnome.org//pub/gnome/sources/ORBit2/${PKG_EXTRAVER}/ +PKG_SUBPKGS:= ORBIT2 ORBIT2_DEV +PKGSD_ORBIT2_DEV:= orbit2 headers +PKGSC_ORBIT2_DEV:= devel + include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,ORBIT2,orbit2,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call PKG_template,ORBIT2_DEV,orbit2-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_ORBIT2_DEV},${PKGSC_ORBIT2_DEV})) CFLAGS_FOR_BUILD+= $(shell ${BUILD_LIBIDL_CONFIG} --cflags) LDFLAGS_FOR_BUILD+= $(shell ${BUILD_LIBIDL_CONFIG} --libs) @@ -38,8 +43,19 @@ orbit2-install: $(INSTALL_DIR) $(IDIR_ORBIT2)/usr/lib $(INSTALL_BIN) $(WRKINST)/usr/lib/libORBit*.so* \ $(IDIR_ORBIT2)/usr/lib + $(INSTALL_DIR) $(IDIR_ORBIT2)/usr/bin + $(CP) $(WRKINST)/usr/bin/orbit-idl-2 \ + $(IDIR_ORBIT2)/usr/bin $(INSTALL_DIR) $(STAGING_DIR)/usr/bin $(CP) $(WRKINST)/usr/bin/orbit-idl-2 \ $(STAGING_DIR)/usr/bin +orbit2-dev-install: + $(INSTALL_DIR) $(IDIR_ORBIT2_DEV)/usr/include + $(CP) $(WRKINST)/usr/include/* \ + $(IDIR_ORBIT2_DEV)/usr/include + $(INSTALL_DIR) $(IDIR_ORBIT2_DEV)/usr/lib/pkgconfig + $(CP) $(WRKINST)/usr/lib/pkgconfig/*.pc \ + $(IDIR_ORBIT2_DEV)/usr/lib/pkgconfig + include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/pango/Makefile b/package/pango/Makefile index 9224f3d9e..e60684cc8 100644 --- a/package/pango/Makefile +++ b/package/pango/Makefile @@ -26,6 +26,8 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,PANGO,pango,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) $(eval $(call PKG_template,PANGO_DEV,pango-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_PANGO_DEV},${PKGSC_PANGO_DEV},${PKG_OPTS})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) + pango-install: $(INSTALL_DIR) $(IDIR_PANGO)/etc/pango $(INSTALL_DIR) $(IDIR_PANGO)/usr/lib $(IDIR_PANGO)/usr/lib/pango/1.6.0/modules diff --git a/package/perl/patches/patch-Configure b/package/perl/patches/patch-Configure new file mode 100644 index 000000000..953d03c5e --- /dev/null +++ b/package/perl/patches/patch-Configure @@ -0,0 +1,65 @@ +--- perl-5.12.3.orig/Configure 2011-01-09 21:20:52.000000000 +0100 ++++ perl-5.12.3/Configure 2011-03-19 20:44:59.000000000 +0100 +@@ -5164,11 +5164,11 @@ default|recommended) + # is to add the flag to the flags passed to the compiler at link time, + # as that way the compiler can do the right implementation dependant + # thing. (NWC) +- case "$gccversion" in +- ?*) set stack-protector -fstack-protector +- eval $checkccflag +- ;; +- esac ++ #case "$gccversion" in ++ #?*) set stack-protector -fstack-protector ++ # eval $checkccflag ++ # ;; ++ #esac + ;; + esac + +@@ -5308,14 +5308,14 @@ case "$ldflags" in + *) dflt="$ldflags";; + esac + # See note above about -fstack-protector +-case "$ccflags" in +-*-fstack-protector*) +- case "$dflt" in +- *-fstack-protector*) ;; # Don't add it again +- *) dflt="$dflt -fstack-protector" ;; +- esac +- ;; +-esac ++#case "$ccflags" in ++#*-fstack-protector*) ++# case "$dflt" in ++# *-fstack-protector*) ;; # Don't add it again ++# *) dflt="$dflt -fstack-protector" ;; ++# esac ++# ;; ++#esac + + : Try to guess additional flags to pick up local libraries. + for thislibdir in $libpth; do +@@ -8107,14 +8107,14 @@ EOM + ''|' ') dflt='none' ;; + esac + +- case "$ldflags" in +- *-fstack-protector*) +- case "$dflt" in +- *-fstack-protector*) ;; # Don't add it again +- *) dflt="$dflt -fstack-protector" ;; +- esac +- ;; +- esac ++# case "$ldflags" in ++# *-fstack-protector*) ++# case "$dflt" in ++# *-fstack-protector*) ;; # Don't add it again ++# *) dflt="$dflt -fstack-protector" ;; ++# esac ++# ;; ++# esac + + + rp="Any special flags to pass to $ld to create a dynamically loaded library?" diff --git a/package/php/Makefile b/package/php/Makefile index 14e037a30..04167069a 100644 --- a/package/php/Makefile +++ b/package/php/Makefile @@ -4,9 +4,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:= php -PKG_VERSION:= 5.3.5 +PKG_VERSION:= 5.3.6 PKG_RELEASE:= 1 -PKG_MD5SUM:= fb727a3ac72bf0ce37e1a20468a7bb81 +PKG_MD5SUM:= 88a2b00047bc53afbbbdf10ebe28a57e PKG_DESCR:= PHP language interpreter PKG_SECTION:= lang PKG_DEPENDS:= libopenssl zlib @@ -19,15 +19,16 @@ PKG_SUBPKGS:= PHP PHP_CLI PHP_FASTCGI PKGSD_PHP_FASTCGI:= PHP for FastCGI usage PKGSD_PHP_CLI:= PHP CLI -PKG_FLAVOURS_PHP:= MOD_CURL MOD_GD MOD_GMP MOD_LDAP MOD_MYSQL +#PKG_FLAVOURS_PHP:= MOD_CURL MOD_GD MOD_GMP MOD_LDAP MOD_MYSQL +PKG_FLAVOURS_PHP:= MOD_CURL MOD_GMP MOD_LDAP MOD_MYSQL PKG_FLAVOURS_PHP+= MOD_PGSQL MOD_SQLITE MOD_XML PKGFD_MOD_CURL:= Curl support PKGFB_MOD_CURL:= curl PKGFS_MOD_CURL:= libcurl -PKGFD_MOD_GD:= Gd support -PKGFB_MOD_GD:= libgd libpng -PKGFS_MOD_GD:= libgd libpng +#PKGFD_MOD_GD:= Gd support +#PKGFB_MOD_GD:= libgd libpng +#PKGFS_MOD_GD:= libgd libpng PKGFD_MOD_GMP:= GMP support PKGFB_MOD_GMP:= gmp PKGFS_MOD_GMP:= libgmp @@ -106,9 +107,9 @@ PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_TARGET_DIR)/usr" else PKG_CONFIGURE_OPTS+= --without-curl endif -ifneq ($(ADK_PACKAGE_PHP_MOD_GD),) -PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_TARGET_DIR)/usr" \ - --with-jpeg-dir="$(STAGING_TARGET_DIR)/usr" \ +#ifneq ($(ADK_PACKAGE_PHP_MOD_GD),) +#PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_TARGET_DIR)/usr" \ + --without-jpeg-dir \ --with-png-dir="$(STAGING_TARGET_DIR)/usr" \ --without-freetype-dir \ --without-xpm-dir \ @@ -116,9 +117,9 @@ PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_TARGET_DIR)/usr" \ --without-t1lib \ --enable-gd-native-ttf \ --disable-gd-jis-conv -else +#else PKG_CONFIGURE_OPTS+= --without-gd -endif +#endif ifneq ($(ADK_PACKAGE_PHP_MOD_GMP),) PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_TARGET_DIR)/usr" else diff --git a/package/php/patches/patch-ext_standard_php_crypt_r_c b/package/php/patches/patch-ext_standard_php_crypt_r_c deleted file mode 100644 index 1c47df417..000000000 --- a/package/php/patches/patch-ext_standard_php_crypt_r_c +++ /dev/null @@ -1,11 +0,0 @@ ---- php-5.3.4.orig/ext/standard/php_crypt_r.c 2010-06-17 12:22:03.000000000 +0200 -+++ php-5.3.4/ext/standard/php_crypt_r.c 2010-12-30 12:53:12.000000000 +0100 -@@ -94,7 +94,7 @@ void _crypt_extended_init_r(void) - if (!initialized) { - #ifdef PHP_WIN32 - InterlockedIncrement(&initialized); --#elif (defined(__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR >= 2)) -+#elif (defined(__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR >= 2)) || defined(__UCLIBC__) - __sync_fetch_and_add(&initialized, 1); - #elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */ - membar_producer(); diff --git a/package/pixman/Makefile b/package/pixman/Makefile index 50b61a3a9..2b136ec07 100644 --- a/package/pixman/Makefile +++ b/package/pixman/Makefile @@ -4,11 +4,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:= pixman -PKG_VERSION:= 0.16.2 +PKG_VERSION:= 0.20.2 PKG_RELEASE:= 1 -PKG_MD5SUM:= 02bd3669f53c404c19980d5efb6f86fb +PKG_MD5SUM:= a923c20af88e469ac29ba42cfedb88c2 PKG_DESCR:= Pixel manipulation library PKG_SECTION:= x11/libs +PKG_BUILDDEP:= libpng PKG_SITES:= http://www.cairographics.org/releases/ PKG_SUBPKGS:= PIXMAN PIXMAN_DEV @@ -24,9 +25,11 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,PIXMAN,pixman,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) $(eval $(call PKG_template,PIXMAN_DEV,pixman-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_PIXMAN_DEV},${PKGSC_PIXMAN_DEV},${PKG_OPTS})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) + pixman-install: ${INSTALL_DIR} ${IDIR_PIXMAN}/usr/lib - ${CP} ${WRKINST}/usr/lib/libpixman-1.so* ${IDIR_PIXMAN}/usr/lib/ + ${CP} ${WRKINST}/usr/lib/libpixman-1.so* ${IDIR_PIXMAN}/usr/lib pixman-dev-install: ${INSTALL_DIR} ${IDIR_PIXMAN_DEV}/usr/include diff --git a/package/pixman/patches/patch-ltmain_sh b/package/pixman/patches/patch-ltmain_sh index b38645c65..73aa1dfdd 100644 --- a/package/pixman/patches/patch-ltmain_sh +++ b/package/pixman/patches/patch-ltmain_sh @@ -1,11 +1,11 @@ ---- pixman-0.16.2.orig/ltmain.sh 2009-04-23 02:27:43.000000000 +0200 -+++ pixman-0.16.2/ltmain.sh 2011-01-14 20:10:48.000000000 +0100 -@@ -4765,7 +4765,7 @@ func_mode_link () - # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC - # @file GCC response files +--- pixman-0.20.2.orig/ltmain.sh 2010-10-30 23:18:32.000000000 +0200 ++++ pixman-0.20.2/ltmain.sh 2011-04-07 15:05:45.000000000 +0200 +@@ -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*|@*) -+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-fstack-protector*|-flto) +- -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/printproto/Makefile b/package/printproto/Makefile new file mode 100644 index 000000000..63a09d3d6 --- /dev/null +++ b/package/printproto/Makefile @@ -0,0 +1,25 @@ +# 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:= printproto +PKG_VERSION:= 1.0.5 +PKG_RELEASE:= 1 +PKG_DESCR:= X Print Extension headers +PKG_SECTION:= x11/devel +PKG_MD5SUM:= 5afeb3a7de8a14b417239a14ea724268 +PKG_SITES:= http://xorg.freedesktop.org/releases/individual/proto/ + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,PRINTPROTO,printproto,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) + +post-install: + ${INSTALL_DIR} ${IDIR_PRINTPROTO}/usr/include + ${CP} ${WRKINST}/usr/include/X11 ${IDIR_PRINTPROTO}/usr/include + ${INSTALL_DIR} ${IDIR_PRINTPROTO}/usr/lib/pkgconfig + ${INSTALL_DATA} ${WRKINST}/usr/lib/pkgconfig/*.pc \ + ${IDIR_PRINTPROTO}/usr/lib/pkgconfig + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/python2/Makefile b/package/python2/Makefile index 4c72c2e1c..200e9d225 100644 --- a/package/python2/Makefile +++ b/package/python2/Makefile @@ -36,6 +36,7 @@ CONFIGURE_ARGS:= --with-threads \ --without-cxx-main post-extract: + $(CP) ./files/posixmodule.c ${WRKBUILD}/Modules/posixmodule.c $(CP) ./files/python-config.in ${WRKBUILD}/Misc/python-config.in (cd ${WRKBUILD}; rm -rf config.{cache,status} ; \ OPT="$(CFLAGS_FOR_BUILD)" \ diff --git a/package/python2/files/posixmodule.c b/package/python2/files/posixmodule.c new file mode 100644 index 000000000..312861b65 --- /dev/null +++ b/package/python2/files/posixmodule.c @@ -0,0 +1,9365 @@ + +/* POSIX module implementation */ + +/* This file is also used for Windows NT/MS-Win and OS/2. In that case the + module actually calls itself 'nt' or 'os2', not 'posix', and a few + functions are either unimplemented or implemented differently. The source + assumes that for Windows NT, the macro 'MS_WINDOWS' is defined independent + of the compiler used. Different compilers define their own feature + test macro, e.g. '__BORLANDC__' or '_MSC_VER'. For OS/2, the compiler + independent macro PYOS_OS2 should be defined. On OS/2 the default + compiler is assumed to be IBM's VisualAge C++ (VACPP). PYCC_GCC is used + as the compiler specific macro for the EMX port of gcc to OS/2. */ + +/* See also ../Dos/dosmodule.c */ + +#ifdef __APPLE__ + /* + * Step 1 of support for weak-linking a number of symbols existing on + * OSX 10.4 and later, see the comment in the #ifdef __APPLE__ block + * at the end of this file for more information. + */ +# pragma weak lchown +# pragma weak statvfs +# pragma weak fstatvfs + +#endif /* __APPLE__ */ + +#define PY_SSIZE_T_CLEAN + +#include "Python.h" +#include "structseq.h" + +#if defined(__VMS) +# include <unixio.h> +#endif /* defined(__VMS) */ + +#ifdef __cplusplus +extern "C" { +#endif + +PyDoc_STRVAR(posix__doc__, +"This module provides access to operating system functionality that is\n\ +standardized by the C Standard and the POSIX standard (a thinly\n\ +disguised Unix interface). Refer to the library manual and\n\ +corresponding Unix manual entries for more information on calls."); + +#ifndef Py_USING_UNICODE +/* This is used in signatures of functions. */ +#define Py_UNICODE void +#endif + +#if defined(PYOS_OS2) +#define INCL_DOS +#define INCL_DOSERRORS +#define INCL_DOSPROCESS +#define INCL_NOPMAPI +#include <os2.h> +#if defined(PYCC_GCC) +#include <ctype.h> +#include <io.h> +#include <stdio.h> +#include <process.h> +#endif +#include "osdefs.h" +#endif + +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif /* HAVE_SYS_TYPES_H */ + +#ifdef HAVE_SYS_STAT_H +#include <sys/stat.h> +#endif /* HAVE_SYS_STAT_H */ + +#ifdef HAVE_SYS_WAIT_H +#include <sys/wait.h> /* For WNOHANG */ +#endif + +#ifdef HAVE_SIGNAL_H +#include <signal.h> +#endif + +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif /* HAVE_FCNTL_H */ + +#ifdef HAVE_GRP_H +#include <grp.h> +#endif + +#ifdef HAVE_SYSEXITS_H +#include <sysexits.h> +#endif /* HAVE_SYSEXITS_H */ + +#ifdef HAVE_SYS_LOADAVG_H +#include <sys/loadavg.h> +#endif + +/* Various compilers have only certain posix functions */ +/* XXX Gosh I wish these were all moved into pyconfig.h */ +#if defined(PYCC_VACPP) && defined(PYOS_OS2) +#include <process.h> +#else +#if defined(__WATCOMC__) && !defined(__QNX__) /* Watcom compiler */ +#define HAVE_GETCWD 1 +#define HAVE_OPENDIR 1 +#define HAVE_SYSTEM 1 +#if defined(__OS2__) +#define HAVE_EXECV 1 +#define HAVE_WAIT 1 +#endif +#include <process.h> +#else +#ifdef __BORLANDC__ /* Borland compiler */ +#define HAVE_EXECV 1 +#define HAVE_GETCWD 1 +#define HAVE_OPENDIR 1 +#define HAVE_PIPE 1 +#define HAVE_POPEN 1 +#define HAVE_SYSTEM 1 +#define HAVE_WAIT 1 +#else +#ifdef _MSC_VER /* Microsoft compiler */ +#define HAVE_GETCWD 1 +#define HAVE_SPAWNV 1 +#define HAVE_EXECV 1 +#define HAVE_PIPE 1 +#define HAVE_POPEN 1 +#define HAVE_SYSTEM 1 +#define HAVE_CWAIT 1 +#define HAVE_FSYNC 1 +#define fsync _commit +#else +#if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS) +/* Everything needed is defined in PC/os2emx/pyconfig.h or vms/pyconfig.h */ +#else /* all other compilers */ +/* Unix functions that the configure script doesn't check for */ +#define HAVE_EXECV 1 +#define HAVE_FORK 1 +#if defined(__USLC__) && defined(__SCO_VERSION__) /* SCO UDK Compiler */ +#define HAVE_FORK1 1 +#endif +#define HAVE_GETCWD 1 +#define HAVE_GETEGID 1 +#define HAVE_GETEUID 1 +#define HAVE_GETGID 1 +#define HAVE_GETPPID 1 +#define HAVE_GETUID 1 +#define HAVE_KILL 1 +#define HAVE_OPENDIR 1 +#define HAVE_PIPE 1 +#ifndef __rtems__ +#define HAVE_POPEN 1 +#endif +#define HAVE_SYSTEM 1 +#define HAVE_WAIT 1 +#define HAVE_TTYNAME 1 +#endif /* PYOS_OS2 && PYCC_GCC && __VMS */ +#endif /* _MSC_VER */ +#endif /* __BORLANDC__ */ +#endif /* ! __WATCOMC__ || __QNX__ */ +#endif /* ! __IBMC__ */ + +#ifndef _MSC_VER + +#if defined(__sgi)&&_COMPILER_VERSION>=700 +/* declare ctermid_r if compiling with MIPSPro 7.x in ANSI C mode + (default) */ +extern char *ctermid_r(char *); +#endif + +#ifndef HAVE_UNISTD_H +#if defined(PYCC_VACPP) +extern int mkdir(char *); +#else +#if ( defined(__WATCOMC__) || defined(_MSC_VER) ) && !defined(__QNX__) +extern int mkdir(const char *); +#else +extern int mkdir(const char *, mode_t); +#endif +#endif +#if defined(__IBMC__) || defined(__IBMCPP__) +extern int chdir(char *); +extern int rmdir(char *); +#else +extern int chdir(const char *); +extern int rmdir(const char *); +#endif +#ifdef __BORLANDC__ +extern int chmod(const char *, int); +#else +extern int chmod(const char *, mode_t); +#endif +/*#ifdef HAVE_FCHMOD +extern int fchmod(int, mode_t); +#endif*/ +/*#ifdef HAVE_LCHMOD +extern int lchmod(const char *, mode_t); +#endif*/ +extern int chown(const char *, uid_t, gid_t); +extern char *getcwd(char *, int); +extern char *strerror(int); +extern int link(const char *, const char *); +extern int rename(const char *, const char *); +extern int stat(const char *, struct stat *); +extern int unlink(const char *); +extern int pclose(FILE *); +#ifdef HAVE_SYMLINK +extern int symlink(const char *, const char *); +#endif /* HAVE_SYMLINK */ +#ifdef HAVE_LSTAT +extern int lstat(const char *, struct stat *); +#endif /* HAVE_LSTAT */ +#endif /* !HAVE_UNISTD_H */ + +#endif /* !_MSC_VER */ + +#ifdef HAVE_UTIME_H +#include <utime.h> +#endif /* HAVE_UTIME_H */ + +#ifdef HAVE_SYS_UTIME_H +#include <sys/utime.h> +#define HAVE_UTIME_H /* pretend we do for the rest of this file */ +#endif /* HAVE_SYS_UTIME_H */ + +#ifdef HAVE_SYS_TIMES_H +#include <sys/times.h> +#endif /* HAVE_SYS_TIMES_H */ + +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif /* HAVE_SYS_PARAM_H */ + +#ifdef HAVE_SYS_UTSNAME_H +#include <sys/utsname.h> +#endif /* HAVE_SYS_UTSNAME_H */ + +#ifdef HAVE_DIRENT_H +#include <dirent.h> +#define NAMLEN(dirent) strlen((dirent)->d_name) +#else +#if defined(__WATCOMC__) && !defined(__QNX__) +#include <direct.h> +#define NAMLEN(dirent) strlen((dirent)->d_name) +#else +#define dirent direct +#define NAMLEN(dirent) (dirent)->d_namlen +#endif +#ifdef HAVE_SYS_NDIR_H +#include <sys/ndir.h> +#endif +#ifdef HAVE_SYS_DIR_H +#include <sys/dir.h> +#endif +#ifdef HAVE_NDIR_H +#include <ndir.h> +#endif +#endif + +#ifdef _MSC_VER +#ifdef HAVE_DIRECT_H +#include <direct.h> +#endif +#ifdef HAVE_IO_H +#include <io.h> +#endif +#ifdef HAVE_PROCESS_H +#include <process.h> +#endif +#include "osdefs.h" +#include <malloc.h> +#include <windows.h> +#include <shellapi.h> /* for ShellExecute() */ +#define popen _popen +#define pclose _pclose +#endif /* _MSC_VER */ + +#if defined(PYCC_VACPP) && defined(PYOS_OS2) +#include <io.h> +#endif /* OS2 */ + +#ifndef MAXPATHLEN +#if defined(PATH_MAX) && PATH_MAX > 1024 +#define MAXPATHLEN PATH_MAX +#else +#define MAXPATHLEN 1024 +#endif +#endif /* MAXPATHLEN */ + +#ifdef UNION_WAIT +/* Emulate some macros on systems that have a union instead of macros */ + +#ifndef WIFEXITED +#define WIFEXITED(u_wait) (!(u_wait).w_termsig && !(u_wait).w_coredump) +#endif + +#ifndef WEXITSTATUS +#define WEXITSTATUS(u_wait) (WIFEXITED(u_wait)?((u_wait).w_retcode):-1) +#endif + +#ifndef WTERMSIG +#define WTERMSIG(u_wait) ((u_wait).w_termsig) +#endif + +#define WAIT_TYPE union wait +#define WAIT_STATUS_INT(s) (s.w_status) + +#else /* !UNION_WAIT */ +#define WAIT_TYPE int +#define WAIT_STATUS_INT(s) (s) +#endif /* UNION_WAIT */ + +/* Issue #1983: pid_t can be longer than a C long on some systems */ +#if !defined(SIZEOF_PID_T) || SIZEOF_PID_T == SIZEOF_INT +#define PARSE_PID "i" +#define PyLong_FromPid PyInt_FromLong +#define PyLong_AsPid PyInt_AsLong +#elif SIZEOF_PID_T == SIZEOF_LONG +#define PARSE_PID "l" +#define PyLong_FromPid PyInt_FromLong +#define PyLong_AsPid PyInt_AsLong +#elif defined(SIZEOF_LONG_LONG) && SIZEOF_PID_T == SIZEOF_LONG_LONG +#define PARSE_PID "L" +#define PyLong_FromPid PyLong_FromLongLong +#define PyLong_AsPid PyInt_AsLongLong +#else +#error "sizeof(pid_t) is neither sizeof(int), sizeof(long) or sizeof(long long)" +#endif /* SIZEOF_PID_T */ + +/* Don't use the "_r" form if we don't need it (also, won't have a + prototype for it, at least on Solaris -- maybe others as well?). */ +#if defined(HAVE_CTERMID_R) && defined(WITH_THREAD) +#define USE_CTERMID_R +#endif + +#if defined(HAVE_TMPNAM_R) && defined(WITH_THREAD) +#define USE_TMPNAM_R +#endif + +/* choose the appropriate stat and fstat functions and return structs */ +#undef STAT +#if defined(MS_WIN64) || defined(MS_WINDOWS) +# define STAT win32_stat +# define FSTAT win32_fstat +# define STRUCT_STAT struct win32_stat +#else +# define STAT stat +# define FSTAT fstat +# define STRUCT_STAT struct stat +#endif + +#if defined(MAJOR_IN_MKDEV) +#include <sys/mkdev.h> +#else +#if defined(MAJOR_IN_SYSMACROS) +#include <sys/sysmacros.h> +#endif +#if defined(HAVE_MKNOD) && defined(HAVE_SYS_MKDEV_H) +#include <sys/mkdev.h> +#endif +#endif + +#if defined _MSC_VER && _MSC_VER >= 1400 +/* Microsoft CRT in VS2005 and higher will verify that a filehandle is + * valid and throw an assertion if it isn't. + * Normally, an invalid fd is likely to be a C program error and therefore + * an assertion can be useful, but it does contradict the POSIX standard + * which for write(2) states: + * "Otherwise, -1 shall be returned and errno set to indicate the error." + * "[EBADF] The fildes argument is not a valid file descriptor open for + * writing." + * Furthermore, python allows the user to enter any old integer + * as a fd and should merely raise a python exception on error. + * The Microsoft CRT doesn't provide an official way to check for the + * validity of a file descriptor, but we can emulate its internal behaviour + * by using the exported __pinfo data member and knowledge of the + * internal structures involved. + * The structures below must be updated for each version of visual studio + * according to the file internal.h in the CRT source, until MS comes + * up with a less hacky way to do this. + * (all of this is to avoid globally modifying the CRT behaviour using + * _set_invalid_parameter_handler() and _CrtSetReportMode()) + */ +/* The actual size of the structure is determined at runtime. + * Only the first items must be present. + */ +typedef struct { + intptr_t osfhnd; + char osfile; +} my_ioinfo; + +extern __declspec(dllimport) char * __pioinfo[]; +#define IOINFO_L2E 5 +#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E) +#define IOINFO_ARRAYS 64 +#define _NHANDLE_ (IOINFO_ARRAYS * IOINFO_ARRAY_ELTS) +#define FOPEN 0x01 +#define _NO_CONSOLE_FILENO (intptr_t)-2 + +/* This function emulates what the windows CRT does to validate file handles */ +int +_PyVerify_fd(int fd) +{ + const int i1 = fd >> IOINFO_L2E; + const int i2 = fd & ((1 << IOINFO_L2E) - 1); + + static int sizeof_ioinfo = 0; + + /* Determine the actual size of the ioinfo structure, + * as used by the CRT loaded in memory + */ + if (sizeof_ioinfo == 0 && __pioinfo[0] != NULL) { + sizeof_ioinfo = _msize(__pioinfo[0]) / IOINFO_ARRAY_ELTS; + } + if (sizeof_ioinfo == 0) { + /* This should not happen... */ + goto fail; + } + + /* See that it isn't a special CLEAR fileno */ + if (fd != _NO_CONSOLE_FILENO) { + /* Microsoft CRT would check that 0<=fd<_nhandle but we can't do that. Instead + * we check pointer validity and other info + */ + if (0 <= i1 && i1 < IOINFO_ARRAYS && __pioinfo[i1] != NULL) { + /* finally, check that the file is open */ + my_ioinfo* info = (my_ioinfo*)(__pioinfo[i1] + i2 * sizeof_ioinfo); + if (info->osfile & FOPEN) { + return 1; + } + } + } + fail: + errno = EBADF; + return 0; +} + +/* the special case of checking dup2. The target fd must be in a sensible range */ +static int +_PyVerify_fd_dup2(int fd1, int fd2) +{ + if (!_PyVerify_fd(fd1)) + return 0; + if (fd2 == _NO_CONSOLE_FILENO) + return 0; + if ((unsigned)fd2 < _NHANDLE_) + return 1; + else + return 0; +} +#else +/* dummy version. _PyVerify_fd() is already defined in fileobject.h */ +#define _PyVerify_fd_dup2(A, B) (1) +#endif + +/* Return a dictionary corresponding to the POSIX environment table */ +#ifdef WITH_NEXT_FRAMEWORK +/* On Darwin/MacOSX a shared library or framework has no access to +** environ directly, we must obtain it with _NSGetEnviron(). +*/ +#include <crt_externs.h> +static char **environ; +#elif !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) ) +extern char **environ; +#endif /* !_MSC_VER */ + +static PyObject * +convertenviron(void) +{ + PyObject *d; + char **e; +#if defined(PYOS_OS2) + APIRET rc; + char buffer[1024]; /* OS/2 Provides a Documented Max of 1024 Chars */ +#endif + d = PyDict_New(); + if (d == NULL) + return NULL; +#ifdef WITH_NEXT_FRAMEWORK + if (environ == NULL) + environ = *_NSGetEnviron(); +#endif + if (environ == NULL) + return d; + /* This part ignores errors */ + for (e = environ; *e != NULL; e++) { + PyObject *k; + PyObject *v; + char *p = strchr(*e, '='); + if (p == NULL) + continue; + k = PyString_FromStringAndSize(*e, (int)(p-*e)); + if (k == NULL) { + PyErr_Clear(); + continue; + } + v = PyString_FromString(p+1); + if (v == NULL) { + PyErr_Clear(); + Py_DECREF(k); + continue; + } + if (PyDict_GetItem(d, k) == NULL) { + if (PyDict_SetItem(d, k, v) != 0) + PyErr_Clear(); + } + Py_DECREF(k); + Py_DECREF(v); + } +#if defined(PYOS_OS2) + rc = DosQueryExtLIBPATH(buffer, BEGIN_LIBPATH); + if (rc == NO_ERROR) { /* (not a type, envname is NOT 'BEGIN_LIBPATH') */ + PyObject *v = PyString_FromString(buffer); + PyDict_SetItemString(d, "BEGINLIBPATH", v); + Py_DECREF(v); + } + rc = DosQueryExtLIBPATH(buffer, END_LIBPATH); + if (rc == NO_ERROR) { /* (not a typo, envname is NOT 'END_LIBPATH') */ + PyObject *v = PyString_FromString(buffer); + PyDict_SetItemString(d, "ENDLIBPATH", v); + Py_DECREF(v); + } +#endif + return d; +} + + +/* Set a POSIX-specific error from errno, and return NULL */ + +static PyObject * +posix_error(void) +{ + return PyErr_SetFromErrno(PyExc_OSError); +} +static PyObject * +posix_error_with_filename(char* name) +{ + return PyErr_SetFromErrnoWithFilename(PyExc_OSError, name); +} + +#ifdef MS_WINDOWS +static PyObject * +posix_error_with_unicode_filename(Py_UNICODE* name) +{ + return PyErr_SetFromErrnoWithUnicodeFilename(PyExc_OSError, name); +} +#endif /* MS_WINDOWS */ + + +static PyObject * +posix_error_with_allocated_filename(char* name) +{ + PyObject *rc = PyErr_SetFromErrnoWithFilename(PyExc_OSError, name); + PyMem_Free(name); + return rc; +} + +#ifdef MS_WINDOWS +static PyObject * +win32_error(char* function, char* filename) +{ + /* XXX We should pass the function name along in the future. + (_winreg.c also wants to pass the function name.) + This would however require an additional param to the + Windows error object, which is non-trivial. + */ + errno = GetLastError(); + if (filename) + return PyErr_SetFromWindowsErrWithFilename(errno, filename); + else + return PyErr_SetFromWindowsErr(errno); +} + +static PyObject * +win32_error_unicode(char* function, Py_UNICODE* filename) +{ + /* XXX - see win32_error for comments on 'function' */ + errno = GetLastError(); + if (filename) + return PyErr_SetFromWindowsErrWithUnicodeFilename(errno, filename); + else + return PyErr_SetFromWindowsErr(errno); +} + +static int +convert_to_unicode(PyObject **param) +{ + if (PyUnicode_CheckExact(*param)) + Py_INCREF(*param); + else if (PyUnicode_Check(*param)) + /* For a Unicode subtype that's not a Unicode object, + return a true Unicode object with the same data. */ + *param = PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(*param), + PyUnicode_GET_SIZE(*param)); + else + *param = PyUnicode_FromEncodedObject(*param, + Py_FileSystemDefaultEncoding, + "strict"); + return (*param) != NULL; +} + +#endif /* MS_WINDOWS */ + +#if defined(PYOS_OS2) +/********************************************************************** + * Helper Function to Trim and Format OS/2 Messages + **********************************************************************/ +static void +os2_formatmsg(char *msgbuf, int msglen, char *reason) +{ + msgbuf[msglen] = '\0'; /* OS/2 Doesn't Guarantee a Terminator */ + + if (strlen(msgbuf) > 0) { /* If Non-Empty Msg, Trim CRLF */ + char *lastc = &msgbuf[ strlen(msgbuf)-1 ]; + + while (lastc > msgbuf && isspace(Py_CHARMASK(*lastc))) + *lastc-- = '\0'; /* Trim Trailing Whitespace (CRLF) */ + } + + /* Add Optional Reason Text */ + if (reason) { + strcat(msgbuf, " : "); + strcat(msgbuf, reason); + } +} + +/********************************************************************** + * Decode an OS/2 Operating System Error Code + * + * A convenience function to lookup an OS/2 error code and return a + * text message we can use to raise a Python exception. + * + * Notes: + * The messages for errors returned from the OS/2 kernel reside in + * the file OSO001.MSG in the \OS2 directory hierarchy. + * + **********************************************************************/ +static char * +os2_strerror(char *msgbuf, int msgbuflen, int errorcode, char *reason) +{ + APIRET rc; + ULONG msglen; + + /* Retrieve Kernel-Related Error Message from OSO001.MSG File */ + Py_BEGIN_ALLOW_THREADS + rc = DosGetMessage(NULL, 0, msgbuf, msgbuflen, + errorcode, "oso001.msg", &msglen); + Py_END_ALLOW_THREADS + + if (rc == NO_ERROR) + os2_formatmsg(msgbuf, msglen, reason); + else + PyOS_snprintf(msgbuf, msgbuflen, + "unknown OS error #%d", errorcode); + + return msgbuf; +} + +/* Set an OS/2-specific error and return NULL. OS/2 kernel + errors are not in a global variable e.g. 'errno' nor are + they congruent with posix error numbers. */ + +static PyObject * +os2_error(int code) +{ + char text[1024]; + PyObject *v; + + os2_strerror(text, sizeof(text), code, ""); + + v = Py_BuildValue("(is)", code, text); + if (v != NULL) { + PyErr_SetObject(PyExc_OSError, v); + Py_DECREF(v); + } + return NULL; /* Signal to Python that an Exception is Pending */ +} + +#endif /* OS2 */ + +/* POSIX generic methods */ + +static PyObject * +posix_fildes(PyObject *fdobj, int (*func)(int)) +{ + int fd; + int res; + fd = PyObject_AsFileDescriptor(fdobj); + if (fd < 0) + return NULL; + if (!_PyVerify_fd(fd)) + return posix_error(); + Py_BEGIN_ALLOW_THREADS + res = (*func)(fd); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error(); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +posix_1str(PyObject *args, char *format, int (*func)(const char*)) +{ + char *path1 = NULL; + int res; + if (!PyArg_ParseTuple(args, format, + Py_FileSystemDefaultEncoding, &path1)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = (*func)(path1); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error_with_allocated_filename(path1); + PyMem_Free(path1); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +posix_2str(PyObject *args, + char *format, + int (*func)(const char *, const char *)) +{ + char *path1 = NULL, *path2 = NULL; + int res; + if (!PyArg_ParseTuple(args, format, + Py_FileSystemDefaultEncoding, &path1, + Py_FileSystemDefaultEncoding, &path2)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = (*func)(path1, path2); + Py_END_ALLOW_THREADS + PyMem_Free(path1); + PyMem_Free(path2); + if (res != 0) + /* XXX how to report both path1 and path2??? */ + return posix_error(); + Py_INCREF(Py_None); + return Py_None; +} + +#ifdef MS_WINDOWS +static PyObject* +win32_1str(PyObject* args, char* func, + char* format, BOOL (__stdcall *funcA)(LPCSTR), + char* wformat, BOOL (__stdcall *funcW)(LPWSTR)) +{ + PyObject *uni; + char *ansi; + BOOL result; + + if (!PyArg_ParseTuple(args, wformat, &uni)) + PyErr_Clear(); + else { + Py_BEGIN_ALLOW_THREADS + result = funcW(PyUnicode_AsUnicode(uni)); + Py_END_ALLOW_THREADS + if (!result) + return win32_error_unicode(func, PyUnicode_AsUnicode(uni)); + Py_INCREF(Py_None); + return Py_None; + } + if (!PyArg_ParseTuple(args, format, &ansi)) + return NULL; + Py_BEGIN_ALLOW_THREADS + result = funcA(ansi); + Py_END_ALLOW_THREADS + if (!result) + return win32_error(func, ansi); + Py_INCREF(Py_None); + return Py_None; + +} + +/* This is a reimplementation of the C library's chdir function, + but one that produces Win32 errors instead of DOS error codes. + chdir is essentially a wrapper around SetCurrentDirectory; however, + it also needs to set "magic" environment variables indicating + the per-drive current directory, which are of the form =<drive>: */ +static BOOL __stdcall +win32_chdir(LPCSTR path) +{ + char new_path[MAX_PATH+1]; + int result; + char env[4] = "=x:"; + + if(!SetCurrentDirectoryA(path)) + return FALSE; + result = GetCurrentDirectoryA(MAX_PATH+1, new_path); + if (!result) + return FALSE; + /* In the ANSI API, there should not be any paths longer + than MAX_PATH. */ + assert(result <= MAX_PATH+1); + if (strncmp(new_path, "\\\\", 2) == 0 || + strncmp(new_path, "//", 2) == 0) + /* UNC path, nothing to do. */ + return TRUE; + env[1] = new_path[0]; + return SetEnvironmentVariableA(env, new_path); +} + +/* The Unicode version differs from the ANSI version + since the current directory might exceed MAX_PATH characters */ +static BOOL __stdcall +win32_wchdir(LPCWSTR path) +{ + wchar_t _new_path[MAX_PATH+1], *new_path = _new_path; + int result; + wchar_t env[4] = L"=x:"; + + if(!SetCurrentDirectoryW(path)) + return FALSE; + result = GetCurrentDirectoryW(MAX_PATH+1, new_path); + if (!result) + return FALSE; + if (result > MAX_PATH+1) { + new_path = malloc(result * sizeof(wchar_t)); + if (!new_path) { + SetLastError(ERROR_OUTOFMEMORY); + return FALSE; + } + result = GetCurrentDirectoryW(result, new_path); + if (!result) { + free(new_path); + return FALSE; + } + } + if (wcsncmp(new_path, L"\\\\", 2) == 0 || + wcsncmp(new_path, L"//", 2) == 0) + /* UNC path, nothing to do. */ + return TRUE; + env[1] = new_path[0]; + result = SetEnvironmentVariableW(env, new_path); + if (new_path != _new_path) + free(new_path); + return result; +} +#endif + +#ifdef MS_WINDOWS +/* The CRT of Windows has a number of flaws wrt. its stat() implementation: + - time stamps are restricted to second resolution + - file modification times suffer from forth-and-back conversions between + UTC and local time + Therefore, we implement our own stat, based on the Win32 API directly. +*/ +#define HAVE_STAT_NSEC 1 + +struct win32_stat{ + int st_dev; + __int64 st_ino; + unsigned short st_mode; + int st_nlink; + int st_uid; + int st_gid; + int st_rdev; + __int64 st_size; + int st_atime; + int st_atime_nsec; + int st_mtime; + int st_mtime_nsec; + int st_ctime; + int st_ctime_nsec; +}; + +static __int64 secs_between_epochs = 11644473600; /* Seconds between 1.1.1601 and 1.1.1970 */ + +static void +FILE_TIME_to_time_t_nsec(FILETIME *in_ptr, int *time_out, int* nsec_out) +{ + /* XXX endianness. Shouldn't matter, as all Windows implementations are little-endian */ + /* Cannot simply cast and dereference in_ptr, + since it might not be aligned properly */ + __int64 in; + memcpy(&in, in_ptr, sizeof(in)); + *nsec_out = (int)(in % 10000000) * 100; /* FILETIME is in units of 100 nsec. */ + /* XXX Win32 supports time stamps past 2038; we currently don't */ + *time_out = Py_SAFE_DOWNCAST((in / 10000000) - secs_between_epochs, __int64, int); +} + +static void +time_t_to_FILE_TIME(int time_in, int nsec_in, FILETIME *out_ptr) +{ + /* XXX endianness */ + __int64 out; + out = time_in + secs_between_epochs; + out = out * 10000000 + nsec_in / 100; + memcpy(out_ptr, &out, sizeof(out)); +} + +/* Below, we *know* that ugo+r is 0444 */ +#if _S_IREAD != 0400 +#error Unsupported C library +#endif +static int +attributes_to_mode(DWORD attr) +{ + int m = 0; + if (attr & FILE_ATTRIBUTE_DIRECTORY) + m |= _S_IFDIR | 0111; /* IFEXEC for user,group,other */ + else + m |= _S_IFREG; + if (attr & FILE_ATTRIBUTE_READONLY) + m |= 0444; + else + m |= 0666; + return m; +} + +static int +attribute_data_to_stat(WIN32_FILE_ATTRIBUTE_DATA *info, struct win32_stat *result) +{ + memset(result, 0, sizeof(*result)); + result->st_mode = attributes_to_mode(info->dwFileAttributes); + result->st_size = (((__int64)info->nFileSizeHigh)<<32) + info->nFileSizeLow; + FILE_TIME_to_time_t_nsec(&info->ftCreationTime, &result->st_ctime, &result->st_ctime_nsec); + FILE_TIME_to_time_t_nsec(&info->ftLastWriteTime, &result->st_mtime, &result->st_mtime_nsec); + FILE_TIME_to_time_t_nsec(&info->ftLastAccessTime, &result->st_atime, &result->st_atime_nsec); + + return 0; +} + +static BOOL +attributes_from_dir(LPCSTR pszFile, LPWIN32_FILE_ATTRIBUTE_DATA pfad) +{ + HANDLE hFindFile; + WIN32_FIND_DATAA FileData; + hFindFile = FindFirstFileA(pszFile, &FileData); + if (hFindFile == INVALID_HANDLE_VALUE) + return FALSE; + FindClose(hFindFile); + pfad->dwFileAttributes = FileData.dwFileAttributes; + pfad->ftCreationTime = FileData.ftCreationTime; + pfad->ftLastAccessTime = FileData.ftLastAccessTime; + pfad->ftLastWriteTime = FileData.ftLastWriteTime; + pfad->nFileSizeHigh = FileData.nFileSizeHigh; + pfad->nFileSizeLow = FileData.nFileSizeLow; + return TRUE; +} + +static BOOL +attributes_from_dir_w(LPCWSTR pszFile, LPWIN32_FILE_ATTRIBUTE_DATA pfad) +{ + HANDLE hFindFile; + WIN32_FIND_DATAW FileData; + hFindFile = FindFirstFileW(pszFile, &FileData); + if (hFindFile == INVALID_HANDLE_VALUE) + return FALSE; + FindClose(hFindFile); + pfad->dwFileAttributes = FileData.dwFileAttributes; + pfad->ftCreationTime = FileData.ftCreationTime; + pfad->ftLastAccessTime = FileData.ftLastAccessTime; + pfad->ftLastWriteTime = FileData.ftLastWriteTime; + pfad->nFileSizeHigh = FileData.nFileSizeHigh; + pfad->nFileSizeLow = FileData.nFileSizeLow; + return TRUE; +} + +static int +win32_stat(const char* path, struct win32_stat *result) +{ + WIN32_FILE_ATTRIBUTE_DATA info; + int code; + char *dot; + if (!GetFileAttributesExA(path, GetFileExInfoStandard, &info)) { + if (GetLastError() != ERROR_SHARING_VIOLATION) { + /* Protocol violation: we explicitly clear errno, instead of + setting it to a POSIX error. Callers should use GetLastError. */ + errno = 0; + return -1; + } else { + /* Could not get attributes on open file. Fall back to + reading the directory. */ + if (!attributes_from_dir(path, &info)) { + /* Very strange. This should not fail now */ + errno = 0; + return -1; + } + } + } + code = attribute_data_to_stat(&info, result); + if (code != 0) + return code; + /* Set S_IFEXEC if it is an .exe, .bat, ... */ + dot = strrchr(path, '.'); + if (dot) { + if (stricmp(dot, ".bat") == 0 || + stricmp(dot, ".cmd") == 0 || + stricmp(dot, ".exe") == 0 || + stricmp(dot, ".com") == 0) + result->st_mode |= 0111; + } + return code; +} + +static int +win32_wstat(const wchar_t* path, struct win32_stat *result) +{ + int code; + const wchar_t *dot; + WIN32_FILE_ATTRIBUTE_DATA info; + if (!GetFileAttributesExW(path, GetFileExInfoStandard, &info)) { + if (GetLastError() != ERROR_SHARING_VIOLATION) { + /* Protocol violation: we explicitly clear errno, instead of + setting it to a POSIX error. Callers should use GetLastError. */ + errno = 0; + return -1; + } else { + /* Could not get attributes on open file. Fall back to + reading the directory. */ + if (!attributes_from_dir_w(path, &info)) { + /* Very strange. This should not fail now */ + errno = 0; + return -1; + } + } + } + code = attribute_data_to_stat(&info, result); + if (code < 0) + return code; + /* Set IFEXEC if it is an .exe, .bat, ... */ + dot = wcsrchr(path, '.'); + if (dot) { + if (_wcsicmp(dot, L".bat") == 0 || + _wcsicmp(dot, L".cmd") == 0 || + _wcsicmp(dot, L".exe") == 0 || + _wcsicmp(dot, L".com") == 0) + result->st_mode |= 0111; + } + return code; +} + +static int +win32_fstat(int file_number, struct win32_stat *result) +{ + BY_HANDLE_FILE_INFORMATION info; + HANDLE h; + int type; + + h = (HANDLE)_get_osfhandle(file_number); + + /* Protocol violation: we explicitly clear errno, instead of + setting it to a POSIX error. Callers should use GetLastError. */ + errno = 0; + + if (h == INVALID_HANDLE_VALUE) { + /* This is really a C library error (invalid file handle). + We set the Win32 error to the closes one matching. */ + SetLastError(ERROR_INVALID_HANDLE); + return -1; + } + memset(result, 0, sizeof(*result)); + + type = GetFileType(h); + if (type == FILE_TYPE_UNKNOWN) { + DWORD error = GetLastError(); + if (error != 0) { + return -1; + } + /* else: valid but unknown file */ + } + + if (type != FILE_TYPE_DISK) { + if (type == FILE_TYPE_CHAR) + result->st_mode = _S_IFCHR; + else if (type == FILE_TYPE_PIPE) + result->st_mode = _S_IFIFO; + return 0; + } + + if (!GetFileInformationByHandle(h, &info)) { + return -1; + } + + /* similar to stat() */ + result->st_mode = attributes_to_mode(info.dwFileAttributes); + result->st_size = (((__int64)info.nFileSizeHigh)<<32) + info.nFileSizeLow; + FILE_TIME_to_time_t_nsec(&info.ftCreationTime, &result->st_ctime, &result->st_ctime_nsec); + FILE_TIME_to_time_t_nsec(&info.ftLastWriteTime, &result->st_mtime, &result->st_mtime_nsec); + FILE_TIME_to_time_t_nsec(&info.ftLastAccessTime, &result->st_atime, &result->st_atime_nsec); + /* specific to fstat() */ + result->st_nlink = info.nNumberOfLinks; + result->st_ino = (((__int64)info.nFileIndexHigh)<<32) + info.nFileIndexLow; + return 0; +} + +#endif /* MS_WINDOWS */ + +PyDoc_STRVAR(stat_result__doc__, +"stat_result: Result from stat or lstat.\n\n\ +This object may be accessed either as a tuple of\n\ + (mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime)\n\ +or via the attributes st_mode, st_ino, st_dev, st_nlink, st_uid, and so on.\n\ +\n\ +Posix/windows: If your platform supports st_blksize, st_blocks, st_rdev,\n\ +or st_flags, they are available as attributes only.\n\ +\n\ +See os.stat for more information."); + +static PyStructSequence_Field stat_result_fields[] = { + {"st_mode", "protection bits"}, + {"st_ino", "inode"}, + {"st_dev", "device"}, + {"st_nlink", "number of hard links"}, + {"st_uid", "user ID of owner"}, + {"st_gid", "group ID of owner"}, + {"st_size", "total size, in bytes"}, + /* The NULL is replaced with PyStructSequence_UnnamedField later. */ + {NULL, "integer time of last access"}, + {NULL, "integer time of last modification"}, + {NULL, "integer time of last change"}, + {"st_atime", "time of last access"}, + {"st_mtime", "time of last modification"}, + {"st_ctime", "time of last change"}, +#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE + {"st_blksize", "blocksize for filesystem I/O"}, +#endif +#ifdef HAVE_STRUCT_STAT_ST_BLOCKS + {"st_blocks", "number of blocks allocated"}, +#endif +#ifdef HAVE_STRUCT_STAT_ST_RDEV + {"st_rdev", "device type (if inode device)"}, +#endif +#ifdef HAVE_STRUCT_STAT_ST_FLAGS + {"st_flags", "user defined flags for file"}, +#endif +#ifdef HAVE_STRUCT_STAT_ST_GEN + {"st_gen", "generation number"}, +#endif +#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME + {"st_birthtime", "time of creation"}, +#endif + {0} +}; + +#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE +#define ST_BLKSIZE_IDX 13 +#else +#define ST_BLKSIZE_IDX 12 +#endif + +#ifdef HAVE_STRUCT_STAT_ST_BLOCKS +#define ST_BLOCKS_IDX (ST_BLKSIZE_IDX+1) +#else +#define ST_BLOCKS_IDX ST_BLKSIZE_IDX +#endif + +#ifdef HAVE_STRUCT_STAT_ST_RDEV +#define ST_RDEV_IDX (ST_BLOCKS_IDX+1) +#else +#define ST_RDEV_IDX ST_BLOCKS_IDX +#endif + +#ifdef HAVE_STRUCT_STAT_ST_FLAGS +#define ST_FLAGS_IDX (ST_RDEV_IDX+1) +#else +#define ST_FLAGS_IDX ST_RDEV_IDX +#endif + +#ifdef HAVE_STRUCT_STAT_ST_GEN +#define ST_GEN_IDX (ST_FLAGS_IDX+1) +#else +#define ST_GEN_IDX ST_FLAGS_IDX +#endif + +#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME +#define ST_BIRTHTIME_IDX (ST_GEN_IDX+1) +#else +#define ST_BIRTHTIME_IDX ST_GEN_IDX +#endif + +static PyStructSequence_Desc stat_result_desc = { + "stat_result", /* name */ + stat_result__doc__, /* doc */ + stat_result_fields, + 10 +}; + +PyDoc_STRVAR(statvfs_result__doc__, +"statvfs_result: Result from statvfs or fstatvfs.\n\n\ +This object may be accessed either as a tuple of\n\ + (bsize, frsize, blocks, bfree, bavail, files, ffree, favail, flag, namemax),\n\ +or via the attributes f_bsize, f_frsize, f_blocks, f_bfree, and so on.\n\ +\n\ +See os.statvfs for more information."); + +static PyStructSequence_Field statvfs_result_fields[] = { + {"f_bsize", }, + {"f_frsize", }, + {"f_blocks", }, + {"f_bfree", }, + {"f_bavail", }, + {"f_files", }, + {"f_ffree", }, + {"f_favail", }, + {"f_flag", }, + {"f_namemax",}, + {0} +}; + +static PyStructSequence_Desc statvfs_result_desc = { + "statvfs_result", /* name */ + statvfs_result__doc__, /* doc */ + statvfs_result_fields, + 10 +}; + +static int initialized; +static PyTypeObject StatResultType; +static PyTypeObject StatVFSResultType; +static newfunc structseq_new; + +static PyObject * +statresult_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PyStructSequence *result; + int i; + + result = (PyStructSequence*)structseq_new(type, args, kwds); + if (!result) + return NULL; + /* If we have been initialized from a tuple, + st_?time might be set to None. Initialize it + from the int slots. */ + for (i = 7; i <= 9; i++) { + if (result->ob_item[i+3] == Py_None) { + Py_DECREF(Py_None); + Py_INCREF(result->ob_item[i]); + result->ob_item[i+3] = result->ob_item[i]; + } + } + return (PyObject*)result; +} + + + +/* If true, st_?time is float. */ +static int _stat_float_times = 1; + +PyDoc_STRVAR(stat_float_times__doc__, +"stat_float_times([newval]) -> oldval\n\n\ +Determine whether os.[lf]stat represents time stamps as float objects.\n\ +If newval is True, future calls to stat() return floats, if it is False,\n\ +future calls return ints. \n\ +If newval is omitted, return the current setting.\n"); + +static PyObject* +stat_float_times(PyObject* self, PyObject *args) +{ + int newval = -1; + if (!PyArg_ParseTuple(args, "|i:stat_float_times", &newval)) + return NULL; + if (newval == -1) + /* Return old value */ + return PyBool_FromLong(_stat_float_times); + _stat_float_times = newval; + Py_INCREF(Py_None); + return Py_None; +} + +static void +fill_time(PyObject *v, int index, time_t sec, unsigned long nsec) +{ + PyObject *fval,*ival; +#if SIZEOF_TIME_T > SIZEOF_LONG + ival = PyLong_FromLongLong((PY_LONG_LONG)sec); +#else + ival = PyInt_FromLong((long)sec); +#endif + if (!ival) + return; + if (_stat_float_times) { + fval = PyFloat_FromDouble(sec + 1e-9*nsec); + } else { + fval = ival; + Py_INCREF(fval); + } + PyStructSequence_SET_ITEM(v, index, ival); + PyStructSequence_SET_ITEM(v, index+3, fval); +} + +/* pack a system stat C structure into the Python stat tuple + (used by posix_stat() and posix_fstat()) */ +static PyObject* +_pystat_fromstructstat(STRUCT_STAT *st) +{ + unsigned long ansec, mnsec, cnsec; + PyObject *v = PyStructSequence_New(&StatResultType); + if (v == NULL) + return NULL; + + PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long)st->st_mode)); +#ifdef HAVE_LARGEFILE_SUPPORT + PyStructSequence_SET_ITEM(v, 1, + PyLong_FromLongLong((PY_LONG_LONG)st->st_ino)); +#else + PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long)st->st_ino)); +#endif +#if defined(HAVE_LONG_LONG) && !defined(MS_WINDOWS) + PyStructSequence_SET_ITEM(v, 2, + PyLong_FromLongLong((PY_LONG_LONG)st->st_dev)); +#else + PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long)st->st_dev)); +#endif + PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long)st->st_nlink)); + PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long)st->st_uid)); + PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long)st->st_gid)); +#ifdef HAVE_LARGEFILE_SUPPORT + PyStructSequence_SET_ITEM(v, 6, + PyLong_FromLongLong((PY_LONG_LONG)st->st_size)); +#else + PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong(st->st_size)); +#endif + +#if defined(HAVE_STAT_TV_NSEC) + ansec = st->st_atim.tv_nsec; + mnsec = st->st_mtim.tv_nsec; + cnsec = st->st_ctim.tv_nsec; +#elif defined(HAVE_STAT_TV_NSEC2) + ansec = st->st_atimespec.tv_nsec; + mnsec = st->st_mtimespec.tv_nsec; + cnsec = st->st_ctimespec.tv_nsec; +#elif defined(HAVE_STAT_NSEC) + ansec = st->st_atime_nsec; + mnsec = st->st_mtime_nsec; + cnsec = st->st_ctime_nsec; +#else + ansec = mnsec = cnsec = 0; +#endif + fill_time(v, 7, st->st_atime, ansec); + fill_time(v, 8, st->st_mtime, mnsec); + fill_time(v, 9, st->st_ctime, cnsec); + +#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE + PyStructSequence_SET_ITEM(v, ST_BLKSIZE_IDX, + PyInt_FromLong((long)st->st_blksize)); +#endif +#ifdef HAVE_STRUCT_STAT_ST_BLOCKS + PyStructSequence_SET_ITEM(v, ST_BLOCKS_IDX, + PyInt_FromLong((long)st->st_blocks)); +#endif +#ifdef HAVE_STRUCT_STAT_ST_RDEV + PyStructSequence_SET_ITEM(v, ST_RDEV_IDX, + PyInt_FromLong((long)st->st_rdev)); +#endif +#ifdef HAVE_STRUCT_STAT_ST_GEN + PyStructSequence_SET_ITEM(v, ST_GEN_IDX, + PyInt_FromLong((long)st->st_gen)); +#endif +#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME + { + PyObject *val; + unsigned long bsec,bnsec; + bsec = (long)st->st_birthtime; +#ifdef HAVE_STAT_TV_NSEC2 + bnsec = st->st_birthtimespec.tv_nsec; +#else + bnsec = 0; +#endif + if (_stat_float_times) { + val = PyFloat_FromDouble(bsec + 1e-9*bnsec); + } else { + val = PyInt_FromLong((long)bsec); + } + PyStructSequence_SET_ITEM(v, ST_BIRTHTIME_IDX, + val); + } +#endif +#ifdef HAVE_STRUCT_STAT_ST_FLAGS + PyStructSequence_SET_ITEM(v, ST_FLAGS_IDX, + PyInt_FromLong((long)st->st_flags)); +#endif + + if (PyErr_Occurred()) { + Py_DECREF(v); + return NULL; + } + + return v; +} + +#ifdef MS_WINDOWS + +/* IsUNCRoot -- test whether the supplied path is of the form \\SERVER\SHARE\, + where / can be used in place of \ and the trailing slash is optional. + Both SERVER and SHARE must have at least one character. +*/ + +#define ISSLASHA(c) ((c) == '\\' || (c) == '/') +#define ISSLASHW(c) ((c) == L'\\' || (c) == L'/') +#ifndef ARRAYSIZE +#define ARRAYSIZE(a) (sizeof(a) / sizeof(a[0])) +#endif + +static BOOL +IsUNCRootA(char *path, int pathlen) +{ + #define ISSLASH ISSLASHA + + int i, share; + + if (pathlen < 5 || !ISSLASH(path[0]) || !ISSLASH(path[1])) + /* minimum UNCRoot is \\x\y */ + return FALSE; + for (i = 2; i < pathlen ; i++) + if (ISSLASH(path[i])) break; + if (i == 2 || i == pathlen) + /* do not allow \\\SHARE or \\SERVER */ + return FALSE; + share = i+1; + for (i = share; i < pathlen; i++) + if (ISSLASH(path[i])) break; + return (i != share && (i == pathlen || i == pathlen-1)); + + #undef ISSLASH +} + +static BOOL +IsUNCRootW(Py_UNICODE *path, int pathlen) +{ + #define ISSLASH ISSLASHW + + int i, share; + + if (pathlen < 5 || !ISSLASH(path[0]) || !ISSLASH(path[1])) + /* minimum UNCRoot is \\x\y */ + return FALSE; + for (i = 2; i < pathlen ; i++) + if (ISSLASH(path[i])) break; + if (i == 2 || i == pathlen) + /* do not allow \\\SHARE or \\SERVER */ + return FALSE; + share = i+1; + for (i = share; i < pathlen; i++) + if (ISSLASH(path[i])) break; + return (i != share && (i == pathlen || i == pathlen-1)); + + #undef ISSLASH +} +#endif /* MS_WINDOWS */ + +static PyObject * +posix_do_stat(PyObject *self, PyObject *args, + char *format, +#ifdef __VMS + int (*statfunc)(const char *, STRUCT_STAT *, ...), +#else + int (*statfunc)(const char *, STRUCT_STAT *), +#endif + char *wformat, + int (*wstatfunc)(const Py_UNICODE *, STRUCT_STAT *)) +{ + STRUCT_STAT st; + char *path = NULL; /* pass this to stat; do not free() it */ + char *pathfree = NULL; /* this memory must be free'd */ + int res; + PyObject *result; + +#ifdef MS_WINDOWS + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, wformat, &po)) { + Py_UNICODE *wpath = PyUnicode_AS_UNICODE(po); + + Py_BEGIN_ALLOW_THREADS + /* PyUnicode_AS_UNICODE result OK without + thread lock as it is a simple dereference. */ + res = wstatfunc(wpath, &st); + Py_END_ALLOW_THREADS + + if (res != 0) + return win32_error_unicode("stat", wpath); + return _pystat_fromstructstat(&st); + } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); +#endif + + if (!PyArg_ParseTuple(args, format, + Py_FileSystemDefaultEncoding, &path)) + return NULL; + pathfree = path; + + Py_BEGIN_ALLOW_THREADS + res = (*statfunc)(path, &st); + Py_END_ALLOW_THREADS + + if (res != 0) { +#ifdef MS_WINDOWS + result = win32_error("stat", pathfree); +#else + result = posix_error_with_filename(pathfree); +#endif + } + else + result = _pystat_fromstructstat(&st); + + PyMem_Free(pathfree); + return result; +} + +/* POSIX methods */ + +PyDoc_STRVAR(posix_access__doc__, +"access(path, mode) -> True if granted, False otherwise\n\n\ +Use the real uid/gid to test for access to a path. Note that most\n\ +operations will use the effective uid/gid, therefore this routine can\n\ +be used in a suid/sgid environment to test if the invoking user has the\n\ +specified access to the path. The mode argument can be F_OK to test\n\ +existence, or the inclusive-OR of R_OK, W_OK, and X_OK."); + +static PyObject * +posix_access(PyObject *self, PyObject *args) +{ + char *path; + int mode; + +#ifdef MS_WINDOWS + DWORD attr; + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, "Ui:access", &po, &mode)) { + Py_BEGIN_ALLOW_THREADS + /* PyUnicode_AS_UNICODE OK without thread lock as + it is a simple dereference. */ + attr = GetFileAttributesW(PyUnicode_AS_UNICODE(po)); + Py_END_ALLOW_THREADS + goto finish; + } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); + if (!PyArg_ParseTuple(args, "eti:access", + Py_FileSystemDefaultEncoding, &path, &mode)) + return NULL; + Py_BEGIN_ALLOW_THREADS + attr = GetFileAttributesA(path); + Py_END_ALLOW_THREADS + PyMem_Free(path); +finish: + if (attr == 0xFFFFFFFF) + /* File does not exist, or cannot read attributes */ + return PyBool_FromLong(0); + /* Access is possible if either write access wasn't requested, or + the file isn't read-only, or if it's a directory, as there are + no read-only directories on Windows. */ + return PyBool_FromLong(!(mode & 2) + || !(attr & FILE_ATTRIBUTE_READONLY) + || (attr & FILE_ATTRIBUTE_DIRECTORY)); +#else /* MS_WINDOWS */ + int res; + if (!PyArg_ParseTuple(args, "eti:access", + Py_FileSystemDefaultEncoding, &path, &mode)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = access(path, mode); + Py_END_ALLOW_THREADS + PyMem_Free(path); + return PyBool_FromLong(res == 0); +#endif /* MS_WINDOWS */ +} + +#ifndef F_OK +#define F_OK 0 +#endif +#ifndef R_OK +#define R_OK 4 +#endif +#ifndef W_OK +#define W_OK 2 +#endif +#ifndef X_OK +#define X_OK 1 +#endif + +#ifdef HAVE_TTYNAME +PyDoc_STRVAR(posix_ttyname__doc__, +"ttyname(fd) -> string\n\n\ +Return the name of the terminal device connected to 'fd'."); + +static PyObject * +posix_ttyname(PyObject *self, PyObject *args) +{ + int id; + char *ret; + + if (!PyArg_ParseTuple(args, "i:ttyname", &id)) + return NULL; + +#if defined(__VMS) + /* file descriptor 0 only, the default input device (stdin) */ + if (id == 0) { + ret = ttyname(); + } + else { + ret = NULL; + } +#else + ret = ttyname(id); +#endif + if (ret == NULL) + return posix_error(); + return PyString_FromString(ret); +} +#endif + +#ifdef HAVE_CTERMID +PyDoc_STRVAR(posix_ctermid__doc__, +"ctermid() -> string\n\n\ +Return the name of the controlling terminal for this process."); + +static PyObject * +posix_ctermid(PyObject *self, PyObject *noargs) +{ + char *ret; + char buffer[L_ctermid]; + +#ifdef USE_CTERMID_R + ret = ctermid_r(buffer); +#else + ret = ctermid(buffer); +#endif + if (ret == NULL) + return posix_error(); + return PyString_FromString(buffer); +} +#endif + +PyDoc_STRVAR(posix_chdir__doc__, +"chdir(path)\n\n\ +Change the current working directory to the specified path."); + +static PyObject * +posix_chdir(PyObject *self, PyObject *args) +{ +#ifdef MS_WINDOWS + return win32_1str(args, "chdir", "s:chdir", win32_chdir, "U:chdir", win32_wchdir); +#elif defined(PYOS_OS2) && defined(PYCC_GCC) + return posix_1str(args, "et:chdir", _chdir2); +#elif defined(__VMS) + return posix_1str(args, "et:chdir", (int (*)(const char *))chdir); +#else + return posix_1str(args, "et:chdir", chdir); +#endif +} + +#ifdef HAVE_FCHDIR +PyDoc_STRVAR(posix_fchdir__doc__, +"fchdir(fildes)\n\n\ +Change to the directory of the given file descriptor. fildes must be\n\ +opened on a directory, not a file."); + +static PyObject * +posix_fchdir(PyObject *self, PyObject *fdobj) +{ + return posix_fildes(fdobj, fchdir); +} +#endif /* HAVE_FCHDIR */ + + +PyDoc_STRVAR(posix_chmod__doc__, +"chmod(path, mode)\n\n\ +Change the access permissions of a file."); + +static PyObject * +posix_chmod(PyObject *self, PyObject *args) +{ + char *path = NULL; + int i; + int res; +#ifdef MS_WINDOWS + DWORD attr; + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, "Ui|:chmod", &po, &i)) { + Py_BEGIN_ALLOW_THREADS + attr = GetFileAttributesW(PyUnicode_AS_UNICODE(po)); + if (attr != 0xFFFFFFFF) { + if (i & _S_IWRITE) + attr &= ~FILE_ATTRIBUTE_READONLY; + else + attr |= FILE_ATTRIBUTE_READONLY; + res = SetFileAttributesW(PyUnicode_AS_UNICODE(po), attr); + } + else + res = 0; + Py_END_ALLOW_THREADS + if (!res) + return win32_error_unicode("chmod", + PyUnicode_AS_UNICODE(po)); + Py_INCREF(Py_None); + return Py_None; + } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); + + if (!PyArg_ParseTuple(args, "eti:chmod", Py_FileSystemDefaultEncoding, + &path, &i)) + return NULL; + Py_BEGIN_ALLOW_THREADS + attr = GetFileAttributesA(path); + if (attr != 0xFFFFFFFF) { + if (i & _S_IWRITE) + attr &= ~FILE_ATTRIBUTE_READONLY; + else + attr |= FILE_ATTRIBUTE_READONLY; + res = SetFileAttributesA(path, attr); + } + else + res = 0; + Py_END_ALLOW_THREADS + if (!res) { + win32_error("chmod", path); + PyMem_Free(path); + return NULL; + } + PyMem_Free(path); + Py_INCREF(Py_None); + return Py_None; +#else /* MS_WINDOWS */ + if (!PyArg_ParseTuple(args, "eti:chmod", Py_FileSystemDefaultEncoding, + &path, &i)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = chmod(path, i); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error_with_allocated_filename(path); + PyMem_Free(path); + Py_INCREF(Py_None); + return Py_None; +#endif +} + +#ifdef HAVE_FCHMOD +PyDoc_STRVAR(posix_fchmod__doc__, +"fchmod(fd, mode)\n\n\ +Change the access permissions of the file given by file\n\ +descriptor fd."); + +static PyObject * +posix_fchmod(PyObject *self, PyObject *args) +{ + int fd, mode, res; + if (!PyArg_ParseTuple(args, "ii:fchmod", &fd, &mode)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = fchmod(fd, mode); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error(); + Py_RETURN_NONE; +} +#endif /* HAVE_FCHMOD */ + +#ifdef HAVE_LCHMOD +PyDoc_STRVAR(posix_lchmod__doc__, +"lchmod(path, mode)\n\n\ +Change the access permissions of a file. If path is a symlink, this\n\ +affects the link itself rather than the target."); + +static PyObject * +posix_lchmod(PyObject *self, PyObject *args) +{ + char *path = NULL; + int i; + int res; + if (!PyArg_ParseTuple(args, "eti:lchmod", Py_FileSystemDefaultEncoding, + &path, &i)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = lchmod(path, i); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error_with_allocated_filename(path); + PyMem_Free(path); + Py_RETURN_NONE; +} +#endif /* HAVE_LCHMOD */ + + +#ifdef HAVE_CHFLAGS +PyDoc_STRVAR(posix_chflags__doc__, +"chflags(path, flags)\n\n\ +Set file flags."); + +static PyObject * +posix_chflags(PyObject *self, PyObject *args) +{ + char *path; + unsigned long flags; + int res; + if (!PyArg_ParseTuple(args, "etk:chflags", + Py_FileSystemDefaultEncoding, &path, &flags)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = chflags(path, flags); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error_with_allocated_filename(path); + PyMem_Free(path); + Py_INCREF(Py_None); + return Py_None; +} +#endif /* HAVE_CHFLAGS */ + +#ifdef HAVE_LCHFLAGS +PyDoc_STRVAR(posix_lchflags__doc__, +"lchflags(path, flags)\n\n\ +Set file flags.\n\ +This function will not follow symbolic links."); + +static PyObject * +posix_lchflags(PyObject *self, PyObject *args) +{ + char *path; + unsigned long flags; + int res; + if (!PyArg_ParseTuple(args, "etk:lchflags", + Py_FileSystemDefaultEncoding, &path, &flags)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = lchflags(path, flags); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error_with_allocated_filename(path); + PyMem_Free(path); + Py_INCREF(Py_None); + return Py_None; +} +#endif /* HAVE_LCHFLAGS */ + +#ifdef HAVE_CHROOT +PyDoc_STRVAR(posix_chroot__doc__, +"chroot(path)\n\n\ +Change root directory to path."); + +static PyObject * +posix_chroot(PyObject *self, PyObject *args) +{ + return posix_1str(args, "et:chroot", chroot); +} +#endif + +#ifdef HAVE_FSYNC +PyDoc_STRVAR(posix_fsync__doc__, +"fsync(fildes)\n\n\ +force write of file with filedescriptor to disk."); + +static PyObject * +posix_fsync(PyObject *self, PyObject *fdobj) +{ + return posix_fildes(fdobj, fsync); +} +#endif /* HAVE_FSYNC */ + +#ifdef HAVE_FDATASYNC + +#ifdef __hpux +extern int fdatasync(int); /* On HP-UX, in libc but not in unistd.h */ +#endif + +PyDoc_STRVAR(posix_fdatasync__doc__, +"fdatasync(fildes)\n\n\ +force write of file with filedescriptor to disk.\n\ + does not force update of metadata."); + +static PyObject * +posix_fdatasync(PyObject *self, PyObject *fdobj) +{ + return posix_fildes(fdobj, fdatasync); +} +#endif /* HAVE_FDATASYNC */ + + +#ifdef HAVE_CHOWN +PyDoc_STRVAR(posix_chown__doc__, +"chown(path, uid, gid)\n\n\ +Change the owner and group id of path to the numeric uid and gid."); + +static PyObject * +posix_chown(PyObject *self, PyObject *args) +{ + char *path = NULL; + long uid, gid; + int res; + if (!PyArg_ParseTuple(args, "etll:chown", + Py_FileSystemDefaultEncoding, &path, + &uid, &gid)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = chown(path, (uid_t) uid, (gid_t) gid); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error_with_allocated_filename(path); + PyMem_Free(path); + Py_INCREF(Py_None); + return Py_None; +} +#endif /* HAVE_CHOWN */ + +#ifdef HAVE_FCHOWN +PyDoc_STRVAR(posix_fchown__doc__, +"fchown(fd, uid, gid)\n\n\ +Change the owner and group id of the file given by file descriptor\n\ +fd to the numeric uid and gid."); + +static PyObject * +posix_fchown(PyObject *self, PyObject *args) +{ + int fd; + long uid, gid; + int res; + if (!PyArg_ParseTuple(args, "ill:chown", &fd, &uid, &gid)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = fchown(fd, (uid_t) uid, (gid_t) gid); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error(); + Py_RETURN_NONE; +} +#endif /* HAVE_FCHOWN */ + +#ifdef HAVE_LCHOWN +PyDoc_STRVAR(posix_lchown__doc__, +"lchown(path, uid, gid)\n\n\ +Change the owner and group id of path to the numeric uid and gid.\n\ +This function will not follow symbolic links."); + +static PyObject * +posix_lchown(PyObject *self, PyObject *args) +{ + char *path = NULL; + long uid, gid; + int res; + if (!PyArg_ParseTuple(args, "etll:lchown", + Py_FileSystemDefaultEncoding, &path, + &uid, &gid)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = lchown(path, (uid_t) uid, (gid_t) gid); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error_with_allocated_filename(path); + PyMem_Free(path); + Py_INCREF(Py_None); + return Py_None; +} +#endif /* HAVE_LCHOWN */ + + +#ifdef HAVE_GETCWD +PyDoc_STRVAR(posix_getcwd__doc__, +"getcwd() -> path\n\n\ +Return a string representing the current working directory."); + +#if (defined(__sun) && defined(__SVR4)) || defined(__OpenBSD__) +/* Issue 9185: getcwd() returns NULL/ERANGE indefinitely. */ +static PyObject * +posix_getcwd(PyObject *self, PyObject *noargs) +{ + char buf[PATH_MAX+2]; + char *res; + + Py_BEGIN_ALLOW_THREADS + res = getcwd(buf, sizeof buf); + Py_END_ALLOW_THREADS + + if (res == NULL) + return posix_error(); + + return PyString_FromString(buf); +} +#else +static PyObject * +posix_getcwd(PyObject *self, PyObject *noargs) +{ + int bufsize_incr = 1024; + int bufsize = 0; + char *tmpbuf = NULL; + char *res = NULL; + PyObject *dynamic_return; + + Py_BEGIN_ALLOW_THREADS + do { + bufsize = bufsize + bufsize_incr; + tmpbuf = malloc(bufsize); + if (tmpbuf == NULL) { + break; + } +#if defined(PYOS_OS2) && defined(PYCC_GCC) + res = _getcwd2(tmpbuf, bufsize); +#else + res = getcwd(tmpbuf, bufsize); +#endif + + if (res == NULL) { + free(tmpbuf); + } + } while ((res == NULL) && (errno == ERANGE)); + Py_END_ALLOW_THREADS + + if (res == NULL) + return posix_error(); + + dynamic_return = PyString_FromString(tmpbuf); + free(tmpbuf); + + return dynamic_return; +} +#endif /* getcwd() NULL/ERANGE workaround. */ + +#ifdef Py_USING_UNICODE +PyDoc_STRVAR(posix_getcwdu__doc__, +"getcwdu() -> path\n\n\ +Return a unicode string representing the current working directory."); + +static PyObject * +posix_getcwdu(PyObject *self, PyObject *noargs) +{ + char buf[1026]; + char *res; + +#ifdef MS_WINDOWS + DWORD len; + wchar_t wbuf[1026]; + wchar_t *wbuf2 = wbuf; + PyObject *resobj; + Py_BEGIN_ALLOW_THREADS + len = GetCurrentDirectoryW(sizeof wbuf/ sizeof wbuf[0], wbuf); + /* If the buffer is large enough, len does not include the + terminating \0. If the buffer is too small, len includes + the space needed for the terminator. */ + if (len >= sizeof wbuf/ sizeof wbuf[0]) { + wbuf2 = malloc(len * sizeof(wchar_t)); + if (wbuf2) + len = GetCurrentDirectoryW(len, wbuf2); + } + Py_END_ALLOW_THREADS + if (!wbuf2) { + PyErr_NoMemory(); + return NULL; + } + if (!len) { + if (wbuf2 != wbuf) free(wbuf2); + return win32_error("getcwdu", NULL); + } + resobj = PyUnicode_FromWideChar(wbuf2, len); + if (wbuf2 != wbuf) free(wbuf2); + return resobj; +#endif /* MS_WINDOWS */ + + Py_BEGIN_ALLOW_THREADS +#if defined(PYOS_OS2) && defined(PYCC_GCC) + res = _getcwd2(buf, sizeof buf); +#else + res = getcwd(buf, sizeof buf); +#endif + Py_END_ALLOW_THREADS + if (res == NULL) + return posix_error(); + return PyUnicode_Decode(buf, strlen(buf), Py_FileSystemDefaultEncoding,"strict"); +} +#endif /* Py_USING_UNICODE */ +#endif /* HAVE_GETCWD */ + + +#ifdef HAVE_LINK +PyDoc_STRVAR(posix_link__doc__, +"link(src, dst)\n\n\ +Create a hard link to a file."); + +static PyObject * +posix_link(PyObject *self, PyObject *args) +{ + return posix_2str(args, "etet:link", link); +} +#endif /* HAVE_LINK */ + + +PyDoc_STRVAR(posix_listdir__doc__, +"listdir(path) -> list_of_strings\n\n\ +Return a list containing the names of the entries in the directory.\n\ +\n\ + path: path of directory to list\n\ +\n\ +The list is in arbitrary order. It does not include the special\n\ +entries '.' and '..' even if they are present in the directory."); + +static PyObject * +posix_listdir(PyObject *self, PyObject *args) +{ + /* XXX Should redo this putting the (now four) versions of opendir + in separate files instead of having them all here... */ +#if defined(MS_WINDOWS) && !defined(HAVE_OPENDIR) + + PyObject *d, *v; + HANDLE hFindFile; + BOOL result; + WIN32_FIND_DATA FileData; + char namebuf[MAX_PATH+5]; /* Overallocate for \\*.*\0 */ + char *bufptr = namebuf; + Py_ssize_t len = sizeof(namebuf)-5; /* only claim to have space for MAX_PATH */ + + PyObject *po; + if (PyArg_ParseTuple(args, "U:listdir", &po)) { + WIN32_FIND_DATAW wFileData; + Py_UNICODE *wnamebuf; + /* Overallocate for \\*.*\0 */ + len = PyUnicode_GET_SIZE(po); + wnamebuf = malloc((len + 5) * sizeof(wchar_t)); + if (!wnamebuf) { + PyErr_NoMemory(); + return NULL; + } + wcscpy(wnamebuf, PyUnicode_AS_UNICODE(po)); + if (len > 0) { + Py_UNICODE wch = wnamebuf[len-1]; + if (wch != L'/' && wch != L'\\' && wch != L':') + wnamebuf[len++] = L'\\'; + wcscpy(wnamebuf + len, L"*.*"); + } + if ((d = PyList_New(0)) == NULL) { + free(wnamebuf); + return NULL; + } + Py_BEGIN_ALLOW_THREADS + hFindFile = FindFirstFileW(wnamebuf, &wFileData); + Py_END_ALLOW_THREADS + if (hFindFile == INVALID_HANDLE_VALUE) { + int error = GetLastError(); + if (error == ERROR_FILE_NOT_FOUND) { + free(wnamebuf); + return d; + } + Py_DECREF(d); + win32_error_unicode("FindFirstFileW", wnamebuf); + free(wnamebuf); + return NULL; + } + do { + /* Skip over . and .. */ + if (wcscmp(wFileData.cFileName, L".") != 0 && + wcscmp(wFileData.cFileName, L"..") != 0) { + v = PyUnicode_FromUnicode(wFileData.cFileName, wcslen(wFileData.cFileName)); + if (v == NULL) { + Py_DECREF(d); + d = NULL; + break; + } + if (PyList_Append(d, v) != 0) { + Py_DECREF(v); + Py_DECREF(d); + d = NULL; + break; + } + Py_DECREF(v); + } + Py_BEGIN_ALLOW_THREADS + result = FindNextFileW(hFindFile, &wFileData); + Py_END_ALLOW_THREADS + /* FindNextFile sets error to ERROR_NO_MORE_FILES if + it got to the end of the directory. */ + if (!result && GetLastError() != ERROR_NO_MORE_FILES) { + Py_DECREF(d); + win32_error_unicode("FindNextFileW", wnamebuf); + FindClose(hFindFile); + free(wnamebuf); + return NULL; + } + } while (result == TRUE); + + if (FindClose(hFindFile) == FALSE) { + Py_DECREF(d); + win32_error_unicode("FindClose", wnamebuf); + free(wnamebuf); + return NULL; + } + free(wnamebuf); + return d; + } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); + + if (!PyArg_ParseTuple(args, "et#:listdir", + Py_FileSystemDefaultEncoding, &bufptr, &len)) + return NULL; + if (len > 0) { + char ch = namebuf[len-1]; + if (ch != SEP && ch != ALTSEP && ch != ':') + namebuf[len++] = '/'; + strcpy(namebuf + len, "*.*"); + } + + if ((d = PyList_New(0)) == NULL) + return NULL; + + Py_BEGIN_ALLOW_THREADS + hFindFile = FindFirstFile(namebuf, &FileData); + Py_END_ALLOW_THREADS + if (hFindFile == INVALID_HANDLE_VALUE) { + int error = GetLastError(); + if (error == ERROR_FILE_NOT_FOUND) + return d; + Py_DECREF(d); + return win32_error("FindFirstFile", namebuf); + } + do { + /* Skip over . and .. */ + if (strcmp(FileData.cFileName, ".") != 0 && + strcmp(FileData.cFileName, "..") != 0) { + v = PyString_FromString(FileData.cFileName); + if (v == NULL) { + Py_DECREF(d); + d = NULL; + break; + } + if (PyList_Append(d, v) != 0) { + Py_DECREF(v); + Py_DECREF(d); + d = NULL; + break; + } + Py_DECREF(v); + } + Py_BEGIN_ALLOW_THREADS + result = FindNextFile(hFindFile, &FileData); + Py_END_ALLOW_THREADS + /* FindNextFile sets error to ERROR_NO_MORE_FILES if + it got to the end of the directory. */ + if (!result && GetLastError() != ERROR_NO_MORE_FILES) { + Py_DECREF(d); + win32_error("FindNextFile", namebuf); + FindClose(hFindFile); + return NULL; + } + } while (result == TRUE); + + if (FindClose(hFindFile) == FALSE) { + Py_DECREF(d); + return win32_error("FindClose", namebuf); + } + + return d; + +#elif defined(PYOS_OS2) + +#ifndef MAX_PATH +#define MAX_PATH CCHMAXPATH +#endif + char *name, *pt; + Py_ssize_t len; + PyObject *d, *v; + char namebuf[MAX_PATH+5]; + HDIR hdir = 1; + ULONG srchcnt = 1; + FILEFINDBUF3 ep; + APIRET rc; + + if (!PyArg_ParseTuple(args, "t#:listdir", &name, &len)) + return NULL; + if (len >= MAX_PATH) { + PyErr_SetString(PyExc_ValueError, "path too long"); + return NULL; + } + strcpy(namebuf, name); + for (pt = namebuf; *pt; pt++) + if (*pt == ALTSEP) + *pt = SEP; + if (namebuf[len-1] != SEP) + namebuf[len++] = SEP; + strcpy(namebuf + len, "*.*"); + + if ((d = PyList_New(0)) == NULL) + return NULL; + + rc = DosFindFirst(namebuf, /* Wildcard Pattern to Match */ + &hdir, /* Handle to Use While Search Directory */ + FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY, + &ep, sizeof(ep), /* Structure to Receive Directory Entry */ + &srchcnt, /* Max and Actual Count of Entries Per Iteration */ + FIL_STANDARD); /* Format of Entry (EAs or Not) */ + + if (rc != NO_ERROR) { + errno = ENOENT; + return posix_error_with_filename(name); + } + + if (srchcnt > 0) { /* If Directory is NOT Totally Empty, */ + do { + if (ep.achName[0] == '.' + && (ep.achName[1] == '\0' || (ep.achName[1] == '.' && ep.achName[2] == '\0'))) + continue; /* Skip Over "." and ".." Names */ + + strcpy(namebuf, ep.achName); + + /* Leave Case of Name Alone -- In Native Form */ + /* (Removed Forced Lowercasing Code) */ + + v = PyString_FromString(namebuf); + if (v == NULL) { + Py_DECREF(d); + d = NULL; + break; + } + if (PyList_Append(d, v) != 0) { + Py_DECREF(v); + Py_DECREF(d); + d = NULL; + break; + } + Py_DECREF(v); + } while (DosFindNext(hdir, &ep, sizeof(ep), &srchcnt) == NO_ERROR && srchcnt > 0); + } + + return d; +#else + + char *name = NULL; + PyObject *d, *v; + DIR *dirp; + struct dirent *ep; + int arg_is_unicode = 1; + + errno = 0; + if (!PyArg_ParseTuple(args, "U:listdir", &v)) { + arg_is_unicode = 0; + PyErr_Clear(); + } + if (!PyArg_ParseTuple(args, "et:listdir", Py_FileSystemDefaultEncoding, &name)) + return NULL; + Py_BEGIN_ALLOW_THREADS + dirp = opendir(name); + Py_END_ALLOW_THREADS + if (dirp == NULL) { + return posix_error_with_allocated_filename(name); + } + if ((d = PyList_New(0)) == NULL) { + Py_BEGIN_ALLOW_THREADS + closedir(dirp); + Py_END_ALLOW_THREADS + PyMem_Free(name); + return NULL; + } + for (;;) { + errno = 0; + Py_BEGIN_ALLOW_THREADS + ep = readdir(dirp); + Py_END_ALLOW_THREADS + if (ep == NULL) { + if (errno == 0) { + break; + } else { + Py_BEGIN_ALLOW_THREADS + closedir(dirp); + Py_END_ALLOW_THREADS + Py_DECREF(d); + return posix_error_with_allocated_filename(name); + } + } + if (ep->d_name[0] == '.' && + (NAMLEN(ep) == 1 || + (ep->d_name[1] == '.' && NAMLEN(ep) == 2))) + continue; + v = PyString_FromStringAndSize(ep->d_name, NAMLEN(ep)); + if (v == NULL) { + Py_DECREF(d); + d = NULL; + break; + } +#ifdef Py_USING_UNICODE + if (arg_is_unicode) { + PyObject *w; + + w = PyUnicode_FromEncodedObject(v, + Py_FileSystemDefaultEncoding, + "strict"); + if (w != NULL) { + Py_DECREF(v); + v = w; + } + else { + /* fall back to the original byte string, as + discussed in patch #683592 */ + PyErr_Clear(); + } + } +#endif + if (PyList_Append(d, v) != 0) { + Py_DECREF(v); + Py_DECREF(d); + d = NULL; + break; + } + Py_DECREF(v); + } + Py_BEGIN_ALLOW_THREADS + closedir(dirp); + Py_END_ALLOW_THREADS + PyMem_Free(name); + + return d; + +#endif /* which OS */ +} /* end of posix_listdir */ + +#ifdef MS_WINDOWS +/* A helper function for abspath on win32 */ +static PyObject * +posix__getfullpathname(PyObject *self, PyObject *args) +{ + /* assume encoded strings won't more than double no of chars */ + char inbuf[MAX_PATH*2]; + char *inbufp = inbuf; + Py_ssize_t insize = sizeof(inbuf); + char outbuf[MAX_PATH*2]; + char *temp; + + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, "U|:_getfullpathname", &po)) { + Py_UNICODE *wpath = PyUnicode_AS_UNICODE(po); + Py_UNICODE woutbuf[MAX_PATH*2], *woutbufp = woutbuf; + Py_UNICODE *wtemp; + DWORD result; + PyObject *v; + result = GetFullPathNameW(wpath, + sizeof(woutbuf)/sizeof(woutbuf[0]), + woutbuf, &wtemp); + if (result > sizeof(woutbuf)/sizeof(woutbuf[0])) { + woutbufp = malloc(result * sizeof(Py_UNICODE)); + if (!woutbufp) + return PyErr_NoMemory(); + result = GetFullPathNameW(wpath, result, woutbufp, &wtemp); + } + if (result) + v = PyUnicode_FromUnicode(woutbufp, wcslen(woutbufp)); + else + v = win32_error_unicode("GetFullPathNameW", wpath); + if (woutbufp != woutbuf) + free(woutbufp); + return v; + } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); + + if (!PyArg_ParseTuple (args, "et#:_getfullpathname", + Py_FileSystemDefaultEncoding, &inbufp, + &insize)) + return NULL; + if (!GetFullPathName(inbuf, sizeof(outbuf)/sizeof(outbuf[0]), + outbuf, &temp)) + return win32_error("GetFullPathName", inbuf); + if (PyUnicode_Check(PyTuple_GetItem(args, 0))) { + return PyUnicode_Decode(outbuf, strlen(outbuf), + Py_FileSystemDefaultEncoding, NULL); + } + return PyString_FromString(outbuf); +} /* end of posix__getfullpathname */ +#endif /* MS_WINDOWS */ + +PyDoc_STRVAR(posix_mkdir__doc__, +"mkdir(path [, mode=0777])\n\n\ +Create a directory."); + +static PyObject * +posix_mkdir(PyObject *self, PyObject *args) +{ + int res; + char *path = NULL; + int mode = 0777; + +#ifdef MS_WINDOWS + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, "U|i:mkdir", &po, &mode)) { + Py_BEGIN_ALLOW_THREADS + /* PyUnicode_AS_UNICODE OK without thread lock as + it is a simple dereference. */ + res = CreateDirectoryW(PyUnicode_AS_UNICODE(po), NULL); + Py_END_ALLOW_THREADS + if (!res) + return win32_error_unicode("mkdir", PyUnicode_AS_UNICODE(po)); + Py_INCREF(Py_None); + return Py_None; + } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); + if (!PyArg_ParseTuple(args, "et|i:mkdir", + Py_FileSystemDefaultEncoding, &path, &mode)) + return NULL; + Py_BEGIN_ALLOW_THREADS + /* PyUnicode_AS_UNICODE OK without thread lock as + it is a simple dereference. */ + res = CreateDirectoryA(path, NULL); + Py_END_ALLOW_THREADS + if (!res) { + win32_error("mkdir", path); + PyMem_Free(path); + return NULL; + } + PyMem_Free(path); + Py_INCREF(Py_None); + return Py_None; +#else /* MS_WINDOWS */ + + if (!PyArg_ParseTuple(args, "et|i:mkdir", + Py_FileSystemDefaultEncoding, &path, &mode)) + return NULL; + Py_BEGIN_ALLOW_THREADS +#if ( defined(__WATCOMC__) || defined(PYCC_VACPP) ) && !defined(__QNX__) + res = mkdir(path); +#else + res = mkdir(path, mode); +#endif + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error_with_allocated_filename(path); + PyMem_Free(path); + Py_INCREF(Py_None); + return Py_None; +#endif /* MS_WINDOWS */ +} + + +/* sys/resource.h is needed for at least: wait3(), wait4(), broken nice. */ +#if defined(HAVE_SYS_RESOURCE_H) +#include <sys/resource.h> +#endif + + +#ifdef HAVE_NICE +PyDoc_STRVAR(posix_nice__doc__, +"nice(inc) -> new_priority\n\n\ +Decrease the priority of process by inc and return the new priority."); + +static PyObject * +posix_nice(PyObject *self, PyObject *args) +{ + int increment, value; + + if (!PyArg_ParseTuple(args, "i:nice", &increment)) + return NULL; + + /* There are two flavours of 'nice': one that returns the new + priority (as required by almost all standards out there) and the + Linux/FreeBSD/BSDI one, which returns '0' on success and advices + the use of getpriority() to get the new priority. + + If we are of the nice family that returns the new priority, we + need to clear errno before the call, and check if errno is filled + before calling posix_error() on a returnvalue of -1, because the + -1 may be the actual new priority! */ + + errno = 0; + value = nice(increment); +#if defined(HAVE_BROKEN_NICE) && defined(HAVE_GETPRIORITY) + if (value == 0) + value = getpriority(PRIO_PROCESS, 0); +#endif + if (value == -1 && errno != 0) + /* either nice() or getpriority() returned an error */ + return posix_error(); + return PyInt_FromLong((long) value); +} +#endif /* HAVE_NICE */ + +PyDoc_STRVAR(posix_rename__doc__, +"rename(old, new)\n\n\ +Rename a file or directory."); + +static PyObject * +posix_rename(PyObject *self, PyObject *args) +{ +#ifdef MS_WINDOWS + PyObject *o1, *o2; + char *p1, *p2; + BOOL result; + if (!PyArg_ParseTuple(args, "OO:rename", &o1, &o2)) + goto error; + if (!convert_to_unicode(&o1)) + goto error; + if (!convert_to_unicode(&o2)) { + Py_DECREF(o1); + goto error; + } + Py_BEGIN_ALLOW_THREADS + result = MoveFileW(PyUnicode_AsUnicode(o1), + PyUnicode_AsUnicode(o2)); + Py_END_ALLOW_THREADS + Py_DECREF(o1); + Py_DECREF(o2); + if (!result) + return win32_error("rename", NULL); + Py_INCREF(Py_None); + return Py_None; +error: + PyErr_Clear(); + if (!PyArg_ParseTuple(args, "ss:rename", &p1, &p2)) + return NULL; + Py_BEGIN_ALLOW_THREADS + result = MoveFileA(p1, p2); + Py_END_ALLOW_THREADS + if (!result) + return win32_error("rename", NULL); + Py_INCREF(Py_None); + return Py_None; +#else + return posix_2str(args, "etet:rename", rename); +#endif +} + + +PyDoc_STRVAR(posix_rmdir__doc__, +"rmdir(path)\n\n\ +Remove a directory."); + +static PyObject * +posix_rmdir(PyObject *self, PyObject *args) +{ +#ifdef MS_WINDOWS + return win32_1str(args, "rmdir", "s:rmdir", RemoveDirectoryA, "U:rmdir", RemoveDirectoryW); +#else + return posix_1str(args, "et:rmdir", rmdir); +#endif +} + + +PyDoc_STRVAR(posix_stat__doc__, +"stat(path) -> stat result\n\n\ +Perform a stat system call on the given path."); + +static PyObject * +posix_stat(PyObject *self, PyObject *args) +{ +#ifdef MS_WINDOWS + return posix_do_stat(self, args, "et:stat", STAT, "U:stat", win32_wstat); +#else + return posix_do_stat(self, args, "et:stat", STAT, NULL, NULL); +#endif +} + + +#ifdef HAVE_SYSTEM +PyDoc_STRVAR(posix_system__doc__, +"system(command) -> exit_status\n\n\ +Execute the command (a string) in a subshell."); + +static PyObject * +posix_system(PyObject *self, PyObject *args) +{ + char *command; + long sts; + if (!PyArg_ParseTuple(args, "s:system", &command)) + return NULL; + Py_BEGIN_ALLOW_THREADS + sts = system(command); + Py_END_ALLOW_THREADS + return PyInt_FromLong(sts); +} +#endif + + +PyDoc_STRVAR(posix_umask__doc__, +"umask(new_mask) -> old_mask\n\n\ +Set the current numeric umask and return the previous umask."); + +static PyObject * +posix_umask(PyObject *self, PyObject *args) +{ + int i; + if (!PyArg_ParseTuple(args, "i:umask", &i)) + return NULL; + i = (int)umask(i); + if (i < 0) + return posix_error(); + return PyInt_FromLong((long)i); +} + + +PyDoc_STRVAR(posix_unlink__doc__, +"unlink(path)\n\n\ +Remove a file (same as remove(path))."); + +PyDoc_STRVAR(posix_remove__doc__, +"remove(path)\n\n\ +Remove a file (same as unlink(path))."); + +static PyObject * +posix_unlink(PyObject *self, PyObject *args) +{ +#ifdef MS_WINDOWS + return win32_1str(args, "remove", "s:remove", DeleteFileA, "U:remove", DeleteFileW); +#else + return posix_1str(args, "et:remove", unlink); +#endif +} + + +#ifdef HAVE_UNAME +PyDoc_STRVAR(posix_uname__doc__, +"uname() -> (sysname, nodename, release, version, machine)\n\n\ +Return a tuple identifying the current operating system."); + +static PyObject * +posix_uname(PyObject *self, PyObject *noargs) +{ + struct utsname u; + int res; + + Py_BEGIN_ALLOW_THREADS + res = uname(&u); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error(); + return Py_BuildValue("(sssss)", + u.sysname, + u.nodename, + u.release, + u.version, + u.machine); +} +#endif /* HAVE_UNAME */ + +static int +extract_time(PyObject *t, long* sec, long* usec) +{ + long intval; + if (PyFloat_Check(t)) { + double tval = PyFloat_AsDouble(t); + PyObject *intobj = Py_TYPE(t)->tp_as_number->nb_int(t); + if (!intobj) + return -1; + intval = PyInt_AsLong(intobj); + Py_DECREF(intobj); + if (intval == -1 && PyErr_Occurred()) + return -1; + *sec = intval; + *usec = (long)((tval - intval) * 1e6); /* can't exceed 1000000 */ + if (*usec < 0) + /* If rounding gave us a negative number, + truncate. */ + *usec = 0; + return 0; + } + intval = PyInt_AsLong(t); + if (intval == -1 && PyErr_Occurred()) + return -1; + *sec = intval; + *usec = 0; + return 0; +} + +PyDoc_STRVAR(posix_utime__doc__, +"utime(path, (atime, mtime))\n\ +utime(path, None)\n\n\ +Set the access and modified time of the file to the given values. If the\n\ +second form is used, set the access and modified times to the current time."); + +static PyObject * +posix_utime(PyObject *self, PyObject *args) +{ +#ifdef MS_WINDOWS + PyObject *arg; + PyUnicodeObject *obwpath; + wchar_t *wpath = NULL; + char *apath = NULL; + HANDLE hFile; + long atimesec, mtimesec, ausec, musec; + FILETIME atime, mtime; + PyObject *result = NULL; + + if (PyArg_ParseTuple(args, "UO|:utime", &obwpath, &arg)) { + wpath = PyUnicode_AS_UNICODE(obwpath); + Py_BEGIN_ALLOW_THREADS + hFile = CreateFileW(wpath, FILE_WRITE_ATTRIBUTES, 0, + NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, NULL); + Py_END_ALLOW_THREADS + if (hFile == INVALID_HANDLE_VALUE) + return win32_error_unicode("utime", wpath); + } else + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); + + if (!wpath) { + if (!PyArg_ParseTuple(args, "etO:utime", + Py_FileSystemDefaultEncoding, &apath, &arg)) + return NULL; + Py_BEGIN_ALLOW_THREADS + hFile = CreateFileA(apath, FILE_WRITE_ATTRIBUTES, 0, + NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, NULL); + Py_END_ALLOW_THREADS + if (hFile == INVALID_HANDLE_VALUE) { + win32_error("utime", apath); + PyMem_Free(apath); + return NULL; + } + PyMem_Free(apath); + } + + if (arg == Py_None) { + SYSTEMTIME now; + GetSystemTime(&now); + if (!SystemTimeToFileTime(&now, &mtime) || + !SystemTimeToFileTime(&now, &atime)) { + win32_error("utime", NULL); + goto done; + } + } + else if (!PyTuple_Check(arg) || PyTuple_Size(arg) != 2) { + PyErr_SetString(PyExc_TypeError, + "utime() arg 2 must be a tuple (atime, mtime)"); + goto done; + } + else { + if (extract_time(PyTuple_GET_ITEM(arg, 0), + &atimesec, &ausec) == -1) + goto done; + time_t_to_FILE_TIME(atimesec, 1000*ausec, &atime); + if (extract_time(PyTuple_GET_ITEM(arg, 1), + &mtimesec, &musec) == -1) + goto done; + time_t_to_FILE_TIME(mtimesec, 1000*musec, &mtime); + } + if (!SetFileTime(hFile, NULL, &atime, &mtime)) { + /* Avoid putting the file name into the error here, + as that may confuse the user into believing that + something is wrong with the file, when it also + could be the time stamp that gives a problem. */ + win32_error("utime", NULL); + } + Py_INCREF(Py_None); + result = Py_None; +done: + CloseHandle(hFile); + return result; +#else /* MS_WINDOWS */ + + char *path = NULL; + long atime, mtime, ausec, musec; + int res; + PyObject* arg; + +#if defined(HAVE_UTIMES) + struct timeval buf[2]; +#define ATIME buf[0].tv_sec +#define MTIME buf[1].tv_sec +#elif defined(HAVE_UTIME_H) +/* XXX should define struct utimbuf instead, above */ + struct utimbuf buf; +#define ATIME buf.actime +#define MTIME buf.modtime +#define UTIME_ARG &buf +#else /* HAVE_UTIMES */ + time_t buf[2]; +#define ATIME buf[0] +#define MTIME buf[1] +#define UTIME_ARG buf +#endif /* HAVE_UTIMES */ + + + if (!PyArg_ParseTuple(args, "etO:utime", + Py_FileSystemDefaultEncoding, &path, &arg)) + return NULL; + if (arg == Py_None) { + /* optional time values not given */ + Py_BEGIN_ALLOW_THREADS + res = utime(path, NULL); + Py_END_ALLOW_THREADS + } + else if (!PyTuple_Check(arg) || PyTuple_Size(arg) != 2) { + PyErr_SetString(PyExc_TypeError, + "utime() arg 2 must be a tuple (atime, mtime)"); + PyMem_Free(path); + return NULL; + } + else { + if (extract_time(PyTuple_GET_ITEM(arg, 0), + &atime, &ausec) == -1) { + PyMem_Free(path); + return NULL; + } + if (extract_time(PyTuple_GET_ITEM(arg, 1), + &mtime, &musec) == -1) { + PyMem_Free(path); + return NULL; + } + ATIME = atime; + MTIME = mtime; +#ifdef HAVE_UTIMES + buf[0].tv_usec = ausec; + buf[1].tv_usec = musec; + Py_BEGIN_ALLOW_THREADS + res = utimes(path, buf); + Py_END_ALLOW_THREADS +#else + Py_BEGIN_ALLOW_THREADS + res = utime(path, UTIME_ARG); + Py_END_ALLOW_THREADS +#endif /* HAVE_UTIMES */ + } + if (res < 0) { + return posix_error_with_allocated_filename(path); + } + PyMem_Free(path); + Py_INCREF(Py_None); + return Py_None; +#undef UTIME_ARG +#undef ATIME +#undef MTIME +#endif /* MS_WINDOWS */ +} + + +/* Process operations */ + +PyDoc_STRVAR(posix__exit__doc__, +"_exit(status)\n\n\ +Exit to the system with specified status, without normal exit processing."); + +static PyObject * +posix__exit(PyObject *self, PyObject *args) +{ + int sts; + if (!PyArg_ParseTuple(args, "i:_exit", &sts)) + return NULL; + _exit(sts); + return NULL; /* Make gcc -Wall happy */ +} + +#if defined(HAVE_EXECV) || defined(HAVE_SPAWNV) +static void +free_string_array(char **array, Py_ssize_t count) +{ + Py_ssize_t i; + for (i = 0; i < count; i++) + PyMem_Free(array[i]); + PyMem_DEL(array); +} +#endif + + +#ifdef HAVE_EXECV +PyDoc_STRVAR(posix_execv__doc__, +"execv(path, args)\n\n\ +Execute an executable path with arguments, replacing current process.\n\ +\n\ + path: path of executable file\n\ + args: tuple or list of strings"); + +static PyObject * +posix_execv(PyObject *self, PyObject *args) +{ + char *path; + PyObject *argv; + char **argvlist; + Py_ssize_t i, argc; + PyObject *(*getitem)(PyObject *, Py_ssize_t); + + /* execv has two arguments: (path, argv), where + argv is a list or tuple of strings. */ + + if (!PyArg_ParseTuple(args, "etO:execv", + Py_FileSystemDefaultEncoding, + &path, &argv)) + return NULL; + if (PyList_Check(argv)) { + argc = PyList_Size(argv); + getitem = PyList_GetItem; + } + else if (PyTuple_Check(argv)) { + argc = PyTuple_Size(argv); + getitem = PyTuple_GetItem; + } + else { + PyErr_SetString(PyExc_TypeError, "execv() arg 2 must be a tuple or list"); + PyMem_Free(path); + return NULL; + } + if (argc < 1) { + PyErr_SetString(PyExc_ValueError, "execv() arg 2 must not be empty"); + PyMem_Free(path); + return NULL; + } + + argvlist = PyMem_NEW(char *, argc+1); + if (argvlist == NULL) { + PyMem_Free(path); + return PyErr_NoMemory(); + } + for (i = 0; i < argc; i++) { + if (!PyArg_Parse((*getitem)(argv, i), "et", + Py_FileSystemDefaultEncoding, + &argvlist[i])) { + free_string_array(argvlist, i); + PyErr_SetString(PyExc_TypeError, + "execv() arg 2 must contain only strings"); + PyMem_Free(path); + return NULL; + + } + } + argvlist[argc] = NULL; + + execv(path, argvlist); + + /* If we get here it's definitely an error */ + + free_string_array(argvlist, argc); + PyMem_Free(path); + return posix_error(); +} + + +PyDoc_STRVAR(posix_execve__doc__, +"execve(path, args, env)\n\n\ +Execute a path with arguments and environment, replacing current process.\n\ +\n\ + path: path of executable file\n\ + args: tuple or list of arguments\n\ + env: dictionary of strings mapping to strings"); + +static PyObject * +posix_execve(PyObject *self, PyObject *args) +{ + char *path; + PyObject *argv, *env; + char **argvlist; + char **envlist; + PyObject *key, *val, *keys=NULL, *vals=NULL; + Py_ssize_t i, pos, argc, envc; + PyObject *(*getitem)(PyObject *, Py_ssize_t); + Py_ssize_t lastarg = 0; + + /* execve has three arguments: (path, argv, env), where + argv is a list or tuple of strings and env is a dictionary + like posix.environ. */ + + if (!PyArg_ParseTuple(args, "etOO:execve", + Py_FileSystemDefaultEncoding, + &path, &argv, &env)) + return NULL; + if (PyList_Check(argv)) { + argc = PyList_Size(argv); + getitem = PyList_GetItem; + } + else if (PyTuple_Check(argv)) { + argc = PyTuple_Size(argv); + getitem = PyTuple_GetItem; + } + else { + PyErr_SetString(PyExc_TypeError, + "execve() arg 2 must be a tuple or list"); + goto fail_0; + } + if (!PyMapping_Check(env)) { + PyErr_SetString(PyExc_TypeError, + "execve() arg 3 must be a mapping object"); + goto fail_0; + } + + argvlist = PyMem_NEW(char *, argc+1); + if (argvlist == NULL) { + PyErr_NoMemory(); + goto fail_0; + } + for (i = 0; i < argc; i++) { + if (!PyArg_Parse((*getitem)(argv, i), + "et;execve() arg 2 must contain only strings", + Py_FileSystemDefaultEncoding, + &argvlist[i])) + { + lastarg = i; + goto fail_1; + } + } + lastarg = argc; + argvlist[argc] = NULL; + + i = PyMapping_Size(env); + if (i < 0) + goto fail_1; + envlist = PyMem_NEW(char *, i + 1); + if (envlist == NULL) { + PyErr_NoMemory(); + goto fail_1; + } + envc = 0; + keys = PyMapping_Keys(env); + vals = PyMapping_Values(env); + if (!keys || !vals) + goto fail_2; + if (!PyList_Check(keys) || !PyList_Check(vals)) { + PyErr_SetString(PyExc_TypeError, + "execve(): env.keys() or env.values() is not a list"); + goto fail_2; + } + + for (pos = 0; pos < i; pos++) { + char *p, *k, *v; + size_t len; + + key = PyList_GetItem(keys, pos); + val = PyList_GetItem(vals, pos); + if (!key || !val) + goto fail_2; + + if (!PyArg_Parse( + key, + "s;execve() arg 3 contains a non-string key", + &k) || + !PyArg_Parse( + val, + "s;execve() arg 3 contains a non-string value", + &v)) + { + goto fail_2; + } + +#if defined(PYOS_OS2) + /* Omit Pseudo-Env Vars that Would Confuse Programs if Passed On */ + if (stricmp(k, "BEGINLIBPATH") != 0 && stricmp(k, "ENDLIBPATH") != 0) { +#endif + len = PyString_Size(key) + PyString_Size(val) + 2; + p = PyMem_NEW(char, len); + if (p == NULL) { + PyErr_NoMemory(); + goto fail_2; + } + PyOS_snprintf(p, len, "%s=%s", k, v); + envlist[envc++] = p; +#if defined(PYOS_OS2) + } +#endif + } + envlist[envc] = 0; + + execve(path, argvlist, envlist); + + /* If we get here it's definitely an error */ + + (void) posix_error(); + + fail_2: + while (--envc >= 0) + PyMem_DEL(envlist[envc]); + PyMem_DEL(envlist); + fail_1: + free_string_array(argvlist, lastarg); + Py_XDECREF(vals); + Py_XDECREF(keys); + fail_0: + PyMem_Free(path); + return NULL; +} +#endif /* HAVE_EXECV */ + + +#ifdef HAVE_SPAWNV +PyDoc_STRVAR(posix_spawnv__doc__, +"spawnv(mode, path, args)\n\n\ +Execute the program 'path' in a new process.\n\ +\n\ + mode: mode of process creation\n\ + path: path of executable file\n\ + args: tuple or list of strings"); + +static PyObject * +posix_spawnv(PyObject *self, PyObject *args) +{ + char *path; + PyObject *argv; + char **argvlist; + int mode, i; + Py_ssize_t argc; + Py_intptr_t spawnval; + PyObject *(*getitem)(PyObject *, Py_ssize_t); + + /* spawnv has three arguments: (mode, path, argv), where + argv is a list or tuple of strings. */ + + if (!PyArg_ParseTuple(args, "ietO:spawnv", &mode, + Py_FileSystemDefaultEncoding, + &path, &argv)) + return NULL; + if (PyList_Check(argv)) { + argc = PyList_Size(argv); + getitem = PyList_GetItem; + } + else if (PyTuple_Check(argv)) { + argc = PyTuple_Size(argv); + getitem = PyTuple_GetItem; + } + else { + PyErr_SetString(PyExc_TypeError, + "spawnv() arg 2 must be a tuple or list"); + PyMem_Free(path); + return NULL; + } + + argvlist = PyMem_NEW(char *, argc+1); + if (argvlist == NULL) { + PyMem_Free(path); + return PyErr_NoMemory(); + } + for (i = 0; i < argc; i++) { + if (!PyArg_Parse((*getitem)(argv, i), "et", + Py_FileSystemDefaultEncoding, + &argvlist[i])) { + free_string_array(argvlist, i); + PyErr_SetString( + PyExc_TypeError, + "spawnv() arg 2 must contain only strings"); + PyMem_Free(path); + return NULL; + } + } + argvlist[argc] = NULL; + +#if defined(PYOS_OS2) && defined(PYCC_GCC) + Py_BEGIN_ALLOW_THREADS + spawnval = spawnv(mode, path, argvlist); + Py_END_ALLOW_THREADS +#else + if (mode == _OLD_P_OVERLAY) + mode = _P_OVERLAY; + + Py_BEGIN_ALLOW_THREADS + spawnval = _spawnv(mode, path, argvlist); + Py_END_ALLOW_THREADS +#endif + + free_string_array(argvlist, argc); + PyMem_Free(path); + + if (spawnval == -1) + return posix_error(); + else +#if SIZEOF_LONG == SIZEOF_VOID_P + return Py_BuildValue("l", (long) spawnval); +#else + return Py_BuildValue("L", (PY_LONG_LONG) spawnval); +#endif +} + + +PyDoc_STRVAR(posix_spawnve__doc__, +"spawnve(mode, path, args, env)\n\n\ +Execute the program 'path' in a new process.\n\ +\n\ + mode: mode of process creation\n\ + path: path of executable file\n\ + args: tuple or list of arguments\n\ + env: dictionary of strings mapping to strings"); + +static PyObject * +posix_spawnve(PyObject *self, PyObject *args) +{ + char *path; + PyObject *argv, *env; + char **argvlist; + char **envlist; + PyObject *key, *val, *keys=NULL, *vals=NULL, *res=NULL; + int mode, pos, envc; + Py_ssize_t argc, i; + Py_intptr_t spawnval; + PyObject *(*getitem)(PyObject *, Py_ssize_t); + Py_ssize_t lastarg = 0; + + /* spawnve has four arguments: (mode, path, argv, env), where + argv is a list or tuple of strings and env is a dictionary + like posix.environ. */ + + if (!PyArg_ParseTuple(args, "ietOO:spawnve", &mode, + Py_FileSystemDefaultEncoding, + &path, &argv, &env)) + return NULL; + if (PyList_Check(argv)) { + argc = PyList_Size(argv); + getitem = PyList_GetItem; + } + else if (PyTuple_Check(argv)) { + argc = PyTuple_Size(argv); + getitem = PyTuple_GetItem; + } + else { + PyErr_SetString(PyExc_TypeError, + "spawnve() arg 2 must be a tuple or list"); + goto fail_0; + } + if (!PyMapping_Check(env)) { + PyErr_SetString(PyExc_TypeError, + "spawnve() arg 3 must be a mapping object"); + goto fail_0; + } + + argvlist = PyMem_NEW(char *, argc+1); + if (argvlist == NULL) { + PyErr_NoMemory(); + goto fail_0; + } + for (i = 0; i < argc; i++) { + if (!PyArg_Parse((*getitem)(argv, i), + "et;spawnve() arg 2 must contain only strings", + Py_FileSystemDefaultEncoding, + &argvlist[i])) + { + lastarg = i; + goto fail_1; + } + } + lastarg = argc; + argvlist[argc] = NULL; + + i = PyMapping_Size(env); + if (i < 0) + goto fail_1; + envlist = PyMem_NEW(char *, i + 1); + if (envlist == NULL) { + PyErr_NoMemory(); + goto fail_1; + } + envc = 0; + keys = PyMapping_Keys(env); + vals = PyMapping_Values(env); + if (!keys || !vals) + goto fail_2; + if (!PyList_Check(keys) || !PyList_Check(vals)) { + PyErr_SetString(PyExc_TypeError, + "spawnve(): env.keys() or env.values() is not a list"); + goto fail_2; + } + + for (pos = 0; pos < i; pos++) { + char *p, *k, *v; + size_t len; + + key = PyList_GetItem(keys, pos); + val = PyList_GetItem(vals, pos); + if (!key || !val) + goto fail_2; + + if (!PyArg_Parse( + key, + "s;spawnve() arg 3 contains a non-string key", + &k) || + !PyArg_Parse( + val, + "s;spawnve() arg 3 contains a non-string value", + &v)) + { + goto fail_2; + } + len = PyString_Size(key) + PyString_Size(val) + 2; + p = PyMem_NEW(char, len); + if (p == NULL) { + PyErr_NoMemory(); + goto fail_2; + } + PyOS_snprintf(p, len, "%s=%s", k, v); + envlist[envc++] = p; + } + envlist[envc] = 0; + +#if defined(PYOS_OS2) && defined(PYCC_GCC) + Py_BEGIN_ALLOW_THREADS + spawnval = spawnve(mode, path, argvlist, envlist); + Py_END_ALLOW_THREADS +#else + if (mode == _OLD_P_OVERLAY) + mode = _P_OVERLAY; + + Py_BEGIN_ALLOW_THREADS + spawnval = _spawnve(mode, path, argvlist, envlist); + Py_END_ALLOW_THREADS +#endif + + if (spawnval == -1) + (void) posix_error(); + else +#if SIZEOF_LONG == SIZEOF_VOID_P + res = Py_BuildValue("l", (long) spawnval); +#else + res = Py_BuildValue("L", (PY_LONG_LONG) spawnval); +#endif + + fail_2: + while (--envc >= 0) + PyMem_DEL(envlist[envc]); + PyMem_DEL(envlist); + fail_1: + free_string_array(argvlist, lastarg); + Py_XDECREF(vals); + Py_XDECREF(keys); + fail_0: + PyMem_Free(path); + return res; +} + +/* OS/2 supports spawnvp & spawnvpe natively */ +#if defined(PYOS_OS2) +PyDoc_STRVAR(posix_spawnvp__doc__, +"spawnvp(mode, file, args)\n\n\ +Execute the program 'file' in a new process, using the environment\n\ +search path to find the file.\n\ +\n\ + mode: mode of process creation\n\ + file: executable file name\n\ + args: tuple or list of strings"); + +static PyObject * +posix_spawnvp(PyObject *self, PyObject *args) +{ + char *path; + PyObject *argv; + char **argvlist; + int mode, i, argc; + Py_intptr_t spawnval; + PyObject *(*getitem)(PyObject *, Py_ssize_t); + + /* spawnvp has three arguments: (mode, path, argv), where + argv is a list or tuple of strings. */ + + if (!PyArg_ParseTuple(args, "ietO:spawnvp", &mode, + Py_FileSystemDefaultEncoding, + &path, &argv)) + return NULL; + if (PyList_Check(argv)) { + argc = PyList_Size(argv); + getitem = PyList_GetItem; + } + else if (PyTuple_Check(argv)) { + argc = PyTuple_Size(argv); + getitem = PyTuple_GetItem; + } + else { + PyErr_SetString(PyExc_TypeError, + "spawnvp() arg 2 must be a tuple or list"); + PyMem_Free(path); + return NULL; + } + + argvlist = PyMem_NEW(char *, argc+1); + if (argvlist == NULL) { + PyMem_Free(path); + return PyErr_NoMemory(); + } + for (i = 0; i < argc; i++) { + if (!PyArg_Parse((*getitem)(argv, i), "et", + Py_FileSystemDefaultEncoding, + &argvlist[i])) { + free_string_array(argvlist, i); + PyErr_SetString( + PyExc_TypeError, + "spawnvp() arg 2 must contain only strings"); + PyMem_Free(path); + return NULL; + } + } + argvlist[argc] = NULL; + + Py_BEGIN_ALLOW_THREADS +#if defined(PYCC_GCC) + spawnval = spawnvp(mode, path, argvlist); +#else + spawnval = _spawnvp(mode, path, argvlist); +#endif + Py_END_ALLOW_THREADS + + free_string_array(argvlist, argc); + PyMem_Free(path); + + if (spawnval == -1) + return posix_error(); + else + return Py_BuildValue("l", (long) spawnval); +} + + +PyDoc_STRVAR(posix_spawnvpe__doc__, +"spawnvpe(mode, file, args, env)\n\n\ +Execute the program 'file' in a new process, using the environment\n\ +search path to find the file.\n\ +\n\ + mode: mode of process creation\n\ + file: executable file name\n\ + args: tuple or list of arguments\n\ + env: dictionary of strings mapping to strings"); + +static PyObject * +posix_spawnvpe(PyObject *self, PyObject *args) +{ + char *path; + PyObject *argv, *env; + char **argvlist; + char **envlist; + PyObject *key, *val, *keys=NULL, *vals=NULL, *res=NULL; + int mode, i, pos, argc, envc; + Py_intptr_t spawnval; + PyObject *(*getitem)(PyObject *, Py_ssize_t); + int lastarg = 0; + + /* spawnvpe has four arguments: (mode, path, argv, env), where + argv is a list or tuple of strings and env is a dictionary + like posix.environ. */ + + if (!PyArg_ParseTuple(args, "ietOO:spawnvpe", &mode, + Py_FileSystemDefaultEncoding, + &path, &argv, &env)) + return NULL; + if (PyList_Check(argv)) { + argc = PyList_Size(argv); + getitem = PyList_GetItem; + } + else if (PyTuple_Check(argv)) { + argc = PyTuple_Size(argv); + getitem = PyTuple_GetItem; + } + else { + PyErr_SetString(PyExc_TypeError, + "spawnvpe() arg 2 must be a tuple or list"); + goto fail_0; + } + if (!PyMapping_Check(env)) { + PyErr_SetString(PyExc_TypeError, + "spawnvpe() arg 3 must be a mapping object"); + goto fail_0; + } + + argvlist = PyMem_NEW(char *, argc+1); + if (argvlist == NULL) { + PyErr_NoMemory(); + goto fail_0; + } + for (i = 0; i < argc; i++) { + if (!PyArg_Parse((*getitem)(argv, i), + "et;spawnvpe() arg 2 must contain only strings", + Py_FileSystemDefaultEncoding, + &argvlist[i])) + { + lastarg = i; + goto fail_1; + } + } + lastarg = argc; + argvlist[argc] = NULL; + + i = PyMapping_Size(env); + if (i < 0) + goto fail_1; + envlist = PyMem_NEW(char *, i + 1); + if (envlist == NULL) { + PyErr_NoMemory(); + goto fail_1; + } + envc = 0; + keys = PyMapping_Keys(env); + vals = PyMapping_Values(env); + if (!keys || !vals) + goto fail_2; + if (!PyList_Check(keys) || !PyList_Check(vals)) { + PyErr_SetString(PyExc_TypeError, + "spawnvpe(): env.keys() or env.values() is not a list"); + goto fail_2; + } + + for (pos = 0; pos < i; pos++) { + char *p, *k, *v; + size_t len; + + key = PyList_GetItem(keys, pos); + val = PyList_GetItem(vals, pos); + if (!key || !val) + goto fail_2; + + if (!PyArg_Parse( + key, + "s;spawnvpe() arg 3 contains a non-string key", + &k) || + !PyArg_Parse( + val, + "s;spawnvpe() arg 3 contains a non-string value", + &v)) + { + goto fail_2; + } + len = PyString_Size(key) + PyString_Size(val) + 2; + p = PyMem_NEW(char, len); + if (p == NULL) { + PyErr_NoMemory(); + goto fail_2; + } + PyOS_snprintf(p, len, "%s=%s", k, v); + envlist[envc++] = p; + } + envlist[envc] = 0; + + Py_BEGIN_ALLOW_THREADS +#if defined(PYCC_GCC) + spawnval = spawnvpe(mode, path, argvlist, envlist); +#else + spawnval = _spawnvpe(mode, path, argvlist, envlist); +#endif + Py_END_ALLOW_THREADS + + if (spawnval == -1) + (void) posix_error(); + else + res = Py_BuildValue("l", (long) spawnval); + + fail_2: + while (--envc >= 0) + PyMem_DEL(envlist[envc]); + PyMem_DEL(envlist); + fail_1: + free_string_array(argvlist, lastarg); + Py_XDECREF(vals); + Py_XDECREF(keys); + fail_0: + PyMem_Free(path); + return res; +} +#endif /* PYOS_OS2 */ +#endif /* HAVE_SPAWNV */ + + +#ifdef HAVE_FORK1 +PyDoc_STRVAR(posix_fork1__doc__, +"fork1() -> pid\n\n\ +Fork a child process with a single multiplexed (i.e., not bound) thread.\n\ +\n\ +Return 0 to child process and PID of child to parent process."); + +static PyObject * +posix_fork1(PyObject *self, PyObject *noargs) +{ + pid_t pid; + int result = 0; + _PyImport_AcquireLock(); + pid = fork1(); + if (pid == 0) { + /* child: this clobbers and resets the import lock. */ + PyOS_AfterFork(); + } else { + /* parent: release the import lock. */ + result = _PyImport_ReleaseLock(); + } + if (pid == -1) + return posix_error(); + if (result < 0) { + /* Don't clobber the OSError if the fork failed. */ + PyErr_SetString(PyExc_RuntimeError, + "not holding the import lock"); + return NULL; + } + return PyLong_FromPid(pid); +} +#endif + + +#ifdef HAVE_FORK +PyDoc_STRVAR(posix_fork__doc__, +"fork() -> pid\n\n\ +Fork a child process.\n\ +Return 0 to child process and PID of child to parent process."); + +static PyObject * +posix_fork(PyObject *self, PyObject *noargs) +{ + pid_t pid; + int result = 0; + _PyImport_AcquireLock(); + pid = fork(); + if (pid == 0) { + /* child: this clobbers and resets the import lock. */ + PyOS_AfterFork(); + } else { + /* parent: release the import lock. */ + result = _PyImport_ReleaseLock(); + } + if (pid == -1) + return posix_error(); + if (result < 0) { + /* Don't clobber the OSError if the fork failed. */ + PyErr_SetString(PyExc_RuntimeError, + "not holding the import lock"); + return NULL; + } + return PyLong_FromPid(pid); +} +#endif + +/* AIX uses /dev/ptc but is otherwise the same as /dev/ptmx */ +/* IRIX has both /dev/ptc and /dev/ptmx, use ptmx */ +#if defined(HAVE_DEV_PTC) && !defined(HAVE_DEV_PTMX) +#define DEV_PTY_FILE "/dev/ptc" +#define HAVE_DEV_PTMX +#else +#define DEV_PTY_FILE "/dev/ptmx" +#endif + +#if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) || defined(HAVE_DEV_PTMX) +#ifdef HAVE_PTY_H +#include <pty.h> +#else +#ifdef HAVE_LIBUTIL_H +#include <libutil.h> +#else +#ifdef HAVE_UTIL_H +#include <util.h> +#endif /* HAVE_UTIL_H */ +#endif /* HAVE_LIBUTIL_H */ +#endif /* HAVE_PTY_H */ +#ifdef HAVE_STROPTS_H +#include <stropts.h> +#endif +#endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) || defined(HAVE_DEV_PTMX */ + +#if defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX) +PyDoc_STRVAR(posix_openpty__doc__, +"openpty() -> (master_fd, slave_fd)\n\n\ +Open a pseudo-terminal, returning open fd's for both master and slave end.\n"); + +static PyObject * +posix_openpty(PyObject *self, PyObject *noargs) +{ + int master_fd, slave_fd; +#ifndef HAVE_OPENPTY + char * slave_name; +#endif +#if defined(HAVE_DEV_PTMX) && !defined(HAVE_OPENPTY) && !defined(HAVE__GETPTY) + PyOS_sighandler_t sig_saved; +#ifdef sun + extern char *ptsname(int fildes); +#endif +#endif + +#ifdef HAVE_OPENPTY + if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) != 0) + return posix_error(); +#elif defined(HAVE__GETPTY) + slave_name = _getpty(&master_fd, O_RDWR, 0666, 0); + if (slave_name == NULL) + return posix_error(); + + slave_fd = open(slave_name, O_RDWR); + if (slave_fd < 0) + return posix_error(); +#else + master_fd = open(DEV_PTY_FILE, O_RDWR | O_NOCTTY); /* open master */ + if (master_fd < 0) + return posix_error(); + sig_saved = PyOS_setsig(SIGCHLD, SIG_DFL); + /* change permission of slave */ + if (grantpt(master_fd) < 0) { + PyOS_setsig(SIGCHLD, sig_saved); + return posix_error(); + } + /* unlock slave */ + if (unlockpt(master_fd) < 0) { + PyOS_setsig(SIGCHLD, sig_saved); + return posix_error(); + } + PyOS_setsig(SIGCHLD, sig_saved); + slave_name = ptsname(master_fd); /* get name of slave */ + if (slave_name == NULL) + return posix_error(); + slave_fd = open(slave_name, O_RDWR | O_NOCTTY); /* open slave */ + if (slave_fd < 0) + return posix_error(); +#endif /* HAVE_OPENPTY */ + + return Py_BuildValue("(ii)", master_fd, slave_fd); + +} +#endif /* defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX) */ + +#ifdef HAVE_FORKPTY +PyDoc_STRVAR(posix_forkpty__doc__, +"forkpty() -> (pid, master_fd)\n\n\ +Fork a new process with a new pseudo-terminal as controlling tty.\n\n\ +Like fork(), return 0 as pid to child process, and PID of child to parent.\n\ +To both, return fd of newly opened pseudo-terminal.\n"); + +static PyObject * +posix_forkpty(PyObject *self, PyObject *noargs) +{ + int master_fd = -1, result = 0; + pid_t pid; + + _PyImport_AcquireLock(); + pid = forkpty(&master_fd, NULL, NULL, NULL); + if (pid == 0) { + /* child: this clobbers and resets the import lock. */ + PyOS_AfterFork(); + } else { + /* parent: release the import lock. */ + result = _PyImport_ReleaseLock(); + } + if (pid == -1) + return posix_error(); + if (result < 0) { + /* Don't clobber the OSError if the fork failed. */ + PyErr_SetString(PyExc_RuntimeError, + "not holding the import lock"); + return NULL; + } + return Py_BuildValue("(Ni)", PyLong_FromPid(pid), master_fd); +} +#endif + +#ifdef HAVE_GETEGID +PyDoc_STRVAR(posix_getegid__doc__, +"getegid() -> egid\n\n\ +Return the current process's effective group id."); + +static PyObject * +posix_getegid(PyObject *self, PyObject *noargs) +{ + return PyInt_FromLong((long)getegid()); +} +#endif + + +#ifdef HAVE_GETEUID +PyDoc_STRVAR(posix_geteuid__doc__, +"geteuid() -> euid\n\n\ +Return the current process's effective user id."); + +static PyObject * +posix_geteuid(PyObject *self, PyObject *noargs) +{ + return PyInt_FromLong((long)geteuid()); +} +#endif + + +#ifdef HAVE_GETGID +PyDoc_STRVAR(posix_getgid__doc__, +"getgid() -> gid\n\n\ +Return the current process's group id."); + +static PyObject * +posix_getgid(PyObject *self, PyObject *noargs) +{ + return PyInt_FromLong((long)getgid()); +} +#endif + + +PyDoc_STRVAR(posix_getpid__doc__, +"getpid() -> pid\n\n\ +Return the current process id"); + +static PyObject * +posix_getpid(PyObject *self, PyObject *noargs) +{ + return PyLong_FromPid(getpid()); +} + + +#ifdef HAVE_GETGROUPS +PyDoc_STRVAR(posix_getgroups__doc__, +"getgroups() -> list of group IDs\n\n\ +Return list of supplemental group IDs for the process."); + +static PyObject * +posix_getgroups(PyObject *self, PyObject *noargs) +{ + PyObject *result = NULL; + +#ifdef NGROUPS_MAX +#define MAX_GROUPS NGROUPS_MAX +#else + /* defined to be 16 on Solaris7, so this should be a small number */ +#define MAX_GROUPS 64 +#endif + gid_t grouplist[MAX_GROUPS]; + + /* On MacOSX getgroups(2) can return more than MAX_GROUPS results + * This is a helper variable to store the intermediate result when + * that happens. + * + * To keep the code readable the OSX behaviour is unconditional, + * according to the POSIX spec this should be safe on all unix-y + * systems. + */ + gid_t* alt_grouplist = grouplist; + int n; + + n = getgroups(MAX_GROUPS, grouplist); + if (n < 0) { + if (errno == EINVAL) { + n = getgroups(0, NULL); + if (n == -1) { + return posix_error(); + } + if (n == 0) { + /* Avoid malloc(0) */ + alt_grouplist = grouplist; + } else { + alt_grouplist = PyMem_Malloc(n * sizeof(gid_t)); + if (alt_grouplist == NULL) { + errno = EINVAL; + return posix_error(); + } + n = getgroups(n, alt_grouplist); + if (n == -1) { + PyMem_Free(alt_grouplist); + return posix_error(); + } + } + } else { + return posix_error(); + } + } + result = PyList_New(n); + if (result != NULL) { + int i; + for (i = 0; i < n; ++i) { + PyObject *o = PyInt_FromLong((long)alt_grouplist[i]); + if (o == NULL) { + Py_DECREF(result); + result = NULL; + break; + } + PyList_SET_ITEM(result, i, o); + } + } + + if (alt_grouplist != grouplist) { + PyMem_Free(alt_grouplist); + } + + return result; +} +#endif + +#ifdef HAVE_INITGROUPS +PyDoc_STRVAR(posix_initgroups__doc__, +"initgroups(username, gid) -> None\n\n\ +Call the system initgroups() to initialize the group access list with all of\n\ +the groups of which the specified username is a member, plus the specified\n\ +group id."); + +static PyObject * +posix_initgroups(PyObject *self, PyObject *args) +{ + char *username; + long gid; + + if (!PyArg_ParseTuple(args, "sl:initgroups", &username, &gid)) + return NULL; + + if (initgroups(username, (gid_t) gid) == -1) + return PyErr_SetFromErrno(PyExc_OSError); + + Py_INCREF(Py_None); + return Py_None; +} +#endif + +#ifdef HAVE_GETPGID +PyDoc_STRVAR(posix_getpgid__doc__, +"getpgid(pid) -> pgid\n\n\ +Call the system call getpgid()."); + +static PyObject * +posix_getpgid(PyObject *self, PyObject *args) +{ + pid_t pid, pgid; + if (!PyArg_ParseTuple(args, PARSE_PID ":getpgid", &pid)) + return NULL; + pgid = getpgid(pid); + if (pgid < 0) + return posix_error(); + return PyLong_FromPid(pgid); +} +#endif /* HAVE_GETPGID */ + + +#ifdef HAVE_GETPGRP +PyDoc_STRVAR(posix_getpgrp__doc__, +"getpgrp() -> pgrp\n\n\ +Return the current process group id."); + +static PyObject * +posix_getpgrp(PyObject *self, PyObject *noargs) +{ +#ifdef GETPGRP_HAVE_ARG + return PyLong_FromPid(getpgrp(0)); +#else /* GETPGRP_HAVE_ARG */ + return PyLong_FromPid(getpgrp()); +#endif /* GETPGRP_HAVE_ARG */ +} +#endif /* HAVE_GETPGRP */ + + +#ifdef HAVE_SETPGRP +PyDoc_STRVAR(posix_setpgrp__doc__, +"setpgrp()\n\n\ +Make this process the process group leader."); + +static PyObject * +posix_setpgrp(PyObject *self, PyObject *noargs) +{ +#ifdef SETPGRP_HAVE_ARG + if (setpgrp(0, 0) < 0) +#else /* SETPGRP_HAVE_ARG */ + if (setpgrp() < 0) +#endif /* SETPGRP_HAVE_ARG */ + return posix_error(); + Py_INCREF(Py_None); + return Py_None; +} + +#endif /* HAVE_SETPGRP */ + +#ifdef HAVE_GETPPID +PyDoc_STRVAR(posix_getppid__doc__, +"getppid() -> ppid\n\n\ +Return the parent's process id."); + +static PyObject * +posix_getppid(PyObject *self, PyObject *noargs) +{ + return PyLong_FromPid(getppid()); +} +#endif + + +#ifdef HAVE_GETLOGIN +PyDoc_STRVAR(posix_getlogin__doc__, +"getlogin() -> string\n\n\ +Return the actual login name."); + +static PyObject * +posix_getlogin(PyObject *self, PyObject *noargs) +{ + PyObject *result = NULL; + char *name; + int old_errno = errno; + + errno = 0; + name = getlogin(); + if (name == NULL) { + if (errno) + posix_error(); + else + PyErr_SetString(PyExc_OSError, + "unable to determine login name"); + } + else + result = PyString_FromString(name); + errno = old_errno; + + return result; +} +#endif + +#ifdef HAVE_GETUID +PyDoc_STRVAR(posix_getuid__doc__, +"getuid() -> uid\n\n\ +Return the current process's user id."); + +static PyObject * +posix_getuid(PyObject *self, PyObject *noargs) +{ + return PyInt_FromLong((long)getuid()); +} +#endif + + +#ifdef HAVE_KILL +PyDoc_STRVAR(posix_kill__doc__, +"kill(pid, sig)\n\n\ +Kill a process with a signal."); + +static PyObject * +posix_kill(PyObject *self, PyObject *args) +{ + pid_t pid; + int sig; + if (!PyArg_ParseTuple(args, PARSE_PID "i:kill", &pid, &sig)) + return NULL; +#if defined(PYOS_OS2) && !defined(PYCC_GCC) + if (sig == XCPT_SIGNAL_INTR || sig == XCPT_SIGNAL_BREAK) { + APIRET rc; + if ((rc = DosSendSignalException(pid, sig)) != NO_ERROR) + return os2_error(rc); + + } else if (sig == XCPT_SIGNAL_KILLPROC) { + APIRET rc; + if ((rc = DosKillProcess(DKP_PROCESS, pid)) != NO_ERROR) + return os2_error(rc); + + } else + return NULL; /* Unrecognized Signal Requested */ +#else + if (kill(pid, sig) == -1) + return posix_error(); +#endif + Py_INCREF(Py_None); + return Py_None; +} +#endif + +#ifdef HAVE_KILLPG +PyDoc_STRVAR(posix_killpg__doc__, +"killpg(pgid, sig)\n\n\ +Kill a process group with a signal."); + +static PyObject * +posix_killpg(PyObject *self, PyObject *args) +{ + int sig; + pid_t pgid; + /* XXX some man pages make the `pgid` parameter an int, others + a pid_t. Since getpgrp() returns a pid_t, we assume killpg should + take the same type. Moreover, pid_t is always at least as wide as + int (else compilation of this module fails), which is safe. */ + if (!PyArg_ParseTuple(args, PARSE_PID "i:killpg", &pgid, &sig)) + return NULL; + if (killpg(pgid, sig) == -1) + return posix_error(); + Py_INCREF(Py_None); + return Py_None; +} +#endif + +#ifdef MS_WINDOWS +PyDoc_STRVAR(win32_kill__doc__, +"kill(pid, sig)\n\n\ +Kill a process with a signal."); + +static PyObject * +win32_kill(PyObject *self, PyObject *args) +{ + PyObject *result; + DWORD pid, sig, err; + HANDLE handle; + + if (!PyArg_ParseTuple(args, "kk:kill", &pid, &sig)) + return NULL; + + /* Console processes which share a common console can be sent CTRL+C or + CTRL+BREAK events, provided they handle said events. */ + if (sig == CTRL_C_EVENT || sig == CTRL_BREAK_EVENT) { + if (GenerateConsoleCtrlEvent(sig, pid) == 0) { + err = GetLastError(); + return PyErr_SetFromWindowsErr(err); + } + else + Py_RETURN_NONE; + } + + /* If the signal is outside of what GenerateConsoleCtrlEvent can use, + attempt to open and terminate the process. */ + handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid); + if (handle == NULL) { + err = GetLastError(); + return PyErr_SetFromWindowsErr(err); + } + + if (TerminateProcess(handle, sig) == 0) { + err = GetLastError(); + result = PyErr_SetFromWindowsErr(err); + } else { + Py_INCREF(Py_None); + result = Py_None; + } + + CloseHandle(handle); + return result; +} +#endif /* MS_WINDOWS */ + +#ifdef HAVE_PLOCK + +#ifdef HAVE_SYS_LOCK_H +#include <sys/lock.h> +#endif + +PyDoc_STRVAR(posix_plock__doc__, +"plock(op)\n\n\ +Lock program segments into memory."); + +static PyObject * +posix_plock(PyObject *self, PyObject *args) +{ + int op; + if (!PyArg_ParseTuple(args, "i:plock", &op)) + return NULL; + if (plock(op) == -1) + return posix_error(); + Py_INCREF(Py_None); + return Py_None; +} +#endif + + +#ifdef HAVE_POPEN +PyDoc_STRVAR(posix_popen__doc__, +"popen(command [, mode='r' [, bufsize]]) -> pipe\n\n\ +Open a pipe to/from a command returning a file object."); + +#if defined(PYOS_OS2) +#if defined(PYCC_VACPP) +static int +async_system(const char *command) +{ + char errormsg[256], args[1024]; + RESULTCODES rcodes; + APIRET rc; + + char *shell = getenv("COMSPEC"); + if (!shell) + shell = "cmd"; + + /* avoid overflowing the argument buffer */ + if (strlen(shell) + 3 + strlen(command) >= 1024) + return ERROR_NOT_ENOUGH_MEMORY + + args[0] = '\0'; + strcat(args, shell); + strcat(args, "/c "); + strcat(args, command); + + /* execute asynchronously, inheriting the environment */ + rc = DosExecPgm(errormsg, + sizeof(errormsg), + EXEC_ASYNC, + args, + NULL, + &rcodes, + shell); + return rc; +} + +static FILE * +popen(const char *command, const char *mode, int pipesize, int *err) +{ + int oldfd, tgtfd; + HFILE pipeh[2]; + APIRET rc; + + /* mode determines which of stdin or stdout is reconnected to + * the pipe to the child + */ + if (strchr(mode, 'r') != NULL) { + tgt_fd = 1; /* stdout */ + } else if (strchr(mode, 'w')) { + tgt_fd = 0; /* stdin */ + } else { + *err = ERROR_INVALID_ACCESS; + return NULL; + } + + /* setup the pipe */ + if ((rc = DosCreatePipe(&pipeh[0], &pipeh[1], pipesize)) != NO_ERROR) { + *err = rc; + return NULL; + } + + /* prevent other threads accessing stdio */ + DosEnterCritSec(); + + /* reconnect stdio and execute child */ + oldfd = dup(tgtfd); + close(tgtfd); + if (dup2(pipeh[tgtfd], tgtfd) == 0) { + DosClose(pipeh[tgtfd]); + rc = async_system(command); + } + + /* restore stdio */ + dup2(oldfd, tgtfd); + close(oldfd); + + /* allow other threads access to stdio */ + DosExitCritSec(); + + /* if execution of child was successful return file stream */ + if (rc == NO_ERROR) + return fdopen(pipeh[1 - tgtfd], mode); + else { + DosClose(pipeh[1 - tgtfd]); + *err = rc; + return NULL; + } +} + +static PyObject * +posix_popen(PyObject *self, PyObject *args) +{ + char *name; + char *mode = "r"; + int err, bufsize = -1; + FILE *fp; + PyObject *f; + if (!PyArg_ParseTuple(args, "s|si:popen", &name, &mode, &bufsize)) + return NULL; + Py_BEGIN_ALLOW_THREADS + fp = popen(name, mode, (bufsize > 0) ? bufsize : 4096, &err); + Py_END_ALLOW_THREADS + if (fp == NULL) + return os2_error(err); + + f = PyFile_FromFile(fp, name, mode, fclose); + if (f != NULL) + PyFile_SetBufSize(f, bufsize); + return f; +} + +#elif defined(PYCC_GCC) + +/* standard posix version of popen() support */ +static PyObject * +posix_popen(PyObject *self, PyObject *args) +{ + char *name; + char *mode = "r"; + int bufsize = -1; + FILE *fp; + PyObject *f; + if (!PyArg_ParseTuple(args, "s|si:popen", &name, &mode, &bufsize)) + return NULL; + Py_BEGIN_ALLOW_THREADS + fp = popen(name, mode); + Py_END_ALLOW_THREADS + if (fp == NULL) + return posix_error(); + f = PyFile_FromFile(fp, name, mode, pclose); + if (f != NULL) + PyFile_SetBufSize(f, bufsize); + return f; +} + +/* fork() under OS/2 has lots'o'warts + * EMX supports pipe() and spawn*() so we can synthesize popen[234]() + * most of this code is a ripoff of the win32 code, but using the + * capabilities of EMX's C library routines + */ + +/* These tell _PyPopen() whether to return 1, 2, or 3 file objects. */ +#define POPEN_1 1 +#define POPEN_2 2 +#define POPEN_3 3 +#define POPEN_4 4 + +static PyObject *_PyPopen(char *, int, int, int); +static int _PyPclose(FILE *file); + +/* + * Internal dictionary mapping popen* file pointers to process handles, + * for use when retrieving the process exit code. See _PyPclose() below + * for more information on this dictionary's use. + */ +static PyObject *_PyPopenProcs = NULL; + +/* os2emx version of popen2() + * + * The result of this function is a pipe (file) connected to the + * process's stdin, and a pipe connected to the process's stdout. + */ + +static PyObject * +os2emx_popen2(PyObject *self, PyObject *args) +{ + PyObject *f; + int tm=0; + + char *cmdstring; + char *mode = "t"; + int bufsize = -1; + if (!PyArg_ParseTuple(args, "s|si:popen2", &cmdstring, &mode, &bufsize)) + return NULL; + + if (*mode == 't') + tm = O_TEXT; + else if (*mode != 'b') { + PyErr_SetString(PyExc_ValueError, "mode must be 't' or 'b'"); + return NULL; + } else + tm = O_BINARY; + + f = _PyPopen(cmdstring, tm, POPEN_2, bufsize); + + return f; +} + +/* + * Variation on os2emx.popen2 + * + * The result of this function is 3 pipes - the process's stdin, + * stdout and stderr + */ + +static PyObject * +os2emx_popen3(PyObject *self, PyObject *args) +{ + PyObject *f; + int tm = 0; + + char *cmdstring; + char *mode = "t"; + int bufsize = -1; + if (!PyArg_ParseTuple(args, "s|si:popen3", &cmdstring, &mode, &bufsize)) + return NULL; + + if (*mode == 't') + tm = O_TEXT; + else if (*mode != 'b') { + PyErr_SetString(PyExc_ValueError, "mode must be 't' or 'b'"); + return NULL; + } else + tm = O_BINARY; + + f = _PyPopen(cmdstring, tm, POPEN_3, bufsize); + + return f; +} + +/* + * Variation on os2emx.popen2 + * + * The result of this function is 2 pipes - the processes stdin, + * and stdout+stderr combined as a single pipe. + */ + +static PyObject * +os2emx_popen4(PyObject *self, PyObject *args) +{ + PyObject *f; + int tm = 0; + + char *cmdstring; + char *mode = "t"; + int bufsize = -1; + if (!PyArg_ParseTuple(args, "s|si:popen4", &cmdstring, &mode, &bufsize)) + return NULL; + + if (*mode == 't') + tm = O_TEXT; + else if (*mode != 'b') { + PyErr_SetString(PyExc_ValueError, "mode must be 't' or 'b'"); + return NULL; + } else + tm = O_BINARY; + + f = _PyPopen(cmdstring, tm, POPEN_4, bufsize); + + return f; +} + +/* a couple of structures for convenient handling of multiple + * file handles and pipes + */ +struct file_ref +{ + int handle; + int flags; +}; + +struct pipe_ref +{ + int rd; + int wr; +}; + +/* The following code is derived from the win32 code */ + +static PyObject * +_PyPopen(char *cmdstring, int mode, int n, int bufsize) +{ + struct file_ref stdio[3]; + struct pipe_ref p_fd[3]; + FILE *p_s[3]; + int file_count, i, pipe_err; + pid_t pipe_pid; + char *shell, *sh_name, *opt, *rd_mode, *wr_mode; + PyObject *f, *p_f[3]; + + /* file modes for subsequent fdopen's on pipe handles */ + if (mode == O_TEXT) + { + rd_mode = "rt"; + wr_mode = "wt"; + } + else + { + rd_mode = "rb"; + wr_mode = "wb"; + } + + /* prepare shell references */ + if ((shell = getenv("EMXSHELL")) == NULL) + if ((shell = getenv("COMSPEC")) == NULL) + { + errno = ENOENT; + return posix_error(); + } + + sh_name = _getname(shell); + if (stricmp(sh_name, "cmd.exe") == 0 || stricmp(sh_name, "4os2.exe") == 0) + opt = "/c"; + else + opt = "-c"; + + /* save current stdio fds + their flags, and set not inheritable */ + i = pipe_err = 0; + while (pipe_err >= 0 && i < 3) + { + pipe_err = stdio[i].handle = dup(i); + stdio[i].flags = fcntl(i, F_GETFD, 0); + fcntl(stdio[i].handle, F_SETFD, stdio[i].flags | FD_CLOEXEC); + i++; + } + if (pipe_err < 0) + { + /* didn't get them all saved - clean up and bail out */ + int saved_err = errno; + while (i-- > 0) + { + close(stdio[i].handle); + } + errno = saved_err; + return posix_error(); + } + + /* create pipe ends */ + file_count = 2; + if (n == POPEN_3) + file_count = 3; + i = pipe_err = 0; + while ((pipe_err == 0) && (i < file_count)) + pipe_err = pipe((int *)&p_fd[i++]); + if (pipe_err < 0) + { + /* didn't get them all made - clean up and bail out */ + while (i-- > 0) + { + close(p_fd[i].wr); + close(p_fd[i].rd); + } + errno = EPIPE; + return posix_error(); + } + + /* change the actual standard IO streams over temporarily, + * making the retained pipe ends non-inheritable + */ + pipe_err = 0; + + /* - stdin */ + if (dup2(p_fd[0].rd, 0) == 0) + { + close(p_fd[0].rd); + i = fcntl(p_fd[0].wr, F_GETFD, 0); + fcntl(p_fd[0].wr, F_SETFD, i | FD_CLOEXEC); + if ((p_s[0] = fdopen(p_fd[0].wr, wr_mode)) == NULL) + { + close(p_fd[0].wr); + pipe_err = -1; + } + } + else + { + pipe_err = -1; + } + + /* - stdout */ + if (pipe_err == 0) + { + if (dup2(p_fd[1].wr, 1) == 1) + { + close(p_fd[1].wr); + i = fcntl(p_fd[1].rd, F_GETFD, 0); + fcntl(p_fd[1].rd, F_SETFD, i | FD_CLOEXEC); + if ((p_s[1] = fdopen(p_fd[1].rd, rd_mode)) == NULL) + { + close(p_fd[1].rd); + pipe_err = -1; + } + } + else + { + pipe_err = -1; + } + } + + /* - stderr, as required */ + if (pipe_err == 0) + switch (n) + { + case POPEN_3: + { + if (dup2(p_fd[2].wr, 2) == 2) + { + close(p_fd[2].wr); + i = fcntl(p_fd[2].rd, F_GETFD, 0); + fcntl(p_fd[2].rd, F_SETFD, i | FD_CLOEXEC); + if ((p_s[2] = fdopen(p_fd[2].rd, rd_mode)) == NULL) + { + close(p_fd[2].rd); + pipe_err = -1; + } + } + else + { + pipe_err = -1; + } + break; + } + + case POPEN_4: + { + if (dup2(1, 2) != 2) + { + pipe_err = -1; + } + break; + } + } + + /* spawn the child process */ + if (pipe_err == 0) + { + pipe_pid = spawnlp(P_NOWAIT, shell, shell, opt, cmdstring, (char *)0); + if (pipe_pid == -1) + { + pipe_err = -1; + } + else + { + /* save the PID into the FILE structure + * NOTE: this implementation doesn't actually + * take advantage of this, but do it for + * completeness - AIM Apr01 + */ + for (i = 0; i < file_count; i++) + p_s[i]->_pid = pipe_pid; + } + } + + /* reset standard IO to normal */ + for (i = 0; i < 3; i++) + { + dup2(stdio[i].handle, i); + fcntl(i, F_SETFD, stdio[i].flags); + close(stdio[i].handle); + } + + /* if any remnant problems, clean up and bail out */ + if (pipe_err < 0) + { + for (i = 0; i < 3; i++) + { + close(p_fd[i].rd); + close(p_fd[i].wr); + } + errno = EPIPE; + return posix_error_with_filename(cmdstring); + } + + /* build tuple of file objects to return */ + if ((p_f[0] = PyFile_FromFile(p_s[0], cmdstring, wr_mode, _PyPclose)) != NULL) + PyFile_SetBufSize(p_f[0], bufsize); + if ((p_f[1] = PyFile_FromFile(p_s[1], cmdstring, rd_mode, _PyPclose)) != NULL) + PyFile_SetBufSize(p_f[1], bufsize); + if (n == POPEN_3) + { + if ((p_f[2] = PyFile_FromFile(p_s[2], cmdstring, rd_mode, _PyPclose)) != NULL) + PyFile_SetBufSize(p_f[0], bufsize); + f = PyTuple_Pack(3, p_f[0], p_f[1], p_f[2]); + } + else + f = PyTuple_Pack(2, p_f[0], p_f[1]); + + /* + * Insert the files we've created into the process dictionary + * all referencing the list with the process handle and the + * initial number of files (see description below in _PyPclose). + * Since if _PyPclose later tried to wait on a process when all + * handles weren't closed, it could create a deadlock with the + * child, we spend some energy here to try to ensure that we + * either insert all file handles into the dictionary or none + * at all. It's a little clumsy with the various popen modes + * and variable number of files involved. + */ + if (!_PyPopenProcs) + { + _PyPopenProcs = PyDict_New(); + } + + if (_PyPopenProcs) + { + PyObject *procObj, *pidObj, *intObj, *fileObj[3]; + int ins_rc[3]; + + fileObj[0] = fileObj[1] = fileObj[2] = NULL; + ins_rc[0] = ins_rc[1] = ins_rc[2] = 0; + + procObj = PyList_New(2); + pidObj = PyLong_FromPid(pipe_pid); + intObj = PyInt_FromLong((long) file_count); + + if (procObj && pidObj && intObj) + { + PyList_SetItem(procObj, 0, pidObj); + PyList_SetItem(procObj, 1, intObj); + + fileObj[0] = PyLong_FromVoidPtr(p_s[0]); + if (fileObj[0]) + { + ins_rc[0] = PyDict_SetItem(_PyPopenProcs, + fileObj[0], + procObj); + } + fileObj[1] = PyLong_FromVoidPtr(p_s[1]); + if (fileObj[1]) + { + ins_rc[1] = PyDict_SetItem(_PyPopenProcs, + fileObj[1], + procObj); + } + if (file_count >= 3) + { + fileObj[2] = PyLong_FromVoidPtr(p_s[2]); + if (fileObj[2]) + { + ins_rc[2] = PyDict_SetItem(_PyPopenProcs, + fileObj[2], + procObj); + } + } + + if (ins_rc[0] < 0 || !fileObj[0] || + ins_rc[1] < 0 || (file_count > 1 && !fileObj[1]) || + ins_rc[2] < 0 || (file_count > 2 && !fileObj[2])) + { + /* Something failed - remove any dictionary + * entries that did make it. + */ + if (!ins_rc[0] && fileObj[0]) + { + PyDict_DelItem(_PyPopenProcs, + fileObj[0]); + } + if (!ins_rc[1] && fileObj[1]) + { + PyDict_DelItem(_PyPopenProcs, + fileObj[1]); + } + if (!ins_rc[2] && fileObj[2]) + { + PyDict_DelItem(_PyPopenProcs, + fileObj[2]); + } + } + } + + /* + * Clean up our localized references for the dictionary keys + * and value since PyDict_SetItem will Py_INCREF any copies + * that got placed in the dictionary. + */ + Py_XDECREF(procObj); + Py_XDECREF(fileObj[0]); + Py_XDECREF(fileObj[1]); + Py_XDECREF(fileObj[2]); + } + + /* Child is launched. */ + return f; +} + +/* + * Wrapper for fclose() to use for popen* files, so we can retrieve the + * exit code for the child process and return as a result of the close. + * + * This function uses the _PyPopenProcs dictionary in order to map the + * input file pointer to information about the process that was + * originally created by the popen* call that created the file pointer. + * The dictionary uses the file pointer as a key (with one entry + * inserted for each file returned by the original popen* call) and a + * single list object as the value for all files from a single call. + * The list object contains the Win32 process handle at [0], and a file + * count at [1], which is initialized to the total number of file + * handles using that list. + * + * This function closes whichever handle it is passed, and decrements + * the file count in the dictionary for the process handle pointed to + * by this file. On the last close (when the file count reaches zero), + * this function will wait for the child process and then return its + * exit code as the result of the close() operation. This permits the + * files to be closed in any order - it is always the close() of the + * final handle that will return the exit code. + * + * NOTE: This function is currently called with the GIL released. + * hence we use the GILState API to manage our state. + */ + +static int _PyPclose(FILE *file) +{ + int result; + int exit_code; + pid_t pipe_pid; + PyObject *procObj, *pidObj, *intObj, *fileObj; + int file_count; +#ifdef WITH_THREAD + PyGILState_STATE state; +#endif + + /* Close the file handle first, to ensure it can't block the + * child from exiting if it's the last handle. + */ + result = fclose(file); + +#ifdef WITH_THREAD + state = PyGILState_Ensure(); +#endif + if (_PyPopenProcs) + { + if ((fileObj = PyLong_FromVoidPtr(file)) != NULL && + (procObj = PyDict_GetItem(_PyPopenProcs, + fileObj)) != NULL && + (pidObj = PyList_GetItem(procObj,0)) != NULL && + (intObj = PyList_GetItem(procObj,1)) != NULL) + { + pipe_pid = (pid_t) PyLong_AsPid(pidObj); + file_count = (int) PyInt_AsLong(intObj); + + if (file_count > 1) + { + /* Still other files referencing process */ + file_count--; + PyList_SetItem(procObj,1, + PyInt_FromLong((long) file_count)); + } + else + { + /* Last file for this process */ + if (result != EOF && + waitpid(pipe_pid, &exit_code, 0) == pipe_pid) + { + /* extract exit status */ + if (WIFEXITED(exit_code)) + { + result = WEXITSTATUS(exit_code); + } + else + { + errno = EPIPE; + result = -1; + } + } + else + { + /* Indicate failure - this will cause the file object + * to raise an I/O error and translate the last + * error code from errno. We do have a problem with + * last errors that overlap the normal errno table, + * but that's a consistent problem with the file object. + */ + result = -1; + } + } + + /* Remove this file pointer from dictionary */ + PyDict_DelItem(_PyPopenProcs, fileObj); + + if (PyDict_Size(_PyPopenProcs) == 0) + { + Py_DECREF(_PyPopenProcs); + _PyPopenProcs = NULL; + } + + } /* if object retrieval ok */ + + Py_XDECREF(fileObj); + } /* if _PyPopenProcs */ + +#ifdef WITH_THREAD + PyGILState_Release(state); +#endif + return result; +} + +#endif /* PYCC_??? */ + +#elif defined(MS_WINDOWS) + +/* + * Portable 'popen' replacement for Win32. + * + * Written by Bill Tutt <billtut@microsoft.com>. Minor tweaks + * and 2.0 integration by Fredrik Lundh <fredrik@pythonware.com> + * Return code handling by David Bolen <db3l@fitlinxx.com>. + */ + +#include <malloc.h> +#include <io.h> +#include <fcntl.h> + +/* These tell _PyPopen() wether to return 1, 2, or 3 file objects. */ +#define POPEN_1 1 +#define POPEN_2 2 +#define POPEN_3 3 +#define POPEN_4 4 + +static PyObject *_PyPopen(char *, int, int); +static int _PyPclose(FILE *file); + +/* + * Internal dictionary mapping popen* file pointers to process handles, + * for use when retrieving the process exit code. See _PyPclose() below + * for more information on this dictionary's use. + */ +static PyObject *_PyPopenProcs = NULL; + + +/* popen that works from a GUI. + * + * The result of this function is a pipe (file) connected to the + * processes stdin or stdout, depending on the requested mode. + */ + +static PyObject * +posix_popen(PyObject *self, PyObject *args) +{ + PyObject *f; + int tm = 0; + + char *cmdstring; + char *mode = "r"; + int bufsize = -1; + if (!PyArg_ParseTuple(args, "s|si:popen", &cmdstring, &mode, &bufsize)) + return NULL; + + if (*mode == 'r') + tm = _O_RDONLY; + else if (*mode != 'w') { + PyErr_SetString(PyExc_ValueError, "popen() arg 2 must be 'r' or 'w'"); + return NULL; + } else + tm = _O_WRONLY; + + if (bufsize != -1) { + PyErr_SetString(PyExc_ValueError, "popen() arg 3 must be -1"); + return NULL; + } + + if (*(mode+1) == 't') + f = _PyPopen(cmdstring, tm | _O_TEXT, POPEN_1); + else if (*(mode+1) == 'b') + f = _PyPopen(cmdstring, tm | _O_BINARY, POPEN_1); + else + f = _PyPopen(cmdstring, tm | _O_TEXT, POPEN_1); + + return f; +} + +/* Variation on win32pipe.popen + * + * The result of this function is a pipe (file) connected to the + * process's stdin, and a pipe connected to the process's stdout. + */ + +static PyObject * +win32_popen2(PyObject *self, PyObject *args) +{ + PyObject *f; + int tm=0; + + char *cmdstring; + char *mode = "t"; + int bufsize = -1; + if (!PyArg_ParseTuple(args, "s|si:popen2", &cmdstring, &mode, &bufsize)) + return NULL; + + if (*mode == 't') + tm = _O_TEXT; + else if (*mode != 'b') { + PyErr_SetString(PyExc_ValueError, "popen2() arg 2 must be 't' or 'b'"); + return NULL; + } else + tm = _O_BINARY; + + if (bufsize != -1) { + PyErr_SetString(PyExc_ValueError, "popen2() arg 3 must be -1"); + return NULL; + } + + f = _PyPopen(cmdstring, tm, POPEN_2); + + return f; +} + +/* + * Variation on <om win32pipe.popen> + * + * The result of this function is 3 pipes - the process's stdin, + * stdout and stderr + */ + +static PyObject * +win32_popen3(PyObject *self, PyObject *args) +{ + PyObject *f; + int tm = 0; + + char *cmdstring; + char *mode = "t"; + int bufsize = -1; + if (!PyArg_ParseTuple(args, "s|si:popen3", &cmdstring, &mode, &bufsize)) + return NULL; + + if (*mode == 't') + tm = _O_TEXT; + else if (*mode != 'b') { + PyErr_SetString(PyExc_ValueError, "popen3() arg 2 must be 't' or 'b'"); + return NULL; + } else + tm = _O_BINARY; + + if (bufsize != -1) { + PyErr_SetString(PyExc_ValueError, "popen3() arg 3 must be -1"); + return NULL; + } + + f = _PyPopen(cmdstring, tm, POPEN_3); + + return f; +} + +/* + * Variation on win32pipe.popen + * + * The result of this function is 2 pipes - the processes stdin, + * and stdout+stderr combined as a single pipe. + */ + +static PyObject * +win32_popen4(PyObject *self, PyObject *args) +{ + PyObject *f; + int tm = 0; + + char *cmdstring; + char *mode = "t"; + int bufsize = -1; + if (!PyArg_ParseTuple(args, "s|si:popen4", &cmdstring, &mode, &bufsize)) + return NULL; + + if (*mode == 't') + tm = _O_TEXT; + else if (*mode != 'b') { + PyErr_SetString(PyExc_ValueError, "popen4() arg 2 must be 't' or 'b'"); + return NULL; + } else + tm = _O_BINARY; + + if (bufsize != -1) { + PyErr_SetString(PyExc_ValueError, "popen4() arg 3 must be -1"); + return NULL; + } + + f = _PyPopen(cmdstring, tm, POPEN_4); + + return f; +} + +static BOOL +_PyPopenCreateProcess(char *cmdstring, + HANDLE hStdin, + HANDLE hStdout, + HANDLE hStderr, + HANDLE *hProcess) +{ + PROCESS_INFORMATION piProcInfo; + STARTUPINFO siStartInfo; + DWORD dwProcessFlags = 0; /* no NEW_CONSOLE by default for Ctrl+C handling */ + char *s1,*s2, *s3 = " /c "; + const char *szConsoleSpawn = "w9xpopen.exe"; + int i; + Py_ssize_t x; + + if (i = GetEnvironmentVariable("COMSPEC",NULL,0)) { + char *comshell; + + s1 = (char *)alloca(i); + if (!(x = GetEnvironmentVariable("COMSPEC", s1, i))) + /* x < i, so x fits into an integer */ + return (int)x; + + /* Explicitly check if we are using COMMAND.COM. If we are + * then use the w9xpopen hack. + */ + comshell = s1 + x; + while (comshell >= s1 && *comshell != '\\') + --comshell; + ++comshell; + + if (GetVersion() < 0x80000000 && + _stricmp(comshell, "command.com") != 0) { + /* NT/2000 and not using command.com. */ + x = i + strlen(s3) + strlen(cmdstring) + 1; + s2 = (char *)alloca(x); + ZeroMemory(s2, x); + PyOS_snprintf(s2, x, "%s%s%s", s1, s3, cmdstring); + } + else { + /* + * Oh gag, we're on Win9x or using COMMAND.COM. Use + * the workaround listed in KB: Q150956 + */ + char modulepath[_MAX_PATH]; + struct stat statinfo; + GetModuleFileName(NULL, modulepath, sizeof(modulepath)); + for (x = i = 0; modulepath[i]; i++) + if (modulepath[i] == SEP) + x = i+1; + modulepath[x] = '\0'; + /* Create the full-name to w9xpopen, so we can test it exists */ + strncat(modulepath, + szConsoleSpawn, + (sizeof(modulepath)/sizeof(modulepath[0])) + -strlen(modulepath)); + if (stat(modulepath, &statinfo) != 0) { + size_t mplen = sizeof(modulepath)/sizeof(modulepath[0]); + /* Eeek - file-not-found - possibly an embedding + situation - see if we can locate it in sys.prefix + */ + strncpy(modulepath, + Py_GetExecPrefix(), + mplen); + modulepath[mplen-1] = '\0'; + if (modulepath[strlen(modulepath)-1] != '\\') + strcat(modulepath, "\\"); + strncat(modulepath, + szConsoleSpawn, + mplen-strlen(modulepath)); + /* No where else to look - raise an easily identifiable + error, rather than leaving Windows to report + "file not found" - as the user is probably blissfully + unaware this shim EXE is used, and it will confuse them. + (well, it confused me for a while ;-) + */ + if (stat(modulepath, &statinfo) != 0) { + PyErr_Format(PyExc_RuntimeError, + "Can not locate '%s' which is needed " + "for popen to work with your shell " + "or platform.", + szConsoleSpawn); + return FALSE; + } + } + x = i + strlen(s3) + strlen(cmdstring) + 1 + + strlen(modulepath) + + strlen(szConsoleSpawn) + 1; + + s2 = (char *)alloca(x); + ZeroMemory(s2, x); + /* To maintain correct argument passing semantics, + we pass the command-line as it stands, and allow + quoting to be applied. w9xpopen.exe will then + use its argv vector, and re-quote the necessary + args for the ultimate child process. + */ + PyOS_snprintf( + s2, x, + "\"%s\" %s%s%s", + modulepath, + s1, + s3, + cmdstring); + /* Not passing CREATE_NEW_CONSOLE has been known to + cause random failures on win9x. Specifically a + dialog: + "Your program accessed mem currently in use at xxx" + and a hopeful warning about the stability of your + system. + Cost is Ctrl+C won't kill children, but anyone + who cares can have a go! + */ + dwProcessFlags |= CREATE_NEW_CONSOLE; + } + } + + /* Could be an else here to try cmd.exe / command.com in the path + Now we'll just error out.. */ + else { + PyErr_SetString(PyExc_RuntimeError, + "Cannot locate a COMSPEC environment variable to " + "use as the shell"); + return FALSE; + } + + ZeroMemory(&siStartInfo, sizeof(STARTUPINFO)); + siStartInfo.cb = sizeof(STARTUPINFO); + siStartInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; + siStartInfo.hStdInput = hStdin; + siStartInfo.hStdOutput = hStdout; + siStartInfo.hStdError = hStderr; + siStartInfo.wShowWindow = SW_HIDE; + + if (CreateProcess(NULL, + s2, + NULL, + NULL, + TRUE, + dwProcessFlags, + NULL, + NULL, + &siStartInfo, + &piProcInfo) ) { + /* Close the handles now so anyone waiting is woken. */ + CloseHandle(piProcInfo.hThread); + + /* Return process handle */ + *hProcess = piProcInfo.hProcess; + return TRUE; + } + win32_error("CreateProcess", s2); + return FALSE; +} + +/* The following code is based off of KB: Q190351 */ + +static PyObject * +_PyPopen(char *cmdstring, int mode, int n) +{ + HANDLE hChildStdinRd, hChildStdinWr, hChildStdoutRd, hChildStdoutWr, + hChildStderrRd, hChildStderrWr, hChildStdinWrDup, hChildStdoutRdDup, + hChildStderrRdDup, hProcess; /* hChildStdoutWrDup; */ + + SECURITY_ATTRIBUTES saAttr; + BOOL fSuccess; + int fd1, fd2, fd3; + FILE *f1, *f2, *f3; + long file_count; + PyObject *f; + + saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); + saAttr.bInheritHandle = TRUE; + saAttr.lpSecurityDescriptor = NULL; + + if (!CreatePipe(&hChildStdinRd, &hChildStdinWr, &saAttr, 0)) + return win32_error("CreatePipe", NULL); + + /* Create new output read handle and the input write handle. Set + * the inheritance properties to FALSE. Otherwise, the child inherits + * these handles; resulting in non-closeable handles to the pipes + * being created. */ + fSuccess = DuplicateHandle(GetCurrentProcess(), hChildStdinWr, + GetCurrentProcess(), &hChildStdinWrDup, 0, + FALSE, + DUPLICATE_SAME_ACCESS); + if (!fSuccess) + return win32_error("DuplicateHandle", NULL); + + /* Close the inheritable version of ChildStdin + that we're using. */ + CloseHandle(hChildStdinWr); + + if (!CreatePipe(&hChildStdoutRd, &hChildStdoutWr, &saAttr, 0)) + return win32_error("CreatePipe", NULL); + + fSuccess = DuplicateHandle(GetCurrentProcess(), hChildStdoutRd, + GetCurrentProcess(), &hChildStdoutRdDup, 0, + FALSE, DUPLICATE_SAME_ACCESS); + if (!fSuccess) + return win32_error("DuplicateHandle", NULL); + + /* Close the inheritable version of ChildStdout + that we're using. */ + CloseHandle(hChildStdoutRd); + + if (n != POPEN_4) { + if (!CreatePipe(&hChildStderrRd, &hChildStderrWr, &saAttr, 0)) + return win32_error("CreatePipe", NULL); + fSuccess = DuplicateHandle(GetCurrentProcess(), + hChildStderrRd, + GetCurrentProcess(), + &hChildStderrRdDup, 0, + FALSE, DUPLICATE_SAME_ACCESS); + if (!fSuccess) + return win32_error("DuplicateHandle", NULL); + /* Close the inheritable version of ChildStdErr that we're using. */ + CloseHandle(hChildStderrRd); + } + + switch (n) { + case POPEN_1: + switch (mode & (_O_RDONLY | _O_TEXT | _O_BINARY | _O_WRONLY)) { + case _O_WRONLY | _O_TEXT: + /* Case for writing to child Stdin in text mode. */ + fd1 = _open_osfhandle((Py_intptr_t)hChildStdinWrDup, mode); + f1 = _fdopen(fd1, "w"); + f = PyFile_FromFile(f1, cmdstring, "w", _PyPclose); + PyFile_SetBufSize(f, 0); + /* We don't care about these pipes anymore, so close them. */ + CloseHandle(hChildStdoutRdDup); + CloseHandle(hChildStderrRdDup); + break; + + case _O_RDONLY | _O_TEXT: + /* Case for reading from child Stdout in text mode. */ + fd1 = _open_osfhandle((Py_intptr_t)hChildStdoutRdDup, mode); + f1 = _fdopen(fd1, "r"); + f = PyFile_FromFile(f1, cmdstring, "r", _PyPclose); + PyFile_SetBufSize(f, 0); + /* We don't care about these pipes anymore, so close them. */ + CloseHandle(hChildStdinWrDup); + CloseHandle(hChildStderrRdDup); + break; + + case _O_RDONLY | _O_BINARY: + /* Case for readinig from child Stdout in binary mode. */ + fd1 = _open_osfhandle((Py_intptr_t)hChildStdoutRdDup, mode); + f1 = _fdopen(fd1, "rb"); + f = PyFile_FromFile(f1, cmdstring, "rb", _PyPclose); + PyFile_SetBufSize(f, 0); + /* We don't care about these pipes anymore, so close them. */ + CloseHandle(hChildStdinWrDup); + CloseHandle(hChildStderrRdDup); + break; + + case _O_WRONLY | _O_BINARY: + /* Case for writing to child Stdin in binary mode. */ + fd1 = _open_osfhandle((Py_intptr_t)hChildStdinWrDup, mode); + f1 = _fdopen(fd1, "wb"); + f = PyFile_FromFile(f1, cmdstring, "wb", _PyPclose); + PyFile_SetBufSize(f, 0); + /* We don't care about these pipes anymore, so close them. */ + CloseHandle(hChildStdoutRdDup); + CloseHandle(hChildStderrRdDup); + break; + } + file_count = 1; + break; + + case POPEN_2: + case POPEN_4: + { + char *m1, *m2; + PyObject *p1, *p2; + + if (mode & _O_TEXT) { + m1 = "r"; + m2 = "w"; + } else { + m1 = "rb"; + m2 = "wb"; + } + + fd1 = _open_osfhandle((Py_intptr_t)hChildStdinWrDup, mode); + f1 = _fdopen(fd1, m2); + fd2 = _open_osfhandle((Py_intptr_t)hChildStdoutRdDup, mode); + f2 = _fdopen(fd2, m1); + p1 = PyFile_FromFile(f1, cmdstring, m2, _PyPclose); + PyFile_SetBufSize(p1, 0); + p2 = PyFile_FromFile(f2, cmdstring, m1, _PyPclose); + PyFile_SetBufSize(p2, 0); + + if (n != 4) + CloseHandle(hChildStderrRdDup); + + f = PyTuple_Pack(2,p1,p2); + Py_XDECREF(p1); + Py_XDECREF(p2); + file_count = 2; + break; + } + + case POPEN_3: + { + char *m1, *m2; + PyObject *p1, *p2, *p3; + + if (mode & _O_TEXT) { + m1 = "r"; + m2 = "w"; + } else { + m1 = "rb"; + m2 = "wb"; + } + + fd1 = _open_osfhandle((Py_intptr_t)hChildStdinWrDup, mode); + f1 = _fdopen(fd1, m2); + fd2 = _open_osfhandle((Py_intptr_t)hChildStdoutRdDup, mode); + f2 = _fdopen(fd2, m1); + fd3 = _open_osfhandle((Py_intptr_t)hChildStderrRdDup, mode); + f3 = _fdopen(fd3, m1); + p1 = PyFile_FromFile(f1, cmdstring, m2, _PyPclose); + p2 = PyFile_FromFile(f2, cmdstring, m1, _PyPclose); + p3 = PyFile_FromFile(f3, cmdstring, m1, _PyPclose); + PyFile_SetBufSize(p1, 0); + PyFile_SetBufSize(p2, 0); + PyFile_SetBufSize(p3, 0); + f = PyTuple_Pack(3,p1,p2,p3); + Py_XDECREF(p1); + Py_XDECREF(p2); + Py_XDECREF(p3); + file_count = 3; + break; + } + } + + if (n == POPEN_4) { + if (!_PyPopenCreateProcess(cmdstring, + hChildStdinRd, + hChildStdoutWr, + hChildStdoutWr, + &hProcess)) + return NULL; + } + else { + if (!_PyPopenCreateProcess(cmdstring, + hChildStdinRd, + hChildStdoutWr, + hChildStderrWr, + &hProcess)) + return NULL; + } + + /* + * Insert the files we've created into the process dictionary + * all referencing the list with the process handle and the + * initial number of files (see description below in _PyPclose). + * Since if _PyPclose later tried to wait on a process when all + * handles weren't closed, it could create a deadlock with the + * child, we spend some energy here to try to ensure that we + * either insert all file handles into the dictionary or none + * at all. It's a little clumsy with the various popen modes + * and variable number of files involved. + */ + if (!_PyPopenProcs) { + _PyPopenProcs = PyDict_New(); + } + + if (_PyPopenProcs) { + PyObject *procObj, *hProcessObj, *intObj, *fileObj[3]; + int ins_rc[3]; + + fileObj[0] = fileObj[1] = fileObj[2] = NULL; + ins_rc[0] = ins_rc[1] = ins_rc[2] = 0; + + procObj = PyList_New(2); + hProcessObj = PyLong_FromVoidPtr(hProcess); + intObj = PyInt_FromLong(file_count); + + if (procObj && hProcessObj && intObj) { + PyList_SetItem(procObj,0,hProcessObj); + PyList_SetItem(procObj,1,intObj); + + fileObj[0] = PyLong_FromVoidPtr(f1); + if (fileObj[0]) { + ins_rc[0] = PyDict_SetItem(_PyPopenProcs, + fileObj[0], + procObj); + } + if (file_count >= 2) { + fileObj[1] = PyLong_FromVoidPtr(f2); + if (fileObj[1]) { + ins_rc[1] = PyDict_SetItem(_PyPopenProcs, + fileObj[1], + procObj); + } + } + if (file_count >= 3) { + fileObj[2] = PyLong_FromVoidPtr(f3); + if (fileObj[2]) { + ins_rc[2] = PyDict_SetItem(_PyPopenProcs, + fileObj[2], + procObj); + } + } + + if (ins_rc[0] < 0 || !fileObj[0] || + ins_rc[1] < 0 || (file_count > 1 && !fileObj[1]) || + ins_rc[2] < 0 || (file_count > 2 && !fileObj[2])) { + /* Something failed - remove any dictionary + * entries that did make it. + */ + if (!ins_rc[0] && fileObj[0]) { + PyDict_DelItem(_PyPopenProcs, + fileObj[0]); + } + if (!ins_rc[1] && fileObj[1]) { + PyDict_DelItem(_PyPopenProcs, + fileObj[1]); + } + if (!ins_rc[2] && fileObj[2]) { + PyDict_DelItem(_PyPopenProcs, + fileObj[2]); + } + } + } + + /* + * Clean up our localized references for the dictionary keys + * and value since PyDict_SetItem will Py_INCREF any copies + * that got placed in the dictionary. + */ + Py_XDECREF(procObj); + Py_XDECREF(fileObj[0]); + Py_XDECREF(fileObj[1]); + Py_XDECREF(fileObj[2]); + } + + /* Child is launched. Close the parents copy of those pipe + * handles that only the child should have open. You need to + * make sure that no handles to the write end of the output pipe + * are maintained in this process or else the pipe will not close + * when the child process exits and the ReadFile will hang. */ + + if (!CloseHandle(hChildStdinRd)) + return win32_error("CloseHandle", NULL); + + if (!CloseHandle(hChildStdoutWr)) + return win32_error("CloseHandle", NULL); + + if ((n != 4) && (!CloseHandle(hChildStderrWr))) + return win32_error("CloseHandle", NULL); + + return f; +} + +/* + * Wrapper for fclose() to use for popen* files, so we can retrieve the + * exit code for the child process and return as a result of the close. + * + * This function uses the _PyPopenProcs dictionary in order to map the + * input file pointer to information about the process that was + * originally created by the popen* call that created the file pointer. + * The dictionary uses the file pointer as a key (with one entry + * inserted for each file returned by the original popen* call) and a + * single list object as the value for all files from a single call. + * The list object contains the Win32 process handle at [0], and a file + * count at [1], which is initialized to the total number of file + * handles using that list. + * + * This function closes whichever handle it is passed, and decrements + * the file count in the dictionary for the process handle pointed to + * by this file. On the last close (when the file count reaches zero), + * this function will wait for the child process and then return its + * exit code as the result of the close() operation. This permits the + * files to be closed in any order - it is always the close() of the + * final handle that will return the exit code. + * + * NOTE: This function is currently called with the GIL released. + * hence we use the GILState API to manage our state. + */ + +static int _PyPclose(FILE *file) +{ + int result; + DWORD exit_code; + HANDLE hProcess; + PyObject *procObj, *hProcessObj, *intObj, *fileObj; + long file_count; +#ifdef WITH_THREAD + PyGILState_STATE state; +#endif + + /* Close the file handle first, to ensure it can't block the + * child from exiting if it's the last handle. + */ + result = fclose(file); +#ifdef WITH_THREAD + state = PyGILState_Ensure(); +#endif + if (_PyPopenProcs) { + if ((fileObj = PyLong_FromVoidPtr(file)) != NULL && + (procObj = PyDict_GetItem(_PyPopenProcs, + fileObj)) != NULL && + (hProcessObj = PyList_GetItem(procObj,0)) != NULL && + (intObj = PyList_GetItem(procObj,1)) != NULL) { + + hProcess = PyLong_AsVoidPtr(hProcessObj); + file_count = PyInt_AsLong(intObj); + + if (file_count > 1) { + /* Still other files referencing process */ + file_count--; + PyList_SetItem(procObj,1, + PyInt_FromLong(file_count)); + } else { + /* Last file for this process */ + if (result != EOF && + WaitForSingleObject(hProcess, INFINITE) != WAIT_FAILED && + GetExitCodeProcess(hProcess, &exit_code)) { + /* Possible truncation here in 16-bit environments, but + * real exit codes are just the lower byte in any event. + */ + result = exit_code; + } else { + /* Indicate failure - this will cause the file object + * to raise an I/O error and translate the last Win32 + * error code from errno. We do have a problem with + * last errors that overlap the normal errno table, + * but that's a consistent problem with the file object. + */ + if (result != EOF) { + /* If the error wasn't from the fclose(), then + * set errno for the file object error handling. + */ + errno = GetLastError(); + } + result = -1; + } + + /* Free up the native handle at this point */ + CloseHandle(hProcess); + } + + /* Remove this file pointer from dictionary */ + PyDict_DelItem(_PyPopenProcs, fileObj); + + if (PyDict_Size(_PyPopenProcs) == 0) { + Py_DECREF(_PyPopenProcs); + _PyPopenProcs = NULL; + } + + } /* if object retrieval ok */ + + Py_XDECREF(fileObj); + } /* if _PyPopenProcs */ + +#ifdef WITH_THREAD + PyGILState_Release(state); +#endif + return result; +} + +#else /* which OS? */ +static PyObject * +posix_popen(PyObject *self, PyObject *args) +{ + char *name; + char *mode = "r"; + int bufsize = -1; + FILE *fp; + PyObject *f; + if (!PyArg_ParseTuple(args, "s|si:popen", &name, &mode, &bufsize)) + return NULL; + /* Strip mode of binary or text modifiers */ + if (strcmp(mode, "rb") == 0 || strcmp(mode, "rt") == 0) + mode = "r"; + else if (strcmp(mode, "wb") == 0 || strcmp(mode, "wt") == 0) + mode = "w"; + Py_BEGIN_ALLOW_THREADS + fp = popen(name, mode); + Py_END_ALLOW_THREADS + if (fp == NULL) + return posix_error(); + f = PyFile_FromFile(fp, name, mode, pclose); + if (f != NULL) + PyFile_SetBufSize(f, bufsize); + return f; +} + +#endif /* PYOS_??? */ +#endif /* HAVE_POPEN */ + + +#ifdef HAVE_SETUID +PyDoc_STRVAR(posix_setuid__doc__, +"setuid(uid)\n\n\ +Set the current process's user id."); + +static PyObject * +posix_setuid(PyObject *self, PyObject *args) +{ + long uid_arg; + uid_t uid; + if (!PyArg_ParseTuple(args, "l:setuid", &uid_arg)) + return NULL; + uid = uid_arg; + if (uid != uid_arg) { + PyErr_SetString(PyExc_OverflowError, "user id too big"); + return NULL; + } + if (setuid(uid) < 0) + return posix_error(); + Py_INCREF(Py_None); + return Py_None; +} +#endif /* HAVE_SETUID */ + + +#ifdef HAVE_SETEUID +PyDoc_STRVAR(posix_seteuid__doc__, +"seteuid(uid)\n\n\ +Set the current process's effective user id."); + +static PyObject * +posix_seteuid (PyObject *self, PyObject *args) +{ + long euid_arg; + uid_t euid; + if (!PyArg_ParseTuple(args, "l", &euid_arg)) + return NULL; + euid = euid_arg; + if (euid != euid_arg) { + PyErr_SetString(PyExc_OverflowError, "user id too big"); + return NULL; + } + if (seteuid(euid) < 0) { + return posix_error(); + } else { + Py_INCREF(Py_None); + return Py_None; + } +} +#endif /* HAVE_SETEUID */ + +#ifdef HAVE_SETEGID +PyDoc_STRVAR(posix_setegid__doc__, +"setegid(gid)\n\n\ +Set the current process's effective group id."); + +static PyObject * +posix_setegid (PyObject *self, PyObject *args) +{ + long egid_arg; + gid_t egid; + if (!PyArg_ParseTuple(args, "l", &egid_arg)) + return NULL; + egid = egid_arg; + if (egid != egid_arg) { + PyErr_SetString(PyExc_OverflowError, "group id too big"); + return NULL; + } + if (setegid(egid) < 0) { + return posix_error(); + } else { + Py_INCREF(Py_None); + return Py_None; + } +} +#endif /* HAVE_SETEGID */ + +#ifdef HAVE_SETREUID +PyDoc_STRVAR(posix_setreuid__doc__, +"setreuid(ruid, euid)\n\n\ +Set the current process's real and effective user ids."); + +static PyObject * +posix_setreuid (PyObject *self, PyObject *args) +{ + long ruid_arg, euid_arg; + uid_t ruid, euid; + if (!PyArg_ParseTuple(args, "ll", &ruid_arg, &euid_arg)) + return NULL; + if (ruid_arg == -1) + ruid = (uid_t)-1; /* let the compiler choose how -1 fits */ + else + ruid = ruid_arg; /* otherwise, assign from our long */ + if (euid_arg == -1) + euid = (uid_t)-1; + else + euid = euid_arg; + if ((euid_arg != -1 && euid != euid_arg) || + (ruid_arg != -1 && ruid != ruid_arg)) { + PyErr_SetString(PyExc_OverflowError, "user id too big"); + return NULL; + } + if (setreuid(ruid, euid) < 0) { + return posix_error(); + } else { + Py_INCREF(Py_None); + return Py_None; + } +} +#endif /* HAVE_SETREUID */ + +#ifdef HAVE_SETREGID +PyDoc_STRVAR(posix_setregid__doc__, +"setregid(rgid, egid)\n\n\ +Set the current process's real and effective group ids."); + +static PyObject * +posix_setregid (PyObject *self, PyObject *args) +{ + long rgid_arg, egid_arg; + gid_t rgid, egid; + if (!PyArg_ParseTuple(args, "ll", &rgid_arg, &egid_arg)) + return NULL; + if (rgid_arg == -1) + rgid = (gid_t)-1; /* let the compiler choose how -1 fits */ + else + rgid = rgid_arg; /* otherwise, assign from our long */ + if (egid_arg == -1) + egid = (gid_t)-1; + else + egid = egid_arg; + if ((egid_arg != -1 && egid != egid_arg) || + (rgid_arg != -1 && rgid != rgid_arg)) { + PyErr_SetString(PyExc_OverflowError, "group id too big"); + return NULL; + } + if (setregid(rgid, egid) < 0) { + return posix_error(); + } else { + Py_INCREF(Py_None); + return Py_None; + } +} +#endif /* HAVE_SETREGID */ + +#ifdef HAVE_SETGID +PyDoc_STRVAR(posix_setgid__doc__, +"setgid(gid)\n\n\ +Set the current process's group id."); + +static PyObject * +posix_setgid(PyObject *self, PyObject *args) +{ + long gid_arg; + gid_t gid; + if (!PyArg_ParseTuple(args, "l:setgid", &gid_arg)) + return NULL; + gid = gid_arg; + if (gid != gid_arg) { + PyErr_SetString(PyExc_OverflowError, "group id too big"); + return NULL; + } + if (setgid(gid) < 0) + return posix_error(); + Py_INCREF(Py_None); + return Py_None; +} +#endif /* HAVE_SETGID */ + +#ifdef HAVE_SETGROUPS +PyDoc_STRVAR(posix_setgroups__doc__, +"setgroups(list)\n\n\ +Set the groups of the current process to list."); + +static PyObject * +posix_setgroups(PyObject *self, PyObject *groups) +{ + int i, len; + gid_t grouplist[MAX_GROUPS]; + + if (!PySequence_Check(groups)) { + PyErr_SetString(PyExc_TypeError, "setgroups argument must be a sequence"); + return NULL; + } + len = PySequence_Size(groups); + if (len > MAX_GROUPS) { + PyErr_SetString(PyExc_ValueError, "too many groups"); + return NULL; + } + for(i = 0; i < len; i++) { + PyObject *elem; + elem = PySequence_GetItem(groups, i); + if (!elem) + return NULL; + if (!PyInt_Check(elem)) { + if (!PyLong_Check(elem)) { + PyErr_SetString(PyExc_TypeError, + "groups must be integers"); + Py_DECREF(elem); + return NULL; + } else { + unsigned long x = PyLong_AsUnsignedLong(elem); + if (PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "group id too big"); + Py_DECREF(elem); + return NULL; + } + grouplist[i] = x; + /* read back to see if it fits in gid_t */ + if (grouplist[i] != x) { + PyErr_SetString(PyExc_TypeError, + "group id too big"); + Py_DECREF(elem); + return NULL; + } + } + } else { + long x = PyInt_AsLong(elem); + grouplist[i] = x; + if (grouplist[i] != x) { + PyErr_SetString(PyExc_TypeError, + "group id too big"); + Py_DECREF(elem); + return NULL; + } + } + Py_DECREF(elem); + } + + if (setgroups(len, grouplist) < 0) + return posix_error(); + Py_INCREF(Py_None); + return Py_None; +} +#endif /* HAVE_SETGROUPS */ + +#if defined(HAVE_WAIT3) || defined(HAVE_WAIT4) +static PyObject * +wait_helper(pid_t pid, int status, struct rusage *ru) +{ + PyObject *result; + static PyObject *struct_rusage; + + if (pid == -1) + return posix_error(); + + if (struct_rusage == NULL) { + PyObject *m = PyImport_ImportModuleNoBlock("resource"); + if (m == NULL) + return NULL; + struct_rusage = PyObject_GetAttrString(m, "struct_rusage"); + Py_DECREF(m); + if (struct_rusage == NULL) + return NULL; + } + + /* XXX(nnorwitz): Copied (w/mods) from resource.c, there should be only one. */ + result = PyStructSequence_New((PyTypeObject*) struct_rusage); + if (!result) + return NULL; + +#ifndef doubletime +#define doubletime(TV) ((double)(TV).tv_sec + (TV).tv_usec * 0.000001) +#endif + + PyStructSequence_SET_ITEM(result, 0, + PyFloat_FromDouble(doubletime(ru->ru_utime))); + PyStructSequence_SET_ITEM(result, 1, + PyFloat_FromDouble(doubletime(ru->ru_stime))); +#define SET_INT(result, index, value)\ + PyStructSequence_SET_ITEM(result, index, PyInt_FromLong(value)) + SET_INT(result, 2, ru->ru_maxrss); + SET_INT(result, 3, ru->ru_ixrss); + SET_INT(result, 4, ru->ru_idrss); + SET_INT(result, 5, ru->ru_isrss); + SET_INT(result, 6, ru->ru_minflt); + SET_INT(result, 7, ru->ru_majflt); + SET_INT(result, 8, ru->ru_nswap); + SET_INT(result, 9, ru->ru_inblock); + SET_INT(result, 10, ru->ru_oublock); + SET_INT(result, 11, ru->ru_msgsnd); + SET_INT(result, 12, ru->ru_msgrcv); + SET_INT(result, 13, ru->ru_nsignals); + SET_INT(result, 14, ru->ru_nvcsw); + SET_INT(result, 15, ru->ru_nivcsw); +#undef SET_INT + + if (PyErr_Occurred()) { + Py_DECREF(result); + return NULL; + } + + return Py_BuildValue("NiN", PyLong_FromPid(pid), status, result); +} +#endif /* HAVE_WAIT3 || HAVE_WAIT4 */ + +#ifdef HAVE_WAIT3 +PyDoc_STRVAR(posix_wait3__doc__, +"wait3(options) -> (pid, status, rusage)\n\n\ +Wait for completion of a child process."); + +static PyObject * +posix_wait3(PyObject *self, PyObject *args) +{ + pid_t pid; + int options; + struct rusage ru; + WAIT_TYPE status; + WAIT_STATUS_INT(status) = 0; + + if (!PyArg_ParseTuple(args, "i:wait3", &options)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + pid = wait3(&status, options, &ru); + Py_END_ALLOW_THREADS + + return wait_helper(pid, WAIT_STATUS_INT(status), &ru); +} +#endif /* HAVE_WAIT3 */ + +#ifdef HAVE_WAIT4 +PyDoc_STRVAR(posix_wait4__doc__, +"wait4(pid, options) -> (pid, status, rusage)\n\n\ +Wait for completion of a given child process."); + +static PyObject * +posix_wait4(PyObject *self, PyObject *args) +{ + pid_t pid; + int options; + struct rusage ru; + WAIT_TYPE status; + WAIT_STATUS_INT(status) = 0; + + if (!PyArg_ParseTuple(args, PARSE_PID "i:wait4", &pid, &options)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + pid = wait4(pid, &status, options, &ru); + Py_END_ALLOW_THREADS + + return wait_helper(pid, WAIT_STATUS_INT(status), &ru); +} +#endif /* HAVE_WAIT4 */ + +#ifdef HAVE_WAITPID +PyDoc_STRVAR(posix_waitpid__doc__, +"waitpid(pid, options) -> (pid, status)\n\n\ +Wait for completion of a given child process."); + +static PyObject * +posix_waitpid(PyObject *self, PyObject *args) +{ + pid_t pid; + int options; + WAIT_TYPE status; + WAIT_STATUS_INT(status) = 0; + + if (!PyArg_ParseTuple(args, PARSE_PID "i:waitpid", &pid, &options)) + return NULL; + Py_BEGIN_ALLOW_THREADS + pid = waitpid(pid, &status, options); + Py_END_ALLOW_THREADS + if (pid == -1) + return posix_error(); + + return Py_BuildValue("Ni", PyLong_FromPid(pid), WAIT_STATUS_INT(status)); +} + +#elif defined(HAVE_CWAIT) + +/* MS C has a variant of waitpid() that's usable for most purposes. */ +PyDoc_STRVAR(posix_waitpid__doc__, +"waitpid(pid, options) -> (pid, status << 8)\n\n" +"Wait for completion of a given process. options is ignored on Windows."); + +static PyObject * +posix_waitpid(PyObject *self, PyObject *args) +{ + Py_intptr_t pid; + int status, options; + + if (!PyArg_ParseTuple(args, PARSE_PID "i:waitpid", &pid, &options)) + return NULL; + Py_BEGIN_ALLOW_THREADS + pid = _cwait(&status, pid, options); + Py_END_ALLOW_THREADS + if (pid == -1) + return posix_error(); + + /* shift the status left a byte so this is more like the POSIX waitpid */ + return Py_BuildValue("Ni", PyLong_FromPid(pid), status << 8); +} +#endif /* HAVE_WAITPID || HAVE_CWAIT */ + +#ifdef HAVE_WAIT +PyDoc_STRVAR(posix_wait__doc__, +"wait() -> (pid, status)\n\n\ +Wait for completion of a child process."); + +static PyObject * +posix_wait(PyObject *self, PyObject *noargs) +{ + pid_t pid; + WAIT_TYPE status; + WAIT_STATUS_INT(status) = 0; + + Py_BEGIN_ALLOW_THREADS + pid = wait(&status); + Py_END_ALLOW_THREADS + if (pid == -1) + return posix_error(); + + return Py_BuildValue("Ni", PyLong_FromPid(pid), WAIT_STATUS_INT(status)); +} +#endif + + +PyDoc_STRVAR(posix_lstat__doc__, +"lstat(path) -> stat result\n\n\ +Like stat(path), but do not follow symbolic links."); + +static PyObject * +posix_lstat(PyObject *self, PyObject *args) +{ +#ifdef HAVE_LSTAT + return posix_do_stat(self, args, "et:lstat", lstat, NULL, NULL); +#else /* !HAVE_LSTAT */ +#ifdef MS_WINDOWS + return posix_do_stat(self, args, "et:lstat", STAT, "U:lstat", win32_wstat); +#else + return posix_do_stat(self, args, "et:lstat", STAT, NULL, NULL); +#endif +#endif /* !HAVE_LSTAT */ +} + + +#ifdef HAVE_READLINK +PyDoc_STRVAR(posix_readlink__doc__, +"readlink(path) -> path\n\n\ +Return a string representing the path to which the symbolic link points."); + +static PyObject * +posix_readlink(PyObject *self, PyObject *args) +{ + PyObject* v; + char buf[MAXPATHLEN]; + char *path; + int n; +#ifdef Py_USING_UNICODE + int arg_is_unicode = 0; +#endif + + if (!PyArg_ParseTuple(args, "et:readlink", + Py_FileSystemDefaultEncoding, &path)) + return NULL; +#ifdef Py_USING_UNICODE + v = PySequence_GetItem(args, 0); + if (v == NULL) { + PyMem_Free(path); + return NULL; + } + + if (PyUnicode_Check(v)) { + arg_is_unicode = 1; + } + Py_DECREF(v); +#endif + + Py_BEGIN_ALLOW_THREADS + n = readlink(path, buf, (int) sizeof buf); + Py_END_ALLOW_THREADS + if (n < 0) + return posix_error_with_allocated_filename(path); + + PyMem_Free(path); + v = PyString_FromStringAndSize(buf, n); +#ifdef Py_USING_UNICODE + if (arg_is_unicode) { + PyObject *w; + + w = PyUnicode_FromEncodedObject(v, + Py_FileSystemDefaultEncoding, + "strict"); + if (w != NULL) { + Py_DECREF(v); + v = w; + } + else { + /* fall back to the original byte string, as + discussed in patch #683592 */ + PyErr_Clear(); + } + } +#endif + return v; +} +#endif /* HAVE_READLINK */ + + +#ifdef HAVE_SYMLINK +PyDoc_STRVAR(posix_symlink__doc__, +"symlink(src, dst)\n\n\ +Create a symbolic link pointing to src named dst."); + +static PyObject * +posix_symlink(PyObject *self, PyObject *args) +{ + return posix_2str(args, "etet:symlink", symlink); +} +#endif /* HAVE_SYMLINK */ + + +#ifdef HAVE_TIMES +#if defined(PYCC_VACPP) && defined(PYOS_OS2) +static long +system_uptime(void) +{ + ULONG value = 0; + + Py_BEGIN_ALLOW_THREADS + DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &value, sizeof(value)); + Py_END_ALLOW_THREADS + + return value; +} + +static PyObject * +posix_times(PyObject *self, PyObject *noargs) +{ + /* Currently Only Uptime is Provided -- Others Later */ + return Py_BuildValue("ddddd", + (double)0 /* t.tms_utime / HZ */, + (double)0 /* t.tms_stime / HZ */, + (double)0 /* t.tms_cutime / HZ */, + (double)0 /* t.tms_cstime / HZ */, + (double)system_uptime() / 1000); +} +#else /* not OS2 */ +#define NEED_TICKS_PER_SECOND +static long ticks_per_second = -1; +static PyObject * +posix_times(PyObject *self, PyObject *noargs) +{ + struct tms t; + clock_t c; + errno = 0; + c = times(&t); + if (c == (clock_t) -1) + return posix_error(); + return Py_BuildValue("ddddd", + (double)t.tms_utime / ticks_per_second, + (double)t.tms_stime / ticks_per_second, + (double)t.tms_cutime / ticks_per_second, + (double)t.tms_cstime / ticks_per_second, + (double)c / ticks_per_second); +} +#endif /* not OS2 */ +#endif /* HAVE_TIMES */ + + +#ifdef MS_WINDOWS +#define HAVE_TIMES /* so the method table will pick it up */ +static PyObject * +posix_times(PyObject *self, PyObject *noargs) +{ + FILETIME create, exit, kernel, user; + HANDLE hProc; + hProc = GetCurrentProcess(); + GetProcessTimes(hProc, &create, &exit, &kernel, &user); + /* The fields of a FILETIME structure are the hi and lo part + of a 64-bit value expressed in 100 nanosecond units. + 1e7 is one second in such units; 1e-7 the inverse. + 429.4967296 is 2**32 / 1e7 or 2**32 * 1e-7. + */ + return Py_BuildValue( + "ddddd", + (double)(user.dwHighDateTime*429.4967296 + + user.dwLowDateTime*1e-7), + (double)(kernel.dwHighDateTime*429.4967296 + + kernel.dwLowDateTime*1e-7), + (double)0, + (double)0, + (double)0); +} +#endif /* MS_WINDOWS */ + +#ifdef HAVE_TIMES +PyDoc_STRVAR(posix_times__doc__, +"times() -> (utime, stime, cutime, cstime, elapsed_time)\n\n\ +Return a tuple of floating point numbers indicating process times."); +#endif + + +#ifdef HAVE_GETSID +PyDoc_STRVAR(posix_getsid__doc__, +"getsid(pid) -> sid\n\n\ +Call the system call getsid()."); + +static PyObject * +posix_getsid(PyObject *self, PyObject *args) +{ + pid_t pid; + int sid; + if (!PyArg_ParseTuple(args, PARSE_PID ":getsid", &pid)) + return NULL; + sid = getsid(pid); + if (sid < 0) + return posix_error(); + return PyInt_FromLong((long)sid); +} +#endif /* HAVE_GETSID */ + + +#ifdef HAVE_SETSID +PyDoc_STRVAR(posix_setsid__doc__, +"setsid()\n\n\ +Call the system call setsid()."); + +static PyObject * +posix_setsid(PyObject *self, PyObject *noargs) +{ + if (setsid() < 0) + return posix_error(); + Py_INCREF(Py_None); + return Py_None; +} +#endif /* HAVE_SETSID */ + +#ifdef HAVE_SETPGID +PyDoc_STRVAR(posix_setpgid__doc__, +"setpgid(pid, pgrp)\n\n\ +Call the system call setpgid()."); + +static PyObject * +posix_setpgid(PyObject *self, PyObject *args) +{ + pid_t pid; + int pgrp; + if (!PyArg_ParseTuple(args, PARSE_PID "i:setpgid", &pid, &pgrp)) + return NULL; + if (setpgid(pid, pgrp) < 0) + return posix_error(); + Py_INCREF(Py_None); + return Py_None; +} +#endif /* HAVE_SETPGID */ + + +#ifdef HAVE_TCGETPGRP +PyDoc_STRVAR(posix_tcgetpgrp__doc__, +"tcgetpgrp(fd) -> pgid\n\n\ +Return the process group associated with the terminal given by a fd."); + +static PyObject * +posix_tcgetpgrp(PyObject *self, PyObject *args) +{ + int fd; + pid_t pgid; + if (!PyArg_ParseTuple(args, "i:tcgetpgrp", &fd)) + return NULL; + pgid = tcgetpgrp(fd); + if (pgid < 0) + return posix_error(); + return PyLong_FromPid(pgid); +} +#endif /* HAVE_TCGETPGRP */ + + +#ifdef HAVE_TCSETPGRP +PyDoc_STRVAR(posix_tcsetpgrp__doc__, +"tcsetpgrp(fd, pgid)\n\n\ +Set the process group associated with the terminal given by a fd."); + +static PyObject * +posix_tcsetpgrp(PyObject *self, PyObject *args) +{ + int fd; + pid_t pgid; + if (!PyArg_ParseTuple(args, "i" PARSE_PID ":tcsetpgrp", &fd, &pgid)) + return NULL; + if (tcsetpgrp(fd, pgid) < 0) + return posix_error(); + Py_INCREF(Py_None); + return Py_None; +} +#endif /* HAVE_TCSETPGRP */ + +/* Functions acting on file descriptors */ + +PyDoc_STRVAR(posix_open__doc__, +"open(filename, flag [, mode=0777]) -> fd\n\n\ +Open a file (for low level IO)."); + +static PyObject * +posix_open(PyObject *self, PyObject *args) +{ + char *file = NULL; + int flag; + int mode = 0777; + int fd; + +#ifdef MS_WINDOWS + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, "Ui|i:mkdir", &po, &flag, &mode)) { + Py_BEGIN_ALLOW_THREADS + /* PyUnicode_AS_UNICODE OK without thread + lock as it is a simple dereference. */ + fd = _wopen(PyUnicode_AS_UNICODE(po), flag, mode); + Py_END_ALLOW_THREADS + if (fd < 0) + return posix_error(); + return PyInt_FromLong((long)fd); + } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); +#endif + + if (!PyArg_ParseTuple(args, "eti|i", + Py_FileSystemDefaultEncoding, &file, + &flag, &mode)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + fd = open(file, flag, mode); + Py_END_ALLOW_THREADS + if (fd < 0) + return posix_error_with_allocated_filename(file); + PyMem_Free(file); + return PyInt_FromLong((long)fd); +} + + +PyDoc_STRVAR(posix_close__doc__, +"close(fd)\n\n\ +Close a file descriptor (for low level IO)."); + +static PyObject * +posix_close(PyObject *self, PyObject *args) +{ + int fd, res; + if (!PyArg_ParseTuple(args, "i:close", &fd)) + return NULL; + if (!_PyVerify_fd(fd)) + return posix_error(); + Py_BEGIN_ALLOW_THREADS + res = close(fd); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error(); + Py_INCREF(Py_None); + return Py_None; +} + + +PyDoc_STRVAR(posix_closerange__doc__, +"closerange(fd_low, fd_high)\n\n\ +Closes all file descriptors in [fd_low, fd_high), ignoring errors."); + +static PyObject * +posix_closerange(PyObject *self, PyObject *args) +{ + int fd_from, fd_to, i; + if (!PyArg_ParseTuple(args, "ii:closerange", &fd_from, &fd_to)) + return NULL; + Py_BEGIN_ALLOW_THREADS + for (i = fd_from; i < fd_to; i++) + if (_PyVerify_fd(i)) + close(i); + Py_END_ALLOW_THREADS + Py_RETURN_NONE; +} + + +PyDoc_STRVAR(posix_dup__doc__, +"dup(fd) -> fd2\n\n\ +Return a duplicate of a file descriptor."); + +static PyObject * +posix_dup(PyObject *self, PyObject *args) +{ + int fd; + if (!PyArg_ParseTuple(args, "i:dup", &fd)) + return NULL; + if (!_PyVerify_fd(fd)) + return posix_error(); + Py_BEGIN_ALLOW_THREADS + fd = dup(fd); + Py_END_ALLOW_THREADS + if (fd < 0) + return posix_error(); + return PyInt_FromLong((long)fd); +} + + +PyDoc_STRVAR(posix_dup2__doc__, +"dup2(old_fd, new_fd)\n\n\ +Duplicate file descriptor."); + +static PyObject * +posix_dup2(PyObject *self, PyObject *args) +{ + int fd, fd2, res; + if (!PyArg_ParseTuple(args, "ii:dup2", &fd, &fd2)) + return NULL; + if (!_PyVerify_fd_dup2(fd, fd2)) + return posix_error(); + Py_BEGIN_ALLOW_THREADS + res = dup2(fd, fd2); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error(); + Py_INCREF(Py_None); + return Py_None; +} + + +PyDoc_STRVAR(posix_lseek__doc__, +"lseek(fd, pos, how) -> newpos\n\n\ +Set the current position of a file descriptor."); + +static PyObject * +posix_lseek(PyObject *self, PyObject *args) +{ + int fd, how; +#if defined(MS_WIN64) || defined(MS_WINDOWS) + PY_LONG_LONG pos, res; +#else + off_t pos, res; +#endif + PyObject *posobj; + if (!PyArg_ParseTuple(args, "iOi:lseek", &fd, &posobj, &how)) + return NULL; +#ifdef SEEK_SET + /* Turn 0, 1, 2 into SEEK_{SET,CUR,END} */ + switch (how) { + case 0: how = SEEK_SET; break; + case 1: how = SEEK_CUR; break; + case 2: how = SEEK_END; break; + } +#endif /* SEEK_END */ + +#if !defined(HAVE_LARGEFILE_SUPPORT) + pos = PyInt_AsLong(posobj); +#else + pos = PyLong_Check(posobj) ? + PyLong_AsLongLong(posobj) : PyInt_AsLong(posobj); +#endif + if (PyErr_Occurred()) + return NULL; + + if (!_PyVerify_fd(fd)) + return posix_error(); + Py_BEGIN_ALLOW_THREADS +#if defined(MS_WIN64) || defined(MS_WINDOWS) + res = _lseeki64(fd, pos, how); +#else + res = lseek(fd, pos, how); +#endif + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error(); + +#if !defined(HAVE_LARGEFILE_SUPPORT) + return PyInt_FromLong(res); +#else + return PyLong_FromLongLong(res); +#endif +} + + +PyDoc_STRVAR(posix_read__doc__, +"read(fd, buffersize) -> string\n\n\ +Read a file descriptor."); + +static PyObject * +posix_read(PyObject *self, PyObject *args) +{ + int fd, size, n; + PyObject *buffer; + if (!PyArg_ParseTuple(args, "ii:read", &fd, &size)) + return NULL; + if (size < 0) { + errno = EINVAL; + return posix_error(); + } + buffer = PyString_FromStringAndSize((char *)NULL, size); + if (buffer == NULL) + return NULL; + if (!_PyVerify_fd(fd)) { + Py_DECREF(buffer); + return posix_error(); + } + Py_BEGIN_ALLOW_THREADS + n = read(fd, PyString_AsString(buffer), size); + Py_END_ALLOW_THREADS + if (n < 0) { + Py_DECREF(buffer); + return posix_error(); + } + if (n != size) + _PyString_Resize(&buffer, n); + return buffer; +} + + +PyDoc_STRVAR(posix_write__doc__, +"write(fd, string) -> byteswritten\n\n\ +Write a string to a file descriptor."); + +static PyObject * +posix_write(PyObject *self, PyObject *args) +{ + Py_buffer pbuf; + int fd; + Py_ssize_t size; + + if (!PyArg_ParseTuple(args, "is*:write", &fd, &pbuf)) + return NULL; + if (!_PyVerify_fd(fd)) { + PyBuffer_Release(&pbuf); + return posix_error(); + } + Py_BEGIN_ALLOW_THREADS + size = write(fd, pbuf.buf, (size_t)pbuf.len); + Py_END_ALLOW_THREADS + PyBuffer_Release(&pbuf); + if (size < 0) + return posix_error(); + return PyInt_FromSsize_t(size); +} + + +PyDoc_STRVAR(posix_fstat__doc__, +"fstat(fd) -> stat result\n\n\ +Like stat(), but for an open file descriptor."); + +static PyObject * +posix_fstat(PyObject *self, PyObject *args) +{ + int fd; + STRUCT_STAT st; + int res; + if (!PyArg_ParseTuple(args, "i:fstat", &fd)) + return NULL; +#ifdef __VMS + /* on OpenVMS we must ensure that all bytes are written to the file */ + fsync(fd); +#endif + if (!_PyVerify_fd(fd)) + return posix_error(); + Py_BEGIN_ALLOW_THREADS + res = FSTAT(fd, &st); + Py_END_ALLOW_THREADS + if (res != 0) { +#ifdef MS_WINDOWS + return win32_error("fstat", NULL); +#else + return posix_error(); +#endif + } + + return _pystat_fromstructstat(&st); +} + + +PyDoc_STRVAR(posix_fdopen__doc__, +"fdopen(fd [, mode='r' [, bufsize]]) -> file_object\n\n\ +Return an open file object connected to a file descriptor."); + +static PyObject * +posix_fdopen(PyObject *self, PyObject *args) +{ + int fd; + char *orgmode = "r"; + int bufsize = -1; + FILE *fp; + PyObject *f; + char *mode; + if (!PyArg_ParseTuple(args, "i|si", &fd, &orgmode, &bufsize)) + return NULL; + + /* Sanitize mode. See fileobject.c */ + mode = PyMem_MALLOC(strlen(orgmode)+3); + if (!mode) { + PyErr_NoMemory(); + return NULL; + } + strcpy(mode, orgmode); + if (_PyFile_SanitizeMode(mode)) { + PyMem_FREE(mode); + return NULL; + } + if (!_PyVerify_fd(fd)) + return posix_error(); + Py_BEGIN_ALLOW_THREADS +#if !defined(MS_WINDOWS) && defined(HAVE_FCNTL_H) + if (mode[0] == 'a') { + /* try to make sure the O_APPEND flag is set */ + int flags; + flags = fcntl(fd, F_GETFL); + if (flags != -1) + fcntl(fd, F_SETFL, flags | O_APPEND); + fp = fdopen(fd, mode); + if (fp == NULL && flags != -1) + /* restore old mode if fdopen failed */ + fcntl(fd, F_SETFL, flags); + } else { + fp = fdopen(fd, mode); + } +#else + fp = fdopen(fd, mode); +#endif + Py_END_ALLOW_THREADS + PyMem_FREE(mode); + if (fp == NULL) + return posix_error(); + f = PyFile_FromFile(fp, "<fdopen>", orgmode, fclose); + if (f != NULL) + PyFile_SetBufSize(f, bufsize); + return f; +} + +PyDoc_STRVAR(posix_isatty__doc__, +"isatty(fd) -> bool\n\n\ +Return True if the file descriptor 'fd' is an open file descriptor\n\ +connected to the slave end of a terminal."); + +static PyObject * +posix_isatty(PyObject *self, PyObject *args) +{ + int fd; + if (!PyArg_ParseTuple(args, "i:isatty", &fd)) + return NULL; + if (!_PyVerify_fd(fd)) + return PyBool_FromLong(0); + return PyBool_FromLong(isatty(fd)); +} + +#ifdef HAVE_PIPE +PyDoc_STRVAR(posix_pipe__doc__, +"pipe() -> (read_end, write_end)\n\n\ +Create a pipe."); + +static PyObject * +posix_pipe(PyObject *self, PyObject *noargs) +{ +#if defined(PYOS_OS2) + HFILE read, write; + APIRET rc; + + Py_BEGIN_ALLOW_THREADS + rc = DosCreatePipe( &read, &write, 4096); + Py_END_ALLOW_THREADS + if (rc != NO_ERROR) + return os2_error(rc); + + return Py_BuildValue("(ii)", read, write); +#else +#if !defined(MS_WINDOWS) + int fds[2]; + int res; + Py_BEGIN_ALLOW_THREADS + res = pipe(fds); + Py_END_ALLOW_THREADS + if (res != 0) + return posix_error(); + return Py_BuildValue("(ii)", fds[0], fds[1]); +#else /* MS_WINDOWS */ + HANDLE read, write; + int read_fd, write_fd; + BOOL ok; + Py_BEGIN_ALLOW_THREADS + ok = CreatePipe(&read, &write, NULL, 0); + Py_END_ALLOW_THREADS + if (!ok) + return win32_error("CreatePipe", NULL); + read_fd = _open_osfhandle((Py_intptr_t)read, 0); + write_fd = _open_osfhandle((Py_intptr_t)write, 1); + return Py_BuildValue("(ii)", read_fd, write_fd); +#endif /* MS_WINDOWS */ +#endif +} +#endif /* HAVE_PIPE */ + + +#ifdef HAVE_MKFIFO +PyDoc_STRVAR(posix_mkfifo__doc__, +"mkfifo(filename [, mode=0666])\n\n\ +Create a FIFO (a POSIX named pipe)."); + +static PyObject * +posix_mkfifo(PyObject *self, PyObject *args) +{ + char *filename; + int mode = 0666; + int res; + if (!PyArg_ParseTuple(args, "s|i:mkfifo", &filename, &mode)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = mkfifo(filename, mode); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error(); + Py_INCREF(Py_None); + return Py_None; +} +#endif + + +#if defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV) +PyDoc_STRVAR(posix_mknod__doc__, +"mknod(filename [, mode=0600, device])\n\n\ +Create a filesystem node (file, device special file or named pipe)\n\ +named filename. mode specifies both the permissions to use and the\n\ +type of node to be created, being combined (bitwise OR) with one of\n\ +S_IFREG, S_IFCHR, S_IFBLK, and S_IFIFO. For S_IFCHR and S_IFBLK,\n\ +device defines the newly created device special file (probably using\n\ +os.makedev()), otherwise it is ignored."); + + +static PyObject * +posix_mknod(PyObject *self, PyObject *args) +{ + char *filename; + int mode = 0600; + int device = 0; + int res; + if (!PyArg_ParseTuple(args, "s|ii:mknod", &filename, &mode, &device)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = mknod(filename, mode, device); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error(); + Py_INCREF(Py_None); + return Py_None; +} +#endif + +#ifdef HAVE_DEVICE_MACROS +PyDoc_STRVAR(posix_major__doc__, +"major(device) -> major number\n\ +Extracts a device major number from a raw device number."); + +static PyObject * +posix_major(PyObject *self, PyObject *args) +{ + int device; + if (!PyArg_ParseTuple(args, "i:major", &device)) + return NULL; + return PyInt_FromLong((long)major(device)); +} + +PyDoc_STRVAR(posix_minor__doc__, +"minor(device) -> minor number\n\ +Extracts a device minor number from a raw device number."); + +static PyObject * +posix_minor(PyObject *self, PyObject *args) +{ + int device; + if (!PyArg_ParseTuple(args, "i:minor", &device)) + return NULL; + return PyInt_FromLong((long)minor(device)); +} + +PyDoc_STRVAR(posix_makedev__doc__, +"makedev(major, minor) -> device number\n\ +Composes a raw device number from the major and minor device numbers."); + +static PyObject * +posix_makedev(PyObject *self, PyObject *args) +{ + int major, minor; + if (!PyArg_ParseTuple(args, "ii:makedev", &major, &minor)) + return NULL; + return PyInt_FromLong((long)makedev(major, minor)); +} +#endif /* device macros */ + + +#ifdef HAVE_FTRUNCATE +PyDoc_STRVAR(posix_ftruncate__doc__, +"ftruncate(fd, length)\n\n\ +Truncate a file to a specified length."); + +static PyObject * +posix_ftruncate(PyObject *self, PyObject *args) +{ + int fd; + off_t length; + int res; + PyObject *lenobj; + + if (!PyArg_ParseTuple(args, "iO:ftruncate", &fd, &lenobj)) + return NULL; + +#if !defined(HAVE_LARGEFILE_SUPPORT) + length = PyInt_AsLong(lenobj); +#else + length = PyLong_Check(lenobj) ? + PyLong_AsLongLong(lenobj) : PyInt_AsLong(lenobj); +#endif + if (PyErr_Occurred()) + return NULL; + + Py_BEGIN_ALLOW_THREADS + res = ftruncate(fd, length); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error(); + Py_INCREF(Py_None); + return Py_None; +} +#endif + +#ifdef HAVE_PUTENV +PyDoc_STRVAR(posix_putenv__doc__, +"putenv(key, value)\n\n\ +Change or add an environment variable."); + +/* Save putenv() parameters as values here, so we can collect them when they + * get re-set with another call for the same key. */ +static PyObject *posix_putenv_garbage; + +static PyObject * +posix_putenv(PyObject *self, PyObject *args) +{ + char *s1, *s2; + char *newenv; + PyObject *newstr; + size_t len; + + if (!PyArg_ParseTuple(args, "ss:putenv", &s1, &s2)) + return NULL; + +#if defined(PYOS_OS2) + if (stricmp(s1, "BEGINLIBPATH") == 0) { + APIRET rc; + + rc = DosSetExtLIBPATH(s2, BEGIN_LIBPATH); + if (rc != NO_ERROR) + return os2_error(rc); + + } else if (stricmp(s1, "ENDLIBPATH") == 0) { + APIRET rc; + + rc = DosSetExtLIBPATH(s2, END_LIBPATH); + if (rc != NO_ERROR) + return os2_error(rc); + } else { +#endif + + /* XXX This can leak memory -- not easy to fix :-( */ + len = strlen(s1) + strlen(s2) + 2; + /* len includes space for a trailing \0; the size arg to + PyString_FromStringAndSize does not count that */ + newstr = PyString_FromStringAndSize(NULL, (int)len - 1); + if (newstr == NULL) + return PyErr_NoMemory(); + newenv = PyString_AS_STRING(newstr); + PyOS_snprintf(newenv, len, "%s=%s", s1, s2); + if (putenv(newenv)) { + Py_DECREF(newstr); + posix_error(); + return NULL; + } + /* Install the first arg and newstr in posix_putenv_garbage; + * this will cause previous value to be collected. This has to + * happen after the real putenv() call because the old value + * was still accessible until then. */ + if (PyDict_SetItem(posix_putenv_garbage, + PyTuple_GET_ITEM(args, 0), newstr)) { + /* really not much we can do; just leak */ + PyErr_Clear(); + } + else { + Py_DECREF(newstr); + } + +#if defined(PYOS_OS2) + } +#endif + Py_INCREF(Py_None); + return Py_None; +} +#endif /* putenv */ + +#ifdef HAVE_UNSETENV +PyDoc_STRVAR(posix_unsetenv__doc__, +"unsetenv(key)\n\n\ +Delete an environment variable."); + +static PyObject * +posix_unsetenv(PyObject *self, PyObject *args) +{ + char *s1; + + if (!PyArg_ParseTuple(args, "s:unsetenv", &s1)) + return NULL; + + unsetenv(s1); + + /* Remove the key from posix_putenv_garbage; + * this will cause it to be collected. This has to + * happen after the real unsetenv() call because the + * old value was still accessible until then. + */ + if (PyDict_DelItem(posix_putenv_garbage, + PyTuple_GET_ITEM(args, 0))) { + /* really not much we can do; just leak */ + PyErr_Clear(); + } + + Py_INCREF(Py_None); + return Py_None; +} +#endif /* unsetenv */ + +PyDoc_STRVAR(posix_strerror__doc__, +"strerror(code) -> string\n\n\ +Translate an error code to a message string."); + +static PyObject * +posix_strerror(PyObject *self, PyObject *args) +{ + int code; + char *message; + if (!PyArg_ParseTuple(args, "i:strerror", &code)) + return NULL; + message = strerror(code); + if (message == NULL) { + PyErr_SetString(PyExc_ValueError, + "strerror() argument out of range"); + return NULL; + } + return PyString_FromString(message); +} + + +#ifdef HAVE_SYS_WAIT_H + +#ifdef WCOREDUMP +PyDoc_STRVAR(posix_WCOREDUMP__doc__, +"WCOREDUMP(status) -> bool\n\n\ +Return True if the process returning 'status' was dumped to a core file."); + +static PyObject * +posix_WCOREDUMP(PyObject *self, PyObject *args) +{ + WAIT_TYPE status; + WAIT_STATUS_INT(status) = 0; + + if (!PyArg_ParseTuple(args, "i:WCOREDUMP", &WAIT_STATUS_INT(status))) + return NULL; + + return PyBool_FromLong(WCOREDUMP(status)); +} +#endif /* WCOREDUMP */ + +#ifdef WIFCONTINUED +PyDoc_STRVAR(posix_WIFCONTINUED__doc__, +"WIFCONTINUED(status) -> bool\n\n\ +Return True if the process returning 'status' was continued from a\n\ +job control stop."); + +static PyObject * +posix_WIFCONTINUED(PyObject *self, PyObject *args) +{ + WAIT_TYPE status; + WAIT_STATUS_INT(status) = 0; + + if (!PyArg_ParseTuple(args, "i:WCONTINUED", &WAIT_STATUS_INT(status))) + return NULL; + + return PyBool_FromLong(WIFCONTINUED(status)); +} +#endif /* WIFCONTINUED */ + +#ifdef WIFSTOPPED +PyDoc_STRVAR(posix_WIFSTOPPED__doc__, +"WIFSTOPPED(status) -> bool\n\n\ +Return True if the process returning 'status' was stopped."); + +static PyObject * +posix_WIFSTOPPED(PyObject *self, PyObject *args) +{ + WAIT_TYPE status; + WAIT_STATUS_INT(status) = 0; + + if (!PyArg_ParseTuple(args, "i:WIFSTOPPED", &WAIT_STATUS_INT(status))) + return NULL; + + return PyBool_FromLong(WIFSTOPPED(status)); +} +#endif /* WIFSTOPPED */ + +#ifdef WIFSIGNALED +PyDoc_STRVAR(posix_WIFSIGNALED__doc__, +"WIFSIGNALED(status) -> bool\n\n\ +Return True if the process returning 'status' was terminated by a signal."); + +static PyObject * +posix_WIFSIGNALED(PyObject *self, PyObject *args) +{ + WAIT_TYPE status; + WAIT_STATUS_INT(status) = 0; + + if (!PyArg_ParseTuple(args, "i:WIFSIGNALED", &WAIT_STATUS_INT(status))) + return NULL; + + return PyBool_FromLong(WIFSIGNALED(status)); +} +#endif /* WIFSIGNALED */ + +#ifdef WIFEXITED +PyDoc_STRVAR(posix_WIFEXITED__doc__, +"WIFEXITED(status) -> bool\n\n\ +Return true if the process returning 'status' exited using the exit()\n\ +system call."); + +static PyObject * +posix_WIFEXITED(PyObject *self, PyObject *args) +{ + WAIT_TYPE status; + WAIT_STATUS_INT(status) = 0; + + if (!PyArg_ParseTuple(args, "i:WIFEXITED", &WAIT_STATUS_INT(status))) + return NULL; + + return PyBool_FromLong(WIFEXITED(status)); +} +#endif /* WIFEXITED */ + +#ifdef WEXITSTATUS +PyDoc_STRVAR(posix_WEXITSTATUS__doc__, +"WEXITSTATUS(status) -> integer\n\n\ +Return the process return code from 'status'."); + +static PyObject * +posix_WEXITSTATUS(PyObject *self, PyObject *args) +{ + WAIT_TYPE status; + WAIT_STATUS_INT(status) = 0; + + if (!PyArg_ParseTuple(args, "i:WEXITSTATUS", &WAIT_STATUS_INT(status))) + return NULL; + + return Py_BuildValue("i", WEXITSTATUS(status)); +} +#endif /* WEXITSTATUS */ + +#ifdef WTERMSIG +PyDoc_STRVAR(posix_WTERMSIG__doc__, +"WTERMSIG(status) -> integer\n\n\ +Return the signal that terminated the process that provided the 'status'\n\ +value."); + +static PyObject * +posix_WTERMSIG(PyObject *self, PyObject *args) +{ + WAIT_TYPE status; + WAIT_STATUS_INT(status) = 0; + + if (!PyArg_ParseTuple(args, "i:WTERMSIG", &WAIT_STATUS_INT(status))) + return NULL; + + return Py_BuildValue("i", WTERMSIG(status)); +} +#endif /* WTERMSIG */ + +#ifdef WSTOPSIG +PyDoc_STRVAR(posix_WSTOPSIG__doc__, +"WSTOPSIG(status) -> integer\n\n\ +Return the signal that stopped the process that provided\n\ +the 'status' value."); + +static PyObject * +posix_WSTOPSIG(PyObject *self, PyObject *args) +{ + WAIT_TYPE status; + WAIT_STATUS_INT(status) = 0; + + if (!PyArg_ParseTuple(args, "i:WSTOPSIG", &WAIT_STATUS_INT(status))) + return NULL; + + return Py_BuildValue("i", WSTOPSIG(status)); +} +#endif /* WSTOPSIG */ + +#endif /* HAVE_SYS_WAIT_H */ + + +#if defined(HAVE_FSTATVFS) && defined(HAVE_SYS_STATVFS_H) +#ifdef _SCO_DS +/* SCO OpenServer 5.0 and later requires _SVID3 before it reveals the + needed definitions in sys/statvfs.h */ +#define _SVID3 +#endif +#include <sys/statvfs.h> + +static PyObject* +_pystatvfs_fromstructstatvfs(struct statvfs st) { + PyObject *v = PyStructSequence_New(&StatVFSResultType); + if (v == NULL) + return NULL; + +#if !defined(HAVE_LARGEFILE_SUPPORT) + PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long) st.f_bsize)); + PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize)); + PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long) st.f_blocks)); + PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long) st.f_bfree)); + PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long) st.f_bavail)); + PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long) st.f_files)); + PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong((long) st.f_ffree)); + PyStructSequence_SET_ITEM(v, 7, PyInt_FromLong((long) st.f_favail)); + PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag)); + PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax)); +#else + PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long) st.f_bsize)); + PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize)); + PyStructSequence_SET_ITEM(v, 2, + PyLong_FromLongLong((PY_LONG_LONG) st.f_blocks)); + PyStructSequence_SET_ITEM(v, 3, + PyLong_FromLongLong((PY_LONG_LONG) st.f_bfree)); + PyStructSequence_SET_ITEM(v, 4, + PyLong_FromLongLong((PY_LONG_LONG) st.f_bavail)); + PyStructSequence_SET_ITEM(v, 5, + PyLong_FromLongLong((PY_LONG_LONG) st.f_files)); + PyStructSequence_SET_ITEM(v, 6, + PyLong_FromLongLong((PY_LONG_LONG) st.f_ffree)); + PyStructSequence_SET_ITEM(v, 7, + PyLong_FromLongLong((PY_LONG_LONG) st.f_favail)); + PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag)); + PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax)); +#endif + + return v; +} + +PyDoc_STRVAR(posix_fstatvfs__doc__, +"fstatvfs(fd) -> statvfs result\n\n\ +Perform an fstatvfs system call on the given fd."); + +static PyObject * +posix_fstatvfs(PyObject *self, PyObject *args) +{ + int fd, res; + struct statvfs st; + + if (!PyArg_ParseTuple(args, "i:fstatvfs", &fd)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = fstatvfs(fd, &st); + Py_END_ALLOW_THREADS + if (res != 0) + return posix_error(); + + return _pystatvfs_fromstructstatvfs(st); +} +#endif /* HAVE_FSTATVFS && HAVE_SYS_STATVFS_H */ + + +#if defined(HAVE_STATVFS) && defined(HAVE_SYS_STATVFS_H) +#include <sys/statvfs.h> + +PyDoc_STRVAR(posix_statvfs__doc__, +"statvfs(path) -> statvfs result\n\n\ +Perform a statvfs system call on the given path."); + +static PyObject * +posix_statvfs(PyObject *self, PyObject *args) +{ + char *path; + int res; + struct statvfs st; + if (!PyArg_ParseTuple(args, "s:statvfs", &path)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = statvfs(path, &st); + Py_END_ALLOW_THREADS + if (res != 0) + return posix_error_with_filename(path); + + return _pystatvfs_fromstructstatvfs(st); +} +#endif /* HAVE_STATVFS */ + + +#ifdef HAVE_TEMPNAM +PyDoc_STRVAR(posix_tempnam__doc__, +"tempnam([dir[, prefix]]) -> string\n\n\ +Return a unique name for a temporary file.\n\ +The directory and a prefix may be specified as strings; they may be omitted\n\ +or None if not needed."); + +static PyObject * +posix_tempnam(PyObject *self, PyObject *args) +{ + PyObject *result = NULL; + char *dir = NULL; + char *pfx = NULL; + char *name; + + if (!PyArg_ParseTuple(args, "|zz:tempnam", &dir, &pfx)) + return NULL; + + if (PyErr_Warn(PyExc_RuntimeWarning, + "tempnam is a potential security risk to your program") < 0) + return NULL; + +#ifdef MS_WINDOWS + name = _tempnam(dir, pfx); +#else + name = tempnam(dir, pfx); +#endif + if (name == NULL) + return PyErr_NoMemory(); + result = PyString_FromString(name); + free(name); + return result; +} +#endif + + +#ifdef HAVE_TMPFILE +PyDoc_STRVAR(posix_tmpfile__doc__, +"tmpfile() -> file object\n\n\ +Create a temporary file with no directory entries."); + +static PyObject * +posix_tmpfile(PyObject *self, PyObject *noargs) +{ + FILE *fp; + + fp = tmpfile(); + if (fp == NULL) + return posix_error(); + return PyFile_FromFile(fp, "<tmpfile>", "w+b", fclose); +} +#endif + + +#ifdef HAVE_TMPNAM +PyDoc_STRVAR(posix_tmpnam__doc__, +"tmpnam() -> string\n\n\ +Return a unique name for a temporary file."); + +static PyObject * +posix_tmpnam(PyObject *self, PyObject *noargs) +{ + char buffer[L_tmpnam]; + char *name; + + if (PyErr_Warn(PyExc_RuntimeWarning, + "tmpnam is a potential security risk to your program") < 0) + return NULL; + +#ifdef USE_TMPNAM_R + name = tmpnam_r(buffer); +#else + name = tmpnam(buffer); +#endif + if (name == NULL) { + PyObject *err = Py_BuildValue("is", 0, +#ifdef USE_TMPNAM_R + "unexpected NULL from tmpnam_r" +#else + "unexpected NULL from tmpnam" +#endif + ); + PyErr_SetObject(PyExc_OSError, err); + Py_XDECREF(err); + return NULL; + } + return PyString_FromString(buffer); +} +#endif + + +/* This is used for fpathconf(), pathconf(), confstr() and sysconf(). + * It maps strings representing configuration variable names to + * integer values, allowing those functions to be called with the + * magic names instead of polluting the module's namespace with tons of + * rarely-used constants. There are three separate tables that use + * these definitions. + * + * This code is always included, even if none of the interfaces that + * need it are included. The #if hackery needed to avoid it would be + * sufficiently pervasive that it's not worth the loss of readability. + */ +struct constdef { + char *name; + long value; +}; + +static int +conv_confname(PyObject *arg, int *valuep, struct constdef *table, + size_t tablesize) +{ + if (PyInt_Check(arg)) { + *valuep = PyInt_AS_LONG(arg); + return 1; + } + if (PyString_Check(arg)) { + /* look up the value in the table using a binary search */ + size_t lo = 0; + size_t mid; + size_t hi = tablesize; + int cmp; + char *confname = PyString_AS_STRING(arg); + while (lo < hi) { + mid = (lo + hi) / 2; + cmp = strcmp(confname, table[mid].name); + if (cmp < 0) + hi = mid; + else if (cmp > 0) + lo = mid + 1; + else { + *valuep = table[mid].value; + return 1; + } + } + PyErr_SetString(PyExc_ValueError, "unrecognized configuration name"); + } + else + PyErr_SetString(PyExc_TypeError, + "configuration names must be strings or integers"); + return 0; +} + + +#if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) +static struct constdef posix_constants_pathconf[] = { +#ifdef _PC_ABI_AIO_XFER_MAX + {"PC_ABI_AIO_XFER_MAX", _PC_ABI_AIO_XFER_MAX}, +#endif +#ifdef _PC_ABI_ASYNC_IO + {"PC_ABI_ASYNC_IO", _PC_ABI_ASYNC_IO}, +#endif +#ifdef _PC_ASYNC_IO + {"PC_ASYNC_IO", _PC_ASYNC_IO}, +#endif +#ifdef _PC_CHOWN_RESTRICTED + {"PC_CHOWN_RESTRICTED", _PC_CHOWN_RESTRICTED}, +#endif +#ifdef _PC_FILESIZEBITS + {"PC_FILESIZEBITS", _PC_FILESIZEBITS}, +#endif +#ifdef _PC_LAST + {"PC_LAST", _PC_LAST}, +#endif +#ifdef _PC_LINK_MAX + {"PC_LINK_MAX", _PC_LINK_MAX}, +#endif +#ifdef _PC_MAX_CANON + {"PC_MAX_CANON", _PC_MAX_CANON}, +#endif +#ifdef _PC_MAX_INPUT + {"PC_MAX_INPUT", _PC_MAX_INPUT}, +#endif +#ifdef _PC_NAME_MAX + {"PC_NAME_MAX", _PC_NAME_MAX}, +#endif +#ifdef _PC_NO_TRUNC + {"PC_NO_TRUNC", _PC_NO_TRUNC}, +#endif +#ifdef _PC_PATH_MAX + {"PC_PATH_MAX", _PC_PATH_MAX}, +#endif +#ifdef _PC_PIPE_BUF + {"PC_PIPE_BUF", _PC_PIPE_BUF}, +#endif +#ifdef _PC_PRIO_IO + {"PC_PRIO_IO", _PC_PRIO_IO}, +#endif +#ifdef _PC_SOCK_MAXBUF + {"PC_SOCK_MAXBUF", _PC_SOCK_MAXBUF}, +#endif +#ifdef _PC_SYNC_IO + {"PC_SYNC_IO", _PC_SYNC_IO}, +#endif +#ifdef _PC_VDISABLE + {"PC_VDISABLE", _PC_VDISABLE}, +#endif +}; + +static int +conv_path_confname(PyObject *arg, int *valuep) +{ + return conv_confname(arg, valuep, posix_constants_pathconf, + sizeof(posix_constants_pathconf) + / sizeof(struct constdef)); +} +#endif + +#ifdef HAVE_FPATHCONF +PyDoc_STRVAR(posix_fpathconf__doc__, +"fpathconf(fd, name) -> integer\n\n\ +Return the configuration limit name for the file descriptor fd.\n\ +If there is no limit, return -1."); + +static PyObject * +posix_fpathconf(PyObject *self, PyObject *args) +{ + PyObject *result = NULL; + int name, fd; + + if (PyArg_ParseTuple(args, "iO&:fpathconf", &fd, + conv_path_confname, &name)) { + long limit; + + errno = 0; + limit = fpathconf(fd, name); + if (limit == -1 && errno != 0) + posix_error(); + else + result = PyInt_FromLong(limit); + } + return result; +} +#endif + + +#ifdef HAVE_PATHCONF +PyDoc_STRVAR(posix_pathconf__doc__, +"pathconf(path, name) -> integer\n\n\ +Return the configuration limit name for the file or directory path.\n\ +If there is no limit, return -1."); + +static PyObject * +posix_pathconf(PyObject *self, PyObject *args) +{ + PyObject *result = NULL; + int name; + char *path; + + if (PyArg_ParseTuple(args, "sO&:pathconf", &path, + conv_path_confname, &name)) { + long limit; + + errno = 0; + limit = pathconf(path, name); + if (limit == -1 && errno != 0) { + if (errno == EINVAL) + /* could be a path or name problem */ + posix_error(); + else + posix_error_with_filename(path); + } + else + result = PyInt_FromLong(limit); + } + return result; +} +#endif + +#ifdef HAVE_CONFSTR +static struct constdef posix_constants_confstr[] = { +#ifdef _CS_ARCHITECTURE + {"CS_ARCHITECTURE", _CS_ARCHITECTURE}, +#endif +#ifdef _CS_HOSTNAME + {"CS_HOSTNAME", _CS_HOSTNAME}, +#endif +#ifdef _CS_HW_PROVIDER + {"CS_HW_PROVIDER", _CS_HW_PROVIDER}, +#endif +#ifdef _CS_HW_SERIAL + {"CS_HW_SERIAL", _CS_HW_SERIAL}, +#endif +#ifdef _CS_INITTAB_NAME + {"CS_INITTAB_NAME", _CS_INITTAB_NAME}, +#endif +#ifdef _CS_LFS64_CFLAGS + {"CS_LFS64_CFLAGS", _CS_LFS64_CFLAGS}, +#endif +#ifdef _CS_LFS64_LDFLAGS + {"CS_LFS64_LDFLAGS", _CS_LFS64_LDFLAGS}, +#endif +#ifdef _CS_LFS64_LIBS + {"CS_LFS64_LIBS", _CS_LFS64_LIBS}, +#endif +#ifdef _CS_LFS64_LINTFLAGS + {"CS_LFS64_LINTFLAGS", _CS_LFS64_LINTFLAGS}, +#endif +#ifdef _CS_LFS_CFLAGS + {"CS_LFS_CFLAGS", _CS_LFS_CFLAGS}, +#endif +#ifdef _CS_LFS_LDFLAGS + {"CS_LFS_LDFLAGS", _CS_LFS_LDFLAGS}, +#endif +#ifdef _CS_LFS_LIBS + {"CS_LFS_LIBS", _CS_LFS_LIBS}, +#endif +#ifdef _CS_LFS_LINTFLAGS + {"CS_LFS_LINTFLAGS", _CS_LFS_LINTFLAGS}, +#endif +#ifdef _CS_MACHINE + {"CS_MACHINE", _CS_MACHINE}, +#endif +#ifdef _CS_PATH + {"CS_PATH", _CS_PATH}, +#endif +#ifdef _CS_RELEASE + {"CS_RELEASE", _CS_RELEASE}, +#endif +#ifdef _CS_SRPC_DOMAIN + {"CS_SRPC_DOMAIN", _CS_SRPC_DOMAIN}, +#endif +#ifdef _CS_SYSNAME + {"CS_SYSNAME", _CS_SYSNAME}, +#endif +#ifdef _CS_VERSION + {"CS_VERSION", _CS_VERSION}, +#endif +#ifdef _CS_XBS5_ILP32_OFF32_CFLAGS + {"CS_XBS5_ILP32_OFF32_CFLAGS", _CS_XBS5_ILP32_OFF32_CFLAGS}, +#endif +#ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS + {"CS_XBS5_ILP32_OFF32_LDFLAGS", _CS_XBS5_ILP32_OFF32_LDFLAGS}, +#endif +#ifdef _CS_XBS5_ILP32_OFF32_LIBS + {"CS_XBS5_ILP32_OFF32_LIBS", _CS_XBS5_ILP32_OFF32_LIBS}, +#endif +#ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS + {"CS_XBS5_ILP32_OFF32_LINTFLAGS", _CS_XBS5_ILP32_OFF32_LINTFLAGS}, +#endif +#ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS + {"CS_XBS5_ILP32_OFFBIG_CFLAGS", _CS_XBS5_ILP32_OFFBIG_CFLAGS}, +#endif +#ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS + {"CS_XBS5_ILP32_OFFBIG_LDFLAGS", _CS_XBS5_ILP32_OFFBIG_LDFLAGS}, +#endif +#ifdef _CS_XBS5_ILP32_OFFBIG_LIBS + {"CS_XBS5_ILP32_OFFBIG_LIBS", _CS_XBS5_ILP32_OFFBIG_LIBS}, +#endif +#ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS + {"CS_XBS5_ILP32_OFFBIG_LINTFLAGS", _CS_XBS5_ILP32_OFFBIG_LINTFLAGS}, +#endif +#ifdef _CS_XBS5_LP64_OFF64_CFLAGS + {"CS_XBS5_LP64_OFF64_CFLAGS", _CS_XBS5_LP64_OFF64_CFLAGS}, +#endif +#ifdef _CS_XBS5_LP64_OFF64_LDFLAGS + {"CS_XBS5_LP64_OFF64_LDFLAGS", _CS_XBS5_LP64_OFF64_LDFLAGS}, +#endif +#ifdef _CS_XBS5_LP64_OFF64_LIBS + {"CS_XBS5_LP64_OFF64_LIBS", _CS_XBS5_LP64_OFF64_LIBS}, +#endif +#ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS + {"CS_XBS5_LP64_OFF64_LINTFLAGS", _CS_XBS5_LP64_OFF64_LINTFLAGS}, +#endif +#ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS + {"CS_XBS5_LPBIG_OFFBIG_CFLAGS", _CS_XBS5_LPBIG_OFFBIG_CFLAGS}, +#endif +#ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS + {"CS_XBS5_LPBIG_OFFBIG_LDFLAGS", _CS_XBS5_LPBIG_OFFBIG_LDFLAGS}, +#endif +#ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS + {"CS_XBS5_LPBIG_OFFBIG_LIBS", _CS_XBS5_LPBIG_OFFBIG_LIBS}, +#endif +#ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS + {"CS_XBS5_LPBIG_OFFBIG_LINTFLAGS", _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS}, +#endif +#ifdef _MIPS_CS_AVAIL_PROCESSORS + {"MIPS_CS_AVAIL_PROCESSORS", _MIPS_CS_AVAIL_PROCESSORS}, +#endif +#ifdef _MIPS_CS_BASE + {"MIPS_CS_BASE", _MIPS_CS_BASE}, +#endif +#ifdef _MIPS_CS_HOSTID + {"MIPS_CS_HOSTID", _MIPS_CS_HOSTID}, +#endif +#ifdef _MIPS_CS_HW_NAME + {"MIPS_CS_HW_NAME", _MIPS_CS_HW_NAME}, +#endif +#ifdef _MIPS_CS_NUM_PROCESSORS + {"MIPS_CS_NUM_PROCESSORS", _MIPS_CS_NUM_PROCESSORS}, +#endif +#ifdef _MIPS_CS_OSREL_MAJ + {"MIPS_CS_OSREL_MAJ", _MIPS_CS_OSREL_MAJ}, +#endif +#ifdef _MIPS_CS_OSREL_MIN + {"MIPS_CS_OSREL_MIN", _MIPS_CS_OSREL_MIN}, +#endif +#ifdef _MIPS_CS_OSREL_PATCH + {"MIPS_CS_OSREL_PATCH", _MIPS_CS_OSREL_PATCH}, +#endif +#ifdef _MIPS_CS_OS_NAME + {"MIPS_CS_OS_NAME", _MIPS_CS_OS_NAME}, +#endif +#ifdef _MIPS_CS_OS_PROVIDER + {"MIPS_CS_OS_PROVIDER", _MIPS_CS_OS_PROVIDER}, +#endif +#ifdef _MIPS_CS_PROCESSORS + {"MIPS_CS_PROCESSORS", _MIPS_CS_PROCESSORS}, +#endif +#ifdef _MIPS_CS_SERIAL + {"MIPS_CS_SERIAL", _MIPS_CS_SERIAL}, +#endif +#ifdef _MIPS_CS_VENDOR + {"MIPS_CS_VENDOR", _MIPS_CS_VENDOR}, +#endif +}; + +static int +conv_confstr_confname(PyObject *arg, int *valuep) +{ + return conv_confname(arg, valuep, posix_constants_confstr, + sizeof(posix_constants_confstr) + / sizeof(struct constdef)); +} + +PyDoc_STRVAR(posix_confstr__doc__, +"confstr(name) -> string\n\n\ +Return a string-valued system configuration variable."); + +static PyObject * +posix_confstr(PyObject *self, PyObject *args) +{ + PyObject *result = NULL; + int name; + char buffer[256]; + + if (PyArg_ParseTuple(args, "O&:confstr", conv_confstr_confname, &name)) { + int len; + + errno = 0; + len = confstr(name, buffer, sizeof(buffer)); + if (len == 0) { + if (errno) { + posix_error(); + } + else { + result = Py_None; + Py_INCREF(Py_None); + } + } + else { + if ((unsigned int)len >= sizeof(buffer)) { + result = PyString_FromStringAndSize(NULL, len-1); + if (result != NULL) + confstr(name, PyString_AS_STRING(result), len); + } + else + result = PyString_FromStringAndSize(buffer, len-1); + } + } + return result; +} +#endif + + +#ifdef HAVE_SYSCONF +static struct constdef posix_constants_sysconf[] = { +#ifdef _SC_2_CHAR_TERM + {"SC_2_CHAR_TERM", _SC_2_CHAR_TERM}, +#endif +#ifdef _SC_2_C_BIND + {"SC_2_C_BIND", _SC_2_C_BIND}, +#endif +#ifdef _SC_2_C_DEV + {"SC_2_C_DEV", _SC_2_C_DEV}, +#endif +#ifdef _SC_2_C_VERSION + {"SC_2_C_VERSION", _SC_2_C_VERSION}, +#endif +#ifdef _SC_2_FORT_DEV + {"SC_2_FORT_DEV", _SC_2_FORT_DEV}, +#endif +#ifdef _SC_2_FORT_RUN + {"SC_2_FORT_RUN", _SC_2_FORT_RUN}, +#endif +#ifdef _SC_2_LOCALEDEF + {"SC_2_LOCALEDEF", _SC_2_LOCALEDEF}, +#endif +#ifdef _SC_2_SW_DEV + {"SC_2_SW_DEV", _SC_2_SW_DEV}, +#endif +#ifdef _SC_2_UPE + {"SC_2_UPE", _SC_2_UPE}, +#endif +#ifdef _SC_2_VERSION + {"SC_2_VERSION", _SC_2_VERSION}, +#endif +#ifdef _SC_ABI_ASYNCHRONOUS_IO + {"SC_ABI_ASYNCHRONOUS_IO", _SC_ABI_ASYNCHRONOUS_IO}, +#endif +#ifdef _SC_ACL + {"SC_ACL", _SC_ACL}, +#endif +#ifdef _SC_AIO_LISTIO_MAX + {"SC_AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX}, +#endif +#ifdef _SC_AIO_MAX + {"SC_AIO_MAX", _SC_AIO_MAX}, +#endif +#ifdef _SC_AIO_PRIO_DELTA_MAX + {"SC_AIO_PRIO_DELTA_MAX", _SC_AIO_PRIO_DELTA_MAX}, +#endif +#ifdef _SC_ARG_MAX + {"SC_ARG_MAX", _SC_ARG_MAX}, +#endif +#ifdef _SC_ASYNCHRONOUS_IO + {"SC_ASYNCHRONOUS_IO", _SC_ASYNCHRONOUS_IO}, +#endif +#ifdef _SC_ATEXIT_MAX + {"SC_ATEXIT_MAX", _SC_ATEXIT_MAX}, +#endif +#ifdef _SC_AUDIT + {"SC_AUDIT", _SC_AUDIT}, +#endif +#ifdef _SC_AVPHYS_PAGES + {"SC_AVPHYS_PAGES", _SC_AVPHYS_PAGES}, +#endif +#ifdef _SC_BC_BASE_MAX + {"SC_BC_BASE_MAX", _SC_BC_BASE_MAX}, +#endif +#ifdef _SC_BC_DIM_MAX + {"SC_BC_DIM_MAX", _SC_BC_DIM_MAX}, +#endif +#ifdef _SC_BC_SCALE_MAX + {"SC_BC_SCALE_MAX", _SC_BC_SCALE_MAX}, +#endif +#ifdef _SC_BC_STRING_MAX + {"SC_BC_STRING_MAX", _SC_BC_STRING_MAX}, +#endif +#ifdef _SC_CAP + {"SC_CAP", _SC_CAP}, +#endif +#ifdef _SC_CHARCLASS_NAME_MAX + {"SC_CHARCLASS_NAME_MAX", _SC_CHARCLASS_NAME_MAX}, +#endif +#ifdef _SC_CHAR_BIT + {"SC_CHAR_BIT", _SC_CHAR_BIT}, +#endif +#ifdef _SC_CHAR_MAX + {"SC_CHAR_MAX", _SC_CHAR_MAX}, +#endif +#ifdef _SC_CHAR_MIN + {"SC_CHAR_MIN", _SC_CHAR_MIN}, +#endif +#ifdef _SC_CHILD_MAX + {"SC_CHILD_MAX", _SC_CHILD_MAX}, +#endif +#ifdef _SC_CLK_TCK + {"SC_CLK_TCK", _SC_CLK_TCK}, +#endif +#ifdef _SC_COHER_BLKSZ + {"SC_COHER_BLKSZ", _SC_COHER_BLKSZ}, +#endif +#ifdef _SC_COLL_WEIGHTS_MAX + {"SC_COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX}, +#endif +#ifdef _SC_DCACHE_ASSOC + {"SC_DCACHE_ASSOC", _SC_DCACHE_ASSOC}, +#endif +#ifdef _SC_DCACHE_BLKSZ + {"SC_DCACHE_BLKSZ", _SC_DCACHE_BLKSZ}, +#endif +#ifdef _SC_DCACHE_LINESZ + {"SC_DCACHE_LINESZ", _SC_DCACHE_LINESZ}, +#endif +#ifdef _SC_DCACHE_SZ + {"SC_DCACHE_SZ", _SC_DCACHE_SZ}, +#endif +#ifdef _SC_DCACHE_TBLKSZ + {"SC_DCACHE_TBLKSZ", _SC_DCACHE_TBLKSZ}, +#endif +#ifdef _SC_DELAYTIMER_MAX + {"SC_DELAYTIMER_MAX", _SC_DELAYTIMER_MAX}, +#endif +#ifdef _SC_EQUIV_CLASS_MAX + {"SC_EQUIV_CLASS_MAX", _SC_EQUIV_CLASS_MAX}, +#endif +#ifdef _SC_EXPR_NEST_MAX + {"SC_EXPR_NEST_MAX", _SC_EXPR_NEST_MAX}, +#endif +#ifdef _SC_FSYNC + {"SC_FSYNC", _SC_FSYNC}, +#endif +#ifdef _SC_GETGR_R_SIZE_MAX + {"SC_GETGR_R_SIZE_MAX", _SC_GETGR_R_SIZE_MAX}, +#endif +#ifdef _SC_GETPW_R_SIZE_MAX + {"SC_GETPW_R_SIZE_MAX", _SC_GETPW_R_SIZE_MAX}, +#endif +#ifdef _SC_ICACHE_ASSOC + {"SC_ICACHE_ASSOC", _SC_ICACHE_ASSOC}, +#endif +#ifdef _SC_ICACHE_BLKSZ + {"SC_ICACHE_BLKSZ", _SC_ICACHE_BLKSZ}, +#endif +#ifdef _SC_ICACHE_LINESZ + {"SC_ICACHE_LINESZ", _SC_ICACHE_LINESZ}, +#endif +#ifdef _SC_ICACHE_SZ + {"SC_ICACHE_SZ", _SC_ICACHE_SZ}, +#endif +#ifdef _SC_INF + {"SC_INF", _SC_INF}, +#endif +#ifdef _SC_INT_MAX + {"SC_INT_MAX", _SC_INT_MAX}, +#endif +#ifdef _SC_INT_MIN + {"SC_INT_MIN", _SC_INT_MIN}, +#endif +#ifdef _SC_IOV_MAX + {"SC_IOV_MAX", _SC_IOV_MAX}, +#endif +#ifdef _SC_IP_SECOPTS + {"SC_IP_SECOPTS", _SC_IP_SECOPTS}, +#endif +#ifdef _SC_JOB_CONTROL + {"SC_JOB_CONTROL", _SC_JOB_CONTROL}, +#endif +#ifdef _SC_KERN_POINTERS + {"SC_KERN_POINTERS", _SC_KERN_POINTERS}, +#endif +#ifdef _SC_KERN_SIM + {"SC_KERN_SIM", _SC_KERN_SIM}, +#endif +#ifdef _SC_LINE_MAX + {"SC_LINE_MAX", _SC_LINE_MAX}, +#endif +#ifdef _SC_LOGIN_NAME_MAX + {"SC_LOGIN_NAME_MAX", _SC_LOGIN_NAME_MAX}, +#endif +#ifdef _SC_LOGNAME_MAX + {"SC_LOGNAME_MAX", _SC_LOGNAME_MAX}, +#endif +#ifdef _SC_LONG_BIT + {"SC_LONG_BIT", _SC_LONG_BIT}, +#endif +#ifdef _SC_MAC + {"SC_MAC", _SC_MAC}, +#endif +#ifdef _SC_MAPPED_FILES + {"SC_MAPPED_FILES", _SC_MAPPED_FILES}, +#endif +#ifdef _SC_MAXPID + {"SC_MAXPID", _SC_MAXPID}, +#endif +#ifdef _SC_MB_LEN_MAX + {"SC_MB_LEN_MAX", _SC_MB_LEN_MAX}, +#endif +#ifdef _SC_MEMLOCK + {"SC_MEMLOCK", _SC_MEMLOCK}, +#endif +#ifdef _SC_MEMLOCK_RANGE + {"SC_MEMLOCK_RANGE", _SC_MEMLOCK_RANGE}, +#endif +#ifdef _SC_MEMORY_PROTECTION + {"SC_MEMORY_PROTECTION", _SC_MEMORY_PROTECTION}, +#endif +#ifdef _SC_MESSAGE_PASSING + {"SC_MESSAGE_PASSING", _SC_MESSAGE_PASSING}, +#endif +#ifdef _SC_MMAP_FIXED_ALIGNMENT + {"SC_MMAP_FIXED_ALIGNMENT", _SC_MMAP_FIXED_ALIGNMENT}, +#endif +#ifdef _SC_MQ_OPEN_MAX + {"SC_MQ_OPEN_MAX", _SC_MQ_OPEN_MAX}, +#endif +#ifdef _SC_MQ_PRIO_MAX + {"SC_MQ_PRIO_MAX", _SC_MQ_PRIO_MAX}, +#endif +#ifdef _SC_NACLS_MAX + {"SC_NACLS_MAX", _SC_NACLS_MAX}, +#endif +#ifdef _SC_NGROUPS_MAX + {"SC_NGROUPS_MAX", _SC_NGROUPS_MAX}, +#endif +#ifdef _SC_NL_ARGMAX + {"SC_NL_ARGMAX", _SC_NL_ARGMAX}, +#endif +#ifdef _SC_NL_LANGMAX + {"SC_NL_LANGMAX", _SC_NL_LANGMAX}, +#endif +#ifdef _SC_NL_MSGMAX + {"SC_NL_MSGMAX", _SC_NL_MSGMAX}, +#endif +#ifdef _SC_NL_NMAX + {"SC_NL_NMAX", _SC_NL_NMAX}, +#endif +#ifdef _SC_NL_SETMAX + {"SC_NL_SETMAX", _SC_NL_SETMAX}, +#endif +#ifdef _SC_NL_TEXTMAX + {"SC_NL_TEXTMAX", _SC_NL_TEXTMAX}, +#endif +#ifdef _SC_NPROCESSORS_CONF + {"SC_NPROCESSORS_CONF", _SC_NPROCESSORS_CONF}, +#endif +#ifdef _SC_NPROCESSORS_ONLN + {"SC_NPROCESSORS_ONLN", _SC_NPROCESSORS_ONLN}, +#endif +#ifdef _SC_NPROC_CONF + {"SC_NPROC_CONF", _SC_NPROC_CONF}, +#endif +#ifdef _SC_NPROC_ONLN + {"SC_NPROC_ONLN", _SC_NPROC_ONLN}, +#endif +#ifdef _SC_NZERO + {"SC_NZERO", _SC_NZERO}, +#endif +#ifdef _SC_OPEN_MAX + {"SC_OPEN_MAX", _SC_OPEN_MAX}, +#endif +#ifdef _SC_PAGESIZE + {"SC_PAGESIZE", _SC_PAGESIZE}, +#endif +#ifdef _SC_PAGE_SIZE + {"SC_PAGE_SIZE", _SC_PAGE_SIZE}, +#endif +#ifdef _SC_PASS_MAX + {"SC_PASS_MAX", _SC_PASS_MAX}, +#endif +#ifdef _SC_PHYS_PAGES + {"SC_PHYS_PAGES", _SC_PHYS_PAGES}, +#endif +#ifdef _SC_PII + {"SC_PII", _SC_PII}, +#endif +#ifdef _SC_PII_INTERNET + {"SC_PII_INTERNET", _SC_PII_INTERNET}, +#endif +#ifdef _SC_PII_INTERNET_DGRAM + {"SC_PII_INTERNET_DGRAM", _SC_PII_INTERNET_DGRAM}, +#endif +#ifdef _SC_PII_INTERNET_STREAM + {"SC_PII_INTERNET_STREAM", _SC_PII_INTERNET_STREAM}, +#endif +#ifdef _SC_PII_OSI + {"SC_PII_OSI", _SC_PII_OSI}, +#endif +#ifdef _SC_PII_OSI_CLTS + {"SC_PII_OSI_CLTS", _SC_PII_OSI_CLTS}, +#endif +#ifdef _SC_PII_OSI_COTS + {"SC_PII_OSI_COTS", _SC_PII_OSI_COTS}, +#endif +#ifdef _SC_PII_OSI_M + {"SC_PII_OSI_M", _SC_PII_OSI_M}, +#endif +#ifdef _SC_PII_SOCKET + {"SC_PII_SOCKET", _SC_PII_SOCKET}, +#endif +#ifdef _SC_PII_XTI + {"SC_PII_XTI", _SC_PII_XTI}, +#endif +#ifdef _SC_POLL + {"SC_POLL", _SC_POLL}, +#endif +#ifdef _SC_PRIORITIZED_IO + {"SC_PRIORITIZED_IO", _SC_PRIORITIZED_IO}, +#endif +#ifdef _SC_PRIORITY_SCHEDULING + {"SC_PRIORITY_SCHEDULING", _SC_PRIORITY_SCHEDULING}, +#endif +#ifdef _SC_REALTIME_SIGNALS + {"SC_REALTIME_SIGNALS", _SC_REALTIME_SIGNALS}, +#endif +#ifdef _SC_RE_DUP_MAX + {"SC_RE_DUP_MAX", _SC_RE_DUP_MAX}, +#endif +#ifdef _SC_RTSIG_MAX + {"SC_RTSIG_MAX", _SC_RTSIG_MAX}, +#endif +#ifdef _SC_SAVED_IDS + {"SC_SAVED_IDS", _SC_SAVED_IDS}, +#endif +#ifdef _SC_SCHAR_MAX + {"SC_SCHAR_MAX", _SC_SCHAR_MAX}, +#endif +#ifdef _SC_SCHAR_MIN + {"SC_SCHAR_MIN", _SC_SCHAR_MIN}, +#endif +#ifdef _SC_SELECT + {"SC_SELECT", _SC_SELECT}, +#endif +#ifdef _SC_SEMAPHORES + {"SC_SEMAPHORES", _SC_SEMAPHORES}, +#endif +#ifdef _SC_SEM_NSEMS_MAX + {"SC_SEM_NSEMS_MAX", _SC_SEM_NSEMS_MAX}, +#endif +#ifdef _SC_SEM_VALUE_MAX + {"SC_SEM_VALUE_MAX", _SC_SEM_VALUE_MAX}, +#endif +#ifdef _SC_SHARED_MEMORY_OBJECTS + {"SC_SHARED_MEMORY_OBJECTS", _SC_SHARED_MEMORY_OBJECTS}, +#endif +#ifdef _SC_SHRT_MAX + {"SC_SHRT_MAX", _SC_SHRT_MAX}, +#endif +#ifdef _SC_SHRT_MIN + {"SC_SHRT_MIN", _SC_SHRT_MIN}, +#endif +#ifdef _SC_SIGQUEUE_MAX + {"SC_SIGQUEUE_MAX", _SC_SIGQUEUE_MAX}, +#endif +#ifdef _SC_SIGRT_MAX + {"SC_SIGRT_MAX", _SC_SIGRT_MAX}, +#endif +#ifdef _SC_SIGRT_MIN + {"SC_SIGRT_MIN", _SC_SIGRT_MIN}, +#endif +#ifdef _SC_SOFTPOWER + {"SC_SOFTPOWER", _SC_SOFTPOWER}, +#endif +#ifdef _SC_SPLIT_CACHE + {"SC_SPLIT_CACHE", _SC_SPLIT_CACHE}, +#endif +#ifdef _SC_SSIZE_MAX + {"SC_SSIZE_MAX", _SC_SSIZE_MAX}, +#endif +#ifdef _SC_STACK_PROT + {"SC_STACK_PROT", _SC_STACK_PROT}, +#endif +#ifdef _SC_STREAM_MAX + {"SC_STREAM_MAX", _SC_STREAM_MAX}, +#endif +#ifdef _SC_SYNCHRONIZED_IO + {"SC_SYNCHRONIZED_IO", _SC_SYNCHRONIZED_IO}, +#endif +#ifdef _SC_THREADS + {"SC_THREADS", _SC_THREADS}, +#endif +#ifdef _SC_THREAD_ATTR_STACKADDR + {"SC_THREAD_ATTR_STACKADDR", _SC_THREAD_ATTR_STACKADDR}, +#endif +#ifdef _SC_THREAD_ATTR_STACKSIZE + {"SC_THREAD_ATTR_STACKSIZE", _SC_THREAD_ATTR_STACKSIZE}, +#endif +#ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS + {"SC_THREAD_DESTRUCTOR_ITERATIONS", _SC_THREAD_DESTRUCTOR_ITERATIONS}, +#endif +#ifdef _SC_THREAD_KEYS_MAX + {"SC_THREAD_KEYS_MAX", _SC_THREAD_KEYS_MAX}, +#endif +#ifdef _SC_THREAD_PRIORITY_SCHEDULING + {"SC_THREAD_PRIORITY_SCHEDULING", _SC_THREAD_PRIORITY_SCHEDULING}, +#endif +#ifdef _SC_THREAD_PRIO_INHERIT + {"SC_THREAD_PRIO_INHERIT", _SC_THREAD_PRIO_INHERIT}, +#endif +#ifdef _SC_THREAD_PRIO_PROTECT + {"SC_THREAD_PRIO_PROTECT", _SC_THREAD_PRIO_PROTECT}, +#endif +#ifdef _SC_THREAD_PROCESS_SHARED + {"SC_THREAD_PROCESS_SHARED", _SC_THREAD_PROCESS_SHARED}, +#endif +#ifdef _SC_THREAD_SAFE_FUNCTIONS + {"SC_THREAD_SAFE_FUNCTIONS", _SC_THREAD_SAFE_FUNCTIONS}, +#endif +#ifdef _SC_THREAD_STACK_MIN + {"SC_THREAD_STACK_MIN", _SC_THREAD_STACK_MIN}, +#endif +#ifdef _SC_THREAD_THREADS_MAX + {"SC_THREAD_THREADS_MAX", _SC_THREAD_THREADS_MAX}, +#endif +#ifdef _SC_TIMERS + {"SC_TIMERS", _SC_TIMERS}, +#endif +#ifdef _SC_TIMER_MAX + {"SC_TIMER_MAX", _SC_TIMER_MAX}, +#endif +#ifdef _SC_TTY_NAME_MAX + {"SC_TTY_NAME_MAX", _SC_TTY_NAME_MAX}, +#endif +#ifdef _SC_TZNAME_MAX + {"SC_TZNAME_MAX", _SC_TZNAME_MAX}, +#endif +#ifdef _SC_T_IOV_MAX + {"SC_T_IOV_MAX", _SC_T_IOV_MAX}, +#endif +#ifdef _SC_UCHAR_MAX + {"SC_UCHAR_MAX", _SC_UCHAR_MAX}, +#endif +#ifdef _SC_UINT_MAX + {"SC_UINT_MAX", _SC_UINT_MAX}, +#endif +#ifdef _SC_UIO_MAXIOV + {"SC_UIO_MAXIOV", _SC_UIO_MAXIOV}, +#endif +#ifdef _SC_ULONG_MAX + {"SC_ULONG_MAX", _SC_ULONG_MAX}, +#endif +#ifdef _SC_USHRT_MAX + {"SC_USHRT_MAX", _SC_USHRT_MAX}, +#endif +#ifdef _SC_VERSION + {"SC_VERSION", _SC_VERSION}, +#endif +#ifdef _SC_WORD_BIT + {"SC_WORD_BIT", _SC_WORD_BIT}, +#endif +#ifdef _SC_XBS5_ILP32_OFF32 + {"SC_XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32}, +#endif +#ifdef _SC_XBS5_ILP32_OFFBIG + {"SC_XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG}, +#endif +#ifdef _SC_XBS5_LP64_OFF64 + {"SC_XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64}, +#endif +#ifdef _SC_XBS5_LPBIG_OFFBIG + {"SC_XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG}, +#endif +#ifdef _SC_XOPEN_CRYPT + {"SC_XOPEN_CRYPT", _SC_XOPEN_CRYPT}, +#endif +#ifdef _SC_XOPEN_ENH_I18N + {"SC_XOPEN_ENH_I18N", _SC_XOPEN_ENH_I18N}, +#endif +#ifdef _SC_XOPEN_LEGACY + {"SC_XOPEN_LEGACY", _SC_XOPEN_LEGACY}, +#endif +#ifdef _SC_XOPEN_REALTIME + {"SC_XOPEN_REALTIME", _SC_XOPEN_REALTIME}, +#endif +#ifdef _SC_XOPEN_REALTIME_THREADS + {"SC_XOPEN_REALTIME_THREADS", _SC_XOPEN_REALTIME_THREADS}, +#endif +#ifdef _SC_XOPEN_SHM + {"SC_XOPEN_SHM", _SC_XOPEN_SHM}, +#endif +#ifdef _SC_XOPEN_UNIX + {"SC_XOPEN_UNIX", _SC_XOPEN_UNIX}, +#endif +#ifdef _SC_XOPEN_VERSION + {"SC_XOPEN_VERSION", _SC_XOPEN_VERSION}, +#endif +#ifdef _SC_XOPEN_XCU_VERSION + {"SC_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION}, +#endif +#ifdef _SC_XOPEN_XPG2 + {"SC_XOPEN_XPG2", _SC_XOPEN_XPG2}, +#endif +#ifdef _SC_XOPEN_XPG3 + {"SC_XOPEN_XPG3", _SC_XOPEN_XPG3}, +#endif +#ifdef _SC_XOPEN_XPG4 + {"SC_XOPEN_XPG4", _SC_XOPEN_XPG4}, +#endif +}; + +static int +conv_sysconf_confname(PyObject *arg, int *valuep) +{ + return conv_confname(arg, valuep, posix_constants_sysconf, + sizeof(posix_constants_sysconf) + / sizeof(struct constdef)); +} + +PyDoc_STRVAR(posix_sysconf__doc__, +"sysconf(name) -> integer\n\n\ +Return an integer-valued system configuration variable."); + +static PyObject * +posix_sysconf(PyObject *self, PyObject *args) +{ + PyObject *result = NULL; + int name; + + if (PyArg_ParseTuple(args, "O&:sysconf", conv_sysconf_confname, &name)) { + int value; + + errno = 0; + value = sysconf(name); + if (value == -1 && errno != 0) + posix_error(); + else + result = PyInt_FromLong(value); + } + return result; +} +#endif + + +/* This code is used to ensure that the tables of configuration value names + * are in sorted order as required by conv_confname(), and also to build the + * the exported dictionaries that are used to publish information about the + * names available on the host platform. + * + * Sorting the table at runtime ensures that the table is properly ordered + * when used, even for platforms we're not able to test on. It also makes + * it easier to add additional entries to the tables. + */ + +static int +cmp_constdefs(const void *v1, const void *v2) +{ + const struct constdef *c1 = + (const struct constdef *) v1; + const struct constdef *c2 = + (const struct constdef *) v2; + + return strcmp(c1->name, c2->name); +} + +static int +setup_confname_table(struct constdef *table, size_t tablesize, + char *tablename, PyObject *module) +{ + PyObject *d = NULL; + size_t i; + + qsort(table, tablesize, sizeof(struct constdef), cmp_constdefs); + d = PyDict_New(); + if (d == NULL) + return -1; + + for (i=0; i < tablesize; ++i) { + PyObject *o = PyInt_FromLong(table[i].value); + if (o == NULL || PyDict_SetItemString(d, table[i].name, o) == -1) { + Py_XDECREF(o); + Py_DECREF(d); + return -1; + } + Py_DECREF(o); + } + return PyModule_AddObject(module, tablename, d); +} + +/* Return -1 on failure, 0 on success. */ +static int +setup_confname_tables(PyObject *module) +{ +#if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) + if (setup_confname_table(posix_constants_pathconf, + sizeof(posix_constants_pathconf) + / sizeof(struct constdef), + "pathconf_names", module)) + return -1; +#endif +#ifdef HAVE_CONFSTR + if (setup_confname_table(posix_constants_confstr, + sizeof(posix_constants_confstr) + / sizeof(struct constdef), + "confstr_names", module)) + return -1; +#endif +#ifdef HAVE_SYSCONF + if (setup_confname_table(posix_constants_sysconf, + sizeof(posix_constants_sysconf) + / sizeof(struct constdef), + "sysconf_names", module)) + return -1; +#endif + return 0; +} + + +PyDoc_STRVAR(posix_abort__doc__, +"abort() -> does not return!\n\n\ +Abort the interpreter immediately. This 'dumps core' or otherwise fails\n\ +in the hardest way possible on the hosting operating system."); + +static PyObject * +posix_abort(PyObject *self, PyObject *noargs) +{ + abort(); + /*NOTREACHED*/ + Py_FatalError("abort() called from Python code didn't abort!"); + return NULL; +} + +#ifdef MS_WINDOWS +PyDoc_STRVAR(win32_startfile__doc__, +"startfile(filepath [, operation]) - Start a file with its associated\n\ +application.\n\ +\n\ +When \"operation\" is not specified or \"open\", this acts like\n\ +double-clicking the file in Explorer, or giving the file name as an\n\ +argument to the DOS \"start\" command: the file is opened with whatever\n\ +application (if any) its extension is associated.\n\ +When another \"operation\" is given, it specifies what should be done with\n\ +the file. A typical operation is \"print\".\n\ +\n\ +startfile returns as soon as the associated application is launched.\n\ +There is no option to wait for the application to close, and no way\n\ +to retrieve the application's exit status.\n\ +\n\ +The filepath is relative to the current directory. If you want to use\n\ +an absolute path, make sure the first character is not a slash (\"/\");\n\ +the underlying Win32 ShellExecute function doesn't work if it is."); + +static PyObject * +win32_startfile(PyObject *self, PyObject *args) +{ + char *filepath; + char *operation = NULL; + HINSTANCE rc; + + PyObject *unipath, *woperation = NULL; + if (!PyArg_ParseTuple(args, "U|s:startfile", + &unipath, &operation)) { + PyErr_Clear(); + goto normal; + } + + if (operation) { + woperation = PyUnicode_DecodeASCII(operation, + strlen(operation), NULL); + if (!woperation) { + PyErr_Clear(); + operation = NULL; + goto normal; + } + } + + Py_BEGIN_ALLOW_THREADS + rc = ShellExecuteW((HWND)0, woperation ? PyUnicode_AS_UNICODE(woperation) : 0, + PyUnicode_AS_UNICODE(unipath), + NULL, NULL, SW_SHOWNORMAL); + Py_END_ALLOW_THREADS + + Py_XDECREF(woperation); + if (rc <= (HINSTANCE)32) { + PyObject *errval = win32_error_unicode("startfile", + PyUnicode_AS_UNICODE(unipath)); + return errval; + } + Py_INCREF(Py_None); + return Py_None; + +normal: + if (!PyArg_ParseTuple(args, "et|s:startfile", + Py_FileSystemDefaultEncoding, &filepath, + &operation)) + return NULL; + Py_BEGIN_ALLOW_THREADS + rc = ShellExecute((HWND)0, operation, filepath, + NULL, NULL, SW_SHOWNORMAL); + Py_END_ALLOW_THREADS + if (rc <= (HINSTANCE)32) { + PyObject *errval = win32_error("startfile", filepath); + PyMem_Free(filepath); + return errval; + } + PyMem_Free(filepath); + Py_INCREF(Py_None); + return Py_None; +} +#endif /* MS_WINDOWS */ + +#ifdef HAVE_GETLOADAVG +PyDoc_STRVAR(posix_getloadavg__doc__, +"getloadavg() -> (float, float, float)\n\n\ +Return the number of processes in the system run queue averaged over\n\ +the last 1, 5, and 15 minutes or raises OSError if the load average\n\ +was unobtainable"); + +static PyObject * +posix_getloadavg(PyObject *self, PyObject *noargs) +{ + double loadavg[3]; + if (getloadavg(loadavg, 3)!=3) { + PyErr_SetString(PyExc_OSError, "Load averages are unobtainable"); + return NULL; + } else + return Py_BuildValue("ddd", loadavg[0], loadavg[1], loadavg[2]); +} +#endif + +#ifdef MS_WINDOWS + +PyDoc_STRVAR(win32_urandom__doc__, +"urandom(n) -> str\n\n\ +Return a string of n random bytes suitable for cryptographic use."); + +typedef BOOL (WINAPI *CRYPTACQUIRECONTEXTA)(HCRYPTPROV *phProv,\ + LPCSTR pszContainer, LPCSTR pszProvider, DWORD dwProvType,\ + DWORD dwFlags ); +typedef BOOL (WINAPI *CRYPTGENRANDOM)(HCRYPTPROV hProv, DWORD dwLen,\ + BYTE *pbBuffer ); + +static CRYPTGENRANDOM pCryptGenRandom = NULL; +/* This handle is never explicitly released. Instead, the operating + system will release it when the process terminates. */ +static HCRYPTPROV hCryptProv = 0; + +static PyObject* +win32_urandom(PyObject *self, PyObject *args) +{ + int howMany; + PyObject* result; + + /* Read arguments */ + if (! PyArg_ParseTuple(args, "i:urandom", &howMany)) + return NULL; + if (howMany < 0) + return PyErr_Format(PyExc_ValueError, + "negative argument not allowed"); + + if (hCryptProv == 0) { + HINSTANCE hAdvAPI32 = NULL; + CRYPTACQUIRECONTEXTA pCryptAcquireContext = NULL; + + /* Obtain handle to the DLL containing CryptoAPI + This should not fail */ + hAdvAPI32 = GetModuleHandle("advapi32.dll"); + if(hAdvAPI32 == NULL) + return win32_error("GetModuleHandle", NULL); + + /* Obtain pointers to the CryptoAPI functions + This will fail on some early versions of Win95 */ + pCryptAcquireContext = (CRYPTACQUIRECONTEXTA)GetProcAddress( + hAdvAPI32, + "CryptAcquireContextA"); + if (pCryptAcquireContext == NULL) + return PyErr_Format(PyExc_NotImplementedError, + "CryptAcquireContextA not found"); + + pCryptGenRandom = (CRYPTGENRANDOM)GetProcAddress( + hAdvAPI32, "CryptGenRandom"); + if (pCryptGenRandom == NULL) + return PyErr_Format(PyExc_NotImplementedError, + "CryptGenRandom not found"); + + /* Acquire context */ + if (! pCryptAcquireContext(&hCryptProv, NULL, NULL, + PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) + return win32_error("CryptAcquireContext", NULL); + } + + /* Allocate bytes */ + result = PyString_FromStringAndSize(NULL, howMany); + if (result != NULL) { + /* Get random data */ + memset(PyString_AS_STRING(result), 0, howMany); /* zero seed */ + if (! pCryptGenRandom(hCryptProv, howMany, (unsigned char*) + PyString_AS_STRING(result))) { + Py_DECREF(result); + return win32_error("CryptGenRandom", NULL); + } + } + return result; +} +#endif + +#ifdef __VMS +/* Use openssl random routine */ +#include <openssl/rand.h> +PyDoc_STRVAR(vms_urandom__doc__, +"urandom(n) -> str\n\n\ +Return a string of n random bytes suitable for cryptographic use."); + +static PyObject* +vms_urandom(PyObject *self, PyObject *args) +{ + int howMany; + PyObject* result; + + /* Read arguments */ + if (! PyArg_ParseTuple(args, "i:urandom", &howMany)) + return NULL; + if (howMany < 0) + return PyErr_Format(PyExc_ValueError, + "negative argument not allowed"); + + /* Allocate bytes */ + result = PyString_FromStringAndSize(NULL, howMany); + if (result != NULL) { + /* Get random data */ + if (RAND_pseudo_bytes((unsigned char*) + PyString_AS_STRING(result), + howMany) < 0) { + Py_DECREF(result); + return PyErr_Format(PyExc_ValueError, + "RAND_pseudo_bytes"); + } + } + return result; +} +#endif + +#ifdef HAVE_SETRESUID +PyDoc_STRVAR(posix_setresuid__doc__, +"setresuid(ruid, euid, suid)\n\n\ +Set the current process's real, effective, and saved user ids."); + +static PyObject* +posix_setresuid (PyObject *self, PyObject *args) +{ + /* We assume uid_t is no larger than a long. */ + long ruid, euid, suid; + if (!PyArg_ParseTuple(args, "lll", &ruid, &euid, &suid)) + return NULL; + if (setresuid(ruid, euid, suid) < 0) + return posix_error(); + Py_RETURN_NONE; +} +#endif + +#ifdef HAVE_SETRESGID +PyDoc_STRVAR(posix_setresgid__doc__, +"setresgid(rgid, egid, sgid)\n\n\ +Set the current process's real, effective, and saved group ids."); + +static PyObject* +posix_setresgid (PyObject *self, PyObject *args) +{ + /* We assume uid_t is no larger than a long. */ + long rgid, egid, sgid; + if (!PyArg_ParseTuple(args, "lll", &rgid, &egid, &sgid)) + return NULL; + if (setresgid(rgid, egid, sgid) < 0) + return posix_error(); + Py_RETURN_NONE; +} +#endif + +#ifdef HAVE_GETRESUID +PyDoc_STRVAR(posix_getresuid__doc__, +"getresuid() -> (ruid, euid, suid)\n\n\ +Get tuple of the current process's real, effective, and saved user ids."); + +static PyObject* +posix_getresuid (PyObject *self, PyObject *noargs) +{ + uid_t ruid, euid, suid; + long l_ruid, l_euid, l_suid; + if (getresuid(&ruid, &euid, &suid) < 0) + return posix_error(); + /* Force the values into long's as we don't know the size of uid_t. */ + l_ruid = ruid; + l_euid = euid; + l_suid = suid; + return Py_BuildValue("(lll)", l_ruid, l_euid, l_suid); +} +#endif + +#ifdef HAVE_GETRESGID +PyDoc_STRVAR(posix_getresgid__doc__, +"getresgid() -> (rgid, egid, sgid)\n\n\ +Get tuple of the current process's real, effective, and saved group ids."); + +static PyObject* +posix_getresgid (PyObject *self, PyObject *noargs) +{ + uid_t rgid, egid, sgid; + long l_rgid, l_egid, l_sgid; + if (getresgid(&rgid, &egid, &sgid) < 0) + return posix_error(); + /* Force the values into long's as we don't know the size of uid_t. */ + l_rgid = rgid; + l_egid = egid; + l_sgid = sgid; + return Py_BuildValue("(lll)", l_rgid, l_egid, l_sgid); +} +#endif + +static PyMethodDef posix_methods[] = { + {"access", posix_access, METH_VARARGS, posix_access__doc__}, +#ifdef HAVE_TTYNAME + {"ttyname", posix_ttyname, METH_VARARGS, posix_ttyname__doc__}, +#endif + {"chdir", posix_chdir, METH_VARARGS, posix_chdir__doc__}, +#ifdef HAVE_CHFLAGS + {"chflags", posix_chflags, METH_VARARGS, posix_chflags__doc__}, +#endif /* HAVE_CHFLAGS */ + {"chmod", posix_chmod, METH_VARARGS, posix_chmod__doc__}, +#ifdef HAVE_FCHMOD + {"fchmod", posix_fchmod, METH_VARARGS, posix_fchmod__doc__}, +#endif /* HAVE_FCHMOD */ +#ifdef HAVE_CHOWN + {"chown", posix_chown, METH_VARARGS, posix_chown__doc__}, +#endif /* HAVE_CHOWN */ +#ifdef HAVE_LCHMOD + {"lchmod", posix_lchmod, METH_VARARGS, posix_lchmod__doc__}, +#endif /* HAVE_LCHMOD */ +#ifdef HAVE_FCHOWN + {"fchown", posix_fchown, METH_VARARGS, posix_fchown__doc__}, +#endif /* HAVE_FCHOWN */ +#ifdef HAVE_LCHFLAGS + {"lchflags", posix_lchflags, METH_VARARGS, posix_lchflags__doc__}, +#endif /* HAVE_LCHFLAGS */ +#ifdef HAVE_LCHOWN + {"lchown", posix_lchown, METH_VARARGS, posix_lchown__doc__}, +#endif /* HAVE_LCHOWN */ +#ifdef HAVE_CHROOT + {"chroot", posix_chroot, METH_VARARGS, posix_chroot__doc__}, +#endif +#ifdef HAVE_CTERMID + {"ctermid", posix_ctermid, METH_NOARGS, posix_ctermid__doc__}, +#endif +#ifdef HAVE_GETCWD + {"getcwd", posix_getcwd, METH_NOARGS, posix_getcwd__doc__}, +#ifdef Py_USING_UNICODE + {"getcwdu", posix_getcwdu, METH_NOARGS, posix_getcwdu__doc__}, +#endif +#endif +#ifdef HAVE_LINK + {"link", posix_link, METH_VARARGS, posix_link__doc__}, +#endif /* HAVE_LINK */ + {"listdir", posix_listdir, METH_VARARGS, posix_listdir__doc__}, + {"lstat", posix_lstat, METH_VARARGS, posix_lstat__doc__}, + {"mkdir", posix_mkdir, METH_VARARGS, posix_mkdir__doc__}, +#ifdef HAVE_NICE + {"nice", posix_nice, METH_VARARGS, posix_nice__doc__}, +#endif /* HAVE_NICE */ +#ifdef HAVE_READLINK + {"readlink", posix_readlink, METH_VARARGS, posix_readlink__doc__}, +#endif /* HAVE_READLINK */ + {"rename", posix_rename, METH_VARARGS, posix_rename__doc__}, + {"rmdir", posix_rmdir, METH_VARARGS, posix_rmdir__doc__}, + {"stat", posix_stat, METH_VARARGS, posix_stat__doc__}, + {"stat_float_times", stat_float_times, METH_VARARGS, stat_float_times__doc__}, +#ifdef HAVE_SYMLINK + {"symlink", posix_symlink, METH_VARARGS, posix_symlink__doc__}, +#endif /* HAVE_SYMLINK */ +#ifdef HAVE_SYSTEM + {"system", posix_system, METH_VARARGS, posix_system__doc__}, +#endif + {"umask", posix_umask, METH_VARARGS, posix_umask__doc__}, +#ifdef HAVE_UNAME + {"uname", posix_uname, METH_NOARGS, posix_uname__doc__}, +#endif /* HAVE_UNAME */ + {"unlink", posix_unlink, METH_VARARGS, posix_unlink__doc__}, + {"remove", posix_unlink, METH_VARARGS, posix_remove__doc__}, + {"utime", posix_utime, METH_VARARGS, posix_utime__doc__}, +#ifdef HAVE_TIMES + {"times", posix_times, METH_NOARGS, posix_times__doc__}, +#endif /* HAVE_TIMES */ + {"_exit", posix__exit, METH_VARARGS, posix__exit__doc__}, +#ifdef HAVE_EXECV + {"execv", posix_execv, METH_VARARGS, posix_execv__doc__}, + {"execve", posix_execve, METH_VARARGS, posix_execve__doc__}, +#endif /* HAVE_EXECV */ +#ifdef HAVE_SPAWNV + {"spawnv", posix_spawnv, METH_VARARGS, posix_spawnv__doc__}, + {"spawnve", posix_spawnve, METH_VARARGS, posix_spawnve__doc__}, +#if defined(PYOS_OS2) + {"spawnvp", posix_spawnvp, METH_VARARGS, posix_spawnvp__doc__}, + {"spawnvpe", posix_spawnvpe, METH_VARARGS, posix_spawnvpe__doc__}, +#endif /* PYOS_OS2 */ +#endif /* HAVE_SPAWNV */ +#ifdef HAVE_FORK1 + {"fork1", posix_fork1, METH_NOARGS, posix_fork1__doc__}, +#endif /* HAVE_FORK1 */ +#ifdef HAVE_FORK + {"fork", posix_fork, METH_NOARGS, posix_fork__doc__}, +#endif /* HAVE_FORK */ +#if defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX) + {"openpty", posix_openpty, METH_NOARGS, posix_openpty__doc__}, +#endif /* HAVE_OPENPTY || HAVE__GETPTY || HAVE_DEV_PTMX */ +#ifdef HAVE_FORKPTY + {"forkpty", posix_forkpty, METH_NOARGS, posix_forkpty__doc__}, +#endif /* HAVE_FORKPTY */ +#ifdef HAVE_GETEGID + {"getegid", posix_getegid, METH_NOARGS, posix_getegid__doc__}, +#endif /* HAVE_GETEGID */ +#ifdef HAVE_GETEUID + {"geteuid", posix_geteuid, METH_NOARGS, posix_geteuid__doc__}, +#endif /* HAVE_GETEUID */ +#ifdef HAVE_GETGID + {"getgid", posix_getgid, METH_NOARGS, posix_getgid__doc__}, +#endif /* HAVE_GETGID */ +#ifdef HAVE_GETGROUPS + {"getgroups", posix_getgroups, METH_NOARGS, posix_getgroups__doc__}, +#endif + {"getpid", posix_getpid, METH_NOARGS, posix_getpid__doc__}, +#ifdef HAVE_GETPGRP + {"getpgrp", posix_getpgrp, METH_NOARGS, posix_getpgrp__doc__}, +#endif /* HAVE_GETPGRP */ +#ifdef HAVE_GETPPID + {"getppid", posix_getppid, METH_NOARGS, posix_getppid__doc__}, +#endif /* HAVE_GETPPID */ +#ifdef HAVE_GETUID + {"getuid", posix_getuid, METH_NOARGS, posix_getuid__doc__}, +#endif /* HAVE_GETUID */ +#ifdef HAVE_GETLOGIN + {"getlogin", posix_getlogin, METH_NOARGS, posix_getlogin__doc__}, +#endif +#ifdef HAVE_KILL + {"kill", posix_kill, METH_VARARGS, posix_kill__doc__}, +#endif /* HAVE_KILL */ +#ifdef HAVE_KILLPG + {"killpg", posix_killpg, METH_VARARGS, posix_killpg__doc__}, +#endif /* HAVE_KILLPG */ +#ifdef HAVE_PLOCK + {"plock", posix_plock, METH_VARARGS, posix_plock__doc__}, +#endif /* HAVE_PLOCK */ +#ifdef HAVE_POPEN + {"popen", posix_popen, METH_VARARGS, posix_popen__doc__}, +#ifdef MS_WINDOWS + {"popen2", win32_popen2, METH_VARARGS}, + {"popen3", win32_popen3, METH_VARARGS}, + {"popen4", win32_popen4, METH_VARARGS}, + {"startfile", win32_startfile, METH_VARARGS, win32_startfile__doc__}, + {"kill", win32_kill, METH_VARARGS, win32_kill__doc__}, +#else +#if defined(PYOS_OS2) && defined(PYCC_GCC) + {"popen2", os2emx_popen2, METH_VARARGS}, + {"popen3", os2emx_popen3, METH_VARARGS}, + {"popen4", os2emx_popen4, METH_VARARGS}, +#endif +#endif +#endif /* HAVE_POPEN */ +#ifdef HAVE_SETUID + {"setuid", posix_setuid, METH_VARARGS, posix_setuid__doc__}, +#endif /* HAVE_SETUID */ +#ifdef HAVE_SETEUID + {"seteuid", posix_seteuid, METH_VARARGS, posix_seteuid__doc__}, +#endif /* HAVE_SETEUID */ +#ifdef HAVE_SETEGID + {"setegid", posix_setegid, METH_VARARGS, posix_setegid__doc__}, +#endif /* HAVE_SETEGID */ +#ifdef HAVE_SETREUID + {"setreuid", posix_setreuid, METH_VARARGS, posix_setreuid__doc__}, +#endif /* HAVE_SETREUID */ +#ifdef HAVE_SETREGID + {"setregid", posix_setregid, METH_VARARGS, posix_setregid__doc__}, +#endif /* HAVE_SETREGID */ +#ifdef HAVE_SETGID + {"setgid", posix_setgid, METH_VARARGS, posix_setgid__doc__}, +#endif /* HAVE_SETGID */ +#ifdef HAVE_SETGROUPS + {"setgroups", posix_setgroups, METH_O, posix_setgroups__doc__}, +#endif /* HAVE_SETGROUPS */ +#ifdef HAVE_INITGROUPS + {"initgroups", posix_initgroups, METH_VARARGS, posix_initgroups__doc__}, +#endif /* HAVE_INITGROUPS */ +#ifdef HAVE_GETPGID + {"getpgid", posix_getpgid, METH_VARARGS, posix_getpgid__doc__}, +#endif /* HAVE_GETPGID */ +#ifdef HAVE_SETPGRP + {"setpgrp", posix_setpgrp, METH_NOARGS, posix_setpgrp__doc__}, +#endif /* HAVE_SETPGRP */ +#ifdef HAVE_WAIT + {"wait", posix_wait, METH_NOARGS, posix_wait__doc__}, +#endif /* HAVE_WAIT */ +#ifdef HAVE_WAIT3 + {"wait3", posix_wait3, METH_VARARGS, posix_wait3__doc__}, +#endif /* HAVE_WAIT3 */ +#ifdef HAVE_WAIT4 + {"wait4", posix_wait4, METH_VARARGS, posix_wait4__doc__}, +#endif /* HAVE_WAIT4 */ +#if defined(HAVE_WAITPID) || defined(HAVE_CWAIT) + {"waitpid", posix_waitpid, METH_VARARGS, posix_waitpid__doc__}, +#endif /* HAVE_WAITPID */ +#ifdef HAVE_GETSID + {"getsid", posix_getsid, METH_VARARGS, posix_getsid__doc__}, +#endif /* HAVE_GETSID */ +#ifdef HAVE_SETSID + {"setsid", posix_setsid, METH_NOARGS, posix_setsid__doc__}, +#endif /* HAVE_SETSID */ +#ifdef HAVE_SETPGID + {"setpgid", posix_setpgid, METH_VARARGS, posix_setpgid__doc__}, +#endif /* HAVE_SETPGID */ +#ifdef HAVE_TCGETPGRP + {"tcgetpgrp", posix_tcgetpgrp, METH_VARARGS, posix_tcgetpgrp__doc__}, +#endif /* HAVE_TCGETPGRP */ +#ifdef HAVE_TCSETPGRP + {"tcsetpgrp", posix_tcsetpgrp, METH_VARARGS, posix_tcsetpgrp__doc__}, +#endif /* HAVE_TCSETPGRP */ + {"open", posix_open, METH_VARARGS, posix_open__doc__}, + {"close", posix_close, METH_VARARGS, posix_close__doc__}, + {"closerange", posix_closerange, METH_VARARGS, posix_closerange__doc__}, + {"dup", posix_dup, METH_VARARGS, posix_dup__doc__}, + {"dup2", posix_dup2, METH_VARARGS, posix_dup2__doc__}, + {"lseek", posix_lseek, METH_VARARGS, posix_lseek__doc__}, + {"read", posix_read, METH_VARARGS, posix_read__doc__}, + {"write", posix_write, METH_VARARGS, posix_write__doc__}, + {"fstat", posix_fstat, METH_VARARGS, posix_fstat__doc__}, + {"fdopen", posix_fdopen, METH_VARARGS, posix_fdopen__doc__}, + {"isatty", posix_isatty, METH_VARARGS, posix_isatty__doc__}, +#ifdef HAVE_PIPE + {"pipe", posix_pipe, METH_NOARGS, posix_pipe__doc__}, +#endif +#ifdef HAVE_MKFIFO + {"mkfifo", posix_mkfifo, METH_VARARGS, posix_mkfifo__doc__}, +#endif +#if defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV) + {"mknod", posix_mknod, METH_VARARGS, posix_mknod__doc__}, +#endif +#ifdef HAVE_DEVICE_MACROS + {"major", posix_major, METH_VARARGS, posix_major__doc__}, + {"minor", posix_minor, METH_VARARGS, posix_minor__doc__}, + {"makedev", posix_makedev, METH_VARARGS, posix_makedev__doc__}, +#endif +#ifdef HAVE_FTRUNCATE + {"ftruncate", posix_ftruncate, METH_VARARGS, posix_ftruncate__doc__}, +#endif +#ifdef HAVE_PUTENV + {"putenv", posix_putenv, METH_VARARGS, posix_putenv__doc__}, +#endif +#ifdef HAVE_UNSETENV + {"unsetenv", posix_unsetenv, METH_VARARGS, posix_unsetenv__doc__}, +#endif + {"strerror", posix_strerror, METH_VARARGS, posix_strerror__doc__}, +#ifdef HAVE_FCHDIR + {"fchdir", posix_fchdir, METH_O, posix_fchdir__doc__}, +#endif +#ifdef HAVE_FSYNC + {"fsync", posix_fsync, METH_O, posix_fsync__doc__}, +#endif +#ifdef HAVE_FDATASYNC + {"fdatasync", posix_fdatasync, METH_O, posix_fdatasync__doc__}, +#endif +#ifdef HAVE_SYS_WAIT_H +#ifdef WCOREDUMP + {"WCOREDUMP", posix_WCOREDUMP, METH_VARARGS, posix_WCOREDUMP__doc__}, +#endif /* WCOREDUMP */ +#ifdef WIFCONTINUED + {"WIFCONTINUED",posix_WIFCONTINUED, METH_VARARGS, posix_WIFCONTINUED__doc__}, +#endif /* WIFCONTINUED */ +#ifdef WIFSTOPPED + {"WIFSTOPPED", posix_WIFSTOPPED, METH_VARARGS, posix_WIFSTOPPED__doc__}, +#endif /* WIFSTOPPED */ +#ifdef WIFSIGNALED + {"WIFSIGNALED", posix_WIFSIGNALED, METH_VARARGS, posix_WIFSIGNALED__doc__}, +#endif /* WIFSIGNALED */ +#ifdef WIFEXITED + {"WIFEXITED", posix_WIFEXITED, METH_VARARGS, posix_WIFEXITED__doc__}, +#endif /* WIFEXITED */ +#ifdef WEXITSTATUS + {"WEXITSTATUS", posix_WEXITSTATUS, METH_VARARGS, posix_WEXITSTATUS__doc__}, +#endif /* WEXITSTATUS */ +#ifdef WTERMSIG + {"WTERMSIG", posix_WTERMSIG, METH_VARARGS, posix_WTERMSIG__doc__}, +#endif /* WTERMSIG */ +#ifdef WSTOPSIG + {"WSTOPSIG", posix_WSTOPSIG, METH_VARARGS, posix_WSTOPSIG__doc__}, +#endif /* WSTOPSIG */ +#endif /* HAVE_SYS_WAIT_H */ +#if defined(HAVE_FSTATVFS) && defined(HAVE_SYS_STATVFS_H) + {"fstatvfs", posix_fstatvfs, METH_VARARGS, posix_fstatvfs__doc__}, +#endif +#if defined(HAVE_STATVFS) && defined(HAVE_SYS_STATVFS_H) + {"statvfs", posix_statvfs, METH_VARARGS, posix_statvfs__doc__}, +#endif +#ifdef HAVE_TMPFILE + {"tmpfile", posix_tmpfile, METH_NOARGS, posix_tmpfile__doc__}, +#endif +#ifdef HAVE_TEMPNAM + {"tempnam", posix_tempnam, METH_VARARGS, posix_tempnam__doc__}, +#endif +#ifdef HAVE_TMPNAM + {"tmpnam", posix_tmpnam, METH_NOARGS, posix_tmpnam__doc__}, +#endif +#ifdef HAVE_CONFSTR + {"confstr", posix_confstr, METH_VARARGS, posix_confstr__doc__}, +#endif +#ifdef HAVE_SYSCONF + {"sysconf", posix_sysconf, METH_VARARGS, posix_sysconf__doc__}, +#endif +#ifdef HAVE_FPATHCONF + {"fpathconf", posix_fpathconf, METH_VARARGS, posix_fpathconf__doc__}, +#endif +#ifdef HAVE_PATHCONF + {"pathconf", posix_pathconf, METH_VARARGS, posix_pathconf__doc__}, +#endif + {"abort", posix_abort, METH_NOARGS, posix_abort__doc__}, +#ifdef MS_WINDOWS + {"_getfullpathname", posix__getfullpathname, METH_VARARGS, NULL}, +#endif +#ifdef HAVE_GETLOADAVG + {"getloadavg", posix_getloadavg, METH_NOARGS, posix_getloadavg__doc__}, +#endif + #ifdef MS_WINDOWS + {"urandom", win32_urandom, METH_VARARGS, win32_urandom__doc__}, + #endif + #ifdef __VMS + {"urandom", vms_urandom, METH_VARARGS, vms_urandom__doc__}, + #endif +#ifdef HAVE_SETRESUID + {"setresuid", posix_setresuid, METH_VARARGS, posix_setresuid__doc__}, +#endif +#ifdef HAVE_SETRESGID + {"setresgid", posix_setresgid, METH_VARARGS, posix_setresgid__doc__}, +#endif +#ifdef HAVE_GETRESUID + {"getresuid", posix_getresuid, METH_NOARGS, posix_getresuid__doc__}, +#endif +#ifdef HAVE_GETRESGID + {"getresgid", posix_getresgid, METH_NOARGS, posix_getresgid__doc__}, +#endif + + {NULL, NULL} /* Sentinel */ +}; + + +static int +ins(PyObject *module, char *symbol, long value) +{ + return PyModule_AddIntConstant(module, symbol, value); +} + +#if defined(PYOS_OS2) +/* Insert Platform-Specific Constant Values (Strings & Numbers) of Common Use */ +static int insertvalues(PyObject *module) +{ + APIRET rc; + ULONG values[QSV_MAX+1]; + PyObject *v; + char *ver, tmp[50]; + + Py_BEGIN_ALLOW_THREADS + rc = DosQuerySysInfo(1L, QSV_MAX, &values[1], sizeof(ULONG) * QSV_MAX); + Py_END_ALLOW_THREADS + + if (rc != NO_ERROR) { + os2_error(rc); + return -1; + } + + if (ins(module, "meminstalled", values[QSV_TOTPHYSMEM])) return -1; + if (ins(module, "memkernel", values[QSV_TOTRESMEM])) return -1; + if (ins(module, "memvirtual", values[QSV_TOTAVAILMEM])) return -1; + if (ins(module, "maxpathlen", values[QSV_MAX_PATH_LENGTH])) return -1; + if (ins(module, "maxnamelen", values[QSV_MAX_COMP_LENGTH])) return -1; + if (ins(module, "revision", values[QSV_VERSION_REVISION])) return -1; + if (ins(module, "timeslice", values[QSV_MIN_SLICE])) return -1; + + switch (values[QSV_VERSION_MINOR]) { + case 0: ver = "2.00"; break; + case 10: ver = "2.10"; break; + case 11: ver = "2.11"; break; + case 30: ver = "3.00"; break; + case 40: ver = "4.00"; break; + case 50: ver = "5.00"; break; + default: + PyOS_snprintf(tmp, sizeof(tmp), + "%d-%d", values[QSV_VERSION_MAJOR], + values[QSV_VERSION_MINOR]); + ver = &tmp[0]; + } + + /* Add Indicator of the Version of the Operating System */ + if (PyModule_AddStringConstant(module, "version", tmp) < 0) + return -1; + + /* Add Indicator of Which Drive was Used to Boot the System */ + tmp[0] = 'A' + values[QSV_BOOT_DRIVE] - 1; + tmp[1] = ':'; + tmp[2] = '\0'; + + return PyModule_AddStringConstant(module, "bootdrive", tmp); +} +#endif + +static int +all_ins(PyObject *d) +{ +#ifdef F_OK + if (ins(d, "F_OK", (long)F_OK)) return -1; +#endif +#ifdef R_OK + if (ins(d, "R_OK", (long)R_OK)) return -1; +#endif +#ifdef W_OK + if (ins(d, "W_OK", (long)W_OK)) return -1; +#endif +#ifdef X_OK + if (ins(d, "X_OK", (long)X_OK)) return -1; +#endif +#ifdef NGROUPS_MAX + if (ins(d, "NGROUPS_MAX", (long)NGROUPS_MAX)) return -1; +#endif +#ifdef TMP_MAX + if (ins(d, "TMP_MAX", (long)TMP_MAX)) return -1; +#endif +#ifdef WCONTINUED + if (ins(d, "WCONTINUED", (long)WCONTINUED)) return -1; +#endif +#ifdef WNOHANG + if (ins(d, "WNOHANG", (long)WNOHANG)) return -1; +#endif +#ifdef WUNTRACED + if (ins(d, "WUNTRACED", (long)WUNTRACED)) return -1; +#endif +#ifdef O_RDONLY + if (ins(d, "O_RDONLY", (long)O_RDONLY)) return -1; +#endif +#ifdef O_WRONLY + if (ins(d, "O_WRONLY", (long)O_WRONLY)) return -1; +#endif +#ifdef O_RDWR + if (ins(d, "O_RDWR", (long)O_RDWR)) return -1; +#endif +#ifdef O_NDELAY + if (ins(d, "O_NDELAY", (long)O_NDELAY)) return -1; +#endif +#ifdef O_NONBLOCK + if (ins(d, "O_NONBLOCK", (long)O_NONBLOCK)) return -1; +#endif +#ifdef O_APPEND + if (ins(d, "O_APPEND", (long)O_APPEND)) return -1; +#endif +#ifdef O_DSYNC + if (ins(d, "O_DSYNC", (long)O_DSYNC)) return -1; +#endif +#ifdef O_RSYNC + if (ins(d, "O_RSYNC", (long)O_RSYNC)) return -1; +#endif +#ifdef O_SYNC + if (ins(d, "O_SYNC", (long)O_SYNC)) return -1; +#endif +#ifdef O_NOCTTY + if (ins(d, "O_NOCTTY", (long)O_NOCTTY)) return -1; +#endif +#ifdef O_CREAT + if (ins(d, "O_CREAT", (long)O_CREAT)) return -1; +#endif +#ifdef O_EXCL + if (ins(d, "O_EXCL", (long)O_EXCL)) return -1; +#endif +#ifdef O_TRUNC + if (ins(d, "O_TRUNC", (long)O_TRUNC)) return -1; +#endif +#ifdef O_BINARY + if (ins(d, "O_BINARY", (long)O_BINARY)) return -1; +#endif +#ifdef O_TEXT + if (ins(d, "O_TEXT", (long)O_TEXT)) return -1; +#endif +#ifdef O_LARGEFILE + if (ins(d, "O_LARGEFILE", (long)O_LARGEFILE)) return -1; +#endif +#ifdef O_SHLOCK + if (ins(d, "O_SHLOCK", (long)O_SHLOCK)) return -1; +#endif +#ifdef O_EXLOCK + if (ins(d, "O_EXLOCK", (long)O_EXLOCK)) return -1; +#endif + +/* MS Windows */ +#ifdef O_NOINHERIT + /* Don't inherit in child processes. */ + if (ins(d, "O_NOINHERIT", (long)O_NOINHERIT)) return -1; +#endif +#ifdef _O_SHORT_LIVED + /* Optimize for short life (keep in memory). */ + /* MS forgot to define this one with a non-underscore form too. */ + if (ins(d, "O_SHORT_LIVED", (long)_O_SHORT_LIVED)) return -1; +#endif +#ifdef O_TEMPORARY + /* Automatically delete when last handle is closed. */ + if (ins(d, "O_TEMPORARY", (long)O_TEMPORARY)) return -1; +#endif +#ifdef O_RANDOM + /* Optimize for random access. */ + if (ins(d, "O_RANDOM", (long)O_RANDOM)) return -1; +#endif +#ifdef O_SEQUENTIAL + /* Optimize for sequential access. */ + if (ins(d, "O_SEQUENTIAL", (long)O_SEQUENTIAL)) return -1; +#endif + +/* GNU extensions. */ +#ifdef O_ASYNC + /* Send a SIGIO signal whenever input or output + becomes available on file descriptor */ + if (ins(d, "O_ASYNC", (long)O_ASYNC)) return -1; +#endif +#ifdef O_DIRECT + /* Direct disk access. */ + if (ins(d, "O_DIRECT", (long)O_DIRECT)) return -1; +#endif +#ifdef O_DIRECTORY + /* Must be a directory. */ + if (ins(d, "O_DIRECTORY", (long)O_DIRECTORY)) return -1; +#endif +#ifdef O_NOFOLLOW + /* Do not follow links. */ + if (ins(d, "O_NOFOLLOW", (long)O_NOFOLLOW)) return -1; +#endif +#ifdef O_NOATIME + /* Do not update the access time. */ + if (ins(d, "O_NOATIME", (long)O_NOATIME)) return -1; +#endif + + /* These come from sysexits.h */ +#ifdef EX_OK + if (ins(d, "EX_OK", (long)EX_OK)) return -1; +#endif /* EX_OK */ +#ifdef EX_USAGE + if (ins(d, "EX_USAGE", (long)EX_USAGE)) return -1; +#endif /* EX_USAGE */ +#ifdef EX_DATAERR + if (ins(d, "EX_DATAERR", (long)EX_DATAERR)) return -1; +#endif /* EX_DATAERR */ +#ifdef EX_NOINPUT + if (ins(d, "EX_NOINPUT", (long)EX_NOINPUT)) return -1; +#endif /* EX_NOINPUT */ +#ifdef EX_NOUSER + if (ins(d, "EX_NOUSER", (long)EX_NOUSER)) return -1; +#endif /* EX_NOUSER */ +#ifdef EX_NOHOST + if (ins(d, "EX_NOHOST", (long)EX_NOHOST)) return -1; +#endif /* EX_NOHOST */ +#ifdef EX_UNAVAILABLE + if (ins(d, "EX_UNAVAILABLE", (long)EX_UNAVAILABLE)) return -1; +#endif /* EX_UNAVAILABLE */ +#ifdef EX_SOFTWARE + if (ins(d, "EX_SOFTWARE", (long)EX_SOFTWARE)) return -1; +#endif /* EX_SOFTWARE */ +#ifdef EX_OSERR + if (ins(d, "EX_OSERR", (long)EX_OSERR)) return -1; +#endif /* EX_OSERR */ +#ifdef EX_OSFILE + if (ins(d, "EX_OSFILE", (long)EX_OSFILE)) return -1; +#endif /* EX_OSFILE */ +#ifdef EX_CANTCREAT + if (ins(d, "EX_CANTCREAT", (long)EX_CANTCREAT)) return -1; +#endif /* EX_CANTCREAT */ +#ifdef EX_IOERR + if (ins(d, "EX_IOERR", (long)EX_IOERR)) return -1; +#endif /* EX_IOERR */ +#ifdef EX_TEMPFAIL + if (ins(d, "EX_TEMPFAIL", (long)EX_TEMPFAIL)) return -1; +#endif /* EX_TEMPFAIL */ +#ifdef EX_PROTOCOL + if (ins(d, "EX_PROTOCOL", (long)EX_PROTOCOL)) return -1; +#endif /* EX_PROTOCOL */ +#ifdef EX_NOPERM + if (ins(d, "EX_NOPERM", (long)EX_NOPERM)) return -1; +#endif /* EX_NOPERM */ +#ifdef EX_CONFIG + if (ins(d, "EX_CONFIG", (long)EX_CONFIG)) return -1; +#endif /* EX_CONFIG */ +#ifdef EX_NOTFOUND + if (ins(d, "EX_NOTFOUND", (long)EX_NOTFOUND)) return -1; +#endif /* EX_NOTFOUND */ + +#ifdef HAVE_SPAWNV +#if defined(PYOS_OS2) && defined(PYCC_GCC) + if (ins(d, "P_WAIT", (long)P_WAIT)) return -1; + if (ins(d, "P_NOWAIT", (long)P_NOWAIT)) return -1; + if (ins(d, "P_OVERLAY", (long)P_OVERLAY)) return -1; + if (ins(d, "P_DEBUG", (long)P_DEBUG)) return -1; + if (ins(d, "P_SESSION", (long)P_SESSION)) return -1; + if (ins(d, "P_DETACH", (long)P_DETACH)) return -1; + if (ins(d, "P_PM", (long)P_PM)) return -1; + if (ins(d, "P_DEFAULT", (long)P_DEFAULT)) return -1; + if (ins(d, "P_MINIMIZE", (long)P_MINIMIZE)) return -1; + if (ins(d, "P_MAXIMIZE", (long)P_MAXIMIZE)) return -1; + if (ins(d, "P_FULLSCREEN", (long)P_FULLSCREEN)) return -1; + if (ins(d, "P_WINDOWED", (long)P_WINDOWED)) return -1; + if (ins(d, "P_FOREGROUND", (long)P_FOREGROUND)) return -1; + if (ins(d, "P_BACKGROUND", (long)P_BACKGROUND)) return -1; + if (ins(d, "P_NOCLOSE", (long)P_NOCLOSE)) return -1; + if (ins(d, "P_NOSESSION", (long)P_NOSESSION)) return -1; + if (ins(d, "P_QUOTE", (long)P_QUOTE)) return -1; + if (ins(d, "P_TILDE", (long)P_TILDE)) return -1; + if (ins(d, "P_UNRELATED", (long)P_UNRELATED)) return -1; + if (ins(d, "P_DEBUGDESC", (long)P_DEBUGDESC)) return -1; +#else + if (ins(d, "P_WAIT", (long)_P_WAIT)) return -1; + if (ins(d, "P_NOWAIT", (long)_P_NOWAIT)) return -1; + if (ins(d, "P_OVERLAY", (long)_OLD_P_OVERLAY)) return -1; + if (ins(d, "P_NOWAITO", (long)_P_NOWAITO)) return -1; + if (ins(d, "P_DETACH", (long)_P_DETACH)) return -1; +#endif +#endif + +#if defined(PYOS_OS2) + if (insertvalues(d)) return -1; +#endif + return 0; +} + + +#if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__)) && !defined(__QNX__) +#define INITFUNC initnt +#define MODNAME "nt" + +#elif defined(PYOS_OS2) +#define INITFUNC initos2 +#define MODNAME "os2" + +#else +#define INITFUNC initposix +#define MODNAME "posix" +#endif + +PyMODINIT_FUNC +INITFUNC(void) +{ + PyObject *m, *v; + + m = Py_InitModule3(MODNAME, + posix_methods, + posix__doc__); + if (m == NULL) + return; + + /* Initialize environ dictionary */ + v = convertenviron(); + Py_XINCREF(v); + if (v == NULL || PyModule_AddObject(m, "environ", v) != 0) + return; + Py_DECREF(v); + + if (all_ins(m)) + return; + + if (setup_confname_tables(m)) + return; + + Py_INCREF(PyExc_OSError); + PyModule_AddObject(m, "error", PyExc_OSError); + +#ifdef HAVE_PUTENV + if (posix_putenv_garbage == NULL) + posix_putenv_garbage = PyDict_New(); +#endif + + if (!initialized) { + stat_result_desc.name = MODNAME ".stat_result"; + stat_result_desc.fields[7].name = PyStructSequence_UnnamedField; + stat_result_desc.fields[8].name = PyStructSequence_UnnamedField; + stat_result_desc.fields[9].name = PyStructSequence_UnnamedField; + PyStructSequence_InitType(&StatResultType, &stat_result_desc); + structseq_new = StatResultType.tp_new; + StatResultType.tp_new = statresult_new; + + statvfs_result_desc.name = MODNAME ".statvfs_result"; + PyStructSequence_InitType(&StatVFSResultType, &statvfs_result_desc); +#ifdef NEED_TICKS_PER_SECOND +# if defined(HAVE_SYSCONF) && defined(_SC_CLK_TCK) + ticks_per_second = sysconf(_SC_CLK_TCK); +# elif defined(HZ) + ticks_per_second = HZ; +# else + ticks_per_second = 60; /* magic fallback value; may be bogus */ +# endif +#endif + } + Py_INCREF((PyObject*) &StatResultType); + PyModule_AddObject(m, "stat_result", (PyObject*) &StatResultType); + Py_INCREF((PyObject*) &StatVFSResultType); + PyModule_AddObject(m, "statvfs_result", + (PyObject*) &StatVFSResultType); + initialized = 1; + +#ifdef __APPLE__ + /* + * Step 2 of weak-linking support on Mac OS X. + * + * The code below removes functions that are not available on the + * currently active platform. + * + * This block allow one to use a python binary that was build on + * OSX 10.4 on OSX 10.3, without loosing access to new APIs on + * OSX 10.4. + */ +#ifdef HAVE_FSTATVFS + if (fstatvfs == NULL) { + if (PyObject_DelAttrString(m, "fstatvfs") == -1) { + return; + } + } +#endif /* HAVE_FSTATVFS */ + +#ifdef HAVE_STATVFS + if (statvfs == NULL) { + if (PyObject_DelAttrString(m, "statvfs") == -1) { + return; + } + } +#endif /* HAVE_STATVFS */ + +# ifdef HAVE_LCHOWN + if (lchown == NULL) { + if (PyObject_DelAttrString(m, "lchown") == -1) { + return; + } + } +#endif /* HAVE_LCHOWN */ + + +#endif /* __APPLE__ */ + +} + +#ifdef __cplusplus +} +#endif + + diff --git a/package/python2/patches/patch-Modules_posixmodule_c b/package/python2/patches/patch-Modules_posixmodule_c deleted file mode 100644 index c14f7e5cb..000000000 --- a/package/python2/patches/patch-Modules_posixmodule_c +++ /dev/null @@ -1,16 +0,0 @@ ---- Python-2.7.1.orig/Modules/posixmodule.c 2010-11-26 18:35:50.000000000 +0100 -+++ Python-2.7.1/Modules/posixmodule.c 2010-12-27 21:23:45.000000000 +0100 -@@ -3775,13 +3775,6 @@ posix_openpty(PyObject *self, PyObject * - slave_fd = open(slave_name, O_RDWR | O_NOCTTY); /* open slave */ - if (slave_fd < 0) - return posix_error(); --#if !defined(__CYGWIN__) && !defined(HAVE_DEV_PTC) -- ioctl(slave_fd, I_PUSH, "ptem"); /* push ptem */ -- ioctl(slave_fd, I_PUSH, "ldterm"); /* push ldterm */ --#ifndef __hpux -- ioctl(slave_fd, I_PUSH, "ttcompat"); /* push ttcompat */ --#endif /* __hpux */ --#endif /* HAVE_CYGWIN */ - #endif /* HAVE_OPENPTY */ - - return Py_BuildValue("(ii)", master_fd, slave_fd); diff --git a/package/qemu/Makefile b/package/qemu/Makefile index 3ce9d6a19..f82e852b8 100644 --- a/package/qemu/Makefile +++ b/package/qemu/Makefile @@ -4,30 +4,30 @@ include $(TOPDIR)/rules.mk PKG_NAME:= qemu -PKG_VERSION:= 0.13.0 -PKG_RELEASE:= 2 -PKG_MD5SUM:= 397a0d665da8ba9d3b9583629f3d6421 +PKG_VERSION:= 0.14.0 +PKG_RELEASE:= 1 +PKG_MD5SUM:= f9d145d5c09de9f0984ffe9bd1229970 PKG_DESCR:= cpu and system emulator PKG_SECTION:= misc -PKG_DEPENDS:= zlib libSDL +PKG_DEPENDS:= zlib libsdl PKG_BUILDDEP:= zlib sdl PKG_URL:= http://wwww.qemu.org/ -PKG_SITES:= http://wiki.qemu.org/download/ +PKG_SITES:= http://download.savannah.gnu.org/releases/qemu/ -PKG_ARCH_DEPENDS:= x86 x86_64 +PKG_ARCH_DEPENDS:= native x86 x86_64 include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,QEMU,$(PKG_NAME),$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIG_STYLE:= minimal CONFIGURE_ARGS+= --host-cc=$(CC_FOR_BUILD) \ - --cross-prefix=$(TARGET_CROSS) \ --disable-user \ --prefix=/usr \ --sysconfdir=/etc \ --bindir=/usr/bin -TARGET_LDFLAGS+= -pthread -lrt +TARGET_LDFLAGS+= -pthread -lm -lrt post-install: $(INSTALL_DIR) $(IDIR_QEMU)/usr/share/qemu diff --git a/package/qemu/patches/patch-configure b/package/qemu/patches/patch-configure deleted file mode 100644 index 963c407fe..000000000 --- a/package/qemu/patches/patch-configure +++ /dev/null @@ -1,11 +0,0 @@ ---- qemu-0.13.0.orig/configure 2010-10-15 22:56:09.000000000 +0200 -+++ qemu-0.13.0/configure 2011-01-12 22:34:59.000000000 +0100 -@@ -136,7 +136,7 @@ QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_C - QEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS" - LDFLAGS="-g $LDFLAGS" - --gcc_flags="-Wold-style-declaration -Wold-style-definition -fstack-protector-all" -+gcc_flags="-Wold-style-declaration -Wold-style-definition" - cat > $TMPC << EOF - int main(void) { return 0; } - EOF diff --git a/package/qemu/patches/patch-hw_vhost_c b/package/qemu/patches/patch-hw_vhost_c deleted file mode 100644 index 71eccb83f..000000000 --- a/package/qemu/patches/patch-hw_vhost_c +++ /dev/null @@ -1,10 +0,0 @@ ---- qemu-0.13.0.orig/hw/vhost.c 2010-10-15 22:56:09.000000000 +0200 -+++ qemu-0.13.0/hw/vhost.c 2011-01-12 21:27:10.000000000 +0100 -@@ -11,7 +11,6 @@ - */ - - #include <sys/ioctl.h> --#include <sys/eventfd.h> - #include "vhost.h" - #include "hw/hw.h" - /* For range_get_last */ diff --git a/package/qemu/patches/patch-hw_vhost_net_c b/package/qemu/patches/patch-hw_vhost_net_c deleted file mode 100644 index 325d5a940..000000000 --- a/package/qemu/patches/patch-hw_vhost_net_c +++ /dev/null @@ -1,10 +0,0 @@ ---- qemu-0.13.0.orig/hw/vhost_net.c 2010-10-15 22:56:09.000000000 +0200 -+++ qemu-0.13.0/hw/vhost_net.c 2011-01-12 21:27:20.000000000 +0100 -@@ -20,7 +20,6 @@ - - #ifdef CONFIG_VHOST_NET - #include <linux/vhost.h> --#include <sys/eventfd.h> - #include <sys/socket.h> - #include <linux/kvm.h> - #include <fcntl.h> diff --git a/package/sdl-image/patches/patch-IMG_png_c b/package/sdl-image/patches/patch-IMG_png_c new file mode 100644 index 000000000..315c1f676 --- /dev/null +++ b/package/sdl-image/patches/patch-IMG_png_c @@ -0,0 +1,160 @@ +--- SDL_image-1.2.10.orig/IMG_png.c 2009-11-08 11:55:32.000000000 +0100 ++++ SDL_image-1.2.10/IMG_png.c 2011-04-01 20:26:38.981819248 +0200 +@@ -71,6 +71,10 @@ + #endif + #include <png.h> + ++/* Check for the older version of libpng */ ++#if (PNG_LIBPNG_VER_MAJOR == 1) && (PNG_LIBPNG_VER_MINOR < 4) ++#define LIBPNG_VERSION_12 ++#endif + + static struct { + int loaded; +@@ -80,6 +84,8 @@ static struct { + void (*png_destroy_read_struct) (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr); + png_uint_32 (*png_get_IHDR) (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, int *interlace_method, int *compression_method, int *filter_method); + png_voidp (*png_get_io_ptr) (png_structp png_ptr); ++ png_byte (*png_get_channels) (png_structp png_ptr, png_infop info_ptr); ++ png_uint_32 (*png_get_PLTE) (png_structp png_ptr, png_infop info_ptr, png_colorp *palette, int *num_palette); + png_uint_32 (*png_get_tRNS) (png_structp png_ptr, png_infop info_ptr, png_bytep *trans, int *num_trans, png_color_16p *trans_values); + png_uint_32 (*png_get_valid) (png_structp png_ptr, png_infop info_ptr, png_uint_32 flag); + void (*png_read_image) (png_structp png_ptr, png_bytepp image); +@@ -91,6 +97,9 @@ static struct { + void (*png_set_read_fn) (png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn); + void (*png_set_strip_16) (png_structp png_ptr); + int (*png_sig_cmp) (png_bytep sig, png_size_t start, png_size_t num_to_check); ++#ifndef LIBPNG_VERSION_12 ++ jmp_buf* (*png_set_longjmp_fn) (png_structp, png_longjmp_ptr, size_t); ++#endif + } lib; + + #ifdef LOAD_PNG_DYNAMIC +@@ -129,6 +138,13 @@ int IMG_InitPNG() + SDL_UnloadObject(lib.handle); + return -1; + } ++ lib.png_get_channels = ++ (png_byte (*) (png_structp, png_infop)) ++ SDL_LoadFunction(lib.handle, "png_get_channels"); ++ if ( lib.png_get_channels == NULL ) { ++ SDL_UnloadObject(lib.handle); ++ return -1; ++ } + lib.png_get_io_ptr = + (png_voidp (*) (png_structp)) + SDL_LoadFunction(lib.handle, "png_get_io_ptr"); +@@ -136,6 +152,13 @@ int IMG_InitPNG() + SDL_UnloadObject(lib.handle); + return -1; + } ++ lib.png_get_PLTE = ++ (png_uint_32 (*) (png_structp, png_infop, png_colorp *, int *)) ++ SDL_LoadFunction(lib.handle, "png_get_PLTE"); ++ if ( lib.png_get_PLTE == NULL ) { ++ SDL_UnloadObject(lib.handle); ++ return -1; ++ } + lib.png_get_tRNS = + (png_uint_32 (*) (png_structp, png_infop, png_bytep *, int *, png_color_16p *)) + SDL_LoadFunction(lib.handle, "png_get_tRNS"); +@@ -213,6 +236,15 @@ int IMG_InitPNG() + SDL_UnloadObject(lib.handle); + return -1; + } ++#ifndef LIBPNG_VERSION_12 ++ lib.png_set_longjmp_fn = ++ (jmp_buf * (*) (png_structp, png_longjmp_ptr, size_t)) ++ SDL_LoadFunction(lib.handle, "png_set_longjmp_fn"); ++ if ( lib.png_set_longjmp_fn == NULL ) { ++ SDL_UnloadObject(lib.handle); ++ return -1; ++ } ++#endif + } + ++lib.loaded; + +@@ -236,7 +268,9 @@ int IMG_InitPNG() + lib.png_create_read_struct = png_create_read_struct; + lib.png_destroy_read_struct = png_destroy_read_struct; + lib.png_get_IHDR = png_get_IHDR; ++ lib.png_get_channels = png_get_channels; + lib.png_get_io_ptr = png_get_io_ptr; ++ lib.png_get_PLTE = png_get_PLTE; + lib.png_get_tRNS = png_get_tRNS; + lib.png_get_valid = png_get_valid; + lib.png_read_image = png_read_image; +@@ -248,6 +282,9 @@ int IMG_InitPNG() + lib.png_set_read_fn = png_set_read_fn; + lib.png_set_strip_16 = png_set_strip_16; + lib.png_sig_cmp = png_sig_cmp; ++#ifndef LIBPNG_VERSION_12 ++ lib.png_set_longjmp_fn = png_set_longjmp_fn; ++#endif + } + ++lib.loaded; + +@@ -347,7 +384,12 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s + * the normal method of doing things with libpng). REQUIRED unless you + * set up your own error handlers in png_create_read_struct() earlier. + */ +- if ( setjmp(png_ptr->jmpbuf) ) { ++#ifndef LIBPNG_VERSION_12 ++ if ( setjmp(*lib.png_set_longjmp_fn(png_ptr, longjmp, sizeof (jmp_buf))) ) ++#else ++ if ( setjmp(png_ptr->jmpbuf) ) ++#endif ++ { + error = "Error reading the PNG file."; + goto done; + } +@@ -416,9 +458,9 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s + Rmask = 0x000000FF; + Gmask = 0x0000FF00; + Bmask = 0x00FF0000; +- Amask = (info_ptr->channels == 4) ? 0xFF000000 : 0; ++ Amask = (lib.png_get_channels(png_ptr, info_ptr) == 4) ? 0xFF000000 : 0; + } else { +- int s = (info_ptr->channels == 4) ? 0 : 8; ++ int s = (lib.png_get_channels(png_ptr, info_ptr) == 4) ? 0 : 8; + Rmask = 0xFF000000 >> s; + Gmask = 0x00FF0000 >> s; + Bmask = 0x0000FF00 >> s; +@@ -426,7 +468,7 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s + } + } + surface = SDL_AllocSurface(SDL_SWSURFACE, width, height, +- bit_depth*info_ptr->channels, Rmask,Gmask,Bmask,Amask); ++ bit_depth*lib.png_get_channels(png_ptr, info_ptr), Rmask,Gmask,Bmask,Amask); + if ( surface == NULL ) { + error = "Out of memory"; + goto done; +@@ -467,6 +509,9 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s + /* Load the palette, if any */ + palette = surface->format->palette; + if ( palette ) { ++ int png_num_palette; ++ png_colorp png_palette; ++ lib.png_get_PLTE(png_ptr, info_ptr, &png_palette, &png_num_palette); + if(color_type == PNG_COLOR_TYPE_GRAY) { + palette->ncolors = 256; + for(i = 0; i < 256; i++) { +@@ -474,12 +519,12 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s + palette->colors[i].g = i; + palette->colors[i].b = i; + } +- } else if (info_ptr->num_palette > 0 ) { +- palette->ncolors = info_ptr->num_palette; +- for( i=0; i<info_ptr->num_palette; ++i ) { +- palette->colors[i].b = info_ptr->palette[i].blue; +- palette->colors[i].g = info_ptr->palette[i].green; +- palette->colors[i].r = info_ptr->palette[i].red; ++ } else if (png_num_palette > 0 ) { ++ palette->ncolors = png_num_palette; ++ for( i=0; i<png_num_palette; ++i ) { ++ palette->colors[i].b = png_palette[i].blue; ++ palette->colors[i].g = png_palette[i].green; ++ palette->colors[i].r = png_palette[i].red; + } + } + } diff --git a/package/section.lst b/package/section.lst index 36bcde679..4648fc04d 100644 --- a/package/section.lst +++ b/package/section.lst @@ -39,9 +39,11 @@ admin System Administration utils Utilities www HTTP / FTP wifi Wireless +x11/lxde Lightweight X Desktop Environment x11/apps X applications x11/drivers X drivers x11/server X server x11/libs X libraries +x11/misc X Misc x11/fonts X fonts x11/devel X headers diff --git a/package/snort/Makefile b/package/snort/Makefile index 6321ac2f5..d8d1fc185 100644 --- a/package/snort/Makefile +++ b/package/snort/Makefile @@ -33,19 +33,19 @@ CONFIGURE_ARGS+= --disable-flexresp \ post-install: ${INSTALL_DIR} ${IDIR_SNORT}/usr/bin ${INSTALL_DIR} ${IDIR_SNORT}/etc/snort - ${INSTALL_DATA} ${WRKBUILD}/etc/snort.conf ${IDIR_SNORT}/etc/snort/ + ${INSTALL_DATA} ${WRKBUILD}/etc/snort.conf ${IDIR_SNORT}/etc/snort ${INSTALL_DATA} ${WRKBUILD}/etc/classification.config \ - ${IDIR_SNORT}/etc/snort/ + ${IDIR_SNORT}/etc/snort ${INSTALL_DATA} ${WRKBUILD}/etc/gen-msg.map \ - ${IDIR_SNORT}/etc/snort/ + ${IDIR_SNORT}/etc/snort ${INSTALL_DATA} ${WRKBUILD}/etc/reference.config \ - ${IDIR_SNORT}/etc/snort/ + ${IDIR_SNORT}/etc/snort ${INSTALL_DATA} ${WRKBUILD}/etc/sid-msg.map \ - ${IDIR_SNORT}/etc/snort/ + ${IDIR_SNORT}/etc/snort ${INSTALL_DATA} ${WRKBUILD}/etc/threshold.conf \ - ${IDIR_SNORT}/etc/snort/ + ${IDIR_SNORT}/etc/snort ${INSTALL_DATA} ${WRKBUILD}/etc/unicode.map \ - ${IDIR_SNORT}/etc/snort/ + ${IDIR_SNORT}/etc/snort ${INSTALL_BIN} ${WRKINST}/usr/bin/snort ${IDIR_SNORT}/usr/bin include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/speex/Makefile b/package/speex/Makefile index 873ad347a..db3b2bcc4 100644 --- a/package/speex/Makefile +++ b/package/speex/Makefile @@ -18,6 +18,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBSPEEX,libspeex,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ARGS+= --without-ogg --disable-oggtest --enable-fixed-point XAKE_FLAGS+= bin_PROGRAMS="" diff --git a/package/sqlite/Makefile b/package/sqlite/Makefile index 2b6c0fc4a..c9eab7a52 100644 --- a/package/sqlite/Makefile +++ b/package/sqlite/Makefile @@ -24,6 +24,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBSQLITE,libsqlite,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBSQLITE},${PKG_SECTION})) $(eval $(call PKG_template,SQLITE_CLI,sqlite-cli,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) CONFIGURE_ENV+= config_BUILD_CC="${CC_FOR_BUILD}" \ config_BUILD_CFLAGS="${CFLAGS_FOR_BUILD}" \ config_TARGET_CC="${TARGET_CC}" \ @@ -32,7 +33,7 @@ CONFIGURE_ENV+= config_BUILD_CC="${CC_FOR_BUILD}" \ config_TARGET_READLINE_LIBS="-L${STAGING_TARGET_DIR}/usr/lib -lreadline -lncurses" MAKE_FLAGS+= LIBPTHREAD=-lm -TARGET_CPPFLAGS+= -DSQLITE_SECURE_DELETE=1 +TARGET_CPPFLAGS+= -DSQLITE_SECURE_DELETE=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 libsqlite-install: ${INSTALL_DIR} ${IDIR_LIBSQLITE}/usr/lib diff --git a/package/uclibc/Makefile b/package/uclibc/Makefile index b15604125..b2d7c4dc1 100644 --- a/package/uclibc/Makefile +++ b/package/uclibc/Makefile @@ -46,11 +46,11 @@ endif done uclibc-dev-install: - ${INSTALL_DIR} ${IDIR_UCLIBC_DEV}/usr/lib + ${INSTALL_DIR} ${IDIR_UCLIBC_DEV}/usr/lib ${IDIR_UCLIBC_DEV}/lib ${CP} ${STAGING_TARGET_DIR}/usr/lib/libc.so ${IDIR_UCLIBC_DEV}/usr/lib ${CP} ${STAGING_TARGET_DIR}/usr/lib/uclibc_nonshared.a ${IDIR_UCLIBC_DEV}/usr/lib - ${CP} ${STAGING_TARGET_DIR}/usr/lib/crt* ${IDIR_UCLIBC_DEV}/usr/lib - -for file in libc libcrypt libdl libm libresolv librt libutil; do \ + ${CP} ${STAGING_TARGET_DIR}/usr/lib/crt*.o ${IDIR_UCLIBC_DEV}/usr/lib + for file in libcrypt libdl libm libresolv librt libutil; do \ cd $(IDIR_UCLIBC_DEV)/lib/; ln -sf $$file-$(PKG_VERSION).so $$file.so; \ done $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-linux-$(KERNEL_VERSION)-$(KERNEL_RELEASE)/linux-$(KERNEL_VERSION) ARCH=$(ARCH) V=1 \ diff --git a/package/vte/Makefile b/package/vte/Makefile new file mode 100644 index 000000000..931fc5344 --- /dev/null +++ b/package/vte/Makefile @@ -0,0 +1,27 @@ +# 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:= vte +PKG_VERSION:= 0.27.5 +PKG_EXTRAVER:= 0.27 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 7155e90b78fb80f4ede9adf959931ef9 +PKG_DESCR:= an experimental terminal emulator widget +PKG_SECTION:= libs +PKG_BUILDDEP:= ncurses +PKG_URL:= http://www.gnome.org/ +PKG_SITES:= http://ftp.gnome.org/pub/GNOME/sources/vte/$(PKG_EXTRAVER)/ + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,VTE,vte,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) + +vte-install: + $(INSTALL_DIR) $(IDIR_VTE)/usr/lib + $(CP) $(WRKINST)/usr/lib/libvte*.so* $(IDIR_VTE)/usr/lib + $(INSTALL_DIR) $(IDIR_VTE)/usr/bin + $(INSTALL_BIN) $(WRKINST)/usr/bin/vte $(IDIR_VTE)/usr/bin + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/vte/patches/patch-config_sub b/package/vte/patches/patch-config_sub new file mode 100644 index 000000000..65d84a780 --- /dev/null +++ b/package/vte/patches/patch-config_sub @@ -0,0 +1,243 @@ +--- vte-0.27.5.orig/config.sub 2011-02-02 08:15:27.000000000 +0100 ++++ vte-0.27.5/config.sub 2010-11-26 15:32:59.100676381 +0100 +@@ -1,10 +1,10 @@ + #! /bin/sh + # Configuration validation subroutine script. + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + # Free Software Foundation, Inc. + +-timestamp='2009-11-20' ++timestamp='2008-09-08' + + # This file is (in principle) common to ALL GNU software. + # The presence of a machine in this file suggests that SOME GNU software +@@ -32,16 +32,13 @@ timestamp='2009-11-20' + + + # Please send patches to <config-patches@gnu.org>. Submit a context +-# diff and a properly formatted GNU ChangeLog entry. ++# diff and a properly formatted ChangeLog entry. + # + # Configuration subroutine to validate and canonicalize a configuration type. + # Supply the specified configuration type as an argument. + # If it is invalid, we print an error message on stderr and exit with code 1. + # Otherwise, we print the canonical config type on stdout and succeed. + +-# You can get the latest version of this script from: +-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +- + # This file is supposed to be the same for all GNU packages + # and recognize all the CPU types, system types and aliases + # that are meaningful with *any* GNU software. +@@ -125,7 +122,6 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^- + case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ +- kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` +@@ -152,13 +148,10 @@ case $os in + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ +- -apple | -axis | -knuth | -cray | -microblaze) ++ -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; +- -bluegene*) +- os=-cnk +- ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 +@@ -251,12 +244,11 @@ case $basic_machine in + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ +- | d10v | d30v | dlx | dsp16xx \ ++ | d10v | d30v | dlx | dsp16xx | dvp \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ +- | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ +@@ -278,7 +270,6 @@ case $basic_machine in + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ +- | moxie \ + | mt \ + | msp430 \ + | nios | nios2 \ +@@ -287,22 +278,20 @@ case $basic_machine in + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ +- | rx \ + | score \ +- | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ ++ | sh | sh[1234] | sh[24]a | sh[24]a*eb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ +- | ubicom32 \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; +- m6811 | m68hc11 | m6812 | m68hc12 | picochip) ++ m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none +@@ -342,10 +331,9 @@ case $basic_machine in + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ +- | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ +- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ ++ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ +@@ -373,8 +361,8 @@ case $basic_machine in + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ +- | romp-* | rs6000-* | rx-* \ +- | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ ++ | romp-* | rs6000-* \ ++ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]a*eb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ +@@ -382,7 +370,6 @@ case $basic_machine in + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | tron-* \ +- | ubicom32-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ +@@ -456,10 +443,6 @@ case $basic_machine in + basic_machine=m68k-apollo + os=-bsd + ;; +- aros) +- basic_machine=i386-pc +- os=-aros +- ;; + aux) + basic_machine=m68k-apple + os=-aux +@@ -476,10 +459,6 @@ case $basic_machine in + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; +- bluegene*) +- basic_machine=powerpc-ibm +- os=-cnk +- ;; + c90) + basic_machine=c90-cray + os=-unicos +@@ -732,9 +711,6 @@ case $basic_machine in + basic_machine=ns32k-utek + os=-sysv + ;; +- microblaze) +- basic_machine=microblaze-xilinx +- ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 +@@ -750,6 +726,24 @@ case $basic_machine in + basic_machine=m68k-atari + os=-mint + ;; ++ mipsEE* | ee | ps2) ++ basic_machine=mips64r5900el-scei ++ case $os in ++ -linux*) ++ ;; ++ *) ++ os=-elf ++ ;; ++ esac ++ ;; ++ iop) ++ basic_machine=mipsel-scei ++ os=-irx ++ ;; ++ dvp) ++ basic_machine=dvp-scei ++ os=-elf ++ ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; +@@ -1206,7 +1200,7 @@ case $basic_machine in + we32k) + basic_machine=we32k-att + ;; +- sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) ++ sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) +@@ -1256,9 +1250,6 @@ case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. +- -auroraux) +- os=-auroraux +- ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; +@@ -1279,11 +1270,10 @@ case $os in + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ +- | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ +- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ +- | -sym* | -kopensolaris* \ ++ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ ++ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ +- | -aos* | -aros* \ ++ | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ +@@ -1302,7 +1292,7 @@ case $os in + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ +- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) ++ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -irx*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) +@@ -1632,7 +1622,7 @@ case $basic_machine in + -sunos*) + vendor=sun + ;; +- -cnk*|-aix*) ++ -aix*) + vendor=ibm + ;; + -beos*) diff --git a/package/vte/patches/patch-ltmain_sh b/package/vte/patches/patch-ltmain_sh new file mode 100644 index 000000000..e7a7ff760 --- /dev/null +++ b/package/vte/patches/patch-ltmain_sh @@ -0,0 +1,11 @@ +--- vte-0.27.5.orig/ltmain.sh 2011-02-02 08:15:19.000000000 +0100 ++++ vte-0.27.5/ltmain.sh 2011-03-18 11:30:26.133370623 +0100 +@@ -5840,7 +5840,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/xcb-proto/Makefile b/package/xcb-proto/Makefile index 893287ee1..56b3db65a 100644 --- a/package/xcb-proto/Makefile +++ b/package/xcb-proto/Makefile @@ -23,11 +23,16 @@ include $(TOPDIR)/mk/python.mk CONFIGURE_ENV+= PYTHON=$(PYTHON) +post-install: + ${INSTALL_DIR} ${STAGING_DIR}/usr/share/xcb + $(INSTALL_DIR) ${STAGING_DIR}/usr/lib/python${PYTHON_VERSION}/site-packages/xcbgen + ${CP} ${WRKBUILD}/src/*.xml ${STAGING_DIR}/usr/share/xcb + ${CP} ${WRKINST}/usr/lib/python${PYTHON_VERSION}/site-packages/xcbgen/*.py \ + ${STAGING_DIR}/usr/lib/python${PYTHON_VERSION}/site-packages/xcbgen + xcb-proto-install: ${INSTALL_DIR} ${IDIR_XCB_PROTO}/usr/share ${CP} ${WRKINST}/usr/share/xcb ${IDIR_XCB_PROTO}/usr/share - ${INSTALL_DIR} ${STAGING_DIR}/usr/share/xcb - ${CP} ${WRKINST}/usr/share/xcb/* ${STAGING_DIR}/usr/share/xcb ${INSTALL_DIR} ${IDIR_XCB_PROTO}/usr/lib/pkgconfig ${INSTALL_DATA} ${WRKINST}/usr/lib/pkgconfig/xcb-proto.pc \ ${IDIR_XCB_PROTO}/usr/lib/pkgconfig diff --git a/package/xfsprogs/patches/patch-ltmain_sh b/package/xfsprogs/patches/patch-ltmain_sh new file mode 100644 index 000000000..6c5c11607 --- /dev/null +++ b/package/xfsprogs/patches/patch-ltmain_sh @@ -0,0 +1,11 @@ +--- xfsprogs-3.1.4.orig/ltmain.sh 2010-11-11 18:38:26.000000000 +0100 ++++ xfsprogs-3.1.4/ltmain.sh 2011-04-01 20:20:00.951819025 +0200 +@@ -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/xineramaproto/Makefile b/package/xineramaproto/Makefile new file mode 100644 index 000000000..9f920d70b --- /dev/null +++ b/package/xineramaproto/Makefile @@ -0,0 +1,25 @@ +# 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:= xineramaproto +PKG_VERSION:= 1.2 +PKG_RELEASE:= 1 +PKG_DESCR:= Xinerama Extension headers +PKG_SECTION:= x11/devel +PKG_MD5SUM:= 1e98484ffa9b0eb6ab9d00cd53bfe74f +PKG_SITES:= http://xorg.freedesktop.org/releases/individual/proto/ + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,XINERAMAPROTO,xineramaproto,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) + +post-install: + ${INSTALL_DIR} ${IDIR_XINERAMAPROTO}/usr/include + ${CP} ${WRKINST}/usr/include/X11 ${IDIR_XINERAMAPROTO}/usr/include + ${INSTALL_DIR} ${IDIR_XINERAMAPROTO}/usr/lib/pkgconfig + ${INSTALL_DATA} ${WRKINST}/usr/lib/pkgconfig/*.pc \ + ${IDIR_XINERAMAPROTO}/usr/lib/pkgconfig + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/xterm/Makefile b/package/xterm/Makefile index 6c336d952..a7f267a81 100644 --- a/package/xterm/Makefile +++ b/package/xterm/Makefile @@ -9,8 +9,8 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 3945ab70cfa2a9e95804157ee1b0f8e8 PKG_DESCR:= Terminal Emulator for X Windows PKG_SECTION:= x11/apps -PKG_DEPENDS:= libxaw libxt -PKG_BUILDDEP:= libXt libXmu libXaw +PKG_DEPENDS:= libxaw libxt libncurses +PKG_BUILDDEP:= ncurses libXt libXmu libXaw PKG_URL:= http://invisible-island.net/xterm/xterm.html PKG_SITES:= ftp://invisible-island.net/xterm/ diff --git a/package/yasm/Makefile b/package/yasm/Makefile new file mode 100644 index 000000000..7567b5d9b --- /dev/null +++ b/package/yasm/Makefile @@ -0,0 +1,23 @@ +# 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:= yasm +PKG_VERSION:= 1.1.0 +PKG_RELEASE:= 1 +PKG_MD5SUM:= 8392e5f2235c2c2a981e1a633f2698cb +PKG_DESCR:= Modular Assembler Project +PKG_SECTION:= misc +PKG_URL:= http://www.tortall.net/projects/yasm/ +PKG_SITES:= http://www.tortall.net/projects/yasm/releases/ + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,YASM,yasm,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) + +yasm-install: + $(INSTALL_DIR) $(IDIR_YASM)/usr/bin + $(INSTALL_BIN) $(WRKINST)/usr/bin/yasm $(IDIR_YASM)/usr/bin + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/scripts/reloc.sh b/scripts/reloc.sh index 59323612f..03034ea35 100755 --- a/scripts/reloc.sh +++ b/scripts/reloc.sh @@ -4,7 +4,7 @@ olddir=$(grep "^TOPDIR" prereq.mk 2>/dev/null |cut -d '=' -f 2) newdir=$(pwd) -if [ ! -z $olddir ];then +if [ ! -z "$olddir" ];then if [ "$olddir" != "$newdir" ];then echo "adk directory relocated!" echo "old directory: $olddir" diff --git a/scripts/scan-pkgs.sh b/scripts/scan-pkgs.sh index 36f861d67..2faa334b6 100644 --- a/scripts/scan-pkgs.sh +++ b/scripts/scan-pkgs.sh @@ -66,6 +66,7 @@ if [[ -n $ADK_PACKAGE_GPSD ]]; then fi if [[ -n $ADK_PACKAGE_FIREFOX ]]; then + NEED_YASM="$NEED_YASM firefox" NEED_LIBIDL="$NEED_LIBIDL firefox" NEED_PYTHON="$NEED_PYTHON firefox" fi @@ -332,6 +333,13 @@ if [[ -n $NEED_FLEX ]]; then fi fi +if [[ -n $NEED_YASM ]]; then + if ! which yasm >/dev/null 2>&1; then + echo >&2 You need yasm to build $NEED_YASM + out=1 + fi +fi + if [[ -n $NEED_XSLTPROC ]]; then if ! which xsltproc >/dev/null 2>&1; then echo >&2 You need xsltproc to build $NEED_XSLTPROC diff --git a/scripts/sha256sum b/scripts/sha256sum index da34d9113..2a7ffb6f7 100755 --- a/scripts/sha256sum +++ b/scripts/sha256sum @@ -4,6 +4,11 @@ if [ -x /usr/bin/sha256sum ]; then /usr/bin/sha256sum "$@" +elif [ -x /bin/cksum ] && [ $(echo | cksum -a sha256) = 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b ]; then + # we assume the arguments are exactly "-c" or "-c -" + x=$(sed 's/^\([0-9a-fA-F]*\) *\([^ ].*\)$/SHA256 (\2) = \1/' | cksum -c -a sha256) + [[ $x = *FAILED* ]] && exit 1 + exit 0 else tmp=$(mktemp -t yyy) cat - > $tmp diff --git a/target/linux/config/Config.in.systems b/target/linux/config/Config.in.systems index 5ded9d0cf..3d933c5ed 100644 --- a/target/linux/config/Config.in.systems +++ b/target/linux/config/Config.in.systems @@ -1,4 +1,7 @@ # mips systems +config ADK_KERNEL_ATHEROS_AR231X + boolean + config ADK_KERNEL_MIPS_MALTA boolean diff --git a/toolchain/Config.in b/toolchain/Config.in index dd0e5ab34..0b5e1dc8a 100644 --- a/toolchain/Config.in +++ b/toolchain/Config.in @@ -10,12 +10,12 @@ config ADK_TOOLCHAIN_GCC_CXX boolean default y -config ADK_TOOLCHAIN_GCC_JAVA - prompt "Enable building of GCJ (Java language support in GCC)" - boolean - select ADK_PACKAGE_LIBGCJ - default n - +#config ADK_TOOLCHAIN_GCC_JAVA +# prompt "Enable building of GCJ (Java language support in GCC)" +# boolean +# select ADK_PACKAGE_LIBGCJ +# default n +# #config ADK_TOOLCHAIN_GCC_OBJC # prompt "Enable building of Objective C compiler" # boolean diff --git a/tools/Makefile b/tools/Makefile index 03441e7a7..8bf118641 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -4,6 +4,7 @@ include $(TOPDIR)/rules.mk TARGETS:=adk mkcrypt cpio + TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS)) TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) |