move over to using meson.build
This commit is contained in:
parent
c22ecb9b76
commit
5543da3c9f
177
build.sh
177
build.sh
|
@ -7,7 +7,7 @@ makebin="${makebin:-$(command -v make)}"
|
||||||
cc="${cc:-${CC:-gcc}}"
|
cc="${cc:-${CC:-gcc}}"
|
||||||
opt="${opt:-${OPT:--O2}}"
|
opt="${opt:-${OPT:--O2}}"
|
||||||
warn="${warn:-true}"
|
warn="${warn:-true}"
|
||||||
xresources=""
|
reconfigure="${reconfigure:-true}"
|
||||||
|
|
||||||
check_dist() {
|
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
|
[ -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
|
||||||
|
@ -18,7 +18,8 @@ check_dist() {
|
||||||
check() {
|
check() {
|
||||||
if [ "$mac" != "true" ]; then
|
if [ "$mac" != "true" ]; then
|
||||||
[ ! -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 ldconfig)" ] && printf "ldconfig not found in %s. Please make sure your system is set up properly." "\$PATH" && exit 1
|
||||||
[ ! -x "$(command -v make)" ] && printf "make 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"
|
[ ! -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 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 libXft)" ] && printf "libXft found\n" && xft=true || xft=false
|
||||||
|
@ -51,126 +52,76 @@ loadconf() {
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
# to be overriden
|
[ "$GEN_MANUAL" != "false" ] && [ -x "$(command -v pandoc)" ] && command -v gen_manual > /dev/null && gen_manual
|
||||||
FREETYPEINC="$INCDIR/freetype2"
|
|
||||||
X11INC="/usr/X11R6/include"
|
|
||||||
X11LIB="/usr/X11R6/lib"
|
|
||||||
|
|
||||||
# macOS
|
cp -f meson.build meson.build.orig
|
||||||
if [ "$mac" = "true" ]; then
|
|
||||||
INCDIR="/usr/local/include"
|
|
||||||
FREETYPEINC="$INCDIR/freetype2"
|
|
||||||
X11INC="/opt/X11/include"
|
|
||||||
X11LIB="/opt/X11/lib"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# openbsd
|
if [ "$libconfig" != "true" ]; then
|
||||||
if [ "$openbsd" = "true" ]; then
|
libconfig_text="libconfig = false"
|
||||||
INCDIR="$X11INC"
|
|
||||||
FREETYPEINC="$INCDIR/freetype2"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# xinerama
|
|
||||||
if [ "$xinerama" = "true" ]; then
|
|
||||||
xineramalib="-lXinerama"
|
|
||||||
xineramatoggle="-DXINERAMA"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# imlib2
|
|
||||||
if [ "$imlib2" = "true" ]; then
|
|
||||||
imlib2libs="-lImlib2"
|
|
||||||
imlib2toggle="-DIMAGE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# openssl
|
|
||||||
if [ "$openssl" = "true" ]; then
|
|
||||||
opensslconf="openssl"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# pango
|
|
||||||
if [ "$pango" = "true" ] && [ "$pangoxft" = "true" ]; then
|
|
||||||
pangoconf="pango"
|
|
||||||
pangoxftconf="pangoxft"
|
|
||||||
pangotoggle="-DPANGO"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# libconfig
|
|
||||||
if [ "$libconfig" = "true" ]; then
|
|
||||||
libconfigtoggle="-DCONFIG"
|
|
||||||
libconfigconf="libconfig"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# xresources
|
|
||||||
if [ "$xresources" = "true" ]; then
|
|
||||||
xrdbtoggle="-DXRESOURCES"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# fribidi
|
|
||||||
if [ "$fribidi" = "true" ]; then
|
|
||||||
bdlibs="-lfribidi"
|
|
||||||
bdinc="$INCDIR/fribidi"
|
|
||||||
bdtoggle="-DRTL"
|
|
||||||
else
|
else
|
||||||
bdlibs=""
|
libconfig_text="libconfig = true"
|
||||||
bdinc=""
|
|
||||||
bdtoggle=""
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$makebin clean
|
if [ "$pango" != "true" ] || [ "$pangoxft" != "true" ]; then
|
||||||
[ "$GEN_MANUAL" != "false" ] && [ -x "$(command -v pandoc)" ] && $makebin man
|
pango_text="pango = false"
|
||||||
|
pangoxft_text="pangoxft = false"
|
||||||
|
else
|
||||||
|
pango_text="pango = true"
|
||||||
|
pangoxft_text="pangoxft = false"
|
||||||
|
fi
|
||||||
|
|
||||||
$makebin \
|
if [ "$openssl" != "true" ] || [ "$imlib2" != "true" ]; then
|
||||||
CC="$cc" \
|
imlib2_text="imlib2 = false"
|
||||||
PREFIX="$PREFIX" \
|
openssl_text="openssl = false"
|
||||||
DESTDIR="$DESTDIR" \
|
else
|
||||||
OPT="$opt" \
|
imlib2_text="imlib2 = true"
|
||||||
XINERAMALIBS="$xineramalib" \
|
openssl_text="openssl = true"
|
||||||
XINERAMATOGGLE="$xineramatoggle" \
|
fi
|
||||||
IMLIB2LIBS="$imlib2libs" \
|
|
||||||
IMLIB2TOGGLE="$imlib2toggle" \
|
if [ "$xinerama" != "true" ]; then
|
||||||
PANGOCONF="$pangoconf" \
|
xinerama_text="xinerama = false"
|
||||||
PANGOXFTCONF="$pangoxftconf" \
|
else
|
||||||
PANGOTOGGLE="$pangotoggle" \
|
xinerama_text="xinerama = true"
|
||||||
BDLIBS="$bdlibs" \
|
fi
|
||||||
BDINC="$bdinc" \
|
|
||||||
BDTOGGLE="$bdtoggle" \
|
if [ "$fribidi" != "true" ]; then
|
||||||
FREETYPEINC="$FREETYPEINC" \
|
fribidi_text="fribidi = false"
|
||||||
OPENSSLCONF="$opensslconf" \
|
else
|
||||||
LIBCONFIGTOGGLE="$libconfigtoggle" \
|
fribidi_text="fribidi = true"
|
||||||
LIBCONFIGCONF="$libconfigconf" \
|
fi
|
||||||
XRDBTOGGLE="$xrdbtoggle" \
|
|
||||||
X11LIB="$X11LIB" \
|
if [ "$xresources" != "true" ]; then
|
||||||
X11INC="$X11INC"
|
xresources_text="xresources = false"
|
||||||
|
else
|
||||||
|
xresources_text="xresources = true"
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i "s/libconfig = true/$libconfig_text/" meson.build
|
||||||
|
sed -i "s/pango = true/$pango_text/" meson.build
|
||||||
|
sed -i "s/pangoxft = true/$pangoxft_text/" meson.build
|
||||||
|
sed -i "s/imlib2 = true/$imlib2_text/" meson.build
|
||||||
|
sed -i "s/openssl = true/$openssl_text/" meson.build
|
||||||
|
sed -i "s/xinerama = true/$xinerama_text/" meson.build
|
||||||
|
sed -i "s/fribidi = true/$fribidi_text/" meson.build
|
||||||
|
sed -i "s/xresources = true/$xresources_text/" meson.build
|
||||||
|
sed -i "s/opt = '-O2'/opt = '$opt'/g" meson.build
|
||||||
|
|
||||||
|
mkdir -p build/
|
||||||
|
|
||||||
|
if [ "$reconfigure" = "true" ]; then
|
||||||
|
meson setup --reconfigure build
|
||||||
|
else
|
||||||
|
meson setup build
|
||||||
|
fi
|
||||||
|
|
||||||
|
ninja -C build
|
||||||
|
|
||||||
|
cp -f meson.build.orig meson.build
|
||||||
}
|
}
|
||||||
|
|
||||||
install() {
|
install() {
|
||||||
if [ "$mac" = "true" ]; then
|
cd build/ || exit 1
|
||||||
RULE="install_mac"
|
meson install
|
||||||
else
|
|
||||||
RULE="install"
|
|
||||||
fi
|
|
||||||
|
|
||||||
$makebin $RULE \
|
|
||||||
CC="$cc" \
|
|
||||||
PREFIX="$PREFIX" \
|
|
||||||
OPT="$opt" \
|
|
||||||
XINERAMALIBS="$xineramalib" \
|
|
||||||
XINERAMATOGGLE="$xineramatoggle" \
|
|
||||||
IMLIB2LIBS="$imlib2libs" \
|
|
||||||
IMLIB2TOGGLE="$imlib2toggle" \
|
|
||||||
PANGOCONF="$pangoconf" \
|
|
||||||
PANGOXFTCONF="$pangoxftconf" \
|
|
||||||
PANGOTOGGLE="$pangotoggle" \
|
|
||||||
BDLIBS="$bdlibs" \
|
|
||||||
BDINC="$bdinc" \
|
|
||||||
BDTOGGLE="$bdtoggle" \
|
|
||||||
FREETYPEINC="$FREETYPEINC" \
|
|
||||||
OPENSSLCONF="$opensslconf" \
|
|
||||||
LIBCONFIGTOGGLE="$libconfigtoggle" \
|
|
||||||
LIBCONFIGCONF="$libconfigconf" \
|
|
||||||
XRDBTOGGLE="$xrdbtoggle" \
|
|
||||||
X11LIB="$X11LIB" \
|
|
||||||
X11INC="$X11INC"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[ "$1" = "--no-install" ] && install=false
|
[ "$1" = "--no-install" ] && install=false
|
||||||
|
|
|
@ -16,6 +16,7 @@ cc=gcc # compiler and linker
|
||||||
opt=-O2 # level of optimization
|
opt=-O2 # level of optimization
|
||||||
warn=true # warn about OS quirks
|
warn=true # warn about OS quirks
|
||||||
install=true # automatically install, if set to false an install will not be performed
|
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
|
# macOS/OS X/Mac OS X
|
||||||
if [ -d "/System/Library/Extensions" ]; then
|
if [ -d "/System/Library/Extensions" ]; then
|
||||||
|
|
10
meson.build
10
meson.build
|
@ -82,10 +82,18 @@ endif
|
||||||
|
|
||||||
project_target = executable(
|
project_target = executable(
|
||||||
meson.project_name(),
|
meson.project_name(),
|
||||||
project_source_files,
|
project_source_files, install : true,
|
||||||
dependencies: project_dependencies,
|
dependencies: project_dependencies,
|
||||||
install : true,
|
install : true,
|
||||||
c_args : build_args,
|
c_args : build_args,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
install_man('spmenu.1')
|
||||||
|
install_data(sources : 'docs/docs.md', install_dir : 'share/spmenu')
|
||||||
|
install_data(sources : 'docs/code-docs.md', install_dir : 'share/spmenu')
|
||||||
|
install_data(sources : 'docs/example.Xresources', install_dir : 'share/spmenu')
|
||||||
|
install_data(sources : 'docs/spmenu.conf', install_dir : 'share/spmenu')
|
||||||
|
install_data(sources : 'scripts/spmenu_run', install_dir : 'bin')
|
||||||
|
install_data(sources : 'scripts/spmenu_test', install_dir : 'bin')
|
||||||
|
|
||||||
test('spmenu', project_target)
|
test('spmenu', project_target)
|
||||||
|
|
Loading…
Reference in a new issue