diff --git a/common/shlibs b/common/shlibs index 8b4edbd9ce6..980f4024ca0 100644 --- a/common/shlibs +++ b/common/shlibs @@ -4159,3 +4159,4 @@ libsyncthingmodel.so.1.2.2 syncthingtray-1.2.2_1 libsyncthingconnector.so.1.2.2 syncthingtray-1.2.2_1 libglibutil.so.1 libglibutil-1.0.64_1 libgbinder.so.1 libgbinder-1.1.20_1 +libsunpinyin.so.3 libsunpinyin-3.0.0rc2_1 diff --git a/srcpkgs/ibus-sunpinyin b/srcpkgs/ibus-sunpinyin new file mode 120000 index 00000000000..b816e4b6f02 --- /dev/null +++ b/srcpkgs/ibus-sunpinyin @@ -0,0 +1 @@ +sunpinyin \ No newline at end of file diff --git a/srcpkgs/libsunpinyin b/srcpkgs/libsunpinyin new file mode 120000 index 00000000000..b816e4b6f02 --- /dev/null +++ b/srcpkgs/libsunpinyin @@ -0,0 +1 @@ +sunpinyin \ No newline at end of file diff --git a/srcpkgs/libsunpinyin-devel b/srcpkgs/libsunpinyin-devel new file mode 120000 index 00000000000..b816e4b6f02 --- /dev/null +++ b/srcpkgs/libsunpinyin-devel @@ -0,0 +1 @@ +sunpinyin \ No newline at end of file diff --git a/srcpkgs/sunpinyin/patches/libexecdir.patch b/srcpkgs/sunpinyin/patches/libexecdir.patch new file mode 100644 index 00000000000..09a5c9cb566 --- /dev/null +++ b/srcpkgs/sunpinyin/patches/libexecdir.patch @@ -0,0 +1,11 @@ +--- a/wrapper/ibus/SConstruct ++++ b/wrapper/ibus/SConstruct +@@ -71,7 +71,7 @@ PassVariables(envvar, env) + + data_dir = env['DATADIR'] + '/ibus-sunpinyin' + icons_dir = env['DATADIR'] + '/ibus-sunpinyin/icons' +-bin_dir = env['LIBEXECDIR'] + '/ibus-sunpinyin' ++bin_dir = env['LIBEXECDIR'] + gettext_package = 'ibus-sunpinyin' + + extra_cflags = ' -DIBUS_SUNPINYIN_LOCALEDIR=\'"%s"\'' % (env['DATADIR'] + '/locale') diff --git a/srcpkgs/sunpinyin/patches/pkg-config.patch b/srcpkgs/sunpinyin/patches/pkg-config.patch new file mode 100644 index 00000000000..b4ee4efd7ef --- /dev/null +++ b/srcpkgs/sunpinyin/patches/pkg-config.patch @@ -0,0 +1,10 @@ +--- a/sunpinyin-2.0.pc.in ++++ b/sunpinyin-2.0.pc.in +@@ -1,6 +1,6 @@ + prefix=@PREFIX@ + exec_prefix=${prefix} +-libdir=@LIBDIR@ ++libdir=${exec_prefix}/lib + includedir=${exec_prefix}/include/sunpinyin-2.0 + + Name: libsunpinyin diff --git a/srcpkgs/sunpinyin/patches/version.patch b/srcpkgs/sunpinyin/patches/version.patch new file mode 100644 index 00000000000..3ca4102f603 --- /dev/null +++ b/srcpkgs/sunpinyin/patches/version.patch @@ -0,0 +1,22 @@ +--- a/SConstruct ++++ b/SConstruct +@@ -7,7 +7,7 @@ import sys + + import SCons.Errors + +-version = "2.0.4" ++version = "3.0.0-rc2" + abi_major = 3 + abi_minor = 0 + +--- a/wrapper/ibus/SConstruct ++++ b/wrapper/ibus/SConstruct +@@ -14,7 +14,7 @@ sources = ['src/debug.cpp', + locales = ['zh_CN'] + + cflags = '-O2 -g -pipe ' +-version = '2.0.3' ++version = '3.0.0-rc2' + + AddOption('--prefix', dest='prefix', metavar='DIR', + help='installation prefix') diff --git a/srcpkgs/sunpinyin/template b/srcpkgs/sunpinyin/template new file mode 100644 index 00000000000..01b55eb4e36 --- /dev/null +++ b/srcpkgs/sunpinyin/template @@ -0,0 +1,102 @@ +# Template file for 'sunpinyin' +pkgname=sunpinyin +version=3.0.0rc2 +revision=1 +wrksrc="sunpinyin-${version/rc/-rc}" +build_style=scons +hostmakedepends="pkg-config python3 perl gettext" +makedepends="python3-devel sqlite-devel ibus-devel" +short_desc="Statistical language model based Chinese input method" +maintainer="Đoàn Trần Công Danh " +license="LGPL-2.1-or-later, CDDL-1.0" +homepage="https://github.com/sunpinyin/sunpinyin" +# fcitx has this archive, too +_lm_sc=lm_sc.3gm.arpa-20140820.tar.bz2 +_dict=dict.utf8-20131214.tar.bz2 +distfiles="https://github.com/sunpinyin/sunpinyin/archive/refs/tags/v${version/rc/-rc}.tar.gz + https://downloads.sourceforge.net/project/open-gram/$_lm_sc + https://downloads.sourceforge.net/project/open-gram/$_dict" +checksum="6722bd41e58b0a42bf41b7c1cb7707e6adfce810ab35597f938c5df8aa5a0af0 + 751bab7c55ea93a2cedfb0fbb7eb09f67d4da9c2c55496e5f31eb8580f1d1e2f + af70bc2bcd7af7468495774fed9e3a2de434650119fbc3d3388c2bcf7e0acb01" +skip_extraction="$_lm_sc $_dict" +CXXFLAGS="-I../../src" +LDFLAGS="-L." + +if [ "$CROSS_BUILD" ]; then + hostmakedepends+=" sunpinyin" +fi + +do_configure() { + cat <<-EOF >configure.conf + PREFIX = '/usr' + LIBDIR = '/usr/lib' + DATADIR = '/usr/share' + ENABLE_PLUGINS = True + PYTHON = '/usr/bin/python3' + EOF + cat <<-EOF >wrapper/ibus/configure.conf + PREFIX = '/usr' + LIBDIR = '/usr/lib' + LIBEXECDIR = '/usr/libexec' + DATADIR = '/usr/share' + EOF +} + +post_extract() { + local _f + mkdir -p dict + for _f in $skip_extraction; do + bsdtar -C dict -xf "$XBPS_SRCDISTDIR/sunpinyin-$version/$_f" + done + ln -s ../doc/SLM-inst.mk dict/Makefile +} + +post_build() { + PATH="$PATH:$wrksrc/src" + make -C dict ${makejobs} ENDIANESS="${XBPS_TARGET_ENDIAN}" + PKG_CONFIG_PATH="$wrksrc:/usr/lib/pkgconfig:/usr/share/pkgconfig" + PKG_CONFIG_LIBDIR="$wrksrc:/usr/lib/pkgconfig" + # LDFLAGS+=" -Wl,-rpath-link=$wrksrc" + export PKG_CONFIG_PATH PKG_CONFIG_LIBDIR + cd wrapper/ibus + ln -s ../../libsunpinyin.so.*.* libsunpinyin.so + do_build +} + +post_install() { + PKG_CONFIG_PATH="$wrksrc:/usr/lib/pkgconfig:/usr/share/pkgconfig" + PKG_CONFIG_LIBDIR="$wrksrc:/usr/lib/pkgconfig" + # LDFLAGS+=" -Wl,-rpath-link=$wrksrc" + export PKG_CONFIG_PATH PKG_CONFIG_LIBDIR + cd wrapper/ibus + do_install +} + +libsunpinyin_package() { + short_desc+=" - libraries" + pkg_install() { + vmove "usr/lib/*.so.*" + make -C dict install \ + DESTDIR=${PKGDESTDIR} \ + ENDIANESS="${XBPS_TARGET_ENDIAN}" + } +} + +libsunpinyin-devel_package() { + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove "usr/lib/*.so" + vmove usr/lib/pkgconfig + } +} + +ibus-sunpinyin_package() { + short_desc+=" - IBus plugin" + pkg_install() { + vmove usr/libexec + vmove "usr/share/ibus*" + vmove usr/share/locale + } +}