You are not logged in.

#1 2013-10-24 18:25:31

vwyodajl
Member
Registered: 2012-01-21
Posts: 183

Need help with a PKGBUILD for libbtbb building from git

I am trying to write a new PKGBUILD for libbtbb[1]. There is one in the AUR already but it is not building from git[2]. I have been able to write git related ones before but I am new to working with cmake and I think that is where my issue is coming from.

What my problem is (I think) is that it is not packaging all the files needed. The reason I am thinking this is due to the fact that once I install the built package, when I go to build a package that depends on libbtbb it can not find everything. Such as it cant find bluetooth_packet.h or bluetooth_piconet.h. Which I know are both part of the package libbtbb. The package I am building that depends on it is UberTooth.

PKGBUILD

pkgname=libbtbb-git
pkgver=20130806
pkgrel=1
pkgdesc="This is the Bluetooth baseband decoding library, forked from the GR-Bluetooth project. It can be used to extract Bluetooth packet and piconet information from Ubertooth devices as well as GR-Bluetooth/USRP."
arch=('x86_64' 'i686')
url="http://sourceforge.net/p/libbtbb/"
license=('GPL')
depends=('bluez-libs' 'libpcap')
makedepends=('git' 'cmake')
conflicts=('libbtbb')
provides=('libbtbb')

_gitroot='https://github.com/dominicgs/libbtbb.git'
_gitname='libbtbb'

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 build..."

  rm -rf "$srcdir/$_gitname-build"
  git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
  cd "$srcdir/$_gitname-build"

  #
  # BUILD HERE
  #
  cmake -DCMAKE_INSTALL_PREFIX="$pkgdir" -DCMAKE_INCLUDE_PATH="$pkgdir"
  make
}

package() {
  cd "$srcdir/$_gitname-build"
  make  install
}

# vim:set ts=2 sw=2 et:

Can anyone spot what my issue is here or what I am not grasping to make it build a complete package? Thanks for your time and help with this. If I have forgotten any other info that can help please let me know.

[1]http://sourceforge.net/p/libbtbb/
[2]https://github.com/dominicgs/libbtbb.git

edit: removed solved for the time being as it ended up not being so, apologies.

Last edited by vwyodajl (2013-10-29 22:43:51)

Offline

#2 2013-10-24 18:35:12

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 4,988

Re: Need help with a PKGBUILD for libbtbb building from git

you need to set DESTDIR for the install and just set -DCMAKE_PREFIX=/usr on the cmake command.

You're also using a very old template for git PKGBUILDs, see https://wiki.archlinux.org/index.php/VC … Guidelines

Offline

#3 2013-10-24 19:00:22

vwyodajl
Member
Registered: 2012-01-21
Posts: 183

Re: Need help with a PKGBUILD for libbtbb building from git

Thank you. Will update and see where I get from there.

Offline

#4 2013-10-24 19:15:08

vwyodajl
Member
Registered: 2012-01-21
Posts: 183

Re: Need help with a PKGBUILD for libbtbb building from git

If I use -DCMAKE_PREFIX=/usr like you stated I get the following warning when building.

CMake Warning:
Manually-specified variables were not used by the project:

  CMAKE_PREFIX

Not sure why it is not taking that.

cmake -DCMAKE_PREFIX=/usr

It is also failing to build completely now. It has a hiccup with the following warning.

creating //usr/local/lib/python3.3
error: could not create '//usr/local/python3.3': Permission denied. 

Updated PKGBUILD

pkgname=libbtbb-git
pkgver=20130924
pkgrel=1
pkgdesc="This is the Bluetooth baseband decoding library, forked from the GR-Bluetooth project. It can be used to extract Bluetooth packet and piconet information from Ubertooth devices as well as GR-Bluetooth/USRP."
arch=('x86_64' 'i686' 'armv7h' 'armv6h')
url="http://sourceforge.net/p/libbtbb/"
license=('GPL')
depends=('bluez-libs' 'libpcap')
makedepends=('git' 'cmake')
conflicts=('libbtbb')
provides=('libbtbb')
source=("$pkgname"::'git://github.com/dominicgs/libbtbb.git')
md5sums=('SKIP')

pkgver() {
	cd "$pkgname"
	# Use the tag of the last commit
	local ver="$(git describe --long)"
	printf "%s" "${ver//-/.}"
}

build() {
  cd "$pkgname"
  cmake -DCMAKE_PREFIX=/usr
}

package() {
  cd "$pkgname"
  make  DESTDIR="$pkgdir" install
}

# vim:set ts=2 sw=2 et:

Last edited by vwyodajl (2013-10-24 19:15:59)

Offline

#5 2013-10-24 19:42:31

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 4,988

Re: Need help with a PKGBUILD for libbtbb building from git

I'm sorry, I meant -DCMAKE_INSTALL_PREFIX=/usr, not -DCMAKE_PREFIX. Looking at the build scripts, that's actually the default, so you don't really need it at all.

Looks like pcapdump isn't taking DESTDIR, probably because it uses setup.py. Not sure how to get around that off hand.

Offline

#6 2013-10-24 20:05:06

vwyodajl
Member
Registered: 2012-01-21
Posts: 183

Re: Need help with a PKGBUILD for libbtbb building from git

No worries. Thanks, you were correct and that portion works again. I will start researching the setup.py portion.

Offline

#7 2013-10-24 21:30:54

vwyodajl
Member
Registered: 2012-01-21
Posts: 183

Re: Need help with a PKGBUILD for libbtbb building from git

Well now with the correct flag to cmake it is giving a different warning about the python portion and I am at a loss. I am not finding any examples with the same issue. The error now is

copying /home/dev/libbtbb-git/src/libbtbb-git/python/pcaptools/build/lib/pcapdump/pcapdump.py -> //usr/lib/python3.3/site-packages/pcapdump
error: could not delete '//usr/lib/python3.3/site-packages/pcapdump/pcapdump.py': Permission denied

How can it copy it there but not delete, and doesn't make sense why it is copying to delete it. Unless I am just totally confused on this one. It seems it copies it to my actual system somehow but not in the package directory.

Last edited by vwyodajl (2013-10-24 21:36:12)

Offline

#8 2013-10-24 21:47:43

Jristz
Member
From: America/Santiago
Registered: 2011-06-11
Posts: 921

Re: Need help with a PKGBUILD for libbtbb building from git

Aparently the package try to acces '//usr/lib/python3.3/site-packages/pcapdump/pcapdump.py' that ever or not exist or is part of / (root, the dir that PKGBUILD never touch)

look for mee that you need chage the reference in the build script (or even patch that if need)


Well, I suppose that this is somekind of signature, no?

Offline

#9 2013-10-25 00:12:42

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 5,688
Website

Re: Need help with a PKGBUILD for libbtbb building from git

Here's a PKGBUILD with a patch to include the omitted header files. You should check with upstream if that is intentional.

PKGBUILD
_gitname='libbtbb'
pkgname="$_gitname-git"
pkgver=20130806
pkgrel=1
pkgdesc="This is the Bluetooth baseband decoding library, forked from the GR-Bluetooth project. It can be used to extract Bluetooth packet and piconet information from Ubertooth devices as well as GR-Bluetooth/USRP."
arch=('x86_64' 'i686')
url="http://sourceforge.net/p/libbtbb/"
license=('GPL')
depends=('bluez-libs' 'libpcap')
makedepends=('git' 'cmake')
conflicts=('libbtbb')
provides=('libbtbb')
source=("git://github.com/dominicgs/$_gitname.git" 'include-headers.patch')
sha256sums=('SKIP'
            '38649f7834a3d7b306b695f1293c66b41acf796830d81ec2a09b1d73a635d618')

pkgver() {
  cd "$srcdir/$_gitname"
  # Use the tag of the last commit
  local ver="$(git describe --long)"
  printf "%s" "${ver//-/.}"
}

prepare() {
  cd "$srcdir/$_gitname"
  git apply --ignore-space-change --ignore-whitespace \
    "$srcdir/include-headers.patch"
}

build() {
  cd "$srcdir/$_gitname"
  cmake -DCMAKE_INSTALL_PREFIX="/usr"
  make
}

package() {
  cd "$srcdir/$_gitname"
  make DESTDIR="$pkgdir/" install
}

# vim:set ts=2 sw=2 et:
include-headers.patch
---
 lib/src/CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/src/CMakeLists.txt b/lib/src/CMakeLists.txt
index 51dd07d..ce5f31d 100644
--- a/lib/src/CMakeLists.txt
+++ b/lib/src/CMakeLists.txt
@@ -23,7 +23,9 @@ set(c_sources ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth_packet.c
               ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth_piconet.c
               ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth_le_packet.c
        CACHE INTERNAL "List of C sources")
-set(c_headers ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth_le_packet.h
+set(c_headers ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth_packet.h
+              ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth_piconet.h
+              ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth_le_packet.h
               ${CMAKE_CURRENT_SOURCE_DIR}/btbb.h
        CACHE INTERNAL "List of C headers")

--
1.8.4.1

Btw, the description is too long. Try to shorten it.

Offline

#10 2013-10-25 05:12:31

vwyodajl
Member
Registered: 2012-01-21
Posts: 183

Re: Need help with a PKGBUILD for libbtbb building from git

@Xyne thanks a bunch for that.

Last edited by vwyodajl (2013-10-25 17:06:16)

Offline

#11 2013-10-25 05:24:29

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 4,988

Re: Need help with a PKGBUILD for libbtbb building from git

Um, Xyne, $pkgdir in the build function?

Offline

#12 2013-10-25 18:58:45

vwyodajl
Member
Registered: 2012-01-21
Posts: 183

Re: Need help with a PKGBUILD for libbtbb building from git

I checked with upstream and the missing headers was intentional.

Thanks again for your help Xyne.

Offline

#13 2013-10-25 22:37:53

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 5,688
Website

Re: Need help with a PKGBUILD for libbtbb building from git

Scimmia wrote:

Um, Xyne, $pkgdir in the build function?

Ooops. I missed that when copying the previous PKGBUILD.



@vwyodajl
Np.

I have corrected the mistake in my PKGBUILD indicated by Scimmia above (and added options to the "git apply" command).

Did upstream say why they omit their own header files?

Offline

#14 2013-10-29 22:42:51

vwyodajl
Member
Registered: 2012-01-21
Posts: 183

Re: Need help with a PKGBUILD for libbtbb building from git

Here is what they said

The c_headers list is being used as the list of headers to be installed rather than to be used for building libbtbb.  Since we made changes to libbtbb earlier in the year we now only export one header for Bluetooth baseband functions (btbb.h) and a second for Bluetooth low energy (bluetooth_le_packet.h).  The other headers are used to build the library, but they do not need to be installed for tools and applications to build on top of libbtbb.

One thing I realized after seeing your changes here was this needs to build with python2 and the files need to be patched. I had to disable python in the cmake build because regardless of how I passed the executable, it always found python3. I have been trying to get it work from your start for me but this is proving to be a major pain for me. Hopefully I can get this figured out so I can figure out its companion ubertooth from git.

Here is where I am so far, but for some reason my patch does not seem to hold through once everything is packaged. I am trying to make sure everything calls the proper python once installed.  If any other suggestions or help to get these building and packaging properly for me would be of great help. Once I can see how to get them built I am pretty sure I can make the kismet and wireshark plugin PKGBUILDs. Thanks for everyones time.
libbtbb-git PKGBUILD

_gitname='libbtbb'
pkgname="$_gitname-git"
pkgver=175.0c4345b
pkgrel=1
pkgdesc="This is the Bluetooth baseband decoding library, forked from the GR-Bluetooth project."
arch=('x86_64' 'i686')
url="http://sourceforge.net/p/libbtbb/"
license=('GPL')
depends=('bluez-libs' 'libpcap')
makedepends=('git' 'cmake')
conflicts=('libbtbb')
provides=('libbtbb')
source=("$_gitname"::"git://git.code.sf.net/p/libbtbb/code" 'python2fix.patch')
sha256sums=('SKIP'
            '2ad7956073cd257ba4a9776d014c7c742aed1b55dbc02f18234f63b429a4b16f')

pkgver() {
  cd "$srcdir/$_gitname"
  printf "%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd "$srcdir/$_gitname"
  git apply --ignore-space-change --ignore-whitespace --stat "$srcdir/python2fix.patch"
}

build() {
  cd "$srcdir/$_gitname"
  cmake -DCMAKE_INSTALL_PREFIX="/usr" -DCMAKE_INCLUDE_PATH="/usr" -DDISABLE_PYTHON=true
  make
}

package() {
  cd "$srcdir/$_gitname"
  make DESTDIR="$pkgdir/" install
  cd "$srcdir/$_gitname"/python/pcaptools
  /usr/bin/python2 setup.py install --root="$pkgdir/" --optimize=1
  cd "$srcdir/$_gitname"/python/utils
  install -Dm755 encode_sw.py "$pkgdir/usr/bin/encode_sw.py"
  install -Dm755 gen_barker_correct.py "$pkgdir/usr/bin/gen_barker_correct.py"
  install -Dm755 gen_check_tables.py "$pkgdir/usr/bin/gen_check_tables.py"
  install -Dm755 le_whitening.py "$pkgdir/usr/bin/le_whitening.py"
}

# vim:set ts=2 sw=2 et:

python2fix.patch

From 7ca66fc5c6c8194911cc3c278f35d7c4b897f7e2 Mon Sep 17 00:00:00 2001
Date: Tue, 29 Oct 2013 14:40:44 -0700

---
 python/pcaptools/btaptap                            | 2 +-
 python/utils/encode_sw.py                           | 2 +-
 python/utils/gen_barker_correct.py                  | 2 +-
 python/utils/gen_check_tables.py                    | 2 +-
 python/utils/le_whitening.py                        | 2 +-
 wireshark/plugins/btatt/tools/make-dissector-reg.py | 2 +-
 wireshark/plugins/btbb/tools/make-dissector-reg.py  | 2 +-
 wireshark/plugins/btle/tools/make-dissector-reg.py  | 2 +-
 wireshark/plugins/btsm/tools/make-dissector-reg.py  | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/python/pcaptools/btaptap b/python/pcaptools/btaptap
index 3b9eb72..dcb87c3 100755
--- a/python/pcaptools/btaptap
+++ b/python/pcaptools/btaptap
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 #
 # Copyright 2009 Joshua Wright, Michael Ossmann
 # 
diff --git a/python/utils/encode_sw.py b/python/utils/encode_sw.py
index 6583abf..115887d 100755
--- a/python/utils/encode_sw.py
+++ b/python/utils/encode_sw.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
 
 # produce a sync word for a given LAP
 
diff --git a/python/utils/gen_barker_correct.py b/python/utils/gen_barker_correct.py
index f428def..40fe5a3 100755
--- a/python/utils/gen_barker_correct.py
+++ b/python/utils/gen_barker_correct.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 
 # Reverse the binary of thesebarker codes for the host code
 barkers = (0x0d, 0x72)
diff --git a/python/utils/gen_check_tables.py b/python/utils/gen_check_tables.py
index 0ae41df..10e9c26 100755
--- a/python/utils/gen_check_tables.py
+++ b/python/utils/gen_check_tables.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
 
 # (64,30) linear block code stuff
 
diff --git a/python/utils/le_whitening.py b/python/utils/le_whitening.py
index 6ce9a9b..172b220 100755
--- a/python/utils/le_whitening.py
+++ b/python/utils/le_whitening.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 
 num_channels = 40
 bits = []
diff --git a/wireshark/plugins/btatt/tools/make-dissector-reg.py b/wireshark/plugins/btatt/tools/make-dissector-reg.py
index 060460c..ba98105 100755
--- a/wireshark/plugins/btatt/tools/make-dissector-reg.py
+++ b/wireshark/plugins/btatt/tools/make-dissector-reg.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 #
 # Looks for registration routines in the protocol dissectors,
 # and assembles C code to call all the routines.
diff --git a/wireshark/plugins/btbb/tools/make-dissector-reg.py b/wireshark/plugins/btbb/tools/make-dissector-reg.py
index 060460c..ba98105 100755
--- a/wireshark/plugins/btbb/tools/make-dissector-reg.py
+++ b/wireshark/plugins/btbb/tools/make-dissector-reg.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 #
 # Looks for registration routines in the protocol dissectors,
 # and assembles C code to call all the routines.
diff --git a/wireshark/plugins/btle/tools/make-dissector-reg.py b/wireshark/plugins/btle/tools/make-dissector-reg.py
index 060460c..ba98105 100755
--- a/wireshark/plugins/btle/tools/make-dissector-reg.py
+++ b/wireshark/plugins/btle/tools/make-dissector-reg.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 #
 # Looks for registration routines in the protocol dissectors,
 # and assembles C code to call all the routines.
diff --git a/wireshark/plugins/btsm/tools/make-dissector-reg.py b/wireshark/plugins/btsm/tools/make-dissector-reg.py
index 060460c..ba98105 100755
--- a/wireshark/plugins/btsm/tools/make-dissector-reg.py
+++ b/wireshark/plugins/btsm/tools/make-dissector-reg.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 #
 # Looks for registration routines in the protocol dissectors,
 # and assembles C code to call all the routines.
-- 
1.8.4.1

ubertooth-git

_gitname='ubertooth'
pkgname="$_gitname-git"
pkgver=736.5352af7
pkgrel=1
pkgdesc="A 2.4 GHz wireless development board suitable for Bluetooth experimentation. Open source hardware and software. Tools only"
arch=('x86_64' 'i686')
url="http://sourceforge.net/projects/ubertooth/"
license=('GPL')
depends=('libusbx' 'libbtbb' 'bluez-libs' 'libftdi')
makedepends=('git' 'cmake')
conflicts=('ubertooth')
provides=('ubertooth')
source=("$_gitname"::"git://git.code.sf.net/p/ubertooth/code" 'python2fix.patch')
sha256sums=('SKIP'
            '2ba4366994f52ef39afccdd2276ff9411a8b75e6ce84fb54f477f81a34781f70')

pkgver() {
  cd "$srcdir/$_gitname"
  printf "%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd "$srcdir/$_gitname"
  git apply --stat "$srcdir/python2fix.patch"
}

build() {
  cd "$srcdir/$_gitname"
  mkdir build && cd build
  cmake ../host -DCMAKE_INSTALL_PREFIX="/usr" -DCMAKE_INCLUDE_PATH="/usr" -DDISABLE_PYTHON=true
  make
}

package() {
  cd "$srcdir/$_gitname"/build
  make DESTDIR="$pkgdir/" install
  cd "$srcdir/$_gitname"/host/python/usb_dfu
  /usr/bin/python2 setup.py install --root="$pkgdir/" --optimize=1
  cd "$srcdir/$_gitname"/host/python/specan_ui
  /usr/bin/python2 setup.py install --root="$pkgdir/" --optimize=1
  cd "$srcdir/$_gitname"/host/python/extcap
  install -Dm755 btle-extcap.py "$pkgdir/usr/bin/btle-extcap.py"
}

# vim:set ts=2 sw=2 et:

python2fix.patch

From eade5e30e2b0154aa00a41084205b151223730bc Mon Sep 17 00:00:00 2001

---
 host/python/extcap/btle-extcap.py         | 2 +-
 host/python/specan_ui/setup.py            | 2 +-
 host/python/specan_ui/specan/Ubertooth.py | 2 +-
 host/python/specan_ui/ubertooth-specan-ui | 2 +-
 host/python/usb_dfu/dfu/dfu.py            | 2 +-
 host/python/usb_dfu/ubertooth-dfu         | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/host/python/extcap/btle-extcap.py b/host/python/extcap/btle-extcap.py
index b41d7c3..1b8cfee 100755
--- a/host/python/extcap/btle-extcap.py
+++ b/host/python/extcap/btle-extcap.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 
 # Copyright 2013 Mike Ryan
 #
diff --git a/host/python/specan_ui/setup.py b/host/python/specan_ui/setup.py
index f93f0a2..e731a21 100644
--- a/host/python/specan_ui/setup.py
+++ b/host/python/specan_ui/setup.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 """
 dfu setup
 
diff --git a/host/python/specan_ui/specan/Ubertooth.py b/host/python/specan_ui/specan/Ubertooth.py
index 7a18173..daaf808 100644
--- a/host/python/specan_ui/specan/Ubertooth.py
+++ b/host/python/specan_ui/specan/Ubertooth.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 #
 # Copyright 2011 Jared Boone
 #
diff --git a/host/python/specan_ui/ubertooth-specan-ui b/host/python/specan_ui/ubertooth-specan-ui
index c3c351f..ceab3b3 100755
--- a/host/python/specan_ui/ubertooth-specan-ui
+++ b/host/python/specan_ui/ubertooth-specan-ui
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 #
 # Copyright 2011 Jared Boone
 #
diff --git a/host/python/usb_dfu/dfu/dfu.py b/host/python/usb_dfu/dfu/dfu.py
index 19bdbff..0eb4921 100644
--- a/host/python/usb_dfu/dfu/dfu.py
+++ b/host/python/usb_dfu/dfu/dfu.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 #
 # Copyright 2010-2012 Michael Ossmann, Jared Boone, Dominic Spill
 # Copyright 2010 TheSeven
diff --git a/host/python/usb_dfu/ubertooth-dfu b/host/python/usb_dfu/ubertooth-dfu
index 5df7a47..263ae81 100755
--- a/host/python/usb_dfu/ubertooth-dfu
+++ b/host/python/usb_dfu/ubertooth-dfu
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 #
 # Copyright 2010, 2011 Michael Ossmann
 #
-- 
1.8.4.1

Last edited by vwyodajl (2013-10-30 05:32:21)

Offline

Board footer

Powered by FluxBB