move from makefile

This commit is contained in:
speedie 2023-05-08 11:11:49 +02:00
parent fe310119b1
commit a26f64de33
7 changed files with 41 additions and 22 deletions

1
.gitignore vendored
View file

@ -4,3 +4,4 @@
*sig*
spmenu
buildconf_dev
build

View file

@ -1,13 +1,9 @@
#!/bin/bash
# spmenu build script
PREFIX="${PREFIX:-/usr}"
DESTDIR="${DESTDIR:-}"
INCDIR="${INCDIR:-/usr/include}"
makebin="${makebin:-$(command -v make)}"
cc="${cc:-${CC:-gcc}}"
opt="${opt:-${OPT:--O2}}"
warn="${warn:-true}"
reconfigure="${reconfigure:-true}"
version="${version:-1.1}"
check_dist() {
[ -f "/etc/pacman.conf" ] && [ "$warn" != "false" ] && printf "hint: detected Pacman. if you want you can run 'makepkg' with proper arguments to install it using pacman.\n" && pacman=true
@ -20,7 +16,6 @@ check() {
[ ! -x "$(command -v ldconfig)" ] && printf "ldconfig not found in %s. Please make sure your system is set up properly." "\$PATH" && exit 1
[ ! -x "$(command -v ninja)" ] && printf "ninja not found in %s. Please make sure your system is set up properly." "\$PATH" && exit 1
[ ! -x "$(command -v meson)" ] && printf "meson not found in %s. Please make sure your system is set up properly." "\$PATH" && exit 1
[ ! -x "$(command -v "$cc")" ] && printf "%s not found in %s. Please make sure your system is set up properly." "$cc" "\$PATH"
[ -n "$(ldconfig -p | grep Imlib2)" ] && printf "Imlib2 found\n" && imlib2=true || imlib2=false
[ -n "$(ldconfig -p | grep libXft)" ] && printf "libXft found\n" && xft=true || xft=false
[ -n "$(ldconfig -p | grep libX11)" ] && printf "libX11 found\n" && x11=true || x11=false
@ -33,9 +28,7 @@ check() {
[ -n "$(ldconfig -p | grep freetype)" ] && printf "freetype found\n" && freetype=true || freetype=false
[ -n "$(ldconfig -p | grep libconfig)" ] && printf "libconfig found\n" && libconfig=true || libconfig=false
else
makebin="gnumake"
GEN_MANUAL="false"
PREFIX="/usr/local"
fi
}
@ -52,10 +45,13 @@ loadconf() {
}
build() {
[ "$GEN_MANUAL" != "false" ] && [ -x "$(command -v pandoc)" ] && command -v gen_manual > /dev/null && gen_manual
[ ! -f "meson.build" ] && printf "meson.build does not exist.\n" && exit 1
[ "$GEN_MANUAL" != "false" ] && [ -x "$(command -v pandoc)" ] && scripts/make/generate-docs.sh
cp -f meson.build meson.build.orig
[ "$reconfigure" != "false" ] && rm -rf build/
if [ "$libconfig" != "true" ]; then
libconfig_text="libconfig = false"
else
@ -67,7 +63,7 @@ build() {
pangoxft_text="pangoxft = false"
else
pango_text="pango = true"
pangoxft_text="pangoxft = false"
pangoxft_text="pangoxft = true"
fi
if [ "$openssl" != "true" ] || [ "$imlib2" != "true" ]; then
@ -116,6 +112,7 @@ build() {
ninja -C build
[ "$cp_build" = "true" ] && cp meson.build meson.build.used
mv meson.build.orig meson.build
}

View file

@ -12,18 +12,7 @@ openssl=true # enable support for openssl, used to calculate MD5
fribidi=true # enable support for right to left languages
libconfig=true # enable configuration and themes
xresources=true # enable .Xresources support
cc=gcc # compiler and linker
opt=-O2 # level of optimization
warn=true # warn about OS quirks
install=true # automatically install, if set to false an install will not be performed
reconfigure=true # reconfigure using meson
# macOS/OS X/Mac OS X
if [ -d "/System/Library/Extensions" ]; then
imlib2=false # currently unsupported on mac due to the use of pkg-config
pango=false # currently unsupported on mac due to the use of pkg-config
pangoxft=false # currently unsupported on mac due to the use of pkg-config
openssl=false # currently unsupported on mac due to the use of pkg-config
prefix=/usr/local # as of 10.15 catalina we can no longer write to /usr/bin and /usr/share
makebin=gnumake # on mac, the binary for GNU make is gnumake
fi

View file

@ -1,4 +1,4 @@
! spmenu VERSION default configuration
! spmenu default configuration
!
! You may copy this configuration file to ~/.config/spmenu/spmenurc OR ~/.spmenurc, it will be loaded on runtime.
! It is .Xresources syntax. As such you may also append it to your existing .Xresources configuration, use programs like Pywal to have universal colorschemes.

10
scripts/make/generate-docs.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
version="$(grep "version : '" meson.build | awk '{ print $3 }' | sed "s/'\"//g; s/\"',//g")"
printf "%% spmenu(1) ${version} | fancy dynamic menu\n" > .man.md
grep -v docs/preview.png docs/docs.md >> .man.md
pandoc --standalone --to man .man.md -o spmenu.1
pandoc --standalone .man.md -o spmenu.html
rm -f .man.md
scripts/make/generate-code-docs.sh docs/code-docs.md code.html || return
pandoc --standalone README.md -o README.html

View file

@ -0,0 +1,11 @@
#!/bin/sh
version="$(grep "version : '" meson.build | awk '{ print $3 }' | sed "s/'\"//g; s/\"',//g")"
scripts/make/generate-pkg.sh
command -v makepkg > /dev/null || exit 1
[ -f PKGBUILD ] || exit 1
cp -f PKGBUILD PKGBUILD.orig
sed -i "s/VERSION/${VERSION}/g; s/MD5SUM/$(md5sum *.tar.gz | cut -d ' ' -f 1)/g" PKGBUILD
makepkg -sfr --sign || exit 1
rm -rf src/ pkg/ *.tar.gz
cp PKGBUILD spmenu-${VERSION}.PKGBUILD; mv PKGBUILD.orig PKGBUILD

11
scripts/make/generate-pkg.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
version="$(grep "version : '" meson.build | awk '{ print $3 }' | sed "s/'\"//g; s/\"',//g")"
rm -f spmenu spmenu-${version}.tar.gz spmenu-${version}.PKGBUILD *.o *zst*
mkdir -p spmenu-${version}
cp -rf LICENSE Makefile *.h *.mk *.c scripts/ docs/ libs/ PKGBUILD build.sh spmenu-${version}
[ -f buildconf ] && cp buildconf spmenu-${version} || :
[ -f spmenu.1 ] && cp spmenu.1 spmenu-${version} || :
tar -cf spmenu-${version}.tar spmenu-${version}
gzip spmenu-${version}.tar
rm -rf spmenu-${version}