Skip to content

Commit

Permalink
autogen: Delete gnome-autogen dependency
Browse files Browse the repository at this point in the history
You may like to call ./autogen.sh --enable-gtk-doc with your custom
configure options.
Also set SAVE_DIST_FILE=1 by default
  • Loading branch information
fujiwarat committed Dec 2, 2021
1 parent be17934 commit 2bc47f0
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 41 deletions.
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ arch:
addons:
apt:
packages:
# For autogen.sh
- gnome-common
- gtk-doc-tools
# For make from
# https://packages.ubuntu.com/search?searchon=sourcenames&keywords=ibus
- desktop-file-utils
- gobject-introspection
- gtk-doc-tools
- iso-codes
- libdconf-dev
- libgirepository1.0-dev
Expand All @@ -47,7 +45,7 @@ jobs:
before_script:
- sudo apt-get -qq update
env:
- SAVE_DIST_FILES=1
- SAVE_DIST_FILES=0
script:
- set -e
- git config pull.rebase false
Expand All @@ -56,6 +54,7 @@ jobs:
# https://salsa.debian.org/debian/ibus/-/blob/master/debian/rules
- >
./autogen.sh
--enable-gtk-doc
--with-python=/usr/bin/python3
--with-ucd-dir='/usr/share/unicode'
--enable-install-tests
Expand Down
96 changes: 65 additions & 31 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,47 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.

srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.

PKG_NAME="ibus"
DIST_FILES="
engine/simple.xml.in
src/ibusemojigen.h
src/ibusunicodegen.h
"
: ${srcdir=$(dirname $0)}
: ${srcdir:=.}
: ${SAVE_DIST_FILES:=0}

olddir=$(pwd)
# shellcheck disable=SC2016
PKG_NAME=$(autoconf --trace 'AC_INIT:$1' configure.ac)
WANT_GTK_DOC=0
GCC_VERSION=$(gcc --version | head -1 | awk '{print $3}')
GCC_MAJOR_VERSION=$(echo "$GCC_VERSION" | awk -F. '{print $1}')
FEDORA_PKG1='autoconf automake libtool gettext-devel'
FEDORA_PKG2='glib2-devel gtk2-devel gtk3-devel
wayland-devel'
FEDORA_PKG3='cldr-emoji-annotation iso-codes-devel unicode-emoji unicode-ucd
xkeyboard-config-devel'

(test -z "$DISABLE_INSTALL_PKGS") && {
CFLAGS=${CFLAGS-"-Wall -Wformat -Werror=format-security"}
(test $GCC_MAJOR_VERSION -ge 10) && {
CFLAGS="$CFLAGS -fanalyzer -fsanitize=address -fsanitize=leak"
FEDORA_PKG1="$FEDORA_PKG1 libasan"
}

cd "$srcdir"

(test -f configure.ac \
&& test -f README ) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level $PKG_NAME directory"
exit 1
}

(test $(grep -q "^GTK_DOC_CHECK" configure.ac)) || {
WANT_GTK_DOC=1
FEDORA_PKG2="$FEDORA_PKG2 gtk-doc"
}

(test -f ChangeLog) || {
touch ChangeLog
}

(test "x$DISABLE_INSTALL_PKGS" = "x") && {
(test -f /etc/fedora-release ) && {
rpm -q $FEDORA_PKG1 || exit 1
rpm -q $FEDORA_PKG2 || exit 1
Expand All @@ -27,30 +52,39 @@ FEDORA_PKG3='cldr-emoji-annotation iso-codes-devel unicode-emoji unicode-ucd
}
}

(test -f $srcdir/configure.ac \
&& test -f $srcdir/README ) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level $PKG_NAME directory"
exit 1
}

which gnome-autogen.sh || {
echo "Not found gnome-autogen.sh. You may need to install gnome-common"
exit 1
CONFIGFLAGS="$@"
(test "$#" = 0 -a "x$NOCONFIGURE" = "x" ) && {
echo "*** WARNING: I am going to run 'configure' with no arguments." >&2
echo "*** If you wish to pass any to it, please specify them on the" >&2
echo "*** '$0' command line." >&2
echo "" >&2
(test $WANT_GTK_DOC -eq 1) && CONFIGFLAGS="--enable-gtk-doc $@"
}

(test -f $srcdir/ChangeLog) || {
touch $srcdir/ChangeLog
}
(test $WANT_GTK_DOC -eq 1) && gtkdocize --copy

CFLAGS=${CFLAGS-"-Wall -Wformat -Werror=format-security"}
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4" REQUIRED_AUTOMAKE_VERSION=1.11 \
autoreconf --verbose --force --install || exit 1

# need --enable-gtk-doc for gnome-autogen.sh to make dist
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4" REQUIRED_AUTOMAKE_VERSION=1.11 CFLAGS="$CFLAGS" . gnome-autogen.sh "$@"
cd "$olddir"
(test "x$NOCONFIGURE" = "x" ) && {
echo "$srcdir/configure $CONFIGFLAGS"
$srcdir/configure $CONFIGFLAGS || exit 1
(test "$1" = "--help" ) && {
exit 0
} || {
echo "Now type 'make' to compile $PKG_NAME" || exit 1
}
} || {
echo "Skipping configure process."
}

(test -z "$SAVE_DIST_FILES") && {
for f in $DIST_FILES ; do
echo "rm $f"
rm $f
done
cd "$srcdir"
(test "x$SAVE_DIST_FILES" = "x0" ) && {
# rm engine/simple.xml.in src/ibusemojigen.h src/ibusunicodegen.h
for d in engine src; do
echo "make -C $d maintainer-clean-generic"
make -C $d maintainer-clean-generic
done
} || :
cd "$olddir"
18 changes: 12 additions & 6 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ibus - The Input Bus
#
# Copyright (c) 2007-2015 Peng Huang <shawn.p.huang@gmail.com>
# Copyright (c) 2015-2020 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright (c) 2015-2021 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright (c) 2007-2017 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
Expand Down Expand Up @@ -296,8 +296,8 @@ dicts/emoji-%.dict: emoji-parser
echo "Skip $$plus_comment $@"; \
fi;

ibusemojigen.h: dicts/emoji-en.dict
$(NULL)
ibusemojigen.h:
$(MAKE) $(AM_MAKEFLAGS) dicts/emoji-en.dict

# We put dicts/emoji-%.dict as the make target for the parallel build
# and the make target has to be genarated even if the file size is zero.
Expand Down Expand Up @@ -364,8 +364,8 @@ dicts/unicode-blocks.dict: unicode-parser
echo "Generated $@"; \
fi;

ibusunicodegen.h: dicts/unicode-blocks.dict
$(NULL)
ibusunicodegen.h:
$(MAKE) $(AM_MAKEFLAGS) dicts/unicode-blocks.dict

unicode_parser_SOURCES = \
unicode-parser.c \
Expand Down Expand Up @@ -398,9 +398,15 @@ CLEANFILES += \
stamp-ibusenumtypes.h \
$(NULL)

DISTCLEANFILES = \
MAINTAINERCLEANFILES = \
ibusemojigen.h \
ibusunicodegen.h \
dicts/emoji-en.dict \
dicts/unicode-blocks.dict \
$(NULL)

DISTCLEANFILES = \
$(MAINTAINERCLEANFILES) \
ibusversion.h \
$(NULL)

Expand Down

0 comments on commit 2bc47f0

Please sign in to comment.