Move PKGBUILD to packaging/PKGBUILD and add spmenu ebuild

This commit is contained in:
Jacob 2023-07-27 20:12:19 +02:00
parent 32418e80e8
commit a7316968e7
3 changed files with 119 additions and 6 deletions

80
packaging/spmenu.ebuild Normal file
View file

@ -0,0 +1,80 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit toolchain-funcs meson
DESCRIPTION="Fancy dynamic menu for X11 and Wayland, compatible with dmenu"
HOMEPAGE="https://spmenu.speedie.site"
if [[ ${PV} == 9999 ]]; then
inherit git-r3
EGIT_REPO_URI="https://git.speedie.site/speedie/${PN}"
else
KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~x86"
SRC_URI="https://ls.speedie.site/releases/${PN}/${PV}/${P}.tar.gz"
fi
LICENSE="MIT"
SLOT="0"
IUSE="+X +wayland +imlib2 +ssl +regex +fribidi +config +xinerama +xrdb +doc +run +test +man"
REQUIRED_USE="
!wayland? ( X )
!X? ( wayland )
imlib2? ( ssl )
ssl? ( imlib2 )
"
RDEPEND="
X? ( x11-libs/libX11 x11-libs/libXrender )
X? ( xrdb? ( x11-apps/xrdb ) )
X? ( xinerama? ( x11-libs/libXinerama ) )
wayland? ( dev-libs/wayland dev-util/wayland-scanner dev-libs/wayland-protocols )
imlib2? ( media-libs/imlib2 dev-libs/openssl )
ssl? ( dev-libs/openssl )
fribidi? ( dev-libs/fribidi )
x11-libs/pango
x11-libs/cairo
"
DEPEND="${RDEPEND}"
BDEPEND="virtual/pkgconfig"
src_prepare() {
default
}
src_configure() {
local emesonargs=(
$(meson_use wayland)
$(meson_use X x11)
$(meson_use xinerama)
$(meson_use xrdb xresources)
$(meson_use fribidi)
$(meson_use config libconfig)
$(meson_use regex)
$(meson_use doc docs)
$(meson_use man)
$(meson_use run)
$(meson_use test)
)
if use imlib2 && use ssl; then
emesonargs+=($(meson_use ssl openssl))
emesonargs+=($(meson_use imlib2))
else
emesonargs+=(-Dimlib2=false)
emesonargs+=(-Dopenssl=false)
fi
meson_src_configure
}
src_compile() {
meson_src_compile
}
src_install() {
meson_install
}

View file

@ -18,7 +18,7 @@ static=${static:-false}
clean() {
clean_headers
rm -rf ./*.zst* ./*.tar* ./*.sig* spmenu-*.PKGBUILD build/
rm -rf ./*.zst* ./*.tar* ./*.sig* spmenu-*.PKGBUILD spmenu-*.ebuild build/
}
check_correct_dir() {
@ -137,7 +137,20 @@ gen_pkg() {
rm -f spmenu spmenu-${version}.tar.gz spmenu-${version}.PKGBUILD *.o *zst*
mkdir -p spmenu-${version}
cp -rf LICENSE meson.build meson_options.txt *.c spmenu.1 spmenu_run.1 spmenu_test.1 scripts/ docs/ libs/ protocols/ PKGBUILD "spmenu-${version}"
cp -rf \
LICENSE \
meson.build \
meson_options.txt \
*.c \
spmenu.1 \
spmenu_run.1 \
spmenu_test.1 \
scripts/ \
docs/ \
libs/ \
protocols/ \
packaging \
"spmenu-${version}"
tar -cf spmenu-${version}.tar spmenu-${version}
gzip spmenu-${version}.tar
rm -rf spmenu-${version}
@ -155,19 +168,36 @@ gen_pkg() {
fi
}
gen_gentoo_pkg() {
if [ -f "packaging/spmenu.ebuild" ]; then
cp packaging/spmenu.ebuild spmenu-${version}.ebuild
if [ -x "$(command -v gpg)" ]; then
gpg --detach-sign --yes --local-user $(whoami) spmenu-${version}.ebuild
fi
if [ -x "$(command -v md5sum)" ]; then
md5sum spmenu-${version}.ebuild | cut -d ' ' -f 1 > spmenu-${version}.ebuild.md5
fi
if [ -x "$(command -v sha256sum)" ]; then
sha256sum spmenu-${version}.ebuild | cut -d ' ' -f 1 > spmenu-${version}.ebuild.sha256
fi
fi
}
gen_arch_pkg() {
[ "$(id -u)" = "0" ] && printf "Do not run as root.\n" && exit 1
[ ! -x "$(command -v makepkg)" ] && printf "makepkg required for this action.\n" && exit 1
[ -f PKGBUILD ] || exit 1
[ -f "packaging/PKGBUILD" ] || exit 1
gen_pkg
cp -f PKGBUILD PKGBUILD.orig
sed "s/VERSION/${version}/g; s/MD5SUM/$(md5sum *.tar.gz | cut -d ' ' -f 1)/g; s/SHA256SUM/$(sha256sum *.tar.gz | cut -d ' ' -f 1)/g" PKGBUILD > .PKGBUILD && mv .PKGBUILD PKGBUILD
sed "s/VERSION/${version}/g; s/MD5SUM/$(md5sum *.tar.gz | cut -d ' ' -f 1)/g; s/SHA256SUM/$(sha256sum *.tar.gz | cut -d ' ' -f 1)/g" packaging/PKGBUILD > .PKGBUILD && mv .PKGBUILD PKGBUILD
makepkg -sfr --sign || exit 1
rm -rf src/ pkg/
cp PKGBUILD spmenu-${version}.PKGBUILD; mv -f PKGBUILD.orig PKGBUILD
mv PKGBUILD spmenu-${version}.PKGBUILD
if [ -x "$(command -v md5sum)" ]; then
md5sum spmenu-${version}-1-x86_64.pkg.tar.zst | cut -d ' ' -f 1 > spmenu-${version}-1-x86_64.pkg.tar.zst.md5
@ -335,6 +365,7 @@ $0 dist Create a distro package for spmenu
$0 arglist Create an argument list for spmenu based on spmenu -h output
$0 kblist Create a keybind list in markdown column format based on keybinds.h
$0 pkg_arch Create a Arch package for spmenu
$0 pkg_gentoo Create a Gentoo package for spmenu
$0 theme <theme> Create a theme for spmenu based on 18 colors
$0 docs Generate documentation such as man pages for spmenu
$0 headers Generate headers using wayland-scanner
@ -350,6 +381,7 @@ main() {
"arglist") action="arglist" ;;
"kblist") action="kblist" ;;
"pkg_arch") action="arch" ;;
"pkg_gentoo") action="gentoo" ;;
"help") action="help" ;;
"install") action="install" ;;
"theme") action="theme" ;;
@ -371,6 +403,7 @@ main() {
"build") build ;;
"install") install ;;
"arch") gen_arch_pkg ;;
"gentoo") gen_gentoo_pkg ;;
"theme") generate_theme "$2" ;;
"kblist") kblist "libs/keybinds.h" ;;
"help") help ;;