This commit is contained in:
ferreo 2024-08-15 20:07:56 +01:00
parent b17dec4c85
commit 4e166b7012
7 changed files with 118 additions and 86 deletions

48
debian/build-deb-from-git.sh vendored Executable file
View File

@ -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

10
debian/changelog vendored
View File

@ -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) <nnnn is the bug number of your ITP> * 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 <andrea.righi@canonical.com> Fri, 26 Apr 2024 19:14:36 +0200
-- ferreo <harderthanfire@gmail.com> Wed, 18 Jan 2023 21:48:14 +0000

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
11

36
debian/control vendored
View File

@ -1,19 +1,21 @@
Source: upstream-name Source: scx
Section: admin Section: misc
Priority: optional Priority: optional
Maintainer: name <email> Maintainer: Andrea Righi <andrea.righi@canonical.com>
Standards-Version: 4.6.1 Standards-Version: 4.5.1
Build-Depends: debhelper-compat (= 13) Build-Depends: debhelper (>= 11), fakeroot,
Rules-Requires-Root: no 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 Package: scx
Architecture: linux-any Architecture: amd64
# Delete any of these lines if un-used Depends:
Depends: ${misc:Depends}, depends ${shlibs:Depends},
Recommends: high priority optdepends Description: sched_ext schedulers and tools
Conflicts: conflicts sched_ext is a Linux kernel feature which enables implementing kernel thread
Suggests: low priority optdepends schedulers in BPF and dynamically loading them. This package contains various
Breaks: also conflicts!? scheduler implementations and support utilities.
Provides: provides
#
Description: pkgdesc

0
debian/patches/series vendored Normal file
View File

98
debian/rules vendored
View File

@ -1,67 +1,43 @@
#! /usr/bin/make -f #!/usr/bin/make -f
## See debhelper(7) (uncomment to enable). ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
## Output every command that modifies files on the build system.
export DH_VERBOSE = 1
export PIKA_BUILD_ARCH = $(shell cat ../pika-build-arch)
## === the chain of command === # Detect the latest bpftool installed
## debuild runs a chain of dh functions in the following order: BPFTOOL := $(shell ls -c1 /usr/lib/linux-*tools*/bpftool 2>/dev/null | sort -n | tail -1)
## 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
## === 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 $@ 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

11
main.sh
View File

@ -6,15 +6,16 @@ set -e
echo "$PIKA_BUILD_ARCH" > pika-build-arch echo "$PIKA_BUILD_ARCH" > pika-build-arch
VERSION="1.0" VERSION="0.1.8.8"
# Clone Upstream # Clone Upstream
mkdir -p ./src-pkg-name git clone https://github.com/sched-ext/scx.git
cp -rvf ./debian ./src-pkg-name/ cd ./scx
cd ./src-pkg-name/ cp -rvf ./debian ./scx/
cd ./scx/
# Get build deps # 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 apt-get build-dep ./ -y
# Build package # Build package