ports/120462: [New port] archivers/par2cmdline-tbb

Ganael Laplanche ganael.laplanche at martymac.com
Sat Feb 9 13:00:07 UTC 2008


>Number:         120462
>Category:       ports
>Synopsis:       [New port] archivers/par2cmdline-tbb
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 09 13:00:07 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Ganael Laplanche
>Release:        FreeBSD 7.0-PRERELEASE #5
>Organization:
http://contribs.martymac.com
>Environment:
FreeBSD home.martymac.com 7.0-PRERELEASE FreeBSD 7.0-PRERELEASE #5: Tue Feb  5 08:26:51 CET 2008     root at home.martymac.com:/usr/obj/usr/src/sys/MYKERNEL  amd64
>Description:
Tbb (Intel Threading Building Blocks) version of par2cmdline tool. This version is available on : http://chuchusoft.com/par2_tbb and is actively maintained.

Note : the files/ directory include a .h file coming from the tbb port itself. This file is necessary for compiling the tool and is *not* available in the local include directory.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	par2cmdline-tbb
#	par2cmdline-tbb/files
#	par2cmdline-tbb/files/tbb_misc-freebsd-20070815.h
#	par2cmdline-tbb/Makefile
#	par2cmdline-tbb/distinfo
#	par2cmdline-tbb/pkg-descr
#
echo c - par2cmdline-tbb
mkdir -p par2cmdline-tbb > /dev/null 2>&1
echo c - par2cmdline-tbb/files
mkdir -p par2cmdline-tbb/files > /dev/null 2>&1
echo x - par2cmdline-tbb/files/tbb_misc-freebsd-20070815.h
sed 's/^X//' >par2cmdline-tbb/files/tbb_misc-freebsd-20070815.h << 'END-of-par2cmdline-tbb/files/tbb_misc-freebsd-20070815.h'
X/*
X    Copyright 2005-2007 Intel Corporation.  All Rights Reserved.
X
X    This file is part of Threading Building Blocks.
X
X    Threading Building Blocks is free software; you can redistribute it
X    and/or modify it under the terms of the GNU General Public License
X    version 2 as published by the Free Software Foundation.
X
X    Threading Building Blocks is distributed in the hope that it will be
X    useful, but WITHOUT ANY WARRANTY; without even the implied warranty
X    of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X    GNU General Public License for more details.
X
X    You should have received a copy of the GNU General Public License
X    along with Threading Building Blocks; if not, write to the Free Software
X    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
X
X    As a special exception, you may use this file as part of a free software
X    library without restriction.  Specifically, if other files instantiate
X    templates or use macros or inline functions from this file, or you compile
X    this file and link it with other files to produce an executable, this
X    file does not by itself cause the resulting executable to be covered by
X    the GNU General Public License.  This exception does not however
X    invalidate any other reasons why the executable file might be covered by
X    the GNU General Public License.
X*/
X
X#ifndef _TBB_tbb_misc_H
X#define _TBB_tbb_misc_H
X
X#include "tbb/tbb_stddef.h"
X#include "tbb/tbb_machine.h"
X
X#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
X#include <unistd.h>
X#endif
X
Xnamespace tbb {
X
Xstatic volatile int number_of_workers = 0;
X
X#if defined(__TBB_DetectNumberOfWorkers)
Xstatic inline int DetectNumberOfWorkers() {
X    return __TBB_DetectNumberOfWorkers(); 
X}
X#else
X#if _WIN32||_WIN64
X
Xstatic inline int DetectNumberOfWorkers() {
X    if (!number_of_workers) {
X        SYSTEM_INFO si;
X        GetSystemInfo(&si);
X        number_of_workers = static_cast<int>(si.dwNumberOfProcessors);
X    }
X    return number_of_workers; 
X}
X
X#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
X
Xstatic inline int DetectNumberOfWorkers( void ) {
X    if (!number_of_workers) {
X        number_of_workers = sysconf(_SC_NPROCESSORS_ONLN);
X    }
X    return number_of_workers; 
X}
X
X#else
X
X#error Unknown OS
X
X#endif /* os kind */
X
X#endif
X
Xnamespace internal {
X
X// assertion_failure is declared in tbb/tbb_stddef.h because it user code
X// needs to see its declaration.
X
X//! Throw std::runtime_error of form "(what): (strerror of error_code)"
X/* The "what" should be fairly short, not more than about 64 characters.
X   Because we control all the call sites to handle_perror, it is pointless
X   to bullet-proof it for very long strings.
X
X   Design note: ADR put this routine off to the side in tbb_misc.cpp instead of
X   Task.cpp because the throw generates a pathetic lot of code, and ADR wanted
X   this large chunk of code to be placed on a cold page. */
Xvoid handle_perror( int error_code, const char* what );
X
X//! True if environment variable with given name is set and not 0; otherwise false.
Xbool GetBoolEnvironmentVariable( const char * name );
X
X//! Print TBB version information on stderr
Xvoid PrintVersion();
X
X//! Print extra TBB version information on stderr
Xvoid PrintExtraVersionInfo( const char* category, const char* description );
X
Xtypedef void (*PointerToHandler)();
X
X//! Association between a handler name and location of pointer to it.
Xstruct DynamicLinkDescriptor {
X    //! Name of the handler
X    const char* name;
X    //! Pointer to the handler
X    PointerToHandler* handler;
X};
X
X//! Fill in dynamically linked handlers.
X/** n is the length of array list[], must not exceed 4, which is all we currently need. 
X    If the library and all of the handlers are found, then all corresponding handler pointers are set.
X    Otherwise all corresponding handler pointers are untouched. */
Xbool FillDynamicLinks( const char* libraryname, const DynamicLinkDescriptor list[], size_t n );
X
X//! Template functions to temporary add volatile attribute to a variable.
X/** Allow to perform operations with volatile semantics on non-volatile variables
X    which is useful to improve performance on IPF where Intel compiler
X    translates volatile reads to "load with acquire semantics" (ld*.acq)
X    and volatile writes to "store with release semantics" (st*.rel). */
Xtemplate<typename T>
Xstatic inline T volatile& volatile_cast(T& location) {
X    return const_cast<T volatile&>(location);
X}
X
Xtemplate<typename T>
Xstatic inline T const volatile& volatile_cast(T const& location) {
X    return const_cast<T const volatile&>(location);
X}
X
X//! Class that implements exponential backoff.
X/** See implementation of SpinwaitWhileEq for an example. */
Xclass ExponentialBackoff {
X    //! Time delay, in units of "pause" instructions. 
X    /** Should be equal to approximately the number of "pause" instructions
X        that take the same time as an context switch. */
X    static const int LOOPS_BEFORE_YIELD = 0x10;
X    int count;
Xpublic:
X    ExponentialBackoff() : count(1) {}
X
X    //! Pause for a while.
X    void pause() {
X        if( count<=LOOPS_BEFORE_YIELD ) {
X            __TBB_Pause(count);
X            // Pause twice as long the next time.
X            count*=2;
X        } else {
X            // Pause is so long that we might as well yield CPU to scheduler.
X            __TBB_Yield();
X        }
X    }
X    void reset() {
X        count = 1;
X    }
X};
X
X//! Spin WHILE the value of the variable is equal to a given value
X/** T and U should be comparable types. */
Xtemplate<typename T, typename U>
Xstatic inline void SpinwaitWhileEq( const volatile T& location, U value ) {
X    ExponentialBackoff backoff;
X    while( location==value ) {
X        backoff.pause();
X    }
X}
X
X//! Spin UNTIL the value of the variable is equal to a given value
X/** T and U should be comparable types. */
Xtemplate<typename T, typename U>
Xstatic inline void SpinwaitUntilEq( const volatile T& location, const U value ) {
X    ExponentialBackoff backoff;
X    while( location!=value ) {
X        backoff.pause();
X    }
X}
X
X} // namespace internal
X
X} // namespace tbb
X
X#endif /* _TBB_tbb_misc_H */
END-of-par2cmdline-tbb/files/tbb_misc-freebsd-20070815.h
echo x - par2cmdline-tbb/Makefile
sed 's/^X//' >par2cmdline-tbb/Makefile << 'END-of-par2cmdline-tbb/Makefile'
X# New ports collection makefile for:    par2cmdline-tbb
X# Whom:                                 Ganael Laplanche <ganael.laplanche at martymac.com>
X# Date created:                         27 December 2007
X#
X# $FreeBSD$
X#
X
XPORTNAME=	par2cmdline-tbb
XPORTVERSION=	20080203
XCATEGORIES=	archivers
XMASTER_SITES=	http://chuchusoft.com/par2_tbb/
XDISTNAME=	par2cmdline-0.4-tbb-${PORTVERSION}
X
XMAINTAINER=	ganael.laplanche at martymac.com
XCOMMENT=	Tools for using Parity v2 Archive files (tbb version)
X
XBUILD_DEPENDS=	${LOCALBASE}/lib/libtbb.so:${PORTSDIR}/devel/tbb
X
XWRKSRC=		${WRKDIR}/${DISTNAME}
X
XGNU_CONFIGURE=	yes
XUSE_AUTOTOOLS=	autoconf:261 automake:16
X
XPORTDOCS=	README
XCONFLICTS=	par2cmdline-[0-9]*
XPLIST_FILES=	bin/par2 bin/par2create bin/par2repair bin/par2verify
X
Xpost-patch:
X	@${CP} ${FILESDIR}/tbb_misc-freebsd-20070815.h ${WRKSRC}/tbb_misc.h
X	@${REINPLACE_CMD} -e 's|#include "tbb/tbb_misc\.h"|#include "tbb_misc.h"|' ${WRKSRC}/par2cmdline.h
X	@${REINPLACE_CMD} -e 's|tbb::internal::|tbb::|' ${WRKSRC}/par2cmdline.h
X
Xpost-install:
X.if !defined(NOPORTDOCS)
X	@${MKDIR} ${DOCSDIR}
X	${INSTALL_MAN} ${WRKSRC}/README ${DOCSDIR}
X.endif
X
X.include <bsd.port.mk>
END-of-par2cmdline-tbb/Makefile
echo x - par2cmdline-tbb/distinfo
sed 's/^X//' >par2cmdline-tbb/distinfo << 'END-of-par2cmdline-tbb/distinfo'
XMD5 (par2cmdline-0.4-tbb-20080203.tar.gz) = 1b6d98d5ee80c968aefd6424c8dedda9
XSHA256 (par2cmdline-0.4-tbb-20080203.tar.gz) = e6093b729cd78e16e60ebc349fcc6fba12a824ff60040cbf21aae1ddec978f26
XSIZE (par2cmdline-0.4-tbb-20080203.tar.gz) = 284762
END-of-par2cmdline-tbb/distinfo
echo x - par2cmdline-tbb/pkg-descr
sed 's/^X//' >par2cmdline-tbb/pkg-descr << 'END-of-par2cmdline-tbb/pkg-descr'
XParity v2 Archive create/verify/recover
X
Xtbb version of the par2cmdline tool.
X
Xpar2cmdline is a program for creating and using PAR2 files to detect
Xdamage in data files and repair them if necessary. It can be used with
Xany kind of file. Par files are especially popular on Usenet.
X
XWWW: http://chuchusoft.com/par2_tbb/
END-of-par2cmdline-tbb/pkg-descr
exit



>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list