Skip to content
This repository was archived by the owner on Jan 25, 2021. It is now read-only.
This repository was archived by the owner on Jan 25, 2021. It is now read-only.

Building DEB package #3

Closed
Closed
@elvenfighter

Description

@elvenfighter

I've managed to get a working DEB package by building the binary as described (cmake .. && make).
Since I really hope this will be merged to the original PulseAudio (and, consequently will end up in repositories sooner or later), I did not bother with fancy stuff and using CPack.

However, I wanted to share my script for re-building pulseaudio-module-bluetooth using binaries build from these sources and the original DEB shenanigans from (Ubuntu/Debian) repository.

#!/bin/bash

# Builds pulseaudio-module-bluetooth DEB in current directory
# using binaries from CMake build
# Usage:
#
#   # do the cmake build, e.g.
#   git clone ... && mkdir build && cd build && cmake .. && make
#
#   # build a DEB from that binaries on Ubuntu (or maybe Debian)
#   cd ..
#   mkdir deb && cd deb
#   wget $THIS_SCRIPT_URL -O pkg-build.sh
#   ./pkg-build.sh
#
# This would generate a .deb file with -9git~<hash> in name, install it

BUILD_DIR=$1
PKG_NAME=pulseaudio-module-bluetooth
OS_CODENAME=$(lsb_release -sc)
# agli huck
#REPO_VERSION=$(apt policy "${PKG_NAME}" | grep ubuntu | head -n 1 | awk '{print $1}')

[ ! -d "$BUILD_DIR" ] && BUILD_DIR="../build"
if [ ! -d "$BUILD_DIR" ]; then
  echo "## ERROR: specify build directory with binaries as first argument" >&2
  exit 1
fi

rm -rf "$PKG_NAME"
rm -f *.deb

apt download "${PKG_NAME}/${OS_CODENAME}"

ORIG_PKG=$(find . -maxdepth 1 -name "${PKG_NAME}*.deb")

# extract original packages
mkdir "${PKG_NAME}"
dpkg-deb -x "${ORIG_PKG}" "${PKG_NAME}"
dpkg-deb -e "${ORIG_PKG}" "${PKG_NAME}/DEBIAN"

PLUGINS_DIR="$(find "$PKG_NAME" -type d -name 'pulse-*.*')/modules"

# copy new binaries
find "$BUILD_DIR" -maxdepth 1 -type f -name '*.so' -print -exec cp {} "${PLUGINS_DIR}" \;

# update version
GIT_HASH=$(git rev-parse --short HEAD)
TIMESTAMP=$(date '+%Y%m%d')
sed -e "s/^Version: \(.*\)$/Version: \1-9git+${TIMESTAMP}~${GIT_HASH}/" -i "${PKG_NAME}/DEBIAN/control"

# update md5sums
find "${PKG_NAME}" -type f ! -path "${PKG_NAME}/DEBIAN*" -exec md5sum {} + | sed -e "s|${PKG_NAME}/||g" > "${PKG_NAME}/DEBIAN/md5sums"

dpkg-deb -b "${PKG_NAME}" "${PKG_NAME}.deb"
dpkg-name "${PKG_NAME}.deb"

Metadata

Metadata

Assignees

No one assigned

    Labels

    tipsHelpful guides

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions