以ibus为例
1.新建目录Demo,将PKGBUILD文件复制到该目录下
PKGBUILD文件在Arch Linux网站,右边的“Source Files ”处下载
# Maintainer: Felix Yan <felixonmars@archlinux.org>
pkgbase=ibus
pkgname=(ibus libibus)
pkgver=1.5.25
pkgrel=2
pkgdesc="Next Generation Input Bus for Linux"
arch=('x86_64')
url="https://github.com/ibus/ibus/wiki"
license=('LGPL')
depends=('dconf' 'gtk3' 'hicolor-icon-theme' 'libnotify' 'python-dbus' 'python-gobject'
'iso-codes' 'librsvg')
makedepends=('gobject-introspection' 'vala' 'intltool' 'gnome-common' 'gtk-doc' 'gtk4' 'gtk2'
'qt5-base' 'unicode-cldr' 'unicode-character-database' 'unicode-emoji' 'git')
options=('!emptydirs')
# _commit=cfb263f04f82a83dd94f6eedcd5017d40a4a1a05 # 1.5.25
# source=("git+https://github.com/ibus/ibus#commit=$_commit")
# sha512sums=('SKIP')
pkgver() {
cd ibus
git describe --tags | sed 's/-/+/g'
}
prepare() {
cd ibus
sed -i 's|$(libibus) $(libibus_emoji_dialog)|$(libibus_emoji_dialog) $(libibus)|' ui/gtk3/Makefile.am
NOCONFIGURE=1 ./autogen.sh
}
build() {
cd ibus
./configure \
--prefix=/usr \
--libexecdir=/usr/lib/ibus \
--sysconfdir=/etc \
--enable-dconf \
--enable-wayland \
--enable-gtk-doc \
--enable-gtk4 \
--disable-memconf \
--enable-ui \
--disable-python2 \
--with-python=python3 \
--with-ucd-dir=/usr/share/unicode/
sed -i 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
make
}
package_ibus() {
depends+=("libibus=$pkgver")
cd ibus
make DESTDIR="$pkgdir" install
make -C src DESTDIR="$pkgdir" uninstall
make -C bindings DESTDIR="$pkgdir" uninstall
make DESTDIR="$pkgdir" uninstall-pkgconfigDATA
}
package_libibus() {
pkgdesc="IBus support library"
depends=(libg{lib,object,io}-2.0.so)
provides=('libibus-1.0.so')
cd ibus
make -C src DESTDIR="$pkgdir" install
make -C bindings DESTDIR="$pkgdir" install
make DESTDIR="$pkgdir" install-pkgconfigDATA
}
在Demo目录下执行
makepkg --source
若提示==> ERROR: PKGBUILD does not exist.则是没有PKGBUILD文件;
若提示==> 错误: Cannot find the strip binary required for object file stripping.则没安装打包基本工具,用命令 pacman -S base-devel安装
执行完则目录变成:
–Demo
----------src
----------ibus-1.5.25-2.src.tar.gz
----------PKGBUILD
2.获取源代码
进入src目录,将代码clone到ibus目录下
git clone https://github.com/ibus/ibus.git
源代码则在Demo/src/ibus目录下
3.编译代码
在Demo目录下执行命令
makepkg -s
编译完成会生产安装包文件
4.安装
sudo pacman -U ibus-1.5.25-2-x86_64.pkg.tar.zst