diff --git a/core/getversion.sh b/core/getversion.sh index 294d292445..4d436285a3 100755 --- a/core/getversion.sh +++ b/core/getversion.sh @@ -1,7 +1,3 @@ #!/usr/bin/env bash # Get the version number from VERSION.md -# When building from a Linux source package, `VERSION.md` is in the -# same directory as this script. -VERSIONFILE=VERSION.md -[ -f ../VERSION.md ] && VERSIONFILE=../VERSION.md -cat $VERSIONFILE +cat ../VERSION.md diff --git a/linux/Makefile b/linux/Makefile index af2a83a69c..735d08b257 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -54,10 +54,8 @@ nightlydist: reconf sources check: cd keyman-config && ./run-tests.sh - cd ibus-keyman && make check + cd ibus-keyman && ./build.sh test -tmpcheck: - cd keyman-config && ./run-tests.sh - cd build-ibus-keyman && make check +tmpcheck: check tests: check diff --git a/linux/debian/ibus-keyman.postinst b/linux/debian/ibus-keyman.postinst index 57c22b8d6d..c09ded7646 100644 --- a/linux/debian/ibus-keyman.postinst +++ b/linux/debian/ibus-keyman.postinst @@ -9,8 +9,8 @@ case "$1" in if which sudo > /dev/null && which ps > /dev/null; then # check for gnome-shell as it works differently - ! gspid=`ps -C gnome-shell -o pid=|head -n 1` - if [ "x$gspid" != "x" ]; then + gspid=$(ps -C gnome-shell -o pid=|head -n 1) + if [ "$gspid" != "" ]; then # gnome-shell has multiple ibus-daemon processes and needs exit instead of restart is_gnome_shell=1 else @@ -18,17 +18,17 @@ case "$1" in fi # Restart IBus if it is running - ! ibuspid=`ps -C ibus-daemon -o pid=|head -n 1` + ibuspid=$(ps -C ibus-daemon -o pid=|head -n 1) - if [ "x$ibuspid" != "x" ]; then - if [ "x$is_gnome_shell" = "x1" ]; then - ibususers=`ps -C ibus-daemon -o user=|grep -v gdm|uniq` + if [ "$ibuspid" != "" ]; then + if [ "$is_gnome_shell" = "1" ]; then + ibususers=$(ps -C ibus-daemon -o user=|grep -v gdm|uniq) for ibususer in $ibususers; do sudo -H -u "$ibususer" ibus exit || true sleep 1s done else - ibususers=`ps -C ibus-daemon -o user=|uniq` + ibususers=$(ps -C ibus-daemon -o user=|uniq) for ibususer in $ibususers; do sudo -H -u "$ibususer" ibus restart || true sleep 1s @@ -37,13 +37,13 @@ case "$1" in fi # Verify that it's running now - if [ ! -z $SUDO_USER ] && id $SUDO_USER > /dev/null 2>/dev/null; then - ! ibusdaemon=$(ps --user $SUDO_USER -o s= -o cmd | grep --regexp="^[^ZT] ibus-daemon .*--xim.*") - if [ "x$ibusdaemon" = "x" ]; then + if [ -n "$SUDO_USER" ] && id "$SUDO_USER" > /dev/null 2>/dev/null; then + ibusdaemon=$(ps --user "$SUDO_USER" -o s= -o cmd | grep --regexp="^[^ZT] ibus-daemon .*--xim.*") + if [ "$ibusdaemon" = "" ]; then # otherwise try to start it for the user installing the package - if [ "x$is_gnome_shell" = "x1" ]; then - for session in $(loginctl show-user ${SUDO_USER} -p Sessions --value); do - case $(loginctl show-session ${session} -p Type --value) in + if [ "$is_gnome_shell" = "1" ]; then + for session in $(loginctl show-user "${SUDO_USER}" -p Sessions --value); do + case $(loginctl show-session "${session}" -p Type --value) in wayland) sudo -H -u "${SUDO_USER}" -i WAYLAND_DISPLAY=wayland-0 -- ibus-daemon -d -r --xim --panel disable;; x11) sudo -H -u "${SUDO_USER}" -- ibus-daemon -d -r --xim --panel disable;; *) ;; diff --git a/linux/debian/ibus-keyman.postrm b/linux/debian/ibus-keyman.postrm index 088e35e856..c27030a468 100644 --- a/linux/debian/ibus-keyman.postrm +++ b/linux/debian/ibus-keyman.postrm @@ -9,19 +9,18 @@ case "$1" in if which sudo > /dev/null && which ps > /dev/null; then # Restart IBus if it is running - ! ibuspid=`ps -C ibus-daemon -o pid=|head -n 1` - - if [ "x$ibuspid" != "x" ]; then + ibuspid=$(ps -C ibus-daemon -o pid=|head -n 1) + if [ "$ibuspid" != "" ]; then # check for gnome-shell as it works differently - ! gspid=`ps -C gnome-shell -o pid=|head -n 1` - if [ "x$gspid" != "x" ]; then + gspid=$(ps -C gnome-shell -o pid=|head -n 1) + if [ "$gspid" != "" ]; then # gnome-shell has multiple ibus-daemon processes and needs exit instead of restart - ibususers=`ps -C ibus-daemon -o user=|grep -v gdm|uniq` + ibususers=$(ps -C ibus-daemon -o user=|grep -v gdm|uniq) for ibususer in $ibususers; do sudo -H -u "$ibususer" ibus exit || true done else - ibususers=`ps -C ibus-daemon -o user=|uniq` + ibususers=$(ps -C ibus-daemon -o user=|uniq) for ibususer in $ibususers; do sudo -H -u "$ibususer" ibus restart || true done diff --git a/linux/debian/rules b/linux/debian/rules index 0ea917118f..9f4848c8a8 100755 --- a/linux/debian/rules +++ b/linux/debian/rules @@ -20,26 +20,25 @@ include /usr/share/dpkg/pkg-info.mk dh $@ --with-python3 override_dh_auto_configure: - # keymankeyboardprocessor + # keymankeyboardprocessor - we need to configure and build core before + # we can configure ibus-keyman! cd core && \ - ./build.sh configure -- --wrap-mode=nodownload --prefix=/usr --sysconfdir=/etc \ + ./build.sh configure build -- --wrap-mode=nodownload --prefix=/usr --sysconfdir=/etc \ --localstatedir=/var --libdir=lib/$(DEB_TARGET_MULTIARCH) \ --libexecdir=lib/$(DEB_TARGET_MULTIARCH) # ibus-keyman cd linux/ibus-keyman && \ - cp -f ../../VERSION.md VERSION && \ - export KEYMAN_PROC_CFLAGS="-I$(CURDIR)/core/build/arch/release/include -I$(CURDIR)/common/include -I$(CURDIR)/core/include" && \ - export KEYMAN_PROC_LIBS="-L$(CURDIR)/core/build/arch/release/src -lkmnkbp0" && \ - export PKG_CONFIG_PATH=$(CURDIR)/core/build/arch/release/meson-private && \ - ./autogen.sh && \ - ./configure --prefix=/usr + ./build.sh configure -- --wrap-mode=nodownload --prefix=/usr --sysconfdir=/etc \ + --localstatedir=/var # keyman-config override_dh_auto_build: # keymankeyboardprocessor - cd core && ./build.sh build + cd core && \ + ./build.sh build # ibus-keyman - cd linux/ibus-keyman && make + cd linux/ibus-keyman && \ + ./build.sh build # keyman-config cd linux/keyman-config && \ make man && \ @@ -50,19 +49,23 @@ override_dh_auto_build: override_dh_auto_test: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) # keymankeyboardprocessor - cd core && ./build.sh tests + cd core && \ + ./build.sh tests # ibus-keyman - cd linux/ibus-keyman && make check VERBOSE=1 + cd linux/ibus-keyman && \ + ./build.sh test # keyman-config dh_auto_test --sourcedir=linux/keyman-config --buildsystem=pybuild $@ endif override_dh_auto_install: - # keymankeyboardprocessor install -d $(CURDIR)/debian/tmp - cd core && DESTDIR=$(CURDIR)/debian/tmp ./build.sh install + # keymankeyboardprocessor + cd core && \ + DESTDIR=$(CURDIR)/debian/tmp ./build.sh install # ibus-keyman - cd linux/ibus-keyman && make install DESTDIR=$(CURDIR)/debian/tmp + cd linux/ibus-keyman && \ + DESTDIR=$(CURDIR)/debian/tmp ./build.sh install # keyman-config install -d $(CURDIR)/debian/keyman/usr/share/ cp -r linux/keyman-config/locale/ $(CURDIR)/debian/keyman/usr/share/ diff --git a/linux/ibus-keyman/meson.build b/linux/ibus-keyman/meson.build index 689cf5a5ec..e8548432d4 100644 --- a/linux/ibus-keyman/meson.build +++ b/linux/ibus-keyman/meson.build @@ -36,7 +36,9 @@ configure_file(output : 'config.h', core_include_dirs = [ include_directories('../../core/src'), include_directories('../../core/src/kmx'), + include_directories('../../core/include'), include_directories('../../common/include'), + include_directories('../../core/build/arch' / get_option('buildtype') / 'include'), ] subdir('icons') diff --git a/linux/ibus-keyman/tests/run-tests.sh b/linux/ibus-keyman/tests/run-tests.sh index b6ebc90ff1..022088abe4 100755 --- a/linux/ibus-keyman/tests/run-tests.sh +++ b/linux/ibus-keyman/tests/run-tests.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash -TOP_SRCDIR=${top_srcdir:-$(realpath $(dirname $0)/..)} -BASEDIR=$(realpath $(dirname $0)) +TOP_SRCDIR=${top_srcdir:-$(realpath "$(dirname "$0")/..")} TESTDIR=${XDG_DATA_HOME:-$HOME/.local/share}/keyman/test_kmx PID_FILE=/tmp/ibus-keyman-test-pids @@ -69,22 +68,22 @@ function run_tests() { echo "rm -rf ${TEMP_DATA_DIR}" >> $PID_FILE COMMON_ARCH_DIR= - [ -d ${TOP_SRCDIR}/../../core/build/arch ] && COMMON_ARCH_DIR=${TOP_SRCDIR}/../../core/build/arch - [ -d ${TOP_SRCDIR}/../keyboardprocessor/arch ] && COMMON_ARCH_DIR=${TOP_SRCDIR}/../keyboardprocessor/arch + [ -d "${TOP_SRCDIR}"/../../core/build/arch ] && COMMON_ARCH_DIR=${TOP_SRCDIR}/../../core/build/arch + [ -d "${TOP_SRCDIR}"/../keyboardprocessor/arch ] && COMMON_ARCH_DIR=${TOP_SRCDIR}/../keyboardprocessor/arch - if [ -d ${COMMON_ARCH_DIR}/release ]; then + if [ -d "${COMMON_ARCH_DIR}"/release ]; then COMMON_ARCH_DIR=${COMMON_ARCH_DIR}/release - elif [ -d ${COMMON_ARCH_DIR}/debug ]; then + elif [ -d "${COMMON_ARCH_DIR}"/debug ]; then COMMON_ARCH_DIR=${COMMON_ARCH_DIR}/debug else echo "Can't find neither ${COMMON_ARCH_DIR}/release nor ${COMMON_ARCH_DIR}/debug" exit 2 fi - if [ ! -d $TESTDIR ] || ! [[ $(ls -x ${TESTDIR}/*.kmx 2>/dev/null | wc -l) > 0 ]]; then - if [[ $(ls -x ${COMMON_ARCH_DIR}/tests/unit/kmx/*.kmx 2>/dev/null | wc -l) > 0 ]]; then - mkdir -p $(realpath --canonicalize-missing $TESTDIR/..) - ln -sf $(realpath ${COMMON_ARCH_DIR}/tests/unit/kmx) $TESTDIR + if [ ! -d "$TESTDIR" ] || ! (( $(find "${TESTDIR}" -maxdepth 1 -name \*.kmx | wc -l) > 0 )); then + if (( $(find "${COMMON_ARCH_DIR}/tests/unit/kmx" -maxdepth 1 -name \*.kmx | wc -l) > 0 )); then + mkdir -p "$(realpath --canonicalize-missing "$TESTDIR"/..)" + ln -sf "$(realpath "${COMMON_ARCH_DIR}"/tests/unit/kmx)" "$TESTDIR" else echo "Can't find kmx files in ${COMMON_ARCH_DIR}/tests/unit/kmx" exit 3 @@ -103,11 +102,12 @@ function run_tests() { echo "Running on Wayland..." TMPFILE=$(mktemp) # mutter-Message: 18:56:15.422: Using Wayland display name 'wayland-1' - mutter --wayland --headless --no-x11 --virtual-monitor 1024x768 &> $TMPFILE & + mutter --wayland --headless --no-x11 --virtual-monitor 1024x768 &> "$TMPFILE" & echo "kill -9 $!" >> $PID_FILE sleep 1s - export WAYLAND_DISPLAY=$(cat $TMPFILE | grep "Using Wayland display" | cut -d"'" -f2) - rm $TMPFILE + WAYLAND_DISPLAY=$(cat "$TMPFILE" | grep "Using Wayland display" | cut -d"'" -f2) + export WAYLAND_DISPLAY + rm "$TMPFILE" else echo "Starting Xvfb..." Xvfb -screen 0 1024x768x24 :33 &> /dev/null & @@ -128,16 +128,16 @@ function run_tests() { SCHEMA_DIR=$TEMP_DATA_DIR/glib-2.0/schemas export XDG_DATA_DIRS=$TEMP_DATA_DIR:$XDG_DATA_DIRS - mkdir -p $SCHEMA_DIR - cp ${TOP_SRCDIR}/../keyman-config/com.keyman.gschema.xml $SCHEMA_DIR/ - glib-compile-schemas $SCHEMA_DIR + mkdir -p "$SCHEMA_DIR" + cp "${TOP_SRCDIR}/../keyman-config/com.keyman.gschema.xml" "$SCHEMA_DIR"/ + glib-compile-schemas "$SCHEMA_DIR" if [ $# -gt 0 ]; then TESTFILES=($@) else - pushd $TESTDIR > /dev/null + pushd "$TESTDIR" > /dev/null || exit TESTFILES=(*.kmx) - popd > /dev/null + popd > /dev/null || exit fi export LD_LIBRARY_PATH=${COMMON_ARCH_DIR}/src:$LD_LIBRARY_PATH @@ -150,16 +150,19 @@ function run_tests() { IBUS_CONFIG=--config=/usr/libexec/ibus-memconf fi + # shellcheck disable=SC2086 ibus-daemon ${ARG_VERBOSE-} --panel=disable ${IBUS_CONFIG-} &> /tmp/ibus-daemon.log & echo "kill -9 $!" >> $PID_FILE sleep 1s + # shellcheck disable=SC2086 ../src/ibus-engine-keyman ${ARG_VERBOSE-} &> /tmp/ibus-engine-keyman.log & echo "kill -9 $!" >> $PID_FILE sleep 1s echo "Starting tests..." # Note: -k and --tap are consumed by the GLib testing framework + # shellcheck disable=SC2086 ./ibus-keyman-tests ${ARG_K-} ${ARG_TAP-} ${ARG_VERBOSE-} ${ARG_DEBUG-} \ ${ARG_SURROUNDING_TEXT-} ${ARG_NO_SURROUNDING_TEXT-} \ --directory $TESTDIR --${DISPLAY_SERVER} "${TESTFILES[@]}" @@ -198,7 +201,7 @@ if ! can_run_wayland; then fi fi -if [ "$USE_WAYLAND" == "0" -a "$USE_X11" == "0" ]; then +if [ "$USE_WAYLAND" == "0" ] && [ "$USE_X11" == "0" ]; then echo "ERROR: I'll have to run somewhere. Specifying both --no-wayland and --no-x11 is not allowed." exit 6 fi diff --git a/linux/keyman-config/Makefile b/linux/keyman-config/Makefile index e539765069..b18b1f133d 100644 --- a/linux/keyman-config/Makefile +++ b/linux/keyman-config/Makefile @@ -59,7 +59,7 @@ man: ./build-help.sh --man --no-reconf version_reconf: - cd .. && ./scripts/reconf.sh keyman-config + cd .. && ./scripts/reconf.sh version: version_reconf $(eval VERSION := $(shell python3 -c "from keyman_config import __releaseversion__; print(__releaseversion__)")) diff --git a/linux/keyman-config/build-help.sh b/linux/keyman-config/build-help.sh index e525fdbb76..a326fcfffc 100755 --- a/linux/keyman-config/build-help.sh +++ b/linux/keyman-config/build-help.sh @@ -57,7 +57,7 @@ fi if [ -n "$reconfigure" ]; then pushd $THIS_DIR/.. > /dev/null - ./scripts/reconf.sh keyman-config + ./scripts/reconf.sh popd > /dev/null fi diff --git a/linux/scripts/build.sh b/linux/scripts/build.sh index e8770b888f..7aa9dab9e8 100755 --- a/linux/scripts/build.sh +++ b/linux/scripts/build.sh @@ -13,80 +13,36 @@ INSTALLDIR=${INSTALLDIR:-"/usr/local"} CONFIGUREONLY=${CONFIGUREONLY:="no"} BUILDONLY=${BUILDONLY:="no"} -projects="ibus-keyman" - if [[ "${CONFIGUREONLY}" != "no" && "${BUILDONLY}" != "no" ]]; then echo "Only use one of CONFIGUREONLY and BUILDONLY" exit 1 fi if [[ "${BUILDONLY}" == "no" ]]; then + cd "$BASEDIR" ../core/build.sh -t keyboardprocessor configure cd keyboardprocessor/arch/release echo "reconfiguring keyboardprocessor meson with prefix ${INSTALLDIR}" meson configure -Dprefix="${INSTALLDIR}" && ninja reconfigure + + # We need to build core first before we can configure ibus-keyman! cd "$BASEDIR" + ../core/build.sh -t keyboardprocessor build + + cd "$BASEDIR/ibus-keyman" + ./build.sh clean configure -- --prefix="${INSTALLDIR}" fi if [[ "${CONFIGUREONLY}" == "no" ]]; then echo "building keyboardprocessor" + cd "$BASEDIR" # May 2021: For now, running tests here as well. We could move this elsewhere # in the future if we want to split out the tests, but they run in a couple of seconds # at present. ../core/build.sh -t keyboardprocessor build tests -fi - -function buildproject() { - local proj=$1 - local subdir=$2 - - echo "buildproject: proj=$proj, subdir=$subdir; pwd=$(pwd)" - if [ ! -f "${subdir}${proj}/configure" ]; then - echo "$proj is not set up with autoreconf. First run 'make reconf' or 'make devreconf'" - exit 1 - fi - if [[ "${BUILDONLY}" == "no" ]]; then - rm -rf "build-$proj" - fi - mkdir -p "build-$proj" - cd "build-$proj" - if [[ "${BUILDONLY}" == "no" ]]; then - echo "Configuring $proj" - if [[ "${INSTALLDIR}" == "/tmp/keyman" ]]; then # don't install ibus-keyman into ibus - "../${subdir}$proj/configure" KEYMAN_PROC_CFLAGS="-I\$(top_builddir)/../keyboardprocessor/arch/release/include -I\$(top_builddir)/../../common/include -I\$(top_builddir)/../../core/include" \ - CPPFLAGS="-I\$(top_builddir)/../build-keymancomp -I\$(top_builddir)/../build-libkeyman" \ - KEYMAN_PROC_LIBS="-L$(pwd)/../build-libkeyman/src -L$(pwd)/../keyboardprocessor/arch/release/src -lkmnkbp0" \ - LDFLAGS="-L$(pwd)/../build-keymancomp/src -L$(pwd)/../build-libkeyman/src" --prefix="${INSTALLDIR}" --libexecdir="${INSTALLDIR}/lib/ibus" - else # install ibus-keyman into ibus - "../${subdir}$proj/configure" KEYMAN_PROC_CFLAGS="-I\$(top_builddir)/../keyboardprocessor/arch/release/include -I\$(top_builddir)/../../common/include -I\$(top_builddir)/../../core/include" \ - CPPFLAGS="-I\$(top_builddir)/../build-keymancomp -I\$(top_builddir)/../build-libkeyman" \ - LDFLAGS="-L$(pwd)/../build-keymancomp/src -L$(pwd)/../build-libkeyman/src" \ - KEYMAN_PROC_LIBS="-L$(pwd)/../build-libkeyman/src -L$(pwd)/../keyboardprocessor/arch/release/src -lkmnkbp0" \ - --prefix="${INSTALLDIR}" --libexecdir="${INSTALLDIR}/lib/ibus" --datadir=/usr/share - fi - fi - if [[ "${CONFIGUREONLY}" == "no" ]]; then - if [ ! -f config.h ]; then - echo "$proj has not been configured before building. First run 'make configure'" - exit 1 - fi - echo "Building $proj" - make - fi - cd "$BASEDIR" -} - -for proj in $projects; do - buildproject $proj -done - -if [[ "${CONFIGUREONLY}" == "no" ]]; then - cd keyman-config - if [ ! -f keyman_config/version.py ]; then - echo "The version of keyman-config has not been configured before building. First run 'make reconf'" - fi - make clean - make - cd "$BASEDIR" + + echo "building ibus-keyman" + cd "$BASEDIR/ibus-keyman" + ./build.sh build fi diff --git a/linux/scripts/cow.sh b/linux/scripts/cow.sh index 069811049d..6e3e778685 100755 --- a/linux/scripts/cow.sh +++ b/linux/scripts/cow.sh @@ -5,9 +5,7 @@ distributions='focal jammy kinetic' -dpkgcheck=$(dpkg-query -l cowbuilder) -if [ $? != 0 ]; then - +if ! dpkg-query -l cowbuilder; then echo "installing pbuilder and cowbuilder" sudo apt install pbuilder cowbuilder else @@ -26,27 +24,27 @@ else fi for dist in $distributions; do - sudo mkdir -p /var/cache/pbuilder/result/${dist} - if [ ! -e /var/cache/pbuilder/result/${dist}/Packages ]; then - sudo touch /var/cache/pbuilder/result/${dist}/Packages + sudo mkdir -p /var/cache/pbuilder/result/"${dist}" + if [ ! -e /var/cache/pbuilder/result/"${dist}"/Packages ]; then + sudo touch /var/cache/pbuilder/result/"${dist}"/Packages fi - sudo mkdir -p /var/cache/pbuilder/hook.d/${dist} - if [ ! -e /var/cache/pbuilder/hook.d/${dist}/D70results ]; then - echo "#!/bin/bash" | sudo tee /var/cache/pbuilder/hook.d/${dist}/D70results - echo "cd /var/cache/pbuilder/result/${dist}" | sudo tee -a /var/cache/pbuilder/hook.d/${dist}/D70results - echo "/usr/bin/dpkg-scanpackages . /dev/null > /var/cache/pbuilder/result/${dist}/Packages" | sudo tee -a /var/cache/pbuilder/hook.d/${dist}/D70results - echo "/usr/bin/apt-get update" | sudo tee -a /var/cache/pbuilder/hook.d/${dist}/D70results - sudo chmod +x /var/cache/pbuilder/hook.d/${dist}/D70results - sudo ln -s /var/cache/pbuilder/hook.d/${dist}/D70results /var/cache/pbuilder/hook.d/${dist}/I70buildresults + sudo mkdir -p /var/cache/pbuilder/hook.d/"${dist}" + if [ ! -e /var/cache/pbuilder/hook.d/"${dist}"/D70results ]; then + echo "#!/bin/bash" | sudo tee /var/cache/pbuilder/hook.d/"${dist}"/D70results + echo "cd /var/cache/pbuilder/result/${dist}" | sudo tee -a /var/cache/pbuilder/hook.d/"${dist}"/D70results + echo "/usr/bin/dpkg-scanpackages . /dev/null > /var/cache/pbuilder/result/${dist}/Packages" | sudo tee -a /var/cache/pbuilder/hook.d/"${dist}"/D70results + echo "/usr/bin/apt-get update" | sudo tee -a /var/cache/pbuilder/hook.d/"${dist}"/D70results + sudo chmod +x /var/cache/pbuilder/hook.d/"${dist}"/D70results + sudo ln -s /var/cache/pbuilder/hook.d/"${dist}"/D70results /var/cache/pbuilder/hook.d/"${dist}"/I70buildresults fi - if [ ! -e /var/cache/pbuilder/hook.d/${dist}/D80no-man-db-rebuild ]; then - sudo ln -s /usr/share/doc/pbuilder/examples/D80no-man-db-rebuild /var/cache/pbuilder/hook.d/${dist}/D80no-man-db-rebuild + if [ ! -e /var/cache/pbuilder/hook.d/"${dist}"/D80no-man-db-rebuild ]; then + sudo ln -s /usr/share/doc/pbuilder/examples/D80no-man-db-rebuild /var/cache/pbuilder/hook.d/"${dist}"/D80no-man-db-rebuild fi - if [ ! -d /var/cache/pbuilder/base-${dist}.cow ]; then + if [ ! -d /var/cache/pbuilder/base-"${dist}".cow ]; then echo "making ${dist} cowbuilder" - sudo DIST=${dist} cowbuilder --create --distribution ${dist} --basepath /var/cache/pbuilder/base-${dist}.cow --hookdir /var/cache/pbuilder/hook.d/${dist} + sudo DIST="${dist}" cowbuilder --create --distribution "${dist}" --basepath /var/cache/pbuilder/base-"${dist}".cow --hookdir /var/cache/pbuilder/hook.d/"${dist}" else echo "already have ${dist} cowbuilder" fi - sudo DIST=${dist} cowbuilder --update --distribution ${dist} --basepath /var/cache/pbuilder/base-${dist}.cow --override-config --othermirror="deb [trusted=yes] file:/var/cache/pbuilder/result/${dist} ./" --bindmounts /var/cache/pbuilder/result/${dist} --hookdir /var/cache/pbuilder/hook.d/${dist} + sudo DIST="${dist}" cowbuilder --update --distribution "${dist}" --basepath /var/cache/pbuilder/base-"${dist}".cow --override-config --othermirror="deb [trusted=yes] file:/var/cache/pbuilder/result/${dist} ./" --bindmounts /var/cache/pbuilder/result/"${dist}" --hookdir /var/cache/pbuilder/hook.d/"${dist}" done diff --git a/linux/scripts/deb-packaging.sh b/linux/scripts/deb-packaging.sh index 35416cc370..85fb3ff5c2 100755 --- a/linux/scripts/deb-packaging.sh +++ b/linux/scripts/deb-packaging.sh @@ -38,15 +38,15 @@ if builder_start_action source; then echo "${START_STEP}Make source package for keyman${COLOR_RESET}" echo "${START_STEP}reconfigure${COLOR_RESET}" - ./scripts/reconf.sh keyman + ./scripts/reconf.sh echo "${END_STEP}" echo "${START_STEP}Make origdist${COLOR_RESET}" - ./scripts/dist.sh origdist keyman + ./scripts/dist.sh origdist echo "${END_STEP}" echo "${START_STEP}Make deb source${COLOR_RESET}" - ./scripts/deb.sh sourcepackage keyman + ./scripts/deb.sh sourcepackage echo "${END_STEP}" mv builddebs/* "${OUTPUT_PATH:-..}" diff --git a/linux/scripts/deb.sh b/linux/scripts/deb.sh index f35d9e6a85..f858cc04d4 100755 --- a/linux/scripts/deb.sh +++ b/linux/scripts/deb.sh @@ -5,75 +5,40 @@ # It must be run from the keyman/linux directory -# parameters: ./deb.sh [sourcepackage] [proj] [dist] +# parameters: ./deb.sh [sourcepackage] [dist] # sourcepackage = only create Debian source package -# proj = only build for this project # dist = only build for this distribution set -e -all_distributions="focal" +all_distributions="focal jammy" distributions="" -all_projects="keyman" -projects="" echo "all_distributions: ${all_distributions}" -echo "all_projects: ${all_projects}" if [ "$1" == "sourcepackage" ]; then - if [ "$2" != "" ]; then - for proj in ${all_projects}; do - if [ "${proj}" == "$2" ]; then - projects="$2" - fi - done - if [ "${projects}" == "" ]; then - echo "project $2 does not exist" - exit 1 - fi - fi + only_sourcepackage=true + shift else - if [ "$1" != "" ]; then - for proj in ${all_projects}; do - if [ "${proj}" == "$1" ]; then - projects="$1" - fi - done - if [ "${projects}" == "" ]; then - for dist in ${all_distributions}; do - if [ "${dist}" == "$1" ]; then - distributions="$1" - projects="${all_projects}" - fi - done - if [ "${distributions}" == "" ]; then - echo "project or distribution $1 does not exist" - exit 1 - fi - else - if [ "$2" != "" ]; then - for dist in ${all_distributions}; do - if [ "${dist}" == "$2" ]; then - distributions="$2" - fi - done - if [ "${distributions}" == "" ]; then - echo "project or distribution $1 does not exist" - exit 1 - fi - fi + only_sourcepackage=false +fi + +if [ "$1" != "" ]; then + for dist in ${all_distributions}; do + if [ "${dist}" == "$1" ]; then + distributions="$1" fi + done + if [ "${distributions}" == "" ]; then + echo "distribution $1 does not exist" + exit 1 fi fi -if [ "${projects}" == "" ]; then - projects="${all_projects}" -fi if [ "${distributions}" == "" ]; then distributions="${all_distributions}" fi echo "distributions: ${distributions}" -echo "projects: ${projects}" BASEDIR=$(pwd) #echo "basedir is $BASEDIR" @@ -82,42 +47,36 @@ mkdir -p builddebs # make the source packages cd builddebs -for proj in ${projects}; do - vers=$(ls ../dist/${proj}_*.orig.tar.gz) - #echo "vers1:${vers}" - vers=${vers##*_} - #echo "vers2:${vers}" - vers=${vers%*.orig.tar.gz} - #echo "vers3:${vers}" - cp -a "../dist/${proj}_${vers}.orig.tar.gz" . - tar xfz "${proj}_${vers}.orig.tar.gz" - if [ "keyman" == "$proj" ]; then - cp -a ../../debian "${proj}-${vers}" - fi - cd "${proj}-${vers}" - dch -v "${vers}-1" "local build" - echo "${proj}-${vers}" - debuild -d -S -sa -Zxz -us -uc - cd "$BASEDIR/builddebs" - rm -rf "${proj}-${vers}" -done +vers=$(ls ../dist/keyman_*.orig.tar.gz) +#echo "vers1:${vers}" +vers=${vers##*_} +#echo "vers2:${vers}" +vers=${vers%*.orig.tar.gz} +#echo "vers3:${vers}" +cp -a "../dist/keyman_${vers}.orig.tar.gz" . +tar xfz "keyman_${vers}.orig.tar.gz" +cp -a ../../debian "keyman-${vers}" +cd "keyman-${vers}" +dch -v "${vers}-1" "local build" +echo "keyman-${vers}" +debuild -d -S -sa -Zxz -us -uc +cd "$BASEDIR/builddebs" +rm -rf "keyman-${vers}" cd "$BASEDIR" -if [ "$1" == "sourcepackage" ]; then +if $only_sourcepackage; then exit 0 fi # build the packages with cowbuilder from the source package -for proj in ${projects}; do - cd builddebs - echo "$proj version ${vers}" - rm -rf "${proj}-${vers}" - dpkg-source -x "${proj}_${vers}-1.dsc" - cd "${proj}-${vers}" - for dist in ${distributions}; do - dch -v "${vers}-1+${dist}" "local build for ${dist}" - echo "dist: $dist" - DIST=${dist} pdebuild --pbuilder cowbuilder --buildresult /var/cache/pbuilder/result/${dist} -- --basepath /var/cache/pbuilder/base-${dist}.cow --distribution ${dist} --override-config --othermirror="deb [trusted=yes] file:/var/cache/pbuilder/result/${dist} ./" --bindmounts /var/cache/pbuilder/result/${dist} --hookdir /var/cache/pbuilder/hook.d/${dist} - done - cd "${BASEDIR}" +cd builddebs +echo "keyman version ${vers}" +rm -rf "keyman-${vers}" +dpkg-source -x "keyman_${vers}-1.dsc" +cd "keyman-${vers}" +for dist in ${distributions}; do + dch -v "${vers}-1+${dist}" "local build for ${dist}" + echo "dist: $dist" + DIST=${dist} pdebuild --pbuilder cowbuilder --buildresult /var/cache/pbuilder/result/"${dist}" -- --basepath /var/cache/pbuilder/base-"${dist}".cow --distribution "${dist}" --override-config --othermirror="deb [trusted=yes] file:/var/cache/pbuilder/result/${dist} ./" --bindmounts /var/cache/pbuilder/result/"${dist}" --hookdir /var/cache/pbuilder/hook.d/"${dist}" done +cd "${BASEDIR}" diff --git a/linux/scripts/dist.sh b/linux/scripts/dist.sh index 056bf44aaa..9c96252df7 100755 --- a/linux/scripts/dist.sh +++ b/linux/scripts/dist.sh @@ -16,56 +16,41 @@ THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BA ## END STANDARD BUILD SCRIPT INCLUDE BASEDIR=$(pwd) -extra_projects="keyman" if [ "$1" == "origdist" ]; then create_origdist=1 shift fi -if [ "$1" != "" ]; then - echo "$1" - if [ "$1" == "keyman" ]; then - extra_projects="$1" - else - echo "project $1 does not exist" - exit 1 - fi -fi - rm -rf dist mkdir -p dist -# configure and make dist for autotool projects -for proj in ${extra_projects}; do - # dist for keyman - cp -a debian ../ - cd .. - echo "3.0 (native)" > debian/source/format - dch keyman --newversion "${VERSION}" --force-bad-version --nomultimaint - dpkg-source --tar-ignore=*~ --tar-ignore=.git --tar-ignore=.gitattributes \ - --tar-ignore=.gitignore --tar-ignore=experiments --tar-ignore=debian \ - --tar-ignore=.github --tar-ignore=.vscode --tar-ignore=android \ - --tar-ignore=common/models --tar-ignore=common/predictive-text \ - --tar-ignore=common/resources --tar-ignore=common/schemas \ - --tar-ignore=common/test --tar-ignore=common/web --tar-ignore=common/windows \ - --tar-ignore=developer --tar-ignore=docs --tar-ignore=ios \ - --tar-ignore=linux/keyman-config/buildtools/build-langtags.py --tar-ignore=__pycache__ \ - --tar-ignore=linux/help --tar-ignore=linux/Jenkinsfile \ - --tar-ignore=linux/keyboardprocessor \ - --tar-ignore=mac --tar-ignore=node_modules --tar-ignore=oem \ - --tar-ignore=linux/build* --tar-ignore=core/build \ - --tar-ignore=resources/devbox --tar-ignore=resources/git-hooks \ - --tar-ignore=resources/scopes \ - --tar-ignore=resources/build/*.lua --tar-ignore=resources/build/jq* \ - --tar-ignore=resources/build/vswhere* --tar-ignore=results \ - --tar-ignore=web --tar-ignore=windows --tar-ignore=keyman_1* \ - --tar-ignore=dist --tar-ignore=.pbuilderrc --tar-ignore=VERSION \ - --tar-ignore=scripts -Zgzip -b . - mv ../keyman_"${VERSION}".tar.gz linux/dist/keyman-"${VERSION}".tar.gz - echo "3.0 (quilt)" > debian/source/format - cd "$BASEDIR" -done +# dist for keyman +cp -a debian ../ +cd .. +echo "3.0 (native)" > debian/source/format +dch keyman --newversion "${VERSION}" --force-bad-version --nomultimaint +dpkg-source --tar-ignore=*~ --tar-ignore=.git --tar-ignore=.gitattributes \ + --tar-ignore=.gitignore --tar-ignore=experiments --tar-ignore=debian \ + --tar-ignore=.github --tar-ignore=.vscode --tar-ignore=android \ + --tar-ignore=common/models --tar-ignore=common/predictive-text \ + --tar-ignore=common/resources --tar-ignore=common/schemas \ + --tar-ignore=common/test --tar-ignore=common/web --tar-ignore=common/windows \ + --tar-ignore=developer --tar-ignore=docs --tar-ignore=ios \ + --tar-ignore=linux/keyman-config/buildtools/build-langtags.py --tar-ignore=__pycache__ \ + --tar-ignore=linux/help --tar-ignore=linux/Jenkinsfile \ + --tar-ignore=linux/keyboardprocessor \ + --tar-ignore=mac --tar-ignore=node_modules --tar-ignore=oem \ + --tar-ignore=linux/build --tar-ignore=core/build \ + --tar-ignore=resources/devbox --tar-ignore=resources/git-hooks \ + --tar-ignore=resources/scopes \ + --tar-ignore=resources/build/*.lua --tar-ignore=resources/build/jq* \ + --tar-ignore=resources/build/vswhere* --tar-ignore=results \ + --tar-ignore=web --tar-ignore=windows --tar-ignore=keyman_1* \ + --tar-ignore=dist --tar-ignore=.pbuilderrc --tar-ignore=VERSION -Zgzip -b . +mv ../keyman_"${VERSION}".tar.gz linux/dist/keyman-"${VERSION}".tar.gz +echo "3.0 (quilt)" > debian/source/format +cd "$BASEDIR" # create orig.tar.gz if [ -n "$create_origdist" ]; then diff --git a/linux/scripts/install.sh b/linux/scripts/install.sh index 081f44e93f..3883304327 100755 --- a/linux/scripts/install.sh +++ b/linux/scripts/install.sh @@ -35,21 +35,13 @@ cd keyboardprocessor/arch/release ninja install cd "$BASEDIR" -cd build-ibus-keyman +cd ibus-keyman if [[ "${SUDOINSTALL}" == "uninstall" ]]; then - if [ ! -f Makefile ]; then - echo "ibus-keyman must be configured before it is uninstalled. First run 'make configure'" - exit 1 - fi echo "doing make uninstall of ibus-keyman" - make uninstall + ./build.sh uninstall else - if [ ! -f Makefile ]; then - echo "ibus-keyman must be configured and built before it is installed. First run 'make' or 'make tmpinstall'" - exit 1 - fi echo "doing make install of ibus-keyman" - make install + ./build.sh install fi cd "$BASEDIR" diff --git a/linux/scripts/jenkins.sh b/linux/scripts/jenkins.sh index edac87d30f..fe80138b61 100755 --- a/linux/scripts/jenkins.sh +++ b/linux/scripts/jenkins.sh @@ -13,8 +13,6 @@ THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BA . "$KEYMAN_ROOT/resources/shellHelperFunctions.sh" -keyman_projects="keyman" - tier="stable" if [[ "$1" =~ "-alpha" ]]; then @@ -70,12 +68,12 @@ rm -rf "$sourcedir/../${1}"_*.{dsc,build,buildinfo,changes,tar.?z,log} echo_heading "Make source package for $fullsourcename" echo_heading "reconfigure" -TIER="$tier" ./scripts/reconf.sh $sourcename +TIER="$tier" ./scripts/reconf.sh echo_heading "Make origdist" -./scripts/dist.sh origdist $sourcename +./scripts/dist.sh origdist echo_heading "Make deb source" -./scripts/deb.sh sourcepackage "$proj" +./scripts/deb.sh sourcepackage #sign source package for file in builddebs/*.dsc; do @@ -83,9 +81,4 @@ for file in builddebs/*.dsc; do debsign -k"$2" "$file" done -if [ "$proj" == "keyman" ]; then - mv builddebs/* .. -else - mkdir -p "$sourcedir" - mv builddebs/* "$sourcedir" -fi +mv builddebs/* .. diff --git a/linux/scripts/launchpad.sh b/linux/scripts/launchpad.sh index 8667023e49..8fb316f6b1 100755 --- a/linux/scripts/launchpad.sh +++ b/linux/scripts/launchpad.sh @@ -37,13 +37,13 @@ else fi echo "ppa: ${ppa}" -if [ "${DIST}" != "" ]; then +if [ "${DIST:-}" != "" ]; then distributions="${DIST}" else distributions="focal jammy kinetic" fi -if [ "${PACKAGEVERSION}" != "" ]; then +if [ "${PACKAGEVERSION:-}" != "" ]; then packageversion="${PACKAGEVERSION}" else packageversion="1~sil1" @@ -58,18 +58,18 @@ mkdir -p launchpad for proj in ${projects}; do downloadSource launchpad - cd ${proj}-${version} - echo $(pwd) + cd "${proj}-${version}" + pwd cp debian/changelog ../${proj}-changelog for dist in ${distributions}; do cp ../${proj}-changelog debian/changelog - dch -v ${version}-${packageversion}~${dist} "source package for PPA" - dch -D ${dist} -r "" + dch -v "${version}-${packageversion}~${dist}" "source package for PPA" + dch -D "${dist}" -r "" debuild -d -S -sa -Zxz done cd .. for dist in ${distributions}; do - dput ${SIM} ${ppa} ${proj}_${version}-${packageversion}~${dist}_source.changes + dput ${SIM} ${ppa} "${proj}_${version}-${packageversion}~${dist}_source.changes" done - cd ${BASEDIR} + cd "${BASEDIR}" done diff --git a/linux/scripts/reconf.sh b/linux/scripts/reconf.sh index 858b0e2484..d37c13d7eb 100755 --- a/linux/scripts/reconf.sh +++ b/linux/scripts/reconf.sh @@ -1,10 +1,5 @@ #!/bin/bash -# autoreconf autotool projects - -# parameters: ./reconf.sh [proj] -# proj = only reconf this project - set -e ## START STANDARD BUILD SCRIPT INCLUDE @@ -15,64 +10,29 @@ THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BA BASEDIR="$KEYMAN_ROOT/linux" echo "basedir is $BASEDIR" -autotool_projects="ibus-keyman" -extra_projects="keyboardprocessor keyman-config" - -if [ "$1" != "" ]; then - if [ "$1" == "keyman" ]; then - echo "reconfiguring only keyman" - extra_projects="keyman" - autotool_projects="" - elif [ "$1" == "keyboardprocessor" ]; then - echo "reconfiguring only keyboardprocessor" - extra_projects="keyboardprocessor" - autotool_projects="" - elif [ "$1" == "keyman-config" ]; then - echo "reconfiguring only keyman-config" - extra_projects="keyman-config" - autotool_projects="" - elif [ -d "$1" ]; then - echo "reconfiguring only $1" - extra_projects="" - autotool_projects="$1" - else - echo "project $1 does not exist" - exit 1 - fi -fi echo "Found tier ${TIER}, version ${VERSION}" -# autoreconf the projects -for proj in ${autotool_projects}; do - cd "$proj" - echo "Reconfiguring $proj to version ${VERSION}" - autoreconf -if - rm -rf autom4te.cache - cd "$BASEDIR" -done +# We need to configure+build core before we can configure ibus-keyman +cd ../core +./build.sh clean configure build -for proj in ${extra_projects}; do - if [ "${proj}" == "keyboardprocessor" ] || [ "${proj}" == "keyman" ]; then - rm -rf keyboardprocessor - cp ../VERSION.md ../core/ - ../core/build.sh -t keyboardprocessor configure - fi - if [ "${proj}" == "keyman-config" ] || [ "${proj}" == "keyman" ]; then - cd keyman-config - make clean - cd keyman_config - sed \ - -e "s/_VERSION_/${VERSION}/g" \ - -e "s/_VERSIONWITHTAG_/${VERSION_WITH_TAG}/g" \ - -e "s/_VERSIONGITTAG_/${VERSION_GIT_TAG}/g" \ - -e "s/_MAJORVERSION_/${VERSION_MAJOR}/g" \ - -e "s/_RELEASEVERSION_/${VERSION_RELEASE}/g" \ - -e "s/_TIER_/${TIER}/g" \ - -e "s/_ENVIRONMENT_/${VERSION_ENVIRONMENT}/g" \ - -e "s/_UPLOADSENTRY_/${UPLOAD_SENTRY}/g" \ - version.py.in > version.py - cd ../buildtools && python3 ./build-langtags.py - fi - cd "$BASEDIR" -done +cd "$BASEDIR/ibus-keyman" +./build.sh clean configure + +cd "$BASEDIR/keyman-config" +make clean + +cd keyman_config +sed \ + -e "s/_VERSION_/${VERSION}/g" \ + -e "s/_VERSIONWITHTAG_/${VERSION_WITH_TAG}/g" \ + -e "s/_VERSIONGITTAG_/${VERSION_GIT_TAG}/g" \ + -e "s/_MAJORVERSION_/${VERSION_MAJOR}/g" \ + -e "s/_RELEASEVERSION_/${VERSION_RELEASE}/g" \ + -e "s/_TIER_/${TIER}/g" \ + -e "s/_ENVIRONMENT_/${VERSION_ENVIRONMENT}/g" \ + -e "s/_UPLOADSENTRY_/${UPLOAD_SENTRY}/g" \ + version.py.in > version.py +cd ../buildtools && python3 ./build-langtags.py +cd "$BASEDIR"