[sway] refactoring + track version by counting commits

This commit is contained in:
Gwenhael Le Moine 2023-03-07 13:05:02 +01:00
parent f73df4d0b7
commit 365fcc8a6b
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -35,7 +35,8 @@ cp -R "$REPOSITORY" $TMP/
cd "$TMP/$PRGNAM/" || exit 1
case $VERSION in
trunk)
PKGVERSION="git_$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)"
# PKGVERSION="git_$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)"
PKGVERSION="r$(git rev-list --count HEAD)"
;;
latest)
PKGVERSION=$(git describe --tags --abbrev=0)
@ -47,6 +48,9 @@ case $VERSION in
esac
PKGNAM=${PRGNAM}
###########
# PATCHES #
###########
# Tray-menu patch
PATCH_6249=${PATCH_6249:-"yes"}
@ -54,11 +58,13 @@ if [ "$PATCH_6249" = "yes" ]; then
[ -e "$CWD"/patches/6249-tray-menu.patch ] && mv "$CWD"/patches/6249-tray-menu.patch{,.previous}
wget -c https://patch-diff.githubusercontent.com/raw/swaywm/sway/pull/6249.patch -O "$CWD"/patches/6249-tray-menu.patch
patch -p1 < "$CWD"/patches/6249-tray-menu.patch
PKGVERSION="${PKGVERSION}_+6249"
PKGVERSION="${PKGVERSION}_p6249"
fi
# Embed wlroots
######################
# EMBED DEPENDENCIES #
######################
# wlroots
EMBED_WLROOTS=${EMBED_WLROOTS:-"yes"}
if [ "$EMBED_WLROOTS" = "yes" ]; then
WLROOTS_VERSION=${WLROOTS_VERSION:-$VERSION}
@ -73,7 +79,8 @@ if [ "$EMBED_WLROOTS" = "yes" ]; then
cd "$TMP/$PRGNAM"/subprojects/wlroots || exit 1
case $WLROOTS_VERSION in
trunk)
WLROOTS_VERSION="git_$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)"
# WLROOTS_VERSION="git_$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)"
WLROOTS_VERSION="r$(git rev-list --count HEAD)"
;;
latest)
WLROOTS_VERSION=$(git describe --tags --abbrev=0)
@ -87,8 +94,7 @@ if [ "$EMBED_WLROOTS" = "yes" ]; then
PKGVERSION="${PKGVERSION}+${WLROOTS_VERSION}"
fi
# Embed libliftoff
# libliftoff
EMBED_LIBLIFTOFF=${EMBED_LIBLIFTOFF:-"yes"}
if [ "$EMBED_LIBLIFTOFF" = "yes" ]; then
LIBLIFTOFF_VERSION=${LIBLIFTOFF_VERSION:-$VERSION}
@ -103,7 +109,8 @@ if [ "$EMBED_LIBLIFTOFF" = "yes" ]; then
cd "$TMP/$PRGNAM"/subprojects/libliftoff || exit 1
case $LIBLIFTOFF_VERSION in
trunk)
LIBLIFTOFF_VERSION="git_$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)"
# LIBLIFTOFF_VERSION="git_$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)"
LIBLIFTOFF_VERSION="r$(git rev-list --count HEAD)"
;;
latest)
LIBLIFTOFF_VERSION=$(git describe --tags --abbrev=0)
@ -117,8 +124,7 @@ if [ "$EMBED_LIBLIFTOFF" = "yes" ]; then
PKGVERSION="${PKGVERSION}+${LIBLIFTOFF_VERSION}"
fi
# Embed libdisplay-info
# libdisplay-info
EMBED_LIBDISPLAYINFO=${EMBED_LIBDISPLAYINFO:-"yes"}
if [ "$EMBED_LIBDISPLAYINFO" = "yes" ]; then
LIBDISPLAYINFO_VERSION=${LIBDISPLAYINFO_VERSION:-$VERSION}
@ -133,7 +139,8 @@ if [ "$EMBED_LIBDISPLAYINFO" = "yes" ]; then
cd "$TMP/$PRGNAM"/subprojects/libdisplay-info || exit 1
case $LIBDISPLAYINFO_VERSION in
trunk)
LIBDISPLAYINFO_VERSION="git_$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)"
# LIBDISPLAYINFO_VERSION="git_$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)"
LIBDISPLAYINFO_VERSION="r$(git rev-list --count HEAD)"
;;
latest)
LIBDISPLAYINFO_VERSION=$(git describe --tags --abbrev=0)
@ -172,10 +179,8 @@ cd build/ || exit 1
meson install --destdir="$PKG"
cd ../
# Don't package wlroots includes or .so link as we don't want to interfere with SBo's wlroots
find "$PKG$PREFIX/lib$(uname -m | grep -o 64)/" -type l -exec rm {} \;
rm -r "$PKG$PREFIX/lib$(uname -m | grep -o 64)/pkgconfig/"
rm -r "$PKG$PREFIX/include/"
mkdir -p "$PKG$PREFIX/doc/$PRGNAM"
cp LICENSE ./*.md "$PKG$PREFIX/doc/$PRGNAM/"
cat <<EOF > "$PKG$PREFIX/bin/start_sway.sh"
#!/bin/bash
@ -221,18 +226,23 @@ exec dbus-run-session /usr/bin/sway
#exec /usr/bin/sway
EOF
chmod +x "$PKG$PREFIX/bin/start_sway.sh"
sed -i 's|Exec=sway|Exec=/usr/bin/start_sway.sh|' "$PKG$PREFIX/share/wayland-sessions/sway.desktop"
mkdir -p "$PKG$PREFIX/doc/$PRGNAM"
cp LICENSE ./*.md "$PKG$PREFIX/doc/$PRGNAM/"
# correction
###############
# corrections #
###############
cd "$PKG" || exit 1
chown -R root:root ./*
[ -d "$PKG$PREFIX/man" ] && find "$PKG$PREFIX/man" -name "*.?" -type f -exec gzip -9 {} \;
# embaumement
# Don't package wlroots includes or .so link as we don't want to interfere with SBo's wlroots
find "$PKG$PREFIX/lib$(uname -m | grep -o 64)/" -type l -exec rm {} \;
rm -r "$PKG$PREFIX/lib$(uname -m | grep -o 64)/pkgconfig/"
rm -r "$PKG$PREFIX/include/"
####################
# Actual packaging #
####################
mkdir -p "$PKG/install"
cat <<EOF > "$PKG/install/slack-desc"