updated on Sat Jan 14 12:12:45 UTC 2012
[aur-mirror.git] / pmcma-git / PKGBUILD
blob17dcdc61d4aaa074ac25a0c7a7ed046674fb924c
1 # See http://wiki.archlinux.org/index.php/VCS_PKGBUILD_Guidelines
2 # for more information on packaging from GIT sources.
4 # Maintainer: Your Name <youremail@domain.com>
5 pkgname=pmcma-git
6 pkgver=20111229
7 pkgrel=1
8 pkgdesc="A tool aimed at determining if a given software bug is exploitable"
9 arch=('i686' 'x86_64')
10 url="http://www.pmcma.org"
11 license=('GPL')
12 makedepends=('git' 'cmake' 'flex')
14 _gitroot=https://github.com/toucan-system/pmcma
15 _gitname=pmcma
17 build() {
18   cd "$srcdir"
19   msg "Connecting to GIT server...."
21   if [[ -d "$_gitname" ]]; then
22     cd "$_gitname" && git pull origin
23     msg "The local files are updated."
24   else
25     git clone "$_gitroot" "$_gitname"
26   fi
28   msg "GIT checkout done or server timeout"
29   msg "Starting build..."
31   rm -rf "$srcdir/$_gitname-build"
32   git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
33   cd "$srcdir/$_gitname-build"
34   
35   sed -i 's#cd beaengine/ && :>CMakeCache.txt && cmake . && make#$(shell cd beaengine/ \&\& :>CMakeCache.txt \&\& cmake . \&\& make)#' Makefile
36   sed -i 's#/usr/#$(DESTDIR)/usr/#g' Makefile
37   make
39   make testcases
42 package() {
43   cd "$srcdir/$_gitname-build"
44   install -d -m 755 "$pkgdir/usr/bin"
45   install -d -m 755 "$pkgdir/usr/share/man/man1/"
46   make DESTDIR="$pkgdir/" install
48   cat > ${pkgdir}/usr/bin/gcore << 'EOF'
49 #!/bin/sh
51 #   Copyright (C) 2003, 2005, 2007, 2008, 2009, 2010, 2011
52 #   Free Software Foundation, Inc.
54 # This program is free software; you can redistribute it and/or modify
55 # it under the terms of the GNU General Public License as published by
56 # the Free Software Foundation; either version 3 of the License, or
57 # (at your option) any later version.
59 # This program is distributed in the hope that it will be useful,
60 # but WITHOUT ANY WARRANTY; without even the implied warranty of
61 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
62 # GNU General Public License for more details.
64 # You should have received a copy of the GNU General Public License
65 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
68 # gcore.sh
69 # Script to generate a core file of a running program.
70 # It starts up gdb, attaches to the given PID and invokes the gcore command.
73 if [ "$#" -eq "0" ]
74 then
75     echo "usage:  gcore [-o filename] pid"
76     exit 2
79 # Need to check for -o option, but set default basename to "core".
80 name=core
82 if [ "$1" = "-o" ]
83 then
84     if [ "$#" -lt "3" ]
85     then
86         # Not enough arguments.
87         echo "usage:  gcore [-o filename] pid"
88         exit 2
89     fi
90     name=$2
92     # Shift over to start of pid list
93     shift; shift
96 # Initialise return code.
97 rc=0
99 # Loop through pids
100 for pid in $*
102         # `</dev/null' to avoid touching interactive terminal if it is
103         # available but not accessible as GDB would get stopped on SIGTTIN.
104         gdb </dev/null --nx --batch \
105             -ex "set pagination off" -ex "set height 0" -ex "set width 0" \
106             -ex "attach $pid" -ex "gcore $name.$pid" -ex detach -ex quit
108         if [ -r $name.$pid ] ; then 
109             rc=0
110         else
111             echo gcore: failed to create $name.$pid
112             rc=1
113             break
114         fi
117 done
119 exit $rc
122   chmod +x ${pkgdir}/usr/bin/gcore
125 # vim:set ts=2 sw=2 et: