From 9553dbf12ec42a58beb671a7039827fbd652e14d Mon Sep 17 00:00:00 2001 From: Izumi Tsutsui Date: Mon, 27 Mar 2023 19:45:37 +0900 Subject: [PATCH] Portability fixes for preparation of NetBSD CI - Makefile: Ignore errors on $(RM) -r "`uname -i`" - autogen: Replace make with $MAKE - data/dconf: BSD does not support the --tmpdir long option in mktemp. Also add the cleanup function. BUG=https://github.com/ibus/ibus/pull/2482 --- Makefile.am | 2 +- autogen.sh | 7 ++++--- data/dconf/make-dconf-override-db.sh | 11 ++++++++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index 17e56b382..16548d258 100644 --- a/Makefile.am +++ b/Makefile.am @@ -139,7 +139,7 @@ srpm: dist @PACKAGE_NAME@.spec @PACKAGE_NAME@.spec clean-rpm: - $(RM) -r "`uname -i`" + -$(RM) -r "`uname -i`" clean-local: clean-rpm diff --git a/autogen.sh b/autogen.sh index 9b1d83420..4ea8d757f 100755 --- a/autogen.sh +++ b/autogen.sh @@ -4,6 +4,7 @@ : ${srcdir=$(dirname $0)} : ${srcdir:=.} : ${SAVE_DIST_FILES:=0} +: ${MAKE:=make} olddir=$(pwd) # shellcheck disable=SC2016 @@ -73,7 +74,7 @@ cd "$olddir" (test "$1" = "--help" ) && { exit 0 } || { - echo "Now type 'make' to compile $PKG_NAME" || exit 1 + echo "Now type '$MAKE' to compile $PKG_NAME" || exit 1 } } || { echo "Skipping configure process." @@ -83,8 +84,8 @@ cd "$srcdir" (test "x$SAVE_DIST_FILES" = "x0" ) && { # rm engine/simple.xml.in src/ibusemojigen.h src/ibusunicodegen.h for d in engine src src/compose; do - echo "make -C $d maintainer-clean-generic" - make -C $d maintainer-clean-generic + echo "$MAKE -C $d maintainer-clean-generic" + $MAKE -C $d maintainer-clean-generic done } || : cd "$olddir" diff --git a/data/dconf/make-dconf-override-db.sh b/data/dconf/make-dconf-override-db.sh index 601c1c3fa..32cb15306 100755 --- a/data/dconf/make-dconf-override-db.sh +++ b/data/dconf/make-dconf-override-db.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -e @@ -6,7 +6,7 @@ set -e # breaks dbus-launch. There's dbus-run-session which is # better, but not everyone has it yet. export DBUS_FATAL_WARNINGS=0 -export TMPDIR=$(mktemp -d --tmpdir="$PWD") +export TMPDIR=$(mktemp -d -p "$PWD") export XDG_CONFIG_HOME="$TMPDIR/config" export XDG_CACHE_HOME="$TMPDIR/cache" export GSETTINGS_SCHEMA_DIR="$TMPDIR/schemas" @@ -14,7 +14,12 @@ mkdir -p $XDG_CONFIG_HOME $XDG_CACHE_HOME $GSETTINGS_SCHEMA_DIR eval `dbus-launch --sh-syntax` -trap 'rm -rf $TMPDIR; kill $DBUS_SESSION_BUS_PID' ERR +trap cleanup EXIT + +cleanup() { + test $? -eq 0 && exit + rm -rf $TMPDIR; kill $DBUS_SESSION_BUS_PID +} # in case that schema is not installed on the system glib-compile-schemas --targetdir "$GSETTINGS_SCHEMA_DIR" "$PWD"