Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

Proper RPM packaging #16

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions Debian/OpenTabletDriver/DEBIAN/control

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions Debian/debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
12 changes: 12 additions & 0 deletions Debian/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Source: opentabletdriver
Priority: optional
Build-Depends: dotnet-sdk-6.0
Maintainer: InfinityGhost <infinityghostgit@gmail.com>, hwsnemo <hwsnemo@gmail.com>

Package: opentabletdriver
Section: base
Architecture: amd64
Depends: libevdev2, libgtk-3-0, dotnet-runtime-6.0
Recommends: libx11-dev, libxrandr-dev
Description: OpenTabletDriver
A cross-platform open source tablet driver.
File renamed without changes.
10 changes: 10 additions & 0 deletions Debian/debian/opentabletdriver.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
usr/share/OpenTabletDriver
usr/share/man/man8/opentabletdriver.8*
usr/share/pixmaps/otd.ico
usr/share/pixmaps/otd.png
usr/share/applications/OpenTabletDriver.desktop
usr/bin/opentabletdriver
usr/bin/otd
usr/lib/systemd/user/opentabletdriver.service
usr/lib/udev/rules.d/99-opentabletdriver.rules
usr/lib/modprobe.d/99-opentabletdriver.conf
2 changes: 1 addition & 1 deletion Debian/OpenTabletDriver/DEBIAN/postinst → Debian/debian/opentabletdriver.postinst
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ fi

if lsmod | grep wacom > /dev/null ; then
rmmod wacom || true
fi
fi
40 changes: 40 additions & 0 deletions Debian/debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/make -f
SHELL=/usr/bin/env bash
PREFIX = debian/tmp/usr
COMMON = Common/Linux/
PKG_VERSION = $(shell [[ $$(cat Directory.Build.props) =~ \<VersionBase\>(.+?)\<\/VersionBase\> ]] && echo $${BASH_REMATCH[1]})
VERSION_REGEX = ^Version=.\+$$
VERSION_REPLACE_REGEX = Version=$(PKG_VERSION)

%:
dh $@

override_dh_auto_build:
./build.sh
find ./bin -name "*.pdb" -type f -exec rm {} ';'
./generate-rules.sh -v OpenTabletDriver.Configurations/Configurations ./99-opentabletdriver.rules

override_dh_auto_install:
mkdir -p $(PREFIX)/share/OpenTabletDriver
cp -r bin/* $(PREFIX)/share/OpenTabletDriver

mkdir -p $(PREFIX)/bin
install -m 0755 $(COMMON)/scripts/otd $(PREFIX)/bin/otd
install -m 0755 $(COMMON)/scripts/opentabletdriver $(PREFIX)/bin/opentabletdriver

mkdir -p $(PREFIX)/lib/modprobe.d
mkdir -p $(PREFIX)/lib/systemd/user
install -m 0644 $(COMMON)/modprobe/99-opentabletdriver.conf $(PREFIX)/lib/modprobe.d/99-opentabletdriver.conf
install -m 0755 $(COMMON)/systemd-user/opentabletdriver.service $(PREFIX)/lib/systemd/user/

mkdir -p $(PREFIX)/share/man/man8
gzip -c docs/manpages/opentabletdriver.8 > $(PREFIX)/share/man/man8/opentabletdriver.8.gz

mkdir -p $(PREFIX)/share/pixmaps
cp -v OpenTabletDriver.UX/Assets/otd.{ico,png} $(PREFIX)/share/pixmaps

mkdir -p $(PREFIX)/lib/udev/rules.d
install -m 0644 ./99-opentabletdriver.rules $(PREFIX)/lib/udev/rules.d/99-opentabletdriver.rules

mkdir -p $(PREFIX)/share/applications
sed "s/$(VERSION_REGEX)/$(VERSION_REPLACE_REGEX)/g" "Common/Linux/desktop/OpenTabletDriver.desktop" > $(PREFIX)/share/applications/OpenTabletDriver.desktop
1 change: 1 addition & 0 deletions Debian/debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0
95 changes: 21 additions & 74 deletions Debian/package
Original file line number Diff line number Diff line change
Expand Up @@ -4,98 +4,45 @@ SCRIPT_DIR=$(realpath $(dirname ${BASH_SOURCE[0]}))

source "${SCRIPT_DIR}/../base"

# Build arguments
FRAMEWORK="net6.0"
RUNTIME="linux-x64"
PROJECTS=("OpenTabletDriver.Daemon" "OpenTabletDriver.Console" "OpenTabletDriver.UX.Gtk")

# Directories
PKG_DIR="${SCRIPT_DIR}/OpenTabletDriver"
OUT_DIR="${PKG_DIR}/usr/share/OpenTabletDriver"
OUT_DIR_PIXMAPS="${PKG_DIR}/usr/share/pixmaps"

# Package
PKG_DEB_FILE="${SCRIPT_DIR}/OpenTabletDriver.deb"
DEBIAN_DIR="${PKG_DIR}/DEBIAN"

# Files
PKG_DESKTOP_FILE="${PKG_DIR}/usr/share/applications/OpenTabletDriver.desktop"
OUT_UDEV_FILE="${PKG_DIR}/usr/lib/udev/rules.d/99-opentabletdriver.rules"

# Output

clean() {
clean_target "${PKG_DEB_FILE}" "Cleaning up existing builds..."
clean_target "${OUT_DIR}" "Cleaning up build directory..."
clean_target "${OUT_UDEV_FILE}" "Cleaning existing udev rules..."
rm -rf ${SCRIPT_DIR}/opentabletdriver-* ${SCRIPT_DIR}/opentabletdriver_*
}

print "Cleaning 'DEBIAN/control'..."
regex_edit "^Installed-Size:.\+$" "Installed-Size: 0" "${DEBIAN_DIR}/control"
regex_edit "^Version: .\+$" "Version: 0.0.0" "${DEBIAN_DIR}/control"
prepare() {
pushd "${SCRIPT_DIR}"
cp -rv "${SRC_DIR}" opentabletdriver-${PKG_VERSION}
cp -rv debian opentabletdriver-${PKG_VERSION}/
cp -rv "${ROOT_DIR}/Common" opentabletdriver-${PKG_VERSION}/
cat <<EOF > opentabletdriver-${PKG_VERSION}/debian/changelog
opentabletdriver (${PKG_VERSION}) UNRELEASED; urgency=low

print "Cleaning desktop file..."
regex_edit "^Version=.\+$" "Version=0.0.0" "${PKG_DESKTOP_FILE}"
}
* New version: ${PKG_VERSION}

build() {
print "Building OpenTabletDriver..."
for project in ${PROJECTS[@]}; do
dotnet publish "${SRC_DIR}/${project}" \
--runtime ${RUNTIME} \
--configuration Release \
--self-contained false \
--framework ${FRAMEWORK} \
--output ${OUT_DIR} \
/p:VersionSuffix="${VERSION_SUFFIX}"
done
-- InfinityGhost <infinityghostgit@gmail.com> `LANG=C date +"%a, %d %b %Y %X %z"`

EOF
popd
}

package() {
generate_rules "${SRC_DIR_CONFIGURATIONS}" "${OUT_UDEV_FILE}"

copy_assets "${OUT_DIR_PIXMAPS}"

clean_debug "${OUT_DIR}"

update_size
update_version

create_debpkg "${PKG_DIR}" "${PKG_DEB_FILE}"

create_debpkg "${PKG_DEB_FILE}"
print "Packaging complete."
}

copy_assets() {
[ "$#" -ne 1 ] && exit 102

local ASSET_DIR="${SRC_DIR}/OpenTabletDriver.UX/Assets"
[ ! -d "${ASSET_DIR}" ] && exit 103

print "Copying assets to '${1}'..."
mkdir -p "${1}"
for file in "${SRC_DIR}/OpenTabletDriver.UX/Assets/*"; do
[ -f "${file}" ] && cp -v "${file}" "${1}/$(basename ${file})"
done
}

update_size() {
print "Updating size in DEBIAN/control"
regex_edit "Installed-Size:.\+$" "Installed-Size: $(du -s "${PKG_DIR}" | cut -f1)" "${DEBIAN_DIR}/control"
}

update_version() {
print "Updating version in DEBIAN/control"
regex_edit "Version: .\+$" "Version: ${PKG_VERSION}" "${DEBIAN_DIR}/control"

print "Updating version in desktop file"
regex_edit "Version=.\+$" "Version=${PKG_VERSION}" "${PKG_DESKTOP_FILE}"
}

create_debpkg () {
[ "$#" -ne 2 ] && exit 104

print "Packaging 'OpenTabletDriver.deb'..."
dpkg-deb --build "${1}" "${2}"
pushd "${SCRIPT_DIR}"
pushd "opentabletdriver-${PKG_VERSION}"
dpkg-buildpackage -b
popd
mv "opentabletdriver_${PKG_VERSION}_amd64.deb" "${1}"
popd
}

case $1 in
Expand Down
4 changes: 3 additions & 1 deletion Redhat/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
OpenTabletDriver/usr/share/OpenTabletDriver/
OpenTabletDriver/usr/share/pixmaps/
OpenTabletDriver/usr/lib/udev/rules.d/
*.rpm
*.rpm
*.tar.gz
*.spec
1 change: 1 addition & 0 deletions Redhat/BUILD/OpenTabletDriver
Submodule OpenTabletDriver added at 041264
165 changes: 0 additions & 165 deletions Redhat/OpenTabletDriver/LICENSE

This file was deleted.

Loading