diff --git a/build.sh b/build.sh index 62038db..bcd3456 100755 --- a/build.sh +++ b/build.sh @@ -4,6 +4,7 @@ opt="${opt:-${OPT:--O2}}" warn="${warn:-true}" reconfigure="${reconfigure:-true}" version="${version:-1.1}" +xresources="${xresources:-true}" 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 @@ -52,62 +53,30 @@ build() { [ "$reconfigure" != "false" ] && rm -rf build/ - if [ "$libconfig" != "true" ]; then - libconfig_text="libconfig = false" - else - libconfig_text="libconfig = true" - fi - - if [ "$pango" != "true" ] || [ "$pangoxft" != "true" ]; then - pango_text="pango = false" - pangoxft_text="pangoxft = false" - else - pango_text="pango = true" - pangoxft_text="pangoxft = true" - fi - - if [ "$openssl" != "true" ] || [ "$imlib2" != "true" ]; then - imlib2_text="imlib2 = false" - openssl_text="openssl = false" - else - imlib2_text="imlib2 = true" - openssl_text="openssl = true" - fi - - if [ "$xinerama" != "true" ]; then - xinerama_text="xinerama = false" - else - xinerama_text="xinerama = true" - fi - - if [ "$fribidi" != "true" ]; then - fribidi_text="fribidi = false" - else - fribidi_text="fribidi = true" - fi - - if [ "$xresources" != "true" ]; then - 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 + meson setup --reconfigure \ + -Dxresources="$xresources" \ + -Dfribidi="$fribidi" \ + -Dxinerama="$xinerama" \ + -Dimlib2="$imlib2" \ + -Dopenssl="$openssl" \ + -Dpango="$pango" \ + -Dpangoxft="$pangoxft" \ + -Dlibconfig="$libconfig" \ + build else - meson setup build + meson setup \ + -Dxresources="$xresources" \ + -Dfribidi="$fribidi" \ + -Dxinerama="$xinerama" \ + -Dimlib2="$imlib2" \ + -Dopenssl="$openssl" \ + -Dpango="$pango" \ + -Dpangoxft="$pangoxft" \ + -Dlibconfig="$libconfig" \ + build fi ninja -C build diff --git a/meson.build b/meson.build index b824420..819d35b 100644 --- a/meson.build +++ b/meson.build @@ -5,16 +5,6 @@ project( default_options : ['warning_level=3'] ) -imlib2 = true -openssl = true -xresources = true -fribidi = true -libconfig = true -pango = true -pangoxft = true -xinerama = true -opt = '-O2' - cc = meson.get_compiler('c') project_source_files = [ @@ -45,26 +35,26 @@ build_args = [ '-Wno-deprecated-declarations', '-Wno-unused-parameter', '-Wno-sign-compare', - opt, + get_option('opt'), ] -if imlib2 and openssl +if get_option('imlib2') and get_option('openssl') project_dependencies += [ dependency('imlib2') ] project_dependencies += [ dependency('openssl') ] build_args += [ '-DIMAGE' ] endif -if fribidi +if get_option('fribidi') project_dependencies += [ dependency('fribidi') ] build_args += [ '-DRTL' ] endif -if xinerama +if get_option('xinerama') project_dependencies += [ dependency('xinerama') ] build_args += [ '-DXINERAMA' ] endif -if pango and pangoxft +if get_option('pango') and get_option('pangoxft') project_dependencies += [ dependency('pango') ] project_dependencies += [ dependency('pangoxft') ] build_args += [ '-DPANGO' ] @@ -72,12 +62,12 @@ else project_dependencies += [ dependency('fontconfig') ] endif -if libconfig +if get_option('libconfig') project_dependencies += [ dependency('libconfig') ] build_args += [ '-DCONFIG' ] endif -if xresources +if get_option('xresources') build_args += [ '-DXRESOURCES' ] endif diff --git a/meson.options b/meson.options new file mode 100644 index 0000000..56282a3 --- /dev/null +++ b/meson.options @@ -0,0 +1,9 @@ +option('imlib2', type : 'boolean', value : true, description : 'Enable image support') +option('openssl', type : 'boolean', value : true, description : 'Enable OpenSSL, used for image support') +option('xresources', type : 'boolean', value : true, description : 'Enable .Xresources/xrdb support') +option('fribidi', type : 'boolean', value : true, description : 'Enable Right-to-left language support') +option('libconfig', type : 'boolean', value : true, description : 'Enable configuration file support') +option('pango', type : 'boolean', value : true, description : 'Enable Pango markup support') +option('pangoxft', type : 'boolean', value : true, description : 'Enable Pango for libXft') +option('xinerama', type : 'boolean', value : true, description : 'Enable multi-monitor support using libXinerama') +option('opt', type : 'string', value : '-O2', description : 'Optimization level') diff --git a/scripts/make/generate-pkg.sh b/scripts/make/generate-pkg.sh index e6c54df..c937b9a 100755 --- a/scripts/make/generate-pkg.sh +++ b/scripts/make/generate-pkg.sh @@ -3,7 +3,7 @@ version="$(grep "version : '" meson.build | awk '{ print $3 }' | sed "s/'\"//g; rm -f spmenu spmenu-${version}.tar.gz spmenu-${version}.PKGBUILD *.o *zst* mkdir -p spmenu-${version} -cp -rf LICENSE meson.build *.h *.c scripts/ docs/ libs/ PKGBUILD build.sh spmenu-${version} +cp -rf LICENSE meson.build meson.options *.h *.c scripts/ docs/ libs/ themes/ PKGBUILD build.sh spmenu-${version} [ -f buildconf ] && cp buildconf spmenu-${version} || : [ -f Makefile ] && cp Makefile spmenu-${version} || : [ -f host.mk ] && cp host.mk spmenu-${version} || :