Skip to content

Commit

Permalink
packaging: update Macports portfile
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 committed Nov 1, 2022
1 parent 3e9de91 commit 6972ac3
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 0 deletions.
74 changes: 74 additions & 0 deletions host/packaging/macports/ubertooth/Portfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem 1.0
PortGroup cmake 1.1
PortGroup conflicts_build 1.0
PortGroup github 1.0
PortGroup legacysupport 1.1

github.setup greatscottgadgets ubertooth 3e9de91f406ea13f4a5a76c3fd5e21c2a0375ad8
version 2022-07-19
revision 0
categories devel net security
description Software, firmware and hardware designs for Ubertooth.
long_description Project Ubertooth is an open source wireless development platform suitable \
for Bluetooth experimentation. Ubertooth ships with a capable BLE (Bluetooth Smart) \
sniffer and can sniff some data from Basic Rate (BR) Bluetooth Classic connections.
license GPL-2
maintainers {@barracuda156 gmail.com:vital.had} openmaintainer

homepage https://github.com/greatscottgadgets/ubertooth

checksums rmd160 3a3545670f44bcb3a1ce257bf5dd5da42fba1014 \
sha256 3ad1dc36accd8b7f69fdf4489df93afcaa4d1e7bdd9448b24a23eacc525deec5 \
size 1307090

# clock_gettime
legacysupport.newest_darwin_requires_legacy 15

patchfiles patch-python3.diff

set python_branch 3.10
set python_ver [string map {. {}} ${python_branch}]
configure.python ${prefix}/bin/python${python_branch}

depends_build-append \
port:pkgconfig

if {${build_arch} ni [list ppc ppc64]} {
depends_build-append \
port:python${python_ver} \
port:py${python_ver}-numpy \
port:py${python_ver}-pyside \
port:py${python_ver}-setuptools
}

depends_lib-append path:${prefix}/lib/pkgconfig/libbtbb.pc:libbtbb \
path:${prefix}/lib/pkgconfig/libusb-1.0.pc:libusb

post-patch {
fs-traverse f ${worksrcpath}/host/python {
if {[file extension ${f}] eq ".py"} {
reinplace -q "s|/usr/bin/env python3|${configure.python}|" ${f}
}
}
reinplace "s|/usr/bin/env python3|${configure.python}|" ${worksrcpath}/host/python/ubtbr/ubertooth-btbr
reinplace "s|/usr/bin/env python3|${configure.python}|" ${worksrcpath}/host/python/specan_ui/ubertooth-specan-ui
reinplace "s|/usr/bin/env python3|${configure.python}|" ${worksrcpath}/host/python/specan_ui/setup.py.in
reinplace "s|@PYTHON3@|${configure.python}|g" ${worksrcpath}/host/python/ubtbr/CMakeLists.txt
}

cmake.source_dir ${worksrcpath}/host
cmake.module_path ${cmake.source_dir}/cmake/modules

conflicts_build ${name}

compiler.blacklist-append *gcc-4.*

platform darwin powerpc {
# Indirect dependency, py310-shiboken, currently fails on PPC: https://trac.macports.org/ticket/65708
configure.args-append \
-DENABLE_PYTHON=OFF
# Needed for Rosetta
compiler.blacklist-append clang
}
37 changes: 37 additions & 0 deletions host/packaging/macports/ubertooth/files/patch-python3.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
--- host/python/CMakeLists.txt.orig 2022-07-19 05:15:57.000000000 +0800
+++ host/python/CMakeLists.txt 2022-11-01 18:44:41.000000000 +0800
@@ -20,7 +20,8 @@
project(ubertooth-python)

# Check for python installation
-find_package(Python3)
+set(Python3_FIND_UNVERSIONED_NAMES NEVER)
+find_package(PYTHON3)
if(NOT Python3_FOUND)
return()
else()

--- host/python/ubtbr/CMakeLists.txt.orig 2022-07-19 05:15:57.000000000 +0800
+++ host/python/ubtbr/CMakeLists.txt 2022-11-01 19:48:10.000000000 +0800
@@ -1,4 +1,5 @@
-find_program(PYTHON3 "python3")
+set(Python3_FIND_UNVERSIONED_NAMES NEVER)
+find_package(PYTHON3)
set(SETUP_PY_IN ${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in)
set(SETUP_PY ${CMAKE_CURRENT_BINARY_DIR}/setup.py)
set(DEPS ${CMAKE_CURRENT_SOURCE_DIR}/ubtbr/__init__.py
@@ -9,12 +10,12 @@
configure_file(${SETUP_PY_IN} ${SETUP_PY})

add_custom_command(OUTPUT ${OUTPUT}/timestamp
- COMMAND ${PYTHON3} setup.py build
+ COMMAND @PYTHON3@ setup.py build
COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}/timestamp
DEPENDS ${DEPS})

add_custom_target(ubtbr ALL DEPENDS ${OUTPUT}/timestamp)
-install(CODE "execute_process(COMMAND ${PYTHON3} ${SETUP_PY} build -b ${OUTPUT} install -f --prefix=${CMAKE_INSTALL_PREFIX})")
+install(CODE "execute_process(COMMAND @PYTHON3@ ${SETUP_PY} build -b ${OUTPUT} install -f --prefix=${CMAKE_INSTALL_PREFIX})")

add_custom_target(ubertooth-btbr ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ubertooth-btbr)
install(PROGRAMS ubertooth-btbr DESTINATION ${INSTALL_DEFAULT_BINDIR})

0 comments on commit 6972ac3

Please sign in to comment.