From 4e166b70126f4b137632bf84e5c25a0056f18e58 Mon Sep 17 00:00:00 2001 From: ferreo Date: Thu, 15 Aug 2024 20:07:56 +0100 Subject: [PATCH] initial --- debian/build-deb-from-git.sh | 48 ++++++++++++++++++ debian/changelog | 10 ++-- debian/compat | 1 + debian/control | 36 ++++++------- debian/patches/series | 0 debian/rules | 98 ++++++++++++++---------------------- main.sh | 11 ++-- 7 files changed, 118 insertions(+), 86 deletions(-) create mode 100755 debian/build-deb-from-git.sh create mode 100644 debian/compat create mode 100644 debian/patches/series diff --git a/debian/build-deb-from-git.sh b/debian/build-deb-from-git.sh new file mode 100755 index 0000000..06780e6 --- /dev/null +++ b/debian/build-deb-from-git.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# Produce a deb source package that can be uploaded to a Debian/Ubuntu builder. + +if [[ $(git --no-optional-locks status -uno --porcelain) ]]; then + echo "ERROR: git repository is not clean" + exit 1 +fi + +# Stop on error +set -e + +BPFTOOL=$(ls -c1 /usr/lib/linux-*tools*/bpftool 2>/dev/null | sort -n | tail -1) + +# Fetch Rust dependencies for offline build +meson setup build -Dcargo_home=`pwd`/cargo-deps +meson compile -C build fetch + +# Clean-up binary artifacts from embedded repos +cd build/libbpf +rm -f assets/* +rm -f fuzz/bpf-object-fuzzer_seed_corpus.zip +rm -rf .git +cd - +cd build/bpftool/libbpf +rm -f assets/* +rm -f fuzz/bpf-object-fuzzer_seed_corpus.zip +rm -rf .git +cd - +cd build/bpftool +rm -rf .git +cd - + +# Add and commit all the embedded build dependencies +git add -f build +git add -f cargo-deps +git commit -sm "DROP THIS: include dependencies" + +# Create upstream tag (required by gbp) +version=$(dpkg-parsechangelog -SVersion | cut -d- -f1) +git tag -f upstream/${version} + +# Produce source package (including an orig tarball) +git clean -xdf +git reset --hard HEAD +gbp buildpackage --git-ignore-branch -S -sa --lintian-opts --no-lintian +git clean -xdf +git reset --hard HEAD diff --git a/debian/changelog b/debian/changelog index 6d8d068..b9a9910 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,9 @@ -upstream-name (1.0-101pika1) pika; urgency=medium +scx (0.1.8.8-101pika) pika; urgency=medium - * Initial release. (Closes: #nnnn) + * Miscellaneous Ubuntu changes: + - Rebase on top of the latest upstream main branch + - include custom libbpf and bpftool in the source package + - enable scx_rustland by default + + -- Andrea Righi Fri, 26 Apr 2024 19:14:36 +0200 - -- ferreo Wed, 18 Jan 2023 21:48:14 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..b4de394 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +11 diff --git a/debian/control b/debian/control index 0bcd8e0..dc0aed2 100644 --- a/debian/control +++ b/debian/control @@ -1,19 +1,21 @@ -Source: upstream-name -Section: admin +Source: scx +Section: misc Priority: optional -Maintainer: name -Standards-Version: 4.6.1 -Build-Depends: debhelper-compat (= 13) -Rules-Requires-Root: no +Maintainer: Andrea Righi +Standards-Version: 4.5.1 +Build-Depends: debhelper (>= 11), fakeroot, + linux-libc-dev, bpftool, + libbpf-dev (>= 1.4.0), + binutils-dev, libelf-dev, libcap-dev, zlib1g-dev, pkg-config, + cmake, pkgconf, cargo, rustc, clang, llvm, llvm-dev, jq, meson +Homepage: https://github.com/sched-ext/scx +Vcs-Git: https://github.com/sched-ext/scx -Package: pkgname1 -Architecture: linux-any -# Delete any of these lines if un-used -Depends: ${misc:Depends}, depends -Recommends: high priority optdepends -Conflicts: conflicts -Suggests: low priority optdepends -Breaks: also conflicts!? -Provides: provides -# -Description: pkgdesc +Package: scx +Architecture: amd64 +Depends: + ${shlibs:Depends}, +Description: sched_ext schedulers and tools + sched_ext is a Linux kernel feature which enables implementing kernel thread + schedulers in BPF and dynamically loading them. This package contains various + scheduler implementations and support utilities. \ No newline at end of file diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..e69de29 diff --git a/debian/rules b/debian/rules index 64a084a..f4a854d 100755 --- a/debian/rules +++ b/debian/rules @@ -1,67 +1,43 @@ -#! /usr/bin/make -f +#!/usr/bin/make -f -## See debhelper(7) (uncomment to enable). -## Output every command that modifies files on the build system. -export DH_VERBOSE = 1 -export PIKA_BUILD_ARCH = $(shell cat ../pika-build-arch) +ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH) -## === the chain of command === -## debuild runs a chain of dh functions in the following order: -## dh_testdir -## dh_clean -## dh_auto_clean -## dh_update_autotools_config -## dh_autoreconf -## dh_auto_configure -## dh_prep -## dh_build -## dh_auto_build -## dh_install -## dh_auto_install -## dh_installdocs -## dh_installchangelogs -## dh_perl -## dh_link -## dh_strip_nondeterminism -## dh_compress -## dh_fixperms -## dh_missing -## dh_dwz -## dh_strip -## dh_makeshlibs -## dh_shlibdeps -## dh_installdeb -## dh_gencontrol -## but you are most likely to only need to override the following: -## dh_clean -## dh_auto_configure -## dh_build -## dh_install +# Detect the latest bpftool installed +BPFTOOL := $(shell ls -c1 /usr/lib/linux-*tools*/bpftool 2>/dev/null | sort -n | tail -1) -## === End end of region === +ifeq ($(ARCH),armhf) +MESON_EXTRA_OPTS := -Denable_rust=false +else ifeq ($(ARCH),s390x) +MESON_EXTRA_OPTS := -Denable_rust=false +endif -## === overriding dh functions === -## by default all dh functions will run a specific command based on the build system selected by "dh $@" -## if you have a makefile that does everything you need this is fine, -## but most likely you have no MakeFile and you want to add your own commands -## Note : overrides must be places above %: -## So here's a few examples: - -## overriding dh_clean to make it not delete rust vendor files: -#override_dh_clean: -# echo "disabled" - -## overriding dh_auto_configure to add custom configs: -#override_dh_auto_configure: -# $(srcdir)/configure -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_DATADIR=/usr/share -DCMAKE_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu -DBUILD_PLUGIN=OFF - -## overriding dh_install to install files to a package: -#override_dh_auto_configure: -# mkdir -p debian/pikman/usr/bin -# cp pikman debian/pikman/usr/bin/ - -## === End end of region === - -## This here will start the build: %: dh $@ + +override_dh_auto_configure: + mkdir -p debian/build + cd debian/build && ln -s ../../build/libbpf libbpf + cd debian/build && ln -s ../../build/bpftool bpftool + cd debian/build/libbpf && mkdir -p src/usr/include + meson setup debian/build \ + --prefix=/usr \ + --datadir=$(CURDIR)/debian/scx/usr \ + -Dcargo_home=$(CURDIR)/cargo-deps \ + -Doffline=true -Dbuildtype=release $(MESON_EXTRA_OPTS) + +override_dh_auto_build: + meson compile -j1 -C debian/build + +override_dh_auto_test: + dh_auto_test + +override_dh_auto_install: + meson install -C debian/build --destdir $(CURDIR)/debian/scx + +override_dh_install: + # Install all binaries to /usr/sbin + mkdir -p $(CURDIR)/debian/scx/usr/sbin/ + mv $(CURDIR)/debian/scx/usr/bin/* $(CURDIR)/debian/scx/usr/sbin/ + +override_dh_clean: + dh_clean diff --git a/main.sh b/main.sh index d80ca48..2ea4f84 100755 --- a/main.sh +++ b/main.sh @@ -6,15 +6,16 @@ set -e echo "$PIKA_BUILD_ARCH" > pika-build-arch -VERSION="1.0" +VERSION="0.1.8.8" # Clone Upstream -mkdir -p ./src-pkg-name -cp -rvf ./debian ./src-pkg-name/ -cd ./src-pkg-name/ +git clone https://github.com/sched-ext/scx.git +cd ./scx +cp -rvf ./debian ./scx/ +cd ./scx/ # Get build deps -LOGNAME=root dh_make --createorig -y -l -p src-pkg-name_"$VERSION" || echo "dh-make: Ignoring Last Error" +LOGNAME=root dh_make --createorig -y -l -p scx_"$VERSION" || echo "dh-make: Ignoring Last Error" apt-get build-dep ./ -y # Build package