Merge pull request #1180 from keymanapp/linux-buildsys

[linux] Linux buildsys
This commit is contained in:
Daniel Glassey 2018-09-17 16:54:08 +07:00 • committed by GitHub
commit 1eb0fd411e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 588 additions and 52 deletions

10
.gitignore vendored
View file

@ -254,6 +254,16 @@ ltsugar.m4
ltversion.m4
lt~obsolete.m4
libtool.m4
__pycache__
*.egg-info
build-*
deb-*
builddebs
make_deb
tmp/
dist/
*~
linux/keyman-config/debian/man
.DS_Store

80
linux/.pbuilderrc Normal file
View file

@ -0,0 +1,80 @@
PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-gdebi"
PDEBUILD_PBUILDER="cowbuilder"
# Codenames for Debian suites according to their alias. Update these when
# needed.
UNSTABLE_CODENAME="sid"
TESTING_CODENAME="buster"
STABLE_CODENAME="stretch"
STABLE_BACKPORTS_SUITE="$STABLE_CODENAME-backports"
OLDSTABLE_CODENAME="jessie"
# List of Debian suites.
DEBIAN_SUITES=($UNSTABLE_CODENAME $TESTING_CODENAME $STABLE_CODENAME $STABLE_BACKPORTS_SUITE $OLDSTABLE_CODENAME
"experimental" "unstable" "testing" "stable")
# List of Ubuntu suites. Update these when needed.
UBUNTU_SUITES=("cosmic" "bionic" "xenial" "trusty")
# Mirrors to use. Update these to your preferred mirror.
DEBIAN_MIRROR="deb.debian.org"
UBUNTU_MIRROR="th.archive.ubuntu.com"
# Optionally use the changelog of a package to determine the suite to use if
# none set.
if [ -z "${DIST}" ] && [ -r "debian/changelog" ]; then
DIST=$(dpkg-parsechangelog --show-field=Distribution)
fi
# Optionally set a default distribution if none is used. Note that you can set
# your own default (i.e. ${DIST:="unstable"}).
: ${DIST:="$(lsb_release --short --codename)"}
# Optionally change Debian codenames in $DIST to their aliases.
#case "$DIST" in
# $UNSTABLE_CODENAME)
# DIST="unstable"
# ;;
# $TESTING_CODENAME)
# DIST="testing"
# ;;
# $STABLE_CODENAME)
# DIST="stable"
# ;;
#esac
# Optionally set the architecture to the host architecture if none set. Note
# that you can set your own default (i.e. ${ARCH:="i386"}).
#: ${ARCH:="$(dpkg --print-architecture)"}
NAME="$DIST"
if [ -n "${ARCH}" ]; then
NAME="$NAME-$ARCH"
DEBOOTSTRAPOPTS=("--arch" "$ARCH" "${DEBOOTSTRAPOPTS[@]}")
fi
#BASETGZ="/var/cache/pbuilder/$NAME-base.tgz"
BASEPATH=/var/cache/pbuilder/base-$NAME.cow
DISTRIBUTION="$DIST"
BUILDRESULT="/var/cache/pbuilder/result/$NAME/"
APTCACHE="/var/cache/pbuilder/aptcache/$NAME/"
BUILDPLACE="/var/cache/pbuilder/build/"
HOOKDIR="/var/cache/pbuilder/hook.d/$NAME/"
OTHERMIRROR="deb [trusted=yes] file:/var/cache/pbuilder/result/$NAME ./ "
BINDMOUNTS="/var/cache/pbuilder/result/$NAME"
if $(echo ${DEBIAN_SUITES[@]} | grep -q $DIST); then
# Debian configuration
MIRRORSITE="http://$DEBIAN_MIRROR/debian/"
COMPONENTS="main contrib non-free"
if $(echo "$STABLE_CODENAME stable" | grep -q $DIST); then
OTHERMIRROR="$OTHERMIRROR | deb $MIRRORSITE $STABLE_BACKPORTS_SUITE $COMPONENTS"
fi
elif $(echo ${UBUNTU_SUITES[@]} | grep -q $DIST); then
# Ubuntu configuration
MIRRORSITE="http://$UBUNTU_MIRROR/ubuntu/"
COMPONENTS="main restricted universe multiverse"
else
echo "Unknown distribution: $DIST"
exit 1
fi

44
linux/Makefile Normal file
View file

@ -0,0 +1,44 @@
#!/usr/bin/make
tmpinstall: devreconf
./scripts/build.sh
install_local: devreconf
SUDOINSTALL="yes" ./scripts/build.sh
uninstall_local: devreconf
SUDOINSTALL="uninstall" ./scripts/build.sh
debnocow:
./scripts/deb.sh
reconf:
./scripts/reconf.sh
dist:
./scripts/dist.sh
origdist:
./scripts/dist.sh origdist
sourcepackage: reconf origdist
./scripts/deb.sh sourcepackage
devsourcepackage: devreconf origdist
./scripts/deb.sh sourcepackage
devreconf:
./scripts/reconf.sh dev
cow:
./scripts/cow.sh
deb: devreconf origdist cow debnocow
echo "Built dev Debian packages in builddebs/"
releasedeb: reconf origdist cow debnocow
echo "Built release Debian packages in builddebs/"
nightlydist: devreconf dist
echo "Built nightly source release in dist/"

View file

@ -14,34 +14,32 @@
- It is helpful to be using the [packages.sil.org](http://packages.sil.org) repo
- Install packages required for building and developing KMFL
`sudo apt install cdbs debhelper libx11-dev autotools-dev build-essential dh-autoreconf flex bison libibus-1.0-dev`
`sudo apt install cdbs debhelper libx11-dev autotools-dev build-essential dh-autoreconf flex bison libibus-1.0-dev python3-setuptools`
### Compiling from Command Line
#### Build script
##### Build only
##### Tmp install
Run `./build.sh` to build and install kmflcomp, libkmfl and ibus-kmfl to `/tmp/kmfl`
set `$INSTALLDIR` to use a different install directory.
e.g. `INSTALLDIR=/home/me/kmfl ./build.sh`
Run `make tmpinstall` to build and install kmflcomp, libkmfl and ibus-kmfl to `/tmp/kmfl`
This is only for testing the build, not for running ibus-kmfl in ibus
##### Installing for ibus to use ibus-kmfl
- Some of the files must be installed to `/usr/share/` so `make install` must be run as `sudo`.
- To do this run `SUDOINSTALL="yes" ./build.sh`
- To do this run `sudo make install_local`
* This will install to /usr/local
* and `/usr/share/ibus/component/kmfl.xml` and `/usr/share/kmfl/icons`
* If you already have the ibus-kmfl package installed then build.sh will move the file `/usr/share/ibus/component/kmfl.xml` to `/usr/share/doc/ibus-kmfl/`
* run `SUDOINSTALL="uninstall" ./build.sh` to put it back again
* run `sudo make uninstall_local` to put it back again
#### Manually
@ -66,7 +64,7 @@ This is only for testing the build, not for running ibus-kmfl in ibus
### Continuous integration
Teamcity will run build.sh
Teamcity will run `make tmpinstall`
### Building packages

5
linux/README.repo Normal file
View file

@ -0,0 +1,5 @@
You need autoconf, autopoint, gettext, automake and libtool to generate the build system
flex and bison are useful to rebuild lex.l and yacc.y in kmflcomp but not essential
Run `make reconf` to run them

1
linux/VERSION Normal file
View file

@ -0,0 +1 @@
10.99.1

View file

@ -30,6 +30,7 @@ ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = \
autogen.sh \
@PACKAGE_NAME@.spec.in \
VERSION \
$(NULL)
noinst_DIST = \

View file

@ -1,3 +1,3 @@
You need autoconf, automake and libtool to generate the build system
You need autoconf, autopoint, gettext, automake and libtool to generate the build system
Run ./autogen.sh to run them

1
linux/ibus-kmfl/VERSION Symbolic link
View file

@ -0,0 +1 @@
../VERSION

View file

@ -29,7 +29,8 @@ m4_define(ibus_maybe_datestamp,
m4_define([ibus_version],
ibus_major_version.ibus_minor_version.ibus_micro_version[]ibus_maybe_datestamp)
AC_INIT([ibus-kmfl], [10.99.1], [http://code.google.com/p/ibus/issues/entry],[ibus-kmfl])
AC_INIT([ibus-kmfl], m4_esyscmd_s([cat VERSION]), [https://github.com/ibus/ibus/issues/new])
AM_INIT_AUTOMAKE
AC_GNU_SOURCE

View file

@ -1,15 +1,15 @@
Source: ibus-kmfl
Section: utils
Priority: optional
Maintainer: Doug Rintoul <doug_rintoul@sil.org>
Maintainer: Daniel Glassey <wdg@debian.org>
Build-Depends: debhelper (>= 9), autotools-dev, dh-autoreconf, pkg-config,
libkmflcomp-dev, libkmfl-dev, libibus-1.0-dev (>= 1.2), x11proto-core-dev, libx11-dev
Standards-Version: 3.9.6
Homepage: http://kmfl.sourceforge.net
libkmflcomp-dev (>=10.99.1), libkmfl-dev (>=10.99.1), libibus-1.0-dev (>= 1.2), x11proto-core-dev, libx11-dev
Standards-Version: 3.9.8
Homepage: http://www.keyman.com
Package: ibus-kmfl
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libkmflcomp0, libkmfl0, ibus (>= 1.3.7)
Depends: ${shlibs:Depends}, ${misc:Depends}, ibus (>= 1.3.7)
Description: kmfl engine for IBus
IBus-kmfl is a IM Engine for multiple languages, based on IBus.
.

View file

@ -7,8 +7,8 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n"
"POT-Creation-Date: 2016-12-07 15:26-0800\n"
"Report-Msgid-Bugs-To: https://github.com/ibus/ibus/issues/new\n"
"POT-Creation-Date: 2018-09-03 16:25+0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,6 +17,6 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/kmflutil.c:240
#: src/kmflutil.c:294
msgid "KMFL"
msgstr ""

Binary file not shown.

View file

@ -7,8 +7,8 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n"
"POT-Creation-Date: 2016-12-07 15:26-0800\n"
"Report-Msgid-Bugs-To: https://github.com/ibus/ibus/issues/new\n"
"POT-Creation-Date: 2018-09-03 16:25+0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,6 +17,6 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/kmflutil.c:240
#: src/kmflutil.c:294
msgid "KMFL"
msgstr ""

View file

@ -1 +1,2 @@
recursive-include keyman_config/icons *
include README.md

View file

@ -8,13 +8,21 @@ default:
install:
python3 setup.py install
install-temp:
mkdir -p /tmp/kmfl/`python3 -c 'import sys;import os;pythonver="python%d.%d" % (sys.version_info[0], sys.version_info[1]);sitedir = os.path.join("lib", pythonver, "site-packages");print(sitedir)'`
PYTHONUSERBASE=/tmp/kmfl python3 setup.py install --user
clean:
-rm -rf dist make_deb build
devdist:
python3 setup.py egg_info -b.`TZ=UTC git log -1 --pretty=format:%cd --date=format-local:%Y%m%d%H%M` sdist
dist: clean
python3 setup.py sdist
deb: clean dist man
deb: clean devdist man
-mkdir make_deb
cd make_deb && tar xf ../dist/keyman_config-$(VERSION).tar.gz && \
mv keyman_config-$(VERSION) keyman-config-$(VERSION) && \

View file

@ -9,14 +9,17 @@ Homepage: http://www.keyman.com/
Package: python3-keyman-config
Architecture: all
Depends: ${misc:Depends}, ${python3:Depends}, python3-gi, gir1.2-webkit-3.0,
kmflcomp, dconf-cli
kmflcomp (>=10.99.1), dconf-cli, ibus-kmfl (>=10.99.1)
Description: Keyman for Linux configuration
Python module to install, uninstall and view information about Keyman keyboard
packages.
Package: keyman-config
Package: keyman
Architecture: all
Depends: ${misc:Depends}, python3-keyman-config
Description: Keyman for Linux configuration
Description: Type in your language with Keyman for Linux
Install, uninstall and view information about Keyman keyboard
packages.
.
This package depends all on that is needed for using Keyman
for Linux.

View file

@ -0,0 +1 @@
README.md

View file

@ -7,7 +7,6 @@ gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from keyman_config import __version__
from keyman_config.view_installed import ViewInstalledWindow
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Keyman keyboards installation and information')
@ -23,6 +22,8 @@ if __name__ == '__main__':
else:
logging.basicConfig(format='%(levelname)s:%(message)s')
from keyman_config.view_installed import ViewInstalledWindow
w = ViewInstalledWindow()
w.connect("destroy", Gtk.main_quit)
w.resize(800, 450)

View file

@ -6,7 +6,6 @@ import os.path
import sys
from keyman_config import __version__
from keyman_config.kvk2ldml import parse_kvk_file, print_kvk, convert_ldml, output_ldml
def main():
parser = argparse.ArgumentParser(description='Convert a Keyman kvk on-screen keyboard file to an LDML file. Optionally print the details of the kvk file.')
@ -26,6 +25,7 @@ def main():
else:
logging.basicConfig(format='%(levelname)s:%(message)s')
from keyman_config.kvk2ldml import parse_kvk_file, print_kvk, convert_ldml, output_ldml
name, ext = os.path.splitext(args.kvkfile)
# Check if input file extension is kvk

View file

@ -5,7 +5,6 @@ import logging
import sys
from keyman_config import __version__
from keyman_config.get_kmp import get_kmp
def main():
parser = argparse.ArgumentParser(description='Download Keyman keyboard package to ~/Downloads')
@ -22,6 +21,7 @@ def main():
else:
logging.basicConfig(format='%(levelname)s:%(message)s')
from keyman_config.get_kmp import get_kmp
get_kmp(args.id)
if __name__ == "__main__":

View file

@ -3,10 +3,8 @@
import argparse
import logging
import sys
import os
from keyman_config import __version__
from keyman_config.install_kmp import install_kmp
from keyman_config.list_installed_kmp import get_kmp_version
from keyman_config.get_kmp import get_keyboard_data, get_kmp
def main():
parser = argparse.ArgumentParser(description='Install a Keyman keyboard, either a local .kmp file or specify a keyboard id to download and install')
@ -28,6 +26,10 @@ def main():
logging.error("km-package-install: error: too many arguments: either install a local kmp file or specify a keyboard id to download and install.")
sys.exit(2)
from keyman_config.install_kmp import install_kmp
from keyman_config.list_installed_kmp import get_kmp_version
from keyman_config.get_kmp import get_keyboard_data, get_kmp
if args.f:
name, ext = os.path.splitext(args.f)
if ext != ".kmp":

View file

@ -4,7 +4,6 @@ import argparse
import logging
import os
from keyman_config import __version__
from keyman_config.list_installed_kmp import get_installed_kmp
def main():
parser = argparse.ArgumentParser(description='Show installed Keyman keyboards with name, version, id and description.')
@ -21,6 +20,7 @@ def main():
else:
logging.basicConfig(format='%(levelname)s:%(message)s')
from keyman_config.list_installed_kmp import get_installed_kmp
installed_kmp = get_installed_kmp()
print("--- Installed keyboards ---")

View file

@ -14,7 +14,7 @@ kmflcompdoc_DATA = \
INSTALL\
NEWS
EXTRA_DIST = $(kmflcompdoc_DATA)
EXTRA_DIST = $(kmflcompdoc_DATA) VERSION
# Copy all the spec files. Of cource, only one is actually used.
dist-hook:

View file

@ -1,3 +1,5 @@
You need autoconf, automake and libtool to generate the build system
flex and bison are useful to rebuild lex.l and yacc.y but not essential
Run ./autogen.sh to run them

1
linux/kmflcomp/VERSION Symbolic link
View file

@ -0,0 +1 @@
../VERSION

View file

@ -3,7 +3,7 @@ dnl Created by Anjuta - will be overwritten
dnl If you don't want it to overwrite it,
dnl Please disable it in the Anjuta project configuration
AC_INIT(kmflcomp, 10.99.1)
AC_INIT(kmflcomp, m4_esyscmd_s([cat VERSION]))
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)

View file

@ -1 +1 @@
10
9

View file

@ -1,10 +1,10 @@
Source: kmflcomp
Priority: optional
Section: utils
Maintainer: Doug Rintoul <doug_rintoul@sil.org>
Maintainer: Daniel Glassey <wdg@debian.org>
Uploaders: Torsten Werner <twerner@debian.org>
Homepage: http://kmfl.sourceforge.net/
Build-Depends: cdbs (>= 0.4.27), debhelper (>= 10), libx11-dev
Homepage: http://www.keyman.com
Build-Depends: cdbs (>= 0.4.27), debhelper (>= 9), libx11-dev, dh-autoreconf
Standards-Version: 3.9.8.0
Package: libkmflcomp-dev

View file

@ -6,6 +6,9 @@ include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/autoreconf.mk
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
DEB_SHLIBDEPS_INCLUDE := debian/libkmflcomp/usr/lib/
DEB_DH_INSTALL_SOURCEDIR := debian/tmp

View file

@ -11,7 +11,7 @@ libkmfldoc_DATA = \
INSTALL\
NEWS
EXTRA_DIST = $(libkmfldoc_DATA)
EXTRA_DIST = $(libkmfldoc_DATA) VERSION
# Copy all the spec files. Of cource, only one is actually used.
dist-hook:

1
linux/libkmfl/VERSION Symbolic link
View file

@ -0,0 +1 @@
../VERSION

View file

@ -3,7 +3,7 @@ dnl Created by Anjuta - will be overwritten
dnl If you don't want it to overwrite it,
dnl Please disable it in the Anjuta project configuration
AC_INIT(libkmfl, 10.99.1)
AC_INIT(libkmfl, m4_esyscmd_s([cat VERSION]))
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)

View file

@ -1,10 +1,10 @@
Source: libkmfl
Priority: optional
Section: libs
Maintainer: Doug Rintoul <doug_rintoul@sil.org>
Homepage: http://kmfl.sourceforge.net/
Build-Depends: cdbs (>= 0.4.27), debhelper (>= 9), dh-autoreconf, libkmflcomp-dev
Standards-Version: 3.9.8.0
Maintainer: Daniel Glassey <wdg@debian.org>
Homepage: http://www.keyman.com/
Build-Depends: cdbs (>= 0.4.27), debhelper (>= 9), dh-autoreconf, libkmflcomp-dev (>=10.99.0)
Standards-Version: 3.9.7
Package: libkmfl-dev
Section: libdevel

View file

@ -6,6 +6,9 @@ include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/autoreconf.mk
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
DEB_SHLIBDEPS_INCLUDE := debian/libkmfl0/usr/lib/
DEB_DH_INSTALL_SOURCEDIR := debian/tmp

View file

@ -0,0 +1,10 @@
{
"folders": [
{
"path": "."
},
{
"path": "../onboard-keyman"
},
],
}

View file

@ -18,13 +18,6 @@ SUDOINSTALL=${SUDOINSTALL:-"no"}
INSTALLDIR=${INSTALLDIR:-"/tmp/kmfl"}
# autoreconf the projects
for proj in kmflcomp libkmfl ibus-kmfl; do
cd $proj
autoreconf -if
cd $BASEDIR
done
if [[ "${SUDOINSTALL}" == "uninstall" ]]
then
echo "putting ibus-kmfl package component file back"
@ -54,9 +47,22 @@ for proj in kmflcomp libkmfl ibus-kmfl; do
make
sudo make install
else
echo "doing /tmp install of $proj"
../$proj/configure CPPFLAGS="-I${INSTALLDIR}/include" LDFLAGS="-L${INSTALLDIR}/lib" --prefix=${INSTALLDIR} --libexecdir=${INSTALLDIR}/lib/ibus
make
make install
fi
cd $BASEDIR
done
cd keyman-config
echo "SUDOINSTALL: ${SUDOINSTALL}"
if [[ "${SUDOINSTALL}" == "yes" ]]
then
echo "doing sudo install of keyman-config"
sudo make install
else
echo "doing /tmp install of keyman-config"
make install-temp
fi
cd $BASEDIR

52
linux/scripts/cow.sh Executable file
View file

@ -0,0 +1,52 @@
#!/bin/bash
# If needed set cowbuilder up for building Keyman Debian packages
# Then cowbuilder update
distributions='bionic xenial'
dpkgcheck=`dpkg-query -l cowbuilder`
if [ $? != 0 ]; then
echo "installing pbuilder and cowbuilder"
sudo apt install pbuilder cowbuilder
else
echo "already have pbuilder and cowbuilder"
fi
# set -e at this point to allow detecting the error of the dpkg-query
set -e
if [ ! -e ~/.pbuilderrc ]; then
echo "linking .pbuilderrc to your ~/.pbuilderrc"
ln -s `pwd`/.pbuilderrc ~/.pbuilderrc
else
echo "assuming you already have ~/.pbuilderrc set up as you want it"
echo "though you may like to look at this .pbuilderrc in case it is useful"
fi
for dist in $distributions; do
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}
else
echo "already have ${dist} cowbuilder"
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
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
fi
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 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

119
linux/scripts/deb.sh Executable file
View file

@ -0,0 +1,119 @@
#!/bin/bash
# Build Debian packages of Keyman with pbuilder
# It must be run from the keyman/linux directory
# parameters: ./deb.sh [sourcepackage] [proj] [dist]
# sourcepackage = only create Debian source package
# proj = only build for this project
# dist = only build for this distribution
set -e
all_distributions="bionic xenial"
distributions=""
all_projects="kmflcomp libkmfl ibus-kmfl keyman-config"
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
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
fi
fi
fi
if [ "${projects}" == "" ]; then
projects="${all_projects}"
fi
if [ "${distributions}" == "" ]; then
distributions="${all_distributions}"
fi
echo "distributions: ${distributions}"
echo "projects: ${projects}"
BASEDIR=`pwd`
mkdir -p builddebs
# make the source packages
cd builddebs
for proj in ${projects}; do
vers=`ls ../dist/${proj}_*.orig.tar.gz`
# echo "${vers}"
vers=${vers##*_}
# echo "${vers}"
vers=${vers%*.orig.tar.gz}
# echo "${vers}"
cp -a ../dist/${proj}_${vers}.orig.tar.gz .
tar xfz ${proj}_${vers}.orig.tar.gz
cp -a ../${proj}/debian ${proj}-${vers}
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
cd $BASEDIR
if [ "$1" == "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}
done

110
linux/scripts/dist.sh Executable file
View file

@ -0,0 +1,110 @@
#!/bin/bash
# Build dist tarballs or Debian orig tarballs
# and put them in dist/
# parameters: ./dist.sh [origdist] [proj]
# origdist = create Debian orig.tar.gz
# proj = only make tarball for this project
set -e
BASEDIR=`pwd`
autotool_projects="kmflcomp libkmfl ibus-kmfl"
extra_project="keyman-config"
if [ "$1" == "origdist" ]; then
if [ "$2" != "" ]; then
if [ ! -d "$2" ]; then
echo "project $2 does not exist"
exit 1
fi
if [ "$2" == "keyman-config" ]; then
autotool_projects=""
else
autotool_projects="$2"
extra_project=""
fi
fi
else
if [ "$1" != "" ]; then
if [ ! -d "$1" ]; then
echo "project $1 does not exist"
exit 1
fi
if [ "$1" == "keyman-config" ]; then
autotool_projects=""
else
autotool_projects="$1"
extra_project=""
fi
fi
fi
rm -rf dist
mkdir -p dist
# configure and make dist for autotool projects
for proj in ${autotool_projects}; do
cd $proj
rm -rf ../build-$proj
mkdir -p ../build-$proj
cd ../build-$proj
../$proj/configure
make dist
mv *.tar.gz ../dist
cd $BASEDIR
done
# dist for keyman-config
if [ "${extra_project}" == "keyman-config" ]; then
cd kmflcomp
baseversion=`cat VERSION`
echo "baseversion: ${baseversion}"
if [ -e configure ]; then
distversion=`./configure --version|grep kmfl|grep -Po 'kmflcomp configure \K[^a-z]*'`
else
distversion=`cat VERSION`.`TZ=UTC git log -1 --pretty=format:%cd --date=format-local:%Y%m%d%H%M`
fi
echo "distversion: ${distversion}"
cd ../keyman-config
rm -rf dist
if [ "${distversion}" == "${baseversion}" ]; then
python3 setup.py sdist
else
datever=${distversion##*.}
echo "datever: ${datever}"
python3 setup.py egg_info -b.${datever} sdist
fi
make man
cp dist/*.tar.gz ../dist
fi
cd $BASEDIR
# create orig.tar.gz
if [ "$1" == "origdist" ]; then
cd dist
for proj in ${autotool_projects}; do
tmp=`basename ${proj}*.tar.gz .tar.gz`
origname=${tmp/$proj-/$proj\_}
index=`expr index "${origname}" _`
mv $proj*.tar.gz ${origname}.orig.tar.gz
done
if [ "${extra_project}" == "keyman-config" ]; then
tmp=`basename keyman\_config*.tar.gz .tar.gz`
origname=${tmp/keyman\_config-/keyman-config\_}
index=`expr index "${origname}" _`
kcversion=${tmp:$index}
echo "keyman-config version: ${kcversion}"
tar xf keyman_config-${kcversion}.tar.gz
mv keyman_config-${kcversion} keyman-config-${kcversion}
tar cfz keyman-config_${kcversion}.orig.tar.gz keyman-config-${kcversion}
rm -rf keyman-config-${kcversion} keyman_config-${kcversion}.tar.gz
fi
fi

23
linux/scripts/jenkins.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash -e
. $HOME/ci-builder-scripts/bash/common.sh
init --no-package
# clean up prev deb builds
log "cleaning previous builds of $1"
rm -rf builddebs
rm -rf $1/${1}_*.{dsc,build,buildinfo,changes,tar.?z,log}
rm -rf ${1}_*.{dsc,build,buildinfo,changes,tar.?z,log}
log "Make source package for $1"
./scripts/reconf.sh dev $1
./scripts/dist.sh origdist $1
./scripts/deb.sh sourcepackage $1
#sign source package
for file in `ls builddebs/*.dsc`; do
log "Signing source package $file"
debsign -k$2 $file
done
mv builddebs/* $1

49
linux/scripts/reconf.sh Executable file
View file

@ -0,0 +1,49 @@
#!/bin/bash
# autoreconf autotool projects
# parameters: ./reconf.sh [dev] [proj]
# dev = append current GMT datetime to VERSION
# proj = only reconf this project
set -e
BASEDIR=`pwd`
autotool_projects="kmflcomp libkmfl ibus-kmfl"
if [ "$2" != "" ]; then
autotool_projects="$2"
if [ ! -d "$2" ]; then
echo "project $2 does not exist"
exit 1
fi
fi
if [ "$1" == "dev" ]; then
vers=`cat VERSION`
# get datetime of latest git commit
datevers=`TZ=UTC git log -1 --pretty=format:%cd --date=format-local:%Y%m%d%H%M`
echo "$vers.${datevers}" > VERSION
else
if [ "$1" != "" ]; then
autotool_projects="$1"
if [ ! -d "$1" ]; then
echo "project $1 does not exist"
exit 1
fi
fi
fi
# autoreconf the projects
for proj in ${autotool_projects}; do
if [ "${proj}" != "keyman-config" ]; then
cd $proj
echo "Reconfiguring $proj to version `cat VERSION`"
autoreconf -if
cd $BASEDIR
fi
done
if [ "$1" == "dev" ]; then
echo "${vers}" > VERSION
fi