diff options
author | Nicolás Reynolds <apoyosis@correo.inta.gob.ar> | 2012-11-13 13:34:54 -0300 |
---|---|---|
committer | Nicolás Reynolds <apoyosis@correo.inta.gob.ar> | 2012-11-13 13:34:54 -0300 |
commit | 359b99f193cb2c3b0ea7cad66080c1e81125afb1 (patch) | |
tree | e03f36b1af48bbcdcfe662695cd60d905253786a /pcr | |
parent | b669c4d23e5797b4bfdd78908fa162caf202ad6f (diff) | |
parent | cf319581703bfe2836e7df909dd5f9c0ab0d54e5 (diff) |
Merge branch 'master' of ssh://gparabola/srv/git/abslibre
Diffstat (limited to 'pcr')
150 files changed, 14051 insertions, 0 deletions
diff --git a/pcr/anyremote/PKGBUILD b/pcr/anyremote/PKGBUILD new file mode 100644 index 000000000..96e030245 --- /dev/null +++ b/pcr/anyremote/PKGBUILD @@ -0,0 +1,24 @@ +# Contributor: Andrea Fagiani <andfagiani_at_gmail_dot_com> +# Contributor: hb <hb.at.spamers.dot.net> +# Contributor: Lisa Denia <eiffel56@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=anyremote +pkgver=6.0 +pkgrel=1 +pkgdesc="Remote control (console-oriented) through bluetooth or IR connection" +arch=('i686' 'x86_64') +url="http://anyremote.sourceforge.net" +license=('GPL') +depends=('bluez' 'dbus-glib' 'libxtst') +optdepends=("irda-utils: IRDA support") +install=anyremote.install +source=(http://downloads.sourceforge.net/sourceforge/anyremote/$pkgname-$pkgver.tar.gz) + +build() { + cd $srcdir/$pkgname-$pkgver + ./configure --prefix=/usr + make + make DESTDIR=$pkgdir install +} +md5sums=('f39da5df07f3e1a0c59bc3f95347dbe7') diff --git a/pcr/anyremote/anyremote.install b/pcr/anyremote/anyremote.install new file mode 100644 index 000000000..012444ce0 --- /dev/null +++ b/pcr/anyremote/anyremote.install @@ -0,0 +1,6 @@ +post_install () { + echo " + >>>Download the java client for your phone at + >>>http://anyremote.sourceforge.net/dload.html + " +} diff --git a/pcr/aurvote/PKGBUILD b/pcr/aurvote/PKGBUILD new file mode 100644 index 000000000..4dcf8d3d2 --- /dev/null +++ b/pcr/aurvote/PKGBUILD @@ -0,0 +1,18 @@ +# Maintainer: tuxce <tuxce.net@gmail.com> +# Maintainer: Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=aurvote +pkgver=1.4 +pkgrel=1 +pkgdesc="Tool to vote for favorite AUR packages" +url="http://git.archlinux.fr/aurvote.git/" +license="GPL" +arch=('any') +depends=('curl') +source=($pkgname) + +build() { + install -D -m 755 "$srcdir/$pkgname" "$pkgdir/usr/bin/$pkgname" +} + +md5sums=('57f2f0822b833f6c858526eb7c8bb85f') diff --git a/pcr/aurvote/aurvote b/pcr/aurvote/aurvote new file mode 100755 index 000000000..1b9c8f1bf --- /dev/null +++ b/pcr/aurvote/aurvote @@ -0,0 +1,193 @@ +#!/bin/bash +# +# aurvote : Tool to vote for favorite AUR packages +# +# Copyright (c) 2007-2010 Julien MISCHKOWITZ <wain@archlinux.fr> +# Copyright (c) 2011 tuxce <tuxce.net@gmail.com> +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU Library General Public License as published +# by the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +NAME='aurvote' +VERSION=1.4 + +TMPDIR=${TMPDIR:-/tmp} +AV_TMP="$TMPDIR/aurvote-$USER" + +CONFIGFILE=${XDG_HOME_CONFIG:-~/.config}/aurvote + +AUR_URL="https://aur.archlinux.org" +AUR_URL_LOGIN="$AUR_URL/login/" +AUR_URL_PKG_INFO="$AUR_URL/rpc.php" +AUR_URL_PKG_PAGE="$AUR_URL/packages/" +AUR_DOMAIN="aur.archlinux.org" +AUR_COOKIE="AURSID" +AUR_COOKIE_VALUE="" +AUR_SETLANG="?setlang=en" + + +version() { + echo "$NAME $VERSION" +} + +usage() { + echo "$NAME $VERSION" + echo + echo "usage: $0 <option> <pkgname1> <pkgname2> ..." + echo + echo " --version, -V shows version" + echo " --help, -h shows this help" + echo " --check, -c check for voted packages" + echo " --vote, -v vote for packages" + echo " --unvote, -u unvote packages" + echo + echo " --configure create $CONFIGFILE" + echo +} + +error() { + echo -e "Error: $*" + exit 1 +} + +is_cookie_valid() { + [[ -r $COOKIE_FILE ]] || return 1 + local expire + expire=$(sed -ne '/^\(#HttpOnly_\|[^#]\)/ { s/#HttpOnly_//;p }' "$COOKIE_FILE" | + awk "{ if (\$1==\"$AUR_DOMAIN\" && \$6==\"$AUR_COOKIE\") print \$5\" \"\$7; }") + AUR_COOKIE_VALUE=${expire##* } + expire=${expire%% *} + [[ $expire ]] && { ((expire==0)) || ((expire>$(date +%s))); } +} + +aur_login() { + local args=() + if ((PERSIST)); then + is_cookie_valid && return 0 + args=(-d "remember_me=on") + fi + if [[ ! $user || ! $pass ]]; then + error "$CONFIGFILE must have user name and password. Run:\n$NAME --configure" + fi + curl $CURL_OPT -L -fs -c "$COOKIE_FILE" "${args[@]}" -d "user=$user" \ + --data-urlencode "passwd=$pass" "$AUR_URL_LOGIN" \ + -o "$AV_TMP/login" || error "Unable to access $AUR_URL_LOGIN" + err=$(sed -ne 's/.*ul class="errorlist"><li>\([^<]*\)<.*/\1/p' "$AV_TMP/login") + [[ $err ]] && error "$err" +} + +aur_check_vote() { + local pkg + for pkg in "${pkgnames[@]}"; do + curl $CURL_OPT -fs -b "$COOKIE_FILE" \ + "${AUR_URL_PKG_PAGE}${pkg}${AUR_SETLANG}" \ + -o "$AV_TMP/$pkg.$PID" || + error "Unable to get $pkg page" + if sed '/<div id="news">/q' "$AV_TMP/$pkg.$PID" | grep -q /unvote/; then + echo "already voted" + elif sed '/<div id="news">/q' "$AV_TMP/$pkg.$PID" | grep -q /vote/; then + echo "not voted" + else + echo "voted status not found" + fi + done +} + + +aur_vote() { + local pkg + (($1)) && vote="/vote/" || vote="/unvote/" + for pkg in "${pkgnames[@]}"; do + curl $CURL_OPT -fs -b "$COOKIE_FILE" \ + "${AUR_URL_PKG_PAGE}${pkg}${vote}" -o /dev/null + if (($?)); then + echo "Error: Can't (un)vote for $pkg" + else + echo "$pkg : vote changed" + fi + done +} + +create_config_file() { + local ans + if [[ -f "$CONFIGFILE" ]]; then + read -p "$CONFIGFILE exists. Replace ? [y/N] " ans + [[ $ans != 'Y' && $ans != 'y' ]] && return 0 + fi + echo -n > "$CONFIGFILE" + if [[ ! -r "$CONFIGFILE" ]]; then + error "Unable to create $CONFIGFILE" + fi + echo "Creation of $CONFIGFILE" + read -p "AUR User : " ans + printf "user=%q\n" "$ans" >> "$CONFIGFILE" + read -p "AUR Password : " ans + printf "pass=%q\n" "$ans" >> "$CONFIGFILE" + read -p "Persistent login ? [Y/n] " ans + [[ $ans = 'n' || $ans = 'N' ]] && return 0 + read -p "Path to the cookie file : [/var/tmp/aurvote-$USER.cookie] ? " ans + printf "COOKIE_FILE=%q\n" "${ans:-/var/tmp/aurvote-$USER.cookie}" >> "$CONFIGFILE" + echo + echo "Creation complete." +} + +### MAIN PROGRAM ### +umask 077 +[[ -d "$AV_TMP" ]] || mkdir -p "$AV_TMP" +[[ -d "$AV_TMP" && -w "$AV_TMP" ]] || error "Cannot access to $AV_TMP" +PID=$$ +ACTION="vote" +pkgnames=() +CURL_OPT="" +PERSIST=0 + +[[ -r "$CONFIGFILE" ]] && source "$CONFIGFILE" + +[[ $COOKIE_FILE ]] && PERSIST=1 + +while [[ $1 ]]; do + case $1 in + --help|-h) usage; exit 0;; + --version|-V) version; exit 0;; + --check|-c) ACTION="check";; + --configure) ACTION="configure";; + --vote|-v) ACTION="vote";; + --unvote|-u) ACTION="unvote";; + --id) ;; # deprecated + --insecure) CURL_OPT+=" --insecure";; + -k) PERSIST=1; shift; COOKIE_FILE="$1";; + --*|-*) usage; exit 1;; + *) pkgnames+=("$1");; + esac + shift +done + +if [[ $ACTION = "configure" ]]; then + create_config_file + exit 0 +fi + +COOKIE_FILE=${COOKIE_FILE:-"$AV_TMP/cookies"} +pkgnames=("${pkgnames[@]%/*}") # compatibility with yaourt <= 1.2.1 +[[ ! $pkgnames ]] && usage && exit 1 + +aur_login + +case "$ACTION" in + check) aur_check_vote;; + vote) aur_vote 1;; + unvote) aur_vote 0;; +esac + +# vim: set ts=4 sw=4 et: diff --git a/pcr/auto-complete/PKGBUILD b/pcr/auto-complete/PKGBUILD new file mode 100755 index 000000000..afa9d8691 --- /dev/null +++ b/pcr/auto-complete/PKGBUILD @@ -0,0 +1,30 @@ +# Contributor: abf <zouxiaoming@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=auto-complete +pkgver=1.3.1 +pkgrel=1 +pkgdesc="A plugin for emacs that allows to auto-complete.Auto Complete Mode is the most intelligent auto-completion extension for GNU Emacs." +arch=('any') +url="http://cx4a.org/software/auto-complete/" +license=('GPL3') +install=$pkgname.install +depends=() +optdepends=('emacs') +source=(http://cx4a.org/pub/auto-complete/$pkgname-$pkgver.tar.bz2) +md5sums=('0ffdc1223d40b8ebc57495e33708ceea') + +build() { + cd "$srcdir/$pkgname-$pkgver" + make +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + mkdir -p $pkgdir/usr/share/$pkgname + mkdir -p $pkgdir/usr/share/emacs/site-lisp/ + make DIR="$pkgdir/usr/share/$pkgname" install + ln -s /usr/share/$pkgname $pkgdir/usr/share/emacs/site-lisp/$pkgname +} + +# vim:set ts=2 sw=2 et: diff --git a/pcr/auto-complete/auto-complete.install b/pcr/auto-complete/auto-complete.install new file mode 100755 index 000000000..9687f5e43 --- /dev/null +++ b/pcr/auto-complete/auto-complete.install @@ -0,0 +1,21 @@ +post_install() +{ +echo " " +echo "===================================================================" +echo " " +echo "Add the following code to your .emacs:" + +echo "(add-to-list 'load-path \"/usr/share/emacs/site-lisp/auto-complete\")" +echo "(require 'auto-complete-config)" +echo "(add-to-list 'ac-dictionary-directories \"/usr/share/emacs/site-lisp/auto-complete/ac-dict\")" +echo "(ac-config-default)" +echo " " +echo "===================================================================" +echo " " + +} + +post_upgrade() +{ + post_install +} diff --git a/pcr/bambus/PKGBUILD b/pcr/bambus/PKGBUILD new file mode 100755 index 000000000..d76ba2dc2 --- /dev/null +++ b/pcr/bambus/PKGBUILD @@ -0,0 +1,26 @@ +# Bambus +# Contributor: ying <Jinoto Systems> +# Contributor: ying <Jinoto Systems> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=bambus +pkgver=2.4 +pkgrel=1 +pkgdesc="A small and simple GTK Gui to change Wallpapers using feh, Esetroot, hsetroot, habak or any other command tool." +url="http://malisch-ts.de" +arch=('i686' 'x86_64') +license=('GPL3') +depends=('gtkmm' 'eterm') # 'eterm' can be changed in any command tool to draw the wallpaper. +optdepends=('eterm' 'habak' 'feh' 'hsetroot' 'others') +source=("https://downloads.sourceforge.net/project/simplebambus/bambus-${pkgver}-source.tar.gz?r=&ts=1289210369&use_mirror=master") +md5sums=('c8001d9f837f04f4f8712729c2aa1849') + +build() { + make all +} +package() { + install -Dm755 bambus $pkgdir/usr/bin/bambus || return +} + + +md5sums=('c8001d9f837f04f4f8712729c2aa1849') diff --git a/pcr/bashmount/PKGBUILD b/pcr/bashmount/PKGBUILD new file mode 100644 index 000000000..e468ab79f --- /dev/null +++ b/pcr/bashmount/PKGBUILD @@ -0,0 +1,37 @@ +# Contributer: Jamie Nguyen <jamie@tomoyolinux.co.uk> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=bashmount +pkgver=1.6.2 +pkgrel=1 +pkgdesc="A menu-driven bash script for the management of removable media with udisks" +arch=('any') +url='http://www.sourceforge.net/projects/bashmount/' +license=('GPL2') +depends=('udisks') +install=${pkgname}.install +backup=('etc/bashmount.conf') +source=("http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.gz") + +build() +{ + cd "${srcdir}/bashmount-${pkgver}" + + # install script + install -D -m755 bashmount "${pkgdir}/usr/bin/bashmount" + + # install config file + install -D -m644 bashmount.conf "${pkgdir}/etc/bashmount.conf" + + # install man page + gzip -c -9 bashmount.1 > bashmount.1.gz + install -D -m644 bashmount.1.gz "${pkgdir}/usr/share/man/man1/bashmount.1.gz" + + # install documentation + install -d -m755 "${pkgdir}/usr/share/doc/bashmount" + install -m644 AUTHORS "${pkgdir}/usr/share/doc/bashmount/AUTHORS" + install -m644 COPYING "${pkgdir}/usr/share/doc/bashmount/COPYING" + install -m644 NEWS "${pkgdir}/usr/share/doc/bashmount/NEWS" +} + +sha256sums=('10e5c8f9065e2410c5018d74a3f8cf7f30668fafa30d9ed82ff04cd64a0f7309') diff --git a/pcr/bashmount/bashmount.install b/pcr/bashmount/bashmount.install new file mode 100644 index 000000000..6e646d94b --- /dev/null +++ b/pcr/bashmount/bashmount.install @@ -0,0 +1,9 @@ +post_install () { + echo + echo " * dbus and consolekit/policykit need to be running. If you are not" + echo " using a graphical login manager, put this in ~/.xinitrc:" + echo + echo " source /etc/X11/xinit/xinitrc.d/30-dbus" + echo " exec ck-launch-session [insert window manager here]" + echo +} diff --git a/pcr/bup/PKGBUILD b/pcr/bup/PKGBUILD new file mode 100644 index 000000000..bdc2abeeb --- /dev/null +++ b/pcr/bup/PKGBUILD @@ -0,0 +1,34 @@ +# Contributor: Bram Schoenmakers <me@bramschoenmakers.nl> +# Contributor: henning mueller <henning@orgizm.net> +# Maintainer : Parabola GNU / Linux-libre Aurélien Desbrières <aurelien@cwb.io> + +# If you'd like to have documentation, please set the variable below to 1. +# This implies installing pandoc, which in turn depends on many Haskell packages. +_havedocs=0 + +pkgname=bup +pkgver=0.25rc1 +_pkgver=0.25-rc1 +pkgrel=2 +pkgdesc="Backup tool using git pack files." +arch=('i686' 'x86_64') +url="http://github.com/apenwarr/bup" +license=('GPL') +depends=('python2-fuse' 'par2cmdline') +[ $_havedocs = 1 ] && makedepends=('haskell-pandoc') +source=("https://github.com/apenwarr/${pkgname}/archive/${pkgname}-${_pkgver}.tar.gz") + +build() { + cd "${srcdir}/${pkgname}-${pkgname}-${_pkgver}" + + find . -name \*.py | xargs sed -i 's:env python:env python2:' + sed -i 's:PYTHON=python:PYTHON=python2:' Makefile + + make +} + +package() { + cd "${srcdir}/${pkgname}-${pkgname}-${_pkgver}" + make DESTDIR=$pkgdir install +} +md5sums=('9d9af10900d84e2951aa64631ff4860d') diff --git a/pcr/cegui-0.5/CEGUIString.h b/pcr/cegui-0.5/CEGUIString.h new file mode 100644 index 000000000..13a61ba15 --- /dev/null +++ b/pcr/cegui-0.5/CEGUIString.h @@ -0,0 +1,5603 @@ +/*********************************************************************** + filename: CEGUIString.h + created: 26/2/2004 + author: Paul D Turner + + purpose: Defines string class used within the GUI system. +*************************************************************************/ +/*************************************************************************** + * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + ***************************************************************************/ +#ifndef _CEGUIString_h_ +#define _CEGUIString_h_ + +#include "CEGUIBase.h" +#include <string> +#include <string.h> +#include <stdexcept> + +// Start of CEGUI namespace section +namespace CEGUI +{ +#define STR_QUICKBUFF_SIZE 32 + /************************************************************************* + Basic Types + *************************************************************************/ + typedef uint8 utf8; + //typedef uint16 utf16; // removed typedef to prevent usage, as utf16 is not supported (yet) + typedef uint32 utf32; + +/*! +\brief + String class used within the GUI system. + + For the most part, this class can replace std::string in basic usage. However, currently String does not use the + current locale, and also comparisons do not take into account the Unicode data tables, so are not 'correct' + as such. +*/ +class CEGUIEXPORT String +{ +public: + /************************************************************************* + Integral Types + *************************************************************************/ + typedef utf32 value_type; //!< Basic 'code point' type used for String (utf32) + typedef size_t size_type; //!< Unsigned type used for size values and indices + typedef std::ptrdiff_t difference_type; //!< Signed type used for differences + typedef utf32& reference; //!< Type used for utf32 code point references + typedef const utf32& const_reference; //!< Type used for constant utf32 code point references + typedef utf32* pointer; //!< Type used for utf32 code point pointers + typedef const utf32* const_pointer; //!< Type used for constant utf32 code point pointers + + static const size_type npos; //!< Value used to represent 'not found' conditions and 'all code points' etc. + +private: + /************************************************************************* + Implementation data + *************************************************************************/ + size_type d_cplength; //!< holds length of string in code points (not including null termination) + size_type d_reserve; //!< code point reserve size (currently allocated buffer size in code points). + + mutable utf8* d_encodedbuff; //!< holds string data encoded as utf8 (generated only by calls to c_str() and data()) + mutable size_type d_encodeddatlen; //!< holds length of encoded data (in case it's smaller than buffer). + mutable size_type d_encodedbufflen; //!< length of above buffer (since buffer can be bigger then the data it holds to save re-allocations). + + utf32 d_quickbuff[STR_QUICKBUFF_SIZE]; //!< This is a integrated 'quick' buffer to save allocations for smallish strings + utf32* d_buffer; //!< Pointer the the main buffer memory. This is only valid when quick-buffer is not being used + +public: + /************************************************************************* + Iterator Classes + *************************************************************************/ + /*! + \brief + Constant forward iterator class for String objects + */ +#if defined(_MSC_VER) && (_MSC_VER <= 1200) + class const_iterator : public std::iterator<std::random_access_iterator_tag, utf32> +#else + class const_iterator : public std::iterator<std::random_access_iterator_tag, utf32, std::ptrdiff_t, const utf32*, const utf32&> +#endif + { + + public: + ////////////////////////////////////////////////////////////////////////// + // data + ////////////////////////////////////////////////////////////////////////// + const utf32* d_ptr; + + + ////////////////////////////////////////////////////////////////////////// + // Methods + ////////////////////////////////////////////////////////////////////////// + const_iterator(void) + { + d_ptr = 0; + } + const_iterator(const_pointer ptr) + { + d_ptr = ptr; + } + + const_reference operator*() const + { + return *d_ptr; + } + +#if defined(_MSC_VER) && (_MSC_VER <= 1200) +# pragma warning (push) +# pragma warning (disable : 4284) +#endif + const_pointer operator->() const + { + return &**this; + } + +#if defined(_MSC_VER) && (_MSC_VER <= 1200) +# pragma warning (pop) +#endif + + const_iterator& operator++() + { + ++d_ptr; + return *this; + } + + const_iterator operator++(int) + { + const_iterator temp = *this; + ++*this; + return temp; + } + + const_iterator& operator--() + { + --d_ptr; + return *this; + } + + const_iterator operator--(int) + { + const_iterator temp = *this; + --*this; + return temp; + } + + const_iterator& operator+=(difference_type offset) + { + d_ptr += offset; + return *this; + } + + const_iterator operator+(difference_type offset) const + { + const_iterator temp = *this; + return temp += offset; + } + + const_iterator& operator-=(difference_type offset) + { + return *this += -offset; + } + + const_iterator operator-(difference_type offset) const + { + const_iterator temp = *this; + return temp -= offset; + } + + difference_type operator-(const const_iterator& iter) const + { + return d_ptr - iter.d_ptr; + } + + const_reference operator[](difference_type offset) const + { + return *(*this + offset); + } + + bool operator==(const const_iterator& iter) const + { + return d_ptr == iter.d_ptr; + } + + bool operator!=(const const_iterator& iter) const + { + return !(*this == iter); + } + + bool operator<(const const_iterator& iter) const + { + return d_ptr < iter.d_ptr; + } + + bool operator>(const const_iterator& iter) const + { + return (!(iter < *this)); + } + + bool operator<=(const const_iterator& iter) const + { + return (!(iter < *this)); + } + + bool operator>=(const const_iterator& iter) const + { + return (!(*this < iter)); + } + + friend const_iterator operator+(difference_type offset, const const_iterator& iter) + { + return iter + offset; + } + + }; + + /*! + \brief + Forward iterator class for String objects + */ + class iterator : public const_iterator + { + public: + iterator(void) {} + iterator(pointer ptr) : const_iterator(ptr) {} + + + reference operator*() const + { + return ((reference)**(const_iterator *)this); + } + +#if defined(_MSC_VER) && (_MSC_VER <= 1200) +# pragma warning (push) +# pragma warning (disable : 4284) +#endif + + pointer operator->() const + { + return &**this; + } + +#if defined(_MSC_VER) && (_MSC_VER <= 1200) +# pragma warning (pop) +#endif + + iterator& operator++() + { + ++this->d_ptr; + return *this; + } + + iterator operator++(int) + { + iterator temp = *this; + ++*this; + return temp; + } + + iterator& operator--() + { + --this->d_ptr; + return *this; + } + + iterator operator--(int) + { + iterator temp = *this; + --*this; + return temp; + } + + iterator& operator+=(difference_type offset) + { + this->d_ptr += offset; + return *this; + } + + iterator operator+(difference_type offset) const + { + iterator temp = *this; + return temp + offset; + } + + iterator& operator-=(difference_type offset) + { + return *this += -offset; + } + + iterator operator-(difference_type offset) const + { + iterator temp = *this; + return temp -= offset; + } + + difference_type operator-(const const_iterator& iter) const + { + return ((const_iterator)*this - iter); + } + + reference operator[](difference_type offset) const + { + return *(*this + offset); + } + + friend iterator operator+(difference_type offset, const iterator& iter) + { + return iter + offset; + } + + }; + + /*! + \brief + Constant reverse iterator class for String objects + */ +#if defined(_MSC_VER) && ((_MSC_VER <= 1200) || ((_MSC_VER <= 1300) && defined(_STLPORT_VERSION))) + typedef std::reverse_iterator<const_iterator, const_pointer, const_reference, difference_type> const_reverse_iterator; +#else + typedef std::reverse_iterator<const_iterator> const_reverse_iterator; +#endif + + /*! + \brief + Reverse iterator class for String objects + */ +#if defined(_MSC_VER) && ((_MSC_VER <= 1200) || ((_MSC_VER <= 1300) && defined(_STLPORT_VERSION))) + typedef std::reverse_iterator<iterator, pointer, reference, difference_type> reverse_iterator; +#else + typedef std::reverse_iterator<iterator> reverse_iterator; +#endif + +public: + /*! + \brief + Functor that can be used as comparator in a std::map with String keys. + It's faster than using the default, but the map will no longer be sorted alphabetically. + */ + struct FastLessCompare + { + bool operator() (const String& a, const String& b) const + { + const size_t la = a.length(); + const size_t lb = b.length(); + if (la == lb) + return (memcmp(a.ptr(), b.ptr(), la*sizeof(utf32)) < 0); + return (la < lb); + } + }; + +public: + ////////////////////////////////////////////////////////////////////////// + // Default Construction and Destructor + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Constructs an empty string + */ + String(void) + { + init(); + } + + /*! + \brief + Destructor for String objects + */ + ~String(void); + + ////////////////////////////////////////////////////////////////////////// + // Construction via CEGUI::String + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Copy constructor - Creates a new string with the same value as \a str + + \param str + String object used to initialise the newly created string + + \return + Nothing + */ + String(const String& str) + { + init(); + assign(str); + } + + + /*! + \brief + Constructs a new string initialised with code points from another String object. + + \param str + String object used to initialise the newly created string + + \param str_idx + Starting code-point of \a str to be used when initialising the new String + + \param str_num + Maximum number of code points from \a str that are to be assigned to the new String + + \return + Nothing + */ + String(const String& str, size_type str_idx, size_type str_num = npos) + { + init(); + assign(str, str_idx, str_num); + } + + ////////////////////////////////////////////////////////////////////////// + // Construction via std::string + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Constructs a new string and initialises it using the std::string std_str + + \param std_str + The std::string object that is to be used to initialise the new String object. + + \note + The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF. No translation of + the provided data will occur. + + \return + Nothing + + \exception std::length_error Thrown if resulting String object would be too big. + */ + String(const std::string& std_str) + { + init(); + assign(std_str); + } + + /*! + \brief + Constructs a new string initialised with characters from the given std::string object. + + \param std_str + std::string object used to initialise the newly created string + + \param str_idx + Starting character of \a std_str to be used when initialising the new String + + \note + The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF. No translation of + the provided data will occur. + + \param str_num + Maximum number of characters from \a std_str that are to be assigned to the new String + + \return + Nothing + + \exception std::length_error Thrown if resulting String object would be too big. + */ + String(const std::string& std_str, size_type str_idx, size_type str_num = npos) + { + init(); + assign(std_str, str_idx, str_num); + } + + + ////////////////////////////////////////////////////////////////////////// + // Construction via UTF-8 stream (for straight ASCII use, only codes 0x00 - 0x7f are valid) + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Constructs a new String object and initialise it using the provided utf8 encoded string buffer. + + \param utf8_str + Pointer to a buffer containing a null-terminated Unicode string encoded as utf8 data. + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \return + Nothing + + \exception std::length_error Thrown if resulting String object would be too big. + */ + String(const utf8* utf8_str) + { + init(); + assign(utf8_str); + } + + /*! + \brief + Constructs a new String object and initialise it using the provided utf8 encoded string buffer. + + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param utf8_str + Pointer to a buffer containing Unicode string data encoded as utf8. + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param chars_len + Length of the provided utf8 string in code units (not code-points). + + \return + Nothing + + \exception std::length_error Thrown if resulting String object would be too big. + */ + String(const utf8* utf8_str, size_type chars_len) + { + init(); + assign(utf8_str, chars_len); + } + + ////////////////////////////////////////////////////////////////////////// + // Construction via code-point (using a UTF-32 code unit) + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Constructs a new String that is initialised with the specified code point + + \param num + The number of times \a code_point is to be put into new String object + + \param code_point + The Unicode code point to be used when initialising the String object + + \return + Nothing + + \exception std::length_error Thrown if resulting String object would be too big. + */ + String(size_type num, utf32 code_point) + { + init(); + assign(num, code_point); + } + + ////////////////////////////////////////////////////////////////////////// + // Construction via iterator + ////////////////////////////////////////////////////////////////////////// + // Create string with characters in the range [beg, end) + /*! + \brief + Construct a new string object and initialise it with code-points from the range [beg, end). + + \param beg + Iterator describing the start of the data to be used when initialising the String object + + \param end + Iterator describing the (exclusive) end of the data to be used when initialising the String object + + \return + Nothing + */ + String(const_iterator iter_beg, const_iterator iter_end) + { + init(); + append(iter_beg, iter_end); + } + + + ////////////////////////////////////////////////////////////////////////// + // Construction via c-string + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Constructs a new String object and initialise it using the provided c-string. + + \param c_str + Pointer to a c-string. + + \return + Nothing + + \exception std::length_error Thrown if resulting String object would be too big. + */ + String(const char* cstr) + { + init(); + assign(cstr); + } + + /*! + \brief + Constructs a new String object and initialise it using characters from the provided char array. + + \param chars + char array. + + \param chars_len + Number of chars from the array to be used. + + \return + Nothing + + \exception std::length_error Thrown if resulting String object would be too big. + */ + String(const char* chars, size_type chars_len) + { + init(); + assign(chars, chars_len); + } + + + ////////////////////////////////////////////////////////////////////////// + // Size operations + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Returns the size of the String in code points + + \return + Number of code points currently in the String + */ + size_type size(void) const + { + return d_cplength; + } + + /*! + \brief + Returns the size of the String in code points + + \return + Number of code points currently in the String + */ + size_type length(void) const + { + return d_cplength; + } + + /*! + \brief + Returns true if the String is empty + + \return + true if the String is empty, else false. + */ + bool empty(void) const + { + return (d_cplength == 0); + } + + /*! + \brief + Returns the maximum size of a String. + + Any operation that would result in a String that is larger than this value will throw the std::length_error exception. + + \return + The maximum number of code points that a string can contain + */ + static size_type max_size(void) + { + return (((size_type)-1) / sizeof(utf32)); + } + + ////////////////////////////////////////////////////////////////////////// + // Capacity Operations + ////////////////////////////////////////////////////////////////////////// + // return the number of code points the string could hold without re-allocation + // (due to internal encoding this will always report the figure for worst-case encoding, and could even be < size()!) + /*! + \brief + Return the number of code points that the String could hold before a re-allocation would be required. + + \return + Size of the current reserve buffer. This is the maximum number of code points the String could hold before a buffer + re-allocation would be required + */ + size_type capacity(void) const + { + return d_reserve - 1; + } + + // reserve internal memory for at-least 'num' code-points (characters). if num is 0, request is shrink-to-fit. + /*! + \brief + Specifies the amount of reserve capacity to allocate. + + \param num + The number of code points to allocate space for. If \a num is larger that the current reserve, then a re-allocation will occur. If + \a num is smaller than the current reserve (but not 0) the buffer may be shrunk to the larger of the specified number, or the current + String size (operation is currently not implemented). If \a num is 0, then the buffer is re-allocated to fit the current String size. + + \return + Nothing + + \exception std::length_error Thrown if resulting String object would be too big. + */ + void reserve(size_type num = 0) + { + if (num == 0) + trim(); + else + grow(num); + } + + ////////////////////////////////////////////////////////////////////////// + // Comparisons + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Compares this String with the String 'str'. + + \note + This does currently not properly consider Unicode and / or the system locale. + + \param str + The String object that is to compared with this String. + + \return + - 0 if the String objects are equal + - <0 if this String is lexicographically smaller than \a str + - >0 if this String is lexicographically greater than \a str + */ + int compare(const String& str) const + { + return compare(0, d_cplength, str); + } + + /*! + \brief + Compares code points from this String with code points from the String 'str'. + + \note + This does currently not properly consider Unicode and / or the system locale. + + \param idx + Index of the first code point from this String to consider. + + \param len + Maximum number of code points from this String to consider. + + \param str + The String object that is to compared with this String. + + \param str_idx + Index of the first code point from String \a str to consider. + + \param str_len + Maximum number of code points from String \a str to consider + + \return + - 0 if the specified sub-strings are equal + - <0 if specified sub-strings are lexicographically smaller than \a str + - >0 if specified sub-strings are lexicographically greater than \a str + + \exception std::out_of_range Thrown if either \a idx or \a str_idx are invalid. + */ + int compare(size_type idx, size_type len, const String& str, size_type str_idx = 0, size_type str_len = npos) const + { + if ((d_cplength < idx) || (str.d_cplength < str_idx)) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + if ((len == npos) || (idx + len > d_cplength)) + len = d_cplength - idx; + + if ((str_len == npos) || (str_idx + str_len > str.d_cplength)) + str_len = str.d_cplength - str_idx; + + int val = (len == 0) ? 0 : utf32_comp_utf32(&ptr()[idx], &str.ptr()[str_idx], (len < str_len) ? len : str_len); + + return (val != 0) ? ((val < 0) ? -1 : 1) : (len < str_len) ? -1 : (len == str_len) ? 0 : 1; + } + + + /*! + \brief + Compares this String with the std::string 'std_str'. + + \note + This does currently not properly consider Unicode and / or the system locale. + + \param std_str + The std::string object that is to compared with this String. + + \note + Characters from \a std_str are considered to represent Unicode code points in the range 0x00..0xFF. No translation of + the encountered data is performed. + + \return + - 0 if the string objects are equal + - <0 if this string is lexicographically smaller than \a std_str + - >0 if this string is lexicographically greater than \a std_str + */ + int compare(const std::string& std_str) const + { + return compare(0, d_cplength, std_str); + } + + + /*! + \brief + Compares code points from this String with code points from the std::string 'std_str'. + + \note + This does currently not properly consider Unicode and / or the system locale. + + \param idx + Index of the first code point from this String to consider. + + \param len + Maximum number of code points from this String to consider. + + \param std_str + The std::string object that is to compared with this String. + + \note + Characters from \a std_str are considered to represent Unicode code points in the range 0x00..0xFF. No translation of + the encountered data is performed. + + \param str_idx + Index of the first character from std::string \a std_str to consider. + + \param str_len + Maximum number of characters from std::string \a std_str to consider + + \return + - 0 if the specified sub-strings are equal + - <0 if specified sub-strings are lexicographically smaller than \a std_str + - >0 if specified sub-strings are lexicographically greater than \a std_str + + \exception std::out_of_range Thrown if either \a idx or \a str_idx are invalid. + */ + int compare(size_type idx, size_type len, const std::string& std_str, size_type str_idx = 0, size_type str_len = npos) const + { + if (d_cplength < idx) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + if (std_str.size() < str_idx) + throw std::out_of_range("Index is out of range for std::string"); + + if ((len == npos) || (idx + len > d_cplength)) + len = d_cplength - idx; + + if ((str_len == npos) || (str_idx + str_len > std_str.size())) + str_len = (size_type)std_str.size() - str_idx; + + int val = (len == 0) ? 0 : utf32_comp_char(&ptr()[idx], &std_str.c_str()[str_idx], (len < str_len) ? len : str_len); + + return (val != 0) ? ((val < 0) ? -1 : 1) : (len < str_len) ? -1 : (len == str_len) ? 0 : 1; + } + + + /*! + \brief + Compares this String with the null-terminated utf8 encoded 'utf8_str'. + + \note + This does currently not properly consider Unicode and / or the system locale. + + \param utf8_str + The buffer containing valid Unicode data encoded as utf8 that is to compared with this String. + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \return + - 0 if the strings are equal + - <0 if this string is lexicographically smaller than \a utf8_str + - >0 if this string is lexicographically greater than \a utf8_str + */ + int compare(const utf8* utf8_str) const + { + return compare(0, d_cplength, utf8_str, encoded_size(utf8_str)); + } + + + /*! + \brief + Compares code points from this String with the null-terminated utf8 encoded 'utf8_str'. + + \note + This does currently not properly consider Unicode and / or the system locale. + + \param idx + Index of the first code point from this String to consider. + + \param len + Maximum number of code points from this String to consider. + + \param utf8_str + The buffer containing valid Unicode data encoded as utf8 that is to compared with this String. + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \return + - 0 if the specified sub-strings are equal + - <0 if specified sub-strings are lexicographically smaller than \a utf8_str + - >0 if specified sub-strings are lexicographically greater than \a utf8_str + + \exception std::out_of_range Thrown if \a idx is invalid. + */ + int compare(size_type idx, size_type len, const utf8* utf8_str) const + { + return compare(idx, len, utf8_str, encoded_size(utf8_str)); + } + + /*! + \brief + Compares code points from this String with the utf8 encoded data in buffer 'utf8_str'. + + \note + This does currently not properly consider Unicode and / or the system locale. + + \param idx + Index of the first code point from this String to consider. + + \param len + Maximum number of code points from this String to consider. + + \param utf8_str + The buffer containing valid Unicode data encoded as utf8 that is to compared with this String. + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param str_cplen + The number of encoded code points in the buffer \a utf8_str (this is not the same as the number of code units). + + \return + - 0 if the specified sub-strings are equal + - <0 if specified sub-strings are lexicographically smaller than \a utf8_str + - >0 if specified sub-strings are lexicographically greater than \a utf8_str + + \exception std::out_of_range Thrown if \a idx is invalid. + \exception std::length_error Thrown if \a str_cplen is set to npos. + */ + int compare(size_type idx, size_type len, const utf8* utf8_str, size_type str_cplen) const + { + if (d_cplength < idx) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + if (str_cplen == npos) + throw std::length_error("Length for utf8 encoded string can not be 'npos'"); + + if ((len == npos) || (idx + len > d_cplength)) + len = d_cplength - idx; + + int val = (len == 0) ? 0 : utf32_comp_utf8(&ptr()[idx], utf8_str, (len < str_cplen) ? len : str_cplen); + + return (val != 0) ? ((val < 0) ? -1 : 1) : (len < str_cplen) ? -1 : (len == str_cplen) ? 0 : 1; + } + + + /*! + \brief + Compares this String with the given c-string. + + \note + This does currently not properly consider Unicode and / or the system locale. + + \param c_str + The c-string that is to compared with this String. + + \return + - 0 if the strings are equal + - <0 if this string is lexicographically smaller than \a c_str + - >0 if this string is lexicographically greater than \a c_str + */ + int compare(const char* cstr) const + { + return compare(0, d_cplength, cstr, strlen(cstr)); + } + + + /*! + \brief + Compares code points from this String with the given c-string. + + \note + This does currently not properly consider Unicode and / or the system locale. + + \param idx + Index of the first code point from this String to consider. + + \param len + Maximum number of code points from this String to consider. + + \param c_str + The c-string that is to compared with this String. + + \return + - 0 if the specified sub-strings are equal + - <0 if specified sub-strings are lexicographically smaller than \a c_str + - >0 if specified sub-strings are lexicographically greater than \a c_str + + \exception std::out_of_range Thrown if \a idx is invalid. + */ + int compare(size_type idx, size_type len, const char* cstr) const + { + return compare(idx, len, cstr, strlen(cstr)); + } + + + /*! + \brief + Compares code points from this String with chars in the given char array. + + \note + This does currently not properly consider Unicode and / or the system locale. + + \param idx + Index of the first code point from this String to consider. + + \param len + Maximum number of code points from this String to consider. + + \param chars + The array containing the chars that are to compared with this String. + + \param chars_len + The number of chars in the array. + + \return + - 0 if the specified sub-strings are equal + - <0 if specified sub-strings are lexicographically smaller than \a chars + - >0 if specified sub-strings are lexicographically greater than \a chars + + \exception std::out_of_range Thrown if \a idx is invalid. + \exception std::length_error Thrown if \a chars_len is set to npos. + */ + int compare(size_type idx, size_type len, const char* chars, size_type chars_len) const + { + if (d_cplength < idx) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + if (chars_len == npos) + throw std::length_error("Length for char array can not be 'npos'"); + + if ((len == npos) || (idx + len > d_cplength)) + len = d_cplength - idx; + + int val = (len == 0) ? 0 : utf32_comp_char(&ptr()[idx], chars, (len < chars_len) ? len : chars_len); + + return (val != 0) ? ((val < 0) ? -1 : 1) : (len < chars_len) ? -1 : (len == chars_len) ? 0 : 1; + } + + + ////////////////////////////////////////////////////////////////////////// + // Character access + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Returns the code point at the given index. + + \param idx + Zero based index of the code point to be returned. + + \note + - For constant strings length()/size() provide a valid index and will access the default utf32 value. + - For non-constant strings length()/size() is an invalid index, and acceesing (especially writing) this index could cause string corruption. + + \return + The utf32 code point at the given index within the String. + */ + reference operator[](size_type idx) + { + return (ptr()[idx]); + } + + /*! + \brief + Returns the code point at the given index. + + \param idx + Zero based index of the code point to be returned. + + \note + - For constant strings length()/size() provide a valid index and will access the default utf32 value. + - For non-constant strings length()/size() is an invalid index, and acceesing (especially writing) this index could cause string corruption. + + \return + The utf32 code point at the given index within the String. + */ + value_type operator[](size_type idx) const + { + return ptr()[idx]; + } + + /*! + \brief + Returns the code point at the given index. + + \param idx + Zero based index of the code point to be returned. + + \return + The utf32 code point at the given index within the String. + + \exception std::out_of_range Thrown if \a idx is >= length(). + */ + reference at(size_type idx) + { + if (d_cplength <= idx) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + return ptr()[idx]; + } + + /*! + \brief + Returns the code point at the given index. + + \param idx + Zero based index of the code point to be returned. + + \return + The utf32 code point at the given index within the String. + + \exception std::out_of_range Thrown if \a idx is >= length(). + */ + const_reference at(size_type idx) const + { + if (d_cplength <= idx) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + return ptr()[idx]; + } + + + ////////////////////////////////////////////////////////////////////////// + // C-Strings and arrays + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Returns contents of the String as a null terminated string of utf8 encoded data. + + \return + Pointer to a char buffer containing the contents of the String encoded as null-terminated utf8 data. + + \note + The buffer returned from this function is owned by the String object. + + \note + Any function that modifies the String data will invalidate the buffer returned by this call. + */ + const char* c_str(void) const + { + return (const char*)build_utf8_buff(); + } + + /*! + \brief + Returns contents of the String as utf8 encoded data. + + \return + Pointer to a buffer containing the contents of the String encoded utf8 data. + + \note + The buffer returned from this function is owned by the String object. + + \note + Any function that modifies the String data will invalidate the buffer returned by this call. + */ + const utf8* data(void) const + { + return build_utf8_buff(); + } + + /*! + \brief + Returns a pointer to the buffer in use. + */ + utf32* ptr(void) + { + return (d_reserve > STR_QUICKBUFF_SIZE) ? d_buffer : d_quickbuff; + } + + /*! + \brief + Returns a pointer to the buffer in use. (const version) + */ + const utf32* ptr(void) const + { + return (d_reserve > STR_QUICKBUFF_SIZE) ? d_buffer : d_quickbuff; + } + + // copy, at most, 'len' code-points of the string, begining with code-point 'idx', into the array 'buf' as valid utf8 encoded data + // return number of utf8 code units placed into the buffer + /*! + \brief + Copies an area of the String into the provided buffer as encoded utf8 data. + + \param buf + Pointer to a buffer that is to receive the encoded data (this must be big enough to hold the encoded data) + + \param len + Maximum number of code points from the String that should be encoded into the buffer + + \param idx + Index of the first code point to be encoded into the buffer + + \return + The number of utf8 encoded code units transferred to the buffer. + + \note A code unit does not equal a code point. A utf32 code point, when encoded as utf8, can occupy between 1 and 4 code units. + + \exception std::out_of_range Thrown if \a idx was invalid for this String. + */ + size_type copy(utf8* buf, size_type len = npos, size_type idx = 0) const + { + if (d_cplength < idx) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + if (len == npos) + len = d_cplength; + + return encode(&ptr()[idx], buf, npos, len); + } + + ////////////////////////////////////////////////////////////////////////// + // UTF8 Encoding length information + ////////////////////////////////////////////////////////////////////////// + // return the number of bytes required to hold 'num' code-points, starting at code-point 'idx', of the the string when encoded as utf8 data. + /*! + \brief + Return the number of utf8 code units required to hold an area of the String when encoded as utf8 data + + \param num + Maximum number of code points to consider when calculating utf8 encoded size. + + \param idx + Index of the first code point to consider when calculating the utf8 encoded size + + \return + The number of utf8 code units (bytes) required to hold the specified sub-string when encoded as utf8 data. + + \exception std::out_of_range Thrown if \a idx was invalid for this String. + */ + size_type utf8_stream_len(size_type num = npos, size_type idx = 0) const + { + using namespace std; + + if (d_cplength < idx) + throw out_of_range("Index was out of range for CEGUI::String object"); + + size_type maxlen = d_cplength - idx; + + return encoded_size(&ptr()[idx], ceguimin(num, maxlen)); + } + + ////////////////////////////////////////////////////////////////////////// + // Assignment Functions + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Assign the value of String \a str to this String + + \param str + String object containing the string value to be assigned. + + \return + This String after the assignment has happened + */ + String& operator=(const String& str) + { + return assign(str); + } + + /*! + \brief + Assign a sub-string of String \a str to this String + + \param str + String object containing the string data to be assigned. + + \param str_idx + Index of the first code point in \a str that is to be assigned + + \param str_num + Maximum number of code points from \a str that are be be assigned + + \return + This String after the assignment has happened + + \exception std::out_of_range Thrown if str_idx is invalid for \a str + */ + String& assign(const String& str, size_type str_idx = 0, size_type str_num = npos) + { + if (str.d_cplength < str_idx) + throw std::out_of_range("Index was out of range for CEGUI::String object"); + + if (str_num == npos) + str_num = str.d_cplength - str_idx; + + grow(str_num); + setlen(str_num); + memcpy(ptr(), &str.ptr()[str_idx], str_num * sizeof(utf32)); + + return *this; + } + + /*! + \brief + Assign the value of std::string \a std_str to this String + + \note + The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF. No translation of + the provided data will occur. + + \param std_str + std::string object containing the string value to be assigned. + + \return + This String after the assignment has happened + + \exception std::length_error Thrown if the resulting String would have been too large. + */ + String& operator=(const std::string& std_str) + { + return assign(std_str); + } + + /*! + \brief + Assign a sub-string of std::string \a std_str to this String + + \note + The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF. No translation of + the provided data will occur. + + \param std_str + std::string object containing the string value to be assigned. + + \param str_idx + Index of the first character of \a std_str to be assigned + + \param str_num + Maximum number of characters from \a std_str to be assigned + + \return + This String after the assignment has happened + + \exception std::out_of_range Thrown if \a str_idx is invalid for \a std_str + \exception std::length_error Thrown if the resulting String would have been too large. + */ + String& assign(const std::string& std_str, size_type str_idx = 0, size_type str_num = npos) + { + if (std_str.size() < str_idx) + throw std::out_of_range("Index was out of range for std::string object"); + + if (str_num == npos) + str_num = (size_type)std_str.size() - str_idx; + + grow(str_num); + setlen(str_num); + + while(str_num--) + { + ((*this)[str_num]) = static_cast<utf32>(static_cast<unsigned char>(std_str[str_num + str_idx])); + } + + return *this; + } + + /*! + \brief + Assign to this String the string value represented by the given null-terminated utf8 encoded data + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param utf8_str + Buffer containing valid null-terminated utf8 encoded data + + \return + This String after the assignment has happened + + \exception std::length_error Thrown if the resulting String would have been too large. + */ + String& operator=(const utf8* utf8_str) + { + return assign(utf8_str, utf_length(utf8_str)); + } + + /*! + \brief + Assign to this String the string value represented by the given null-terminated utf8 encoded data + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param utf8_str + Buffer containing valid null-terminated utf8 encoded data + + \return + This String after the assignment has happened + + \exception std::length_error Thrown if the resulting String would have been too large. + */ + String& assign(const utf8* utf8_str) + { + return assign(utf8_str, utf_length(utf8_str)); + } + + /*! + \brief + Assign to this String the string value represented by the given utf8 encoded data + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param utf8_str + Buffer containing valid utf8 encoded data + + \param str_num + Number of code units (not code points) in the buffer pointed to by \a utf8_str + + \return + This String after the assignment has happened + + \exception std::length_error Thrown if the resulting String would have been too large, or if str_num is 'npos'. + */ + String& assign(const utf8* utf8_str, size_type str_num) + { + if (str_num == npos) + throw std::length_error("Length for utf8 encoded string can not be 'npos'"); + + size_type enc_sze = encoded_size(utf8_str, str_num); + + grow(enc_sze); + encode(utf8_str, ptr(), d_reserve, str_num); + setlen(enc_sze); + return *this; + } + + /*! + \brief + Assigns the specified utf32 code point to this String. Result is always a String 1 code point in length. + + \param code_point + Valid utf32 Unicode code point to be assigned to the string + + \return + This String after assignment + */ + String& operator=(utf32 code_point) + { + return assign(1, code_point); + } + + /*! + \brief + Assigns the specified code point repeatedly to the String + + \param num + The number of times to assign the code point + + \param code_point + Valid utf32 Unicode code point to be assigned to the string + + \return + This String after assignment. + + \exception std::length_error Thrown if \a num was 'npos' + */ + String& assign(size_type num, utf32 code_point) + { + if (num == npos) + throw std::length_error("Code point count can not be 'npos'"); + + grow(num); + setlen(num); + utf32* p = ptr(); + + while(num--) + *p++ = code_point; + + return *this; + } + + + /*! + \brief + Assign to this String the given C-string. + + \param c_str + Pointer to a valid C style string. + + \return + This String after the assignment has happened + + \exception std::length_error Thrown if the resulting String would have been too large. + */ + String& operator=(const char* cstr) + { + return assign(cstr, strlen(cstr)); + } + + + /*! + \brief + Assign to this String the given C-string. + + \param c_str + Pointer to a valid C style string. + + \return + This String after the assignment has happened + + \exception std::length_error Thrown if the resulting String would have been too large. + */ + String& assign(const char* cstr) + { + return assign(cstr, strlen(cstr)); + } + + + /*! + \brief + Assign to this String a number of chars from a char array. + + \param chars + char array. + + \param chars_len + Number of chars to be assigned. + + \return + This String after the assignment has happened + + \exception std::length_error Thrown if the resulting String would have been too large. + */ + String& assign(const char* chars, size_type chars_len) + { + grow(chars_len); + utf32* pt = ptr(); + + for (size_type i = 0; i < chars_len; ++i) + { + *pt++ = static_cast<utf32>(static_cast<unsigned char>(*chars++)); + } + + setlen(chars_len); + return *this; + } + + + /*! + \brief + Swaps the value of this String with the given String \a str + + \param str + String object whos value is to be swapped with this String. + + \return + Nothing + */ + void swap(String& str) + { + size_type temp_len = d_cplength; + d_cplength = str.d_cplength; + str.d_cplength = temp_len; + + size_type temp_res = d_reserve; + d_reserve = str.d_reserve; + str.d_reserve = temp_res; + + utf32* temp_buf = d_buffer; + d_buffer = str.d_buffer; + str.d_buffer = temp_buf; + + // see if we need to swap 'quick buffer' data + if (temp_res <= STR_QUICKBUFF_SIZE) + { + utf32 temp_qbf[STR_QUICKBUFF_SIZE]; + + memcpy(temp_qbf, d_quickbuff, STR_QUICKBUFF_SIZE * sizeof(utf32)); + memcpy(d_quickbuff, str.d_quickbuff, STR_QUICKBUFF_SIZE * sizeof(utf32)); + memcpy(str.d_quickbuff, temp_qbf, STR_QUICKBUFF_SIZE * sizeof(utf32)); + } + + } + + ////////////////////////////////////////////////////////////////////////// + // Appending Functions + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Appends the String \a str + + \param str + String object that is to be appended + + \return + This String after the append operation + + \exception std::length_error Thrown if resulting String would be too large. + */ + String& operator+=(const String& str) + { + return append(str); + } + + /*! + \brief + Appends a sub-string of the String \a str + + \param str + String object containing data to be appended + + \param str_idx + Index of the first code point to be appended + + \param str_num + Maximum number of code points to be appended + + \return + This String after the append operation + + \exception std::out_of_range Thrown if \a str_idx is invalid for \a str. + \exception std::length_error Thrown if resulting String would be too large. + */ + String& append(const String& str, size_type str_idx = 0, size_type str_num = npos) + { + if (str.d_cplength < str_idx) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + if (str_num == npos) + str_num = str.d_cplength - str_idx; + + grow(d_cplength + str_num); + memcpy(&ptr()[d_cplength], &str.ptr()[str_idx], str_num * sizeof(utf32)); + setlen(d_cplength + str_num); + return *this; + } + + + /*! + \brief + Appends the std::string \a std_str + + \param std_str + std::string object that is to be appended + + \note + The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF. No translation of + the provided data will occur. + + \return + This String after the append operation + + \exception std::length_error Thrown if resulting String would be too large. + */ + String& operator+=(const std::string& std_str) + { + return append(std_str); + } + + /*! + \brief + Appends a sub-string of the std::string \a std_str + + \param std_str + std::string object containing data to be appended + + \note + The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF. No translation of + the provided data will occur. + + \param str_idx + Index of the first character to be appended + + \param str_num + Maximum number of characters to be appended + + \return + This String after the append operation + + \exception std::out_of_range Thrown if \a str_idx is invalid for \a std_str. + \exception std::length_error Thrown if resulting String would be too large. + */ + String& append(const std::string& std_str, size_type str_idx = 0, size_type str_num = npos) + { + if (std_str.size() < str_idx) + throw std::out_of_range("Index is out of range for std::string"); + + if (str_num == npos) + str_num = (size_type)std_str.size() - str_idx; + + size_type newsze = d_cplength + str_num; + + grow(newsze); + utf32* pt = &ptr()[newsze-1]; + + while(str_num--) + *pt-- = static_cast<utf32>(static_cast<unsigned char>(std_str[str_num])); + + setlen(newsze); + return *this; + } + + + /*! + \brief + Appends to the String the null-terminated utf8 encoded data in the buffer utf8_str. + + \param utf8_str + buffer holding the null-terminated utf8 encoded data that is to be appended + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \return + This String after the append operation + + \exception std::length_error Thrown if resulting String would be too large. + */ + String& operator+=(const utf8* utf8_str) + { + return append(utf8_str, utf_length(utf8_str)); + } + + /*! + \brief + Appends to the String the null-terminated utf8 encoded data in the buffer utf8_str. + + \param utf8_str + Buffer holding the null-terminated utf8 encoded data that is to be appended + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \return + This String after the append operation + + \exception std::length_error Thrown if resulting String would be too large. + */ + String& append(const utf8* utf8_str) + { + return append(utf8_str, utf_length(utf8_str)); + } + + + /*! + \brief + Appends to the String the utf8 encoded data in the buffer utf8_str. + + \param utf8_str + Buffer holding the utf8 encoded data that is to be appended + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param len + Number of code units (not code points) in the buffer to be appended + + \return + This String after the append operation + + \exception std::length_error Thrown if resulting String would be too large, or if \a len was 'npos' + */ + String& append(const utf8* utf8_str, size_type len) + { + if (len == npos) + throw std::length_error("Length for utf8 encoded string can not be 'npos'"); + + size_type encsz = encoded_size(utf8_str, len); + size_type newsz = d_cplength + encsz; + + grow(newsz); + encode(utf8_str, &ptr()[d_cplength], encsz, len); + setlen(newsz); + + return *this; + } + + + /*! + \brief + Appends a single code point to the string + + \param code_point + utf32 Unicode code point that is to be appended + + \return + This String after the append operation + + \exception std::length_error Thrown if resulting String would be too long. + */ + String& operator+=(utf32 code_point) + { + return append(1, code_point); + } + + /*! + \brief + Appends a single code point multiple times to the string + + \param num + Number of copies of the code point to be appended + + \param code_point + utf32 Unicode code point that is to be appended + + \return + This String after the append operation + + \exception std::length_error Thrown if resulting String would be too long, or if \a num was 'npos'. + */ + String& append(size_type num, utf32 code_point) + { + if (num == npos) + throw std::length_error("Code point count can not be 'npos'"); + + size_type newsz = d_cplength + num; + grow(newsz); + + utf32* p = &ptr()[d_cplength]; + + while(num--) + *p++ = code_point; + + setlen(newsz); + + return *this; + } + + /*! + \brief + Appends a single code point to the string + + \param code_point + utf32 Unicode code point that is to be appended + + \return + Nothing + + \exception std::length_error Thrown if resulting String would be too long. + */ + void push_back(utf32 code_point) + { + append(1, code_point); + } + + /*! + \brief + Appends the code points in the reange [beg, end) + + \param beg + Iterator describing the start of the range to be appended + + \param end + Iterator describing the (exclusive) end of the range to be appended. + + \return + This String after the append operation + + \exception std::length_error Thrown if the resulting string would be too large. + */ + String& append(const_iterator iter_beg, const_iterator iter_end) + { + return replace(end(), end(), iter_beg, iter_end); + } + + + /*! + \brief + Appends to the String the given c-string. + + \param c_str + c-string that is to be appended. + + \return + This String after the append operation + + \exception std::length_error Thrown if resulting String would be too large. + */ + String& operator+=(const char* cstr) + { + return append(cstr, strlen(cstr)); + } + + + /*! + \brief + Appends to the String the given c-string. + + \param c_str + c-string that is to be appended. + + \return + This String after the append operation + + \exception std::length_error Thrown if resulting String would be too large. + */ + String& append(const char* cstr) + { + return append(cstr, strlen(cstr)); + } + + + /*! + \brief + Appends to the String chars from the given char array. + + \param chars + char array holding the chars that are to be appended + + \param chars_len + Number of chars to be appended + + \return + This String after the append operation + + \exception std::length_error Thrown if resulting String would be too large, or if \a chars_len was 'npos' + */ + String& append(const char* chars, size_type chars_len) + { + if (chars_len == npos) + throw std::length_error("Length for char array can not be 'npos'"); + + size_type newsz = d_cplength + chars_len; + + grow(newsz); + + utf32* pt = &ptr()[newsz-1]; + + while(chars_len--) + *pt-- = static_cast<utf32>(static_cast<unsigned char>(chars[chars_len])); + + setlen(newsz); + + return *this; + } + + + ////////////////////////////////////////////////////////////////////////// + // Insertion Functions + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Inserts the given String object at the specified position. + + \param idx + Index where the string is to be inserted. + + \param str + String object that is to be inserted. + + \return + This String after the insert. + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + \exception std::length_error Thrown if resulting String would be too large. + */ + String& insert(size_type idx, const String& str) + { + return insert(idx, str, 0, npos); + } + + /*! + \brief + Inserts a sub-string of the given String object at the specified position. + + \param idx + Index where the string is to be inserted. + + \param str + String object containing data to be inserted. + + \param str_idx + Index of the first code point from \a str to be inserted. + + \param str_num + Maximum number of code points from \a str to be inserted. + + \return + This String after the insert. + + \exception std::out_of_range Thrown if \a idx or \a str_idx are out of range. + \exception std::length_error Thrown if resulting String would be too large. + */ + String& insert(size_type idx, const String& str, size_type str_idx, size_type str_num) + { + if ((d_cplength < idx) || (str.d_cplength < str_idx)) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + if (str_num == npos) + str_num = str.d_cplength - str_idx; + + size_type newsz = d_cplength + str_num; + grow(newsz); + memmove(&ptr()[idx + str_num], &ptr()[idx], (d_cplength - idx) * sizeof(utf32)); + memcpy(&ptr()[idx], &str.ptr()[str_idx], str_num * sizeof(utf32)); + setlen(newsz); + + return *this; + } + + /*! + \brief + Inserts the given std::string object at the specified position. + + \param idx + Index where the std::string is to be inserted. + + \param std_str + std::string object that is to be inserted. + + \note + The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF. No translation of + the provided data will occur. + + \return + This String after the insert. + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + \exception std::length_error Thrown if resulting String would be too large. + */ + String& insert(size_type idx, const std::string& std_str) + { + return insert(idx, std_str, 0, npos); + } + + /*! + \brief + Inserts a sub-string of the given std::string object at the specified position. + + \param idx + Index where the string is to be inserted. + + \param std_str + std::string object containing data to be inserted. + + \note + The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF. No translation of + the provided data will occur. + + \param str_idx + Index of the first character from \a std_str to be inserted. + + \param str_num + Maximum number of characters from \a str to be inserted. + + \return + This String after the insert. + + \exception std::out_of_range Thrown if \a idx or \a str_idx are out of range. + \exception std::length_error Thrown if resulting String would be too large. + */ + String& insert(size_type idx, const std::string& std_str, size_type str_idx, size_type str_num) + { + if (d_cplength < idx) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + if (std_str.size() < str_idx) + throw std::out_of_range("Index is out of range for std::string"); + + if (str_num == npos) + str_num = (size_type)std_str.size() - str_idx; + + size_type newsz = d_cplength + str_num; + grow(newsz); + + memmove(&ptr()[idx + str_num], &ptr()[idx], (d_cplength - idx) * sizeof(utf32)); + + utf32* pt = &ptr()[idx + str_num - 1]; + + while(str_num--) + *pt-- = static_cast<utf32>(static_cast<unsigned char>(std_str[str_idx + str_num])); + + setlen(newsz); + + return *this; + } + + /*! + \brief + Inserts the given null-terminated utf8 encoded data at the specified position. + + \param idx + Index where the data is to be inserted. + + \param utf8_str + Buffer containing the null-terminated utf8 encoded data that is to be inserted. + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \return + This String after the insert. + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + \exception std::length_error Thrown if resulting String would be too large. + */ + String& insert(size_type idx, const utf8* utf8_str) + { + return insert(idx, utf8_str, utf_length(utf8_str)); + } + + /*! + \brief + Inserts the given utf8 encoded data at the specified position. + + \param idx + Index where the data is to be inserted. + + \param utf8_str + Buffer containing the utf8 encoded data that is to be inserted. + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param len + Length of the data to be inserted in uf8 code units (not code points) + + \return + This String after the insert. + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + \exception std::length_error Thrown if resulting String would be too large, or if \a len is 'npos' + */ + String& insert(size_type idx, const utf8* utf8_str, size_type len) + { + if (d_cplength < idx) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + if (len == npos) + throw std::length_error("Length of utf8 encoded string can not be 'npos'"); + + size_type encsz = encoded_size(utf8_str, len); + size_type newsz = d_cplength + encsz; + + grow(newsz); + memmove(&ptr()[idx + encsz], &ptr()[idx], (d_cplength - idx) * sizeof(utf32)); + encode(utf8_str, &ptr()[idx], encsz, len); + setlen(newsz); + + return *this; + } + + /*! + \brief + Inserts a code point multiple times into the String + + \param idx + Index where the code point(s) are to be inserted + + \param num + The number of times to insert the code point + + \param code_point + The utf32 code point that is to be inserted + + \return + This String after the insertion. + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + \exception std::length_error Thrown if resulting String would be too large, or if \a num is 'npos' + */ + String& insert(size_type idx, size_type num, utf32 code_point) + { + if (d_cplength < idx) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + if (num == npos) + throw std::length_error("Code point count can not be 'npos'"); + + size_type newsz = d_cplength + num; + grow(newsz); + + memmove(&ptr()[idx + num], &ptr()[idx], (d_cplength - idx) * sizeof(utf32)); + + utf32* pt = &ptr()[idx + num - 1]; + + while(num--) + *pt-- = code_point; + + setlen(newsz); + + return *this; + } + + /*! + \brief + Inserts a code point multiple times into the String + + \param pos + Iterator describing the position where the code point(s) are to be inserted + + \param num + The number of times to insert the code point + + \param code_point + The utf32 code point that is to be inserted + + \return + This String after the insertion. + + \exception std::length_error Thrown if resulting String would be too large, or if \a num is 'npos' + */ + void insert(iterator pos, size_type num, utf32 code_point) + { + insert(safe_iter_dif(pos, begin()), num, code_point); + } + + /*! + \brief + Inserts a single code point into the String + + \param pos + Iterator describing the position where the code point is to be inserted + + \param code_point + The utf32 code point that is to be inserted + + \return + This String after the insertion. + + \exception std::length_error Thrown if resulting String would be too large. + */ + iterator insert(iterator pos, utf32 code_point) + { + insert(pos, 1, code_point); + return pos; + } + + /*! + \brief + Inserts code points specified by the range [beg, end). + + \param pos + Iterator describing the position where the data is to be inserted + + \param beg + Iterator describing the begining of the range to be inserted + + \param end + Iterator describing the (exclusive) end of the range to be inserted. + + \return + Nothing. + + \exception std::length_error Thrown if resulting String would be too large. + */ + void insert(iterator iter_pos, const_iterator iter_beg, const_iterator iter_end) + { + replace(iter_pos, iter_pos, iter_beg, iter_end); + } + + + /*! + \brief + Inserts the given c-string at the specified position. + + \param idx + Index where the c-string is to be inserted. + + \param c_str + c-string that is to be inserted. + + \return + This String after the insert. + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + \exception std::length_error Thrown if resulting String would be too large. + */ + String& insert(size_type idx, const char* cstr) + { + return insert(idx, cstr, strlen(cstr)); + } + + + /*! + \brief + Inserts chars from the given char array at the specified position. + + \param idx + Index where the data is to be inserted. + + \param chars + char array containing the chars that are to be inserted. + + \param chars_len + Length of the char array to be inserted. + + \return + This String after the insert. + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + \exception std::length_error Thrown if resulting String would be too large, or if \a chars_len is 'npos' + */ + String& insert(size_type idx, const char* chars, size_type chars_len) + { + if (d_cplength < idx) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + if (chars_len == npos) + throw std::length_error("Length of char array can not be 'npos'"); + + size_type newsz = d_cplength + chars_len; + + grow(newsz); + memmove(&ptr()[idx + chars_len], &ptr()[idx], (d_cplength - idx) * sizeof(utf32)); + + utf32* pt = &ptr()[idx + chars_len - 1]; + + while(chars_len--) + *pt-- = static_cast<utf32>(static_cast<unsigned char>(chars[chars_len])); + + setlen(newsz); + + return *this; + } + + + ////////////////////////////////////////////////////////////////////////// + // Erasing characters + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Removes all data from the String + + \return + Nothing + */ + void clear(void) + { + setlen(0); + trim(); + } + + /*! + \brief + Removes all data from the String + + \return + The empty String (*this) + */ + String& erase(void) + { + clear(); + return *this; + } + + /*! + \brief + Erase a single code point from the string + + \param idx + The index of the code point to be removed. + + \return + This String after the erase operation + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + */ + String& erase(size_type idx) + { + return erase(idx, 1); + } + + /*! + \brief + Erase a range of code points + + \param idx + Index of the first code point to be removed. + + \param len + Maximum number of code points to be removed. + + \return + This String after the erase operation. + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + */ + String& erase(size_type idx, size_type len = npos) + { + if (d_cplength < idx) + throw std::out_of_range("Index is out of range foe CEGUI::String"); + + if (len == npos) + len = d_cplength - idx; + + size_type newsz = d_cplength - len; + + memmove(&ptr()[idx], &ptr()[idx + len], (d_cplength - idx - len) * sizeof(utf32)); + setlen(newsz); + return *this; + } + + /*! + \brief + Erase the code point described by the given iterator + + \param pos + Iterator describing the code point to be erased + + \return + This String after the erase operation. + */ + String& erase(iterator pos) + { + return erase(safe_iter_dif(pos, begin()), 1); + } + + /*! + \brief + Erase a range of code points described by the iterators [beg, end). + + \param beg + Iterator describing the postion of the beginning of the range to erase + + \param end + Iterator describing the postion of the (exclusive) end of the range to erase + + \return + This String after the erase operation. + */ + String& erase(iterator iter_beg, iterator iter_end) + { + return erase(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg)); + } + + ////////////////////////////////////////////////////////////////////////// + // Resizing + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Resizes the String either by inserting default utf32 code points to make it larger, or by truncating to make it smaller + + \param num + The length, in code points, that the String is to be made. + + \return + Nothing. + + \exception std::length_error Thrown if the String would be too large. + */ + void resize(size_type num) + { + resize(num, utf32()); + } + + /*! + \brief + Resizes the String either by inserting the given utf32 code point to make it larger, or by truncating to make it smaller + + \param num + The length, in code points, that the String is to be made. + + \param code_point + The utf32 code point that should be used when majing the String larger + + \return + Nothing. + + \exception std::length_error Thrown if the String would be too large. + */ + void resize(size_type num, utf32 code_point) + { + if (num < d_cplength) + { + setlen(num); + } + else + { + append(num - d_cplength, code_point); + } + + } + + ////////////////////////////////////////////////////////////////////////// + // Replacing Characters + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Replace code points in the String with the specified String object + + \param idx + Index of the first code point to be replaced + + \param len + Maximum number of code points to be replaced (if this is 0, operation is an insert at position \a idx) + + \param str + The String object that is to replace the specified code points + + \return + This String after the replace operation + + \exception std::out_of_range Thrown if \a idx is invalid for this String + \exception std::length_error Thrown if the resulting String would be too large. + */ + String& replace(size_type idx, size_type len, const String& str) + { + return replace(idx, len, str, 0, npos); + } + + /*! + \brief + Replace the code points in the range [beg, end) with the specified String object + + \note + If \a beg == \a end, the operation is a insert at iterator position \a beg + + \param beg + Iterator describing the start of the range to be replaced + + \param end + Iterator describing the (exclusive) end of the range to be replaced. + + \param str + The String object that is to replace the specified range of code points + + \return + This String after the replace operation + + \exception std::length_error Thrown if the resulting String would be too large. + */ + String& replace(iterator iter_beg, iterator iter_end, const String& str) + { + return replace(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg), str, 0, npos); + } + + /*! + \brief + Replace code points in the String with a specified sub-string of a given String object. + + \param idx + Index of the first code point to be replaced + + \param len + Maximum number of code points to be replaced. If this is 0, the operation is an insert at position \a idx. + + \param str + String object containing the data that will replace the specified range of code points + + \param str_idx + Index of the first code point of \a str that is to replace the specified code point range + + \param str_num + Maximum number of code points of \a str that are to replace the specified code point range + + \return + This String after the replace operation + + \exception std::out_of_range Thrown if either \a idx, or \a str_idx are invalid + \exception std::length_error Thrown if the resulting String would have been too large. + */ + String& replace(size_type idx, size_type len, const String& str, size_type str_idx, size_type str_num) + { + if ((d_cplength < idx) || (str.d_cplength < str_idx)) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + if (((str_idx + str_num) > str.d_cplength) || (str_num == npos)) + str_num = str.d_cplength - str_idx; + + if (((len + idx) > d_cplength) || (len == npos)) + len = d_cplength - idx; + + size_type newsz = d_cplength + str_num - len; + + grow(newsz); + + if ((idx + len) < d_cplength) + memmove(&ptr()[idx + str_num], &ptr()[len + idx], (d_cplength - idx - len) * sizeof(utf32)); + + memcpy(&ptr()[idx], &str.ptr()[str_idx], str_num * sizeof(utf32)); + setlen(newsz); + + return *this; + } + + + /*! + \brief + Replace code points in the String with the specified std::string object + + \param idx + Index of the first code point to be replaced + + \param len + Maximum number of code points to be replaced (if this is 0, operation is an insert at position \a idx) + + \param std_str + The std::string object that is to replace the specified code points + + \note + Characters from \a std_str are considered to represent Unicode code points in the range 0x00..0xFF. No translation of + the encountered data is performed. + + \return + This String after the replace operation + + \exception std::out_of_range Thrown if \a idx is invalid for this String + \exception std::length_error Thrown if the resulting String would be too large. + */ + String& replace(size_type idx, size_type len, const std::string& std_str) + { + return replace(idx, len, std_str, 0, npos); + } + + /*! + \brief + Replace the code points in the range [beg, end) with the specified std::string object + + \note + If \a beg == \a end, the operation is a insert at iterator position \a beg + + \param beg + Iterator describing the start of the range to be replaced + + \param end + Iterator describing the (exclusive) end of the range to be replaced. + + \param std_str + The std::string object that is to replace the specified range of code points + + \note + Characters from \a std_str are considered to represent Unicode code points in the range 0x00..0xFF. No translation of + the encountered data is performed. + + \return + This String after the replace operation + + \exception std::length_error Thrown if the resulting String would be too large. + */ + String& replace(iterator iter_beg, iterator iter_end, const std::string& std_str) + { + return replace(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg), std_str, 0, npos); + } + + /*! + \brief + Replace code points in the String with a specified sub-string of a given std::string object. + + \param idx + Index of the first code point to be replaced + + \param len + Maximum number of code points to be replaced. If this is 0, the operation is an insert at position \a idx. + + \param std_str + std::string object containing the data that will replace the specified range of code points + + \note + Characters from \a std_str are considered to represent Unicode code points in the range 0x00..0xFF. No translation of + the encountered data is performed. + + \param str_idx + Index of the first code point of \a std_str that is to replace the specified code point range + + \param str_num + Maximum number of code points of \a std_str that are to replace the specified code point range + + \return + This String after the replace operation + + \exception std::out_of_range Thrown if either \a idx, or \a str_idx are invalid + \exception std::length_error Thrown if the resulting String would have been too large. + */ + String& replace(size_type idx, size_type len, const std::string& std_str, size_type str_idx, size_type str_num) + { + if (d_cplength < idx) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + if (std_str.size() < str_idx) + throw std::out_of_range("Index is out of range for std::string"); + + if (((str_idx + str_num) > std_str.size()) || (str_num == npos)) + str_num = (size_type)std_str.size() - str_idx; + + if (((len + idx) > d_cplength) || (len == npos)) + len = d_cplength - idx; + + size_type newsz = d_cplength + str_num - len; + + grow(newsz); + + if ((idx + len) < d_cplength) + memmove(&ptr()[idx + str_num], &ptr()[len + idx], (d_cplength - idx - len) * sizeof(utf32)); + + utf32* pt = &ptr()[idx + str_num - 1]; + + while (str_num--) + *pt-- = static_cast<utf32>(static_cast<unsigned char>(std_str[str_idx + str_num])); + + setlen(newsz); + + return *this; + } + + + /*! + \brief + Replace code points in the String with the specified null-terminated utf8 encoded data. + + \param idx + Index of the first code point to be replaced + + \param len + Maximum number of code points to be replaced (if this is 0, operation is an insert at position \a idx) + + \param utf8_str + Buffer containing the null-terminated utf8 encoded data that is to replace the specified code points + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \return + This String after the replace operation + + \exception std::out_of_range Thrown if \a idx is invalid for this String + \exception std::length_error Thrown if the resulting String would be too large. + */ + String& replace(size_type idx, size_type len, const utf8* utf8_str) + { + return replace(idx, len, utf8_str, utf_length(utf8_str)); + } + + /*! + \brief + Replace the code points in the range [beg, end) with the specified null-terminated utf8 encoded data. + + \note + If \a beg == \a end, the operation is a insert at iterator position \a beg + + \param beg + Iterator describing the start of the range to be replaced + + \param end + Iterator describing the (exclusive) end of the range to be replaced. + + \param utf8_str + Buffer containing the null-terminated utf8 encoded data that is to replace the specified range of code points + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \return + This String after the replace operation + + \exception std::length_error Thrown if the resulting String would be too large. + */ + String& replace(iterator iter_beg, iterator iter_end, const utf8* utf8_str) + { + return replace(iter_beg, iter_end, utf8_str, utf_length(utf8_str)); + } + + /*! + \brief + Replace code points in the String with the specified utf8 encoded data. + + \param idx + Index of the first code point to be replaced + + \param len + Maximum number of code points to be replaced (if this is 0, operation is an insert at position \a idx) + + \param utf8_str + Buffer containing the null-terminated utf8 encoded data that is to replace the specified code points + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param str_len + Length of the utf8 encoded data in utf8 code units (not code points). + + \return + This String after the replace operation + + \exception std::out_of_range Thrown if \a idx is invalid for this String + \exception std::length_error Thrown if the resulting String would be too large, or if \a str_len was 'npos'. + */ + String& replace(size_type idx, size_type len, const utf8* utf8_str, size_type str_len) + { + if (d_cplength < idx) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + if (str_len == npos) + throw std::length_error("Length for utf8 encoded string can not be 'npos'"); + + if (((len + idx) > d_cplength) || (len == npos)) + len = d_cplength - idx; + + size_type encsz = encoded_size(utf8_str, str_len); + size_type newsz = d_cplength + encsz - len; + + grow(newsz); + + if ((idx + len) < d_cplength) + memmove(&ptr()[idx + encsz], &ptr()[len + idx], (d_cplength - idx - len) * sizeof(utf32)); + + encode(utf8_str, &ptr()[idx], encsz, str_len); + + setlen(newsz); + return *this; + } + + /*! + \brief + Replace the code points in the range [beg, end) with the specified null-terminated utf8 encoded data. + + \note + If \a beg == \a end, the operation is a insert at iterator position \a beg + + \param beg + Iterator describing the start of the range to be replaced + + \param end + Iterator describing the (exclusive) end of the range to be replaced. + + \param utf8_str + Buffer containing the null-terminated utf8 encoded data that is to replace the specified range of code points + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param str_len + Length of the utf8 encoded data in utf8 code units (not code points). + + \return + This String after the replace operation + + \exception std::length_error Thrown if the resulting String would be too large, or if \a str_len was 'npos'. + */ + String& replace(iterator iter_beg, iterator iter_end, const utf8* utf8_str, size_type str_len) + { + return replace(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg), utf8_str, str_len); + } + + /*! + \brief + Replaces a specified range of code points with occurrences of a given code point + + \param idx + Index of the first code point to be replaced + + \param len + Maximum number of code points to replace. If this is 0 the operation is an insert + + \param num + Number of occurrences of \a code_point that are to replace the specified range of code points + + \param code_point + Code point that is to be used when replacing the specified range of code points + + \return + This String after the replace operation. + + \exception std::out_of_range Thrown if \a idx is invalid for this String + \exception std::length_error Thrown if resulting String would have been too long, or if \a num was 'npos'. + */ + String& replace(size_type idx, size_type len, size_type num, utf32 code_point) + { + if (d_cplength < idx) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + if (num == npos) + throw std::length_error("Code point count can not be 'npos'"); + + if (((len + idx) > d_cplength) || (len == npos)) + len = d_cplength - idx; + + size_type newsz = d_cplength + num - len; + + grow(newsz); + + if ((idx + len) < d_cplength) + memmove(&ptr()[idx + num], &ptr()[len + idx], (d_cplength - idx - len) * sizeof(utf32)); + + utf32* pt = &ptr()[idx + num - 1]; + + while (num--) + *pt-- = code_point; + + setlen(newsz); + + return *this; + } + + /*! + \brief + Replace the code points in the range [beg, end) with occurrences of a given code point + + \note + If \a beg == \a end, the operation is an insert at iterator position \a beg + + \param beg + Iterator describing the start of the range to be replaced + + \param end + Iterator describing the (exclusive) end of the range to be replaced. + + \param num + Number of occurrences of \a code_point that are to replace the specified range of code points + + \param code_point + Code point that is to be used when replacing the specified range of code points + + \return + This String after the replace operation + + \exception std::length_error Thrown if resulting String would have been too long, or if \a num was 'npos'. + */ + String& replace(iterator iter_beg, iterator iter_end, size_type num, utf32 code_point) + { + return replace(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg), num, code_point); + } + + + /*! + \brief + Replace the code points in the range [beg, end) with code points from the range [newBeg, newEnd). + + \note + If \a beg == \a end, the operation is an insert at iterator position \a beg + + \param beg + Iterator describing the start of the range to be replaced + + \param end + Iterator describing the (exclusive) end of the range to be replaced. + + \param newBeg + Iterator describing the beginning of the range to insert. + + \param newEnd + Iterator describing the (exclusive) end of the range to insert. + + \return + This String after the insert operation. + + \exception std::length_error Thrown if the resulting string would be too long. + */ + String& replace(iterator iter_beg, iterator iter_end, const_iterator iter_newBeg, const_iterator iter_newEnd) + { + if (iter_beg == iter_end) + { + erase(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg)); + } + else + { + size_type str_len = safe_iter_dif(iter_newEnd, iter_newBeg); + size_type idx = safe_iter_dif(iter_beg, begin()); + size_type len = safe_iter_dif(iter_end, iter_beg); + + if ((len + idx) > d_cplength) + len = d_cplength - idx; + + size_type newsz = d_cplength + str_len - len; + + grow(newsz); + + if ((idx + len) < d_cplength) + memmove(&ptr()[idx + str_len], &ptr()[len + idx], (d_cplength - idx - len) * sizeof(utf32)); + + memcpy(&ptr()[idx], iter_newBeg.d_ptr, str_len * sizeof(utf32)); + setlen(newsz); + } + + return *this; + } + + + /*! + \brief + Replace code points in the String with the specified c-string. + + \param idx + Index of the first code point to be replaced + + \param len + Maximum number of code points to be replaced (if this is 0, operation is an insert at position \a idx) + + \param c_str + c-string that is to replace the specified code points + + \return + This String after the replace operation + + \exception std::out_of_range Thrown if \a idx is invalid for this String + \exception std::length_error Thrown if the resulting String would be too large. + */ + String& replace(size_type idx, size_type len, const char* cstr) + { + return replace(idx, len, cstr, strlen(cstr)); + } + + + /*! + \brief + Replace the code points in the range [beg, end) with the specified c-string. + + \note + If \a beg == \a end, the operation is a insert at iterator position \a beg + + \param beg + Iterator describing the start of the range to be replaced + + \param end + Iterator describing the (exclusive) end of the range to be replaced. + + \param c_str + c-string that is to replace the specified range of code points + + \return + This String after the replace operation + + \exception std::length_error Thrown if the resulting String would be too large. + */ + String& replace(iterator iter_beg, iterator iter_end, const char* cstr) + { + return replace(iter_beg, iter_end, cstr, strlen(cstr)); + } + + + /*! + \brief + Replace code points in the String with chars from the given char array. + + \param idx + Index of the first code point to be replaced + + \param len + Maximum number of code points to be replaced (if this is 0, operation is an insert at position \a idx) + + \param chars + char array containing the cars that are to replace the specified code points + + \param chars_len + Number of chars in the char array. + + \return + This String after the replace operation + + \exception std::out_of_range Thrown if \a idx is invalid for this String + \exception std::length_error Thrown if the resulting String would be too large, or if \a chars_len was 'npos'. + */ + String& replace(size_type idx, size_type len, const char* chars, size_type chars_len) + { + if (d_cplength < idx) + throw std::out_of_range("Index is out of range for CEGUI::String"); + + if (chars_len == npos) + throw std::length_error("Length for the char array can not be 'npos'"); + + if (((len + idx) > d_cplength) || (len == npos)) + len = d_cplength - idx; + + size_type newsz = d_cplength + chars_len - len; + + grow(newsz); + + if ((idx + len) < d_cplength) + memmove(&ptr()[idx + chars_len], &ptr()[len + idx], (d_cplength - idx - len) * sizeof(utf32)); + + utf32* pt = &ptr()[idx + chars_len - 1]; + + while (chars_len--) + *pt-- = static_cast<utf32>(static_cast<unsigned char>(chars[chars_len])); + + setlen(newsz); + return *this; + } + + + /*! + \brief + Replace the code points in the range [beg, end) with chars from the given char array. + + \note + If \a beg == \a end, the operation is a insert at iterator position \a beg + + \param beg + Iterator describing the start of the range to be replaced + + \param end + Iterator describing the (exclusive) end of the range to be replaced. + + \param chars + char array containing the chars that are to replace the specified range of code points + + \param chars_len + Number of chars in the char array. + + \return + This String after the replace operation + + \exception std::length_error Thrown if the resulting String would be too large, or if \a chars_len was 'npos'. + */ + String& replace(iterator iter_beg, iterator iter_end, const char* chars, size_type chars_len) + { + return replace(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg), chars, chars_len); + } + + + ////////////////////////////////////////////////////////////////////////// + // Find a code point + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Search forwards for a given code point + + \param code_point + The utf32 code point to search for + + \param idx + Index of the code point where the search is to start. + + \return + - Index of the first occurrence of \a code_point travelling forwards from \a idx. + - npos if the code point could not be found + */ + size_type find(utf32 code_point, size_type idx = 0) const + { + if (idx < d_cplength) + { + const utf32* pt = &ptr()[idx]; + + while (idx < d_cplength) + { + if (*pt++ == code_point) + return idx; + + ++idx; + } + + } + + return npos; + } + + /*! + \brief + Search backwards for a given code point + + \param code_point + The utf32 code point to search for + + \param idx + Index of the code point where the search is to start. + + \return + - Index of the first occurrence of \a code_point travelling backwards from \a idx. + - npos if the code point could not be found + */ + size_type rfind(utf32 code_point, size_type idx = npos) const + { + if (idx >= d_cplength) + idx = d_cplength - 1; + + if (d_cplength > 0) + { + const utf32* pt = &ptr()[idx]; + + do + { + if (*pt-- == code_point) + return idx; + + } while (idx-- != 0); + + } + + return npos; + } + + ////////////////////////////////////////////////////////////////////////// + // Find a substring + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Search forwards for a sub-string + + \param str + String object describing the sub-string to search for + + \param idx + Index of the code point where the search is to start + + \return + - Index of the first occurrence of sub-string \a str travelling forwards from \a idx. + - npos if the sub-string could not be found + */ + size_type find(const String& str, size_type idx = 0) const + { + if ((str.d_cplength == 0) && (idx < d_cplength)) + return idx; + + if (idx < d_cplength) + { + // loop while search string could fit in to search area + while (d_cplength - idx >= str.d_cplength) + { + if (0 == compare(idx, str.d_cplength, str)) + return idx; + + ++idx; + } + + } + + return npos; + } + + /*! + \brief + Search backwards for a sub-string + + \param str + String object describing the sub-string to search for + + \param idx + Index of the code point where the search is to start + + \return + - Index of the first occurrence of sub-string \a str travelling backwards from \a idx. + - npos if the sub-string could not be found + */ + size_type rfind(const String& str, size_type idx = npos) const + { + if (str.d_cplength == 0) + return (idx < d_cplength) ? idx : d_cplength; + + if (str.d_cplength <= d_cplength) + { + if (idx > (d_cplength - str.d_cplength)) + idx = d_cplength - str.d_cplength; + + do + { + if (0 == compare(idx, str.d_cplength, str)) + return idx; + + } while (idx-- != 0); + + } + + return npos; + } + + /*! + \brief + Search forwards for a sub-string + + \param std_str + std::string object describing the sub-string to search for + + \note + Characters from \a std_str are considered to represent Unicode code points in the range 0x00..0xFF. No translation of + the encountered data is performed. + + \param idx + Index of the code point where the search is to start + + \return + - Index of the first occurrence of sub-string \a std_str travelling forwards from \a idx. + - npos if the sub-string could not be found + */ + size_type find(const std::string& std_str, size_type idx = 0) const + { + std::string::size_type sze = std_str.size(); + + if ((sze == 0) && (idx < d_cplength)) + return idx; + + if (idx < d_cplength) + { + // loop while search string could fit in to search area + while (d_cplength - idx >= sze) + { + if (0 == compare(idx, (size_type)sze, std_str)) + return idx; + + ++idx; + } + + } + + return npos; + } + + /*! + \brief + Search backwards for a sub-string + + \param std_str + std::string object describing the sub-string to search for + + \note + Characters from \a std_str are considered to represent Unicode code points in the range 0x00..0xFF. No translation of + the encountered data is performed. + + \param idx + Index of the code point where the search is to start + + \return + - Index of the first occurrence of sub-string \a std_str travelling backwards from \a idx. + - npos if the sub-string could not be found + */ + size_type rfind(const std::string& std_str, size_type idx = npos) const + { + std::string::size_type sze = std_str.size(); + + if (sze == 0) + return (idx < d_cplength) ? idx : d_cplength; + + if (sze <= d_cplength) + { + if (idx > (d_cplength - sze)) + idx = d_cplength - sze; + + do + { + if (0 == compare(idx, (size_type)sze, std_str)) + return idx; + + } while (idx-- != 0); + + } + + return npos; + } + + /*! + \brief + Search forwards for a sub-string + + \param utf8_str + Buffer containing null-terminated utf8 encoded data describing the sub-string to search for + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param idx + Index of the code point where the search is to start + + \return + - Index of the first occurrence of sub-string \a utf8_str travelling forwards from \a idx. + - npos if the sub-string could not be found + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + */ + size_type find(const utf8* utf8_str, size_type idx = 0) const + { + return find(utf8_str, idx, utf_length(utf8_str)); + } + + /*! + \brief + Search backwards for a sub-string + + \param utf8_str + Buffer containing null-terminated utf8 encoded data describing the sub-string to search for + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param idx + Index of the code point where the search is to start + + \return + - Index of the first occurrence of sub-string \a utf8_str travelling backwards from \a idx. + - npos if the sub-string could not be found + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + */ + size_type rfind(const utf8* utf8_str, size_type idx = npos) const + { + return rfind(utf8_str, idx, utf_length(utf8_str)); + } + + /*! + \brief + Search forwards for a sub-string + + \param utf8_str + Buffer containing utf8 encoded data describing the sub-string to search for + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param idx + Index of the code point where the search is to start + + \param str_len + Length of the utf8 encoded sub-string in utf8 code units (not code points) + + \return + - Index of the first occurrence of sub-string \a utf8_str travelling forwards from \a idx. + - npos if the sub-string could not be found + + \exception std::length_error Thrown if \a str_len is 'npos' + */ + size_type find(const utf8* utf8_str, size_type idx, size_type str_len) const + { + if (str_len == npos) + throw std::length_error("Length for utf8 encoded string can not be 'npos'"); + + size_type sze = encoded_size(utf8_str, str_len); + + if ((sze == 0) && (idx < d_cplength)) + return idx; + + if (idx < d_cplength) + { + // loop while search string could fit in to search area + while (d_cplength - idx >= sze) + { + if (0 == compare(idx, sze, utf8_str, sze)) + return idx; + + ++idx; + } + + } + + return npos; + } + + /*! + \brief + Search backwards for a sub-string + + \param utf8_str + Buffer containing utf8 encoded data describing the sub-string to search for + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param idx + Index of the code point where the search is to start + + \param str_len + Length of the utf8 encoded sub-string in utf8 code units (not code points) + + \return + - Index of the first occurrence of sub-string \a utf8_str travelling backwards from \a idx. + - npos if the sub-string could not be found + + \exception std::length_error Thrown if \a str_len is 'npos' + */ + size_type rfind(const utf8* utf8_str, size_type idx, size_type str_len) const + { + if (str_len == npos) + throw std::length_error("Length for utf8 encoded string can not be 'npos'"); + + size_type sze = encoded_size(utf8_str, str_len); + + if (sze == 0) + return (idx < d_cplength) ? idx : d_cplength; + + if (sze <= d_cplength) + { + if (idx > (d_cplength - sze)) + idx = d_cplength - sze; + + do + { + if (0 == compare(idx, sze, utf8_str, sze)) + return idx; + + } while (idx-- != 0); + + } + + return npos; + } + + + /*! + \brief + Search forwards for a sub-string + + \param c_str + c-string describing the sub-string to search for + + \param idx + Index of the code point where the search is to start + + \return + - Index of the first occurrence of sub-string \a c_str travelling forwards from \a idx. + - npos if the sub-string could not be found + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + */ + size_type find(const char* cstr, size_type idx = 0) const + { + return find(cstr, idx, strlen(cstr)); + } + + + /*! + \brief + Search backwards for a sub-string + + \param c_str + c-string describing the sub-string to search for + + \param idx + Index of the code point where the search is to start + + \return + - Index of the first occurrence of sub-string \a c_str travelling backwards from \a idx. + - npos if the sub-string could not be found + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + */ + size_type rfind(const char* cstr, size_type idx = npos) const + { + return rfind(cstr, idx, strlen(cstr)); + } + + + /*! + \brief + Search forwards for a sub-string + + \param chars + char array describing the sub-string to search for + + \param idx + Index of the code point where the search is to start + + \param chars_len + Number of chars in the char array. + + \return + - Index of the first occurrence of sub-string \a chars travelling forwards from \a idx. + - npos if the sub-string could not be found + + \exception std::length_error Thrown if \a chars_len is 'npos' + */ + size_type find(const char* chars, size_type idx, size_type chars_len) const + { + if (chars_len == npos) + throw std::length_error("Length for char array can not be 'npos'"); + + if ((chars_len == 0) && (idx < d_cplength)) + return idx; + + if (idx < d_cplength) + { + // loop while search string could fit in to search area + while (d_cplength - idx >= chars_len) + { + if (0 == compare(idx, chars_len, chars, chars_len)) + return idx; + + ++idx; + } + + } + + return npos; + } + + + /*! + \brief + Search backwards for a sub-string + + \param chars + char array describing the sub-string to search for + + \param idx + Index of the code point where the search is to start + + \param chars_len + Number of chars in the char array. + + \return + - Index of the first occurrence of sub-string \a chars travelling backwards from \a idx. + - npos if the sub-string could not be found + + \exception std::length_error Thrown if \a chars_len is 'npos' + */ + size_type rfind(const char* chars, size_type idx, size_type chars_len) const + { + if (chars_len == npos) + throw std::length_error("Length for char array can not be 'npos'"); + + if (chars_len == 0) + return (idx < d_cplength) ? idx : d_cplength; + + if (chars_len <= d_cplength) + { + if (idx > (d_cplength - chars_len)) + idx = d_cplength - chars_len; + + do + { + if (0 == compare(idx, chars_len, chars, chars_len)) + return idx; + + } while (idx-- != 0); + + } + + return npos; + } + + + ////////////////////////////////////////////////////////////////////////// + // Find first of different code-points + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Find the first occurrence of one of a set of code points. + + \param str + String object describing the set of code points. + + \param idx + Index of the start point for the search + + \return + - Index of the first occurrence of any one of the code points in \a str starting from from \a idx. + - npos if none of the code points in \a str were found. + */ + size_type find_first_of(const String& str, size_type idx = 0) const + { + if (idx < d_cplength) + { + const utf32* pt = &ptr()[idx]; + + do + { + if (npos != str.find(*pt++)) + return idx; + + } while (++idx != d_cplength); + + } + + return npos; + } + + /*! + \brief + Find the first code point that is not one of a set of code points. + + \param str + String object describing the set of code points. + + \param idx + Index of the start point for the search + + \return + - Index of the first code point that does not match any one of the code points in \a str starting from from \a idx. + - npos if all code points matched one of the code points in \a str. + */ + size_type find_first_not_of(const String& str, size_type idx = 0) const + { + if (idx < d_cplength) + { + const utf32* pt = &ptr()[idx]; + + do + { + if (npos == str.find(*pt++)) + return idx; + + } while (++idx != d_cplength); + + } + + return npos; + } + + + /*! + \brief + Find the first occurrence of one of a set of code points. + + \param std_str + std::string object describing the set of code points. + + \note + The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF. No translation of + the provided data will occur. + + \param idx + Index of the start point for the search + + \return + - Index of the first occurrence of any one of the code points in \a std_str starting from from \a idx. + - npos if none of the code points in \a std_str were found. + */ + size_type find_first_of(const std::string& std_str, size_type idx = 0) const + { + if (idx < d_cplength) + { + const utf32* pt = &ptr()[idx]; + + do + { + if (npos != find_codepoint(std_str, *pt++)) + return idx; + + } while (++idx != d_cplength); + + } + + return npos; + } + + /*! + \brief + Find the first code point that is not one of a set of code points. + + \param std_str + std::string object describing the set of code points. + + \note + The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF. No translation of + the provided data will occur. + + \param idx + Index of the start point for the search + + \return + - Index of the first code point that does not match any one of the code points in \a std_str starting from from \a idx. + - npos if all code points matched one of the code points in \a std_str. + */ + size_type find_first_not_of(const std::string& std_str, size_type idx = 0) const + { + if (idx < d_cplength) + { + const utf32* pt = &ptr()[idx]; + + do + { + if (npos == find_codepoint(std_str, *pt++)) + return idx; + + } while (++idx != d_cplength); + + } + + return npos; + } + + + /*! + \brief + Find the first occurrence of one of a set of code points. + + \param utf8_str + Buffer containing null-terminated utf8 encoded data describing the set of code points. + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param idx + Index of the start point for the search + + \return + - Index of the first occurrence of any one of the code points in \a utf8_str starting from from \a idx. + - npos if none of the code points in \a utf8_str were found. + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + */ + size_type find_first_of(const utf8* utf8_str, size_type idx = 0) const + { + return find_first_of(utf8_str, idx, utf_length(utf8_str)); + } + + /*! + \brief + Find the first code point that is not one of a set of code points. + + \param utf8_str + Buffer containing null-terminated utf8 encoded data describing the set of code points. + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param idx + Index of the start point for the search + + \return + - Index of the first code point that does not match any one of the code points in \a utf8_str starting from from \a idx. + - npos if all code points matched one of the code points in \a utf8_str. + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + */ + size_type find_first_not_of(const utf8* utf8_str, size_type idx = 0) const + { + return find_first_not_of(utf8_str, idx, utf_length(utf8_str)); + } + + /*! + \brief + Find the first occurrence of one of a set of code points. + + \param utf8_str + Buffer containing utf8 encoded data describing the set of code points. + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param idx + Index of the start point for the search + + \param str_len + Length of the utf8 encoded data in utf8 code units (not code points). + + \return + - Index of the first occurrence of any one of the code points in \a utf8_str starting from from \a idx. + - npos if none of the code points in \a utf8_str were found. + + \exception std::length_error Thrown if \a str_len was 'npos'. + */ + size_type find_first_of(const utf8* utf8_str, size_type idx, size_type str_len) const + { + if (str_len == npos) + throw std::length_error("Length for utf8 encoded string can not be 'npos'"); + + if (idx < d_cplength) + { + size_type encsze = encoded_size(utf8_str, str_len); + + const utf32* pt = &ptr()[idx]; + + do + { + if (npos != find_codepoint(utf8_str, encsze, *pt++)) + return idx; + + } while (++idx != d_cplength); + + } + + return npos; + } + + /*! + \brief + Find the first code point that is not one of a set of code points. + + \param utf8_str + Buffer containing utf8 encoded data describing the set of code points. + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param idx + Index of the start point for the search + + \param str_len + Length of the utf8 encoded data in utf8 code units (not code points). + + \return + - Index of the first code point that does not match any one of the code points in \a utf8_str starting from from \a idx. + - npos if all code points matched one of the code points in \a utf8_str. + + \exception std::length_error Thrown if \a str_len was 'npos'. + */ + size_type find_first_not_of(const utf8* utf8_str, size_type idx, size_type str_len) const + { + if (str_len == npos) + throw std::length_error("Length for utf8 encoded string can not be 'npos'"); + + if (idx < d_cplength) + { + size_type encsze = encoded_size(utf8_str, str_len); + + const utf32* pt = &ptr()[idx]; + + do + { + if (npos == find_codepoint(utf8_str, encsze, *pt++)) + return idx; + + } while (++idx != d_cplength); + + } + + return npos; + } + + + /*! + \brief + Search forwards for a given code point + + \param code_point + The utf32 code point to search for + + \param idx + Index of the code point where the search is to start. + + \return + - Index of the first occurrence of \a code_point starting from from \a idx. + - npos if the code point could not be found + */ + size_type find_first_of(utf32 code_point, size_type idx = 0) const + { + return find(code_point, idx); + } + + /*! + \brief + Search forwards for the first code point that does not match a given code point + + \param code_point + The utf32 code point to search for + + \param idx + Index of the code point where the search is to start. + + \return + - Index of the first code point that does not match \a code_point starting from from \a idx. + - npos if all code points matched \a code_point + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + */ + size_type find_first_not_of(utf32 code_point, size_type idx = 0) const + { + if (idx < d_cplength) + { + do + { + if ((*this)[idx] != code_point) + return idx; + + } while(idx++ < d_cplength); + + } + + return npos; + } + + + /*! + \brief + Find the first occurrence of one of a set of chars. + + \param c_str + c-string describing the set of chars. + + \param idx + Index of the start point for the search + + \return + - Index of the first occurrence of any one of the chars in \a c_str starting from from \a idx. + - npos if none of the chars in \a c_str were found. + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + */ + size_type find_first_of(const char* cstr, size_type idx = 0) const + { + return find_first_of(cstr, idx, strlen(cstr)); + } + + + /*! + \brief + Find the first code point that is not one of a set of chars. + + \param c_str + c-string describing the set of chars. + + \param idx + Index of the start point for the search + + \return + - Index of the first code point that does not match any one of the chars in \a c_str starting from from \a idx. + - npos if all code points matched any of the chars in \a c_str. + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + */ + size_type find_first_not_of(const char* cstr, size_type idx = 0) const + { + return find_first_not_of(cstr, idx, strlen(cstr)); + } + + + /*! + \brief + Find the first occurrence of one of a set of chars. + + \param chars + char array containing the set of chars. + + \param idx + Index of the start point for the search + + \param chars_len + Number of chars in the char array. + + \return + - Index of the first occurrence of any one of the chars in \a chars starting from from \a idx. + - npos if none of the chars in \a chars were found. + + \exception std::length_error Thrown if \a chars_len was 'npos'. + */ + size_type find_first_of(const char* chars, size_type idx, size_type chars_len) const + { + if (chars_len == npos) + throw std::length_error("Length for char array can not be 'npos'"); + + if (idx < d_cplength) + { + const utf32* pt = &ptr()[idx]; + + do + { + if (npos != find_codepoint(chars, chars_len, *pt++)) + return idx; + + } while (++idx != d_cplength); + + } + + return npos; + } + + + /*! + \brief + Find the first code point that is not one of a set of chars. + + \param chars + char array containing the set of chars. + + \param idx + Index of the start point for the search + + \param chars_len + Number of chars in the car array. + + \return + - Index of the first code point that does not match any one of the chars in \a chars starting from from \a idx. + - npos if all code points matched any of the chars in \a chars. + + \exception std::length_error Thrown if \a chars_len was 'npos'. + */ + size_type find_first_not_of(const char* chars, size_type idx, size_type chars_len) const + { + if (chars_len == npos) + throw std::length_error("Length for char array can not be 'npos'"); + + if (idx < d_cplength) + { + const utf32* pt = &ptr()[idx]; + + do + { + if (npos == find_codepoint(chars, chars_len, *pt++)) + return idx; + + } while (++idx != d_cplength); + + } + + return npos; + } + + + ////////////////////////////////////////////////////////////////////////// + // Find last of different code-points + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Find the last occurrence of one of a set of code points. + + \param str + String object describing the set of code points. + + \param idx + Index of the start point for the search + + \return + - Index of the last occurrence of any one of the code points in \a str starting from \a idx. + - npos if none of the code points in \a str were found. + */ + size_type find_last_of(const String& str, size_type idx = npos) const + { + if (d_cplength > 0) + { + if (idx >= d_cplength) + idx = d_cplength - 1; + + const utf32* pt = &ptr()[idx]; + + do + { + if (npos != str.find(*pt--)) + return idx; + + } while (idx-- != 0); + + } + + return npos; + } + + /*! + \brief + Find the last code point that is not one of a set of code points. + + \param str + String object describing the set of code points. + + \param idx + Index of the start point for the search + + \return + - Index of the last code point that does not match any one of the code points in \a str starting from \a idx. + - npos if all code points matched one of the code points in \a str. + */ + size_type find_last_not_of(const String& str, size_type idx = npos) const + { + if (d_cplength > 0) + { + if (idx >= d_cplength) + idx = d_cplength - 1; + + const utf32* pt = &ptr()[idx]; + + do + { + if (npos == str.find(*pt--)) + return idx; + + } while (idx-- != 0); + + } + + return npos; + } + + + /*! + \brief + Find the last occurrence of one of a set of code points. + + \param std_str + std::string object describing the set of code points. + + \note + The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF. No translation of + the provided data will occur. + + \param idx + Index of the start point for the search + + \return + - Index of the last occurrence of any one of the code points in \a std_str starting from \a idx. + - npos if none of the code points in \a std_str were found. + */ + size_type find_last_of(const std::string& std_str, size_type idx = npos) const + { + if (d_cplength > 0) + { + if (idx >= d_cplength) + idx = d_cplength - 1; + + const utf32* pt = &ptr()[idx]; + + do + { + if (npos != find_codepoint(std_str, *pt--)) + return idx; + + } while (idx-- != 0); + + } + + return npos; + } + + /*! + \brief + Find the last code point that is not one of a set of code points. + + \param std_str + std::string object describing the set of code points. + + \note + The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF. No translation of + the provided data will occur. + + \param idx + Index of the start point for the search + + \return + - Index of the last code point that does not match any one of the code points in \a std_str starting from \a idx. + - npos if all code points matched one of the code points in \a std_str. + */ + size_type find_last_not_of(const std::string& std_str, size_type idx = npos) const + { + if (d_cplength > 0) + { + if (idx >= d_cplength) + idx = d_cplength - 1; + + const utf32* pt = &ptr()[idx]; + + do + { + if (npos == find_codepoint(std_str, *pt--)) + return idx; + + } while (idx-- != 0); + + } + + return npos; + } + + + /*! + \brief + Find the last occurrence of one of a set of code points. + + \param utf8_str + Buffer containing null-terminated utf8 encoded data describing the set of code points. + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param idx + Index of the start point for the search + + \return + - Index of the last occurrence of any one of the code points in \a utf8_str starting from \a idx. + - npos if none of the code points in \a utf8_str were found. + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + */ + size_type find_last_of(const utf8* utf8_str, size_type idx = npos) const + { + return find_last_of(utf8_str, idx, utf_length(utf8_str)); + } + + /*! + \brief + Find the last code point that is not one of a set of code points. + + \param utf8_str + Buffer containing null-terminated utf8 encoded data describing the set of code points. + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param idx + Index of the start point for the search + + \return + - Index of the last code point that does not match any one of the code points in \a utf8_str starting from \a idx. + - npos if all code points matched one of the code points in \a utf8_str. + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + */ + size_type find_last_not_of(const utf8* utf8_str, size_type idx = npos) const + { + return find_last_not_of(utf8_str, idx, utf_length(utf8_str)); + } + + /*! + \brief + Find the last occurrence of one of a set of code points. + + \param utf8_str + Buffer containing utf8 encoded data describing the set of code points. + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param idx + Index of the start point for the search + + \param str_len + Length of the utf8 encoded data in utf8 code units (not code points). + + \return + - Index of the last occurrence of any one of the code points in \a utf8_str starting from from \a idx. + - npos if none of the code points in \a utf8_str were found. + + \exception std::length_error Thrown if \a str_len was 'npos'. + */ + size_type find_last_of(const utf8* utf8_str, size_type idx, size_type str_len) const + { + if (str_len == npos) + throw std::length_error("Length for utf8 encoded string can not be 'npos'"); + + if (d_cplength > 0) + { + if (idx >= d_cplength) + idx = d_cplength - 1; + + size_type encsze = encoded_size(utf8_str, str_len); + + const utf32* pt = &ptr()[idx]; + + do + { + if (npos != find_codepoint(utf8_str, encsze, *pt--)) + return idx; + + } while (idx-- != 0); + + } + + return npos; + } + + /*! + \brief + Find the last code point that is not one of a set of code points. + + \param utf8_str + Buffer containing utf8 encoded data describing the set of code points. + + \note + A basic string literal (cast to utf8*) can be passed to this function, provided that the string is + comprised only of code points 0x00..0x7f. The use of extended ASCII characters (with values >0x7f) + would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable + results. + + \param idx + Index of the start point for the search + + \param str_len + Length of the utf8 encoded data in utf8 code units (not code points). + + \return + - Index of the last code point that does not match any one of the code points in \a utf8_str starting from from \a idx. + - npos if all code points matched one of the code points in \a utf8_str. + + \exception std::length_error Thrown if \a str_len was 'npos'. + */ + size_type find_last_not_of(const utf8* utf8_str, size_type idx, size_type str_len) const + { + if (str_len == npos) + throw std::length_error("Length for utf8 encoded string can not be 'npos'"); + + if (d_cplength > 0) + { + if (idx >= d_cplength) + idx = d_cplength - 1; + + size_type encsze = encoded_size(utf8_str, str_len); + + const utf32* pt = &ptr()[idx]; + + do + { + if (npos == find_codepoint(utf8_str, encsze, *pt--)) + return idx; + + } while (idx-- != 0); + + } + + return npos; + } + + + /*! + \brief + Search for last occurrence of a given code point + + \param code_point + The utf32 code point to search for + + \param idx + Index of the code point where the search is to start. + + \return + - Index of the last occurrence of \a code_point starting from \a idx. + - npos if the code point could not be found + */ + size_type find_last_of(utf32 code_point, size_type idx = npos) const + { + return rfind(code_point, idx); + } + + /*! + \brief + Search for the last code point that does not match a given code point + + \param code_point + The utf32 code point to search for + + \param idx + Index of the code point where the search is to start. + + \return + - Index of the last code point that does not match \a code_point starting from from \a idx. + - npos if all code points matched \a code_point + */ + size_type find_last_not_of(utf32 code_point, size_type idx = npos) const + { + if (d_cplength > 0) + { + if (idx >= d_cplength) + idx = d_cplength - 1; + + do + { + if ((*this)[idx] != code_point) + return idx; + + } while(idx-- != 0); + + } + + return npos; + } + + + /*! + \brief + Find the last occurrence of one of a set of chars. + + \param c_str + c-string describing the set of chars. + + \param idx + Index of the start point for the search + + \return + - Index of the last occurrence of any one of the chars in \a c_str starting from \a idx. + - npos if none of the chars in \a c_str were found. + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + */ + size_type find_last_of(const char* cstr, size_type idx = npos) const + { + return find_last_of(cstr, idx, strlen(cstr)); + } + + + /*! + \brief + Find the last code point that is not one of a set of chars. + + \param c_str + c-string describing the set of chars. + + \param idx + Index of the start point for the search + + \return + - Index of the last code point that does not match any one of the chars in \a c_str starting from \a idx. + - npos if all code points matched any of the chars in \a c_str. + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + */ + size_type find_last_not_of(const char* cstr, size_type idx = npos) const + { + return find_last_not_of(cstr, idx, strlen(cstr)); + } + + + /*! + \brief + Find the last occurrence of one of a set of chars. + + \param chars + char array containing the set of chars. + + \param idx + Index of the start point for the search + + \param chars_len + Number of chars in the char array. + + \return + - Index of the last occurrence of any one of the chars in \a chars, starting from from \a idx. + - npos if none of the chars in \a chars were found. + + \exception std::length_error Thrown if \a chars_len was 'npos'. + */ + size_type find_last_of(const char* chars, size_type idx, size_type chars_len) const + { + if (chars_len == npos) + throw std::length_error("Length for char array can not be 'npos'"); + + if (d_cplength > 0) + { + if (idx >= d_cplength) + idx = d_cplength - 1; + + const utf32* pt = &ptr()[idx]; + + do + { + if (npos != find_codepoint(chars, chars_len, *pt--)) + return idx; + + } while (idx-- != 0); + + } + + return npos; + } + + + /*! + \brief + Find the last code point that is not one of a set of chars. + + \param chars + char array containing the set of chars. + + \param idx + Index of the start point for the search + + \param chars_len + Number of chars in the char array. + + \return + - Index of the last code point that does not match any one of the chars in \a chars, starting from from \a idx. + - npos if all code points matched any of the chars in \a chars. + + \exception std::length_error Thrown if \a chars_len was 'npos'. + */ + size_type find_last_not_of(const char* chars, size_type idx, size_type chars_len) const + { + if (chars_len == npos) + throw std::length_error("Length for char array can not be 'npos'"); + + if (d_cplength > 0) + { + if (idx >= d_cplength) + idx = d_cplength - 1; + + const utf32* pt = &ptr()[idx]; + + do + { + if (npos == find_codepoint(chars, chars_len, *pt--)) + return idx; + + } while (idx-- != 0); + + } + + return npos; + } + + + ////////////////////////////////////////////////////////////////////////// + // Substring + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Returns a substring of this String. + + \param idx + Index of the first code point to use for the sub-string. + + \param len + Maximum number of code points to use for the sub-string + + \return + A String object containing the specified sub-string. + + \exception std::out_of_range Thrown if \a idx is invalid for this String. + */ + String substr(size_type idx = 0, size_type len = npos) const + { + if (d_cplength < idx) + throw std::out_of_range("Index is out of range for this CEGUI::String"); + + return String(*this, idx, len); + } + + ////////////////////////////////////////////////////////////////////////// + // Iterator creation + ////////////////////////////////////////////////////////////////////////// + /*! + \brief + Return a forwards iterator that describes the beginning of the String + + \return + iterator object that describes the beginning of the String. + */ + iterator begin(void) + { + return iterator(ptr()); + } + + /*! + \brief + Return a constant forwards iterator that describes the beginning of the String + + \return + const_iterator object that describes the beginning of the String. + */ + const_iterator begin(void) const + { + return const_iterator(ptr()); + } + + /*! + \brief + Return a forwards iterator that describes the end of the String + + \return + iterator object that describes the end of the String. + */ + iterator end(void) + { + return iterator(&ptr()[d_cplength]); + } + + /*! + \brief + Return a constant forwards iterator that describes the end of the String + + \return + const_iterator object that describes the end of the String. + */ + const_iterator end(void) const + { + return const_iterator(&ptr()[d_cplength]); + } + + /*! + \brief + Return a reverse iterator that describes the beginning of the String + + \return + reverse_iterator object that describes the beginning of the String (so is actually at the end) + */ + reverse_iterator rbegin(void) + { + return reverse_iterator(end()); + } + + /*! + \brief + Return a constant reverse iterator that describes the beginning of the String + + \return + const_reverse_iterator object that describes the beginning of the String (so is actually at the end) + */ + const_reverse_iterator rbegin(void) const + { + return const_reverse_iterator(end()); + } + + /*! + \brief + Return a reverse iterator that describes the end of the String + + \return + reverse_iterator object that describes the end of the String (so is actually at the beginning) + */ + reverse_iterator rend(void) + { + return reverse_iterator(begin()); + } + + /*! + \brief + Return a constant reverse iterator that describes the end of the String + + \return + const_reverse_iterator object that describes the end of the String (so is actually at the beginning) + */ + const_reverse_iterator rend(void) const + { + return const_reverse_iterator(begin()); + } + +private: + /************************************************************************* + Implementation Functions + *************************************************************************/ + // string management + + // change size of allocated buffer so it is at least 'new_size'. + // May or may not cause re-allocation and copy of buffer if size is larger + // will never re-allocate to make size smaller. (see trim()) + bool grow(size_type new_size); + + // perform re-allocation to remove wasted space. + void trim(void); + + // set the length of the string, and terminate it, according to the given value (will not re-allocate, use grow() first). + void setlen(size_type len) + { + d_cplength = len; + ptr()[len] = (utf32)(0); + } + + // initialise string object + void init(void) + { + d_reserve = STR_QUICKBUFF_SIZE; + d_encodedbuff = 0; + d_encodedbufflen = 0; + d_encodeddatlen = 0; + setlen(0); + } + + // return true if the given pointer is inside the string data + bool inside(utf32* inptr) + { + if (inptr < ptr() || ptr() + d_cplength <= inptr) + return false; + else + return true; + } + + // compute distance between two iterators, returning a 'safe' value + size_type safe_iter_dif(const const_iterator& iter1, const const_iterator& iter2) const + { + return (iter1.d_ptr == 0) ? 0 : (iter1 - iter2); + } + + // encoding functions + // for all: + // src_len is in code units, or 0 for null terminated string. + // dest_len is in code units. + // returns number of code units put into dest buffer. + size_type encode(const utf32* src, utf8* dest, size_type dest_len, size_type src_len = 0) const + { + // count length for null terminated source... + if (src_len == 0) + { + src_len = utf_length(src); + } + + size_type destCapacity = dest_len; + + // while there is data in the source buffer, + for (uint idx = 0; idx < src_len; ++idx) + { + utf32 cp = src[idx]; + + // check there is enough destination buffer to receive this encoded unit (exit loop & return if not) + if (destCapacity < encoded_size(cp)) + { + break; + } + + if (cp < 0x80) + { + *dest++ = (utf8)cp; + --destCapacity; + } + else if (cp < 0x0800) + { + *dest++ = (utf8)((cp >> 6) | 0xC0); + *dest++ = (utf8)((cp & 0x3F) | 0x80); + destCapacity -= 2; + } + else if (cp < 0x10000) + { + *dest++ = (utf8)((cp >> 12) | 0xE0); + *dest++ = (utf8)(((cp >> 6) & 0x3F) | 0x80); + *dest++ = (utf8)((cp & 0x3F) | 0x80); + destCapacity -= 3; + } + else + { + *dest++ = (utf8)((cp >> 18) | 0xF0); + *dest++ = (utf8)(((cp >> 12) & 0x3F) | 0x80); + *dest++ = (utf8)(((cp >> 6) & 0x3F) | 0x80); + *dest++ = (utf8)((cp & 0x3F) | 0x80); + destCapacity -= 4; + } + + } + + return dest_len - destCapacity; + } + + size_type encode(const utf8* src, utf32* dest, size_type dest_len, size_type src_len = 0) const + { + // count length for null terminated source... + if (src_len == 0) + { + src_len = utf_length(src); + } + + size_type destCapacity = dest_len; + + // while there is data in the source buffer, and space in the dest buffer + for (uint idx = 0; ((idx < src_len) && (destCapacity > 0));) + { + utf32 cp; + utf8 cu = src[idx++]; + + if (cu < 0x80) + { + cp = (utf32)(cu); + } + else if (cu < 0xE0) + { + cp = ((cu & 0x1F) << 6); + cp |= (src[idx++] & 0x3F); + } + else if (cu < 0xF0) + { + cp = ((cu & 0x0F) << 12); + cp |= ((src[idx++] & 0x3F) << 6); + cp |= (src[idx++] & 0x3F); + } + else + { + cp = ((cu & 0x07) << 18); + cp |= ((src[idx++] & 0x3F) << 12); + cp |= ((src[idx++] & 0x3F) << 6); + cp |= (src[idx++] & 0x3F); + } + + *dest++ = cp; + --destCapacity; + } + + return dest_len - destCapacity; + } + + // return the number of utf8 code units required to encode the given utf32 code point + size_type encoded_size(utf32 code_point) const + { + if (code_point < 0x80) + return 1; + else if (code_point < 0x0800) + return 2; + else if (code_point < 0x10000) + return 3; + else + return 4; + } + + // return number of code units required to re-encode given null-terminated utf32 data as utf8. return does not include terminating null. + size_type encoded_size(const utf32* buf) const + { + return encoded_size(buf, utf_length(buf)); + } + + // return number of code units required to re-encode given utf32 data as utf8. len is number of code units in 'buf'. + size_type encoded_size(const utf32* buf, size_type len) const + { + size_type count = 0; + + while (len--) + { + count += encoded_size(*buf++); + } + + return count; + } + + // return number of utf32 code units required to re-encode given utf8 data as utf32. return does not include terminating null. + size_type encoded_size(const utf8* buf) const + { + return encoded_size(buf, utf_length(buf)); + } + + // return number of utf32 code units required to re-encode given utf8 data as utf32. len is number of code units in 'buf'. + size_type encoded_size(const utf8* buf, size_type len) const + { + utf8 tcp; + size_type count = 0; + + while (len--) + { + tcp = *buf++; + ++count; + + if (tcp < 0x80) + { + } + else if (tcp < 0xE0) + { + --len; + ++buf; + } + else if (tcp < 0xF0) + { + len -= 2; + buf += 2; + } + else + { + len -= 2; + buf += 3; + } + + } + + return count; + } + + // return number of code units in a null terminated string + size_type utf_length(const utf8* utf8_str) const + { + size_type cnt = 0; + while (*utf8_str++) + cnt++; + + return cnt; + } + + // return number of code units in a null terminated string + size_type utf_length(const utf32* utf32_str) const + { + size_type cnt = 0; + while (*utf32_str++) + cnt++; + + return cnt; + } + + // build an internal buffer with the string encoded as utf8 (remains valid until string is modified). + utf8* build_utf8_buff(void) const; + + // compare two utf32 buffers + int utf32_comp_utf32(const utf32* buf1, const utf32* buf2, size_type cp_count) const + { + if (!cp_count) + return 0; + + while ((--cp_count) && (*buf1 == *buf2)) + buf1++, buf2++; + + return *buf1 - *buf2; + } + + // compare utf32 buffer with char buffer (chars are taken to be code-points in the range 0x00-0xFF) + int utf32_comp_char(const utf32* buf1, const char* buf2, size_type cp_count) const + { + if (!cp_count) + return 0; + + while ((--cp_count) && (*buf1 == static_cast<utf32>(static_cast<unsigned char>(*buf2)))) + buf1++, buf2++; + + return *buf1 - static_cast<utf32>(static_cast<unsigned char>(*buf2)); + } + + // compare utf32 buffer with encoded utf8 data + int utf32_comp_utf8(const utf32* buf1, const utf8* buf2, size_type cp_count) const + { + if (!cp_count) + return 0; + + utf32 cp; + utf8 cu; + + do + { + cu = *buf2++; + + if (cu < 0x80) + { + cp = (utf32)(cu); + } + else if (cu < 0xE0) + { + cp = ((cu & 0x1F) << 6); + cp |= (*buf2++ & 0x3F); + } + else if (cu < 0xF0) + { + cp = ((cu & 0x0F) << 12); + cp |= ((*buf2++ & 0x3F) << 6); + cp |= (*buf2++ & 0x3F); + } + else + { + cp = ((cu & 0x07) << 18); + cp |= ((*buf2++ & 0x3F) << 12); + cp |= ((*buf2++ & 0x3F) << 6); + cp |= (*buf2++ & 0x3F); + } + + } while ((*buf1++ == cp) && (--cp_count)); + + return (*--buf1) - cp; + } + + // return index of first occurrence of 'code_point' in std::string 'str', or npos if none + size_type find_codepoint(const std::string& str, utf32 code_point) const + { + size_type idx = 0, sze = (size_type)str.size(); + + while (idx != sze) + { + if (code_point == static_cast<utf32>(static_cast<unsigned char>(str[idx]))) + return idx; + + ++idx; + } + + return npos; + } + + // return index of first occurrence of 'code_point' in utf8 encoded string 'str', or npos if none. len is in code points. + size_type find_codepoint(const utf8* str, size_type len, utf32 code_point) const + { + size_type idx = 0; + + utf32 cp; + utf8 cu; + + while (idx != len) { + cu = *str++; + + if (cu < 0x80) + { + cp = (utf32)(cu); + } + else if (cu < 0xE0) + { + cp = ((cu & 0x1F) << 6); + cp |= (*str++ & 0x3F); + } + else if (cu < 0xF0) + { + cp = ((cu & 0x0F) << 12); + cp |= ((*str++ & 0x3F) << 6); + cp |= (*str++ & 0x3F); + } + else + { + cp = ((cu & 0x07) << 18); + cp |= ((*str++ & 0x3F) << 12); + cp |= ((*str++ & 0x3F) << 6); + cp |= (*str++ & 0x3F); + } + + if (code_point == cp) + return idx; + + ++idx; + } + + return npos; + } + + + // return index of first occurrence of 'code_point' in char array 'chars', or npos if none + size_type find_codepoint(const char* chars, size_type chars_len, utf32 code_point) const + { + for (size_type idx = 0; idx != chars_len; ++idx) + { + if (code_point == static_cast<utf32>(static_cast<unsigned char>(chars[idx]))) + return idx; + } + + return npos; + } + +}; + + +////////////////////////////////////////////////////////////////////////// +// Comparison operators +////////////////////////////////////////////////////////////////////////// +/*! +\brief + Return true if String \a str1 is equal to String \a str2 +*/ +bool CEGUIEXPORT operator==(const String& str1, const String& str2); + +/*! +\brief + Return true if String \a str is equal to std::string \a std_str +*/ +bool CEGUIEXPORT operator==(const String& str, const std::string& std_str); + +/*! +\brief + Return true if String \a str is equal to std::string \a std_str +*/ +bool CEGUIEXPORT operator==(const std::string& std_str, const String& str); + +/*! +\brief + Return true if String \a str is equal to null-terminated utf8 data \a utf8_str +*/ +bool CEGUIEXPORT operator==(const String& str, const utf8* utf8_str); + +/*! +\brief + Return true if String \a str is equal to null-terminated utf8 data \a utf8_str +*/ +bool CEGUIEXPORT operator==(const utf8* utf8_str, const String& str); + +/*! +\brief + Return true if String \a str1 is not equal to String \a str2 +*/ +bool CEGUIEXPORT operator!=(const String& str1, const String& str2); + +/*! +\brief + Return true if String \a str is not equal to std::string \a std_str +*/ +bool CEGUIEXPORT operator!=(const String& str, const std::string& std_str); + +/*! +\brief + Return true if String \a str is not equal to std::string \a std_str +*/ +bool CEGUIEXPORT operator!=(const std::string& std_str, const String& str); + +/*! +\brief + Return true if String \a str is not equal to null-terminated utf8 data \a utf8_str +*/ +bool CEGUIEXPORT operator!=(const String& str, const utf8* utf8_str); + +/*! +\brief + Return true if String \a str is not equal to null-terminated utf8 data \a utf8_str +*/ +bool CEGUIEXPORT operator!=(const utf8* utf8_str, const String& str); + +/*! +\brief + Return true if String \a str1 is lexicographically less than String \a str2 +*/ +bool CEGUIEXPORT operator<(const String& str1, const String& str2); + +/*! +\brief + Return true if String \a str is lexicographically less than std::string \a std_str +*/ +bool CEGUIEXPORT operator<(const String& str, const std::string& std_str); + +/*! +\brief + Return true if String \a str is lexicographically less than std::string \a std_str +*/ +bool CEGUIEXPORT operator<(const std::string& std_str, const String& str); + +/*! +\brief + Return true if String \a str is lexicographically less than null-terminated utf8 data \a utf8_str +*/ +bool CEGUIEXPORT operator<(const String& str, const utf8* utf8_str); + +/*! +\brief + Return true if String \a str is lexicographically less than null-terminated utf8 data \a utf8_str +*/ +bool CEGUIEXPORT operator<(const utf8* utf8_str, const String& str); + +/*! +\brief + Return true if String \a str1 is lexicographically greater than String \a str2 +*/ +bool CEGUIEXPORT operator>(const String& str1, const String& str2); + +/*! +\brief + Return true if String \a str is lexicographically greater than std::string \a std_str +*/ +bool CEGUIEXPORT operator>(const String& str, const std::string& std_str); + +/*! +\brief + Return true if String \a str is lexicographically greater than std::string \a std_str +*/ +bool CEGUIEXPORT operator>(const std::string& std_str, const String& str); + +/*! +\brief + Return true if String \a str is lexicographically greater than null-terminated utf8 data \a utf8_str +*/ +bool CEGUIEXPORT operator>(const String& str, const utf8* utf8_str); + +/*! +\brief + Return true if String \a str is lexicographically greater than null-terminated utf8 data \a utf8_str +*/ +bool CEGUIEXPORT operator>(const utf8* utf8_str, const String& str); + +/*! +\brief + Return true if String \a str1 is lexicographically less than or equal to String \a str2 +*/ +bool CEGUIEXPORT operator<=(const String& str1, const String& str2); + +/*! +\brief + Return true if String \a str is lexicographically less than or equal to std::string \a std_str +*/ +bool CEGUIEXPORT operator<=(const String& str, const std::string& std_str); + +/*! +\brief + Return true if String \a str is lexicographically less than or equal to std::string \a std_str +*/ +bool CEGUIEXPORT operator<=(const std::string& std_str, const String& str); + +/*! +\brief + Return true if String \a str is lexicographically less than or equal to null-terminated utf8 data \a utf8_str +*/ +bool CEGUIEXPORT operator<=(const String& str, const utf8* utf8_str); + +/*! +\brief + Return true if String \a str is lexicographically less than or equal to null-terminated utf8 data \a utf8_str +*/ +bool CEGUIEXPORT operator<=(const utf8* utf8_str, const String& str); + +/*! +\brief + Return true if String \a str1 is lexicographically greater than or equal to String \a str2 +*/ +bool CEGUIEXPORT operator>=(const String& str1, const String& str2); + +/*! +\brief + Return true if String \a str is lexicographically greater than or equal to std::string \a std_str +*/ +bool CEGUIEXPORT operator>=(const String& str, const std::string& std_str); + +/*! +\brief + Return true if String \a str is lexicographically greater than or equal to std::string \a std_str +*/ +bool CEGUIEXPORT operator>=(const std::string& std_str, const String& str); + +/*! +\brief + Return true if String \a str is lexicographically greater than or equal to null-terminated utf8 data \a utf8_str +*/ +bool CEGUIEXPORT operator>=(const String& str, const utf8* utf8_str); + +/*! +\brief + Return true if String \a str is lexicographically greater than or equal to null-terminated utf8 data \a utf8_str +*/ +bool CEGUIEXPORT operator>=(const utf8* utf8_str, const String& str); + +/*! +\brief + Return true if String \a str is equal to c-string \a c_str +*/ +bool CEGUIEXPORT operator==(const String& str, const char* c_str); + +/*! +\brief + Return true if c-string \a c_str is equal to String \a str +*/ +bool CEGUIEXPORT operator==(const char* c_str, const String& str); + +/*! +\brief + Return true if String \a str is not equal to c-string \a c_str +*/ +bool CEGUIEXPORT operator!=(const String& str, const char* c_str); + +/*! +\brief + Return true if c-string \a c_str is not equal to String \a str +*/ +bool CEGUIEXPORT operator!=(const char* c_str, const String& str); + +/*! +\brief + Return true if String \a str is lexicographically less than c-string \a c_str +*/ +bool CEGUIEXPORT operator<(const String& str, const char* c_str); + +/*! +\brief + Return true if c-string \a c_str is lexicographically less than String \a str +*/ +bool CEGUIEXPORT operator<(const char* c_str, const String& str); + +/*! +\brief +Return true if String \a str is lexicographically greater than c-string \a c_str +*/ +bool CEGUIEXPORT operator>(const String& str, const char* c_str); + +/*! +\brief +Return true if c-string \a c_str is lexicographically greater than String \a str +*/ +bool CEGUIEXPORT operator>(const char* c_str, const String& str); + +/*! +\brief + Return true if String \a str is lexicographically less than or equal to c-string \a c_str +*/ +bool CEGUIEXPORT operator<=(const String& str, const char* c_str); + +/*! +\brief + Return true if c-string \a c_str is lexicographically less than or equal to String \a str +*/ +bool CEGUIEXPORT operator<=(const char* c_str, const String& str); + +/*! +\brief + Return true if String \a str is lexicographically greater than or equal to c-string \a c_str +*/ +bool CEGUIEXPORT operator>=(const String& str, const char* c_str); + +/*! +\brief + Return true if c-string \a c_str is lexicographically greater than or equal to String \a str +*/ +bool CEGUIEXPORT operator>=(const char* c_str, const String& str); + +////////////////////////////////////////////////////////////////////////// +// Concatenation operator functions +////////////////////////////////////////////////////////////////////////// +/*! +\brief + Return String object that is the concatenation of the given inputs + +\param str1 + String object describing first part of the new string + +\param str2 + String object describing the second part of the new string + +\return + A String object that is the concatenation of \a str1 and \a str2 + +\exception std::length_error Thrown if the resulting String would be too large. +*/ +String CEGUIEXPORT operator+(const String& str1, const String& str2); + +/*! +\brief + Return String object that is the concatenation of the given inputs + +\param str + String object describing first part of the new string + +\param std_str + std::string object describing the second part of the new string + +\return + A String object that is the concatenation of \a str and \a std_str + +\exception std::length_error Thrown if the resulting String would be too large. +*/ +String CEGUIEXPORT operator+(const String& str, const std::string& std_str); + +/*! +\brief + Return String object that is the concatenation of the given inputs + +\param std_str + std::string object describing the first part of the new string + +\param str + String object describing the second part of the new string + +\return + A String object that is the concatenation of \a std_str and \a str + +\exception std::length_error Thrown if the resulting String would be too large. +*/ +String CEGUIEXPORT operator+(const std::string& std_str, const String& str); + +/*! +\brief + Return String object that is the concatenation of the given inputs + +\param str + String object describing first part of the new string + +\param utf8_str + Buffer containing null-terminated utf8 encoded data describing the second part of the new string + +\return + A String object that is the concatenation of \a str and \a utf8_str + +\exception std::length_error Thrown if the resulting String would be too large. +*/ +String CEGUIEXPORT operator+(const String& str, const utf8* utf8_str); + +/*! +\brief + Return String object that is the concatenation of the given inputs + +\param utf8_str + Buffer containing null-terminated utf8 encoded data describing the first part of the new string + +\param str + String object describing the second part of the new string + +\return + A String object that is the concatenation of \a str and \a utf8_str + +\exception std::length_error Thrown if the resulting String would be too large. +*/ +String CEGUIEXPORT operator+(const utf8* utf8_str, const String& str); + +/*! +\brief + Return String object that is the concatenation of the given inputs + +\param str + String object describing the first part of the new string + +\param code_point + utf32 code point describing the second part of the new string + +\return + A String object that is the concatenation of \a str and \a code_point + +\exception std::length_error Thrown if the resulting String would be too large. +*/ +String CEGUIEXPORT operator+(const String& str, utf32 code_point); + +/*! +\brief + Return String object that is the concatenation of the given inputs + +\param code_point + utf32 code point describing the first part of the new string + +\param str + String object describing the second part of the new string + +\return + A String object that is the concatenation of \a code_point and \a str + +\exception std::length_error Thrown if the resulting String would be too large. +*/ +String CEGUIEXPORT operator+(utf32 code_point, const String& str); + +/*! +\brief + Return String object that is the concatenation of the given inputs + +\param str + String object describing first part of the new string + +\param c_str + c-string describing the second part of the new string + +\return + A String object that is the concatenation of \a str and \a c_str + +\exception std::length_error Thrown if the resulting String would be too large. +*/ +String CEGUIEXPORT operator+(const String& str, const char* c_str); + +/*! +\brief + Return String object that is the concatenation of the given inputs + +\param c_str + c-string describing the first part of the new string + +\param str + String object describing the second part of the new string + +\return + A String object that is the concatenation of \a c_str and \a str + +\exception std::length_error Thrown if the resulting String would be too large. +*/ +String CEGUIEXPORT operator+(const char* c_str, const String& str); + + +////////////////////////////////////////////////////////////////////////// +// Output (stream) functions +////////////////////////////////////////////////////////////////////////// +CEGUIEXPORT std::ostream& operator<<(std::ostream& s, const String& str); + + +////////////////////////////////////////////////////////////////////////// +// Modifying operations +////////////////////////////////////////////////////////////////////////// +/*! +\brief + Swap the contents for two String objects + +\param str1 + String object who's contents are to be swapped with \a str2 + +\param str2 + String object who's contents are to be swapped with \a str1 + +\return + Nothing +*/ +void CEGUIEXPORT swap(String& str1, String& str2); + + +} // End of CEGUI namespace section + + +#endif // end of guard _CEGUIString_h_ diff --git a/pcr/cegui-0.5/PKGBUILD b/pcr/cegui-0.5/PKGBUILD new file mode 100644 index 000000000..60c3427cc --- /dev/null +++ b/pcr/cegui-0.5/PKGBUILD @@ -0,0 +1,41 @@ +# Contributor: Jakub Luzny <limoto94@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=cegui-0.5 +pkgver=0.5.0b +pkgrel=1 +pkgdesc="A free library providing windowing and widgets for graphics APIs/engines" +arch=('i686' 'x86_64') +url="http://crayzedsgui.sourceforge.net" +#options=('!libtool') +license=("MIT") +depends=('pcre' 'glew' 'freetype2' 'libxml2' 'devil' 'freeglut' 'silly') +conflicts=('cegui') +source=(http://downloads.sourceforge.net/crayzedsgui/CEGUI-$pkgver.tar.gz + CEGUIString.h) +md5sums=('b42322a33c6a06eede76b15f75694a17' + 'b0859a1316bb25ca4860a5d0052e9a04') + + +build() { + cd $srcdir/CEGUI-0.5.0 + + cp $srcdir/CEGUIString.h include/ + sed -i 's/ILvoid/void/' ImageCodecModules/DevILImageCodec/CEGUIDevILImageCodec.cpp + + ./configure --prefix=/usr --enable-release --enable-shared --disable-expat --disable-tga --disable-samples --disable-xerces-c + + make +} + +package() { + cd $srcdir/CEGUI-0.5.0 + + make DESTDIR=${pkgdir} install + + install -Dm644 COPYING ${pkgdir}/usr/share/licenses/$pkgname/LICENSE +} + +#category: lib +md5sums=('b42322a33c6a06eede76b15f75694a17' + 'b0859a1316bb25ca4860a5d0052e9a04') diff --git a/pcr/cegui-0.6/PKGBUILD b/pcr/cegui-0.6/PKGBUILD new file mode 100644 index 000000000..fb28c2134 --- /dev/null +++ b/pcr/cegui-0.6/PKGBUILD @@ -0,0 +1,55 @@ +# Contributor: Lucio zara <pennega@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=cegui-0.6 +pkgver=0.6.2 +_pkgver=0.6.2b +pkgrel=13 + +pkgdesc="A free library providing windowing and widgets for graphics APIs/engines." +arch=('i686' 'x86_64') +url="http://www.cegui.org.uk/" +license=('MIT') +depends=('devil' 'freetype2' 'libxml2' 'lua' 'pcre' 'silly' 'glew' 'tinyxml' 'directfb' 'freeglut') +makedepends=() +options=('!libtool') +conflicts=('cegui') +source=("http://downloads.sourceforge.net/crayzedsgui/CEGUI-${_pkgver}.tar.gz") +md5sums=('4fbd95e5a2ac1c7acf2a8f5df3ac6b93') + + +build() { + cd ${srcdir}/CEGUI-${pkgver} + #PATCH + #sed -i '1i#include <cstddef>' include/CEGUIString.h + sed -i '/#include <stdexcept>/a\#include <cstddef>' include/CEGUIString.h + sed -i '/#include "CEGUIDynamicModule.h"/a\#include <algorithm>' RendererModules/directfbRenderer/directfb-renderer.cpp + sed -i 's:TiXmlNode\:\::TiXmlNode\:\:TINYXML_:g' XMLParserModules/TinyXMLParser/CEGUITinyXMLParser.cpp + sed -i 's:ILvoid:void:g' ImageCodecModules/DevILImageCodec/CEGUIDevILImageCodec.cpp + + PYTHON=python2 \ + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --disable-static \ + --disable-xerces-c \ + --disable-samples \ + --enable-devil \ + --enable-silly \ + --enable-lua-module \ + --enable-python-module \ + --with-default-image-codec=SILLYImageCodec + + make || return 1 +} + +package() { + cd ${srcdir}/CEGUI-${pkgver} + install -d ${pkgdir}/usr/share/licenses/${pkgname} || return 1 + + make DESTDIR=${pkgdir} install || return 1 + + install -m644 COPYING ${pkgdir}/usr/share/licenses/${pkgname}/ || return 1 +} +md5sums=('4fbd95e5a2ac1c7acf2a8f5df3ac6b93') +md5sums=('4fbd95e5a2ac1c7acf2a8f5df3ac6b93') diff --git a/pcr/cgdb/PKGBUILD b/pcr/cgdb/PKGBUILD new file mode 100644 index 000000000..e623d5a96 --- /dev/null +++ b/pcr/cgdb/PKGBUILD @@ -0,0 +1,21 @@ +# Contributor: Javier ‘Phrodo_00’ Aravena <Phrodo.00@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=cgdb +pkgver=0.6.6 +pkgrel=1 +pkgdesc="Curses-based interface to the GNU Debugger" +arch=('i686' 'x86_64') +url="http://cgdb.sourceforge.net/" +license=('GPL') +depends=('readline>=5.1' 'ncurses' 'gdb') +source=("http://downloads.sourceforge.net/cgdb/$pkgname-$pkgver.tar.gz") +md5sums=('394b542b495755ab8392b7e88dace744') + +build() { + cd $startdir/src/$pkgname-$pkgver + ./configure --prefix=/usr + make || return 1 + make DESTDIR=$startdir/pkg install +} +md5sums=('394b542b495755ab8392b7e88dace744') diff --git a/pcr/cl-ppcre/LICENSE b/pcr/cl-ppcre/LICENSE new file mode 100644 index 000000000..8f122e6eb --- /dev/null +++ b/pcr/cl-ppcre/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2002-2007, Dr. Edmund Weitz. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/pcr/cl-ppcre/PKGBUILD b/pcr/cl-ppcre/PKGBUILD new file mode 100644 index 000000000..b136c4ac9 --- /dev/null +++ b/pcr/cl-ppcre/PKGBUILD @@ -0,0 +1,41 @@ +# Maintainer: mrshpot <mrshpot at gmail dot com> +# Contributor: veox <cy at wre dot ath dot cx> +# Contributor: joyfulgirl <joyfulgirl (at) archlinux.us> +# Contributor: Jonathan Friedman <jonf@gojon.com> +# Maintainer : Parabola GNU / Linux-libre <aurelien@cwb.io> + +pkgname=cl-ppcre +pkgver=2.0.3 +pkgrel=2 +pkgdesc="Perl-compatible, portable regexp library for Common Lisp" +arch=('i686' 'x86_64') +url="http://www.weitz.de/cl-ppcre/" +license=('BSD') + +depends=('common-lisp' 'cl-asdf') + +install=cl-ppcre.install +source=('http://weitz.de/files/cl-ppcre.tar.gz' 'LICENSE') +md5sums=('bd5648fd3c8b6f89eea43f5b82b99aa1' + 'c6aa01dce26b45aa916329701a448d11') + +build() { + install -d ${pkgdir}/usr/share/common-lisp/source/${pkgname} + install -d ${pkgdir}/usr/share/common-lisp/systems + install -d ${pkgdir}/usr/share/licenses/${pkgname} + + cd ${srcdir}/${pkgname}-${pkgver} + + install -m 644 -t ${pkgdir}/usr/share/common-lisp/source/${pkgname} \ + ${srcdir}/${pkgname}-${pkgver}/*.lisp + install -m 644 -t ${pkgdir}/usr/share/common-lisp/source/${pkgname} \ + ${srcdir}/${pkgname}-${pkgver}/*.asd + install -m 644 ${srcdir}/LICENSE \ + ${pkgdir}/usr/share/licenses/${pkgname} + + cd ${pkgdir}/usr/share/common-lisp/systems + ln -s ../source/${pkgname}/${pkgname}.asd . + ln -s ../source/${pkgname}/${pkgname}-unicode.asd . +} + +# vim:set ts=2 sw=4 et nospell: diff --git a/pcr/cl-ppcre/cl-ppcre.install b/pcr/cl-ppcre/cl-ppcre.install new file mode 100644 index 000000000..9ad84d1e1 --- /dev/null +++ b/pcr/cl-ppcre/cl-ppcre.install @@ -0,0 +1,73 @@ +_pkgname=cl-ppcre +_compile_log=n +_lisp=() + +if pacman -Qq clisp &>/dev/null || + pacman -Qq clisp-gtk2 &>/dev/null || + pacman -Qq clisp-new-clx &>/dev/null; then + _lisp=(${_lisp[@]} 'clisp') +fi +if pacman -Qq sbcl &>/dev/null; then + _lisp=(${_lisp[@]} 'sbcl') +fi +if pacman -Qq cmucl &> /dev/null; then + _lisp=(${_lisp[@]} 'cmucl') +fi + +_compile_sbcl() { + sbcl --noinform --no-sysinit --no-userinit \ + --eval "(require :asdf)" \ + --eval "(pushnew #p\"/usr/share/common-lisp/systems/\" asdf:*central-registry* :test #'equal)" \ + --eval "(asdf:operate 'asdf:compile-op '${_pkgname})" \ + --eval "(quit)" &> ${_compile_log_file} || return 1 +} +_compile_clisp() { + clisp --silent -norc -x \ + "(load #p\"/usr/share/common-lisp/source/asdf/asdf.lisp\") + (pushnew #p\"/usr/share/common-lisp/systems/\" asdf:*central-registry* :test #'equal) + (asdf:operate 'asdf:compile-op '${_pkgname}) + (quit)" &> ${_compile_log_file} || return 1 +} +_compile_cmucl() { + cmucl -quiet -nositeinit -noinit -eval \ + "(load #p\"/usr/share/common-lisp/source/asdf/asdf.lisp\") + (pushnew #p\"/usr/share/common-lisp/systems/\" asdf:*central-registry* :test #'equal) + (asdf:operate 'asdf:compile-op '${_pkgname}) + (quit)" &> ${_compile_log_file} || return 1 +} + +post_install() { + for _lispiter in ${_lisp[@]}; do + echo "---> Compiling lisp files using ${_lispiter} <---" + if [ $_compile_log = 'y' ]; then + _compile_log_file=/tmp/${_pkgname}_${_lispiter}.log + else + _compile_log_file=/dev/null + fi + _compile_${_lispiter} + echo "---> Done compiling lisp files (using ${_lispiter}) <---" + done + + cat << EOM + + To load this library, load asdf and then run the following lines + (or their equivalent for your lisp of choice): + + (push #p"/usr/share/common-lisp/systems/" asdf:*central-registry*) + (asdf:operate 'asdf:load-op '${_pkgname}) +EOM +} + +post_upgrade() { + post_install +} + +pre_remove() { + rm -f /usr/share/common-lisp/source/${_pkgname}/{*.fas,*.fasl,*.lib,*.x86f} +} + +pre_upgrade() { + pre_remove +} + +# End of file diff --git a/pcr/clx-git/PKGBUILD b/pcr/clx-git/PKGBUILD new file mode 100644 index 000000000..6e2a3369b --- /dev/null +++ b/pcr/clx-git/PKGBUILD @@ -0,0 +1,71 @@ +#Contributor: Akshay Srinivasan <akshaysrinivasan at gmail.com> +pkgname=clx-git +_clname=clx +pkgver=20120421 +pkgrel=1 +pkgdesc="Xlib for common lisp systems" +arch=('i686' 'x86_64') +url="http://www.cliki.net/CLX" +license=('custom') +depends=('x-server' 'sbcl') +makedepends=('texinfo') +install=clx.install +source=(README.licensing) +md5sums=('74858379015567928f1eee186d9db1a4') + +conflicts=('clx') +provides=('clx') + +makedepends=('git') + +_gitroot="git://github.com/sharplispers/clx.git" +_gitname="clx" + + +build() { + + cat << EOM + + WARNING! + + You are building a package using a snapshot from a repository. The + resulting package may be unusable or pose a security risk, since + the install script does not check source file hashes. Do not continue + if this is undesirable. + +EOM + + install -d ${pkgdir}/usr/share/common-lisp/systems + install -d ${pkgdir}/usr/share/common-lisp/source/${_clname}/{debug,demo,test} + install -d ${pkgdir}/usr/share/licenses/${_clname} + install -d ${pkgdir}/usr/share/info + + ### Git checkout + cd "$srcdir" + msg "Connecting to GIT server...." + + if [ -d $_gitname ] ; then + cd $_gitname && git pull origin + msg "The local files are updated." + else + git clone $_gitroot $_gitname + fi + + cd ${pkgdir}/usr/share/common-lisp/source/${_clname} + + install -m 644 -t . ${srcdir}/${_gitname}/*.lisp + install -m 644 -t debug ${srcdir}/${_gitname}/debug/*.lisp + install -m 644 -t demo ${srcdir}/${_gitname}/demo/*.lisp + install -m 644 -t test ${srcdir}/${_gitname}/test/*.lisp + + install -m 644 -t . ${srcdir}/${_gitname}/${_clname}.asd + cd ${pkgdir}/usr/share/common-lisp/systems + ln -s ../source/${_clname}/${_clname}.asd . + + cd ${srcdir}/${_gitname}/manual + makeinfo ${_clname}.texinfo + install -m 644 ${_clname}.info ${pkgdir}/usr/share/info + + install -m 644 ${srcdir}/README.licensing ${pkgdir}/usr/share/licenses/${_clname} + +} diff --git a/pcr/clx-git/README.licensing b/pcr/clx-git/README.licensing new file mode 100644 index 000000000..669083222 --- /dev/null +++ b/pcr/clx-git/README.licensing @@ -0,0 +1,4 @@ +This packages uses several licenses. + +To see a given source file's license, please check its header. The +lisp files are installed in /usr/share/common-lisp/source/clx. diff --git a/pcr/clx-git/clx.install b/pcr/clx-git/clx.install new file mode 100644 index 000000000..7344518a4 --- /dev/null +++ b/pcr/clx-git/clx.install @@ -0,0 +1,76 @@ +# arg 1: the new package version + +_pkgname=clx +_compile_log=n +_lisp=() + +if pacman -Qq clisp-new-clx &>/dev/null || + pacman -Qq clisp-gtk2 &>/dev/null || + pacman -Qq clisp-new-clx &>/dev/null; then + _lisp=(${_lisp[@]} 'clisp') +fi +if pacman -Qq sbcl &>/dev/null; then + _lisp=(${_lisp[@]} 'sbcl') +fi +if pacman -Qq cmucl &> /dev/null; then + _lisp=(${_lisp[@]} 'cmucl') +fi + +_compile_sbcl() { + sbcl --noinform --no-sysinit --no-userinit \ + --eval "(require :asdf)" \ + --eval "(pushnew #p\"/usr/share/common-lisp/systems/\" asdf:*central-registry* :test #'equal)" \ + --eval "(asdf:operate 'asdf:compile-op '${_pkgname})" \ + --eval "(quit)" &> ${_compile_log_file} || return 1 +} +_compile_clisp() { + clisp --silent -norc -x \ + "(load #p\"/usr/share/common-lisp/source/asdf/asdf\") + (pushnew #p\"/usr/share/common-lisp/systems/\" asdf:*central-registry* :test #'equal) + (asdf:operate 'asdf:compile-op '${_pkgname}) + (quit)" &> ${_compile_log_file} || return 1 +} +_compile_cmucl() { + cmucl -quiet -nositeinit -noinit -eval \ + "(load #p\"/usr/share/common-lisp/source/asdf/asdf\") + (pushnew #p\"/usr/share/common-lisp/systems/\" asdf:*central-registry* :test #'equal) + (asdf:operate 'asdf:compile-op '${_pkgname}) + (quit)" &> ${_compile_log_file} || return 1 +} + +post_install() { + for _lispiter in ${_lisp[@]}; do + echo "---> Compiling lisp files using ${_lispiter} <---" + if [ $_compile_log = 'y' ]; then + _compile_log_file=/tmp/${_pkgname}_${_lispiter}.log + else + _compile_log_file=/dev/null + fi + _compile_${_lispiter} + echo "---> Done compiling lisp files (using ${_lispiter}) <---" + done + + cat << EOM + + To load this library, load asdf and then run the following lines + (or their equivalent for your lisp of choice): + + (push #p"/usr/share/common-lisp/systems/" asdf:*central-registry*) + (asdf:operate 'asdf:load-op '${_pkgname}) +EOM +} + +post_upgrade() { + post_install $1 +} + +pre_remove() { + rm -f /usr/share/common-lisp/source/$_pkgname/{*.fas,*.fasl,*.lib,*.x86f} +} + +op=$1 +shift + +$op $* + +# End of file
\ No newline at end of file diff --git a/pcr/command-not-found/PKGBUILD b/pcr/command-not-found/PKGBUILD new file mode 100644 index 000000000..d43b73c0e --- /dev/null +++ b/pcr/command-not-found/PKGBUILD @@ -0,0 +1,47 @@ +# Contributor: Matthias Maennich <arch@maennich.net> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=command-not-found +pkgver=0.4.4 +pkgrel=1 +pkgdesc="In case a command could not be found this utility searches for packages containing this or a similar command (bash,zsh)." +arch=('i686' 'x86_64') +url="http://github.com/metti/command-not-found" +license=('GPL') +depends=('boost-libs' 'tdb' 'libarchive' 'wget') +makedepends=('boost' 'tdb' 'cmake' 'git') +source=('install') +md5sums=('2ea3c216fb0b7f8449f0225ece33210c') +install='install' + +_gitrepo="https://github.com/metti/$pkgname.git" + +build() { + cd $srcdir + msg "Connecting to the GIT server ..." + + if [[ -d $srcdir/$pkgname ]] ; then + cd $pkgname + git fetch origin + else + git clone $_gitrepo + cd $pkgname + fi + + git checkout v$pkgver + + msg "GIT checkout done" + + mkdir -p $srcdir/build + cd $srcdir/build + + cmake -D CMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="" $srcdir/$pkgname/src + make + +} + +package(){ + cd $srcdir/build + + make DESTDIR=$pkgdir install +} diff --git a/pcr/command-not-found/install b/pcr/command-not-found/install new file mode 100644 index 000000000..26f49fa50 --- /dev/null +++ b/pcr/command-not-found/install @@ -0,0 +1,14 @@ +post_install() { + cnf-sync +} + +post_upgrade() { + cnf-sync +} + +pre_remove() { + rm -rf /var/lib/cnf/*.db + rm -rf /var/lib/cnf/*.tdb +} + +# vim:set ts=2 sw=2 et: diff --git a/pcr/conky-control/PKGBUILD b/pcr/conky-control/PKGBUILD new file mode 100644 index 000000000..c607ae86b --- /dev/null +++ b/pcr/conky-control/PKGBUILD @@ -0,0 +1,35 @@ +# Contributer: giacomogiorgianni@gmail.com +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=conky-control +pkgver=1.0.0 +pkgrel=2 +pkgdesc="control panel for conky" +arch=('any') +url="http://bbs.archbang.org/viewtopic.php?id=3017" +license=('GPL') +categories=() +depends=('conky-lua') +makedepends=() +options=(!emptydirs) +source=("Conky_voyager.tar.gz::http://ompldr.org/vZWoxMA" "conky_voyager.tar.gz::http://ompldr.org/vZWoxYg" "conky-control.install") +md5sums=('6930f45eb5dd402953d306ebe8ff14da' + 'e63ba795800ec20df912e620b423688e' + '0217a6bee07fb918b0c2050548103d43') +install=$pkgname.install + +build() { + mkdir -p $pkgdir/usr/bin + mkdir -p $pkgdir/usr/share/applications + mkdir -p $pkgdir/etc/skel/.config + cp $startdir/conky-controlRC.desktop $pkgdir/etc/skel/.config/ + cp $startdir/conky-control.desktop $pkgdir/usr/share/applications/ + + install -m 0775 -do $LOGNAME $pkgdir/etc/skel/.scripts + tar xzf Conky_voyager.tar.gz -C $pkgdir/etc/skel/.scripts + tar xzf conky_voyager.tar.gz -C $pkgdir/etc/skel// + ln -s $pkgdir/etc/skel/.scripts/Conky/conky $pkgdir/usr/bin/conky-control + } +md5sums=('6930f45eb5dd402953d306ebe8ff14da' + 'e63ba795800ec20df912e620b423688e' + '0217a6bee07fb918b0c2050548103d43') diff --git a/pcr/conky-control/conky-control.install b/pcr/conky-control/conky-control.install new file mode 100644 index 000000000..399672b0a --- /dev/null +++ b/pcr/conky-control/conky-control.install @@ -0,0 +1,17 @@ +post_install() { + for i in `ls /home | grep -v lost+found` + do + cp -fR /etc/skel/.conky /home/$i + cp -fR /etc/skel/.scripts /home/$i + cp -fR /etc/skel/.config /home/$i + echo "# Overwrite this file if you want to have a permanent setting" > /home/$i/.conkyrc + chown $i:users -R /home/$i/{.conky,.scripts} + chown $i:users "/home/$i/.config/autostart/Conky Control RC.desktop" + chown $i:users "/home/$i/.conkyrc" + done + echo " >> Start 'conky-control' to configure conky" +} + +post_upgrade() { + post_install +} diff --git a/pcr/conky-lua/PKGBUILD b/pcr/conky-lua/PKGBUILD new file mode 100644 index 000000000..6d36e9c29 --- /dev/null +++ b/pcr/conky-lua/PKGBUILD @@ -0,0 +1,54 @@ +# Contributor: Renato Garcia <fgarcia.renato@gmail.com> +# Contributor: Giovanni Scafora <giovanni@archlinux.org> +# Contributor: James Rayner <james@archlinux.org> +# Contributor: Partha Chowdhury <kira.laucas@gmail.com> +# Contributor: Gaetan Bisson <bisson@archlinux.org> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=conky-lua +_pkgname=conky +pkgver=1.9.0 +pkgrel=1 +pkgdesc='Lightweight system monitor for X' +url='http://conky.sourceforge.net/' +license=('BSD' 'GPL') +arch=('i686' 'x86_64') +options=('!emptydirs') +makedepends=('docbook2x' 'toluapp' 'perl-xml-libxml') +depends=('alsa-lib' 'libxml2' 'curl' 'wireless_tools' 'libxft' 'glib2' 'libxdamage' 'imlib2' 'lua' 'cairo') +provides=('conky=1.9.0') +conflicts=('conky') +backup=('etc/conky/conky.conf' 'etc/conky/conky_no_x11.conf') +source=("http://downloads.sourceforge.net/project/${_pkgname}/${_pkgname}/${pkgver}/${_pkgname}-${pkgver}.tar.gz") +sha1sums=('a8d26d002370c9b877ae77ad3a3bbd2566b38e5d') + +replaces=('torsmo') + +build() { + cd "${srcdir}/${_pkgname}-${pkgver}" + + CPPFLAGS="${CXXFLAGS}" LIBS="${LDFLAGS}" ./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --enable-ibm \ + --enable-curl \ + --enable-rss \ + --enable-weather-xoap \ + --enable-imlib2 \ + --enable-wlan \ + --enable-lua \ + --enable-lua-cairo \ + --enable-lua-imlib2 + + + make +} + +package() { + cd "${srcdir}/${_pkgname}-${pkgver}" + make DESTDIR="${pkgdir}" install + install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE" + install -Dm644 extras/vim/syntax/conkyrc.vim "${pkgdir}"/usr/share/vim/vimfiles/syntax/conkyrc.vim + install -Dm644 extras/vim/ftdetect/conkyrc.vim "${pkgdir}"/usr/share/vim/vimfiles/ftdetect/conkyrc.vim +} +sha1sums=('a8d26d002370c9b877ae77ad3a3bbd2566b38e5d') diff --git a/pcr/cw/PKGBUILD b/pcr/cw/PKGBUILD new file mode 100644 index 000000000..fb26acb4a --- /dev/null +++ b/pcr/cw/PKGBUILD @@ -0,0 +1,46 @@ +# Contributor: William DÃaz <wdiaz[at]archlinux[dot]us> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=cw +pkgver=1.0.16 +pkgrel=1 +pkgdesc="A non-intrusive ANSI color wrapper for common unix-based commands on GNU/linux." +url="http://sourceforge.net/projects/cwrapper/" +license=('GPL2') +arch=('i686' 'x86_64') +depends=() +makedepends=('patch') +install=cw.install +source=("http://cwrapper.sourceforge.net/${pkgname}-${pkgver}.tar.bz2" + "${pkgname}.patch") +md5sums=('142a1e9a25abbb01c3b90091d0bf68fd' + '5c54fab22fdb0601e6e4fb3fa87c435d') + +build() { + cd ${srcdir}/${pkgname}-${pkgver} + + install -d ${pkgdir}/usr/bin \ + ${pkgdir}/usr/share/man/man1 \ + ${pkgdir}/usr/share/doc/cw + + msg "Patching Files" + patch -Np1 -i ${srcdir}/${pkgname}.patch || return 1 + + ./configure --prefix=/usr || return 1 +} + +package() { + cd ${srcdir}/${pkgname}-${pkgver} + + make DESTDIR=${pkgdir} install || return 1 + + # Deleting the problematic files + rm -R ${pkgdir}/usr/lib/${pkgname}/{file,gcc,g++,stat,du} + + cp CHANGES CONTRIB INSTALL README PLATFORM \ + ${pkgdir}/usr/share/doc/cw + + ln -sf /usr/bin/cw ${pkgdir}/usr/bin/cwe +} +md5sums=('142a1e9a25abbb01c3b90091d0bf68fd' + '5c54fab22fdb0601e6e4fb3fa87c435d') diff --git a/pcr/cw/cw.install b/pcr/cw/cw.install new file mode 100644 index 000000000..bf0219bb7 --- /dev/null +++ b/pcr/cw/cw.install @@ -0,0 +1,26 @@ +post_install () { + echo -e "\033[32;1m==>\033[0m \033[1mUpdating definition files...\033[0m" + /usr/bin/cwu /usr/lib/cw /usr/bin/cw > /dev/null + + echo -e "" + echo -e "Complete, definitions are stored in: /usr/lib/cw" + echo -e "\033[1mFor bash:\033[0m place 'export PATH=\"/usr/lib/cw:\$PATH\"'" + echo -e "at the end of ~/.bash_profile(or /etc/profile globally)" + echo -e "" + echo -e "\033[1mFor tcsh:\033[0m place 'setenv PATH \"/usr/lib/cw:\$PATH\"'" + echo -e "at the end of ~/.login(or /etc/csh.login globally)" + echo -e "" + echo -e "\033[1mFor zsh:\033[0m place:" + echo -e "'export PATH=\"/usr/lib/cw:\$PATH\"'" + echo -e "at the end of ~/.zshrc(or /etc/zprofile globally)" + echo -e "" + echo -e "Or to automate the two lines above use the "colorcfg" command." + echo -e "(and add optional anti-coloring precautions)" + echo -e "Once the desired shell(s) are setup, use the "color" command," + echo -e "or the environmental variable NOCOLOR=1 to turn" + echo -e "color wrapping on and off." +} + +post_upgrade() { + post_install +} diff --git a/pcr/cw/cw.patch b/pcr/cw/cw.patch new file mode 100644 index 000000000..2158a0d30 --- /dev/null +++ b/pcr/cw/cw.patch @@ -0,0 +1,78 @@ +--- cw-1.0.16/Makefile.in 2007-09-25 11:10:20.000000000 -0600 ++++ cw-1.0.16/Makefile.in 2009-12-23 00:22:47.932698402 -0600 +@@ -8,7 +8,7 @@ CC=@CC@ + ECHO=echo + LN=ln + RM=rm +-MKDIR=mkdir ++MKDIR=mkdir -p + INSTALL=@INSTALL@ + + all: +@@ -56,32 +56,18 @@ installlocal: cleanlocal local + + install: cleanpub cw cwu + @$(ECHO) "* Installing color wrapper..." +- @for FILE in bin/*;do $(INSTALL) -o 0 -g 0 -m 755 $$FILE $(BINDIR);done +- @$(LN) -sf $(BINDIR)/cw $(BINDIR)/cwe ++ @for FILE in bin/*;do $(INSTALL) -m 755 $$FILE $(DESTDIR)$(BINDIR);done ++ @$(LN) -sf $(DESTDIR)$(BINDIR)/cw $(DESTDIR)$(BINDIR)/cwe + @$(ECHO) "* Installing color wrapper generic definition files..." +- @$(MKDIR) -m 755 $(LIBDIR)/cw/ +- @for FILE in def/*;do $(INSTALL) -o 0 -g 0 -m 755 $$FILE $(LIBDIR)/cw/;done ++ @$(MKDIR) -m 755 $(DESTDIR)$(LIBDIR)/cw/ ++ @for FILE in def/*;do $(INSTALL) -m 755 $$FILE $(DESTDIR)$(LIBDIR)/cw/;done + @$(ECHO) "* Installing color wrapper generic header/footer files..." +- @$(MKDIR) -m 755 $(LIBDIR)/cw/etc +- @for FILE in etc/*;do $(INSTALL) -o 0 -g 0 -m 644 $$FILE $(LIBDIR)/cw/etc;done ++ @$(MKDIR) -m 755 $(DESTDIR)$(LIBDIR)/cw/etc ++ @for FILE in etc/*;do $(INSTALL) -m 644 $$FILE $(DESTDIR)$(LIBDIR)/cw/etc;done + @$(ECHO) "* Installing manual pages..." +- @for FILE in man/*;do $(INSTALL) -o 0 -g 0 -m 644 $$FILE $(MANDIR)/man1/;done ++ @for FILE in man/*;do $(INSTALL) -m 644 $$FILE $(DESTDIR)$(MANDIR)/man1/;done + @$(ECHO) "* Updating definition files..." +- @$(BINDIR)/cwu $(LIBDIR)/cw $(BINDIR)/cw +- @$(ECHO) "-----------------------------------------------------------" +- @$(ECHO) "* Complete, definitions are stored in: $(LIBDIR)/cw" +- @$(ECHO) "* For bash: place 'export PATH=\"$(LIBDIR)/cw:\$$PATH\"'"\ +- "at the end of ~/.bash_profile(or /etc/profile globally)" +- @$(ECHO) "* For tcsh: place 'setenv PATH \"$(LIBDIR)/cw:\$$PATH\"'"\ +- "at the end of ~/.login(or /etc/csh.login globally)" +- @$(ECHO) "* Or to automate the two lines above use the"\ +- "\"colorcfg\" command. (and add optional anti-coloring precautions)" +- @$(ECHO) "* Once the desired shell(s) are setup, use the"\ +- "\"color\" command, or the environmental variable NOCOLOR=1 to turn"\ +- "color wrapping on and off." +- @$(ECHO) "" +- @$(ECHO) "* PLEASE view the ./README file for more information if"\ +- "you haven't already." ++ @$(DESTDIR)$(BINDIR)/cwu $(DESTDIR)$(LIBDIR)/cw $(DESTDIR)$(BINDIR)/cw + + clean: + @$(ECHO) "* Cleaning compiling content..." +@@ -94,9 +80,9 @@ cleanlocal: + + cleanpub: + @$(ECHO) "* Cleaning cw and cwu binaries, and definitions..." +- @$(RM) -rf $(BINDIR)/cw $(BINDIR)/cwu $(BINDIR)/cwe\ +- $(BINDIR)/cw.exe $(BINDIR)/cwu.exe $(BINDIR)/color $(BINDIR)/colorcfg\ +- $(LIBDIR)/cw $(MANDIR)/man1/cw.1.gz $(MANDIR)/man1/cwu.1.gz\ +- $(MANDIR)/man1/cwe.1.gz ++ @$(RM) -rf $(DESTDIR)$(BINDIR)/cw $(DESTDIR)$(BINDIR)/cwu $(DESTDIR)$(BINDIR)/cwe\ ++ $(DESTDIR)$(BINDIR)/cw.exe $(DESTDIR)$(BINDIR)/cwu.exe $(DESTDIR)$(BINDIR)/color $(DESTDIR)$(BINDIR)/colorcfg\ ++ $(DESTDIR)$(LIBDIR)/cw $(DESTDIR)$(MANDIR)/man1/cw.1.gz $(DESTDIR)$(MANDIR)/man1/cwu.1.gz\ ++ $(DESTDIR)$(MANDIR)/man1/cwe.1.gz + + cleanall: clean cleanlocal cleanpub + +--- cw-1.0.16/bin/colorcfg 2007-09-25 11:10:20.000000000 -0600 ++++ cw-1.0.16/bin/colorcfg 2009-12-23 00:29:05.105994275 -0600 +@@ -12,7 +12,7 @@ if test -x "${HOME}/.cw/bin/colorcfg";th + else + SED="`which sed 2>/dev/null`" + if test -z "$SED";then +- CWLIB="/usr/local/lib/cw" ++ CWLIB="/usr/lib/cw" + echo "(NOTE: using static cw library path, this could be invalid)" + else + CWLIB="`echo \"$0/lib/cw\"|sed \"s/\/bin\/colorcfg//g\"`" diff --git a/pcr/django-cms/PKGBUILD b/pcr/django-cms/PKGBUILD new file mode 100644 index 000000000..9a641b7fb --- /dev/null +++ b/pcr/django-cms/PKGBUILD @@ -0,0 +1,26 @@ +# Contributor: Baptiste Jonglez <baptiste--aur at jonglez dot org> +# Contributor: Fabio Volpe <volpefabio@gmail.com> +# Contributor: Apkawa <apkawa@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurélien Desbrières <aurelien@cwb.io> + +pkgname=django-cms +pkgver=2.2 +pkgrel=1 +pkgdesc="CMS framework based on Django" +arch=('any') +url="http://www.django-cms.org/" +license=('BSD') +depends=('python2' 'django' 'python-south' 'python-imaging' 'django-mptt' 'python2-html5lib' 'django-classy-tags' 'django-sekizai') +source=(http://pypi.python.org/packages/source/d/$pkgname/$pkgname-$pkgver.tar.gz) + +build() { + cd "$srcdir/$pkgname-$pkgver" + python2 setup.py build +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + python2 setup.py install --root="$pkgdir/" --install-data=/usr/share/$pkgname --optimize=1 + #install -D -m644 LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE +} + diff --git a/pcr/django-extensions/PKGBUILD b/pcr/django-extensions/PKGBUILD new file mode 100644 index 000000000..535091cfc --- /dev/null +++ b/pcr/django-extensions/PKGBUILD @@ -0,0 +1,39 @@ +# Contributor: Alper Kanat <alperkanat@raptiye.org> +# Contributor: Schnouki <thomas.jost@gmail.com> +# Maintainer : Parabola GNU / Linux-libre <aurelien@cwb.io> + +pkgname=django-extensions +pkgver=0.6 +pkgrel=1 +pkgdesc="Django Custom Management Command Extensions" +arch=('any') +url="http://github.com/django-extensions/django-extensions" +license=('BSD') +depends=('django' 'python2') +makedepends=('setuptools' 'git') +optdepends=('graphviz: to graph Django models' + 'python-werkzeug: to use the Werbzeug debugger in the embedded web server') +source=() + +_giturl=http://github.com/$pkgname/$pkgname.git + +build() { + cd $srcdir + + if [[ ! -d $srcdir/$pkgname ]]; then + # downloading the whole repository + git clone $_giturl + else + # updating the local repository + cd $srcdir/$pkgname + git pull + fi + + cd $srcdir/$pkgname + + # checking out to the tag (version) + git checkout -b $pkgver $pkgver + + python2 ./setup.py install --root=$pkgdir --prefix=/usr || return 1 +} + diff --git a/pcr/django-tagging/PKGBUILD b/pcr/django-tagging/PKGBUILD new file mode 100644 index 000000000..83f808280 --- /dev/null +++ b/pcr/django-tagging/PKGBUILD @@ -0,0 +1,20 @@ +# Contributor: Ryan Coyner <rcoyner@gmail.com> +# Contributor: James Pearson <james.m.pearson+arch@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurélien Desbrières <aurelien@cwb.io> + +pkgname=django-tagging +pkgver=0.3.1 +pkgrel=2 +pkgdesc="A generic tagging application for Django projects" +arch=('i686' 'x86_64') +url="http://code.google.com/p/django-tagging/" +license=('MIT') +depends=('python2') +source=(http://django-tagging.googlecode.com/files/django-tagging-$pkgver.tar.gz) + +build() { + cd $srcdir/django-tagging-$pkgver + python2 setup.py build || return 1 + python2 setup.py install --root=$pkgdir || return 1 + install -D -m644 LICENSE.txt $pkgdir/usr/share/licenses/$pkgname/LICENSE +} diff --git a/pcr/doxymacs/PKGBUILD b/pcr/doxymacs/PKGBUILD new file mode 100644 index 000000000..09a46a0ae --- /dev/null +++ b/pcr/doxymacs/PKGBUILD @@ -0,0 +1,26 @@ +# Contributor: Limao Luo <luolimao+AUR@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=doxymacs +pkgver=1.8.0 +pkgrel=2 +pkgdesc="Use Doxygen from within {X}Emacs" +arch=(i686 x86_64) +url=http://$pkgname.sourceforge.net +license=(GPL) +depends=('libxml2>=2.6.13') +install=$pkgname.install +source=(http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz) +sha256sums=('a23fd833bc3c21ee5387c62597610941e987f9d4372916f996bf6249cc495afa') +sha512sums=('7461a8a415aadf331f856e4f122712cbedc2907eff9e452f24e6ee83b96903d9944d2cfdbcfeab8a66144a0be508eae723c29f82a081df9723560b10c444f8ac') + +build() { + cd "$srcdir"/$pkgname-$pkgver/ + ./configure --prefix=/usr + make +} + +package() { + cd "$srcdir"/$pkgname-$pkgver/ + make DESTDIR="$pkgdir" install +} diff --git a/pcr/doxymacs/doxymacs.install b/pcr/doxymacs/doxymacs.install new file mode 100644 index 000000000..9d8366f45 --- /dev/null +++ b/pcr/doxymacs/doxymacs.install @@ -0,0 +1,19 @@ +post_install() { + cat <<__EOF__ +====> Put (require 'doxymacs) in your .emacs +====> Invoke doxymacs-mode with M-x doxymacs-mode. +====> To have doxymacs-mode invoked automatically when in C/C++ mode, put +(add-hook 'c-mode-common-hook 'doxymacs-mode) +====> in your .emacs. +====> If you want Doxygen keywords fontified use M-x doxymacs-font-lock. +====> To do it automatically in C and C++ modes, add the following to your .emacs: +(defun my-doxymacs-font-lock-hook () + (if (or (eq major-mode 'c-mode) (eq major-mode 'c++-mode)) + (doxymacs-font-lock))) +(add-hook 'font-lock-mode-hook 'my-doxymacs-font-lock-hook) +__EOF__ +} + +post_upgrade() { + post_install +} diff --git a/pcr/dswm/PKGBUILD b/pcr/dswm/PKGBUILD new file mode 100644 index 000000000..122e62b9a --- /dev/null +++ b/pcr/dswm/PKGBUILD @@ -0,0 +1,41 @@ +pkgname=dswm +pkgver=0.0.5r2 +pkgrel=5 +pkgdesc="Deep Space Window Manager - tiling window manager, oriented for good usability and good emacs integration (StumpWM-based)." +url="http://sourceforge.net/projects/dswm/" +arch=('x86_64' 'i686') +license=('GPLv2') +depends=('sbcl' 'clx-git' 'cl-ppcre') +optdepends=('emacs') +makedepends=('autoconf') +conflicts=() +replaces=() +backup=() +install='dswm.install' +options=(!strip) +source=("http://sourceforge.net/projects/${pkgname}/files/${pkgver}/${pkgname}-${pkgver}.tar.gz") +md5sums=('90f95f7ecfbf964f8ed5aa629959bc1f') + +build() { + mkdir -p "${pkgdir}"/usr/share/xsessions/ # patch for specific original makefile + cd $startdir/src/$pkgname-$pkgver + sed -i 's/\@prefix\@//g' dswm.lisp.in + autoconf + ./configure --prefix=/usr \ + --with-ppcre=/usr/share/common-lisp/source/cl-ppcre + +# this is necesary since the AUR packages do not modify the asdf's registry by default + _sbcl_bopt="sbcl_BUILDOPTS=--eval \"(require :asdf)\" \ +--eval \"(pushnew #p\\\"/usr/share/common-lisp/systems/\\\" asdf:*central-registry* :test #'equal)\" \ +--eval \"(asdf:operate 'asdf:load-op 'clx)\" \ +--load ./make-image.lisp" + _sbcl_iopt="sbcl_INFOOPTS=--eval \"(require 'asdf)\" \ +--eval \"(pushnew #p\\\"/usr/share/common-lisp/systems/\\\" asdf:*central-registry* :test #'equal)\" \ +--eval \"(asdf:operate 'asdf:load-op 'clx)\" \ +--eval \"(require 'dswm)\" \ +--load ./manual.lisp \ +--eval \"(progn (dswm::generate-manual) (sb-ext:quit))\"" + + make "$_sbcl_bopt" "$_sbcl_iopt" + make destdir="${pkgdir}" install +} diff --git a/pcr/dswm/dswm.install b/pcr/dswm/dswm.install new file mode 100644 index 000000000..0077d0018 --- /dev/null +++ b/pcr/dswm/dswm.install @@ -0,0 +1,21 @@ +infodir=usr/share/info +filelist=(dswm.info) + +post_install() { + [ -x usr/bin/install-info ] || return 0 + for file in ${filelist[@]}; do + install-info $infodir/$file.gz $infodir/dir 2> /dev/null + done +} + +post_upgrade() { + post_install $1 +} + +pre_remove() { + [ -x usr/bin/install-info ] || return 0 + for file in ${filelist[@]}; do + install-info --delete $infodir/$file.gz $infodir/dir 2> /dev/null + done +} + diff --git a/pcr/emacs-bzr/PKGBUILD b/pcr/emacs-bzr/PKGBUILD new file mode 100644 index 000000000..7383e3490 --- /dev/null +++ b/pcr/emacs-bzr/PKGBUILD @@ -0,0 +1,93 @@ +# Contributor: Neil Santos <nsantos16+aur@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +# Compile against Gtk+ 2.x, instead of the default 3.x +_opt_use_gtk2="n" +# Emacs is leaking like a sieve on my box with the default values; +# this should be the number of bytes Emacs should allocate for pure +# storage (see Elisp manual). Default as of writing this is 1.62 megs +# (not the final value; there are still calculations done on it). +_opt_puresize="2000000" + +pkgname=emacs-bzr +pkgver=110380 +pkgrel=1 +pkgdesc='The extensible, customizable, self-documenting real-time display editor from its official Bzr repository' +arch=('i686' 'x86_64') +url='http://www.gnu.org/software/emacs/' +license=('GPL3') +if [[ $_opt_use_gtk2 = "y" ]]; then + depends=('dbus-core' 'desktop-file-utils' 'libpng' 'libtiff' 'librsvg' 'giflib' 'gtk2' 'libxpm' 'libjpeg>=7' 'hicolor-icon-theme') +else + depends=('dbus-core' 'desktop-file-utils' 'libpng' 'libtiff' 'librsvg' 'giflib' 'gtk3' 'libxpm' 'libjpeg>=7' 'hicolor-icon-theme') +fi + +makedepends=('bzr' 'pkgconfig' 'texinfo') +provides=("emacs=$pkgver") +conflicts=('emacs' 'emacs-nox' 'emacs-otf' 'emacs-cvs' 'emacs-git') +install=$pkgname.install + +_bzrtrunk='http://bzr.savannah.gnu.org/r/emacs/trunk' +_bzrmod='emacs' + +build() { + cd $srcdir + msg "Connecting to Savannah..." + + if [[ -d $_bzrmod/.bzr ]]; then + (cd $_bzrmod && bzr update -v && cd ..) + msg "Local checkout updated or server timeout" + else + bzr co --lightweight -v $_bzrtrunk $_bzrmod + msg "Checkout done or server timeout" + fi + + cp -urT $_bzrmod/ ${_bzrmod}-build + cd ${_bzrmod}-build + msg "Adjusting BASE_PURESIZE to avoid possible leaks" + sed -i -e "s/\(define BASE_PURESIZE\s*(*\)[0-9]*/\1${_opt_puresize}/" src/puresize.h + + msg "Bootstrapping Emacs Lisp files..." + make bootstrap + + mandir=/usr/share/man + msg "Starting make..." + if [[ $_opt_use_gtk2 = "y" ]]; then + ./autogen.sh && ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --libexecdir=/usr/lib \ + --mandir=${mandir} \ + --without-sound \ + --with-xft \ + --with-x-toolkit=gtk2 + else + ./autogen.sh && ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --libexecdir=/usr/lib \ + --mandir=${mandir} \ + --without-sound \ + --with-xft \ + --with-x-toolkit=gtk3 + fi + make + make DESTDIR=${pkgdir} install + + msg "Cleaning up..." + mv $pkgdir/usr/bin/{ctags,ctags.emacs} + mv $pkgdir/usr/bin/{etags,etags.emacs} + mv $pkgdir${mandir}/man1/{etags.1,etags.emacs.1}.gz + mv $pkgdir${mandir}/man1/{ctags.1,ctags.emacs.1}.gz + + # This is mostly superfluous, and conflicts with texinfo + rm $pkgdir/usr/share/info/info.info.gz + rm $pkgdir/usr/share/info/dir + + find $pkgdir/usr/share/emacs -type d -exec chmod 755 {} \; + find $pkgdir/usr/share/emacs -exec chown root.root {} \; + chmod 775 $pkgdir/var/games + chmod 775 $pkgdir/var/games/emacs + chmod 664 $pkgdir/var/games/emacs/* + chown -R root:50 $pkgdir/var/games +} diff --git a/pcr/emacs-bzr/emacs-bzr.install b/pcr/emacs-bzr/emacs-bzr.install new file mode 100644 index 000000000..35d11bd56 --- /dev/null +++ b/pcr/emacs-bzr/emacs-bzr.install @@ -0,0 +1,32 @@ +ICON_PATH=/usr/share/icons/hicolor +INFO_DIR=/usr/share/info + +INFO_FILES=(ada-mode auth autotype calc ccmode cl dbus dired-x ebrowse +ede ediff edt efaq eieio eintr elisp emacs emacs-mime epa erc ert eshell +eudc flymake forms gnus idlwave mairix-el message mh-e newsticker +nxml-mode org pcl-cvs pgg rcirc reftex remember sasl sc semantic ses +sieve smtpmail speedbar tramp url vip viper widget woman) + +post_install() { + gtk-update-icon-cache -q -t -f ${ICON_PATH} + update-desktop-database -q + + [[ -x /usr/bin/install-info ]] || return 0 + for f in ${INFO_FILES[@]}; do + install-info ${INFO_DIR}/$f.info.gz ${INFO_DIR}/dir 2> /dev/null + done +} + +post_upgrade() { + post_install $1 +} + +pre_remove() { + gtk-update-icon-cache -q -t -f ${ICON_PATH} + update-desktop-database -q + + [[ -x /usr/bin/install-info ]] || return 0 + for f in ${INFO_FILES[@]}; do + install-info --delete ${INFO_DIR}/$f.info.gz ${INFO_DIR}/dir 2> /dev/null + done +} diff --git a/pcr/emacs-color-theme/PKGBUILD b/pcr/emacs-color-theme/PKGBUILD new file mode 100644 index 000000000..53ad1bf24 --- /dev/null +++ b/pcr/emacs-color-theme/PKGBUILD @@ -0,0 +1,48 @@ +# $Id: PKGBUILD 59903 2011-12-02 11:18:13Z andrea $ +# Contributor: Stefan Husmann <stefan-husmann@t-online.de> +# Contributor: Cesar Romero <cesar.romero@gmail.com> +# Maintainer : Parabola GNU / Linux-libre <aurelien@cwb.io> + +pkgname=emacs-color-theme +pkgver=6.6.0 +pkgrel=8 +arch=('any') +pkgdesc="Emacs color themes" +url="https://gna.org/projects/color-theme" +license=('GPL2') +depends=('emacs' 'xorg-fonts-100dpi') +makedepends=('emacs') +provides=('color-theme') +replaces=('color-theme') +install=$pkgname.install +source=(http://download.savannah.gnu.org/releases/color-theme/color-theme-$pkgver.tar.gz + 'gnus-bug.diff' + 'fix-build.patch') +md5sums=('a4de73c236a6af11ab378bfe18dabcca' + '8b7ee1c4c6f80606f22c3de448ec92e8' + '25b92ea246716689502ebe050322a60a') + +build() { + cd $srcdir/color-theme-$pkgver + + patch -p1 -i $srcdir/gnus-bug.diff + patch -p0 -i $srcdir/fix-build.patch + + make +} + +package() { + cd $srcdir/color-theme-$pkgver + install -Dm644 color-theme.el \ + $pkgdir/usr/share/emacs/site-lisp/color-theme.el + install -Dm644 themes/color-theme-library.el \ + $pkgdir/usr/share/emacs/site-lisp/themes/color-theme-library.el + install -Dm644 themes/color-theme-example.el \ + $pkgdir/usr/share/emacs/site-lisp/themes/color-theme-example.el + install -Dm644 color-theme.elc \ + $pkgdir/usr/share/emacs/site-lisp/color-theme.elc + install -Dm644 themes/color-theme-library.elc \ + $pkgdir/usr/share/emacs/site-lisp/themes/color-theme-library.elc + install -Dm644 themes/color-theme-example.elc \ + $pkgdir/usr/share/emacs/site-lisp/themes/color-theme-example.elc +} diff --git a/pcr/emacs-color-theme/emacs-color-theme.install b/pcr/emacs-color-theme/emacs-color-theme.install new file mode 100644 index 000000000..b1de09f76 --- /dev/null +++ b/pcr/emacs-color-theme/emacs-color-theme.install @@ -0,0 +1,9 @@ +# arg 1: the new package version +post_install() { +echo "# To start using color-theme add this to your .emacs:" +echo "# (require 'color-theme)" +} + +post_upgrade() { + post_install +}
\ No newline at end of file diff --git a/pcr/emacs-color-theme/fix-build.patch b/pcr/emacs-color-theme/fix-build.patch new file mode 100644 index 000000000..cadb1ae05 --- /dev/null +++ b/pcr/emacs-color-theme/fix-build.patch @@ -0,0 +1,19 @@ +--- Makefile.orig 2009-05-15 18:22:49.000000000 +0200 ++++ Makefile 2009-05-16 08:59:36.000000000 +0200 +@@ -15,6 +15,7 @@ + TARGET = $(patsubst %.el,%.elc,$(SPECIAL) $(SOURCE)) + MANUAL = color-theme + MISC = AUTHORS COPYING ChangeLog Makefile.defs Makefile $(AUTOLOADFILE).in ++LOADPATH = "$(shell pwd)" "$(shell pwd)/themes" + #AUTHORS CREDITS HISTORY NEWS README Makefile ChangeLog \ + #ChangeLog.2005 ChangeLog.2004 ChangeLog.2003 ChangeLog.2002 \ + #ChangeLog.2001 servers.pl color-theme-auto.in color-theme.texi +@@ -47,7 +48,7 @@ + + %.elc: %.el + @$(EMACS) $(OPTIONCOMPILE) \ +- --eval '(setq load-path (cons "." load-path))' \ ++ --eval '(setq load-path (append load-path (list $(LOADPATH))))' \ + -f batch-byte-compile $< + + %.info: %.texi diff --git a/pcr/emacs-color-theme/gnus-bug.diff b/pcr/emacs-color-theme/gnus-bug.diff new file mode 100644 index 000000000..9d227df56 --- /dev/null +++ b/pcr/emacs-color-theme/gnus-bug.diff @@ -0,0 +1,28 @@ +diff -Naur color-theme-6.6.0.orig/color-theme.el color-theme-6.6.0.new/color-theme.el +--- color-theme-6.6.0.orig/color-theme.el 2011-11-18 01:17:29.000000000 +0100 ++++ color-theme-6.6.0.new/color-theme.el 2011-11-18 01:24:07.000000000 +0100 +@@ -73,9 +73,10 @@ + "Non-nil if running XEmacs.") + + ;; Add this since it appears to miss in emacs-2x +-(or (fboundp 'replace-in-string) +- (defun replace-in-string (target old new) +- (replace-regexp-in-string old new target))) ++(if (fboundp 'replace-in-string) ++ (defalias 'color-theme-replace-in-string 'replace-in-string) ++ (defsubst color-theme-replace-in-string (target old new &optional literal) ++ (replace-regexp-in-string old new target nil literal))) + + ;; face-attr-construct has a problem in Emacs 20.7 and older when + ;; dealing with inverse-video faces. Here is a short test to check +@@ -1626,8 +1627,8 @@ + (add-to-list 'color-themes + (list ',n + (upcase-initials +- (replace-in-string +- (replace-in-string ++ (color-theme-replace-in-string ++ (color-theme-replace-in-string + (symbol-name ',n) "^color-theme-" "") "-" " ")) + ,author)) + (defun ,n () diff --git a/pcr/emacs-elib/PKGBUILD b/pcr/emacs-elib/PKGBUILD new file mode 100644 index 000000000..22946859e --- /dev/null +++ b/pcr/emacs-elib/PKGBUILD @@ -0,0 +1,51 @@ +# PKGBUILD for Emacs Lisp Library (elib) +# Contributor: J. Bromley <jbromley@gmail.com> +# $Id: PKGBUILD,v e6d455730f95 2009/12/03 05:38:28 jbromley $ +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=emacs-elib +_pkgname=elib +pkgver=1.0 +pkgrel=3 +pkgdesc="The Emacs Lisp library" +arch=('i686' 'x86_64') +url="http://jdee.sourceforge.net/" +license="GPL" +depends=('emacs') +makedepends=('texinfo' 'gzip') +conflicts=() +replaces=() +backup=() +install="$pkgname.install" +source=(http://downloads.sourceforge.net/project/jdee/jdee/Dependencies/elib.tar.gz) +md5sums=('4feb380f2e3b12eb5500dfe6714e349d') + +build() { +mv $startdir/src/pub/comp/os/unix/gnu/elib/$_pkgname-$pkgver.tar.gz $startdir/src +cd $startdir/src/ +tar -xzf $_pkgname-$pkgver.tar.gz +cd $startdir/src/$_pkgname-$pkgver + +# Fix up paths and old --infodir flag. +sed -i 's!/usr/local!/usr!' Makefile +sed -i 's!/info!/share/info!' Makefile +sed -i 's!--infodir!--info-dir!g' Makefile + +# Patch to get rid of deprecated code. +patch -p1 < $startdir/elib-deprecation.patch + +# Create directories for installation +mkdir -p $startdir/pkg/usr/share/info +mkdir -p $startdir/pkg/usr/share/emacs/site-lisp +make || return 1 + +# Install the compile package and gzip info file. +make prefix=$startdir/pkg/usr install +find $startdir/pkg -name dir -exec rm '{}' \; +mv $startdir/pkg/usr/share/info/elib.info $startdir/pkg/usr/share/info/elib +gzip $startdir/pkg/usr/share/info/elib +} + +# Local Variables: +# mode: shell-script +# End: diff --git a/pcr/emacs-elib/elib-deprecation.patch b/pcr/emacs-elib/elib-deprecation.patch new file mode 100644 index 000000000..ce8aedb6f --- /dev/null +++ b/pcr/emacs-elib/elib-deprecation.patch @@ -0,0 +1,461 @@ +diff -ub elib-1.0.orig/avltree.el elib-1.0/avltree.el +--- elib-1.0.orig/avltree.el 1995-12-10 16:50:53.000000000 -0800 ++++ elib-1.0/avltree.el 2008-06-22 15:31:48.000000000 -0700 +@@ -69,19 +69,19 @@ + (defmacro elib-avl-node-create (left right data balance) + + ;; Create and return an avl-tree node. +- (` (vector (, left) (, right) (, data) (, balance)))) ++ `(vector ,left ,right ,data ,balance)) + + + (defmacro elib-avl-node-balance (node) + + ;; Return the balance field of a node. +- (` (aref (, node) 3))) ++ `(aref ,node 3)) + + + (defmacro elib-avl-node-set-balance (node newbal) + + ;; Set the balance field of a node. +- (` (aset (, node) 3 (, newbal)))) ++ `(aset ,node 3 ,newbal)) + + + +@@ -96,20 +96,20 @@ + (defmacro elib-avl-root (tree) + + ;; Return the root node for an avl-tree. INTERNAL USE ONLY. +- (` (elib-node-left (car (cdr (, tree)))))) ++ `(elib-node-left (car (cdr ,tree)))) + + + (defmacro elib-avl-dummyroot (tree) + + ;; Return the dummy node of an avl-tree. INTERNAL USE ONLY. + +- (` (car (cdr (, tree))))) ++ `(car (cdr ,tree))) + + + (defmacro elib-avl-cmpfun (tree) + + ;; Return the compare function of AVL tree TREE. INTERNAL USE ONLY. +- (` (cdr (cdr (, tree))))) ++ `(cdr (cdr ,tree))) + + + ;; ---------------------------------------------------------------- +@@ -412,20 +412,20 @@ + ;; INTERNAL USE ONLY. + + (let ((node root) +- (stack (elib-stack-create)) ++ (stack (stack-create)) + (go-left t)) +- (elib-stack-push stack nil) ++ (stack-push stack nil) + (while node + (if (and go-left + (elib-node-left node)) + (progn ; Do the left subtree first. +- (elib-stack-push stack node) ++ (stack-push stack node) + (setq node (elib-node-left node))) + (funcall map-function node) ; Apply the function... + (if (elib-node-right node) ; and do the right subtree. + (setq node (elib-node-right node) + go-left t) +- (setq node (elib-stack-pop stack) ++ (setq node (stack-pop stack) + go-left nil)))))) + + +diff -ub elib-1.0.orig/bintree.el elib-1.0/bintree.el +--- elib-1.0.orig/bintree.el 1995-12-10 16:50:53.000000000 -0800 ++++ elib-1.0/bintree.el 2008-06-22 15:28:45.000000000 -0700 +@@ -64,19 +64,19 @@ + (defmacro elib-bintree-root (tree) + + ;; Return the root node for a binary tree. INTERNAL USE ONLY. +- (` (elib-node-left (car (cdr (, tree)))))) ++ `(elib-node-left (car (cdr ,tree)))) + + + (defmacro elib-bintree-dummyroot (tree) + + ;; Return the dummy node of a binary tree. INTERNAL USE ONLY. +- (` (car (cdr (, tree))))) ++ `(car (cdr ,tree))) + + + (defmacro elib-bintree-cmpfun (tree) + + ;; Return the compare function of binary tree TREE. INTERNAL USE ONLY." +- (` (cdr (cdr (, tree))))) ++ `(cdr (cdr ,tree))) + + + +@@ -90,20 +90,20 @@ + ;; INTERNAL USE ONLY." + + (let ((node root) +- (stack (elib-stack-create)) ++ (stack (stack-create)) + (go-left t)) +- (elib-stack-push stack nil) ++ (stack-push stack nil) + (while node + (if (and go-left + (elib-node-left node)) + (progn ; Do the left subtree first. +- (elib-stack-push stack node) ++ (stack-push stack node) + (setq node (elib-node-left node))) + (funcall map-function node) ; Apply the function... + (if (elib-node-right node) ; and do the right subtree. + (setq node (elib-node-right node) + go-left t) +- (setq node (elib-stack-pop stack) ++ (setq node (stack-pop stack) + go-left nil)))))) + + +diff -ub elib-1.0.orig/cookie.el elib-1.0/cookie.el +--- elib-1.0.orig/cookie.el 1995-12-10 16:50:54.000000000 -0800 ++++ elib-1.0/cookie.el 2008-06-22 15:38:55.000000000 -0700 +@@ -139,13 +139,13 @@ + + (let ((old-buffer (make-symbol "old-buffer")) + (hnd (make-symbol "collection"))) +- (` (let* (((, old-buffer) (current-buffer)) +- ((, hnd) (, collection)) +- (dll (elib-collection->dll (, hnd)))) +- (set-buffer (elib-collection->buffer (, hnd))) ++ `(let* ((,old-buffer (current-buffer)) ++ (,hnd ,collection) ++ (dll (elib-collection->dll ,hnd))) ++ (set-buffer (elib-collection->buffer ,hnd)) + (unwind-protect +- (progn (,@ forms)) +- (set-buffer (, old-buffer))))))) ++ (progn ,@forms) ++ (set-buffer ,old-buffer))))) + + + (put 'elib-set-buffer-bind-dll-let* 'lisp-indent-hook 2) +@@ -160,14 +160,14 @@ + + (let ((old-buffer (make-symbol "old-buffer")) + (hnd (make-symbol "collection"))) +- (` (let* (((, old-buffer) (current-buffer)) +- ((, hnd) (, collection)) +- (dll (elib-collection->dll (, hnd))) +- (,@ varlist)) +- (set-buffer (elib-collection->buffer (, hnd))) ++ `(let* ((,old-buffer (current-buffer)) ++ (,hnd ,collection) ++ (dll (elib-collection->dll ,hnd)) ++ ,@varlist) ++ (set-buffer (elib-collection->buffer ,hnd)) + (unwind-protect +- (progn (,@ forms)) +- (set-buffer (, old-buffer))))))) ++ (progn ,@forms) ++ (set-buffer ,old-buffer))))) + + + (defmacro elib-filter-hf (collection tin) +@@ -179,12 +179,12 @@ + + (let ((tempvar (make-symbol "tin")) + (tmpcoll (make-symbol "tmpcollection"))) +- (` (let (((, tempvar) (, tin)) +- ((, tmpcoll) (, collection))) +- (if (or (eq (, tempvar) (elib-collection->header (, tmpcoll))) +- (eq (, tempvar) (elib-collection->footer (, tmpcoll)))) ++ `(let ((,tempvar ,tin) ++ (,tmpcoll ,collection)) ++ (if (or (eq ,tempvar (elib-collection->header ,tmpcoll)) ++ (eq ,tempvar (elib-collection->footer ,tmpcoll))) + nil +- (, tempvar)))))) ++ ,tempvar)))) + + + +diff -ub elib-1.0.orig/dll-debug.el elib-1.0/dll-debug.el +--- elib-1.0.orig/dll-debug.el 1995-12-10 16:50:54.000000000 -0800 ++++ elib-1.0/dll-debug.el 2008-06-22 15:25:14.000000000 -0700 +@@ -74,9 +74,9 @@ + (defmacro dll-insert-after (node element) + (let ((node-v (make-symbol "node")) + (element-v (make-symbol "element"))) +- (` (let (((, node-v) (, node)) +- ((, element-v) (, element))) +- (setcdr (, node-v) (cons (, element-v) (cdr (, node-v)))))))) ++ `(let ((,node-v ,node) ++ (,element-v ,element)) ++ (setcdr ,node-v (cons ,element-v (cdr ,node-v)))))) + + ;;; =================================================================== + ;;; The public functions which operate on doubly linked lists. +@@ -86,7 +86,7 @@ + "Get the element of a NODE in a doubly linked list DLL. + Args: DLL NODE." + +- (` (car (, node)))) ++ `(car ,node)) + + + (defun dll-create () +diff -ub elib-1.0.orig/dll.el elib-1.0/dll.el +--- elib-1.0.orig/dll.el 1995-12-10 16:50:54.000000000 -0800 ++++ elib-1.0/dll.el 2008-06-22 15:22:58.000000000 -0700 +@@ -89,7 +89,7 @@ + "Get the element of a NODE in a doubly linked list DLL. + Args: DLL NODE." + +- (` (elib-node-data (, node)))) ++ `(elib-node-data ,node)) + + + (defun dll-create () +diff -ub elib-1.0.orig/elib-node.el elib-1.0/elib-node.el +--- elib-1.0.orig/elib-node.el 1995-12-10 16:50:53.000000000 -0800 ++++ elib-1.0/elib-node.el 2008-06-22 15:21:46.000000000 -0700 +@@ -49,42 +49,42 @@ + (defmacro elib-node-create (left right data) + + ;; Create a tree node from LEFT, RIGHT and DATA. +- (` (vector (, left) (, right) (, data)))) ++ `(vector ,left ,right ,data)) + + + (defmacro elib-node-left (node) + + ;; Return the left pointer of NODE. +- (` (aref (, node) 0))) ++ `(aref ,node 0)) + + + (defmacro elib-node-right (node) + + ;; Return the right pointer of NODE. +- (` (aref (, node) 1))) ++ `(aref ,node 1)) + + + (defmacro elib-node-data (node) + + ;; Return the data of NODE. +- (` (aref (, node) 2))) ++ `(aref ,node 2)) + + + (defmacro elib-node-set-left (node newleft) + + ;; Set the left pointer of NODE to NEWLEFT. +- (` (aset (, node) 0 (, newleft)))) ++ `(aset ,node 0 ,newleft)) + + + (defmacro elib-node-set-right (node newright) + + ;; Set the right pointer of NODE to NEWRIGHT. +- (` (aset (, node) 1 (, newright)))) ++ `(aset ,node 1 ,newright)) + + + (defmacro elib-node-set-data (node newdata) + ;; Set the data of NODE to NEWDATA. +- (` (aset (, node) 2 (, newdata)))) ++ `(aset ,node 2 ,newdata)) + + + +@@ -94,7 +94,7 @@ + ;; + ;; NODE is the node, and BRANCH is the branch. + ;; 0 for left pointer, 1 for right pointer and 2 for the data." +- (` (aref (, node) (, branch)))) ++ `(aref ,node ,branch)) + + + (defmacro elib-node-set-branch (node branch newval) +@@ -104,6 +104,6 @@ + ;; NODE is the node, and BRANCH is the branch. + ;; 0 for left pointer, 1 for the right pointer and 2 for the data. + ;; NEWVAL is new value of the branch." +- (` (aset (, node) (, branch) (, newval)))) ++ `(aset ,node ,branch ,newval)) + + ;;; elib-node.el ends here. +Only in elib-1.0: elib.info +diff -ub elib-1.0.orig/queue-m.el elib-1.0/queue-m.el +--- elib-1.0.orig/queue-m.el 1995-12-10 16:50:53.000000000 -0800 ++++ elib-1.0/queue-m.el 2008-06-22 15:13:41.000000000 -0700 +@@ -54,12 +54,12 @@ + + (defmacro queue-create () + "Create an empty fifo queue." +- (` (cons 'QUEUE (cons nil nil)))) ++ `(cons 'QUEUE (cons nil nil))) + + + (defmacro queue-p (queue) + "Return t if QUEUE is a queue, otherwise return nil." +- (` (eq (car-safe (, queue)) 'QUEUE))) ++ `(eq (car-safe ,queue) 'QUEUE)) + + + (defun queue-enqueue (queue element) +@@ -91,13 +91,13 @@ + + (defmacro queue-empty (queue) + "Return t if QUEUE is empty, otherwise return nil." +- (` (null (car (cdr (, queue)))))) ++ `(null (car (cdr ,queue)))) + + + (defmacro queue-first (queue) + "Return the first element of QUEUE or nil if it is empty. + The element is not removed." +- (` (car-safe (car (cdr (, queue)))))) ++ `(car-safe (car (cdr ,queue)))) + + + (defmacro queue-nth (queue n) +@@ -106,18 +106,18 @@ + If the length of the queue is less than N, return nil. + + The oldest element (the first one) has number 0." +- (` (nth (, n) (car (cdr (, queue)))))) ++ `(nth ,n (car (cdr ,queue)))) + + + (defmacro queue-last (queue) + "Return the last element of QUEUE or nil if it is empty." +- (` (car-safe (cdr (cdr (, queue)))))) ++ `(car-safe (cdr (cdr ,queue)))) + + + (defmacro queue-all (queue) + "Return a list of all elements of QUEUE or nil if it is empty. + The oldest element in the queue is the first in the list." +- (` (car (cdr (, queue))))) ++ `(car (cdr ,queue))) + + + (defun queue-copy (queue) +@@ -131,11 +131,11 @@ + + (defmacro queue-length (queue) + "Return the number of elements in QUEUE." +- (` (length (car (cdr (, queue)))))) ++ `(length (car (cdr ,queue)))) + + + (defmacro queue-clear (queue) + "Remove all elements from QUEUE." +- (` (setcdr (, queue) (cons nil nil)))) ++ `(setcdr ,queue (cons nil nil))) + + ;;; queue-m.el ends here +diff -ub elib-1.0.orig/read.el elib-1.0/read.el +--- elib-1.0.orig/read.el 1995-12-10 16:50:54.000000000 -0800 ++++ elib-1.0/read.el 2008-06-22 15:40:38.000000000 -0700 +@@ -61,7 +61,7 @@ + numdefault) + (setq number numdefault)) + ((string-match "\\`[0-9]+\\'" numstr) +- (setq number (string-to-int numstr))) ++ (setq number (string-to-number numstr))) + (t (beep)))) + number)) + +diff -ub elib-1.0.orig/stack-m.el elib-1.0/stack-m.el +--- elib-1.0.orig/stack-m.el 1995-12-10 16:50:52.000000000 -0800 ++++ elib-1.0/stack-m.el 2008-06-22 15:10:48.000000000 -0700 +@@ -51,36 +51,36 @@ + + (defmacro stack-create () + "Create an empty lifo stack." +- (` (cons 'STACK nil))) ++ `(cons 'STACK nil)) + + + (defmacro stack-p (stack) + "Return t if STACK is a stack, otherwise return nil." +- (` (eq (car-safe (, stack)) 'STACK))) ++ `(eq (car-safe ,stack) 'STACK)) + + + (defmacro stack-push (stack element) + "Push an element onto the stack. + Args: STACK ELEMENT" +- (` (setcdr (, stack) (cons (, element) (cdr (, stack)))))) ++ `(setcdr ,stack (cons ,element (cdr ,stack)))) + + + (defmacro stack-pop (stack) + "Remove the topmost element from STACK and return it. + If the stack is empty, return nil." +- (` (prog1 +- (car-safe (cdr (, stack))) +- (setcdr (, stack) (cdr-safe (cdr (, stack))))))) ++ `(prog1 ++ (car-safe (cdr ,stack)) ++ (setcdr ,stack (cdr-safe (cdr ,stack))))) + + + (defmacro stack-empty (stack) + "Return t if STACK is empty, otherwise return nil." +- (` (null (cdr (, stack))))) ++ `(null (cdr ,stack))) + + + (defmacro stack-top (stack) + "Return the topmost element of STACK or nil if it is empty." +- (` (car-safe (cdr (, stack))))) ++ `(car-safe (cdr ,stack))) + + + (defmacro stack-nth (stack n) +@@ -89,28 +89,28 @@ + If the length of the stack is less than N, return nil. + + The top stack element has number 0." +- (` (nth (, n) (cdr (, stack))))) ++ `(nth ,n (cdr ,stack))) + + + (defmacro stack-all (stack) + "Return a list of all entries in STACK. + The element last pushed is first in the list." +- (` (cdr (, stack)))) ++ `(cdr ,stack)) + + + (defmacro stack-copy (stack) + "Return a copy of STACK. + All entries in STACK are also copied." +- (` (cons 'STACK (copy-sequence (cdr (, stack)))))) ++ `(cons 'STACK (copy-sequence (cdr ,stack)))) + + + (defmacro stack-length (stack) + "Return the number of elements on STACK." +- (` (length (cdr (, stack))))) ++ `(length (cdr ,stack))) + + + (defmacro stack-clear (stack) + "Remove all elements from STACK." +- (` (setcdr (, stack) nil))) ++ `(setcdr ,stack nil)) + + ;;; stack-m.el ends here diff --git a/pcr/emacs-elib/emacs-elib.install b/pcr/emacs-elib/emacs-elib.install new file mode 100644 index 000000000..53a01f9f6 --- /dev/null +++ b/pcr/emacs-elib/emacs-elib.install @@ -0,0 +1,34 @@ +# emacs-elib.install +# Install info file and show configuration info. +# $Id: emacs-elib.install,v e6d455730f95 2008/06/23 05:55:28 jbromley $ +post_install () { +if sh -c 'install-info --version' > /dev/nul 2>&1; then + if [ -f /usr/share/info/elib.gz ]; then + cd /usr/share/info + install-info --info-dir=/usr/share/info --section=Emacs --name=Elib \ + --description=' The Emacs Lisp Library' elib.gz + fi +fi + +echo "" +echo "==> To use elib, add the following Lisp to your ~/.emacs file:" +echo "==> " +echo "==> (setq load-path (append (list \"/usr/share/emacs/site-lisp/elib\")" +echo "==> load-path))" +echo "==> " +echo "==> You do not need this if you have a subdirs.el in your Emacs site-lisp" +echo "==> directory." +echo "" +} + +post_upgrade () { + post_install $1 +} + +op=$1 +shift +$op $* + +# Local Variables: +# mode: shell-script +# End: diff --git a/pcr/emacs-jabber/PKGBUILD b/pcr/emacs-jabber/PKGBUILD new file mode 100644 index 000000000..0b2170261 --- /dev/null +++ b/pcr/emacs-jabber/PKGBUILD @@ -0,0 +1,26 @@ +# Contributor: Stefan Husmann <stefan-husmann@t-online.de> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=emacs-jabber +pkgver=0.8.91 +pkgrel=2 +pkgdesc="Jabber.el: a minimal jabber client for emacs" +url=http://emacs-jabber.sourceforge.net +arch=('any') +license=('GPL') +depends=('emacs' 'gnutls' 'gconf') +install=jabber.el.install +source=(http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.lzma) +md5sums=('739506fbc498386989590cd7733dd47a') + +build() { + cd $srcdir/$pkgname-$pkgver + ./configure --prefix=/usr --sysconfdir=/etc \ + --libexecdir=/usr/lib/emacs-jabber \ + --with-gconf-schema-file-dir=/usr/share/gconf/schemas + make +} +package() { + cd $srcdir/$pkgname-$pkgver + make GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 DESTDIR=$pkgdir install +} diff --git a/pcr/emacs-jabber/jabber.el.install b/pcr/emacs-jabber/jabber.el.install new file mode 100644 index 000000000..556888995 --- /dev/null +++ b/pcr/emacs-jabber/jabber.el.install @@ -0,0 +1,27 @@ +infodir=/usr/share/info +filelist=(jabber.info.gz) +pkgname=emacs-jabber + +pre_upgrade() { + /usr/sbin/gconfpkg --uninstall $pkgname +} + +post_install() { + /usr/sbin/gconfpkg --install $pkgname + for file in ${filelist[@]}; do + install-info $infodir/$file $infodir/dir 2> /dev/null + done + echo "Please add the following line to your .emacs." + echo "(require 'jabber)" +} + +post_upgrade() { + post_install +} + +pre_remove() { + /usr/sbin/gconfpkg --uninstall $pkgname + for file in ${filelist[@]}; do + install-info --delete $infodir/$file $infodir/dir 2> /dev/null + done +} diff --git a/pcr/emacs-js2-mode/PKGBUILD b/pcr/emacs-js2-mode/PKGBUILD new file mode 100644 index 000000000..7a73d3f40 --- /dev/null +++ b/pcr/emacs-js2-mode/PKGBUILD @@ -0,0 +1,20 @@ +# Contributor: Hauke Wesselmann <hauke@h-dawg.de> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=emacs-js2-mode +pkgver=20090723b +pkgrel=1 +pkgdesc="An improved JavaScript mode for GNU Emacs" +arch=('i686' 'x86_64') +url="http://code.google.com/p/js2-mode/" +license=('GPL2') +depends=('emacs') +source=(http://js2-mode.googlecode.com/files/js2-$pkgver.el) +md5sums=('9109dca8b624edb8358fb9938a03d785') + +build() { + cd $startdir/src/ + emacs -batch -q -f batch-byte-compile js2-$pkgver.el + install -Dm644 $srcdir/js2-$pkgver.el $pkgdir/usr/share/emacs/site-lisp/js2.el + install -Dm644 $srcdir/js2-$pkgver.elc $pkgdir/usr/share/emacs/site-lisp/js2.elc +} diff --git a/pcr/emacs-magit-git/PKGBUILD b/pcr/emacs-magit-git/PKGBUILD new file mode 100644 index 000000000..734b13072 --- /dev/null +++ b/pcr/emacs-magit-git/PKGBUILD @@ -0,0 +1,45 @@ +# Contributor: Stefan Husmann <stefan.husmann@t-online.de> +# Contributor: Peter Simons <simons@cryp.to> +# Contributor: Just Lest <just.lest@gmail.com> +# Contributor: Daniel White <daniel@whitehouse.id.au> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=emacs-magit-git +pkgver=20121104 +pkgrel=1 +pkgdesc="It's Magit! A Emacs mode for Git." +arch=("any") +url="http://github.com/magit/magit" +license=('GPL3') +depends=('emacs' 'git') +makedepends=('automake' 'autoconf') +provides=('emacs-magit') +conflicts=('emacs-magit') +install="${pkgname}.install" + +_gitname="master" +_gitroot="git://github.com/magit/magit.git" + +build() +{ + cd "${srcdir}" + if [ -d magit ] ; then + cd magit + git pull origin + else + git clone --depth=1 "${_gitroot}" + fi + [ -d "${srcdir}/build" ] && rm -rf "${srcdir}/build" + cp -r "${srcdir}/magit" "${srcdir}/build" + cd "${srcdir}/build" + make +} + +package() +{ + cd "${srcdir}/build" + mkdir -p "${pkgdir}/usr/bin" # work around a bug in the makefile + make PREFIX="/usr" DESTDIR="${pkgdir}" install install_contrib + rm "${pkgdir}/etc/emacs/site-start.d/50magit.el" "${pkgdir}/usr/share/info/dir" + rmdir "${pkgdir}/etc/emacs/site-start.d" "${pkgdir}/etc/emacs" "${pkgdir}/etc" +} diff --git a/pcr/emacs-magit-git/emacs-magit-git.install b/pcr/emacs-magit-git/emacs-magit-git.install new file mode 100644 index 000000000..a9904739e --- /dev/null +++ b/pcr/emacs-magit-git/emacs-magit-git.install @@ -0,0 +1,30 @@ +infodir=/usr/share/info +filelist=(magit.info) + +post_install() { + [ -x usr/bin/install-info ] || return 0 + for file in ${filelist[@]}; do + install-info $infodir/$file $infodir/dir 2> /dev/null + done + + cat << EOF +==> In order to use magit, add the following lines to your ~/.emacs file: + +(autoload 'magit-status "magit" nil t) +EOF +} + +post_upgrade() { + post_install $1 +} + +pre_remove() { + [ -x usr/bin/install-info ] || return 0 + for file in ${filelist[@]}; do + install-info --delete $infodir/$file $infodir/dir 2> /dev/null + done +} + +op=$1 +shift +$op $* diff --git a/pcr/emacs-org-mode-ravel-git/PKGBUILD b/pcr/emacs-org-mode-ravel-git/PKGBUILD new file mode 100644 index 000000000..66baa08b5 --- /dev/null +++ b/pcr/emacs-org-mode-ravel-git/PKGBUILD @@ -0,0 +1,52 @@ +# contributor: zhuqin <zhuqin83@gmail.com> +# Maintainer: Stefan Husmann <stefan-husmann@t-online.de> +# Maintainer : Parabola GNU / Linux-libre <aurelien@cwb.io> + +pkgname=emacs-org-mode-ravel-git +pkgver=20120812 +pkgrel=1 +pkgdesc="R backends for Orgmode by Chas Berry" +arch=('any') +url="https://github.com/chasberry/orgmode-accessories" +depends=(emacs emacs-org-mode) +makedepends=('git') +license=('GPL') +source=() + + + +_gitroot="https://github.com/chasberry/orgmode-accessories.git" +_gitname="master" + +build() { + cd $srcdir + msg "Connecting to the GIT server...." + + if [[ -d $srcdir/$_gitname ]] ; then + cd $_gitname + git pull origin + msg "The local files are updated." + else + git clone $_gitroot $_gitname + fi + + msg "GIT checkout done" + msg "Starting make..." + + [[ -d $srcdir/$_gitname-build ]] && rm -rf $srcdir/$_gitname-build + git clone $srcdir/$_gitname $srcdir/$_gitname-build + + cd $srcdir/$_gitname-build + + emacs --batch --visit scratch --eval "(progn (require 'org) (require 'org-export) (require 'org-e-latex) (require 'org-e-html) (org-babel-load-file \"ravel.org\"))" +} + +package() { + cd $srcdir/$_gitname-build + + install -Dm 644 e-ravel.el $pkgdir/usr/share/emacs/site-lisp/e-ravel.el + + mkdir -p $pkgdir/usr/share/doc/e-ravel/ + cp *.org $pkgdir/usr/share/doc/e-ravel/ +} +md5sums=() diff --git a/pcr/emacs-org-mode/PKGBUILD b/pcr/emacs-org-mode/PKGBUILD new file mode 100644 index 000000000..4b36a3e3b --- /dev/null +++ b/pcr/emacs-org-mode/PKGBUILD @@ -0,0 +1,39 @@ +# Contributor: Jiyunatori <tori_LEAVETHISOUT_@0xc29.net> +# Contributor: mdev +# adopted by domanov <domanov_LEAVETHISOUT_@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=emacs-org-mode +_srcname=org +pkgver=7.9.2 +pkgrel=1 +pkgdesc="Emacs Org Mode" +arch=('any') +url="http://orgmode.org/" +depends=(emacs) +license=('GPL') +install=emacs-org-mode.install +source=(http://orgmode.org/$_srcname-$pkgver.tar.gz) +md5sums=('e79441ff81c176e70230937e09f6042c') + +build() { + cd "${srcdir}/${_srcname}-${pkgver}" + make compile || return 1 +} + +package() { + cd "${srcdir}/${_srcname}-${pkgver}" + make prefix="${pkgdir}/usr/share" install || return 1 + + ## by default now we install also the contrib directory + install -d -m755 $pkgdir/usr/share/emacs/site-lisp/org_contrib || return 1 + cp -r contrib/* $pkgdir/usr/share/emacs/site-lisp/org_contrib || return 1 + + ##! proper install of info files (thanks mdev) + ##! replace "orgmode" with "org" in the following lines if you want + ##! to replace emacs own org's info files. You also need to change the .install. + install -D -m644 doc/org $pkgdir/usr/share/info/orgmode || return 1 + gzip -9 $pkgdir/usr/share/info/orgmode || return 1 + rm $pkgdir/usr/share/info/org || return 1 +} +md5sums=('e79441ff81c176e70230937e09f6042c') diff --git a/pcr/emacs-org-mode/emacs-org-mode.install b/pcr/emacs-org-mode/emacs-org-mode.install new file mode 100644 index 000000000..e8bd91185 --- /dev/null +++ b/pcr/emacs-org-mode/emacs-org-mode.install @@ -0,0 +1,62 @@ +## NOTE: the line commented with '##!' are needed +## to REPLACE the info file shipped by emacs (currently at version 6.21) +## with the info docs from this distribution (thanks mdev) + +# arg 1: the new package version +# arg 2: the old package version + +INFODIR=/usr/share/info + +pre_install() { +##! for file in {org,org-?.gz} ; do +##! if [ -e $INFODIR/$file ] ; then +##! echo "Removing $INFODIR/$file" +##! install-info --delete $INFODIR/$file $INFODIR/dir 2> /dev/null +##! rm -f $INFODIR/$file +##! fi +##! done + cat << EOM +To enable this version of org-mode instead of the one shipped with emacs, +add the line: + (require 'org-install) +to your .emacs file. + +NOTE: info documentation for emacs-org-mode goes now as 'orgmode' in /usr/share/info, + It does NOT replace the 'org' info files shipped with emacs: + $ info orgmode ## this version + $ info org ## emacs' org version (currently 6.21) +EOM +} + + +post_install() { +##! mv $INFODIR/orgmode.gz $INFODIR/org.gz +##! install-info $INFODIR/org.gz $INFODIR/dir 2> /dev/null +##! and comment out the following line: + install-info --name='orgmode' --description='Org Mode provided by emacs-org-mode (AUR)' $INFODIR/orgmode.gz $INFODIR/dir 2> /dev/null +} + +pre_upgrade() { + /bin/true +} + +post_upgrade() { + post_install $1 +} + + +pre_remove() { + install-info --delete $INFODIR/orgmode.gz $INFODIR/dir 2> /dev/null +##! comment out the line above and uncomment the following: +##! install-info --delete $INFODIR/org.gz $INFODIR/dir 2> /dev/null +##! rm $INFODIR/org.gz 2> /dev/null +} + +# arg 1: the old package version +post_remove() { + /bin/true +} + +op=$1 +shift +$op $* diff --git a/pcr/emacs-tuareg-mode/PKGBUILD b/pcr/emacs-tuareg-mode/PKGBUILD new file mode 100644 index 000000000..eba2834e0 --- /dev/null +++ b/pcr/emacs-tuareg-mode/PKGBUILD @@ -0,0 +1,29 @@ +# Contributor: Limao Luo <luolimao+AUR@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=emacs-tuareg-mode +pkgver=2.0.6 +pkgrel=2 +pkgdesc="Emacs tuareg mode for ocaml" +arch=(any) +url=https://forge.ocamlcore.org/projects/tuareg/ +license=(GPL) +depends=(emacs) +DLAGENTS=("https::/usr/bin/curl -fkLC - --retry 3 --retry-delay 3 -o %o %u") +install=$pkgname.install +source=(https://forge.ocamlcore.org/frs/download.php/882/tuareg-$pkgver.tar.gz) +sha256sums=('ea79ac24623b82ab8047345f8504abca557a537e639d16ce1ac3e5b27f5b1189') +sha512sums=('a7162daea30baa38bf1673b62ac545936a24b87b5e4d65329304ce5da68e151af1ef9f6e7720067f1f741614b3b6e1dfeab7080c4e9e7ebf14af594f3a0b0d46') + +build() { + cd "$srcdir"/tuareg-$pkgver/ + make +} + +package() { + cd "$srcdir"/tuareg-$pkgver/ + for i in *.el{,c}; do + install -Dm644 $i "$pkgdir"/usr/share/emacs/site-lisp/tuareg/$i + done + install -Dm644 README "$pkgdir"/usr/share/doc/tuareg/README +} diff --git a/pcr/emacs-tuareg-mode/emacs-tuareg-mode.install b/pcr/emacs-tuareg-mode/emacs-tuareg-mode.install new file mode 100644 index 000000000..f9ee9c970 --- /dev/null +++ b/pcr/emacs-tuareg-mode/emacs-tuareg-mode.install @@ -0,0 +1,17 @@ +post_install() { + cat <<__EOF__ +==> Put this in your $HOME/.emacs file to enable tuareg-mode autoloading +==> and autorecognition of ocaml source files: + + (setq auto-mode-alist (cons '("\\\\.ml[iylp]?\\\\'" . tuareg-mode) auto-mode-alist)) + (autoload 'tuareg-mode "tuareg" "Major mode for editing Caml code" t) + (autoload 'ocamldebug "ocamldebug" "Run the Caml debugger" t) + +==> Note to users of previous versions: 'camldebug' is now known as 'ocamldebug' +__EOF__ +} + + +post_upgrade() { + post_install +} diff --git a/pcr/emhacks/PKGBUILD b/pcr/emhacks/PKGBUILD new file mode 100644 index 000000000..66f0045e5 --- /dev/null +++ b/pcr/emhacks/PKGBUILD @@ -0,0 +1,33 @@ +# Contributor: Junmin Huang <junmin(dot)h(at)gmail(dot)com> +# Contributor: Stefan Husmann <stefan-husmann@t-online.de> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=emhacks +pkgver=20070920 +pkgrel=4 +pkgdesc="Useful Emacs Lisp libraries, including gdiff, jjar, jmaker, swbuff and tabbar, packaged from gentoo portage" +arch=('any') +url="http://emhacks.sourceforge.net/" +license=('GPL2') +depends=(emacs) +install=emhacks.install +source=(http://www.mirrorservice.org/sites/www.ibiblio.org/gentoo/distfiles/$pkgname-$pkgver.tar.bz2) +md5sums=('d349c78d25ce91a6f9c3e6446b129fc8') + +build() { + cd $srcdir/$pkgname-$pkgver + + # remove files included in Emacs>=22 or not useful on GNU/Linux + rm -r findstr* overlay-fix* recentf* ruler-mode* tree-widget* + for _i in gdiff-setup jjar jmaker swbuff tabbar + do + [ -f ${_i}.el.gz ] && rm ${_i}.el.gz + emacs -batch -q -f batch-byte-compile ${_i}.el + gzip ${_i}.el + done +} +package() { + install -d $pkgdir/usr/share/emacs/site-lisp/$pkgname + install -Dm644 $srcdir/$pkgname-$pkgver/* \ + $pkgdir/usr/share/emacs/site-lisp/$pkgname +} diff --git a/pcr/emhacks/emhacks.install b/pcr/emhacks/emhacks.install new file mode 100644 index 000000000..7d2bdf2b6 --- /dev/null +++ b/pcr/emhacks/emhacks.install @@ -0,0 +1,21 @@ +post_install() { +cat << EOM + +Don't forget to add the following code into your ~/.emacs file: +--- +(add-to-list 'load-path "/usr/share/emacs/site-lisp/emhacks") +--- + +EOM +} + +post_remove() { +cat << EOM + +The following code in your ~/.emacs file can be removed: +--- +(add-to-list 'load-path "/usr/share/emacs/site-lisp/emhacks") +--- + +EOM +}
\ No newline at end of file diff --git a/pcr/eterm/PKGBUILD b/pcr/eterm/PKGBUILD new file mode 100644 index 000000000..00030e80a --- /dev/null +++ b/pcr/eterm/PKGBUILD @@ -0,0 +1,39 @@ +# Contributor: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Adam 'battlemidget' Stokes <adam.stokes@gmail.com> +# Contributor: Daniel J Griffiths <ghost1227@archlinux.us> +# Contributor: Brad Fanella <bradfanella@archlinux.us> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=eterm +pkgver=0.9.6 +pkgrel=1 +pkgdesc="A vt102 terminal emulator intended as a replacement for xterm." +arch=('i686' 'x86_64') +url="http://www.eterm.org/" +license=('custom') +depends=('freetype2>=2.3.5' 'libast>=0.7' 'libxmu' 'libxres') +options=('!libtool') +source=(http://www.eterm.org/download/Eterm-${pkgver}.tar.gz) +md5sums=('90e424584c22d4050496874d14f78bb1') + +build() { + cd ${srcdir}/Eterm-${pkgver} + CONF="" + [ "${CARCH}" = "x86_64" ] && CONF="--disable-mmx" + ./configure --prefix=/usr --mandir=/usr/share/man \ + --enable-trans --enable-utmp \ + --enable-multi-charset=utf-8 \ + --enable-xim --with-theme-update \ + --with-backspace=bs --without-terminfo \ + --enable-multi-charset ${CONF} + make || return 1 +} + +package() { + cd ${srcdir}/Eterm-${pkgver} + make DESTDIR=${pkgdir} install + + install -Dm644 LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE +} + +md5sums=('90e424584c22d4050496874d14f78bb1') diff --git a/pcr/fpdns/PKGBUILD b/pcr/fpdns/PKGBUILD new file mode 100644 index 000000000..b4cff364a --- /dev/null +++ b/pcr/fpdns/PKGBUILD @@ -0,0 +1,28 @@ +# Contributor: Ermak <ermak@email.it> +# Maintainer : Parabola GNU / Linux-libre Aurélien Desbrières <aurelien@cwb.io> + +pkgname=fpdns +pkgver=0.9.3 +pkgrel=1 +pkgdesc="Program that remotely determines DNS server versions" +url="http://code.google.com/p/fpdns/" +depends=('') +license=('BSD') +options=('!emptydirs') +arch=('i686' 'x86_64') +source=('http://fpdns.googlecode.com/files/Net-DNS-Fingerprint-0.9.3.tar.gz') +md5sums=('16f1fbc9e5c8b935a0a48a509dc58899') + +build() { + cd ${srcdir}/Net-DNS-Fingerprint-0.9.3 + eval `perl -V:archname` + /usr/bin/perl Makefile.PL \ + INSTALLARCHLIB=/usr/lib/perl5/current/${archname} \ + INSTALLSITELIB=/usr/lib/perl5/site_perl/current \ + INSTALLSITEARCH=/usr/lib/perl5/site_perl/current/${archname} + /usr/bin/make || return 1 + /usr/bin/make DESTDIR=${pkgdir} install + /usr/bin/find ${pkgdir} -name '.packlist' -delete + /usr/bin/find ${pkgdir} -name '*.pod' -delete +} + diff --git a/pcr/fwsnort/PKGBUILD b/pcr/fwsnort/PKGBUILD new file mode 100644 index 000000000..37a863822 --- /dev/null +++ b/pcr/fwsnort/PKGBUILD @@ -0,0 +1,44 @@ +# Contributor: Colin Shea <colin@evaryont.me> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=fwsnort +pkgver=1.6.2 +pkgrel=1 +pkgdesc="application layer IDS/IPS by translating snort rules into iptables" +arch=('any') +url="http://www.cipherdyne.org/fwsnort/" +license=('GPL') +depends=('perl' 'perl-net-ipv4addr' 'perl-iptables-parse' 'iptables' 'net-tools') +makedepends=('wget') +source=(http://www.cipherdyne.org/$pkgname/download/$pkgname-$pkgver.tar.bz2 + 'install_pl.patch') + +build() { + cd "$srcdir/$pkgname-$pkgver" + + mkdir -p $pkgdir/var/log/fwsnort \ + $pkgdir/usr/lib/fwsnort \ + $pkgdir/usr/share/man/man8 \ + $pkgdir/usr/sbin \ + $pkgdir/etc/fwsnort/snort_rules \ + $pkgdir/etc/fwsnort/archive \ + $pkgdir/etc/fwsnort/snort_rules_queue + + patch -p0 -i $srcdir/install_pl.patch + sed -e "/mpath.*man8/s|/usr|$pkgdir&|" \ + -e "/^my\\ \\\$sbin/s|/usr|$pkgdir&|" \ + -i install.pl + + cp fwsnort.conf fwsnort.conf.bak + + sed -e "s|/var/log/fwsnort|$pkgdir&|" \ + -e "s|/usr/lib/fwsnort|$pkgdir&|" \ + -e "s|/etc/fwsnort|$pkgdir&|" \ + ./fwsnort.conf -i + # -S skips installing the perl modules, which we did with packages + echo y | ./install.pl -S + mv -f fwsnort.conf.bak $pkgdir/etc/fwsnort/fwsnort.conf + chmod 755 $pkgdir/usr/sbin/fwsnort +} + +# vim:set ts=2 sw=2 et: diff --git a/pcr/fwsnort/install_pl.patch b/pcr/fwsnort/install_pl.patch new file mode 100644 index 000000000..b9cfb4a33 --- /dev/null +++ b/pcr/fwsnort/install_pl.patch @@ -0,0 +1,27 @@ +--- install.pl 2011-02-05 05:02:38.845785881 -0700 ++++ install2.pl 2011-02-05 05:03:21.350360881 -0700 +@@ -120,10 +120,6 @@ + ### make sure the system binaries are where we think they are. + &check_commands(); + +-### check to make sure we are running as root +-$< == 0 && $> == 0 or die "You need to be root (or equivalent UID 0", +- " account) to install/uninstall fwsnort!\n"; +- + if ($uninstall) { + &uninstall(); + } else { +--- install.pl 2011-01-02 18:38:51.000000000 -0700 ++++ install2.pl 2011-02-05 04:59:01.653910881 -0700 +@@ -471,8 +471,11 @@ + sub check_commands() { + my @path = qw( + /bin ++ /sbin + /usr/bin ++ /usr/sbin + /usr/local/bin ++ /usr/local/sbin + ); + CMD: for my $cmd (keys %cmds) { + unless (-x $cmds{$cmd}) { diff --git a/pcr/gcc-gcj/PKGBUILD b/pcr/gcc-gcj/PKGBUILD new file mode 100644 index 000000000..7ed03b889 --- /dev/null +++ b/pcr/gcc-gcj/PKGBUILD @@ -0,0 +1,83 @@ +# Contributor: Renan Manola <rmanola@gmail.com> +# Contributor: Stefan Husmann <stefan-husmann@t-online.de> +# Based on a modified version of the gcc PKGBUILD +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=gcc-gcj +pkgver=4.7.2 +pkgrel=2 +pkgdesc="The GNU Compiler for Java" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL') +url="http://gcc.gnu.org" +depends=("gcc=$pkgver" 'gtk2' 'file' 'zip' 'libsm' 'libxtst' 'alsa-lib' 'libart-lgpl') +makedepends=('binutils>=2.20.1' 'mpfr>=2.4.2-2' 'cloog>=0.16.2-1' 'elfutils' + 'libmpc>=0.8.2-2' 'jack') +options=('!libtool') +install=$pkgname.install +source=(ftp://gcc.gnu.org/pub/gcc/releases/gcc-${pkgver}/gcc-${pkgver}.tar.bz2 libjava-sjlj.dpatch gcc_pure64.patch) +md5sums=('cc308a0891e778cfda7a151ab8a6e762' + 'afe3541abf5ce163223f94ccdbc66e30' + 'ced48436c1b3c981d721a829f1094de1') + +build() { + cd ${srcdir}/gcc-${pkgver} + + # Do not install libiberty + sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in + + # Do not run fixincludes + sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in + + chmod +x ${srcdir}/*.dpatch + ${srcdir}/libjava-sjlj.dpatch -patch + + echo ${pkgver} > gcc/BASE-VER + + [ -d build ] || mkdir build + if [ "${CARCH}" = "x86_64" ]; then + patch -p1 < $srcdir/gcc_pure64.patch + fi + cd build + + ../configure --prefix=/usr --enable-shared --enable-languages=java \ + --enable-threads=posix --mandir=/usr/share/man --infodir=/usr/share/info \ + --enable-__cxa_atexit --disable-multilib --libdir=/usr/lib \ + --libexecdir=/usr/lib --enable-clocale=gnu --disable-libstdcxx-pch \ + --with-tune=generic --enable-java-awt=gtk --with-java-home="$JAVA_HOME" \ + --enable-libgcj-multifile --disable-plugin --with-system-zlib + make +} + +package() { + cd ${srcdir}/gcc-${pkgver}/build + make -j1 DESTDIR=${pkgdir} install-target-libjava + + cd gcc + make -j1 DESTDIR=${pkgdir} java.install-common java.install-man + + install -m755 jc1 ${pkgdir}/usr/lib/gcc/${CHOST}/${pkgver}/ + install -m755 jvgenmain ${pkgdir}/usr/lib/gcc/${CHOST}/${pkgver}/ + + # Remove files which belong to the base gcc package + rm -f ${pkgdir}/usr/bin/{c,g}++ + if [ "${CARCH}" = "x86_64" ]; then + rm -f ${pkgdir}/usr/bin/x86_64-unknown-linux-gnu-{c,g}++ + else + rm -f ${pkgdir}/usr/bin/i686-pc-linux-gnu-{c,g}++ + fi + rm -f ${pkgdir}/usr/man/man1/g++.* + # Rename two files to not conflict to classpath + mv ${pkgdir}/usr/share/info/cp-tools.info ${pkgdir}/usr/share/info/cp-tools-gcj.info + rm ${pkgdir}/usr/share/info/dir + mv ${pkgdir}/usr/share/man/man1/gjdoc.1 ${pkgdir}/usr/share/man/man1/gjdoc.gcj.1 + + find ${pkgdir}/usr/lib -type f -name '*.so.*' -exec strip --strip-unneeded {} \; + + linkdir=`basename $pkgdir/usr/lib/gcj-${pkgver}*` + ln -sf $linkdir ${pkgdir}/usr/lib/gcj-${pkgver%.?} + ln -sf libgcj-${pkgver}.jar ${pkgdir}/usr/share/java/libgcj-${pkgver%.?}.jar + ln -sf libgcj-${pkgver}.jar ${pkgdir}/usr/share/java/libgcj.jar + ln -sf libgcj-tools-${pkgver}.jar ${pkgdir}/usr/share/java/libgcj-tools-${pkgver%.?}.jar + ln -sf libgcj-tools-${pkgver}.jar ${pkgdir}/usr/share/java/libgcj-tools.jar +} diff --git a/pcr/gcc-gcj/gcc-gcj.install b/pcr/gcc-gcj/gcc-gcj.install new file mode 100644 index 000000000..916aa6a17 --- /dev/null +++ b/pcr/gcc-gcj/gcc-gcj.install @@ -0,0 +1,20 @@ +infodir=usr/share/info +filelist=(cp-tools-gcj.info) + +post_install() { + [[ -x usr/bin/install-info ]] || return 0 + for file in "${filelist[@]}"; do + install-info "$infodir/$file.gz" "$infodir/dir" 2> /dev/null + done +} + +post_upgrade() { + post_install "$1" +} + +pre_remove() { + [[ -x usr/bin/install-info ]] || return 0 + for file in "${filelist[@]}"; do + install-info --delete "$infodir/$file.gz" "$infodir/dir" 2> /dev/null + done +}
\ No newline at end of file diff --git a/pcr/gcc-gcj/gcc_pure64.patch b/pcr/gcc-gcj/gcc_pure64.patch new file mode 100644 index 000000000..a9b09bbcf --- /dev/null +++ b/pcr/gcc-gcj/gcc_pure64.patch @@ -0,0 +1,26 @@ +diff -Naur gcc-orig/gcc/config/i386/linux64.h gcc/gcc/config/i386/linux64.h +--- gcc-orig/gcc/config/i386/linux64.h 2011-07-08 01:38:34.000000000 +1000 ++++ gcc/gcc/config/i386/linux64.h 2011-07-24 19:48:05.000000000 +1000 +@@ -28,6 +28,6 @@ + #define GNU_USER_LINK_EMULATION64 "elf_x86_64" + #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64" + +-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2" +-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2" ++#define GLIBC_DYNAMIC_LINKER32 "/lib32/ld-linux.so.2" ++#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-linux-x86-64.so.2" + #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2" +diff -Naur gcc-orig/gcc/config/i386/t-linux64 gcc/gcc/config/i386/t-linux64 +--- gcc-orig/gcc/config/i386/t-linux64 2011-07-08 01:38:34.000000000 +1000 ++++ gcc/gcc/config/i386/t-linux64 2011-07-24 19:49:41.000000000 +1000 +@@ -34,8 +34,8 @@ + comma=, + MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG)) + MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS))) +-MULTILIB_OSDIRNAMES = m64=../lib64 +-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib) ++MULTILIB_OSDIRNAMES = m64=../lib ++MULTILIB_OSDIRNAMES+= m32=../lib32 + MULTILIB_OSDIRNAMES+= mx32=../libx32 + + LIBGCC = stmp-multilib diff --git a/pcr/gcc-gcj/libjava-sjlj.dpatch b/pcr/gcc-gcj/libjava-sjlj.dpatch new file mode 100755 index 000000000..95b4673b3 --- /dev/null +++ b/pcr/gcc-gcj/libjava-sjlj.dpatch @@ -0,0 +1,65 @@ +#! /bin/sh -e + +# DP: Don't try to use _Unwind_Backtrace on SJLJ targets. +# DP: See bug #387875, #388505, GCC PR 29206. + +dir= +if [ $# -eq 3 -a "$2" = '-d' ]; then + pdir="-d $3" + dir="$3/" +elif [ $# -ne 1 ]; then + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +fi +case "$1" in + -patch) + patch $pdir -f --no-backup-if-mismatch -p1 < $0 + #cd ${dir}gcc && autoconf + ;; + -unpatch) + patch $pdir -f --no-backup-if-mismatch -R -p1 < $0 + #rm ${dir}gcc/configure + ;; + *) + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +esac +exit 0 + +--- + libjava/sysdep/generic/backtrace.h | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +Index: src/libjava/sysdep/generic/backtrace.h +=================================================================== +--- src.orig/libjava/sysdep/generic/backtrace.h 2006-11-06 14:00:32.000000000 -0500 ++++ src/libjava/sysdep/generic/backtrace.h 2006-11-06 14:04:38.000000000 -0500 +@@ -13,6 +13,20 @@ details. */ + + #include <java-stack.h> + ++#ifdef SJLJ_EXCEPTIONS ++ ++#undef _Unwind_GetIPInfo ++#define _Unwind_GetIPInfo(ctx,ip_before_insn) \ ++ (abort (), (void) (ctx), *ip_before_insn = 1, 0) ++ ++#undef _Unwind_GetRegionStart ++#define _Unwind_GetRegionStart(ctx) \ ++ (abort (), (void) (ctx), 0) ++ ++#undef _Unwind_Backtrace ++#define _Unwind_Backtrace(trace_fn,state_ptr) \ ++ (fallback_backtrace (trace_fn, state_ptr)) ++ + /* Unwind through the call stack calling TRACE_FN with STATE for every stack + frame. Returns the reason why the unwinding was stopped. */ + _Unwind_Reason_Code +@@ -20,4 +34,7 @@ fallback_backtrace (_Unwind_Trace_Fn, _J + { + return _URC_NO_REASON; + } ++ ++#endif /* SJLJ_EXCEPTIONS */ ++ + #endif diff --git a/pcr/gloobus-preview-bzr/PKGBUILD b/pcr/gloobus-preview-bzr/PKGBUILD new file mode 100644 index 000000000..ae8a2fd87 --- /dev/null +++ b/pcr/gloobus-preview-bzr/PKGBUILD @@ -0,0 +1,73 @@ +# Contributor: Alessio Sergi <asergi at archlinux dot us> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=gloobus-preview-bzr +_pkgname=gloobus-preview +pkgver=290 +pkgrel=1 +pkgdesc="A quicklook for GNU/Linux" +arch=('i686' 'x86_64') +url="https://launchpad.net/gloobus-preview" +license=('GPL3') +depends=('desktop-file-utils' 'djvulibre' 'gstreamer0.10-base' \ + 'gtksourceview3' 'libspectre' 'poppler-glib' \ + 'python2-gconf' 'taglib') +makedepends=('boost' 'bzr' 'intltool') +optdepends=('gdk-pixbuf-psd: PSD images support' + 'gdk-pixbuf-xcf: XCF images support' + 'gloobus-sushi-bzr: nautilus 3.x support' + 'libicns: ICNS files support' + 'marlin-bzr: file manager integration support' + 'nautilus-actions: nautilus menu integration' + 'nautilus-elementary-bzr: file manager integration support' + 'unoconv: LibO files support') +provides=($_pkgname) +conflicts=($_pkgname) +options=('!libtool') +install=$pkgname.install + +_bzrtrunk="https://code.launchpad.net/~gloobus-dev/$_pkgname/last_working_branch" +_bzrmod="$pkgname" + +build() { + cd "$srcdir" + + msg "Connecting to Bazaar server...." + + if [[ -d "$_bzrmod" ]]; then + cd "$_bzrmod" && bzr --no-plugins pull "$_bzrtrunk" -r "$pkgver" + msg "The local files are updated." + else + bzr --no-plugins branch "$_bzrtrunk" "$_bzrmod" -q -r "$pkgver" + fi + + msg "Bazaar checkout done or server timeout" + msg "Starting build..." + + rm -rf "$srcdir/$_bzrmod-build" + cp -r "$srcdir/$_bzrmod" "$srcdir/$_bzrmod-build" + cd "$srcdir/$_bzrmod-build" + + # no psd and xcf loaders + sed -i '/loaders/d' src/Makefile.am + sed -i '/src\/loaders/d' configure.ac + + # automake 1.12.1 fix + sed -i 's/-Werror//' configure.ac + + # python2 fix + sed -i 's_python_&2_' src/"$_pkgname"-configuration + + ./autogen.sh + ./configure --prefix=/usr + make +} + +package() { + cd "$srcdir/$_bzrmod-build" + + make DESTDIR="$pkgdir/" install +} + +# vim:set ts=2 sw=2 et: +md5sums=() diff --git a/pcr/gloobus-preview-bzr/gloobus-preview-bzr.install b/pcr/gloobus-preview-bzr/gloobus-preview-bzr.install new file mode 100644 index 000000000..63031e5be --- /dev/null +++ b/pcr/gloobus-preview-bzr/gloobus-preview-bzr.install @@ -0,0 +1,28 @@ +post_install() { + gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor + update-desktop-database -q + + echo ">>> To use GP instead of GNOME Sushi with Nautilus 3.x install gloobus-sushi-bzr." + echo "" + echo ">>> To use GP with marlin:" + echo '>>> $ gsettings set org.gnome.marlin.preferences previewer-path "'gloobus-preview'"' + echo "" + echo ">>> To use GP with nautilus-actions:" + echo ">>> Label: Quicklook" + echo ">>> Path: gloobus-preview" + echo ">>> Parameters: %f" + echo "" + echo ">>> For more info: http://gloobus.net/" + echo ">>> IRC channel: #gloobus @ irc.freenode.net" +} + +post_upgrade() { + post_install "$1" +} + +post_remove() { + gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor + update-desktop-database -q +} + +# vim:set ts=2 sw=2 et: diff --git a/pcr/gnome-boxes/PKGBUILD b/pcr/gnome-boxes/PKGBUILD new file mode 100644 index 000000000..0ac23a06b --- /dev/null +++ b/pcr/gnome-boxes/PKGBUILD @@ -0,0 +1,33 @@ +# Contributor: Stefano Facchini <stefano.facchini@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=gnome-boxes +pkgver=3.6.1 +pkgrel=2 +pkgdesc="A simple GNOME 3 application to access remote or virtual systems" +arch=('i686' 'x86_64') +url="http://live.gnome.org/Boxes" +license=('LGPL2.1') +depends=('gtk3' 'clutter-gtk' 'spice-gtk3' 'libvirt-glib' 'tracker' + 'gtk-vnc' 'udev' 'libosinfo' 'dconf' 'hicolor-icon-theme' + 'desktop-file-utils' 'shared-mime-info') +optdepends=('qemu-kvm-spice: to create new VMs') +makedepends=('intltool') +install=gnome-boxes.install +source=(http://ftp.gnome.org/pub/GNOME/sources/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.xz) +sha256sums=('fc6ffd0b3886e2da917abdb63470ab9869eef168c002461b9f02ce5aec5383ba') + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr --libexec=/usr/lib/gnome-boxes + make +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir/" install +} + +# vim:set ts=2 sw=2 et: +sha256sums=('fc6ffd0b3886e2da917abdb63470ab9869eef168c002461b9f02ce5aec5383ba') diff --git a/pcr/gnome-boxes/gnome-boxes.install b/pcr/gnome-boxes/gnome-boxes.install new file mode 100644 index 000000000..2b172e29c --- /dev/null +++ b/pcr/gnome-boxes/gnome-boxes.install @@ -0,0 +1,13 @@ +post_install() { + glib-compile-schemas usr/share/glib-2.0/schemas + update-desktop-database -q + gtk-update-icon-cache -q -t -f usr/share/icons/hicolor +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/pcr/gnome-rdp/PKGBUILD b/pcr/gnome-rdp/PKGBUILD new file mode 100644 index 000000000..67a96bb7f --- /dev/null +++ b/pcr/gnome-rdp/PKGBUILD @@ -0,0 +1,46 @@ +# Contributor: György Balló <ballogy@freestart.hu> +# Contributor: Hyperair <hyperair@gmail.com> +# Contributor: kumico <norrian@gmail.com> +# Contributor: adamruss <mail@russ.co.il> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=gnome-rdp +pkgver=0.3.1.0 +pkgrel=1 +pkgdesc="Remote desktop client for the GNOME Desktop with RDP/VNC/SSH capabilities, written in C Sharp" +arch=('any') +url="http://sourceforge.net/projects/gnome-rdp/" +license=('GPL' 'LGPL') +depends=('gtk-sharp-2' 'gnome-keyring-sharp') +optdepends=('openssh: SSH client' + 'gnome-terminal: required for the SSH client' + 'rdesktop: RDP client' + 'tightvnc: VNC client') +source=(http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz + appindicator.patch) +md5sums=('3c1329702914f8b1c213c0bb00d078cf' + '7bbe98eadfe199c5664fd69a4531fb3d') + +build() { + cd "$srcdir/$pkgname-$pkgver" + sed -i 's/tight-vncviewer/vncviewer/' Sessions/SessionCollection.cs + patch -R -Np3 -i "$srcdir/appindicator.patch" + sed -i 's/pkglib_SCRIPTS/programfiles_SCRIPTS/' Makefile.include + sed -i 's|@expanded_libdir@|@prefix@/@libdir@|' gnome-rdp.in + + autoreconf -fi + ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var + make +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir/" install + + # Install desktop and icon files + install -Dm644 Menu/$pkgname.desktop "$pkgdir/usr/share/applications/$pkgname.desktop" + install -Dm644 Menu/$pkgname.png "$pkgdir/usr/share/pixmaps/$pkgname.png" +} +md5sums=('3c1329702914f8b1c213c0bb00d078cf' + '7bbe98eadfe199c5664fd69a4531fb3d') diff --git a/pcr/gnome-rdp/appindicator.patch b/pcr/gnome-rdp/appindicator.patch new file mode 100644 index 000000000..4cb4d7a65 --- /dev/null +++ b/pcr/gnome-rdp/appindicator.patch @@ -0,0 +1,249 @@ +Index: /trunk/gnome-rdp/configure.ac
+===================================================================
+--- /trunk/gnome-rdp/configure.ac (revision 263)
++++ /trunk/gnome-rdp/configure.ac (revision 264)
+@@ -50,6 +50,7 @@
+ PKG_CHECK_MODULES([GLIB_SHARP_20], [glib-sharp-2.0])
+ PKG_CHECK_MODULES([GLADE_SHARP_20], [glade-sharp-2.0])
+ PKG_CHECK_MODULES([GNOME_KEYRING_SHARP_10], [gnome-keyring-sharp-1.0])
++PKG_CHECK_MODULES([APPINDICATOR_SHARP_01], [appindicator-sharp-0.1])
+
+ dnl package checks, per config
+
+Index: /trunk/gnome-rdp/MainWindow.cs
+===================================================================
+--- /trunk/gnome-rdp/MainWindow.cs (revision 257)
++++ /trunk/gnome-rdp/MainWindow.cs (revision 264)
+@@ -31,14 +31,18 @@
+ using GnomeRDP.Vnc;
+
++using AppIndicator;
++
+ namespace GnomeRDP
+ {
+ public partial class MainWindow: Gtk.Window
+ {
+- private StatusIcon statusIcon;
++ private ApplicationIndicator applicationIndicator;
+ private Gtk.Action actionQuit;
++ private Gtk.Action actionToggleVisible;
++ private bool hideOnDelete = false;
+
+ private const string sessionKey = "Session";
+
+- public MainWindow(): base (Gtk.WindowType.Toplevel)
++ public MainWindow (): base (Gtk.WindowType.Toplevel)
+ {
+ Build ();
+@@ -46,72 +50,80 @@
+ this.DeleteEvent += (s, e) =>
+ {
+- Visible = false;
+- e.RetVal = true;
++ if (hideOnDelete)
++ {
++ Visible = false;
++ e.RetVal = true;
++ }
+ };
+
+- this.actionQuit = new Gtk.Action("QuitAction", "Quit");
+- this.actionQuit.Activated+= (s, e) => Application.Quit();
++ this.actionQuit = new Gtk.Action ("QuitAction", "Quit");
++ this.actionQuit.Activated += (s, e) => Application.Quit ();
++
++ this.actionToggleVisible = new Gtk.Action("ToggleVisibleAction", "Show/Hide");
++ this.actionToggleVisible.Activated += (s, e) => { this.Visible = !this.Visible; };
++
++ this.applicationIndicator = new ApplicationIndicator ("gnome-rdp", "gnome-rdp", Category.ApplicationStatus);
++ this.applicationIndicator.ConnectionChanged += (s, e) => { hideOnDelete = this.applicationIndicator.Connected; };
+
+- this.statusIcon = new StatusIcon(ResourceLoader.Find(ResourceLoader.Icons.gnomeRdp));
+- this.statusIcon.Visible = true;
+- this.statusIcon.Tooltip = "GnomeRDP";
+- this.statusIcon.Activate += OnStatusIcon_Activate;
+- this.statusIcon.PopupMenu += OnStatusIcon_PopupMenu;
+-
++ this.applicationIndicator.Menu = CreateMenu();
++ this.applicationIndicator.Status = Status.Active;
++
+ this.Icon = ResourceLoader.Find(ResourceLoader.Icons.gnomeRdp);
+ }
+-
+- private void OnStatusIcon_Activate(object sender, EventArgs e)
++
++ public void UpdateMenu()
+ {
+- Visible = !Visible;
++ Menu oldMenu = this.applicationIndicator.Menu;
++
++ this.applicationIndicator.Menu = CreateMenu();
++
++ oldMenu.Dispose();
+ }
+-
+- private void OnStatusIcon_PopupMenu(object sender, PopupMenuArgs e)
++
++ private Menu CreateMenu()
+ {
+- try
+- {
+- Menu topMenu = new Menu();
+- topMenu.Popup();
++ Menu topMenu = new Menu();
++
++ topMenu.Append(actionToggleVisible.CreateMenuItem());
++ topMenu.Append(new SeparatorMenuItem());
+
+- foreach (var group in Program.SessionCollection.Groups)
+- {
+- MenuItem groupMenu = new MenuItem(group);
+- topMenu.Append(groupMenu);
+-
+- Menu subMenu = new Menu();
+- foreach(var session in Program.SessionCollection.Items.Where(s => s.Group == group).OrderBy(s => s.Server))
+- {
+- MenuItem menuItem = new MenuItem(session.MenuFormat);
+- menuItem.TooltipText = session.Tooltip;
+- menuItem.Activated += PopupMenuItem_Activated;
+- menuItem.Data[sessionKey] = session;
+-
+- subMenu.Append(menuItem);
+- }
+- groupMenu.Submenu = subMenu;
+- }
+-
+- topMenu.Append(new SeparatorMenuItem());
+-
+- foreach (var session in Program.SessionCollection.Items.Where(s => string.IsNullOrEmpty(s.Group)).OrderBy(s => s.Server))
++ foreach (var group in Program.SessionCollection.Groups)
++ {
++ MenuItem groupMenu = new MenuItem(group);
++
++ Menu subMenu = new Menu();
++ foreach(var session in Program.SessionCollection.Items.Where(s => s.Group == group).OrderBy(s => s.Server))
+ {
+ MenuItem menuItem = new MenuItem(session.MenuFormat);
+ menuItem.TooltipText = session.Tooltip;
+ menuItem.Activated += PopupMenuItem_Activated;
+- menuItem.Data[sessionKey] = session;
+-
+- topMenu.Append(menuItem);
++ menuItem.Data[sessionKey] = session;
++
++ subMenu.Append(menuItem);
+ }
++ groupMenu.Submenu = subMenu;
++
++ topMenu.Append(groupMenu);
++ }
++
++ topMenu.Append(new SeparatorMenuItem());
++
++ foreach (var session in Program.SessionCollection.Items.Where(s => string.IsNullOrEmpty(s.Group)).OrderBy(s => s.Server))
++ {
++ MenuItem menuItem = new MenuItem(session.MenuFormat);
++ menuItem.TooltipText = session.Tooltip;
++ menuItem.Activated += PopupMenuItem_Activated;
++ menuItem.Data[sessionKey] = session;
+
+- topMenu.Append(new SeparatorMenuItem());
+- topMenu.Append(actionQuit.CreateMenuItem());
+- topMenu.ShowAll();
+-// topMenu.Popup();
++ topMenu.Append(menuItem);
+ }
+- catch
+- {
+- }
+- }
+-
++
++ topMenu.Append(new SeparatorMenuItem());
++ topMenu.Append(actionQuit.CreateMenuItem());
++
++ topMenu.ShowAll();
++ return topMenu;
++ }
++
+ private void PopupMenuItem_Activated(object sender, EventArgs e)
+ {
+@@ -126,20 +138,4 @@
+ }
+ }
+-
+- protected virtual void OnNewRdpActionActivated (object sender, System.EventArgs e)
+- {
+- }
+-
+- protected virtual void OnNewVncActionActivated (object sender, System.EventArgs e)
+- {
+- }
+-
+- protected virtual void OnNewSshActionActivated (object sender, System.EventArgs e)
+- {
+- }
+-
+-
+-
+-
+ }
+ }
+Index: /trunk/gnome-rdp/ChangeLog
+===================================================================
+--- /trunk/gnome-rdp/ChangeLog (revision 262)
++++ /trunk/gnome-rdp/ChangeLog (revision 264)
+@@ -1,2 +1,11 @@
++2011-11-02 James P Michels III <jmichels@bluefintrading.com>
++
++ * Program.cs:
++ * gnome-rdp.sln:
++ * MainWindow.cs:
++ * gnome-rdp.csproj:
++ * gui.stetic:
++ * SessionsWidget.cs: Changes to support AppIndicator
++
+ 2011-05-22 James P Michels III <james.p.michels@gmail.com>
+
+Index: /trunk/gnome-rdp/Sessions/SessionsWidget.cs
+===================================================================
+--- /trunk/gnome-rdp/Sessions/SessionsWidget.cs (revision 257)
++++ /trunk/gnome-rdp/Sessions/SessionsWidget.cs (revision 264)
+@@ -205,4 +205,5 @@
+ }
+
++ Program.UpdateMainWindowMenu();
+ }
+ catch (Exception ex)
+Index: /trunk/gnome-rdp/gtk-gui/gui.stetic
+===================================================================
+--- /trunk/gnome-rdp/gtk-gui/gui.stetic (revision 261)
++++ /trunk/gnome-rdp/gtk-gui/gui.stetic (revision 264)
+@@ -7,5 +7,6 @@
+ <import>
+ <widget-library name="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+- <widget-library name="../bin/Debug/gnome-rdp.exe" internal="true" />
++ <widget-library name="appindicator-sharp, Version=0.2.0.0, Culture=neutral, PublicKeyToken=bcae265d1c7ab4c2" />
++ <widget-library name="../bin/Release/gnome-rdp.exe" internal="true" />
+ </import>
+ <widget class="Gtk.Window" id="GnomeRDP.MainWindow" design-size="798 565">
+Index: /trunk/gnome-rdp/Program.cs
+===================================================================
+--- /trunk/gnome-rdp/Program.cs (revision 261)
++++ /trunk/gnome-rdp/Program.cs (revision 264)
+@@ -196,5 +196,14 @@
+ });
+ }
+-
++
++ public static void UpdateMainWindowMenu()
++ {
++ GLib.Timeout.Add(0, () =>
++ {
++ mainWindow.UpdateMenu();
++ return false;
++ });
++ }
++
+ public static void SetMainWindowVisible(bool visible)
+ {
diff --git a/pcr/gnucash-docs/PKGBUIDL b/pcr/gnucash-docs/PKGBUIDL new file mode 100644 index 000000000..94c5d62d0 --- /dev/null +++ b/pcr/gnucash-docs/PKGBUIDL @@ -0,0 +1 @@ +md5sums=('38daeb3b15f296726ee8124122040f08') diff --git a/pcr/gnucash-docs/PKGBUILD b/pcr/gnucash-docs/PKGBUILD new file mode 100644 index 000000000..0895692f2 --- /dev/null +++ b/pcr/gnucash-docs/PKGBUILD @@ -0,0 +1,28 @@ +# Contributor: Mark Schneider <queueRAM@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=gnucash-docs +pkgver=2.4.1 +pkgrel=1 +pkgdesc="User documentation for gnucash" +arch=('i686' 'x86_64') +url="http://www.gnucash.org" +license=('GPL') +depends=('gnucash' 'docbook-xml' 'rarian' 'yelp') +source=(http://downloads.sourceforge.net/gnucash/${pkgname}-${pkgver}.tar.gz) +install=${pkgname}.install +md5sums=('38daeb3b15f296726ee8124122040f08') + +build() { + cd "$srcdir/$pkgname-$pkgver" + ./configure --prefix=/usr --sysconfdir=/etc \ + --localstatedir=/var --disable-scrollkeeper + make +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir/" install +} +md5sums=('38daeb3b15f296726ee8124122040f08') +md5sums=('38daeb3b15f296726ee8124122040f08') diff --git a/pcr/gnucash-docs/gnucash-docs.install b/pcr/gnucash-docs/gnucash-docs.install new file mode 100644 index 000000000..e82d4b10b --- /dev/null +++ b/pcr/gnucash-docs/gnucash-docs.install @@ -0,0 +1,20 @@ +post_install() { + echo "updating scrollkeeper catalogue ..." + scrollkeeper-update -q -p /var/lib/scrollkeeper + update-desktop-database -q +} + +post_upgrade() { + echo "updating scrollkeeper catalogue ..." + update-desktop-database -q + scrollkeeper-update -q -p /var/lib/scrollkeeper +} + +post_remove() { + post_install $1 +} + +op=$1 +shift + +$op $* diff --git a/pcr/gnuplot-py/PKGBUILD b/pcr/gnuplot-py/PKGBUILD new file mode 100644 index 000000000..315c7b695 --- /dev/null +++ b/pcr/gnuplot-py/PKGBUILD @@ -0,0 +1,23 @@ +# Contributor: Michael Krauss <hippodriver@gmx.net> +# Contributor : Baptiste Jonglez <zerstorer at free dot fr> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=gnuplot-py +pkgver=1.8 +pkgrel=3 +pkgdesc="Gnuplot.py is a Python package that interfaces to gnuplot." +arch=('any') +url="http://$pkgname.sourceforge.net/" +license=('LGPL') +depends=('python2-numpy' 'gnuplot') +#options=(!emptydirs) +source=("http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz") +md5sums=('abd6f571e7aec68ae7db90a5217cd5b1') + +package() { + cd $srcdir/$pkgname-$pkgver + python2 setup.py install --prefix=/usr --root=$pkgdir/ --optimize=1 +} + +# vim:set ts=2 sw=2 et: +md5sums=('abd6f571e7aec68ae7db90a5217cd5b1') diff --git a/pcr/gtkpacman/PKGBUILD b/pcr/gtkpacman/PKGBUILD new file mode 100644 index 000000000..0e66e33e5 --- /dev/null +++ b/pcr/gtkpacman/PKGBUILD @@ -0,0 +1,30 @@ +# Contributor: Tetsumaki <http://goo.gl/YMBdA> +# Contributor: Stefan Husmann <stefan-husmann@t-online.de> +# Contributor: Stefano Esposito <ragnarok@email.it> +# Maintainer : Parabola GNU / Linux-libre <aurelien@cwb.io> + +pkgname=gtkpacman +pkgver=2.3.1 +pkgrel=4 +pkgdesc="GTK package manager for archlinux based on pacman" +arch=('any') +url="http://gtkpacman.berlios.de/" +license=('GPL') +depends=('pygtk' 'vte') +source=("http://download.berlios.de/${pkgname}/${pkgname}-${pkgver}.tar.bz2") +sha256sums=('0ee571a5b1efcf5d8594a6eb04456a598c6354301ee6300c6508999c1eb87b88') + +build () { + cd "${srcdir}/${pkgname}-${pkgver}" + + # python2 fix + for _file in $(find . -name '*.py' -print); do + sed -i 's_^#!.*/usr/bin/python_#!/usr/bin/python2_' "${_file}" + sed -i 's_^#!.*/usr/bin/env.*python_#!/usr/bin/env python2_' "${_file}" + done +} + +package() { + cd "${srcdir}/${pkgname}-${pkgver}" + python2 setup.py install --root="${pkgdir}" +} diff --git a/pcr/h264enc/PKGBUILD b/pcr/h264enc/PKGBUILD new file mode 100644 index 000000000..9f47c3640 --- /dev/null +++ b/pcr/h264enc/PKGBUILD @@ -0,0 +1,35 @@ +# Contributor: AlexanderR <rvacheva at nxt dot ru> +# Contributor: Markus Heuser <markus.heuser@web.de> +# Contributor: Stefan Clarke <fm0nk3y@yahoo.co.uk> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=h264enc +pkgver=9.4.8 +pkgrel=1 +pkgdesc="Advanced shell script for encoding DVDs or video files to the H.264 format using the encoding utility MEncoder from MPlayer." +arch=('any') +url='http://h264enc.sourceforge.net/' +license=('GPL') +depends=('x264' 'lsdvd' 'lame' 'bc' 'mencoder') +optdepends=('mkvtoolnix' 'gpac' 'ogmtools' 'mplayer' 'pv' 'neroaacenc' 'aacplusenc' 'tsmuxer' 'vorbis-tools' 'dcaenc') +options=(!strip) +install="${pkgname}.install" +source=("http://sf.net/projects/h264enc/files/$pkgname/$pkgname-$pkgver.tar.gz") + +build() { + cd "$srcdir/$pkgname-$pkgver" + + sed -i -e "s|/usr/local|$pkgdir/usr|g" \ + -e 's|usr/local/|usr/|g' \ + -e 's|/man/man1|/share/man/man1|g' install +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + + ./install + rm ${pkgdir}/usr/share/doc/h264enc/{uninstall,LICENSE} +} + +sha1sums=('3d8b713c831a152994ce124a3fd4aebafcd4fd6d') +sha1sums=('3d8b713c831a152994ce124a3fd4aebafcd4fd6d') diff --git a/pcr/h264enc/h264enc.install b/pcr/h264enc/h264enc.install new file mode 100644 index 000000000..3c17e8130 --- /dev/null +++ b/pcr/h264enc/h264enc.install @@ -0,0 +1,9 @@ +post_install() { + echo "Hint: run 'h264enc -r' after installation of optional packages." +} + +post_upgrade() { + if [[ "$2" < "9.4.3" ]]; then + echo "~/.h264enc/config syntax changed since version 9.4.2. Update it by hands."; + fi +} diff --git a/pcr/ipycli-git/PKGBUILD b/pcr/ipycli-git/PKGBUILD new file mode 100644 index 000000000..86f6289d1 --- /dev/null +++ b/pcr/ipycli-git/PKGBUILD @@ -0,0 +1,56 @@ +# Contributor: Francois Boulogne <fboulogne at april dot org> +# Maintainer: Parabola GNU / Linux-libre Aurélien Desbrières <aurelien@cwb.io> + +pkgname=ipycli-git +pkgver=20121109 +pkgrel=2 +pkgdesc="IPython subapp that supports adding arbitrary notebooks from the command line" +arch=('i686' 'x86_64') +url="https://github.com/dalejung/ipycli/" +license=('UNKNOWN') +depends=('python2' 'ipython2') +optdepends=() +makedepends=('git' 'python2') +install= +provides=() +conflicts=() +source=() + + +_gitroot="git://github.com/dalejung/ipycli.git" +_gitname="ipycli" + +build() { + + cd "$srcdir" + msg "Connecting to GIT server...." + + if [ -d $_gitname ] ; then + cd $_gitname && git pull origin + msg "The local files are updated." + else + git clone $_gitroot $_gitname + fi + + msg "GIT checkout done or server timeout" + msg "Starting make..." + + rm -rf "$srcdir/$_gitname-build" + git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build" + cd "$srcdir/$_gitname-build" + + #lib + python2 setup.py install --root="${pkgdir}" + + #bin + mkdir "${pkgdir}/usr/bin" + cp "bin/nb" "${pkgdir}/usr/bin" + sed -i -e "s|#!/usr/bin/env python$|#!/usr/bin/env python2|" "${pkgdir}/usr/bin/nb" + cp "bin/ipycli" "${pkgdir}/usr/bin" + sed -i -e "s|#!/usr/bin/env python$|#!/usr/bin/env python2|" "${pkgdir}/usr/bin/ipycli" + + #templates/statics + cp -r "ipycli/static" "${pkgdir}/usr/lib/python2.7/site-packages/ipycli/" + cp -r "ipycli/templates" "${pkgdir}/usr/lib/python2.7/site-packages/ipycli/" +} +# vim:set ts=2 sw=2 et: diff --git a/pcr/jdee/PKGBUILD b/pcr/jdee/PKGBUILD new file mode 100644 index 000000000..41cddfb08 --- /dev/null +++ b/pcr/jdee/PKGBUILD @@ -0,0 +1,49 @@ +# PKGBUILD for JDEE 2.4.0.1 +# Contributor: Brandon Ednes <brandon@as220.org> +# $Id$ +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=jdee +_pkgname=jde +pkgver=2.4.0.1 +pkgrel=1 +pkgdesc="The Java Development Environment for Emacs" +arch=('i686' 'x86_64') +url="http://jdee.sourceforge.net/" +license="GPL" +depends=('emacs' 'cedet' 'emacs-elib') +makedepends=() +conflicts=() +replaces=() +backup=() +install="$pkgname.install" +source=(http://downloads.sourceforge.net/project/jdee/jdee/2.4.0.1/jdee-bin-2.4.0.1.zip) +md5sums=('8e1d3e764f01c6dc1e337f9c6882ec85') + +build() { + cd $startdir/src/$pkgname-$pkgver + mkdir -p $startdir/pkg/usr/share/emacs/site-lisp/$_pkgname + + # Fix up permissions for package files. This is nice but not required. + find . -type f | xargs chmod 644 + + # Because of the way JDEE builds, it assumes the jde directory has its + # dependencies in sibling directories. We set up some symlinks to fake + # this. + ln -sf /usr/share/emacs/site-lisp/elib ../elib + ln -sf /usr/share/emacs/site-lisp/cedet ../cedet + # Byte-compile everything. + emacs -q --no-site-file -batch -l $startdir/jdee-build.el -f jde-compile-jde + + # There is no install per se, just copy everything into the pkg directory. + cp -R $startdir/src/$pkgname-$pkgver/* \ + $startdir/pkg/usr/share/emacs/site-lisp/$_pkgname + + # Clean up the symlinks. + rm ../elib + rm ../cedet +} + +# Local Variables: +# mode: shell-script +# End: diff --git a/pcr/jdee/jdee-build.el b/pcr/jdee/jdee-build.el new file mode 100644 index 000000000..a8ec13358 --- /dev/null +++ b/pcr/jdee/jdee-build.el @@ -0,0 +1,8 @@ +;;; jde-build.el +;;; Set up the Emacs environment to byte-compile JDEE +;;; $Id: jdee-build.el,v 99d30c485449 2008/06/23 05:38:36 jbromley $ +(add-to-list 'load-path "../elib") +(add-to-list 'load-path "../cedet") +(add-to-list 'load-path "./lisp") +(load-file (expand-file-name "../cedet/common/cedet.el")) +(require 'jde) diff --git a/pcr/jdee/jdee.install b/pcr/jdee/jdee.install new file mode 100644 index 000000000..08b6501a4 --- /dev/null +++ b/pcr/jdee/jdee.install @@ -0,0 +1,54 @@ +# jdee.install +# Show Emacs configuration instructions. +# $Id: jdee.install,v 99d30c485449 2008/06/23 05:38:36 jbromley $ +post_install () { +echo "" +echo "==> You may need to update your .emacs file. The following shows" +echo "==> the minimal configuration needed. Note that it shows what is" +echo "==> needed to configure JDEE's dependencies elib and cedet." +echo "" +echo "==> ;; This .emacs file illustrates the minimal setup" +echo "==> ;; required to run the JDE." +echo "==>" +echo "==> ;; Update the Emacs load-path to include the path to" +echo "==> ;; the JDE and its require packages. This code assumes" +echo "==> ;; that you have installed the packages in the emacs/site" +echo "==> ;; subdirectory of your home directory." +echo "==> (add-to-list 'load-path (expand-file-name \"~/emacs/site/jde/lisp\"))" +echo "==> (add-to-list 'load-path (expand-file-name \"~/emacs/site/cedet/common\"))" +echo "==> (add-to-list 'load-path (expand-file-name \"~/emacs/site/elib\"))" +echo "==>" +echo "==> ;; Initialize CEDET." +echo "==> (load-file (expand-file-name \"~/emacs/site/cedet/common/cedet.el\"))" +echo "==>" +echo "==>" +echo "==> ;; If you want Emacs to defer loading the JDE until you open a" +echo "==> ;; Java file, edit the following line" +echo "==> (setq defer-loading-jde nil)" +echo "==> ;; to read:" +echo "==> ;;" +echo "==> ;; (setq defer-loading-jde t)" +echo "==> ;;" +echo "==>" +echo "==> (if defer-loading-jde" +echo "==> (progn" +echo "==> (autoload 'jde-mode \"jde\" \"JDE mode.\" t)" +echo "==> (setq auto-mode-alist" +echo "==> (append" +echo "==> '((\"\\\\.java\\\\'\" . jde-mode))" +echo "==> auto-mode-alist)))" +echo "==> (require 'jde))" +echo "" +} + +post_upgrade () { + post_install $1 +} + +op=$1 +shift +$op $* + +# Local Variables: +# mode: shell-script +# End: diff --git a/pcr/knot/PKGBUILD b/pcr/knot/PKGBUILD new file mode 100644 index 000000000..4f785493a --- /dev/null +++ b/pcr/knot/PKGBUILD @@ -0,0 +1,31 @@ +# Contributor: Otto Sabart <seberm[at]gmail[dot]com> +# Maintainer : Parabola GNU / Linux-libre Aurélien Desbrières <aurelien@cwb.io> + +pkgname=knot +pkgver=1.1.0 +pkgrel=1 +pkgdesc="high-performance authoritative-only DNS server" +url="http://www.knot-dns.cz/setlang/?language=en" +arch=('i686' 'x86_64') +license=('GPLv3') +depends=('liburcu>=0.5.4' 'flex>=2.5.3' 'libtool' 'bison>=2.3') +optdepends=('libcap') +makedepends=('autoconf>=2.65') +conflicts=() +replaces=() +backup=() +#install='foo.install' +source=("http://public.nic.cz/files/knot-dns/${pkgname}-${pkgver}.tar.gz") + +md5sums=('b2d4a53d8e98565ebb389531c2b66690') + +build() { + + cd "${srcdir}/${pkgname}-${pkgver}" + + #autoreconf -if + ./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc/knot + + make && make install DESTDIR="${pkgdir}" || return 1 + #ldconfig +} diff --git a/pcr/kompozer/NS_IMETHOD_i686.patch b/pcr/kompozer/NS_IMETHOD_i686.patch new file mode 100644 index 000000000..79abc50de --- /dev/null +++ b/pcr/kompozer/NS_IMETHOD_i686.patch @@ -0,0 +1,11 @@ +--- xpcom/base/nscore.h 2009-05-02 17:43:48.000000000 +0100 ++++ xpcom/base/nscore.h 2012-08-10 23:08:07.168628118 +0100 +@@ -182,7 +182,7 @@ + #define NS_IMPORT_(type) NS_EXTERNAL_VIS_(type) + #define NS_EXPORT NS_EXTERNAL_VIS + #define NS_EXPORT_(type) NS_EXTERNAL_VIS_(type) +-#define NS_IMETHOD_(type) virtual IMETHOD_VISIBILITY type NS_DEFCALL ++#define NS_IMETHOD_(type) virtual type + #define NS_IMETHODIMP_(type) type + #define NS_METHOD_(type) type + #define NS_CALLBACK_(_type, _name) _type (* _name) diff --git a/pcr/kompozer/PKGBUILD b/pcr/kompozer/PKGBUILD new file mode 100644 index 000000000..7b556e166 --- /dev/null +++ b/pcr/kompozer/PKGBUILD @@ -0,0 +1,59 @@ +# Contributor: peace4all <markspost at rocketmail dot com> +# Maintainer : Parabola GNU / Linux-libre <aurelien@cwb.io> + +# thanks to tadzio, and techlive for the investigation +# work and fix included as the NS_IMETHOD_i686.patch + +pkgname=kompozer +pkgver=0.8b3 +pkgrel=10 +pkgdesc="A Dreamweaver style WYSIWYG web editor; Nvu unofficial bug-fix release" +arch=('x86_64' 'i686') +license=('GPL') +url="http://www.kompozer.net" +depends=('gtk2' 'glib2' 'pango' 'pangox-compat' 'nss' 'libxt' 'libidl2' 'gnome-vfs') +makedepends=('zip' 'pkgconfig') +source=("http://downloads.sourceforge.net/kompozer/$pkgname-$pkgver-src.tar.bz2" + 'kompozer.desktop' + 'mozconfig.patch' + 'kompozer-libpng15.patch' + 'kompozer-libpng14.patch' + 'gcc46_default_ctors.patch' + 'kompozer_gcc_4.7.patch' + 'any_kernel_26_plus.patch' + 'NS_IMETHOD_i686.patch') +md5sums=('cd4664ecda908666b19ef0607010c627' + 'ed8edf6817892a38b8b181fc9b2caaea' + '4778f967307cf569089daca843de1df9' + '4852034f99e7943071946e7eedc6c2f5' + 'd5ba90f7fbaed76f77a6d9717e86f3a5' + 'ad3ec5cbc6677dd712b140148398f58f' + '75b0e1cad65dbeb8feedac5d4f52be32' + '58a294356b3e17ad070e4c93180bf0ad' + '186c47586bebf83b9b76d339e3a38c95') + +build() { + cd "$srcdir/mozilla" + + patch -Np0 -i "$srcdir/mozconfig.patch" + patch -Np0 -i "$srcdir/kompozer-libpng14.patch" + patch -Np0 -i "$srcdir/kompozer-libpng15.patch" + patch -Np0 -i "$srcdir/gcc46_default_ctors.patch" + patch -Np0 -i "$srcdir/kompozer_gcc_4.7.patch" + patch -Np0 -i "$srcdir/any_kernel_26_plus.patch" + patch -Np0 -i "$srcdir/NS_IMETHOD_i686.patch" + + make -f client.mk build +} + +package() { + cd "$srcdir/obj-kompozer" + + make DESTDIR=$pkgdir install + install -m755 -dD "$pkgdir/usr/share/applications/" + install -m644 "$srcdir/kompozer.desktop" "$pkgdir/usr/share/applications/" + + mkdir -p "$pkgdir/usr/share/pixmaps/" + ln -s "/usr/lib/kompozer/icons/mozicon256.png" "$pkgdir/usr/share/pixmaps/kompozer.png" + ln -s "/usr/lib/kompozer/icons/mozicon50.xpm" "$pkgdir/usr/share/pixmaps/kompozer.xpm" +} diff --git a/pcr/kompozer/any_kernel_26_plus.patch b/pcr/kompozer/any_kernel_26_plus.patch new file mode 100644 index 000000000..69610ef3f --- /dev/null +++ b/pcr/kompozer/any_kernel_26_plus.patch @@ -0,0 +1,31 @@ +--- security/coreconf/config.mk 2009-05-02 17:42:18.000000000 +0100 ++++ security/coreconf/config.mk 2012-05-22 00:08:39.000000000 +0100 +@@ -63,7 +63,7 @@ + ####################################################################### + + TARGET_OSES = FreeBSD BSD_OS NetBSD OpenUNIX OS2 QNX Darwin BeOS OpenBSD \ +- OpenVMS AIX ++ OpenVMS AIX Linux + + ifeq (,$(filter-out $(TARGET_OSES),$(OS_TARGET))) + include $(CORE_DEPTH)/coreconf/$(OS_TARGET).mk +--- security/coreconf/Linux.mk 2009-05-02 17:42:18.000000000 +0100 ++++ security/coreconf/Linux.mk 2012-05-22 00:36:03.533374797 +0100 +@@ -176,3 +176,17 @@ + # Always set CPU_TAG on Linux, OpenVMS, WINCE. + # + CPU_TAG = _$(CPU_ARCH) ++ ++# ++#Try to compile with any kernel version 2.6 and above. ++# ++DSO_LDOPTS += -Wl,-z,defs ++ ++OS_REL_CFLAGS += -DLINUX2_1 ++MKSHLIB = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) ++ ++ifdef MAPFILE ++ MKSHLIB += -Wl,--version-script,$(MAPFILE) ++endif ++PROCESS_MAP_FILE = grep -v ';-' $< | \ ++ sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@ diff --git a/pcr/kompozer/gcc46_default_ctors.patch b/pcr/kompozer/gcc46_default_ctors.patch new file mode 100644 index 000000000..7f3fa7810 --- /dev/null +++ b/pcr/kompozer/gcc46_default_ctors.patch @@ -0,0 +1,22 @@ +--- intl/unicharutil/util/nsUnicharUtils.h 2011-05-10 17:02:12.472642196 +0200 ++++ intl/unicharutil/util/nsUnicharUtils.h 2011-05-10 17:02:50.656034735 +0200 +@@ -64,6 +64,9 @@ + : public nsStringComparator + { + public: ++ nsCaseInsensitiveStringComparator() ++ { ++ } + virtual int operator()( const PRUnichar*, const PRUnichar*, PRUint32 aLength ) const; + virtual int operator()( PRUnichar, PRUnichar ) const; + }; +--- toolkit/xre/nsAppRunner.cpp 2011-05-10 17:26:05.853608464 +0200 ++++ toolkit/xre/nsAppRunner.cpp 2011-05-10 17:26:15.079221177 +0200 +@@ -491,6 +491,7 @@ + + { + public: ++ nsXULAppInfo() {} + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_NSIXULAPPINFO + NS_DECL_NSIXULRUNTIME diff --git a/pcr/kompozer/kompozer-libpng14.patch b/pcr/kompozer/kompozer-libpng14.patch new file mode 100644 index 000000000..224bc7f61 --- /dev/null +++ b/pcr/kompozer/kompozer-libpng14.patch @@ -0,0 +1,17 @@ +diff -Naur mozilla/modules/libpr0n/encoders/png/nsPNGEncoder.cpp{-,} +--- mozilla/modules/libpr0n/encoders/png/nsPNGEncoder.cpp- 2010-06-10 19:34:09.000000000 -0700 ++++ modules/libpr0n/encoders/png/nsPNGEncoder.cpp 2010-06-10 19:35:13.000000000 -0700 +@@ -111,9 +111,9 @@ + + // initialize + png_struct* png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, +- png_voidp_NULL, +- png_error_ptr_NULL, +- png_error_ptr_NULL); ++ NULL, ++ NULL, ++ NULL); + if (! png_ptr) + return NS_ERROR_OUT_OF_MEMORY; + png_info* info_ptr = png_create_info_struct(png_ptr); + diff --git a/pcr/kompozer/kompozer-libpng15.patch b/pcr/kompozer/kompozer-libpng15.patch new file mode 100644 index 000000000..f236e402a --- /dev/null +++ b/pcr/kompozer/kompozer-libpng15.patch @@ -0,0 +1,64 @@ +diff -urp mozilla.orig/modules/libpr0n/decoders/png/nsPNGDecoder.cpp mozilla/modules/libpr0n/decoders/png/nsPNGDecoder.cpp +--- mozilla.orig/modules/libpr0n/decoders/png/nsPNGDecoder.cpp 2011-11-14 21:55:42.513856274 +0000 ++++ modules/libpr0n/decoders/png/nsPNGDecoder.cpp 2011-11-14 22:15:35.899962674 +0000 +@@ -171,7 +171,7 @@ static NS_METHOD ReadDataOut(nsIInputStr + } + + // we need to do the setjmp here otherwise bad things will happen +- if (setjmp(decoder->mPNG->jmpbuf)) { ++ if (setjmp (png_jmpbuf(decoder->mPNG))) { + png_destroy_read_struct(&decoder->mPNG, &decoder->mInfo, NULL); + + decoder->mError = PR_TRUE; +@@ -227,7 +227,7 @@ info_callback(png_structp png_ptr, png_i + if (width > MOZ_PNG_MAX_DIMENSION || height > MOZ_PNG_MAX_DIMENSION) { + nsPNGDecoder *decoder = NS_STATIC_CAST(nsPNGDecoder*, + png_get_progressive_ptr(png_ptr)); +- longjmp(decoder->mPNG->jmpbuf, 1); ++ longjmp(png_jmpbuf(decoder->mPNG), 1); + } + #undef MOZ_PNG_MAX_DIMENSION + +@@ -307,7 +307,7 @@ info_callback(png_structp png_ptr, png_i + + decoder->mImage = do_CreateInstance("@mozilla.org/image/container;1"); + if (!decoder->mImage) +- longjmp(decoder->mPNG->jmpbuf, 5); // NS_ERROR_OUT_OF_MEMORY ++ longjmp(png_jmpbuf(decoder->mPNG), 5); // NS_ERROR_OUT_OF_MEMORY + + decoder->mImageLoad->SetImage(decoder->mImage); + +@@ -319,7 +319,7 @@ info_callback(png_structp png_ptr, png_i + + decoder->mFrame = do_CreateInstance("@mozilla.org/gfx/image/frame;2"); + if (!decoder->mFrame) +- longjmp(decoder->mPNG->jmpbuf, 5); // NS_ERROR_OUT_OF_MEMORY ++ longjmp(png_jmpbuf(decoder->mPNG), 5); // NS_ERROR_OUT_OF_MEMORY + + gfx_format format; + +@@ -341,7 +341,7 @@ info_callback(png_structp png_ptr, png_i + // then initalize the frame and append it to the container + nsresult rv = decoder->mFrame->Init(0, 0, width, height, format, 24); + if (NS_FAILED(rv)) +- longjmp(decoder->mPNG->jmpbuf, 5); // NS_ERROR_OUT_OF_MEMORY ++ longjmp(png_jmpbuf(decoder->mPNG), 5); // NS_ERROR_OUT_OF_MEMORY + + decoder->mImage->AppendFrame(decoder->mFrame); + +@@ -362,7 +362,7 @@ info_callback(png_structp png_ptr, png_i + decoder->ibpr = bpr; + decoder->interlacebuf = (PRUint8 *)nsMemory::Alloc(decoder->ibpr*height); + if (!decoder->interlacebuf) { +- longjmp(decoder->mPNG->jmpbuf, 5); // NS_ERROR_OUT_OF_MEMORY ++ longjmp(png_jmpbuf(decoder->mPNG), 5); // NS_ERROR_OUT_OF_MEMORY + } + } + +@@ -555,7 +555,7 @@ void + error_callback(png_structp png_ptr, png_const_charp error_msg) + { + PR_LOG(gPNGLog, PR_LOG_ERROR, ("libpng error: %s\n", error_msg)); +- longjmp(png_ptr->jmpbuf, 1); ++ longjmp(png_jmpbuf(png_ptr), 1); + } diff --git a/pcr/kompozer/kompozer.desktop b/pcr/kompozer/kompozer.desktop new file mode 100644 index 000000000..c395f9af7 --- /dev/null +++ b/pcr/kompozer/kompozer.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Exec=kompozer +Icon=kompozer +Type=Application +Terminal=false +Name=KompoZer +GenericName=Web Authoring System +Comment=WYSIWYG Web Editor +MimeType=text/html;text/xml;text/css;text/x-javascript;text/javascript;application/xhtml+xml; +Categories=Development;WebDevelopment;Network; + diff --git a/pcr/kompozer/kompozer_gcc_4.7.patch b/pcr/kompozer/kompozer_gcc_4.7.patch new file mode 100644 index 000000000..196609fce --- /dev/null +++ b/pcr/kompozer/kompozer_gcc_4.7.patch @@ -0,0 +1,107 @@ +--- xpcom/glue/nsBaseHashtable.h 2009-05-02 17:43:39.000000000 +0100 ++++ xpcom/glue/nsBaseHashtable.h 2012-07-27 13:43:55.000000000 +0100 +@@ -123,7 +123,7 @@ + */ + PRBool Get(KeyType aKey, UserDataType* pData) const + { +- EntryType* ent = GetEntry(aKey); ++ EntryType* ent = this->GetEntry(aKey); + + if (!ent) + return PR_FALSE; +@@ -142,7 +142,7 @@ + */ + PRBool Put(KeyType aKey, UserDataType aData) + { +- EntryType* ent = PutEntry(aKey); ++ EntryType* ent = this->PutEntry(aKey); + + if (!ent) + return PR_FALSE; +@@ -156,7 +156,7 @@ + * remove the data for the associated key + * @param aKey the key to remove from the hashtable + */ +- void Remove(KeyType aKey) { RemoveEntry(aKey); } ++ void Remove(KeyType aKey) { this->RemoveEntry(aKey); } + + /** + * function type provided by the application for enumeration. +--- xpcom/glue/nsClassHashtable.h 2009-05-02 17:43:39.000000000 +0100 ++++ xpcom/glue/nsClassHashtable.h 2012-07-27 13:15:10.000000000 +0100 +@@ -98,7 +98,7 @@ + nsClassHashtable<KeyClass,T>::Get(KeyType aKey, T** retVal) const + { + typename nsBaseHashtable<KeyClass,nsAutoPtr<T>,T*>::EntryType* ent = +- GetEntry(aKey); ++ this->GetEntry(aKey); + + if (ent) + { +@@ -126,7 +126,7 @@ + PR_Lock(this->mLock); + + typename nsBaseHashtableMT<KeyClass,nsAutoPtr<T>,T*>::EntryType* ent = +- GetEntry(aKey); ++ this->GetEntry(aKey); + + if (ent) + { +--- xpcom/glue/nsInterfaceHashtable.h 2009-05-02 17:43:39.000000000 +0100 ++++ xpcom/glue/nsInterfaceHashtable.h 2012-07-27 13:30:08.000000000 +0100 +@@ -111,7 +111,7 @@ + (KeyType aKey, UserDataType* pInterface) const + { + typename nsBaseHashtable<KeyClass, nsCOMPtr<Interface>, Interface*>::EntryType* ent = +- GetEntry(aKey); ++ this->GetEntry(aKey); + + if (ent) + { +@@ -139,7 +139,7 @@ + (KeyType aKey, PRBool* aFound) const + { + typename nsBaseHashtable<KeyClass, nsCOMPtr<Interface>, Interface*>::EntryType* ent = +- GetEntry(aKey); ++ this->GetEntry(aKey); + + if (ent) + { +@@ -167,7 +167,7 @@ + PR_Lock(this->mLock); + + typename nsBaseHashtableMT<KeyClass, nsCOMPtr<Interface>, Interface*>::EntryType* ent = +- GetEntry(aKey); ++ this->GetEntry(aKey); + + if (ent) + { +--- xpcom/glue/nsRefPtrHashtable.h 2009-05-02 17:43:39.000000000 +0100 ++++ xpcom/glue/nsRefPtrHashtable.h 2012-07-27 13:52:48.000000000 +0100 +@@ -112,7 +112,7 @@ + (KeyType aKey, UserDataType* pRefPtr) const + { + typename nsBaseHashtable<KeyClass, nsRefPtr<RefPtr>, RefPtr*>::EntryType* ent = +- GetEntry(aKey); ++ this->GetEntry(aKey); + + if (ent) + { +@@ -140,7 +140,7 @@ + (KeyType aKey, PRBool* aFound) const + { + typename nsBaseHashtable<KeyClass, nsRefPtr<RefPtr>, RefPtr*>::EntryType* ent = +- GetEntry(aKey); ++ this->GetEntry(aKey); + + if (ent) + { +@@ -168,7 +168,7 @@ + PR_Lock(this->mLock); + + typename nsBaseHashtableMT<KeyClass, nsRefPtr<RefPtr>, RefPtr*>::EntryType* ent = +- GetEntry(aKey); ++ this->GetEntry(aKey); + + if (ent) + { diff --git a/pcr/kompozer/mozconfig.patch b/pcr/kompozer/mozconfig.patch new file mode 100644 index 000000000..bebad1d20 --- /dev/null +++ b/pcr/kompozer/mozconfig.patch @@ -0,0 +1,142 @@ +--- .mozconfig 2009-04-26 16:19:33.000000000 +0100 ++++ .mozconfig 1970-01-01 10:14:21.000000000 +0100 +@@ -1,85 +1,80 @@ +-# Pulling Composer from the 1.8 Mozilla branch (cvs) +-#$ cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -r MOZILLA_1_8_BRANCH mozilla/client.mk +-#$ cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -r FIREFOX_2_0_0_20_RELEASE mozilla/client.mk +-#$ cd mozilla +-#$ make -f client.mk checkout MOZ_CO_PROJECT=composer +-#$ find . -name CVS -prune -exec rm -rf {} \; +-#$ find . -name .cvsignore -prune -exec rm -rf {} \; +- +-# Building Composer on the 1.8 Mozilla branch +-# Note: on Ubuntu 8.04, requires libgtk2-dev, libxt-dev, libidl-dev +-# + dbus-glib-1-dev, curl (for Mozilla 1.9+) +-#$ make -f client.mk build +-# ++# Build configuration script for Debian ++ ++# build in a separate directory (optional) ++#mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj-@CONFIG_GUESS@ + +-export BUILD_OFFICIAL=1 + export MOZILLA_OFFICIAL=1 ++export BUILD_OFFICIAL=1 ++ ++export MOZ_STANDALONE_COMPOSER=1 ++mk_add_options MOZ_STANDALONE_COMPOSER=1 ++ ++# if you want don't want to use gcc and g or want to use ++# a specific version of the compilers, specify it in the ++# two following lines and uncomment them ++#export CC="gcc-3.0" ++#export CXX="g-3.0" ++ ++# Uncomment the 3 following lines on Debian ++#export OS_LIBS="-lc -lpthread" ++#export CFLAGS="-DDEBIAN" ++#export CXXFLAGS="-DDEBIAN" ++mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj-kompozer + +-mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj-@CONFIG_GUESS@ +-#mk_add_options MOZ_CO_PROJECT=composer ++# build the standalone composer, obviously ++mk_add_options MOZ_CO_PROJECT=composer + ac_add_options --enable-application=composer + ++# change these two line to build in debug mode + ac_add_options --enable-optimize ++ac_add_options --with-pthreads + ac_add_options --disable-debug +-#ac_add_options --disable-optimize +-#ac_add_options --enable-debug +- +-#ac_add_options --disable-shared +-#ac_add_options --enable-static +-#ac_add_options --disable-libxul +-#ac_add_options --disable-xpfe-components +-ac_add_options --enable-xpfe-components +-ac_add_options --disable-tests +-ac_add_options --disable-installer +- +-#ac_add_options --disable-libxul + +-#ac_add_options --disable-crashreporter ++# adapt the following lines according to your distribution + +-#ac_add_options --enable-optimize +-#ac_add_options --enable-default-toolkit=gtk2 +-##ac_add_options --enable-default-toolkit=cairo-gtk2 +-#ac_add_options --enable-xft +-#ac_add_options --disable-canvas +-##ac_add_options --disable-cairo +- +-#ac_add_options --enable-extensions="default inspector venkman" +-ac_add_options --enable-extensions="default spellcheck" +-#ac_add_options --enable-inspector-apis +- +-##ac_add_options --enable-extensions=wallet,xml-rpc,xmlextras,pref,universalchardet,spellcheck +-##ac_add_options --enable-extensions=xml-rpc,xmlextras,pref,universalchardet +-#ac_add_options --disable-extensions +-## (now by default) ac_add_options --enable-necko-protocols=http,ftp,file,jar,viewsource,res,data +-ac_add_options --enable-necko-protocols=http,ftp,file,jar,viewsource,res,data +-##ac_add_options --enable-mathml +-#ac_add_options --enable-svg +- +-#ac_add_options --disable-installer +-#ac_add_options --disable-javaxpcom +-#ac_add_options --disable-activex +-#ac_add_options --disable-activex-scripting ++ac_add_options --prefix=/usr ++ac_add_options --libdir=/usr/lib ++ac_add_options --disable-tests ++ac_add_options --enable-necko-protocols=http,ftp,file,jar,viewsource,res,data + +-# Ubuntu 7.10 default flags: https://wiki.mozilla.org/Linux/Compiler_Options + ac_add_options --enable-default-toolkit=gtk2 + ac_add_options --enable-xft + ac_add_options --enable-pango + ac_add_options --enable-postscript + ac_add_options --disable-xprint + +-ac_add_options --enable-mathml ++#ac_add_options --enable-mathml + ac_add_options --enable-svg +-ac_add_options --enable-svg-renderer=cairo ++#ac_add_options --enable-svg-renderer=cairo + ac_add_options --enable-system-cairo + ac_add_options --enable-canvas + +-ac_add_options --with-system-png=/usr +-ac_add_options --with-system-jpeg=/usr +-ac_add_options --with-system-zlib=/usr ++ac_add_options --with-system-png ++ac_add_options --with-system-jpeg ++ac_add_options --with-system-zlib + + ac_add_options --enable-gnomevfs +-ac_add_options --enable-xinerama + ac_add_options --enable-single-profile + ac_add_options --disable-profilesharing + ac_add_options --enable-system-myspell + ++ac_add_options --disable-installer ++ac_add_options --disable-xpfe-components ++ac_add_options --with-default-mozilla-five-home=/usr/lib/kompozer ++ac_add_options --with-distribution-id=aur.archlinux.org ++ac_add_options --without-system-nspr ++ac_add_options --without-system-nss ++ ++#ac_add_options --disable-elf-dynstr-gc ++#ac_add_options --disable-gtktest ++ac_add_options --enable-strip ++#ac_add_options --disable-strip-lib ++ac_add_options --disable-updater ++ ++ac_add_options --enable-xinerama ++ac_add_options --enable-xpcom-fastload ++ ++ac_cv_visibility_pragma=no ++ ++ ++ diff --git a/pcr/libast/LICENSE.txt b/pcr/libast/LICENSE.txt new file mode 100644 index 000000000..67c75f783 --- /dev/null +++ b/pcr/libast/LICENSE.txt @@ -0,0 +1,21 @@ +/* + * Copyright (C) 1997-2004, Michael Jennings + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies of the Software, its documentation and marketing & publicity + * materials, and acknowledgment shall be given in the documentation, materials + * and software packages that this Software was used. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ diff --git a/pcr/libast/PKGBUILD b/pcr/libast/PKGBUILD new file mode 100644 index 000000000..ede9ab2ce --- /dev/null +++ b/pcr/libast/PKGBUILD @@ -0,0 +1,33 @@ +# $Id: PKGBUILD 40906 2011-03-01 14:45:04Z andrea $ +# Contributor: Daniel J Griffiths <ghost1227@archlinux.us> +# Contributor: Adam 'battlemidget' Stokes <adam.stokes@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=libast +pkgver=0.7 +pkgrel=3 +pkgdesc="The Library of Assorted Spiffy Things." +arch=('i686' 'x86_64') +url="http://eterm.sourceforge.net" +license=('BSD') +depends=('imlib2' 'pcre' 'libsm') +options=('!libtool') +source=(http://www.eterm.org/download/${pkgname}-${pkgver}.tar.gz LICENSE.txt) +md5sums=('a9ec3b2da317f35869316e6d9571d296' + '97071898559acc4f900ceb6cb9579492') + +build() { + cd ${srcdir}/${pkgname}-${pkgver} + + ./configure --prefix=/usr --with-x + make +} + +package() { + cd ${srcdir}/${pkgname}-${pkgver} + + make prefix=${pkgdir}/usr install + install -Dm644 ${srcdir}/LICENSE.txt ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE +} +md5sums=('a9ec3b2da317f35869316e6d9571d296' + '97071898559acc4f900ceb6cb9579492') diff --git a/pcr/libcacard/PKGBUILD b/pcr/libcacard/PKGBUILD new file mode 100755 index 000000000..0886b9847 --- /dev/null +++ b/pcr/libcacard/PKGBUILD @@ -0,0 +1,29 @@ +# Contributor: Jameson Pugh <imntreal@gmail.com> +# Maintainer : Parabola / GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=libcacard +pkgver=0.1.2 +pkgrel=3 +pkgdesc="Virtual Smart Card Emulator" +arch=('x86_64' 'i686') +url="http://spice-space.org" +license=('GPL') +options=('!libtool') +depends=('nss') +source=(http://spice-space.org/download/libcacard/$pkgname-$pkgver.tar.bz2) +md5sums=('ca61fd1d7feaa09e37011daac95c0168') + +build() { + cd "$srcdir/$pkgname-$pkgver" + ./configure --prefix=/usr + make +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir/" install +} + +# vim:set ts=2 sw=2 et: +md5sums=('ca61fd1d7feaa09e37011daac95c0168') diff --git a/pcr/libibus/PKGBUILD b/pcr/libibus/PKGBUILD new file mode 100644 index 000000000..1a934121a --- /dev/null +++ b/pcr/libibus/PKGBUILD @@ -0,0 +1,44 @@ +# $Id$ +# Contributor: Felix Yan <felixonmars@gmail.com> +# Contributor: Rainy <rainylau(at)gmail(dot)com> +# Contributor: Lee.MaRS <leemars at gmail dot com> +# Contributor: Daniel J Griffiths <ghost1227@archlinux.us> +# Contributor: Brad Fanella <bradfanella@archlinux.us> +# Maintainer : Parabola GNU / Linux-libre Aurélien Desbrières <aurelien@cwb.io> + +_pkgbase=ibus +pkgname=lib$_pkgbase +pkgver=1.4.99.20121109 +pkgrel=1 +pkgdesc="Library for Next Generation Input Bus for Linux" +arch=('i686' 'x86_64') +url="http://ibus.googlecode.com" +license=('LGPL') +depends=('glib2') +makedepends=('gobject-introspection' 'dconf' 'iso-codes' 'intltool' 'gtk2' 'gtk3') +options=('!libtool') +provides=("$_pkgbase=$pkgver") +conflicts=('ibus') +source=(http://ibus.googlecode.com/files/${_pkgbase}-${pkgver}.tar.gz) + +build() { + cd "$srcdir/${_pkgbase}-${pkgver}" + export PYTHON=python2 + ./configure \ + --prefix=/usr \ + --libexecdir=/usr/lib/ibus \ + --sysconfdir=/etc \ + --disable-gconf \ + --enable-dconf \ + --disable-memconf \ + --enable-ui + make +} + +package() { + cd "$srcdir/${_pkgbase}-${pkgver}" + make DESTDIR="${pkgdir}" install-pkgconfigDATA + cd src + make DESTDIR="${pkgdir}" install +} +md5sums=('be482479357210283e91a47f43a0a0fe') diff --git a/pcr/libnatpmp/PKGBUILD b/pcr/libnatpmp/PKGBUILD new file mode 100644 index 000000000..0fa0ff469 --- /dev/null +++ b/pcr/libnatpmp/PKGBUILD @@ -0,0 +1,28 @@ +# Maintainer: Pierre Bourdon <delroth@gmail.com> +# Maintainer: Parabola Gnu / Linux-libre Aurélien Desbrières + +pkgname=libnatpmp +pkgver=20120821 +pkgrel=1 +pkgdesc="A portable and fully compliant implementation of the NAT-PMP protocol" +arch=('i686' 'x86_64') +url="http://miniupnp.free.fr/libnatpmp.html" +license=('custom:BSD') +depends=('glibc') +makedepends=() +source=(http://miniupnp.free.fr/files/download.php?file=libnatpmp-$pkgver.tar.gz) + +build() { + cd "$srcdir/$pkgname-$pkgver" + make +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + make INSTALLPREFIX="$pkgdir/usr" \ + INSTALLDIRINC="$pkgdir/usr/include/libnatpmp" install + + # Needed by some packages + install -m 644 getgateway.h declspec.h "$pkgdir/usr/include/libnatpmp" +} +md5sums=('22a1225b890471a7750a9bf26eb863f7') diff --git a/pcr/libpng12/PKGBUILD b/pcr/libpng12/PKGBUILD new file mode 100644 index 000000000..df75ddeaa --- /dev/null +++ b/pcr/libpng12/PKGBUILD @@ -0,0 +1,48 @@ +# $Id: PKGBUILD 58551 2009-11-08 22:37:12Z eric $ +# Contributor: dorphell <archlinux.org: dorphell> +# Contributor: Travis Willard <archlinux.org: travis> +# Contributor: Douglas Soares de Andrade <archlinux.org: douglas> +# Maintainer: Jesse Jaara <gmail.com: jesse.jaara> + +pkgname=libpng12 +_realname=libpng +pkgver=1.2.50 +pkgrel=1 +pkgdesc="A collection of routines used to create PNG format graphics files" +arch=('i686' 'x86_64') +url="http://www.libpng.org/pub/png/libpng.html" +license=('custom') +depends=('zlib') +options=('!libtool') +source=("http://sourceforge.net/projects/libpng/files/libpng-${pkgver}.tar.xz" + "http://sourceforge.net/projects/apng/files/libpng/libpng12/libpng-${pkgver}-apng.patch.gz") + +build() { + cd "${srcdir}/${_realname}-${pkgver}" + + patch -Np0 -i "${srcdir}/libpng-${pkgver}-apng.patch" + + libtoolize --force --copy + aclocal + autoconf + automake --add-missing + + ./configure --prefix=/usr + + make ECHO=echo +} + +package() { + cd "${srcdir}/${_realname}-${pkgver}" + + make ECHO=echo DESTDIR="${pkgdir}" install + + rm -rf "${pkgdir}/usr/share" + rm -rf "${pkgdir}/usr/bin/libpng-config" + rm -rf "${pkgdir}/usr/lib/"{libpng.so,libpng.a} + rm -fr "${pkgdir}/usr/lib/pkgconfig/libpng.pc" + rm -rf "${pkgdir}/usr/include/"{pngconf.h,png.h} +} + +md5sums=('a3e00fccbfe356174ab515b5c00641c7' + 'b06ac3f6a6f982abc2036359665e82a9') diff --git a/pcr/liburcu/PKGBUILD b/pcr/liburcu/PKGBUILD new file mode 100644 index 000000000..ced12e005 --- /dev/null +++ b/pcr/liburcu/PKGBUILD @@ -0,0 +1,22 @@ +# Maintainer : Parabola GNU / Linux-libre Aurélien Desbrières <aurelien@cwb.io> + +pkgname=liburcu +pkgver=0.7.5 +pkgrel=1 +pkgdesc="LGPLv2.1 userspace RCU (read-copy-update) library" +arch=('i686' 'x86_64') +url="http://lttng.org/urcu" +license=('LGPL2.1') +source=(http://lttng.org/files/urcu/userspace-rcu-${pkgver}.tar.bz2) +md5sums=('2c5083fac662ecd38d6076dffa86259b') + +build() { + cd ${srcdir}/userspace-rcu-${pkgver} + ./configure --prefix=/usr + make +} + +package() { + cd ${srcdir}/userspace-rcu-${pkgver} + make DESTDIR=${pkgdir} install +} diff --git a/pcr/maruku/PKGBUILD b/pcr/maruku/PKGBUILD new file mode 100644 index 000000000..a647e5a12 --- /dev/null +++ b/pcr/maruku/PKGBUILD @@ -0,0 +1,24 @@ +# Contributor: Adam Lloyd <lloyda2 (at) rpi (dot) edu> +# Maintainter : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=maruku +pkgver=0.6.0 +pkgrel=1 +pkgdesc="A Markdown-superset interpreter" +arch=(any) +url="http://maruku.rubyforge.org/" +license=('GPL2') +depends=(ruby ruby-syntax) +makedepends=(rubygems) +source=(http://gems.rubyforge.org/gems/maruku-$pkgver.gem) +noextract=(maruku-$pkgver.gem) +md5sums=('6e2575e43b675eb4e15bbcee0fd1fd29') + +build() { + cd $srcdir + local _gemdir="$(ruby -rubygems -e'puts Gem.default_dir')" + gem install --ignore-dependencies -i "$pkgdir$_gemdir" maruku-$pkgver.gem +} + +# vim:set ts=2 sw=2 et: +md5sums=('6e2575e43b675eb4e15bbcee0fd1fd29') diff --git a/pcr/mit-scheme/PKGBUILD b/pcr/mit-scheme/PKGBUILD new file mode 100644 index 000000000..f769acfc8 --- /dev/null +++ b/pcr/mit-scheme/PKGBUILD @@ -0,0 +1,80 @@ +# Contributor: peter feigl <peter.feigl@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=mit-scheme +pkgver=9.1.1 +pkgrel=1 +pkgdesc="MIT/GNU Scheme" +arch=('x86_64' i686) +license=('GPL') +url="http://www.gnu.org/software/mit-scheme/" +groups= +provides=('mit-scheme') +depends=('libx11' 'texinfo' 'texlive-core') +optdepends=('mhash: support for mhash' 'gdbm: support for gdbm' + 'postgresql-libs: support for postresql' 'openssl: support for openssl' + 'mcrypt: support for mcrypt' 'db: support for berkeley db') +_my_arch=$(uname -m) +if [ ${_my_arch} = "x86_64" ] +then +_my_arch="x86-64" +md5sums=('268cb5ac97646f34742828ebc370586d') +else +_my_arch="i386" +md5sums=('e35590a06549d71edba723a719329070') +fi + +source=("http://ftp.gnu.org/gnu/mit-scheme/stable.pkg/${pkgver}/${pkgname}-${pkgver}-${_my_arch}.tar.gz") + +build() { + cd $startdir/src/${pkgname}-${pkgver}/src + ./configure --with-x --enable-native-code --prefix=/usr || return 1 + make compile-microcode || return 1 + make DESTDIR=${pkgdir} install || return 1 + # TODO: add indexer + echo Making Documentation + cd ../doc && ./configure --prefix=/usr && make -j 1 && make DESTDIR=${pkgdir} install && rm ${pkgdir}/usr/share/info/dir && mv ${pkgdir}/usr/share/man/man1/scheme.1 ${pkgdir}/usr/share/man/man1/mit-scheme.1 || return 0 +} + + +infodir=usr/share/info + +filelist=(mit-scheme-ffi.info mit-scheme-imail.info mit-scheme-ref.info mit-scheme-sos.info mit-scheme-user.info) + + + +post_install() { + + [[ -x usr/bin/install-info ]] || return 0 + + for file in "${filelist[@]}"; do + + install-info "$infodir/$file.gz" "$infodir/dir" 2> /dev/null + + done + +} + + + +post_upgrade() { + + post_install "$1" + +} + + + +pre_remove() { + + [[ -x usr/bin/install-info ]] || return 1 + + for file in "${filelist[@]}"; do + + install-info --delete "$infodir/$file.gz" "$infodir/dir" 2>/dev/null + + done + +} + +md5sums=('e35590a06549d71edba723a719329070') diff --git a/pcr/moblock/MoBlock-nfq.sh.patch b/pcr/moblock/MoBlock-nfq.sh.patch new file mode 100644 index 000000000..f9136c3c7 --- /dev/null +++ b/pcr/moblock/MoBlock-nfq.sh.patch @@ -0,0 +1,53 @@ +--- MoBlock-0.8/MoBlock-nfq.sh.orig 2008-11-30 03:44:02.000000000 -0500 ++++ MoBlock-0.8/MoBlock-nfq.sh 2008-12-01 18:56:15.000000000 -0500 +@@ -3,14 +3,10 @@ + # MoBlock.sh - MoBlock start script + # --------------------------------- + +-ACTIVATE_CHAINS=1 +-WHITE_TCP_IN="" +-WHITE_UDP_IN="" +-WHITE_TCP_OUT="" +-WHITE_UDP_OUT="" +-WHITE_TCP_FORWARD="" +-WHITE_UDP_FORWARD="" ++# Some configuration options have been moved to an external conf file ++# This should make maintenance and upgrading easier + ++. /etc/moblock/config + + PIDF=/var/run/moblock.pid + +@@ -78,6 +74,17 @@ + iptables -I MOBLOCK_FW -p udp --dport $PORT -j ACCEPT + done + ++# For added IP whitelisting support ++ ++for IP in $WHITE_IP_OUT; do ++ iptables -I MOBLOCK_OUT -p all -m iprange --dst-range $IP -j ACCEPT ++done ++for IP in $WHITE_IP_IN; do ++ iptables -I MOBLOCK_IN -p all -m iprange --src-range $IP -j ACCEPT ++done ++for IP in $WHITE_IP_FW; do ++ iptables -I MOBLOCK_FW -p all -m iprange --dst-range $IP -j ACCEPT ++done + + # Loopback traffic fix + +@@ -85,7 +92,8 @@ + iptables -I OUTPUT -p all -o lo -j ACCEPT + + # Here you can change block list and log files +-./moblock -p /etc/guarding.p2p ./moblock.log ++#./moblock -p /etc/guarding.p2p ./moblock.log ++/usr/bin/moblock -p /etc/moblock/banned.list /var/log/moblock.log >/dev/null 2>&1 + + # On exit delete the rules we added + +@@ -108,3 +116,4 @@ + if [ -f $PIDF ]; then + rm $PIDF; + fi ++ diff --git a/pcr/moblock/PKGBUILD b/pcr/moblock/PKGBUILD new file mode 100755 index 000000000..15504d1c1 --- /dev/null +++ b/pcr/moblock/PKGBUILD @@ -0,0 +1,55 @@ +# Contributor: Kevin Edmonds <edmondskevin@hotmail.com> +# Contributor: Filip Wojciechowski, filip at loka dot pl +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=moblock +pkgver=0.9rc2 +pkgrel=8 +pkgdesc="Console application that blocks connections from/to hosts listed in a file in peerguardian format" +arch=('i686' 'x86_64') +url="http://moblock.berlios.de/" +license=('GPL') +depends=(libnetfilter_queue iptables) +backup=(etc/moblock/config) +install=moblock.install +source=(http://download.berlios.de/moblock/MoBlock-0.8-i586.tar.bz2 \ + moblock_0.9_rc2.patch \ + MoBlock-nfq.sh.patch \ + moblock_include.patch \ + config \ + moblock-update \ + moblock \ + moblock.logrotate) + +build() { + cd $startdir/src/MoBlock-0.8 + + # patch to update moblock to the latest cvs version + patch -Np1 -i ../moblock_0.9_rc2.patch || return 1 + # add IP whitelisting and move configs to a separate conf file + patch -Np1 -i ../MoBlock-nfq.sh.patch || return 1 + # necessary to make moblock build with recent kernels + patch -Np1 -i ../moblock_include.patch || return 1 + + # change the CFLAGS for both i686 and x84_64 builds + sed -i "s#-Wall -O.*-ffast-math#$CFLAGS#g" Makefile + + # build + make || return 1 + + #move the files + install -D -m 755 ./MoBlock-nfq.sh $startdir/pkg/usr/bin/moblock-nfq || return 1 + install -D -m 744 ./moblock $startdir/pkg/usr/bin/moblock || return 1 + install -D -m 755 ../moblock-update $startdir/pkg/usr/bin/moblock-update || return 1 + install -D -m 744 ../moblock $startdir/pkg/etc/rc.d/moblock || return 1 + install -D -m 644 ../config $startdir/pkg/etc/moblock/config || return 1 + install -D -m 644 ../moblock.logrotate $startdir/pkg/etc/logrotate.d/moblock || return 1 +} +md5sums=('199967adb48b153be90db10fe21325c5' + 'e4e33c515677fa53eaca4616591d4e44' + 'e9f3c6b09f5e07dee948450780340ea3' + 'b23b5214965df59632de5cec317ddbde' + '840bb52a99529305e49212a69c9ced8a' + '49a16feb221d4d912cc7200313517f7b' + '1bdc949fcff0ce751a5096e489061513' + 'a8285fd3e68043cd8d21993d3dbbf9d4') diff --git a/pcr/moblock/config b/pcr/moblock/config new file mode 100644 index 000000000..7d7c287cc --- /dev/null +++ b/pcr/moblock/config @@ -0,0 +1,30 @@ +# Original MoBlock configuration options from MoBlock-nfq.sh file +ACTIVATE_CHAINS=1 +WHITE_TCP_IN="" +WHITE_UDP_IN="" +WHITE_TCP_OUT="" # Add "http https" here to prevent moblock from blocking webpages +WHITE_UDP_OUT="" +WHITE_TCP_FORWARD="" +WHITE_UDP_FORWARD="" + +# Added IP whitelisting support +WHITE_IP_IN="" +WHITE_IP_OUT="" +WHITE_IP_FW="" + +# Individual lists can be disabled by prefixing them with '!' +# Bluetack blacklists (http://www.bluetack.co.uk) +BLUETACK=(level1 level2 !level3 !edu ads-trackers-and-bad-pr0n bogon spyware spider Microsoft !proxy hijacked templist !rangetest dshield) + +# blocklist.org lists (currently doesn't work) +#BLOCKLIST=(p2p gov spy ads edu) + +# backup lists (might be outdated) +#PHOENIXLABS=(!p2b.p2b edu.txt spider.txt spyware.txt level1.txt !level2.txt !level3.txt) + +# Change to 'yes' if you want to backup up the old list before writing +# a new one. Only one backup copy will be kept. +BACKUP_OLD_LIST="no" + +# Options passed to wget +WGET_OPTS="-q" diff --git a/pcr/moblock/moblock b/pcr/moblock/moblock new file mode 100755 index 000000000..d88bd2e8d --- /dev/null +++ b/pcr/moblock/moblock @@ -0,0 +1,70 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +case "$1" in + start) + stat_busy "Starting MoBlock" + if [ ! -f /var/run/moblock.pid ] + then + /usr/bin/moblock-nfq & + if [ $? -gt 0 ] + then + stat_fail + else + add_daemon moblock + stat_done + fi + else + stat_fail + fi + ;; + update) + stat_busy "Updating MoBlock block list..." + error=0 + /usr/bin/moblock-update || error=1 + stat_busy "Updating MoBlock block list" + if [ $error -eq 1 ]; then + stat_fail + else + stat_done + fi + ;; + stats) + stat_busy "Logging stats to /var/log/MoBlock.stats" + PID=`cat /var/run/moblock.pid 2>/dev/null` + if [ ! -z "$PID" ]; then + /bin/kill -USR2 $PID + if [ $? -gt 0 ]; then + stat_fail + else + stat_done + fi + else + stat_fail + fi + ;; + stop) + stat_busy "Stopping MoBlock" + PID=`cat /var/run/moblock.pid 2>/dev/null` + if [ ! -z "$PID" ]; then + /bin/kill $PID + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon moblock + stat_done + fi + else + stat_fail + fi + ;; + restart) + $0 stop + sleep 2 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart|update|stats}" +esac diff --git a/pcr/moblock/moblock-update b/pcr/moblock/moblock-update new file mode 100755 index 000000000..aae861d13 --- /dev/null +++ b/pcr/moblock/moblock-update @@ -0,0 +1,174 @@ +#!/bin/bash + +. /etc/moblock/config + +CONF_DIR=/etc/moblock +TEMP_DIR=$(/usr/bin/mktemp -t -d moblock-updateXXXXXXXX) +LIST_FILE=banned.list + +USECOLOR="no" +. /etc/rc.d/functions +PREFIX_REG=" >" +PREFIX_HL="::" + +function extract() +{ + /usr/bin/find $TEMP_DIR -type f -name '*.gz' -o -name '*.zip' |\ + while read N + do + case "$N" in + *.zip) /usr/bin/unzip -oqq "$N" 2>/dev/null + if [ $? -gt 0 ]; then + rm -f "$N" + return 1 + else + rm -f "$N" + fi + ;; + *.gz) /bin/gunzip -f "$N" 2>/dev/null + if [ $? -gt 0 ]; then + rm -f "$N" + return 1 + fi + ;; + *) continue + ;; + esac + done + return 0 +} + +cd $TEMP_DIR + +printf "${C_SEPARATOR} ------------------------------\n" +printhl "Downloading and extracting files:\n" + +# Bluetack lists (with fallback) +for i in ${BLUETACK[@]} +do + if [ $(echo $i | /bin/grep '^[^\!]' | /usr/bin/wc -l) -eq 1 ]; then + stat_busy "BLUETACK '${i}'... " + /usr/bin/wget ${WGET_OPTS} "http://www.bluetack.co.uk/config/${i}.gz" && extract + if [ $? -gt 0 ] || [ ! -f ${i} ]; then + stat_fail + bfile=$i + if [ "$bfile" = "ads-trackers-and-bad-pr0n" ]; then + bfile="ads" + elif [ "$bfile" = "Microsoft" ];then + bfile="microsoft" + fi + stat_busy "[!!] BLUETACK '${i}' (fallback link)... " + /usr/bin/wget ${WGET_OPTS} "http://list.iblocklist.com/?list=bt_${bfile%%-*}" -O "${i}.gz" && extract + if [ $? -gt 0 ]; then + stat_fail + else + stat_done + fi + else + stat_done + fi + fi +done + +# Blocklist lists +for i in ${BLOCKLIST[@]} +do + if [ $(echo $i | /bin/grep '^[^\!]' | /usr/bin/wc -l) -eq 1 ]; then + stat_busy "BLOCKLIST '${i}'... " + /usr/bin/wget ${WGET_OPTS} "blocklist.org/${i}.p2b.gz" && extract + if [ $? -gt 0 ]; then + stat_fail + else + stat_done + fi + fi +done + +# Old phoenixlabs.org lists +for i in ${PHOENIXLABS[@]} +do + if [ $(echo $i | /bin/grep '^[^\!]' | /usr/bin/wc -l) -eq 1 ]; then + stat_busy "PHOENIXLABS '${i}'... " + /usr/bin/wget ${WGET_OPTS} "fox.phoenixlabs.org/${i}" && extract + if [ $? -gt 0 ]; then + stat_fail + else + stat_done + fi + fi +done + +if [ $(/bin/cat "$TEMP_DIR"/* | /usr/bin/wc -l) -eq 0 ]; then + printf "\n" + printhl "ERROR: No files were downloaded" + printf "${C_SEPARATOR} ------------------------------\n" + exit 1 +fi + +# Check files +printsep +printhl "Checking integrity of downloaded files:\n" + +/usr/bin/find -type f | while read N +do + stat_busy "File '$(echo $N | /bin/awk -F/ '{print $NF}')'... " + scan1=$(/bin/cat "$N" | /usr/bin/wc -l) + scan2=$(/bin/egrep -o ":[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*-[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*" "$N" | /usr/bin/wc -l) + if [ $scan1 -eq $scan2 ]; then + stat_done + else + if [ $scan2 -gt 0 ]; then + if [ $scan1 -gt $scan2 ]; then + stat_append "$(($scan1-$scan2)) of $scan1 entries failed validation; keeping the file" + stat_done + fi + else + stat_fail + stat_busy "[!!] Removing corrupted file... " + rm "$N" 2>/dev/null + if [ $? -gt 0 ]; then + stat_fail + exit 1 + else + stat_done + fi + fi + fi +done + +printsep +printhl "Saving the list:\n" + +# Make backup +if [ "$BACKUP_OLD_LIST" = "yes" ] && [ -f "$CONF_DIR"/"$LIST_FILE" ]; then + stat_busy "Backing up old list to '$CONF_DIR/$LIST_FILE.gz'... " + /bin/gzip -f "$CONF_DIR"/"$LIST_FILE" 2>/dev/null + if [ $? -gt 0 ]; then + stat_fail + else + stat_done + fi +fi + +# Save the list +stat_busy "Saving new list to '$CONF_DIR/$LIST_FILE'... " +/bin/cat "$TEMP_DIR"/* > "$CONF_DIR"/"$LIST_FILE" 2>&1 +if [ $? -gt 0 ]; then + stat_fail + exit 1 +else + stat_done + printf "\n" + printhl "Saved `cat "$CONF_DIR"/"$LIST_FILE" | wc -l` ranges" + printf "${C_SEPARATOR} ------------------------------\n" +fi + +rm -rf "$TEMP_DIR" + +# Restart MoBlock +if [ -f /var/run/moblock.pid ]; then + /bin/kill -HUP `cat /var/run/moblock.pid` >/dev/null 2>&1 +fi + +exit 0 + diff --git a/pcr/moblock/moblock.install b/pcr/moblock/moblock.install new file mode 100644 index 000000000..6afe1d5d9 --- /dev/null +++ b/pcr/moblock/moblock.install @@ -0,0 +1,26 @@ +post_install() { + #clean up after an old hack + if [ -h /usr/lib/libnfnetlink.so.1 ]; then + rm /usr/lib/libnfnetlink.so.1 + fi + echo "" + echo ">>> moblock-update script no longer uses /var/spool/moblock" + echo ">>> as a temporary directory. You can safely delete it." + echo "" +} + +post_upgrade() { + #clean up after an old hack + if [ -h /usr/lib/libnfnetlink.so.1 ]; then + rm /usr/lib/libnfnetlink.so.1 + fi + echo "" + echo ">>> moblock-update script no longer uses /var/spool/moblock" + echo ">>> as a temporary directory. You can safely delete it." + echo "" +} + +op=$1 +shift +$op $* + diff --git a/pcr/moblock/moblock.logrotate b/pcr/moblock/moblock.logrotate new file mode 100644 index 000000000..6ed64bb81 --- /dev/null +++ b/pcr/moblock/moblock.logrotate @@ -0,0 +1,11 @@ +"/var/log/moblock.log" /var/log/MoBlock.stats { + daily + missingok + notifempty + sharedscripts + postrotate + /usr/bin/test -f /var/run/moblock.pid && /bin/kill -HUP `cat /var/run/moblock.pid 2>/dev/null` 2>/dev/null || exit 0 + endscript + compress +} + diff --git a/pcr/moblock/moblock_0.9_rc2.patch b/pcr/moblock/moblock_0.9_rc2.patch new file mode 100644 index 000000000..69994ffe8 --- /dev/null +++ b/pcr/moblock/moblock_0.9_rc2.patch @@ -0,0 +1,912 @@ +diff -Naur MoBlock-0.8_orig/Changelog MoBlock-0.8/Changelog +--- MoBlock-0.8_orig/Changelog 2006-03-22 12:44:31.000000000 -0500 ++++ MoBlock-0.8/Changelog 2008-02-10 11:56:08.000000000 -0500 +@@ -4,6 +4,23 @@ + + --- + ++0.9: - fix for kernel 2.6.23 ++ - support for MARKing packets instead of DROPping or ++ ACCEPTing ++ - example start script that REJECTs packets instead of ++ DROPping. ++ - Integrated a patch from David Walluck for proper loading ++ of p2b files (version 2) ++ - command line options for logging to syslog, stdout ++ and log timestamping ++ - fixed loading pg1 lists with comments (lines starting ++ with '#') ++ - fixed a bug in ranges merge ++ - applied patch 2223 by badfish99: "IPs logged with bytes ++ reversed on big-endian m/c" ++ ++--- ++ + 0.8: - support for NFQUEUE-ing from iptables FORWARD chain (thx to + hyakki for suggestions and testing!) + - included patches from Maximilian Mehnert to support log file +diff -Naur MoBlock-0.8_orig/Makefile MoBlock-0.8/Makefile +--- MoBlock-0.8_orig/Makefile 2006-03-22 12:44:31.000000000 -0500 ++++ MoBlock-0.8/Makefile 2007-11-22 08:10:44.000000000 -0500 +@@ -1,4 +1,3 @@ +- + # To use the old-soon-to-be-deprecated libipq interface + # uncomment the following line and comment the NFQUEUE one, + # then comment the gcc line with netfilter_queue and +@@ -7,7 +6,7 @@ + #QUEUE_LIB=LIBIPQ + QUEUE_LIB=NFQUEUE + +-CFLAGS=-Wall -O2 -march=i586 -mtune=i686 -fomit-frame-pointer -ffast-math \ ++CFLAGS=-Wall -O3 -march=i586 -mtune=i686 -fomit-frame-pointer -ffast-math \ + -D_GNU_SOURCE -D$(QUEUE_LIB) -L/usr/include/libipq + CC=gcc + +diff -Naur MoBlock-0.8_orig/MoBlock-nfq-reject.sh MoBlock-0.8/MoBlock-nfq-reject.sh +--- MoBlock-0.8_orig/MoBlock-nfq-reject.sh 1969-12-31 19:00:00.000000000 -0500 ++++ MoBlock-0.8/MoBlock-nfq-reject.sh 2007-11-22 08:10:44.000000000 -0500 +@@ -0,0 +1,104 @@ ++#!/bin/sh ++# ++# MoBlock.sh - MoBlock start script ++# --------------------------------- ++ ++ACTIVATE_CHAINS=1 ++WHITE_TCP_IN="" ++WHITE_UDP_IN="" ++WHITE_TCP_OUT="" ++WHITE_UDP_OUT="" ++WHITE_TCP_FORWARD="" ++WHITE_UDP_FORWARD="" ++REJECT_MARK="10" ++ ++PIDF=/var/run/moblock.pid ++ ++FNAME=`basename $0 .sh` ++MODE=`echo $FNAME|awk -F- '{print $2}'` ++ ++if [ -f $PIDF ]; then ++ PID=`cat $PIDF` ++ if [ `ps -p $PID|wc -l` -gt 1 ]; then ++ echo "$0: $PIDF exists and processs seems to be running. Exiting." ++ exit 1; ++ fi; ++fi; ++ ++if [ $MODE == "ipq" ]; then ++ modprobe ip_queue ++ TARGET="QUEUE" ++elif [ $MODE == "nfq" ]; then ++ modprobe ipt_NFQUEUE ++ TARGET="NFQUEUE" ++fi; ++ ++modprobe ipt_state ++ ++# Filter all traffic, edit for your needs ++ ++iptables -N MOBLOCK_IN ++iptables -N MOBLOCK_OUT ++iptables -N MOBLOCK_FW ++ ++if [ $ACTIVATE_CHAINS -eq 1 ]; then ++ iptables -I INPUT -p all -m state --state NEW -j MOBLOCK_IN ++ iptables -I OUTPUT -p all -m state --state NEW -j MOBLOCK_OUT ++ iptables -I FORWARD -p all -m state --state NEW -j MOBLOCK_FW ++fi; ++ ++ ++iptables -I MOBLOCK_IN -p all -j $TARGET ++ ++iptables -I MOBLOCK_OUT -p all -j $TARGET ++ ++iptables -I MOBLOCK_FW -p all -j $TARGET ++ ++for PORT in $WHITE_TCP_OUT; do ++ iptables -I MOBLOCK_OUT -p tcp --dport $PORT -j ACCEPT ++done ++for PORT in $WHITE_UDP_OUT; do ++ iptables -I MOBLOCK_OUT -p udp --dport $PORT -j ACCEPT ++done ++ ++for PORT in $WHITE_TCP_IN; do ++ iptables -I MOBLOCK_IN -p tcp --dport $PORT -j ACCEPT ++done ++for PORT in $WHITE_UDP_IN; do ++ iptables -I MOBLOCK_IN -p udp --dport $PORT -j ACCEPT ++done ++ ++for PORT in $WHITE_TCP_FORWARD; do ++ iptables -I MOBLOCK_FW -p tcp --dport $PORT -j ACCEPT ++done ++for PORT in $WHITE_UDP_FORWARD; do ++ iptables -I MOBLOCK_FW -p udp --dport $PORT -j ACCEPT ++done ++ ++iptables -I OUTPUT -p all -m state --state NEW -m mark --mark $REJECT_MARK -j REJECT ++iptables -I FORWARD -p all -m state --state NEW -m mark --mark $REJECT_MARK -j REJECT ++ ++# Here you can change block list and log files ++./moblock -d /etc/ipfilter.dat -t -s -r $REJECT_MARK ./moblock.log ++ ++# On exit delete the rules we added ++ ++if [ $ACTIVATE_CHAINS -eq 1 ]; then ++ iptables -D INPUT -p all -m state --state NEW -j MOBLOCK_IN ++ iptables -D OUTPUT -p all -m state --state NEW -j MOBLOCK_OUT ++ iptables -D FORWARD -p all -m state --state NEW -j MOBLOCK_FW ++fi; ++ ++iptables -D OUTPUT -p all -m state --state NEW -m mark --mark $REJECT_MARK -j REJECT ++iptables -D FORWARD -p all -m state --state NEW -m mark --mark $REJECT_MARK -j REJECT ++ ++iptables -F MOBLOCK_IN ++iptables -X MOBLOCK_IN ++iptables -F MOBLOCK_OUT ++iptables -X MOBLOCK_OUT ++iptables -F MOBLOCK_FW ++iptables -X MOBLOCK_FW ++ ++if [ -f $PIDF ]; then ++ rm $PIDF; ++fi +diff -Naur MoBlock-0.8_orig/MoBlock.c MoBlock-0.8/MoBlock.c +--- MoBlock-0.8_orig/MoBlock.c 2006-03-22 12:44:31.000000000 -0500 ++++ MoBlock-0.8/MoBlock.c 2008-02-10 11:56:08.000000000 -0500 +@@ -35,6 +35,8 @@ + #include <linux/netfilter_ipv4.h>
+ #include <signal.h>
+ #include <regex.h>
++#include <time.h>
++#include <syslog.h>
+
+ // in Makefile define LIBIPQ to use soon-to-be-deprecated ip_queue,
+ // NFQUEUE for ipt_NFQUEUE (from kernel 2.6.14)
+@@ -46,7 +48,7 @@ + #include <libnetfilter_queue/libnetfilter_queue.h>
+ #endif
+
+-#define MB_VERSION "0.8"
++#define MB_VERSION "0.9rc2"
+
+ #define BUFSIZE 2048
+ #define PAYLOADSIZE 21
+@@ -58,6 +60,9 @@ + #define SRC_ADDR(payload) (*(in_addr_t *)((payload)+12))
+ #define DST_ADDR(payload) (*(in_addr_t *)((payload)+16))
+
++#define likely(x) __builtin_expect((x),1)
++#define unlikely(x) __builtin_expect((x),0)
++
+ // rbt datatypes/functions
+
+ typedef enum {
+@@ -96,7 +101,8 @@ + char filename[100];
+ } blocklist_info;
+
+-int merged_ranges=0, skipped_ranges=0;
++u_int32_t merged_ranges=0, skipped_ranges=0, accept_mark=0, reject_mark=0;
++u_int8_t log2syslog=0, log2file=0, log2stdout=0, timestamp=0;
+
+ #ifdef LIBIPQ
+ static void die(struct ipq_handle *h)
+@@ -112,11 +118,13 @@ + static char buf[2][ sizeof("aaa.bbb.ccc.ddd") ];
+ static short int index=0;
+
++ ip = ntohl(ip);
++
+ sprintf(buf[index],"%d.%d.%d.%d",
+- (ip) & 0xff,
+- (ip >> 8) & 0xff,
++ (ip >> 24) & 0xff,
+ (ip >> 16) & 0xff,
+- (ip >> 24) & 0xff);
++ (ip >> 8) & 0xff,
++ (ip) & 0xff);
+
+ if (index) {
+ index=0;
+@@ -134,10 +142,38 @@ + fflush(stdout);
+ }
+
++void log_action(char *msg)
++{
++ char timestr[30];
++ time_t tv;
++
++ if (timestamp) {
++ tv = time(NULL);
++ strncpy(timestr, ctime(&tv), 19);
++ timestr[19] = '\0';
++ strcat(timestr, "| ");
++ }
++ else strcpy(timestr, "");
++
++ if (log2syslog) {
++ syslog(LOG_INFO, msg);
++ }
++
++ if (log2file) {
++ fprintf(logfile,"%s%s",timestr,msg);
++ fflush(logfile);
++ }
++
++ if (log2stdout) {
++ fprintf(stdout,"%s%s",timestr,msg);
++ }
++}
++
+ inline void ranged_insert(char *name,char *ipmin,char *ipmax)
+ {
+ recType tmprec;
+ int ret;
++ char msgbuf[255];
+
+ if ( strlen(name) > (BNAME_LEN-1) ) {
+ strncpy(tmprec.blockname, name, BNAME_LEN);
+@@ -149,10 +185,11 @@ + if ( (ret=insert(ntohl(inet_addr(ipmin)),&tmprec)) != STATUS_OK )
+ switch(ret) {
+ case STATUS_MEM_EXHAUSTED:
+- fprintf(logfile,"Error inserting range, MEM_EXHAUSTED.\n");
++ log_action("Error inserting range, MEM_EXHAUSTED.\n");
+ break;
+ case STATUS_DUPLICATE_KEY:
+- fprintf(logfile,"Duplicated range ( %s )\n",name);
++ sprintf(msgbuf,"Duplicated range ( %s )\n",name);
++ log_action(msgbuf);
+ break;
+ case STATUS_MERGED:
+ merged_ranges++;
+@@ -161,8 +198,9 @@ + skipped_ranges++;
+ break;
+ default:
+- fprintf(logfile,"Unexpected return value from ranged_insert()!\n");
+- fprintf(logfile,"Return value was: %d\n",ret);
++ log_action("Unexpected return value from ranged_insert()!\n");
++ sprintf(msgbuf,"Return value was: %d\n",ret);
++ log_action(msgbuf);
+ break;
+ }
+ }
+@@ -177,15 +215,19 @@ + regex_t regmain;
+ regmatch_t matches[4];
+ int i;
++ char msgbuf[255];
+
+ regcomp(®main, "^(.*)[:]([0-9.]*)[-]([0-9.]*)$", REG_EXTENDED);
+
+ fp=fopen(filename,"r");
+ if ( fp == NULL ) {
+- fprintf(logfile,"Error opening %s, aborting...\n", filename);
++ sprintf(msgbuf,"Error opening %s, aborting...\n", filename);
++ log_action(msgbuf);
+ exit(-1);
+ }
+ while ( (count=getline(&line,&len,fp)) != -1 ) {
++ if ( line[0] == '#' ) //comment line, skip
++ continue;
+ for(i=count-1; i>=0; i--) {
+ if ((line[i] == '\r') || (line[i] == '\n') || (line[i] == ' ')) {
+ line[i] = 0;
+@@ -207,36 +249,78 @@ + line+matches[3].rm_so);
+ ntot++;
+ } else {
+- fprintf(logfile,"Short guarding.p2p line %s, skipping it...\n", line);
++ sprintf(msgbuf,"Short guarding.p2p line %s, skipping it...\n", line);
++ log_action(msgbuf);
+ }
+ }
+ if (line)
+ free(line);
+ fclose(fp);
+- fprintf(logfile,"Ranges loaded: %d\n",ntot);
+- printf("* Ranges loaded: %d\n",ntot);
++ sprintf(msgbuf, "* Ranges loaded: %d\n", ntot);
++ log_action(msgbuf);
++ if ( !log2stdout )
++ printf(msgbuf);
+ }
+
+-void loadlist_pg2(char *filename) // experimental, no check for list sanity
++void loadlist_pg2(char *filename) // supports only v2 files
+ {
+ FILE *fp;
+- int i,retval,ntot=0;
+- char name[100],ipmin[16]; // hope we don't have a list with longer names...
++ int i, j, c, retval=0, ntot=0;
++ char name[100],ipmin[16], msgbuf[255]; // hope we don't have a list with longer names...
+ uint32_t start_ip, end_ip;
+ struct in_addr startaddr,endaddr;
++ size_t s;
+
+ fp=fopen(filename,"r");
+ if ( fp == NULL ) {
+- fprintf(logfile,"Error opening %s, aborting...\n", filename);
++ sprintf(msgbuf, "Error opening %s, aborting...\n", filename);
++ log_action(msgbuf);
+ exit(-1);
+ }
+
+- fgetc(fp); // skip first 4 bytes, don't know what they are
+- fgetc(fp);
+- fgetc(fp);
+- retval=fgetc(fp);
++ for (j=0; j<4; j++) {
++ c=fgetc(fp);
++ if ( c != 0xff ) {
++ sprintf(msgbuf,"Byte %d: 0x%x != 0xff, aborting...\n", j+1, c);
++ log_action(msgbuf);
++ fclose(fp);
++ exit(-1);
++ }
++ }
++
++ c=fgetc(fp);
++ if ( c != 'P' ) {
++ sprintf(msgbuf,"Byte 5: %c != P, aborting...\n", c);
++ log_action(msgbuf);
++ fclose(fp);
++ exit(-1);
++ }
++
++ c=fgetc(fp);
++ if ( c != '2' ) {
++ sprintf(msgbuf,"Byte 6: %c != 2, aborting...\n", c);
++ log_action(msgbuf);
++ fclose(fp);
++ exit(-1);
++ }
+
+- while ( retval != EOF ) {
++ c=fgetc(fp);
++ if ( c != 'B' ) {
++ sprintf(msgbuf,"Byte 7: %c != B, aborting...\n", c);
++ log_action(msgbuf);
++ fclose(fp);
++ exit(-1);
++ }
++
++ c=fgetc(fp);
++ if ( c != 0x02 ) {
++ sprintf(msgbuf,"Byte 8: version: %d != 2, aborting...\n", c);
++ log_action(msgbuf);
++ fclose(fp);
++ exit(-1);
++ }
++
++ do {
+ i=0;
+ do {
+ name[i]=fgetc(fp);
+@@ -244,9 +328,22 @@ + } while ( name[i-1] != 0x00 && name[i-1] != EOF);
+ if ( name[i-1] != EOF ) {
+ name[i-1]='\0';
+- fread(&start_ip,4,1,fp);
+- fread(&end_ip,4,1,fp);
+- startaddr.s_addr=start_ip;
++ s=fread(&start_ip,4,1,fp);
++ if ( s != 1 ) {
++ sprintf(msgbuf,"Failed to read start IP: %d != 1, aborting...\n", (int)s);
++ log_action(msgbuf);
++ fclose(fp);
++ exit(-1);
++ }
++ s=fread(&end_ip,4,1,fp);
++ if ( s != 1 ) {
++ sprintf(msgbuf,"Failed to read end IP: %d != 1, aborting...\n", (int)s);
++ log_action(msgbuf);
++ fclose(fp);
++ exit(-1);
++ }
++
++ startaddr.s_addr=start_ip;
+ endaddr.s_addr=end_ip;
+ strcpy(ipmin,inet_ntoa(startaddr));
+ ranged_insert(name,ipmin,inet_ntoa(endaddr));
+@@ -255,22 +352,25 @@ + else {
+ retval=EOF;
+ }
+- }
++ } while ( retval != EOF );
+ fclose(fp);
+- fprintf(logfile,"Ranges loaded: %d\n",ntot);
+- printf("* Ranges loaded: %d\n",ntot);
++ sprintf(msgbuf, "* Ranges loaded: %d\n",ntot);
++ log_action(msgbuf);
++ if ( !log2stdout )
++ printf(msgbuf);
+ }
+
+ void loadlist_dat(char *filename)
+ {
+ FILE *fp;
+ int ntot=0;
+- char readbuf[200], *name, start_ip[16], end_ip[16];
++ char readbuf[200], *name, start_ip[16], end_ip[16], msgbuf[255];
+ unsigned short ip1_0, ip1_1, ip1_2, ip1_3, ip2_0, ip2_1, ip2_2, ip2_3;
+
+ fp=fopen(filename,"r");
+ if ( fp == NULL ) {
+- fprintf(logfile,"Error opening %s, aborting...\n", filename);
++ sprintf(msgbuf,"Error opening %s, aborting...\n", filename);
++ log_action(msgbuf);
+ exit(-1);
+ }
+
+@@ -286,38 +386,45 @@ + ntot++;
+ }
+ fclose(fp);
+- fprintf(logfile,"Ranges loaded: %d\n",ntot);
+- printf("* Ranges loaded: %d\n",ntot);
++ sprintf(msgbuf, "* Ranges loaded: %d\n", ntot);
++ log_action(msgbuf);
++ if ( !log2stdout )
++ printf(msgbuf);
+ }
+
+ void reopen_logfile(void)
+ {
++ char msgbuf[255];
++
+ if (logfile != NULL) {
+ fclose(logfile);
+ logfile=NULL;
+ }
+ logfile=fopen(logfile_name,"a");
+ if (logfile == NULL) {
+- fprintf(stderr, "Unable to open logfile %s\n", logfile_name);
++ sprintf(msgbuf, "Unable to open logfile %s\n", logfile_name);
++ log_action(msgbuf);
+ exit(-1);
+ }
+- fprintf(logfile, "Reopening logfile.\n");
++ log_action("Reopening logfile.\n");
+ }
+
+ void my_sahandler(int sig)
+ {
++ char msgbuf[255];
++
+ switch( sig ) {
+ case SIGUSR1:
+- fprintf(logfile,"Got SIGUSR1! Dumping stats...\n");
++ log_action("Got SIGUSR1! Dumping stats...\n");
+ ll_show(logfile);
+ reopen_logfile();
+ break;
+ case SIGUSR2:
+- fprintf(logfile,"Got SIGUSR2! Dumping stats to /var/log/MoBlock.stats\n");
++ log_action("Got SIGUSR2! Dumping stats to /var/log/MoBlock.stats\n");
+ ll_log();
+ break;
+ case SIGHUP:
+- fprintf(logfile,"\nGot SIGHUP! Dumping and resetting stats, reloading blocklist\n\n");
++ log_action("Got SIGHUP! Dumping and resetting stats, reloading blocklist\n");
+ ll_log();
+ ll_clear(); // clear stats list
+ destroy_tree(); // clear loaded ranges
+@@ -332,17 +439,18 @@ + loadlist_pg2(blocklist_info.filename);
+ break;
+ default:
+- fprintf(logfile,"Unknown blocklist type while reloading list, contact the developer!\n");
++ log_action("Unknown blocklist type while reloading list, contact the developer!\n");
+ break;
+ }
+ reopen_logfile();
+ break;
+ case SIGTERM:
+- fprintf(logfile,"Got SIGTERM! Dumping stats and exiting.\n");
++ log_action("Got SIGTERM! Dumping stats and exiting.\n");
+ ll_log();
+ exit(0);
+ default:
+- fprintf(logfile,"Received signal = %d but not handled\n",sig);
++ sprintf(msgbuf,"Received signal = %d but not handled\n",sig);
++ log_action(msgbuf);
+ break;
+ }
+ }
+@@ -378,7 +486,7 @@ + {
+ int id=0, status=0;
+ struct nfqnl_msg_packet_hdr *ph;
+- char *payload;
++ char *payload, msgbuf[255];
+ recType tmprec;
+
+ ph = nfq_get_msg_packet_hdr(nfa);
+@@ -389,34 +497,78 @@ + switch (ph->hook) {
+ case NF_IP_LOCAL_IN:
+ if ( find(ntohl(SRC_ADDR(payload)),&tmprec) == STATUS_OK ) {
++ // we drop the packet instead of rejecting
++ // we don't want the other host to know we are alive
+ status=nfq_set_verdict(qh, id, NF_DROP, 0, NULL);
+- fprintf(logfile,"Blocked IN: %s,hits: %d,SRC: %s\n",tmprec.blockname,tmprec.hits,ip2str(SRC_ADDR(payload)));
+- } else status = nfq_set_verdict(qh, id, NF_ACCEPT, 0, NULL);
++ sprintf(msgbuf,"Blocked IN: %s,hits: %d,SRC: %s\n",tmprec.blockname,tmprec.hits,ip2str(SRC_ADDR(payload)));
++ log_action(msgbuf);
++ }
++ else if ( unlikely(accept_mark) ) {
++ // we set the user-defined accept_mark and set NF_REPEAT verdict
++ // it's up to other iptables rules to decide what to do with this marked packet
++ status = nfq_set_verdict_mark(qh, id, NF_REPEAT, accept_mark, 0, NULL);
++ }
++ else {
++ // no accept_mark, just NF_ACCEPT the packet
++ status = nfq_set_verdict(qh, id, NF_ACCEPT, 0, NULL);
++ }
+ break;
+ case NF_IP_LOCAL_OUT:
+ if ( find(ntohl(DST_ADDR(payload)),&tmprec) == STATUS_OK ) {
+- status=nfq_set_verdict(qh, id, NF_DROP, 0, NULL);
+- fprintf(logfile,"Blocked OUT: %s,hits: %d,DST: %s\n",tmprec.blockname,tmprec.hits,ip2str(DST_ADDR(payload)));
+- } else status = nfq_set_verdict(qh, id, NF_ACCEPT, 0, NULL);
++ if ( likely(reject_mark) ) {
++ // we set the user-defined reject_mark and set NF_REPEAT verdict
++ // it's up to other iptables rules to decide what to do with this marked packet
++ status = nfq_set_verdict_mark(qh, id, NF_REPEAT, reject_mark, 0, NULL);
++ }
++ else {
++ status = nfq_set_verdict(qh, id, NF_DROP, 0, NULL);
++ }
++ sprintf(msgbuf,"Blocked OUT: %s,hits: %d,DST: %s\n",tmprec.blockname,tmprec.hits,ip2str(DST_ADDR(payload)));
++ log_action(msgbuf);
++ }
++ else if ( unlikely(accept_mark) ) {
++ // we set the user-defined accept_mark and set NF_REPEAT verdict
++ // it's up to other iptables rules to decide what to do with this marked packet
++ status = nfq_set_verdict_mark(qh, id, NF_REPEAT, accept_mark, 0, NULL);
++ }
++ else {
++ // no accept_mark, just NF_ACCEPT the packet
++ status = nfq_set_verdict(qh, id, NF_ACCEPT, 0, NULL);
++ }
+ break;
+ case NF_IP_FORWARD:
+ if ( find2(ntohl(SRC_ADDR(payload)), ntohl(DST_ADDR(payload)), &tmprec) == STATUS_OK ) {
+- status=nfq_set_verdict(qh, id, NF_DROP, 0, NULL);
+- fprintf(logfile,"Blocked FWD: %s,hits: %d,SRC: %s, DST: %s\n",
++ if ( likely(reject_mark) ) {
++ // we set the user-defined reject_mark and set NF_REPEAT verdict
++ // it's up to other iptables rules to decide what to do with this marked packet
++ status = nfq_set_verdict_mark(qh, id, NF_REPEAT, reject_mark, 0, NULL);
++ }
++ else {
++ status = nfq_set_verdict(qh, id, NF_DROP, 0, NULL);
++ }
++ sprintf(msgbuf,"Blocked FWD: %s,hits: %d,SRC: %s, DST: %s\n",
+ tmprec.blockname, tmprec.hits, ip2str(SRC_ADDR(payload)), ip2str(DST_ADDR(payload)));
+- fflush(logfile);
+- } else status = nfq_set_verdict(qh, id, NF_ACCEPT, 0, NULL);
++ log_action(msgbuf);
++ }
++ else if ( unlikely(accept_mark) ) {
++ // we set the user-defined accept_mark and set NF_REPEAT verdict
++ // it's up to other iptables rules to decide what to do with this marked packet
++ status = nfq_set_verdict_mark(qh, id, NF_REPEAT, accept_mark, 0, NULL);
++ }
++ else {
++ // no accept_mark, just NF_ACCEPT the packet
++ status = nfq_set_verdict(qh, id, NF_ACCEPT, 0, NULL);
++ }
+ break;
+ default:
+- fprintf(logfile,"Not NF_LOCAL_IN/OUT/FORWARD packet!\n");
++ log_action("Not NF_LOCAL_IN/OUT/FORWARD packet!\n");
+ break;
+ }
+ }
+ else {
+- fprintf(logfile,"NFQUEUE: can't get msg packet header.\n");
++ log_action("NFQUEUE: can't get msg packet header.\n");
+ return(1); // from nfqueue source: 0 = ok, >0 = soft error, <0 hard error
+ }
+- fflush(logfile);
+ return(0);
+ }
+ #endif
+@@ -492,46 +644,48 @@ + struct nfq_q_handle *qh;
+ struct nfnl_handle *nh;
+ int fd,rv;
+- char buf[BUFSIZE];
++ char buf[BUFSIZE], msgbuf[255];
+
+ h = nfq_open();
+ if (!h) {
+- fprintf(logfile, "Error during nfq_open()\n");
++ log_action("Error during nfq_open()\n");
+ exit(-1);
+ }
+
+ if (nfq_unbind_pf(h, AF_INET) < 0) {
+- fprintf(logfile, "error during nfq_unbind_pf()\n");
+- exit(-1);
++ log_action("error during nfq_unbind_pf()\n");
++ //exit(-1);
+ }
+
+ if (nfq_bind_pf(h, AF_INET) < 0) {
+- fprintf(logfile, "Error during nfq_bind_pf()\n");
++ log_action("Error during nfq_bind_pf()\n");
+ exit(-1);
+ }
+
+- fprintf(logfile,"NFQUEUE: binding to queue '%hd'\n", queuenum);
++ sprintf(msgbuf,"NFQUEUE: binding to queue '%hd'\n", queuenum);
++ log_action(msgbuf);
+ qh = nfq_create_queue(h, queuenum, &nfqueue_cb, NULL);
+ if (!qh) {
+- fprintf(logfile, "error during nfq_create_queue()\n");
++ log_action("error during nfq_create_queue()\n");
+ exit(-1);
+ }
+
+ if (nfq_set_mode(qh, NFQNL_COPY_PACKET, PAYLOADSIZE) < 0) {
+- fprintf(logfile, "can't set packet_copy mode\n");
++ log_action("can't set packet_copy mode\n");
+ exit(-1);
+ }
+
+ nh = nfq_nfnlh(h);
+ fd = nfnl_fd(nh);
+
+- while ((rv = recv(fd, buf, sizeof(buf), 0)) && rv >= 0) {
++ while ((rv = recv(fd, buf, sizeof(buf), 0)) >= 0) {
+ nfq_handle_packet(h, buf, rv);
+ }
+
+- printf("NFQUEUE: unbinding from queue 0\n");
++ log_action("NFQUEUE: unbinding from queue 0\n");
+ nfq_destroy_queue(qh);
+ nfq_close(h);
++ nfq_unbind_pf(h, AF_INET);
+ return(0);
+ #endif
+
+@@ -540,11 +694,16 @@ + void print_options(void)
+ {
+ printf("\nMoBlock %s by Morpheus",MB_VERSION);
+- printf("\nSyntax: MoBlock -dnp <blocklist> [-b] [-q 0-65535] <logfile>\n\n");
++ printf("\nSyntax: MoBlock -dnp <blocklist> [-q 0-65535] <logfile>\n\n");
+ printf("\t-d\tblocklist is an ipfilter.dat file\n");
+ printf("\t-n\tblocklist is a peerguardian 2.x file (.p2b)\n");
+ printf("\t-p\tblocklist is a peerguardian file (.p2p)\n");
+ printf("\t-q\t0-65535 NFQUEUE number (as specified in --queue-num with iptables)\n");
++ printf("\t-r MARK\tmark packet with MARK instead of DROP\n");
++ printf("\t-a MARK\tmark packet with MARK instead of ACCEPT\n");
++ printf("\t-l\tlog to stdout\n");
++ printf("\t-s\tlog to syslog\n");
++ printf("\t-t\tlog timestamping\n\n");
+ }
+
+ void on_quit()
+@@ -556,6 +715,7 @@ + {
+ int ret=0;
+ unsigned short int queuenum=0;
++ char msgbuf[255];
+
+ if (argc < 3) {
+ print_options();
+@@ -591,10 +751,11 @@ + }
+ logfile_name=malloc(strlen(argv[argc-1])+1);
+ strcpy(logfile_name,argv[argc-1]);
++ log2file = 1;
+ printf("* Logging to %s\n",logfile_name);
+
+ while (1) { //scan command line options
+- ret=getopt(argc, argv, "d:n:p:q:");
++ ret=getopt(argc, argv, "d:n:p:q:a:r:stl");
+ if ( ret == -1 ) break;
+
+ switch (ret) {
+@@ -619,6 +780,28 @@ + case 'q':
+ queuenum=(unsigned short int)atoi(optarg);
+ break;
++ case 'r':
++ reject_mark=(u_int32_t)atoi(optarg);
++ printf("* DROP MARK: %d\n", reject_mark);
++ reject_mark=htonl(reject_mark);
++ break;
++ case 'a':
++ accept_mark=(u_int32_t)atoi(optarg);
++ printf("* ACCEPT MARK: %d\n", accept_mark);
++ accept_mark=htonl(accept_mark);
++ break;
++ case 's':
++ log2syslog = 1;
++ printf("* Logging to syslog\n");
++ break;
++ case 't':
++ timestamp = 1;
++ printf("* Log timestamp enabled\n");
++ break;
++ case 'l':
++ log2stdout = 1;
++ printf("* Log to stdout enabled\n");
++ break;
+ case '?': // unknown option
+ print_options();
+ exit(-1);
+@@ -626,10 +809,14 @@ + }
+ }
+
+- printf("* Merged ranges: %d\n", merged_ranges);
+- fprintf(logfile, "Merged ranges: %d\n", merged_ranges);
+- printf("* Skipped useless ranges: %d\n", skipped_ranges);
+- fprintf(logfile,"Skipped useless ranges: %d\n", skipped_ranges);
++ sprintf(msgbuf, "* Merged ranges: %d\n", merged_ranges);
++ log_action(msgbuf);
++ if ( !log2stdout )
++ printf(msgbuf);
++ sprintf(msgbuf,"* Skipped useless ranges: %d\n", skipped_ranges);
++ log_action(msgbuf);
++ if ( !log2stdout )
++ printf(msgbuf);
+ fflush(NULL);
+
+ netlink_loop(queuenum);
+diff -Naur MoBlock-0.8_orig/README MoBlock-0.8/README +--- MoBlock-0.8_orig/README 2006-03-22 12:44:31.000000000 -0500 ++++ MoBlock-0.8/README 2007-11-22 08:10:44.000000000 -0500 +@@ -1,5 +1,5 @@ + +-MoBlock README v0.8 ++MoBlock README v0.9 + http://moblock.berlios.de + + .Introduction. +@@ -47,6 +47,22 @@ + ip_conntrack 40044 1 ipt_state + iptable_filter 2176 1 + ip_tables 17600 3 ipt_NFQUEUE,ipt_state,iptable_filter ++ ++ ...and these with kernel 2.6.23 using NFQUEUE interface: ++ ++ nfnetlink_queue 9344 1 ++ nfnetlink 4568 2 nfnetlink_queue ++ ipt_REJECT 3520 2 ++ xt_mark 1600 2 ++ nf_conntrack_ipv4 12424 5 ++ iptable_filter 2308 1 ++ ip_tables 10328 1 iptable_filter ++ xt_state 1984 5 ++ nf_conntrack 48356 2 nf_conntrack_ipv4,xt_state ++ xt_NFQUEUE 1664 3 ++ x_tables 11396 5 ipt_REJECT,xt_mark,ip_tables,xt_state,xt_NFQUEUE ++ ++ (notice that ipt_NFQUEUE has changed to xt_NFQUEUE, same thing for other modules too) + + 2) A valid guarding.p2p/ipfilter.dat/p2p.p2b host file in /etc ( /etc/guarding.p2p ). + MoBlock tries to skip malformed or duplicate ranges but +@@ -140,8 +156,18 @@ + To specify a NFQUEUE queue number: + + ./moblock -p /etc/guarding.p2p -q 5 MoBlock.log ++ ++ From version 0.9 MoBlock supports MARKing packets and RETURN them to ++ iptables, there's an example start script (MoBlock-nfq-reject.sh) that ++ uses this feature to REJECT packet instead of dropping them. It can help ++ in complex firewall configuration where you need more control of packets ++ flow after MoBlock inspection. ++ See the mentioned start script for reference, you can set the MARK value ++ for packets that MoBlock would drop (ip in list) with the "-r" command line ++ option and for packets that MoBlock would accept (ip not in list) with ++ the "-a" command line option. + +- To stop it: ++ To stop MoBlock: + + kill -TERM <MoBlockPid> + +@@ -149,7 +175,7 @@ + To obtain stats about blocked ranges while it's running: + + kill -USR1 <MoBlockPid> # write stats to logfile +- kill -USR2 <MoBlockPid> # write stats to /var/log/MoBlock.stats ++ kill -USR2 <MoBlockPid> # write stats to /var/log/MoBlock.stats + + ** NEW: to reload the blocklist while MoBlock is running send to it the + HUP signal: +@@ -168,7 +194,10 @@ + took some code and ideas from his FTwall + - Andrew de Quincey (adq at lidskialf dot net) for regular expressions + and command line args patch +-- Maximilian Mehnert (clessing at freenet dot de) for logfile rotation ++- clessing at freenet dot de for logfile rotation + patches, pid file creation, start script, fixes/files for debian packaging ++- David Walluck, patch for proper loading of p2b files ++- jre, for continuing clessing work on debian packaging and many other ++ contributions + +-Last Updated: 20/Mar/2006 ++Last Updated: 15/Oct/2007 +diff -Naur MoBlock-0.8_orig/rbt.c MoBlock-0.8/rbt.c +--- MoBlock-0.8_orig/rbt.c 2006-03-22 12:44:31.000000000 -0500 ++++ MoBlock-0.8/rbt.c 2008-02-10 11:56:08.000000000 -0500 +@@ -19,7 +19,7 @@ + #include <stdarg.h> + #include <time.h> + +-#define RBT_VERSION 0.8 ++#define RBT_VERSION 0.9 + #define BNAME_LEN 80 + + /* implementation dependend declarations */ +@@ -421,7 +421,7 @@ + + statusEnum insert(keyType key, recType *rec) { + nodeType *current, *parent, *x; +- keyType tmpkey; ++ //keyType tmpkey; + recType tmprec; + int ret; + +@@ -433,6 +433,23 @@ + current = root; + parent = 0; + while (current != NIL) { ++ if (compEQ2(current->key, key, rec->ipmax)) { // current node key is inside new range to be inserted ++ strcpy(tmprec.blockname, rec->blockname); // block name from new range ++ if (compLT(current->rec.ipmax, rec->ipmax)) ++ tmprec.ipmax = rec->ipmax; ++ else tmprec.ipmax = current->rec.ipmax; ++ tmprec.hits = 0; ++ //printf("deleting node :%lu\n", current->key); ++ ret=delete(current->key); ++ if ( ret != STATUS_OK ) ++ return(ret); ++ ret=insert(key, &tmprec); ++ if ( ret == STATUS_OK ) { ++ printf("new merge\n"); ++ return(STATUS_MERGED); ++ } ++ else return(ret); ++ } + if (compEQ(key, current->key)) { + if ( rec->ipmax > current->rec.ipmax ) { + current->rec.ipmax=rec->ipmax; +@@ -458,7 +475,7 @@ + } + } + //check if higher ip (ipmax) is already in a range +- if (compEQ2(rec->ipmax,current->key,current->rec.ipmax)) { ++ /*if (compEQ2(rec->ipmax,current->key,current->rec.ipmax)) { + fprintf(logfile,"higher ip in range\n"); + tmpkey=key; + strcpy(tmprec.blockname,current->rec.blockname); +@@ -470,7 +487,7 @@ + if ( ret == STATUS_OK ) + return(STATUS_MERGED); + else return(ret); +- } ++ }*/ + parent = current; + current = compLT(key, current->key) ? + current->left : current->right; +@@ -495,7 +512,7 @@ + } else { + root = x; + } +- ++ //printf("new node, key: %lu, parent: %lu\n", x->key, parent ? parent->key : 0); + insertFixup(x); + lastFind = NULL; + diff --git a/pcr/moblock/moblock_include.patch b/pcr/moblock/moblock_include.patch new file mode 100644 index 000000000..644e8240e --- /dev/null +++ b/pcr/moblock/moblock_include.patch @@ -0,0 +1,10 @@ +--- MoBlock-0.8/MoBlock.c.orig 2008-08-15 14:41:49.000000000 -0400 ++++ MoBlock-0.8/MoBlock.c 2008-08-15 14:43:45.000000000 -0400 +@@ -32,6 +32,7 @@ + #include <netinet/udp.h>
+ #include <sys/socket.h>
+ #include <arpa/inet.h>
++#include <limits.h>
+ #include <linux/netfilter_ipv4.h>
+ #include <signal.h>
+ #include <regex.h>
diff --git a/pcr/nautilus-dropbox/PKGBUILD b/pcr/nautilus-dropbox/PKGBUILD new file mode 100644 index 000000000..c8a81a959 --- /dev/null +++ b/pcr/nautilus-dropbox/PKGBUILD @@ -0,0 +1,45 @@ +# Contributor: josephgbr <rafael.f.f1@gmail.com> +# Contributor: cmorlok <christianmorlok@web.de> +# Contributor: fazibear <fazibear@gmail.com> +# Contributor: neuromante <lorenzo.nizzi.grifi@gmail.com> +# Contributor: Gordin <9ordin @t gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurélien Desbrières <aurelien@cwb.io> + +pkgname=nautilus-dropbox +pkgver=1.4.0 +pkgrel=2 +pkgdesc="Dropbox for Linux - Nautilus extension" +arch=('i686' 'x86_64') +url="https://www.dropbox.com/" +license=('custom:CC-BY-ND-3' 'GPL') +depends=('libnotify' 'nautilus' 'dropbox' 'hicolor-icon-theme') +makedepends=('python2-docutils' 'python2' 'pygtk') +install=${pkgname}.install +options=('!libtool' '!emptydirs') +source=("https://linux.dropbox.com/packages/${pkgname}-${pkgver}.tar.bz2") + +build() { + cd "${pkgname}-${pkgver}/" + + sed "s/python/python2/" \ + -i configure \ + -i Makefile.am \ + -i Makefile.in \ + -i dropbox.in \ + -i rst2man.py + + # since python2-docutils, rst2man.py is named "rst2man2.py" + sed "s#rst2man.py#/usr/bin/rst2man2.py#" \ + -i configure + + ./configure --prefix=/usr --sysconfdir=/etc + make +} + +package() { + cd "${pkgname}-${pkgver}/" + make DESTDIR="${pkgdir}" install + rm "${pkgdir}/usr/bin/dropbox" + rm "${pkgdir}/usr/share/applications/dropbox.desktop" + install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING" +} diff --git a/pcr/nautilus-dropbox/nautilus-dropbox.install b/pcr/nautilus-dropbox/nautilus-dropbox.install new file mode 100644 index 000000000..c4f3ef960 --- /dev/null +++ b/pcr/nautilus-dropbox/nautilus-dropbox.install @@ -0,0 +1,16 @@ +post_install() { + gtk-update-icon-cache -q -t -f usr/share/icons/hicolor + cat <<-EndOfMessage + +==> Restart nautilus with 'nautilus -q' + +EndOfMessage +} + +post_upgrade() { + post_install $1 +} + +post_remove() { + post_install $1 +} diff --git a/pcr/ocaml-camomile/PKGBUILD b/pcr/ocaml-camomile/PKGBUILD new file mode 100644 index 000000000..48c8eb2f9 --- /dev/null +++ b/pcr/ocaml-camomile/PKGBUILD @@ -0,0 +1,28 @@ +# Contributor: Serge Zirukin <ftrvxmtrx@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=ocaml-camomile +pkgver=0.8.4 +pkgrel=2 +pkgdesc="Comprehensive Unicode library for OCaml" +arch=('i686' 'x86_64') +url="https://github.com/yoriyuki/Camomile" +license=('LGPL') +depends=('ocaml' 'ocaml-findlib>=1.2.3') +install= +source=(https://github.com/downloads/yoriyuki/${pkgname/ocaml-}/${pkgname/ocaml-/}-$pkgver.tar.bz2) +md5sums=('389f1a7e5c2a634fbb3ea6f764d77bd3') +options=(!strip !makeflags) + +build() { + cd "$srcdir/${pkgname/ocaml-/}-$pkgver" + + ./configure --prefix=/usr + mkdir -p $pkgdir$(ocamlfind printconf destdir) || return 1 + mkdir -p $pkgdir/usr/bin + sed -i -e 's|ocamlfind install|ocamlfind install -destdir '$pkgdir$(ocamlfind printconf destdir)'|' Makefile || return 1 + make || return 1 + make DATADIR="$pkgdir/usr/share" BINDIR="$pkgdir/usr/bin" install + install -Dm 644 COPYING $pkgdir/usr/share/licenses/$pkgname/LICENSE +} + diff --git a/pcr/ocaml-pcre/PKGBUILD b/pcr/ocaml-pcre/PKGBUILD new file mode 100644 index 000000000..bfc214b28 --- /dev/null +++ b/pcr/ocaml-pcre/PKGBUILD @@ -0,0 +1,34 @@ +# Contributor: Serge Zirukin <ftrvxmtrx@gmail.com> +# Contributor: Sergei Lebedev <superbobry@gmail.com> +# Contributor: Magnus Therning <magnus@therning.org> +# Maintainer : Parabola GNU / Linux-libre <aurelien@cwb.io> + +pkgname=ocaml-pcre +pkgver=7.0.2 +pkgrel=2 +pkgdesc="Perl compatible regular expressions for OCaml" +arch=('i686' 'x86_64') +url="http://www.ocaml.info/home/ocaml_sources.html#toc18" +license=('LGPL') +depends=('ocaml' 'pcre>=4.5') +makedepends=('ocaml-findlib') +replaces=('pcre-ocaml') +conflicts=('pcre-ocaml') +source=("https://bitbucket.org/mmottl/pcre-ocaml/downloads/pcre-ocaml-$pkgver.tar.gz") +md5sums=('412eec5674a8bab76ccd09e006a24e10') +options=(!strip) + +build() { + cd "$srcdir/pcre-ocaml-$pkgver" + + ./configure --disable-debug --prefix /usr --destdir "$pkgdir" + make all +} + +package() { + cd "$srcdir/pcre-ocaml-$pkgver" + export OCAMLFIND_DESTDIR="$pkgdir$(ocamlfind printconf destdir)" + install -dm 755 "$OCAMLFIND_DESTDIR/stublibs" + make install + install -Dm 644 COPYING.txt "$pkgdir/usr/share/licenses/$pkgname/COPYING" +} diff --git a/pcr/oinkmaster/PKGBUILD b/pcr/oinkmaster/PKGBUILD new file mode 100644 index 000000000..f533e3663 --- /dev/null +++ b/pcr/oinkmaster/PKGBUILD @@ -0,0 +1,34 @@ +# Contributor: Robert Knauer <robert@privatdemail.net> +# Contributor: Kessia Pinheiro <kessiapinheiro @ gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurélien Desbrières <aurelien@cwb.io> + +pkgname=oinkmaster +pkgver=2.0 +pkgrel=7 +pkgdesc="A script that will help you update and manage your Snort rules" +arch=('i686' 'x86_64') +license=('BSD') +url="http://oinkmaster.sourceforge.net/" +depends=('snort') +backup=( + 'etc/oinkmaster.conf' +) +source=( + "http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.gz" +) +sha256sums=( + '3d52f0426aa7c81b122cef22b80d708d8bb8337537e48754a065804f46c46162' +) + +package() { + cd "${srcdir}/${pkgname}-${pkgver}" + install -m0655 -D 'oinkmaster.pl' "${pkgdir}/usr/bin/oinkmaster.pl" + install -m0644 -D 'oinkmaster.conf' "${pkgdir}/etc/oinkmaster.conf" + install -m0644 -D 'oinkmaster.1' "${pkgdir}/usr/man/man1/oinkmaster.1" + install -d -m0644 "${pkgdir}/usr/share/oinkmaster/" + install -d -m0755 "${pkgdir}/usr/share/licenses/oinkmaster/" + install -m0644 -D 'template-examples.conf' "${pkgdir}/usr/share/oinkmaster/" + cp -R 'contrib/' "${pkgdir}/usr/share/oinkmaster/" + install -m0644 [[:upper:]]* "${pkgdir}/usr/share/oinkmaster/" + install -m0644 -D 'LICENSE' "${pkgdir}/usr/share/licenses/${pkgname}/" +} diff --git a/pcr/package-query/PKGBUILD b/pcr/package-query/PKGBUILD new file mode 100644 index 000000000..5bec58ce3 --- /dev/null +++ b/pcr/package-query/PKGBUILD @@ -0,0 +1,29 @@ +# Contributor: tuxce <tuxce.net@gmail.com> +# Maintainer : Parabola GNU / Linux-libre <aurelien@cwb.io> + +pkgname=package-query +pkgver=1.1 +pkgrel=2 +pkgdesc="Query ALPM and AUR" +arch=('i686' 'x86_64' 'mips64el' 'armv6h' 'armv7h') +url="http://gitweb.archlinux.fr/package-query.git/" +license=('GPL') +depends=('pacman>=4.0' 'pacman<4.1' curl 'yajl>=2.0') +source=(http://mir.archlinux.fr/~tuxce/releases/$pkgname/$pkgname-$pkgver.tar.gz) + +build() { + cd "$srcdir/$pkgname-$pkgver" + ./configure --localstatedir=/var --prefix=/usr --sysconfdir=/etc --with-aur-url=https://aur.archlinux.org + make +} + +package () +{ + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} + +# vim:set ts=2 sw=2 et: + +md5sums=('becb5734dd531631cbe2e1c9cf82ae9e') +md5sums=('becb5734dd531631cbe2e1c9cf82ae9e') diff --git a/pcr/packer/PKGBUILD b/pcr/packer/PKGBUILD new file mode 100644 index 000000000..f2ea54a76 --- /dev/null +++ b/pcr/packer/PKGBUILD @@ -0,0 +1,36 @@ +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=packer +pkgver=20120302 +pkgrel=1 +pkgdesc="Bash wrapper for pacman and aur" +url="http://github.com/bruenig/packer" +license="GPL" +arch=('any') +makedepends=('git') +depends=('grep' 'sed' 'bash' 'curl' 'pacman' 'jshon') +optdepends=('sudo: install and update packages as non-root' + 'customizepkg: apply customizepkg modifications') +_gitroot='https://github.com/bruenig/packer.git' +_gitname='packer' + +# Xavion is a non-contributing idiot + +build() { + cd "$srcdir" + + msg "Connecting to github GIT server...." + + if [ -d "$srcdir/$_gitname" ] ; then + cd $_gitname && git pull origin + else + git clone "$_gitroot" + cd $_gitname + fi + + mkdir -p "$pkgdir/usr/bin/" + mkdir -p "$pkgdir/usr/share/man/man8/" + install -m 755 packer "$pkgdir/usr/bin/packer" + install -m 644 packer.8 "$pkgdir/usr/share/man/man8/packer.8" +} + diff --git a/pcr/pacman-color/0001-Add-conflict-for-replacing-owned-empty-directory.patch b/pcr/pacman-color/0001-Add-conflict-for-replacing-owned-empty-directory.patch new file mode 100644 index 000000000..85622aaac --- /dev/null +++ b/pcr/pacman-color/0001-Add-conflict-for-replacing-owned-empty-directory.patch @@ -0,0 +1,152 @@ +From 717fdb8ee0fd23cf72fc7d2832317f513caefa2c Mon Sep 17 00:00:00 2001 +From: Allan McRae <allan@archlinux.org> +Date: Sun, 8 Jul 2012 21:36:36 +1000 +Subject: [PATCH 1/4] Add conflict for replacing owned empty directory + +When two packages own an empty directory, pacman finds no conflict when +one of those packages wants to replace the directory with a file or a +symlink. When it comes to actually extracting the new file/symlink, +pacman sees the directory is still there (we do not remove empty +directories if they are owned by a package) and refuses to extract. + +Detect this potential conflict early and bail. Note that it is a +_potential_ conflict and not a guaranteed one as the other package owning +the directory could be updated or removed first which would remove +the conflict. However, pacman currently can not sort package installation +order to ensure this, so this conflict requires manual upgrade ordering. + +Signed-off-by: Allan McRae <allan@archlinux.org> +Signed-off-by: Dan McGee <dan@archlinux.org> +--- + lib/libalpm/conflict.c | 32 ++++++++++++++++++++++++++------ + test/pacman/tests/fileconflict009.py | 20 ++++++++++++++++++++ + test/pacman/tests/fileconflict010.py | 20 ++++++++++++++++++++ + 3 files changed, 66 insertions(+), 6 deletions(-) + create mode 100644 test/pacman/tests/fileconflict009.py + create mode 100644 test/pacman/tests/fileconflict010.py + +diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c +index 32f6f30..efa1a87 100644 +--- a/lib/libalpm/conflict.c ++++ b/lib/libalpm/conflict.c +@@ -328,15 +328,35 @@ const alpm_file_t *_alpm_filelist_contains(alpm_filelist_t *filelist, + return NULL; + } + +-static int dir_belongsto_pkg(const char *root, const char *dirpath, ++static int dir_belongsto_pkg(alpm_handle_t *handle, const char *dirpath, + alpm_pkg_t *pkg) + { ++ alpm_list_t *i; + struct stat sbuf; + char path[PATH_MAX]; + char abspath[PATH_MAX]; +- struct dirent *ent = NULL; + DIR *dir; ++ struct dirent *ent = NULL; ++ const char *root = handle->root; ++ ++ /* TODO: this is an overly strict check but currently pacman will not ++ * overwrite a directory with a file (case 10/11 in add.c). Adjusting that ++ * is not simple as even if the directory is being unowned by a conflicting ++ * package, pacman does not sort this to ensure all required directory ++ * "removals" happen before installation of file/symlink */ ++ ++ /* check that no other _installed_ package owns the directory */ ++ for(i = _alpm_db_get_pkgcache(handle->db_local); i; i = i->next) { ++ if(pkg == i->data) { ++ continue; ++ } ++ ++ if(_alpm_filelist_contains(alpm_pkg_get_files(i->data), dirpath)) { ++ return 0; ++ } ++ } + ++ /* check all files in directory are owned by the package */ + snprintf(abspath, PATH_MAX, "%s%s", root, dirpath); + dir = opendir(abspath); + if(dir == NULL) { +@@ -349,13 +369,13 @@ static int dir_belongsto_pkg(const char *root, const char *dirpath, + if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) { + continue; + } +- snprintf(path, PATH_MAX, "%s/%s", dirpath, name); ++ snprintf(path, PATH_MAX, "%s%s", dirpath, name); + snprintf(abspath, PATH_MAX, "%s%s", root, path); + if(stat(abspath, &sbuf) != 0) { + continue; + } + if(S_ISDIR(sbuf.st_mode)) { +- if(dir_belongsto_pkg(root, path, pkg)) { ++ if(dir_belongsto_pkg(handle, path, pkg)) { + continue; + } else { + closedir(dir); +@@ -529,9 +549,9 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle, + sprintf(dir, "%s/", filestr); + if(_alpm_filelist_contains(alpm_pkg_get_files(dbpkg), dir)) { + _alpm_log(handle, ALPM_LOG_DEBUG, +- "check if all files in %s belongs to %s\n", ++ "check if all files in %s belong to %s\n", + dir, dbpkg->name); +- resolved_conflict = dir_belongsto_pkg(handle->root, filestr, dbpkg); ++ resolved_conflict = dir_belongsto_pkg(handle, dir, dbpkg); + } + free(dir); + } +diff --git a/test/pacman/tests/fileconflict009.py b/test/pacman/tests/fileconflict009.py +new file mode 100644 +index 0000000..904af4a +--- /dev/null ++++ b/test/pacman/tests/fileconflict009.py +@@ -0,0 +1,20 @@ ++self.description = "dir->symlink change during package upgrade (directory conflict)" ++ ++lp1 = pmpkg("pkg1") ++lp1.files = ["dir/"] ++self.addpkg2db("local", lp1) ++ ++lp2 = pmpkg("pkg2") ++lp2.files = ["dir/"] ++self.addpkg2db("local", lp2) ++ ++p = pmpkg("pkg1", "1.0-2") ++p.files = ["dir -> /usr/dir"] ++self.addpkg2db("sync", p) ++ ++self.args = "-S pkg1" ++ ++self.addrule("PACMAN_RETCODE=1") ++self.addrule("PKG_VERSION=pkg1|1.0-1") ++self.addrule("PKG_VERSION=pkg2|1.0-1") ++self.addrule("DIR_EXIST=dir/") +diff --git a/test/pacman/tests/fileconflict010.py b/test/pacman/tests/fileconflict010.py +new file mode 100644 +index 0000000..0a3ce83 +--- /dev/null ++++ b/test/pacman/tests/fileconflict010.py +@@ -0,0 +1,20 @@ ++self.description = "dir->file change during package upgrade (directory conflict)" ++ ++lp1 = pmpkg("pkg1") ++lp1.files = ["dir/"] ++self.addpkg2db("local", lp1) ++ ++lp2 = pmpkg("pkg2") ++lp2.files = ["dir/"] ++self.addpkg2db("local", lp2) ++ ++p = pmpkg("pkg1", "1.0-2") ++p.files = ["dir"] ++self.addpkg2db("sync", p) ++ ++self.args = "-S pkg1" ++ ++self.addrule("PACMAN_RETCODE=1") ++self.addrule("PKG_VERSION=pkg1|1.0-1") ++self.addrule("PKG_VERSION=pkg2|1.0-1") ++self.addrule("DIR_EXIST=dir/") +-- +1.7.11.1 + diff --git a/pcr/pacman-color/0002-Check-empty-subdirectory-ownership.patch b/pcr/pacman-color/0002-Check-empty-subdirectory-ownership.patch new file mode 100644 index 000000000..6cf496d16 --- /dev/null +++ b/pcr/pacman-color/0002-Check-empty-subdirectory-ownership.patch @@ -0,0 +1,61 @@ +From 44e9fdd0e848382337edb97d41e7317638a67bac Mon Sep 17 00:00:00 2001 +From: Allan McRae <allan@archlinux.org> +Date: Sun, 8 Jul 2012 23:58:37 +1000 +Subject: [PATCH 2/4] Check empty subdirectory ownership + +When checking if a package owns a directory, it is important to check +not only that all the files in the directory are part of the package, +but also if the directory is part of a package. This catches empty +subdirectories during conflict checking for directory to file/symlink +replacements. + +Signed-off-by: Allan McRae <allan@archlinux.org> +Signed-off-by: Dan McGee <dan@archlinux.org> +--- + lib/libalpm/conflict.c | 5 +++++ + test/pacman/tests/fileconflict012.py | 17 +++++++++++++++++ + 2 files changed, 22 insertions(+) + create mode 100644 test/pacman/tests/fileconflict012.py + +diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c +index efa1a87..d6e5d8c 100644 +--- a/lib/libalpm/conflict.c ++++ b/lib/libalpm/conflict.c +@@ -339,6 +339,11 @@ static int dir_belongsto_pkg(alpm_handle_t *handle, const char *dirpath, + struct dirent *ent = NULL; + const char *root = handle->root; + ++ /* check directory is actually in package - used for subdirectory checks */ ++ if(!_alpm_filelist_contains(alpm_pkg_get_files(pkg), dirpath)) { ++ return 0; ++ } ++ + /* TODO: this is an overly strict check but currently pacman will not + * overwrite a directory with a file (case 10/11 in add.c). Adjusting that + * is not simple as even if the directory is being unowned by a conflicting +diff --git a/test/pacman/tests/fileconflict012.py b/test/pacman/tests/fileconflict012.py +new file mode 100644 +index 0000000..421b739 +--- /dev/null ++++ b/test/pacman/tests/fileconflict012.py +@@ -0,0 +1,17 @@ ++self.description = "dir->file change during package upgrade (filesystem file conflict)" ++ ++lp1 = pmpkg("pkg1") ++lp1.files = ["dir/"] ++self.addpkg2db("local", lp1) ++ ++self.filesystem = ["dir/file"] ++ ++p = pmpkg("pkg1", "1.0-2") ++p.files = ["dir"] ++self.addpkg2db("sync", p) ++ ++self.args = "-S pkg1" ++ ++self.addrule("PACMAN_RETCODE=1") ++self.addrule("PKG_VERSION=pkg1|1.0-1") ++self.addrule("DIR_EXIST=dir/") +-- +1.7.11.1 + diff --git a/pcr/pacman-color/PKGBUILD b/pcr/pacman-color/PKGBUILD new file mode 100644 index 000000000..525f965b9 --- /dev/null +++ b/pcr/pacman-color/PKGBUILD @@ -0,0 +1,42 @@ +# Contributor: JokerBoy <jokerboy at punctweb dot ro> +# Contributor: vogo <vogo(at)seznam(dot)cz> +# Maintainer : Parabola GNU / Linux-libre <aurelien@cwb.io> + +pkgname=pacman-color +pkgver=4.0.3 +pkgrel=3 +pkgdesc="A color patched command-line frontend for libalpm (Pacman)" +arch=('i686' 'x86_64') +url="http://www.archlinux.org/pacman/" +license=('GPL') +depends=('pacman>=4.0' 'pacman<4.1') +backup=('etc/pacman.d/color.conf') +source=("http://mirrors.kernel.org/archlinux/other/pacman/pacman-${pkgver}.tar.gz" + '0001-Add-conflict-for-replacing-owned-empty-directory.patch' + '0002-Check-empty-subdirectory-ownership.patch' + "${pkgname}-${pkgver}.patch" + 'color.conf') +md5sums=('387965c7125e60e5f0b9ff3b427fe0f9' + '1a9b79788640907a2b34e8671cacc94a' + 'a9ddd43891bed364e1e97d27b2887bf1' + '185e6a488b1aa14db4a54b71eb5e5e29' + '47665f5054196c20ba0dd280a8d4c5e1') + +build() { + cd "pacman-${pkgver}" + patch -p1 -i "${srcdir}/0001-Add-conflict-for-replacing-owned-empty-directory.patch" + patch -p1 -i "${srcdir}/0002-Check-empty-subdirectory-ownership.patch" + patch -p1 -i "${srcdir}/${pkgname}-${pkgver}.patch" + ./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --disable-doc + make +} + +package() { + # install pacman-color && color.conf + install -Dm755 "pacman-${pkgver}/src/pacman/.libs/pacman" "${pkgdir}/usr/bin/pacman-color" + install -Dm644 'color.conf' "${pkgdir}/etc/pacman.d/color.conf" +} diff --git a/pcr/pacman-color/color.conf b/pcr/pacman-color/color.conf new file mode 100644 index 000000000..4978d4e62 --- /dev/null +++ b/pcr/pacman-color/color.conf @@ -0,0 +1,46 @@ +# Configuration for pacman-color +# ------------------------------ +# in default are all colors "intensive", +# it looks much better on black backround +# +# valid colors: +# black +# red +# green +# yellow +# blue +# magenta +# cyan +# white +# gray +# intensive red +# intensive green +# intensive yellow +# intensive blue +# intensive magenta +# intensive cyan +# intensive white +# intensive foreground +# none + +# error: prefix, fail, Remove (?):, MISSING +#Red = intensive red + +# done, success, pkg version, Not Modified +#Green = intensive green + +# warning: prefix, Targets (?):, MODIFIED +#Yellow = intensive yellow + +# :: prefix, pkg group, counter in install proces +#Blue = intensive blue + +# repo name, package file name +#Magenta = intensive magenta + +# url, flag installed +#Cyan = intensive cyan + +# messages with :: prefix, titles, etc +#White = intensive foreground + diff --git a/pcr/pacman-color/pacman-color-4.0.3.patch b/pcr/pacman-color/pacman-color-4.0.3.patch new file mode 100644 index 000000000..c7b52ef04 --- /dev/null +++ b/pcr/pacman-color/pacman-color-4.0.3.patch @@ -0,0 +1,1297 @@ +diff -up -Npaur a/src/pacman/callback.c b/src/pacman/callback.c +--- a/src/pacman/callback.c 2012-02-03 01:19:15.000000000 +0200 ++++ b/src/pacman/callback.c 2012-07-20 21:48:20.266827634 +0300 +@@ -221,16 +221,16 @@ void cb_event(alpm_event_t event, void * + printf(_("generating %s with %s... "), (char *)data1, (char *)data2); + break; + case ALPM_EVENT_DELTA_PATCH_DONE: +- printf(_("success!\n")); ++ color_printf(COLOR_GREEN_ALL, _("success!\n")); + break; + case ALPM_EVENT_DELTA_PATCH_FAILED: +- printf(_("failed.\n")); ++ color_printf(COLOR_RED_ALL, _("failed.\n")); + break; + case ALPM_EVENT_SCRIPTLET_INFO: + printf("%s", (char *)data1); + break; + case ALPM_EVENT_RETRIEVE_START: +- printf(_(":: Retrieving packages from %s...\n"), (char *)data1); ++ color_printf(COLOR_DOUBLECOLON, _(":: Retrieving packages from %s...\n"), (char *)data1); + break; + case ALPM_EVENT_DISKSPACE_START: + if(config->noprogressbar) { +@@ -264,14 +264,14 @@ void cb_question(alpm_question_t event, + switch(event) { + case ALPM_QUESTION_INSTALL_IGNOREPKG: + if(!config->op_s_downloadonly) { +- *response = yesno(_(":: %s is in IgnorePkg/IgnoreGroup. Install anyway?"), ++ *response = yesno(COLOR_DOUBLECOLON, _(":: %s is in IgnorePkg/IgnoreGroup. Install anyway?"), + alpm_pkg_get_name(data1)); + } else { + *response = 1; + } + break; + case ALPM_QUESTION_REPLACE_PKG: +- *response = yesno(_(":: Replace %s with %s/%s?"), ++ *response = yesno(COLOR_DOUBLECOLON, _(":: Replace %s with %s/%s?"), + alpm_pkg_get_name(data1), + (char *)data3, + alpm_pkg_get_name(data2)); +@@ -280,12 +280,12 @@ void cb_question(alpm_question_t event, + /* data parameters: target package, local package, conflict (strings) */ + /* print conflict only if it contains new information */ + if(strcmp(data1, data3) == 0 || strcmp(data2, data3) == 0) { +- *response = noyes(_(":: %s and %s are in conflict. Remove %s?"), ++ *response = noyes(COLOR_DOUBLECOLON, _(":: %s and %s are in conflict. Remove %s?"), + (char *)data1, + (char *)data2, + (char *)data2); + } else { +- *response = noyes(_(":: %s and %s are in conflict (%s). Remove %s?"), ++ *response = noyes(COLOR_DOUBLECOLON, _(":: %s and %s are in conflict (%s). Remove %s?"), + (char *)data1, + (char *)data2, + (char *)data3, +@@ -302,13 +302,13 @@ void cb_question(alpm_question_t event, + (char *)alpm_pkg_get_name(i->data)); + count++; + } +- printf(_n( ++ color_printf(COLOR_DOUBLECOLON, _n( + ":: The following package cannot be upgraded due to unresolvable dependencies:\n", + ":: The following packages cannot be upgraded due to unresolvable dependencies:\n", + count)); +- list_display(" ", namelist); ++ list_display(NULL, " ", namelist); + printf("\n"); +- *response = noyes(_n( ++ *response = noyes(NULL, _n( + "Do you want to skip the above package for this upgrade?", + "Do you want to skip the above packages for this upgrade?", + count)); +@@ -320,7 +320,7 @@ void cb_question(alpm_question_t event, + alpm_list_t *providers = (alpm_list_t *)data1; + size_t count = alpm_list_count(providers); + char *depstring = alpm_dep_compute_string((alpm_depend_t *)data2); +- printf(_(":: There are %zd providers available for %s:\n"), count, ++ color_printf(COLOR_DOUBLECOLON, _(":: There are %zd providers available for %s:\n"), count, + depstring); + free(depstring); + select_display(providers); +@@ -329,7 +329,7 @@ void cb_question(alpm_question_t event, + break; + case ALPM_QUESTION_LOCAL_NEWER: + if(!config->op_s_downloadonly) { +- *response = yesno(_(":: %s-%s: local version is newer. Upgrade anyway?"), ++ *response = yesno(COLOR_DOUBLECOLON, _(":: %s-%s: local version is newer. Upgrade anyway?"), + alpm_pkg_get_name(data1), + alpm_pkg_get_version(data1)); + } else { +@@ -337,7 +337,7 @@ void cb_question(alpm_question_t event, + } + break; + case ALPM_QUESTION_CORRUPTED_PKG: +- *response = yesno(_(":: File %s is corrupted (%s).\n" ++ *response = yesno(COLOR_DOUBLECOLON, _(":: File %s is corrupted (%s).\n" + "Do you want to delete it?"), + (char *)data1, + alpm_strerror(*(enum _alpm_errno_t *)data2)); +@@ -347,7 +347,7 @@ void cb_question(alpm_question_t event, + alpm_pgpkey_t *key = data1; + char created[12]; + strftime(created, 12, "%Y-%m-%d", localtime(&(key->created))); +- *response = yesno(_(":: Import PGP key %s, \"%s\", created %s?"), ++ *response = yesno(COLOR_DOUBLECOLON, _(":: Import PGP key %s, \"%s\", created %s?"), + key->fingerprint, key->uid, created); + } + break; +@@ -481,8 +481,9 @@ void cb_progress(alpm_progress_t event, + + } + +- printf("(%*ld/%*ld) %ls%-*s", digits, (unsigned long)current, +- digits, (unsigned long)howmany, wcstr, padwid, ""); ++ color_printf(COLOR_BLUE_ALL, "(%*ld/%*ld)", digits, (unsigned long)current, ++ digits, (unsigned long)howmany); ++ printf(" %ls%-*s", wcstr, padwid, ""); + + free(wcstr); + +diff -up -Npaur a/src/pacman/package.c b/src/pacman/package.c +--- a/src/pacman/package.c 2012-02-03 01:18:52.000000000 +0200 ++++ b/src/pacman/package.c 2012-07-20 21:48:20.266827634 +0300 +@@ -41,7 +41,7 @@ + * @param deps a list with items of type alpm_depend_t + * @return a string list, must be freed + */ +-static void deplist_display(const char *title, ++static void deplist_display(const colordata_t *colors_title, const char *title, + alpm_list_t *deps) + { + alpm_list_t *i, *text = NULL; +@@ -49,7 +49,7 @@ static void deplist_display(const char * + alpm_depend_t *dep = alpm_list_getdata(i); + text = alpm_list_add(text, alpm_dep_compute_string(dep)); + } +- list_display(title, text); ++ list_display(colors_title, title, text); + FREELIST(text); + } + +@@ -102,65 +102,65 @@ void dump_pkg_full(alpm_pkg_t *pkg, int + + /* actual output */ + if(from == PKG_FROM_SYNCDB) { +- string_display(_("Repository :"), +- alpm_db_get_name(alpm_pkg_get_db(pkg))); ++ color_string_display(COLOR_WHITE_ALL, _("Repository :"), ++ COLOR_MAGENTA_ALL, alpm_db_get_name(alpm_pkg_get_db(pkg))); + } +- string_display(_("Name :"), alpm_pkg_get_name(pkg)); +- string_display(_("Version :"), alpm_pkg_get_version(pkg)); +- string_display(_("URL :"), alpm_pkg_get_url(pkg)); +- list_display(_("Licenses :"), alpm_pkg_get_licenses(pkg)); +- list_display(_("Groups :"), alpm_pkg_get_groups(pkg)); +- deplist_display(_("Provides :"), alpm_pkg_get_provides(pkg)); +- deplist_display(_("Depends On :"), alpm_pkg_get_depends(pkg)); +- list_display_linebreak(_("Optional Deps :"), alpm_pkg_get_optdepends(pkg)); ++ color_string_display(COLOR_WHITE_ALL, _("Name :"), COLOR_WHITE_ALL, alpm_pkg_get_name(pkg)); ++ color_string_display(COLOR_WHITE_ALL, _("Version :"), COLOR_GREEN_ALL, alpm_pkg_get_version(pkg)); ++ color_string_display(COLOR_WHITE_ALL, _("URL :"), COLOR_CYAN_ALL, alpm_pkg_get_url(pkg)); ++ list_display(COLOR_WHITE_ALL, _("Licenses :"), alpm_pkg_get_licenses(pkg)); ++ list_display(COLOR_WHITE_ALL, _("Groups :"), alpm_pkg_get_groups(pkg)); ++ deplist_display(COLOR_WHITE_ALL, _("Provides :"), alpm_pkg_get_provides(pkg)); ++ deplist_display(COLOR_WHITE_ALL, _("Depends On :"), alpm_pkg_get_depends(pkg)); ++ list_display_linebreak(COLOR_WHITE_ALL, _("Optional Deps :"), alpm_pkg_get_optdepends(pkg)); + if(extra || from == PKG_FROM_LOCALDB) { +- list_display(_("Required By :"), requiredby); ++ list_display(COLOR_WHITE_ALL, _("Required By :"), requiredby); + } +- deplist_display(_("Conflicts With :"), alpm_pkg_get_conflicts(pkg)); +- deplist_display(_("Replaces :"), alpm_pkg_get_replaces(pkg)); ++ deplist_display(COLOR_WHITE_ALL, _("Conflicts With :"), alpm_pkg_get_conflicts(pkg)); ++ deplist_display(COLOR_WHITE_ALL, _("Replaces :"), alpm_pkg_get_replaces(pkg)); + + size = humanize_size(alpm_pkg_get_size(pkg), 'K', 2, &label); + if(from == PKG_FROM_SYNCDB) { +- printf(_("Download Size : %6.2f %s\n"), size, label); ++ color_printf(COLOR_WHITE_COLON, _("Download Size : %6.2f %s\n"), size, label); + } else if(from == PKG_FROM_FILE) { +- printf(_("Compressed Size: %6.2f %s\n"), size, label); ++ color_printf(COLOR_WHITE_COLON, _("Compressed Size: %6.2f %s\n"), size, label); + } + + size = humanize_size(alpm_pkg_get_isize(pkg), 'K', 2, &label); +- printf(_("Installed Size : %6.2f %s\n"), size, label); ++ color_printf(COLOR_WHITE_COLON, _("Installed Size : %6.2f %s\n"), size, label); + +- string_display(_("Packager :"), alpm_pkg_get_packager(pkg)); +- string_display(_("Architecture :"), alpm_pkg_get_arch(pkg)); +- string_display(_("Build Date :"), bdatestr); ++ string_display(COLOR_WHITE_ALL, _("Packager :"), alpm_pkg_get_packager(pkg)); ++ string_display(COLOR_WHITE_ALL, _("Architecture :"), alpm_pkg_get_arch(pkg)); ++ string_display(COLOR_WHITE_ALL, _("Build Date :"), bdatestr); + if(from == PKG_FROM_LOCALDB) { +- string_display(_("Install Date :"), idatestr); +- string_display(_("Install Reason :"), reason); ++ string_display(COLOR_WHITE_ALL, _("Install Date :"), idatestr); ++ string_display(COLOR_WHITE_ALL, _("Install Reason :"), reason); + } + if(from == PKG_FROM_FILE || from == PKG_FROM_LOCALDB) { +- string_display(_("Install Script :"), ++ string_display(COLOR_WHITE_ALL, _("Install Script :"), + alpm_pkg_has_scriptlet(pkg) ? _("Yes") : _("No")); + } + + if(from == PKG_FROM_SYNCDB) { +- string_display(_("MD5 Sum :"), alpm_pkg_get_md5sum(pkg)); +- string_display(_("SHA256 Sum :"), alpm_pkg_get_sha256sum(pkg)); +- string_display(_("Signatures :"), ++ string_display(COLOR_WHITE_ALL, _("MD5 Sum :"), alpm_pkg_get_md5sum(pkg)); ++ string_display(COLOR_WHITE_ALL, _("SHA256 Sum :"), alpm_pkg_get_sha256sum(pkg)); ++ string_display(COLOR_WHITE_ALL, _("Signatures :"), + alpm_pkg_get_base64_sig(pkg) ? _("Yes") : _("None")); + } + if(from == PKG_FROM_FILE) { + alpm_siglist_t siglist; + int err = alpm_pkg_check_pgp_signature(pkg, &siglist); + if(err && alpm_errno(config->handle) == ALPM_ERR_SIG_MISSING) { +- string_display(_("Signatures :"), _("None")); ++ string_display(COLOR_WHITE_ALL, _("Signatures :"), _("None")); + } else if(err) { +- string_display(_("Signatures :"), ++ string_display(COLOR_WHITE_ALL, _("Signatures :"), + alpm_strerror(alpm_errno(config->handle))); + } else { + signature_display(_("Signatures :"), &siglist); + } + alpm_siglist_cleanup(&siglist); + } +- string_display(_("Description :"), alpm_pkg_get_desc(pkg)); ++ string_display(COLOR_WHITE_ALL, _("Description :"), alpm_pkg_get_desc(pkg)); + + /* Print additional package info if info flag passed more than once */ + if(from == PKG_FROM_LOCALDB && extra) { +@@ -219,7 +219,7 @@ void dump_pkg_backups(alpm_pkg_t *pkg) + { + alpm_list_t *i; + const char *root = alpm_option_get_root(config->handle); +- printf(_("Backup Files:\n")); ++ color_printf(COLOR_WHITE_ALL, _("Backup Files:\n")); + if(alpm_pkg_get_backup(pkg)) { + /* package has backup files, so print them */ + for(i = alpm_pkg_get_backup(pkg); i; i = alpm_list_next(i)) { +@@ -252,7 +252,8 @@ void dump_pkg_files(alpm_pkg_t *pkg, int + for(i = 0; i < pkgfiles->count; i++) { + const alpm_file_t *file = pkgfiles->files + i; + if(!quiet) { +- printf("%s %s%s\n", pkgname, root, file->name); ++ color_printf(COLOR_WHITE_ALL, "%s", pkgname); ++ printf(" %s%s\n", root, file->name); + } else { + printf("%s%s\n", root, file->name); + } +diff -up -Npaur a/src/pacman/pacman.c b/src/pacman/pacman.c +--- a/src/pacman/pacman.c 2012-02-15 23:57:20.000000000 +0200 ++++ b/src/pacman/pacman.c 2012-07-20 21:48:20.266827634 +0300 +@@ -219,11 +219,23 @@ static void usage(int op, const char * c + */ + static void version(void) + { ++ color_printf(COLOR_YELLOW_ALL, " .--. "); ++ printf(" "); ++ color_printf(COLOR_RED_ALL, " .---. "); ++ printf(" Pacman-color v%s - libalpm v%s\n", PACKAGE_VERSION, alpm_version()); ++ color_printf(COLOR_YELLOW_ALL, "/ _.-'"); ++ color_printf(COLOR_WHITE_ALL, " .-. .-"); ++ color_printf(COLOR_RED_ALL, "|O O |"); ++ printf(" Copyright (C) 2006-2012 Pacman Development Team\n"); ++ color_printf(COLOR_YELLOW_ALL, "\\ '-."); ++ color_printf(COLOR_WHITE_ALL, " '-' '-"); ++ color_printf(COLOR_RED_ALL, "|~~~ |"); ++ printf(" Copyright (C) 2002-2006 Judd Vinet\n"); ++ color_printf(COLOR_YELLOW_ALL, " '--' "); ++ printf(" "); ++ color_printf(COLOR_RED_ALL, "|.-.-.|"); ++ printf(" Colored by vogo <vogo(at)seznam(dot)cz>\n"); + printf("\n"); +- printf(" .--. Pacman v%s - libalpm v%s\n", PACKAGE_VERSION, alpm_version()); +- printf("/ _.-' .-. .-. .-. Copyright (C) 2006-2012 Pacman Development Team\n"); +- printf("\\ '-. '-' '-' '-' Copyright (C) 2002-2006 Judd Vinet\n"); +- printf(" '--'\n"); + printf(_(" This program may be freely redistributed under\n" + " the terms of the GNU General Public License.\n")); + printf("\n"); +@@ -795,6 +807,7 @@ int main(int argc, char *argv[]) + + /* init config data */ + config = config_new(); ++ parsecolorconfig(); + + /* disable progressbar if the output is redirected */ + if(!isatty(fileno(stdout))) { +@@ -896,18 +909,18 @@ int main(int argc, char *argv[]) + + if(config->verbose > 0) { + alpm_list_t *i; +- printf("Root : %s\n", alpm_option_get_root(config->handle)); +- printf("Conf File : %s\n", config->configfile); +- printf("DB Path : %s\n", alpm_option_get_dbpath(config->handle)); +- printf("Cache Dirs: "); ++ string_display(COLOR_WHITE_ALL, "Root :", alpm_option_get_root(config->handle)); ++ string_display(COLOR_WHITE_ALL, "Conf File :", config->configfile); ++ string_display(COLOR_WHITE_ALL, "DB Path :", alpm_option_get_dbpath(config->handle)); ++ color_printf(COLOR_WHITE_ALL, "Cache Dirs: "); + for(i = alpm_option_get_cachedirs(config->handle); i; i = alpm_list_next(i)) { + printf("%s ", (char *)alpm_list_getdata(i)); + } + printf("\n"); +- printf("Lock File : %s\n", alpm_option_get_lockfile(config->handle)); +- printf("Log File : %s\n", alpm_option_get_logfile(config->handle)); +- printf("GPG Dir : %s\n", alpm_option_get_gpgdir(config->handle)); +- list_display("Targets :", pm_targets); ++ string_display(COLOR_WHITE_ALL, "Lock File :", alpm_option_get_lockfile(config->handle)); ++ string_display(COLOR_WHITE_ALL, "Log File :", alpm_option_get_logfile(config->handle)); ++ string_display(COLOR_WHITE_ALL, "GPG Dir :", alpm_option_get_gpgdir(config->handle)); ++ list_display(COLOR_WHITE_ALL, "Targets :", pm_targets); + } + + /* Log command line */ +diff -up -Npaur a/src/pacman/query.c b/src/pacman/query.c +--- a/src/pacman/query.c 2011-12-23 22:36:36.000000000 +0200 ++++ b/src/pacman/query.c 2012-07-20 21:48:20.268827634 +0300 +@@ -266,7 +266,9 @@ static int query_search(alpm_list_t *tar + alpm_pkg_t *pkg = alpm_list_getdata(i); + + if(!config->quiet) { +- printf("local/%s %s", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg)); ++ color_printf(COLOR_MAGENTA_ALL, "local/"); ++ color_printf(COLOR_WHITE_ALL, "%s ", alpm_pkg_get_name(pkg)); ++ color_printf(COLOR_GREEN_ALL, "%s", alpm_pkg_get_version(pkg)); + } else { + printf("%s", alpm_pkg_get_name(pkg)); + } +@@ -275,16 +277,11 @@ static int query_search(alpm_list_t *tar + if(!config->quiet) { + if((grp = alpm_pkg_get_groups(pkg)) != NULL) { + alpm_list_t *k; +- printf(" ("); ++ color_printf(COLOR_BLUE_ALL, " ("); + for(k = grp; k; k = alpm_list_next(k)) { + const char *group = alpm_list_getdata(k); +- printf("%s", group); +- if(alpm_list_next(k)) { +- /* only print a spacer if there are more groups */ +- printf(" "); +- } ++ color_printf(COLOR_BLUE_ALL, "%s%s", group, (alpm_list_next(k) ? " " : ")")); + } +- printf(")"); + } + + /* we need a newline and initial indent first */ +@@ -315,7 +312,8 @@ static int query_group(alpm_list_t *targ + + for(p = grp->packages; p; p = alpm_list_next(p)) { + alpm_pkg_t *pkg = alpm_list_getdata(p); +- printf("%s %s\n", grp->name, alpm_pkg_get_name(pkg)); ++ color_printf(COLOR_BLUE_ALL, "%s ", grp->name); ++ color_printf(COLOR_WHITE_ALL, "%s\n", alpm_pkg_get_name(pkg)); + } + } + } else { +@@ -327,8 +325,8 @@ static int query_group(alpm_list_t *targ + const alpm_list_t *p; + for(p = grp->packages; p; p = alpm_list_next(p)) { + if(!config->quiet) { +- printf("%s %s\n", grpname, +- alpm_pkg_get_name(alpm_list_getdata(p))); ++ color_printf(COLOR_BLUE_ALL, "%s ", grpname); ++ color_printf(COLOR_WHITE_ALL, "%s\n", alpm_pkg_get_name(alpm_list_getdata(p))); + } else { + printf("%s\n", alpm_pkg_get_name(alpm_list_getdata(p))); + } +@@ -478,7 +476,8 @@ static int display(alpm_pkg_t *pkg) + if(!config->op_q_info && !config->op_q_list + && !config->op_q_changelog && !config->op_q_check) { + if(!config->quiet) { +- printf("%s %s\n", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg)); ++ color_printf(COLOR_WHITE_ALL, "%s ", alpm_pkg_get_name(pkg)); ++ color_printf(COLOR_GREEN_ALL, "%s\n", alpm_pkg_get_version(pkg)); + } else { + printf("%s\n", alpm_pkg_get_name(pkg)); + } +diff -up -Npaur a/src/pacman/remove.c b/src/pacman/remove.c +--- a/src/pacman/remove.c 2012-02-06 13:36:22.000000000 +0200 ++++ b/src/pacman/remove.c 2012-07-20 21:48:20.268827634 +0300 +@@ -111,14 +111,14 @@ int pacman_remove(alpm_list_t *targets) + case ALPM_ERR_PKG_INVALID_ARCH: + for(i = data; i; i = alpm_list_next(i)) { + char *pkg = alpm_list_getdata(i); +- printf(_(":: package %s does not have a valid architecture\n"), pkg); ++ color_printf(COLOR_DOUBLECOLON, _(":: package %s does not have a valid architecture\n"), pkg); + } + break; + case ALPM_ERR_UNSATISFIED_DEPS: + for(i = data; i; i = alpm_list_next(i)) { + alpm_depmissing_t *miss = alpm_list_getdata(i); + char *depstring = alpm_dep_compute_string(miss->depend); +- printf(_(":: %s: requires %s\n"), miss->target, depstring); ++ color_printf(COLOR_DOUBLECOLON, _(":: %s: requires %s\n"), miss->target, depstring); + free(depstring); + } + break; +@@ -140,7 +140,7 @@ int pacman_remove(alpm_list_t *targets) + holdpkg = 1; + } + } +- if(holdpkg && (noyes(_("HoldPkg was found in target list. Do you want to continue?")) == 0)) { ++ if(holdpkg && (noyes(NULL, _("HoldPkg was found in target list. Do you want to continue?")) == 0)) { + retval = 1; + goto cleanup; + } +@@ -160,7 +160,7 @@ int pacman_remove(alpm_list_t *targets) + /* print targets and ask user confirmation */ + display_targets(); + printf("\n"); +- if(yesno(_("Do you want to remove these packages?")) == 0) { ++ if(yesno(NULL, _("Do you want to remove these packages?")) == 0) { + retval = 1; + goto cleanup; + } +diff -up -Npaur a/src/pacman/sync.c b/src/pacman/sync.c +--- a/src/pacman/sync.c 2012-03-13 15:24:11.000000000 +0200 ++++ b/src/pacman/sync.c 2012-07-20 21:48:20.269827634 +0300 +@@ -146,8 +146,8 @@ static int sync_cleandb_all(void) + int ret = 0; + + dbpath = alpm_option_get_dbpath(config->handle); +- printf(_("Database directory: %s\n"), dbpath); +- if(!yesno(_("Do you want to remove unused repositories?"))) { ++ color_printf(COLOR_WHITE_COLON, _("Database directory: %s\n"), dbpath); ++ if(!yesno(NULL, _("Do you want to remove unused repositories?"))) { + return 0; + } + printf(_("removing unused sync repositories...\n")); +@@ -175,7 +175,7 @@ static int sync_cleancache(int level) + int ret = 0; + + for(i = cachedirs; i; i = alpm_list_next(i)) { +- printf(_("Cache directory: %s\n"), (char *)alpm_list_getdata(i)); ++ color_printf(COLOR_WHITE_COLON, _("Cache directory: %s\n"), (char *)alpm_list_getdata(i)); + } + + if(!config->cleanmethod) { +@@ -184,19 +184,19 @@ static int sync_cleancache(int level) + } + + if(level == 1) { +- printf(_("Packages to keep:\n")); ++ color_printf(COLOR_WHITE_COLON, _("Packages to keep:\n")); + if(config->cleanmethod & PM_CLEAN_KEEPINST) { + printf(_(" All locally installed packages\n")); + } + if(config->cleanmethod & PM_CLEAN_KEEPCUR) { + printf(_(" All current sync database packages\n")); + } +- if(!yesno(_("Do you want to remove all other packages from cache?"))) { ++ if(!yesno(NULL, _("Do you want to remove all other packages from cache?"))) { + return 0; + } + printf(_("removing old packages from cache...\n")); + } else { +- if(!noyes(_("Do you want to remove ALL files from cache?"))) { ++ if(!noyes(NULL, _("Do you want to remove ALL files from cache?"))) { + return 0; + } + printf(_("removing all files from cache...\n")); +@@ -345,9 +345,9 @@ static void print_installed(alpm_db_t *d + if(lpkg) { + const char *lpkgver = alpm_pkg_get_version(lpkg); + if(strcmp(lpkgver,pkgver) == 0) { +- printf(" [%s]", _("installed")); ++ color_printf(COLOR_CYAN_ALL, " [%s]", _("installed")); + } else { +- printf(" [%s: %s]", _("installed"), lpkgver); ++ color_printf(COLOR_CYAN_ALL, " [%s: %s]", _("installed"), lpkgver); + } + } + } +@@ -380,8 +380,9 @@ static int sync_search(alpm_list_t *sync + alpm_pkg_t *pkg = alpm_list_getdata(j); + + if(!config->quiet) { +- printf("%s/%s %s", alpm_db_get_name(db), alpm_pkg_get_name(pkg), +- alpm_pkg_get_version(pkg)); ++ color_printf(COLOR_MAGENTA_ALL, "%s/", alpm_db_get_name(db)); ++ color_printf(COLOR_WHITE_ALL, "%s ", alpm_pkg_get_name(pkg)); ++ color_printf(COLOR_GREEN_ALL, "%s", alpm_pkg_get_version(pkg)); + } else { + printf("%s", alpm_pkg_get_name(pkg)); + } +@@ -389,16 +390,11 @@ static int sync_search(alpm_list_t *sync + if(!config->quiet) { + if((grp = alpm_pkg_get_groups(pkg)) != NULL) { + alpm_list_t *k; +- printf(" ("); ++ color_printf(COLOR_BLUE_ALL, " ("); + for(k = grp; k; k = alpm_list_next(k)) { + const char *group = alpm_list_getdata(k); +- printf("%s", group); +- if(alpm_list_next(k)) { +- /* only print a spacer if there are more groups */ +- printf(" "); +- } ++ color_printf(COLOR_BLUE_ALL, "%s%s", group, (alpm_list_next(k) ? " " : ")")); + } +- printf(")"); + } + + print_installed(db_local, pkg); +@@ -433,8 +429,8 @@ static int sync_group(int level, alpm_li + /* get names of packages in group */ + for(k = grp->packages; k; k = alpm_list_next(k)) { + if(!config->quiet) { +- printf("%s %s\n", grpname, +- alpm_pkg_get_name(alpm_list_getdata(k))); ++ color_printf(COLOR_BLUE_ALL, "%s ", grpname); ++ color_printf(COLOR_WHITE_ALL, "%s\n", alpm_pkg_get_name(alpm_list_getdata(k))); + } else { + printf("%s\n", alpm_pkg_get_name(alpm_list_getdata(k))); + } +@@ -451,8 +447,8 @@ static int sync_group(int level, alpm_li + + if(level > 1) { + for(k = grp->packages; k; k = alpm_list_next(k)) { +- printf("%s %s\n", grp->name, +- alpm_pkg_get_name(alpm_list_getdata(k))); ++ color_printf(COLOR_BLUE_ALL, "%s ", grp->name); ++ color_printf(COLOR_WHITE_ALL, "%s\n", alpm_pkg_get_name(alpm_list_getdata(k))); + } + } else { + /* print grp names only, no package names */ +@@ -570,8 +566,9 @@ static int sync_list(alpm_list_t *syncs, + alpm_pkg_t *pkg = alpm_list_getdata(j); + + if(!config->quiet) { +- printf("%s %s %s", alpm_db_get_name(db), alpm_pkg_get_name(pkg), +- alpm_pkg_get_version(pkg)); ++ color_printf(COLOR_MAGENTA_ALL, "%s ", alpm_db_get_name(db)); ++ color_printf(COLOR_WHITE_ALL, "%s ", alpm_pkg_get_name(pkg)); ++ color_printf(COLOR_GREEN_ALL, "%s", alpm_pkg_get_version(pkg)); + print_installed(db_local, pkg); + printf("\n"); + } else { +@@ -654,7 +651,7 @@ static int process_group(alpm_list_t *db + + + if(config->print == 0) { +- printf(_(":: There are %d members in group %s:\n"), count, ++ color_printf(COLOR_DOUBLECOLON, _(":: There are %d members in group %s:\n"), count, + group); + select_display(pkgs); + char *array = malloc(count); +@@ -771,7 +768,7 @@ static int sync_trans(alpm_list_t *targe + } + + if(config->op_s_upgrade) { +- printf(_(":: Starting full system upgrade...\n")); ++ color_printf(COLOR_DOUBLECOLON, _(":: Starting full system upgrade...\n")); + alpm_logaction(config->handle, "starting full system upgrade\n"); + if(alpm_sync_sysupgrade(config->handle, config->op_s_upgrade >= 2) == -1) { + pm_printf(ALPM_LOG_ERROR, "%s\n", alpm_strerror(alpm_errno(config->handle))); +@@ -797,14 +794,14 @@ int sync_prepare_execute(void) + case ALPM_ERR_PKG_INVALID_ARCH: + for(i = data; i; i = alpm_list_next(i)) { + char *pkg = alpm_list_getdata(i); +- printf(_(":: package %s does not have a valid architecture\n"), pkg); ++ color_printf(COLOR_DOUBLECOLON, _(":: package %s does not have a valid architecture\n"), pkg); + } + break; + case ALPM_ERR_UNSATISFIED_DEPS: + for(i = data; i; i = alpm_list_next(i)) { + alpm_depmissing_t *miss = alpm_list_getdata(i); + char *depstring = alpm_dep_compute_string(miss->depend); +- printf(_(":: %s: requires %s\n"), miss->target, depstring); ++ color_printf(COLOR_DOUBLECOLON, _(":: %s: requires %s\n"), miss->target, depstring); + free(depstring); + } + break; +@@ -813,11 +810,11 @@ int sync_prepare_execute(void) + alpm_conflict_t *conflict = alpm_list_getdata(i); + /* only print reason if it contains new information */ + if(conflict->reason->mod == ALPM_DEP_MOD_ANY) { +- printf(_(":: %s and %s are in conflict\n"), ++ color_printf(COLOR_DOUBLECOLON, _(":: %s and %s are in conflict\n"), + conflict->package1, conflict->package2); + } else { + char *reason = alpm_dep_compute_string(conflict->reason); +- printf(_(":: %s and %s are in conflict (%s)\n"), ++ color_printf(COLOR_DOUBLECOLON, _(":: %s and %s are in conflict (%s)\n"), + conflict->package1, conflict->package2, reason); + free(reason); + } +@@ -850,9 +847,9 @@ int sync_prepare_execute(void) + + int confirm; + if(config->op_s_downloadonly) { +- confirm = yesno(_("Proceed with download?")); ++ confirm = yesno(NULL, _("Proceed with download?")); + } else { +- confirm = yesno(_("Proceed with installation?")); ++ confirm = yesno(NULL, _("Proceed with installation?")); + } + if(!confirm) { + goto cleanup; +@@ -872,7 +869,7 @@ int sync_prepare_execute(void) + conflict->file, conflict->target, conflict->ctarget); + break; + case ALPM_FILECONFLICT_FILESYSTEM: +- printf(_("%s: %s exists in filesystem\n"), ++ color_printf(COLOR_WHITE_COLON, _("%s: %s exists in filesystem\n"), + conflict->target, conflict->file); + break; + } +@@ -891,7 +888,7 @@ int sync_prepare_execute(void) + break; + } + /* TODO: stderr? */ +- printf(_("Errors occurred, no packages were upgraded.\n")); ++ color_printf(COLOR_RED_ALL, _("Errors occurred, no packages were upgraded.\n")); + retval = 1; + goto cleanup; + } +@@ -939,7 +936,7 @@ int pacman_sync(alpm_list_t *targets) + + if(config->op_s_sync) { + /* grab a fresh package list */ +- printf(_(":: Synchronizing package databases...\n")); ++ color_printf(COLOR_DOUBLECOLON, _(":: Synchronizing package databases...\n")); + alpm_logaction(config->handle, "synchronizing package lists\n"); + if(!sync_synctree(config->op_s_sync, sync_dbs)) { + return 1; +@@ -992,9 +989,9 @@ int pacman_sync(alpm_list_t *targets) + alpm_list_t *tmp = NULL; + if(config->op_s_upgrade || (tmp = alpm_list_diff(targets, packages, (alpm_list_fn_cmp)strcmp))) { + alpm_list_free(tmp); +- printf(_(":: The following packages should be upgraded first :\n")); +- list_display(" ", packages); +- if(yesno(_(":: Do you want to cancel the current operation\n" ++ color_printf(COLOR_DOUBLECOLON, _(":: The following packages should be upgraded first :\n")); ++ list_display(NULL, " ", packages); ++ if(yesno(COLOR_DOUBLECOLON2, _(":: Do you want to cancel the current operation\n" + ":: and upgrade these packages now?"))) { + FREELIST(targs); + targs = packages; +diff -up -Npaur a/src/pacman/util.c b/src/pacman/util.c +--- a/src/pacman/util.c 2012-02-20 07:18:31.000000000 +0200 ++++ b/src/pacman/util.c 2012-07-20 21:48:20.270827634 +0300 +@@ -48,6 +48,20 @@ + #include "conf.h" + #include "callback.h" + ++#define COLOR_LEN 8 ++ ++typedef struct __colortab_t { ++ char red[COLOR_LEN + 1]; ++ char green[COLOR_LEN + 1]; ++ char yellow[COLOR_LEN + 1]; ++ char blue[COLOR_LEN + 1]; ++ char magenta[COLOR_LEN + 1]; ++ char cyan[COLOR_LEN + 1]; ++ char white[COLOR_LEN + 1]; ++ char none[COLOR_LEN + 1]; ++} colortab_t; ++ ++static colortab_t colortab; + + int trans_init(alpm_transflag_t flags, int check_valid) + { +@@ -463,10 +477,10 @@ static size_t string_length(const char * + return len; + } + +-void string_display(const char *title, const char *string) ++void string_display(const colordata_t *colors_title, const char *title, const char *string) + { + if(title) { +- printf("%s ", title); ++ color_printf(colors_title, "%s ", title); + } + if(string == NULL || string[0] == '\0') { + printf(_("None")); +@@ -599,14 +613,14 @@ int table_display(const char *title, con + return 0; + } + +-void list_display(const char *title, const alpm_list_t *list) ++void list_display(const colordata_t *colors_title, const char *title, const alpm_list_t *list) + { + const alpm_list_t *i; + size_t len = 0; + + if(title) { + len = string_length(title) + 1; +- printf("%s ", title); ++ color_printf(colors_title, "%s ", title); + } + + if(!list) { +@@ -640,13 +654,13 @@ void list_display(const char *title, con + } + } + +-void list_display_linebreak(const char *title, const alpm_list_t *list) ++void list_display_linebreak(const colordata_t *colors_title, const char *title, const alpm_list_t *list) + { + size_t len = 0; + + if(title) { + len = string_length(title) + 1; +- printf("%s ", title); ++ color_printf(colors_title, "%s ", title); + } + + if(!list) { +@@ -867,11 +881,11 @@ static void _display_targets(alpm_list_t + alpm_list_t *header = create_verbose_header(show_dl_size); + if(table_display(str, header, rows) != 0) { + /* fallback to list display if table wouldn't fit */ +- list_display(str, names); ++ list_display(COLOR_YELLOW_ALL, str, names); + } + alpm_list_free(header); + } else { +- list_display(str, names); ++ list_display(COLOR_YELLOW_ALL, str, names); + } + printf("\n"); + +@@ -886,21 +900,21 @@ static void _display_targets(alpm_list_t + + if(dlsize > 0 || config->op_s_downloadonly) { + size = humanize_size(dlsize, 'M', 2, &label); +- printf(_("Total Download Size: %.2f %s\n"), size, label); ++ color_printf(COLOR_WHITE_COLON, _("Total Download Size: %.2f %s\n"), size, label); + } + if(!config->op_s_downloadonly) { + if(isize > 0) { + size = humanize_size(isize, 'M', 2, &label); +- printf(_("Total Installed Size: %.2f %s\n"), size, label); ++ color_printf(COLOR_WHITE_COLON, _("Total Installed Size: %.2f %s\n"), size, label); + } + if(rsize > 0 && isize == 0) { + size = humanize_size(rsize, 'M', 2, &label); +- printf(_("Total Removed Size: %.2f %s\n"), size, label); ++ color_printf(COLOR_WHITE_COLON, _("Total Removed Size: %.2f %s\n"), size, label); + } + /* only show this net value if different from raw installed size */ + if(isize > 0 && rsize > 0) { + size = humanize_size(isize - rsize, 'M', 2, &label); +- printf(_("Net Upgrade Size: %.2f %s\n"), size, label); ++ color_printf(COLOR_WHITE_COLON, _("Net Upgrade Size: %.2f %s\n"), size, label); + } + } + } +@@ -1115,7 +1129,7 @@ void display_new_optdepends(alpm_pkg_t * + alpm_list_t *optdeps = alpm_list_diff(new,old,str_cmp); + if(optdeps) { + printf(_("New optional dependencies for %s\n"), alpm_pkg_get_name(newpkg)); +- list_display_linebreak(" ", optdeps); ++ list_display_linebreak(NULL, " ", optdeps); + } + alpm_list_free(optdeps); + } +@@ -1125,7 +1139,7 @@ void display_optdepends(alpm_pkg_t *pkg) + alpm_list_t *optdeps = alpm_pkg_get_optdepends(pkg); + if(optdeps) { + printf(_("Optional dependencies for %s\n"), alpm_pkg_get_name(pkg)); +- list_display_linebreak(" ", optdeps); ++ list_display_linebreak(NULL, " ", optdeps); + } + } + +@@ -1133,9 +1147,9 @@ static void display_repo_list(const char + { + const char *prefix= " "; + +- printf(":: "); +- printf(_("Repository %s\n"), dbname); +- list_display(prefix, list); ++ color_printf(COLOR_BLUE_ALL, ":: "); ++ color_printf(COLOR_WHITE_ALL, _("Repository %s\n"), dbname); ++ list_display(NULL, prefix, list); + } + + void select_display(const alpm_list_t *pkglist) +@@ -1354,7 +1368,7 @@ int select_question(int count) + + + /* presents a prompt and gets a Y/N answer */ +-static int question(short preset, char *fmt, va_list args) ++static int question(const colordata_t *colors, short preset, char *fmt, va_list args) + { + char response[32]; + FILE *stream; +@@ -1370,7 +1384,7 @@ static int question(short preset, char * + fflush(stdout); + fflush(stderr); + +- vfprintf(stream, fmt, args); ++ color_vfprintf(stream, colors, fmt, args); + + if(preset) { + fprintf(stream, " %s ", _("[Y/n]")); +@@ -1407,25 +1421,25 @@ static int question(short preset, char * + return 0; + } + +-int yesno(char *fmt, ...) ++int yesno(const colordata_t *colors, char *fmt, ...) + { + int ret; + va_list args; + + va_start(args, fmt); +- ret = question(1, fmt, args); ++ ret = question(colors, 1, fmt, args); + va_end(args); + + return ret; + } + +-int noyes(char *fmt, ...) ++int noyes(const colordata_t *colors, char *fmt, ...) + { + int ret; + va_list args; + + va_start(args, fmt); +- ret = question(0, fmt, args); ++ ret = question(colors, 0, fmt, args); + va_end(args); + + return ret; +@@ -1474,22 +1488,42 @@ int pm_vasprintf(char **string, alpm_log + ret = vasprintf(&msg, format, args); + + /* print a prefix to the message */ +- switch(level) { +- case ALPM_LOG_ERROR: +- pm_asprintf(string, _("error: %s"), msg); +- break; +- case ALPM_LOG_WARNING: +- pm_asprintf(string, _("warning: %s"), msg); +- break; +- case ALPM_LOG_DEBUG: +- pm_asprintf(string, "debug: %s", msg); +- break; +- case ALPM_LOG_FUNCTION: +- pm_asprintf(string, "function: %s", msg); +- break; +- default: +- pm_asprintf(string, "%s", msg); +- break; ++ if(isatty(fileno(stdout))) { ++ switch(level) { ++ case ALPM_LOG_ERROR: ++ pm_asprintf(string, "%s%s%s%s", colortab.red, _("error: "), colortab.none, msg); ++ break; ++ case ALPM_LOG_WARNING: ++ pm_asprintf(string, "%s%s%s%s", colortab.yellow, _("warning: "), colortab.none, msg); ++ break; ++ case ALPM_LOG_DEBUG: ++ pm_asprintf(string, "debug: %s", msg); ++ break; ++ case ALPM_LOG_FUNCTION: ++ pm_asprintf(string, "function: %s", msg); ++ break; ++ default: ++ pm_asprintf(string, "%s", msg); ++ break; ++ } ++ } else { ++ switch(level) { ++ case ALPM_LOG_ERROR: ++ pm_asprintf(string, _("error: %s"), msg); ++ break; ++ case ALPM_LOG_WARNING: ++ pm_asprintf(string, _("warning: %s"), msg); ++ break; ++ case ALPM_LOG_DEBUG: ++ pm_asprintf(string, "debug: %s", msg); ++ break; ++ case ALPM_LOG_FUNCTION: ++ pm_asprintf(string, "function: %s", msg); ++ break; ++ default: ++ pm_asprintf(string, "%s", msg); ++ break; ++ } + } + free(msg); + +@@ -1524,10 +1558,10 @@ int pm_vfprintf(FILE *stream, alpm_logle + /* print a prefix to the message */ + switch(level) { + case ALPM_LOG_ERROR: +- fprintf(stream, _("error: ")); ++ color_fprintf(stream, COLOR_RED_ALL, _("error: ")); + break; + case ALPM_LOG_WARNING: +- fprintf(stream, _("warning: ")); ++ color_fprintf(stream, COLOR_YELLOW_ALL, _("warning: ")); + break; + case ALPM_LOG_DEBUG: + fprintf(stream, "debug: "); +@@ -1566,4 +1600,310 @@ char *strndup(const char *s, size_t n) + } + #endif + ++/* pacman-color */ ++ ++int _set_color_sequence(const char* name, char* dest) ++{ ++ int ret = 0; ++ ++ if(strcmp(name, "black") == 0) { ++ strncpy(dest, "\033[0;30m", COLOR_LEN); ++ } else if(strcmp(name, "red") == 0) { ++ strncpy(dest, "\033[0;31m", COLOR_LEN); ++ } else if(strcmp(name, "green") == 0) { ++ strncpy(dest, "\033[0;32m", COLOR_LEN); ++ } else if(strcmp(name, "yellow") == 0) { ++ strncpy(dest, "\033[0;33m", COLOR_LEN); ++ } else if(strcmp(name, "blue") == 0) { ++ strncpy(dest, "\033[0;34m", COLOR_LEN); ++ } else if(strcmp(name, "magenta") == 0) { ++ strncpy(dest, "\033[0;35m", COLOR_LEN); ++ } else if(strcmp(name, "cyan") == 0) { ++ strncpy(dest, "\033[0;36m", COLOR_LEN); ++ } else if(strcmp(name, "white") == 0) { ++ strncpy(dest, "\033[0;37m", COLOR_LEN); ++ } else if(strcmp(name, "gray") == 0) { ++ strncpy(dest, "\033[1;30m", COLOR_LEN); ++ } else if(strcmp(name, "intensive red") == 0) { ++ strncpy(dest, "\033[1;31m", COLOR_LEN); ++ } else if(strcmp(name, "intensive green") == 0) { ++ strncpy(dest, "\033[1;32m", COLOR_LEN); ++ } else if(strcmp(name, "intensive yellow") == 0) { ++ strncpy(dest, "\033[1;33m", COLOR_LEN); ++ } else if(strcmp(name, "intensive blue") == 0) { ++ strncpy(dest, "\033[1;34m", COLOR_LEN); ++ } else if(strcmp(name, "intensive magenta") == 0) { ++ strncpy(dest, "\033[1;35m", COLOR_LEN); ++ } else if(strcmp(name, "intensive cyan") == 0) { ++ strncpy(dest, "\033[1;36m", COLOR_LEN); ++ } else if(strcmp(name, "intensive white") == 0) { ++ strncpy(dest, "\033[1;37m", COLOR_LEN); ++ } else if(strcmp(name, "intensive foreground") == 0) { ++ strncpy(dest, "\033[m\033[1m", COLOR_LEN); ++ } else if(strcmp(name, "none") == 0) { ++ strncpy(dest, "\033[m", COLOR_LEN); ++ } else { ++ ret = 1; ++ } ++ dest[COLOR_LEN] = '\0'; ++ return(ret); ++} ++ ++void _insert_color(FILE* stream, color_t color) ++{ ++ switch(color) { ++ case COLOR_RED: ++ fprintf(stream, colortab.red); ++ break; ++ case COLOR_GREEN: ++ fprintf(stream, colortab.green); ++ break; ++ case COLOR_YELLOW: ++ fprintf(stream, colortab.yellow); ++ break; ++ case COLOR_BLUE: ++ fprintf(stream, colortab.blue); ++ break; ++ case COLOR_MAGENTA: ++ fprintf(stream, colortab.magenta); ++ break; ++ case COLOR_CYAN: ++ fprintf(stream, colortab.cyan); ++ break; ++ case COLOR_WHITE: ++ fprintf(stream, colortab.white); ++ break; ++ case COLOR_NONE: ++ fprintf(stream, colortab.none); ++ break; ++ default:; ++ } ++} ++ ++int _parsecolorconfig(colortab_t* colortab, char* file) ++{ ++ _set_color_sequence("intensive red", colortab->red); ++ _set_color_sequence("intensive green", colortab->green); ++ _set_color_sequence("intensive yellow", colortab->yellow); ++ _set_color_sequence("intensive blue", colortab->blue); ++ _set_color_sequence("intensive magenta", colortab->magenta); ++ _set_color_sequence("intensive cyan", colortab->cyan); ++ _set_color_sequence("intensive foreground", colortab->white); ++ _set_color_sequence("none", colortab->none); ++ ++ FILE* fp = NULL; ++ int linenum = 0; ++ char line[PATH_MAX+1]; ++ char* ptr; ++ ++ fp = fopen(file, "r"); ++ if(fp == NULL) { ++ pm_printf(ALPM_LOG_ERROR, _("config file %s could not be read.\n"), file); ++ return 1; ++ } ++ while(fgets(line, PATH_MAX, fp)) { ++ linenum++; ++ strtrim(line); ++ ++ if(strlen(line) == 0 || line[0] == '#') { ++ continue; ++ } ++ if((ptr = strchr(line, '#'))) { ++ *ptr = '\0'; ++ } ++ ++ char* key = line; ++ ptr = line; ++ strsep(&ptr, "="); ++ strtrim(key); ++ strtrim(ptr); ++ ++ if(key == NULL) { ++ pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: syntax error in config file- missing key.\n"), ++ file, linenum); ++ return 1; ++ } ++ if(strcmp(key, "Red") == 0) { ++ if(_set_color_sequence(ptr, colortab->red)) { ++ pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: color '%s' not recognized.\n"), ++ file, linenum, ptr); ++ } ++ } else if(strcmp(key, "Green") == 0) { ++ if(_set_color_sequence(ptr, colortab->green)) { ++ pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: color '%s' not recognized.\n"), ++ file, linenum, ptr); ++ } ++ } else if(strcmp(key, "Yellow") == 0) { ++ if(_set_color_sequence(ptr, colortab->yellow)) { ++ pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: color '%s' not recognized.\n"), ++ file, linenum, ptr); ++ } ++ } else if(strcmp(key, "Blue") == 0) { ++ if(_set_color_sequence(ptr, colortab->blue)) { ++ pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: color '%s' not recognized.\n"), ++ file, linenum, ptr); ++ } ++ } else if(strcmp(key, "Magenta") == 0) { ++ if(_set_color_sequence(ptr, colortab->magenta)) { ++ pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: color '%s' not recognized.\n"), ++ file, linenum, ptr); ++ } ++ } else if(strcmp(key, "Cyan") == 0) { ++ if(_set_color_sequence(ptr, colortab->cyan)) { ++ pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: color '%s' not recognized.\n"), ++ file, linenum, ptr); ++ } ++ } else if(strcmp(key, "White") == 0) { ++ if(_set_color_sequence(ptr, colortab->white)) { ++ pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: color '%s' not recognized.\n"), ++ file, linenum, ptr); ++ } ++ } else { ++ pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: directive '%s' not recognized.\n"), ++ file, linenum, key); ++ return(1); ++ } ++ } ++ return(0); ++} ++ ++int parsecolorconfig() ++{ ++ return(_parsecolorconfig(&colortab, "/etc/pacman.d/color.conf")); ++} ++ ++int color_vfprintf(FILE* stream, const colordata_t* colors, const char* format, va_list args) ++{ ++ int ret = 0; ++ ++ if(isatty(fileno(stream)) && colors) { ++ char* msg = NULL; ++ ret = vasprintf(&msg, format, args); ++ if(msg == NULL) { ++ return(ret); ++ } ++ ++ const colordata_t* colorpos = colors; ++ color_t colorlast = COLOR_NONE; ++ int len = strlen(msg) + 1; ++ wchar_t* wcstr = calloc(len, sizeof(wchar_t)); ++ len = mbstowcs(wcstr, msg, len); ++ free(msg); ++ const wchar_t *strpos = wcstr; ++ ++ while(*strpos) { ++ if(colorpos->color != COLOR_END && ++ ((colorpos->separator == SEP_ANY) || ++ (colorpos->separator == SEP_LINE && *strpos == L'\n') || ++ (colorpos->separator == SEP_COLON && (*strpos == L':' || *strpos == L':')))) { ++ _insert_color(stream, colorpos->color); ++ colorlast = colorpos->color; ++ colorpos++; ++ } ++ fprintf(stream, "%lc", (wint_t)*strpos); ++ strpos++; ++ } ++ free(wcstr); ++ ++ if(colorlast != COLOR_NONE) { ++ _insert_color(stream, COLOR_NONE); ++ } ++ } else { ++ ret = vfprintf(stream, format, args); ++ } ++ return(ret); ++} ++ ++int color_fprintf(FILE* stream, const colordata_t* colors, const char* format, ...) ++{ ++ int ret; ++ va_list args; ++ va_start(args, format); ++ ret = color_vfprintf(stream, colors, format, args); ++ va_end(args); ++ return(ret); ++} ++ ++int color_printf(const colordata_t* colors, const char* format, ...) ++{ ++ int ret; ++ va_list args; ++ va_start(args, format); ++ ret = color_vfprintf(stdout, colors, format, args); ++ va_end(args); ++ return(ret); ++} ++ ++void color_string_display(const colordata_t* colors_title, const char* title, const colordata_t* colors_string, const char* string) ++{ ++ if(title) { ++ color_printf(colors_title, "%s ", title); ++ } ++ if(string == NULL || string[0] == '\0') { ++ printf(_("None")); ++ } else { ++ color_printf(colors_string, "%s", string); ++ } ++ printf("\n"); ++} ++ ++const colordata_t COLOR_WHITE_ALL[] = { ++ { SEP_ANY, COLOR_WHITE }, ++ { SEP_LINE, COLOR_NONE }, ++ { SEP_ANY, COLOR_END } }; ++ ++const colordata_t COLOR_GREEN_ALL[] = { ++ { SEP_ANY, COLOR_GREEN }, ++ { SEP_LINE, COLOR_NONE }, ++ { SEP_ANY, COLOR_END } }; ++ ++const colordata_t COLOR_RED_ALL[] = { ++ { SEP_ANY, COLOR_RED }, ++ { SEP_LINE, COLOR_NONE }, ++ { SEP_ANY, COLOR_END } }; ++ ++const colordata_t COLOR_BLUE_ALL[] = { ++ { SEP_ANY, COLOR_BLUE }, ++ { SEP_LINE, COLOR_NONE }, ++ { SEP_ANY, COLOR_END } }; ++ ++const colordata_t COLOR_YELLOW_ALL[] = { ++ { SEP_ANY, COLOR_YELLOW }, ++ { SEP_LINE, COLOR_NONE }, ++ { SEP_ANY, COLOR_END } }; ++ ++const colordata_t COLOR_MAGENTA_ALL[] = { ++ { SEP_ANY, COLOR_MAGENTA }, ++ { SEP_LINE, COLOR_NONE }, ++ { SEP_ANY, COLOR_END } }; ++ ++const colordata_t COLOR_CYAN_ALL[] = { ++ { SEP_ANY, COLOR_CYAN }, ++ { SEP_LINE, COLOR_NONE }, ++ { SEP_ANY, COLOR_END } }; ++ ++const colordata_t COLOR_DOUBLECOLON[] = { ++ { SEP_ANY, COLOR_BLUE }, ++ { SEP_ANY, COLOR_SAME }, ++ { SEP_ANY, COLOR_WHITE }, ++ { SEP_LINE, COLOR_NONE }, ++ { SEP_ANY, COLOR_END } }; ++ ++const colordata_t COLOR_DOUBLECOLON2[] = { ++ { SEP_ANY, COLOR_BLUE }, ++ { SEP_ANY, COLOR_SAME }, ++ { SEP_ANY, COLOR_WHITE }, ++ { SEP_LINE, COLOR_NONE }, ++ { SEP_ANY, COLOR_BLUE }, ++ { SEP_ANY, COLOR_SAME }, ++ { SEP_ANY, COLOR_WHITE }, ++ { SEP_LINE, COLOR_NONE }, ++ { SEP_ANY, COLOR_END } }; ++ ++const colordata_t COLOR_WHITE_COLON[] = { ++ { SEP_ANY, COLOR_WHITE }, ++ { SEP_COLON, COLOR_SAME }, ++ { SEP_ANY, COLOR_NONE }, ++ { SEP_ANY, COLOR_END } }; ++ + /* vim: set ts=2 sw=2 noet: */ +diff -up -Npaur a/src/pacman/util.h b/src/pacman/util.h +--- a/src/pacman/util.h 2012-02-03 16:56:16.000000000 +0200 ++++ b/src/pacman/util.h 2012-07-20 21:48:20.271827634 +0300 +@@ -45,6 +45,48 @@ typedef struct _pm_target_t { + int is_explicit; + } pm_target_t; + ++/* pacman-color */ ++typedef enum _separator_t { ++ SEP_ANY = 0, ++ SEP_LINE, ++ SEP_COLON, ++} separator_t; ++ ++typedef enum _color_t { ++ COLOR_END = 0, ++ COLOR_SAME, ++ COLOR_RED, ++ COLOR_GREEN, ++ COLOR_YELLOW, ++ COLOR_BLUE, ++ COLOR_MAGENTA, ++ COLOR_CYAN, ++ COLOR_WHITE, ++ COLOR_NONE, ++} color_t; ++ ++typedef struct _colordata_t { ++ separator_t separator; ++ color_t color; ++} colordata_t; ++ ++extern const colordata_t COLOR_WHITE_ALL[]; ++extern const colordata_t COLOR_GREEN_ALL[]; ++extern const colordata_t COLOR_RED_ALL[]; ++extern const colordata_t COLOR_BLUE_ALL[]; ++extern const colordata_t COLOR_YELLOW_ALL[]; ++extern const colordata_t COLOR_MAGENTA_ALL[]; ++extern const colordata_t COLOR_CYAN_ALL[]; ++extern const colordata_t COLOR_DOUBLECOLON[]; ++extern const colordata_t COLOR_DOUBLECOLON2[]; ++extern const colordata_t COLOR_WHITE_COLON[]; ++ ++int parsecolorconfig(); ++int color_fprintf(FILE* stream, const colordata_t* colors, const char* format, ...) __attribute__((format(printf,3,4))); ++int color_printf(const colordata_t* colors, const char* format, ...) __attribute__((format(printf,2,3))); ++int color_vfprintf(FILE* stream, const colordata_t* colors, const char* format, va_list args) __attribute__((format(printf,3,0))); ++void color_string_display(const colordata_t* colors_title, const char* title, const colordata_t* colors_string, const char* string); ++ + void trans_init_error(void); + int trans_init(alpm_transflag_t flags, int check_valid); + int trans_release(void); +@@ -58,12 +100,12 @@ void indentprint(const char *str, size_t + char *strtrim(char *str); + char *strreplace(const char *str, const char *needle, const char *replace); + alpm_list_t *strsplit(const char *str, const char splitchar); +-void string_display(const char *title, const char *string); ++void string_display(const colordata_t *colors_title, const char *title, const char *string); + double humanize_size(off_t bytes, const char target_unit, int precision, + const char **label); + int table_display(const char *title, const alpm_list_t *header, const alpm_list_t *rows); +-void list_display(const char *title, const alpm_list_t *list); +-void list_display_linebreak(const char *title, const alpm_list_t *list); ++void list_display(const colordata_t *colors_title, const char *title, const alpm_list_t *list); ++void list_display_linebreak(const colordata_t *colors_title, const char *title, const alpm_list_t *list); + void signature_display(const char *title, alpm_siglist_t *siglist); + void display_targets(void); + int str_cmp(const void *s1, const void *s2); +@@ -73,8 +115,8 @@ void print_packages(const alpm_list_t *p + void select_display(const alpm_list_t *pkglist); + int select_question(int count); + int multiselect_question(char *array, int count); +-int yesno(char *fmt, ...); +-int noyes(char *fmt, ...); ++int yesno(const colordata_t *colors, char *fmt, ...); ++int noyes(const colordata_t *colors, char *fmt, ...); + + int pm_printf(alpm_loglevel_t level, const char *format, ...) __attribute__((format(printf,2,3))); + int pm_asprintf(char **string, const char *format, ...); diff --git a/pcr/perl-iptables-parse/PKGBUILD b/pcr/perl-iptables-parse/PKGBUILD new file mode 100644 index 000000000..94fe8e17a --- /dev/null +++ b/pcr/perl-iptables-parse/PKGBUILD @@ -0,0 +1,22 @@ +# Contributor: Weirch Sodora <sodora@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=perl-iptables-parse +pkgver=1.1 +pkgrel=1 +pkgdesc="IPTables::Parse - Perl extension for parsing iptables and ip6tables firewall rulesets" +arch=('i686' 'x86_64') +url="http://search.cpan.org/~mrash/IPTables-Parse/" +license=('GPL' 'PerlArtistic') +depends=('perl' 'iptables') +options=('!emptydirs') +source=(http://search.cpan.org/CPAN/authors/id/M/MR/MRASH/IPTables-Parse-$pkgver.tar.gz) + +build() { + cd $startdir/src/IPTables-Parse-$pkgver + PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor || return 1 + make || return 1 + make install DESTDIR=$startdir/pkg || return 1 + find $startdir/pkg -name '.packlist' -delete + find $startdir/pkg -name '*.pod' -delete +} diff --git a/pcr/python2-fabric/PKGBUILD b/pcr/python2-fabric/PKGBUILD new file mode 100644 index 000000000..7552eaabc --- /dev/null +++ b/pcr/python2-fabric/PKGBUILD @@ -0,0 +1,23 @@ +# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com> +# Contributor: Francois Boulogne <fboulogne at april dot org> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=python2-fabric +pkgver=1.5.0 +pkgrel=2 +pkgdesc="Python library and command-line tool designed to streamline deploying applications or performing system administration tasks via the SSH protocol" +url="http://fabfile.org/" +license=('BSD') +arch=('any') +depends=('python2>=2.5' 'pycrypto' 'python2-paramiko>=1.9.0' 'python2-distribute' 'python2-ssh') +source=("http://pypi.python.org/packages/source/F/Fabric/Fabric-${pkgver}.tar.gz") +md5sums=('13b7b98149497fb7ab6f880e3e875f89') + +build() { + cd ${srcdir}/Fabric-${pkgver} + python2 setup.py install --root=${pkgdir} --optimize=1 + + install -D -m644 README.rst ${pkgdir}/usr/share/doc/${pkgname}/README.rst + install -D -m644 LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE +} +md5sums=('13b7b98149497fb7ab6f880e3e875f89') diff --git a/pcr/python2-paramiko/PKGBUILD b/pcr/python2-paramiko/PKGBUILD new file mode 100644 index 000000000..da62b4e28 --- /dev/null +++ b/pcr/python2-paramiko/PKGBUILD @@ -0,0 +1,33 @@ +# $Id$ +# Maintainer: Chris Brannon <cmbrannon79@gmail.com> +# Contributor: Douglas Soares de Andrade <douglas@archlinux.org> +# Contributor: Mario Danic <mario.danic@gmail.com> + +pkgbase=python-paramiko +pkgname=python2-paramiko +pkgver=1.9.0 +pkgrel=1 +pkgdesc="Python module that implements the SSH2 protocol" +url="http://www.lag.net/paramiko/" +license=('LGPL') +arch=('any') +depends=('python2-crypto') +conflicts=() +replaces=() +source=(http://pypi.python.org/packages/source/p/paramiko/paramiko-$pkgver.tar.gz) + + +package_python2-paramiko() { + cd "$srcdir/paramiko-$pkgver" + + python2 setup.py install --root="$pkgdir" --optimize=1 + install -Dm644 README "$pkgdir/usr/share/doc/$pkgname/README" + install -dm755 "$pkgdir/usr/share/doc/$pkgname/demos" + install -m644 demos/* "$pkgdir/usr/share/doc/$pkgname/demos" + chmod 755 "$pkgdir/usr/share/doc/$pkgname/demos/"*.py + + find "$pkgdir" -name '*.py' -print0 |xargs -0 \ + sed -i -e 's,^#!/usr/bin/env python$,#!/usr/bin/env python2,' \ + -e 's,^#!/usr/bin/python$,#!/usr/bin/python2,' +} +md5sums=('b78472021ff6586dd61ad6972032f54f') diff --git a/pcr/python2-pillow/PKGBUILD b/pcr/python2-pillow/PKGBUILD new file mode 100644 index 000000000..5840a5f82 --- /dev/null +++ b/pcr/python2-pillow/PKGBUILD @@ -0,0 +1,22 @@ +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=python2-pillow +_appname=Pillow +pkgver=1.7.8 +pkgrel=2 +pkgdesc="Python Imaging Library (PIL) fork." +arch=(i686 x86_64) +url="https://github.com/dwaiter/django-ckeditor" +license=('BSD') +depends=('python2') +provides=('python2-imaging') +conflicts=('python2-imaging') +makedepends=('python2-distribute') +source=("http://pypi.python.org/packages/source/P/${_appname}/${_appname}-${pkgver}.zip") +md5sums=('41d8688d4db72673069a6dc63b5289d6') + +package() { + cd "$srcdir/$_appname-$pkgver" + python2 setup.py install --root="$pkgdir/" --optimize=1 +} + diff --git a/pcr/python2-ropemacs/PKGBUILD b/pcr/python2-ropemacs/PKGBUILD new file mode 100644 index 000000000..84c5661ba --- /dev/null +++ b/pcr/python2-ropemacs/PKGBUILD @@ -0,0 +1,21 @@ +# Contributor: Renato Garcia <fgarcia.renato@gmail.com> +# Contributor: yescalona <yescaloan[at]ug[dot]uchile[dot]cl> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=python2-ropemacs +_pkgname=ropemacs +pkgver=0.7 +pkgrel=1 +pkgdesc='Emacs mode that uses rope_ library to provide features like python refactorings and code-assists.' +url='http://bitbucket.org/agr/ropemacs' +arch=('any') +license=('GPL') +depends=('python2-ropemode' 'pymacs') +install=python2-ropemacs.install +source=("http://bitbucket.org/agr/${_pkgname}/get/${pkgver}.tar.bz2") +md5sums=('0034d77822728da561b8ef213eea0762') + +package() { + cd "${srcdir}/agr-ropemacs-93721bd03667" + python2 ./setup.py install --root="${pkgdir}" --prefix=/usr +} diff --git a/pcr/python2-ropemacs/python2-ropemacs.install b/pcr/python2-ropemacs/python2-ropemacs.install new file mode 100644 index 000000000..4b303b8b4 --- /dev/null +++ b/pcr/python2-ropemacs/python2-ropemacs.install @@ -0,0 +1,8 @@ +post_install() { + +echo "After installing pymacs, add these lines to your ``~/.emacs`` file:" +echo "(require 'pymacs)" +echo "(pymacs-load \"ropemacs\" \"rope-\")" +/bin/true +} + diff --git a/pcr/python2-ropemode/PKGBUILD b/pcr/python2-ropemode/PKGBUILD new file mode 100644 index 000000000..bdeb58a68 --- /dev/null +++ b/pcr/python2-ropemode/PKGBUILD @@ -0,0 +1,20 @@ +# Contributor: Renato Garcia <fgarcia.renato@gmail.com> +# Contributor: Nicolás de la Torre <ndelatorre@gmail.com> +# Maintainer : Parabola GNU / Linux-libre <aurelien@cwb.io> + +pkgname=python2-ropemode +_pkgname=ropemode +pkgver=0.2 +pkgrel=1 +pkgdesc="A helper for using rope refactoring library in IDEs" +url='http://bitbucket.org/agr/ropemode' +arch=('any') +license=('GPL') +depends=('python2-rope') +source=("http://bitbucket.org/agr/${_pkgname}/get/${pkgver}.tar.bz2") +md5sums=('6c1cb705e360251ac4bccc33b74ae892') + +package() { + cd "${srcdir}/agr-ropemode-61c99582317d" + python2 ./setup.py install --root="${pkgdir}" --prefix=/usr --optimize=1 +} diff --git a/pcr/python2-ssh/PKGBUILD b/pcr/python2-ssh/PKGBUILD new file mode 100644 index 000000000..84005f0ac --- /dev/null +++ b/pcr/python2-ssh/PKGBUILD @@ -0,0 +1,26 @@ +# Contributor: Your Name <youremail@domain.com> + +pkgname=python2-ssh +pkgver=1.8.0 +pkgrel=1 +pkgdesc="Python SSH2 protocol library" +arch=(any) +url="http://pypi.python.org/pypi/ssh" +license=('LGPL') +depends=('python2' 'pycrypto') +makedepends=() +provides=() +conflicts=() +replaces=() +backup=() +options=(!emptydirs) +install= +source=("http://pypi.python.org/packages/source/s/ssh/ssh-$pkgver.tar.gz") + +package() { + cd "$srcdir/ssh-$pkgver" + python2 setup.py install --root="$pkgdir/" --optimize=1 + + install -D -m644 LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE +} +md5sums=('bc4dd59ec0c7bdf78a3840652cac824e') diff --git a/pcr/quack/PKGBUILD b/pcr/quack/PKGBUILD new file mode 100644 index 000000000..18aa1025d --- /dev/null +++ b/pcr/quack/PKGBUILD @@ -0,0 +1,26 @@ +# Contributor: Geoffrey Teale <tealeg@member.fsf.org> +# Contributor: Stefan Husmann <stefan-husmann@t-online.de> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=quack +pkgver=0.45 +pkgrel=1 +pkgdesc="[Emacs] enhanced support for editing and running Scheme code." +url="http://www.neilvandyke.org/quack" +arch=('any') +license=('GPL') +depends=('emacs') +makedepends=('emacs') +install=quack.install +source=("http://www.neilvandyke.org/${pkgname}/${pkgname}.el") +md5sums=('40c52d0076c95c125e57ef6496ee881e') +EMACS=emacs # or sxemacs, or xemacs + +build() { + $EMACS --batch --eval '(byte-compile-file "quack.el")' +} + +package() { + install -Dm644 $pkgname.el $pkgdir/usr/share/$EMACS/site-lisp/$pkgname.el + install -Dm644 $pkgname.elc $pkgdir/usr/share/$EMACS/site-lisp/$pkgname.elc +} diff --git a/pcr/quack/quack.install b/pcr/quack/quack.install new file mode 100644 index 000000000..f92194ee6 --- /dev/null +++ b/pcr/quack/quack.install @@ -0,0 +1,18 @@ +### quack.install: +post_install () { +cat << EOF +==> Put this in your $HOME/.emacs file to enable quack + +(require 'quack) + +EOF +} + +post_upgrade () { + post_install $1 +} + +op=$1 +shift +$op $* +######################## diff --git a/pcr/ruby-haml/PKGBUILD b/pcr/ruby-haml/PKGBUILD new file mode 100644 index 000000000..37290484a --- /dev/null +++ b/pcr/ruby-haml/PKGBUILD @@ -0,0 +1,35 @@ +# Contributor: Renzo Carbonara <gnuk0001@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=ruby-haml +pkgver=3.1.6 +pkgrel=1 +pkgdesc="An elegant, structured XHTML/XML templating engine. Comes with Sass, a similar CSS templating engine." +arch=('any') +url="http://haml-lang.com/" +license=('MIT') +groups=() +depends=('ruby' 'ruby-yard>=0.5.3' 'maruku>=0.5.9') +makedepends=('rubygems') +optdepends=() +provides=() +conflicts=() +replaces=() +backup=() +options=() +install= +source=("http://gems.rubyforge.org/gems/haml-${pkgver}.gem") +noextract=("haml-${pkgver}.gem") + +build() { + cd $srcdir + local _gemdir="$(ruby -rubygems -e'puts Gem.default_dir')" + gem install --ignore-dependencies -i "$pkgdir$_gemdir" haml-$pkgver.gem \ + -n "$pkgdir/usr/bin" +} + +md5sums=('c73b2755a56cf5461f6a5e430052f436') + +# vim:set ts=2 sw=2 et: +md5sums=('c73b2755a56cf5461f6a5e430052f436') +md5sums=('c73b2755a56cf5461f6a5e430052f436') diff --git a/pcr/ruby-haml/ruby-yard/PKGBUILD b/pcr/ruby-haml/ruby-yard/PKGBUILD new file mode 100644 index 000000000..a686f937d --- /dev/null +++ b/pcr/ruby-haml/ruby-yard/PKGBUILD @@ -0,0 +1,36 @@ +# Maintainer: Matt Harrison <matt at mistbyte dot com> +# Contributor: Renzo Carbonara <gnuk0001@gmail.com> + +pkgname=ruby-yard +_gemname=${pkgname#ruby-} +pkgver=0.8.2.1 +pkgrel=2 +pkgdesc="Documentation tool for consistent and usable documentation in Ruby." +arch=('any') +url="http://yardoc.org" +license=('MIT') +groups=() +depends=() +makedepends=('rubygems') +optdepends=() +provides=() +conflicts=() +replaces=() +backup=() +options=() +install= +source=("http://gems.rubyforge.org/gems/yard-${pkgver}.gem") +noextract=("yard-${pkgver}.gem") + +build() { + cd $srcdir + local _gemdir="$(ruby -rubygems -e'puts Gem.default_dir')" + gem install --no-user-install --ignore-dependencies -i "$pkgdir$_gemdir" \ + -n "$pkgdir/usr/bin" ${_gemname}-$pkgver.gem + install -D "$pkgdir$_gemdir/gems/${_gemname}-$pkgver/LICENSE" \ + "$pkgdir/usr/share/licenses/${pkgname}/LICENSE" +} + +md5sums=('08a48d23f8729b68945011cae7d121fe') + +# vim:set ts=2 sw=2 et: diff --git a/pcr/ruby-libnotify/PKGBUILD b/pcr/ruby-libnotify/PKGBUILD new file mode 100644 index 000000000..f38e10d2d --- /dev/null +++ b/pcr/ruby-libnotify/PKGBUILD @@ -0,0 +1,23 @@ +# Contributor: Luca Russo <vargolo@gmail.com> +# Contributor: Sigitas Mazaliauskas <sigisnn@gmail.com> +# Contributor: Andreas W. Hauser <andy-aur@splashground.de> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=ruby-libnotify +pkgver=0.8.0 +pkgrel=1 +pkgdesc="ruby bindings for libnotify, a library for desktop notifications" +arch=('i686' 'x86_64') +url="http://rubygems.org/downloads" +license=('LGPL') +depends=('ruby' 'libnotify' 'ruby-gtk2') +makedepends=('ruby-pkgconfig') +source=(http://rubygems.org/downloads/${pkgname}-${pkgver}.gem) +noextract=(${pkgname}-${pkgver}.gem) + +build() { + cd $srcdir + local _gemdir="$(ruby -rubygems -e'puts Gem.default_dir')" + + gem install --ignore-dependencies -i "$pkgdir$_gemdir" ${pkgname}-${pkgver}.gem +} diff --git a/pcr/ruby-syntax/PKGBUILD b/pcr/ruby-syntax/PKGBUILD new file mode 100644 index 000000000..6845206bb --- /dev/null +++ b/pcr/ruby-syntax/PKGBUILD @@ -0,0 +1,23 @@ +# Contributor: Adam Lloyd <lloyda2 (at) rpi (dot) edu> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> +pkgname=ruby-syntax +pkgver=1.0.0 +pkgrel=1 +pkgdesc="Syntax - lexical analysis for syntax highlighting" +arch=(any) +url="http://syntax.rubyforge.org/" +license=('custom:BSD') +depends=(ruby) +makedepends=(rubygems) +source=(http://gems.rubyforge.org/gems/syntax-$pkgver.gem) +noextract=(syntax-$pkgver.gem) +md5sums=('d9d2eabc03bc937adfa00e35f228f9a8') + +build() { + cd $srcdir + local _gemdir="$(ruby -rubygems -e'puts Gem.default_dir')" + gem install --ignore-dependencies -i "$pkgdir$_gemdir" syntax-$pkgver.gem +} + +# vim:set ts=2 sw=2 et: +md5sums=('d9d2eabc03bc937adfa00e35f228f9a8') diff --git a/pcr/ruby-yard/PKGBUILD b/pcr/ruby-yard/PKGBUILD new file mode 100644 index 000000000..a686f937d --- /dev/null +++ b/pcr/ruby-yard/PKGBUILD @@ -0,0 +1,36 @@ +# Maintainer: Matt Harrison <matt at mistbyte dot com> +# Contributor: Renzo Carbonara <gnuk0001@gmail.com> + +pkgname=ruby-yard +_gemname=${pkgname#ruby-} +pkgver=0.8.2.1 +pkgrel=2 +pkgdesc="Documentation tool for consistent and usable documentation in Ruby." +arch=('any') +url="http://yardoc.org" +license=('MIT') +groups=() +depends=() +makedepends=('rubygems') +optdepends=() +provides=() +conflicts=() +replaces=() +backup=() +options=() +install= +source=("http://gems.rubyforge.org/gems/yard-${pkgver}.gem") +noextract=("yard-${pkgver}.gem") + +build() { + cd $srcdir + local _gemdir="$(ruby -rubygems -e'puts Gem.default_dir')" + gem install --no-user-install --ignore-dependencies -i "$pkgdir$_gemdir" \ + -n "$pkgdir/usr/bin" ${_gemname}-$pkgver.gem + install -D "$pkgdir$_gemdir/gems/${_gemname}-$pkgver/LICENSE" \ + "$pkgdir/usr/share/licenses/${pkgname}/LICENSE" +} + +md5sums=('08a48d23f8729b68945011cae7d121fe') + +# vim:set ts=2 sw=2 et: diff --git a/pcr/spice-gtk3/PKGBUILD b/pcr/spice-gtk3/PKGBUILD new file mode 100644 index 000000000..903b9b56b --- /dev/null +++ b/pcr/spice-gtk3/PKGBUILD @@ -0,0 +1,38 @@ +# Contributor: Stefano Facchini <stefano.facchini@gmail.com> +# Contributor: Jonathan Lestrelin <zanko@daemontux.org> +# Derived from the spice-gtk PKGBUILD by +# Contributor: Lucio Zara <pennega@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=spice-gtk3 +_pkgname=spice-gtk +pkgver=0.14 +pkgrel=1 +pkgdesc="A Gtk client and libraries for SPICE remote desktop servers (gtk3 version)." +arch=('x86_64' 'i686') +url="http://spice-space.org" +license=('GPL') +makedepends=('intltool' 'vala' 'python2-pyparsing') +depends=('libpulse' 'gtk3' 'spice' 'libusb' 'usbredir') +conflicts=('spice-gtk') +options=('!libtool') +source=("http://www.spice-space.org/download/gtk/$_pkgname-$pkgver.tar.bz2") +sha256sums=('a16fa27364541493b886cc943f72c8f96ec251083af0a29d405a2c4f490274f5') + +build() { + cd "$srcdir/$_pkgname-$pkgver" + + sed -i 's,/usr/bin/env python,/usr/bin/python2,' spice-common/spice_codegen.py + + ./configure --prefix=/usr \ + --with-gtk=3.0 \ + --enable-vala \ + --enable-smartcard=no + make +} + +package() { + cd "$srcdir/$_pkgname-$pkgver" + + make DESTDIR="$pkgdir/" install +} diff --git a/pcr/spice-protocol/PKGBUILD b/pcr/spice-protocol/PKGBUILD new file mode 100644 index 000000000..03c122275 --- /dev/null +++ b/pcr/spice-protocol/PKGBUILD @@ -0,0 +1,36 @@ +# Contributor: Parabola GNU / Linux-libre <aurelien@cwb.io> + + pkgname=spice-protocol + pkgver=0.12.2 + pkgrel=1 + pkgdesc="SPICE protocol" + arch=('x86_64' 'i686') + url="http://spice-space.org" + license=('GPL') + makedepends=(python2-pyparsing) + depends=(pixman celt cegui alsa-utils libxrandr libxinerama libsasl +libcacard) + + source=(http://spice-space.org/download/releases/$pkgname-$pkgver.tar.bz2) + + build() { + cd "$srcdir/$pkgname-$pkgver" + sed -i 's,/usr/bin/env python,/usr/bin/python2,' spice-common/spice_codegen.py + PYTHON=python2 \ + ./configure --prefix=/usr \ + --enable-gui \ + --enable-opengl \ + --enable-smartcard \ + # --enable-tunnel + make + } + + package() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir/" install + } + + # vim:set ts=2 sw=2 et: +md5sums=('8bab5b67a00ec8429334963d361692ab') +md5sums=('8bab5b67a00ec8429334963d361692ab') diff --git a/pcr/spice/PKGBUILD b/pcr/spice/PKGBUILD new file mode 100644 index 000000000..d54f1657d --- /dev/null +++ b/pcr/spice/PKGBUILD @@ -0,0 +1,38 @@ +# Contributor: Lucio Zara <pennega@gmail.com> +# Contributor: Jameson Pugh <imntreal@gmail.com> +# Maintainer : Parabola GNU / Linux-libre <aurelien@cwb.io> + + pkgname=spice + pkgver=0.12.0 + pkgrel=1 + pkgdesc="SPICE client and server" + arch=('x86_64' 'i686') + url="http://spice-space.org" + license=('GPL') + makedepends=(python2-pyparsing) + depends=(pixman celt cegui alsa-utils libxrandr libxinerama libsasl +libcacard ) + + source=(http://spice-space.org/download/releases/$pkgname-$pkgver.tar.bz2) + md5sums=('12c6ea4938215f8f9f10d2925f7bec9b') + + build() { + cd "$srcdir/$pkgname-$pkgver" + sed -i 's,/usr/bin/env python,/usr/bin/python2,' spice-common/spice_codegen.py + PYTHON=python2 \ + ./configure --prefix=/usr \ + --enable-gui \ + --enable-opengl \ + --enable-smartcard \ + # --enable-tunnel + make + } + + package() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir/" install + } + + # vim:set ts=2 sw=2 et: + diff --git a/pcr/startupmanager/PKGBUILD b/pcr/startupmanager/PKGBUILD new file mode 100644 index 000000000..4b33f36a9 --- /dev/null +++ b/pcr/startupmanager/PKGBUILD @@ -0,0 +1,45 @@ +# Contributor: Alexander Rødseth <rodseth@gmail.com> +# Contributor: Chris Giles <Chris.G.27 (at) Gmail.com> +# Contributor: fernando < arch at liquuid dot net> +# Contributor: Juan Pablo González Tognarelli <lord_jotape@yahoo.com.ar> +# Maintainer : Parabola GNU / Linux-libre Aurélien Desbrières <aurelien@cwb.io> + +pkgname=startupmanager +pkgver=1.9.13 +pkgrel=4 +pkgdesc="GUI app for changing the settings of GRUB, GRUB2, Usplash and Splashy" +arch=("any") +url="http://sourceforge.net/projects/startup-manager/" +license=("MIT") +depends=("gnome-python" "imagemagick" "yelp" "python2" "xorg-xrandr>=1.3.3") +makedepends=("intltool" "setconf") +source=("http://downloads.sourceforge.net/sourceforge/startup-manager/${pkgname}_${pkgver}.tar.gz") +sha1sums=('b82a65ac6ec488ca7fe16fd3ea277cd15a3627c6') + +build() { + cd "$srcdir/$pkgname-$pkgver" + + # Make the startup script use python2 + echo "#!/usr/bin/env python2" > pyfix + tail -n +2 startupmanager >> pyfix + cat pyfix > startupmanager + + # Change the grub2 detection to be Arch-friendly + setconf bootconfig/grub.py self.update_grub_command \'/sbin/grub-mkconfig\' + setconf bootconfig/grub.py self.grub_install_command \'/sbin/grub-install\' + + # TIP: bug-workaround: If you have problems with resolution-detection when starting + # startupmanager, try changing line 159 in /usr/lib/python2.7/site-packages/bootconfig/utils.py to: + # + # try: + # return matches.group(1) + 'x' + matches.group(2) + # except: + # return "640x480" + # + # Where "640x480" is just an example (but should make it work) + + python2 setup.py install --prefix="$pkgdir/usr/" + install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING" +} + +# vim:set ts=2 sw=2 et: diff --git a/pcr/stumpwm-git/PKGBUILD b/pcr/stumpwm-git/PKGBUILD new file mode 100644 index 000000000..986a8f740 --- /dev/null +++ b/pcr/stumpwm-git/PKGBUILD @@ -0,0 +1,151 @@ +# Contributor: M Rawash <mrawash@gmail.com> +# Contributor: olvar <beren dot olvar (at) gmail dot com> +# Contributor: Andrew Antle <andrew dot antle at gmail dot com> +# Contributor: joyfulgirl <joyfulgirl (at) archlinux.us> +# Contributor: Jonathan Friedman <jonf@gojon.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=stumpwm-git +pkgver=20110924 +pkgrel=1 +pkgdesc="A tiling, keyboard-driven window manager written in common lisp" +arch=('i686' 'x86_64') +url="http://www.nongnu.org/stumpwm/" +license=('GPL2') +provides=('stumpwm') + +if pacman -Qq sbcl &>/dev/null; then + depends=('sbcl' 'clx' 'cl-ppcre') + _lisp=sbcl +elif pacman -Qq clisp-new-clx &>/dev/null; then + # If somebody compiled this specially, chances are they want to use it + depends=('clisp-new-clx' 'cl-ppcre' 'cl-asdf') + _lisp=clisp + source=(http://common-lisp.net/project/asdf/asdf.lisp) + md5sums=('0f172cc814e11054c37c29fa2acfbfae') +else + # No, this isn't redundant. + depends=('sbcl' 'clx' 'cl-ppcre') + _lisp=sbcl +fi + +makedepends=('git' 'texinfo' 'autoconf') +optdepends=('emacs: Edit and eval stumpwm code with M-x stumpwm-mode' + 'alsa-utils: Use contrib/amixer.lisp to control audio volume' + 'aumix: Use contrib/aumix.lisp to control audio volume' + 'mpd: Use contrib/mpd.lisp to control the mpd' + 'surfraw: Use contrib/surfraw.lisp to surf the Internet') +install=stumpwm.install +options=(!strip) # Thanks to sidereus for pointing this out + +_gitroot="git://git.savannah.nongnu.org/stumpwm.git" +_gitname="stumpwm" + +build() { + msg "Connecting to ${_gitroot}..." + + if [ -d ${srcdir}/${_gitname} ] ; then + cd ${srcdir}/${_gitname} && git pull origin master + else + git clone $_gitroot + fi + + msg "GIT checkout done or server timeout" + msg "Starting make..." + + rm -rf ${srcdir}/${_gitname}-build + cp -a ${srcdir}/${_gitname} ${srcdir}/${_gitname}-build + cd ${srcdir}/${_gitname}-build + + autoconf + if [ "$_lisp" = "sbcl" ]; then + + ./configure --prefix=/usr \ + --with-lisp=$_lisp \ + --with-ppcre=/usr/share/common-lisp/source/cl-ppcre + + # this is necesary since the AUR packages do not modify the asdf's registry by default + _sbcl_bopt="sbcl_BUILDOPTS=--eval \"(require :asdf)\" \ + --eval \"(pushnew #p\\\"/usr/share/common-lisp/systems/\\\" asdf:*central-registry* :test #'equal)\" \ + --eval \"(asdf:operate 'asdf:load-op 'clx)\" \ + --load ./make-image.lisp" + _sbcl_iopt="sbcl_INFOOPTS=--eval \"(require 'asdf)\" \ + --eval \"(pushnew #p\\\"/usr/share/common-lisp/systems/\\\" asdf:*central-registry* :test #'equal)\" \ + --eval \"(asdf:operate 'asdf:load-op 'clx)\" \ + --eval \"(require 'stumpwm)\" \ + --load ./manual.lisp \ + --eval \"(progn (stumpwm::generate-manual) (sb-ext:quit))\"" + + make "$_sbcl_bopt" "$_sbcl_iopt" + + elif [ "$_lisp" = "clisp" ]; then + _lisp_source=/usr/share/common-lisp/source/ + _ppcre_source=${_lisp_source}cl-ppcre/ + + # Sometimes there are no compiled versions of ppcre. + # in this case we need to compile and use our own, and then we install them + if [ ! -f ${_ppcre_source}/api.fas ]; then + + _own_fas=1 + + mkdir ${srcdir}/cl-ppcre_temp + mkdir ${srcdir}/cl-ppcre_temp/systems + mkdir ${srcdir}/cl-ppcre_temp/source + + export ASDF_OUTPUT_TRANSLATIONS="/usr/share/common-lisp/source/:${srcdir}/cl-ppcre_temp/source/" + # for compiling we use the asdf source we donwloaded + clisp -norc -K full -on-error exit \ + -x "(require 'asdf '(\"${srcdir}/asdf.lisp\"))" \ + -x "(pushnew #p\"/usr/share/common-lisp/systems/\" asdf:*central-registry* :test #'equal)" \ + -x "(asdf:operate 'asdf:compile-op 'cl-ppcre)" + + # once we have cl-ppcre compiled we copy the necesary files to + # this new location, and set the necessary options for make + cp $_ppcre_source/cl-ppcre.asd ${srcdir}/cl-ppcre_temp/source/cl-ppcre/ + cp $_ppcre_source/*.lisp ${srcdir}/cl-ppcre_temp/source/cl-ppcre/ + _ppcre_source=${srcdir}/cl-ppcre_temp/source/cl-ppcre/ + + _clisp_bopt="clisp_BUILDOPTS=-K full -on-error exit \ + -x \"(require 'asdf '(\\\"asdf.lisp\\\"))\" \ + -x \"(pushnew \\\"${srcdir}/cl-ppcre_temp/systems/\\\" \ + asdf:*central-registry* \ + :test #'equal)\" \ + -x \"(load \\\"./make-image.lisp\\\")\"" + fi + + ./configure --prefix=/usr \ + --with-lisp=$_lisp \ + --with-ppcre=$_ppcre_source + + if [ -z "$_clisp_bopt" ]; then + make + else + make "$_clisp_bopt" + fi + fi + + make destdir=$pkgdir install + + rm -f ${pkgdir}/usr/share/info/dir + + # Installation of stumpish, the contributed lisp, + # and the emacs stumpwm mode. + install -m 755 ${srcdir}/${_gitname}-build/contrib/stumpish ${pkgdir}/usr/bin + + install -Dm 644 sample-stumpwmrc.lisp ${pkgdir}/etc/stumpwmrc.sample + install -d ${pkgdir}/usr/share/${_gitname} + install -m 644 ${srcdir}/${_gitname}-build/contrib/*.lisp ${pkgdir}/usr/share/${_gitname} + + install -Dm 644 ${srcdir}/${_gitname}-build/contrib/stumpwm-mode.el \ + ${pkgdir}/usr/share/emacs/site-lisp/stumpwm-mode.el + + + # if we had to compile our own fas files, then we need to install them too. + if [ "x$_own_fas" = "x1" ]; then + install -d ${pkgdir}/usr/share/common-lisp/source/cl-ppcre + install -m 644 ${srcdir}/cl-ppcre_temp/source/cl-ppcre/*.fas \ + ${pkgdir}/usr/share/common-lisp/source/cl-ppcre/ + fi +} + +# vim:sw=2 ts=2 et si: diff --git a/pcr/stumpwm-git/stumpwm.install b/pcr/stumpwm-git/stumpwm.install new file mode 100644 index 000000000..3661fa6e3 --- /dev/null +++ b/pcr/stumpwm-git/stumpwm.install @@ -0,0 +1,17 @@ +post_install() { + cd /usr/share/info + install-info stumpwm.info dir + cat << "EOM" + To load contrib/ modules, put the following line in your ~/.stumpwmrc: + (set-contrib-dir "/usr/share/stumpwm") +EOM +} + +post_upgrade() { + post_install +} + +pre_remove() { + cd /usr/share/info + install-info --remove stumpwm.info dir +} diff --git a/pcr/toluapp/PKGBUILD b/pcr/toluapp/PKGBUILD new file mode 100644 index 000000000..fa8c841c6 --- /dev/null +++ b/pcr/toluapp/PKGBUILD @@ -0,0 +1,28 @@ +# Contributor: Stéphane Gaudreault <stephane.gaudreault@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=toluapp +pkgver=1.0.93 +pkgrel=5 +pkgdesc="Tool to integrate C/C++ code with Lua" +url="http://www.codenix.com/~tolua" +depends=('lua') +makedepends=('scons') +license=('MIT') +arch=('i686' 'x86_64') +source=(http://www.codenix.com/~tolua/tolua++-${pkgver}.tar.bz2 config_linux.py) +md5sums=('100aa6907b8108582080b37d79c0afd7' 'f85232adfa873ea012088dd4d7fb63d7') + +build() { + cd "${srcdir}/tolua++-${pkgver}" + cp ../config_linux.py ${srcdir}/tolua++-${pkgver} + + scons all +} + +package() { + cd "${srcdir}/tolua++-${pkgver}" + scons prefix=${pkgdir}/usr install +} +md5sums=('100aa6907b8108582080b37d79c0afd7' + 'f85232adfa873ea012088dd4d7fb63d7') diff --git a/pcr/toluapp/config_linux.py b/pcr/toluapp/config_linux.py new file mode 100755 index 000000000..0a5fbcfeb --- /dev/null +++ b/pcr/toluapp/config_linux.py @@ -0,0 +1,22 @@ +## This is the linux configuration file +# This file was adapted to be used with ArchLinux +# Use 'scons -h' to see the list of command line options available + +# Compiler flags (based on ArchLinux's installation of lua) +#LINKFLAGS = ['-g'] +CCFLAGS = ['-O2', '-ansi', '-Wall', '-fPIC'] +#CCFLAGS = ['-g'] + +# this is the default directory for installation. Files will be installed on +# <prefix>/bin, <prefix>/lib and <prefix>/include when you run 'scons install' +# +# You can also specify this directory on the command line with the 'prefix' +# option +# +# You can see more 'generic' options for POSIX systems on config_posix.py + +prefix = '/usr' + +# libraries (based on ArchLinux's installation of lua) +LIBS = ['lua', 'dl', 'm'] + diff --git a/pcr/wallchange/PKGBUILD b/pcr/wallchange/PKGBUILD new file mode 100755 index 000000000..f8465bda5 --- /dev/null +++ b/pcr/wallchange/PKGBUILD @@ -0,0 +1,34 @@ +# Wallchange +# Contributor: ying <Jinoto Systems> +# Contributor: ying <Jinoto Systems> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=wallchange +pkgver=1.2 +pkgrel=1 +pkgdesc="A small and simple command tool which is changing the wallpaper on a switch to the next virtual desktop." +url="https://sourceforge.net/projects/wallchange-slim/files/" +arch=('i686' 'x86_64') +install=wallchange.install +license=('GPL2') +depends=('eterm' 'archlinux-wallpaper') # 'eterm' can be changed in any command tool to draw the wallpaper. +optdepends=('eterm' 'habak' 'feh' 'hsetroot' 'others') +source=("https://downloads.sourceforge.net/project/wallchange-slim/wallchange-${pkgver}.tar.gz?r=&ts=1289391543&use_mirror=master" wallchange.conf) + + +build() { + cd ${srcdir}/${pkgname}-${pkgver} + make all +} +package() { + install -Dm755 ${pkgname}-${pkgver}/wallchange $pkgdir/usr/bin/wallchange || return + install -Dm755 wallchange.conf $pkgdir/usr/share/wallchange/wallchange.conf || return +} + + + + +md5sums=('840425f1c724aea198b7cd378fba708d' + 'd4a9b5c9b341eee1651269139e1f91c9') +md5sums=('840425f1c724aea198b7cd378fba708d' + 'd4a9b5c9b341eee1651269139e1f91c9') diff --git a/pcr/wallchange/wallchange.conf b/pcr/wallchange/wallchange.conf new file mode 100644 index 000000000..9deda3c92 --- /dev/null +++ b/pcr/wallchange/wallchange.conf @@ -0,0 +1,23 @@ +# Wallchange configuration file + +# specify the command to draw the wallpaper +command=Esetroot -s + + +# specify the wallpapers which will be used on a desktop switch. + + +# Wallpaper for the first desktop +wallpaper=/usr/share/archlinux/wallpaper/archlinux-simplyblack.png + +# Wallpaper for the second desktop +wallpaper=/usr/share/archlinux/wallpaper/archlinux-poolclouds.jpg + +# Wallpaper for the third desktop +wallpaper=/usr/share/archlinux/wallpaper/archlinux-carbonite-knight.jpg + +# Wallpaper for the fourth desktop +wallpaper=/usr/share/archlinux/wallpaper/archlinux-burn.jpg + + + diff --git a/pcr/wallchange/wallchange.install b/pcr/wallchange/wallchange.install new file mode 100644 index 000000000..ceb90e348 --- /dev/null +++ b/pcr/wallchange/wallchange.install @@ -0,0 +1,13 @@ + +post_install() { + echo "" + echo -e "\033[37;41;1m Read First \033[0m" + echo "Please copy the /usr/share/wallchange/wallchange.conf configuration file to you home folder(~/.wallchange.conf). Enjoy!" + echo "" +} + +op=$1 +shift +$op "$@" + + diff --git a/pcr/zeroinstall-injector/PKGBUILD b/pcr/zeroinstall-injector/PKGBUILD new file mode 100644 index 000000000..120355775 --- /dev/null +++ b/pcr/zeroinstall-injector/PKGBUILD @@ -0,0 +1,36 @@ +# Contributor: SpepS <dreamspepser at yahoo dot it> +# Contributor: Anton Bazhenov <anton.bazhenov at gmail> +# Contributor: Lone_Wolf <lonewolf@xs4all.nl> +# Maintainer : Parabola GNU / Linux-libre <aurelien@cwb.io> + +pkgname=zeroinstall-injector +pkgver=1.8 +pkgrel=1 +pkgdesc="A decentralised loosly-coupled secure installation system" +arch=('any') +url="http://zero-install.sourceforge.net/" +license=('GPL2' 'LGPL') +depends=('pygtk' 'dbus-python' 'gnupg' 'hicolor-icon-theme' 'desktop-file-utils') +optdepends=('xdg-utils: desktop integration' + 'packagekit: packagekit integration') +install="$pkgname.install" +source=("http://downloads.sourceforge.net/zero-install/$pkgname-$pkgver.tar.bz2") +md5sums=('00b3e8b3cbfbe8ed55f81842a4d2c386') + +build() { + cd "$srcdir/$pkgname-$pkgver" + + # man path fix + sed -i "s|man/|share/&|" setup.py + + python2 setup.py build +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + python2 setup.py install --prefix=/usr --root="$pkgdir/" + + # python2 fix + sed -i "s/env python/&2/" `grep -rl "env python" "$pkgdir"` +} +md5sums=('00b3e8b3cbfbe8ed55f81842a4d2c386') diff --git a/pcr/zeroinstall-injector/zeroinstall-injector.install b/pcr/zeroinstall-injector/zeroinstall-injector.install new file mode 100644 index 000000000..293ff852a --- /dev/null +++ b/pcr/zeroinstall-injector/zeroinstall-injector.install @@ -0,0 +1,12 @@ +post_install() { + gtk-update-icon-cache -q -t -f usr/share/icons/hicolor + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/pcr/zsh-yaourt/PKGBUILD b/pcr/zsh-yaourt/PKGBUILD new file mode 100644 index 000000000..af6541183 --- /dev/null +++ b/pcr/zsh-yaourt/PKGBUILD @@ -0,0 +1,21 @@ +# Contributor: Jakub Ruzicka <yaccobb@centrum.cz> +# Contributor: Javier `Phrodo_00' Aravena <phrodo.00@gmail.com> +# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io> + +pkgname=zsh-yaourt +pkgver=20110403 +_laststablerev=497acb78fe6b +pkgrel=3 +pkgdesc="ZSH functions to tab-complete repo package names for yaourt" +url="http://bitbucket.org/Phrodo_00/zsh-yaourt" +depends=(zsh) +source=("https://bitbucket.org/Phrodo_00/${pkgname}/get/${_laststablerev}.tar.gz") +arch=('i686' 'x86_64') +license=('GPL') +md5sums=('ac80ec05fa12e53fc8c58e5178609a6b') + +package() { + cd ${srcdir}/Phrodo_00-${pkgname}-${_laststablerev} + install -d -m755 ${pkgdir}/usr/share/zsh/site-functions/ + install -m644 _yaourt $startdir/pkg/usr/share/zsh/site-functions/_yaourt +} |