尝试构建基于LoongArch64架构Linux系统桌面办公软件libreoffice(尝试构建基于LoongArch64架构Linux系统桌面办公软件libreoffice)(1)

新闻来源:龙芯为 LibreOffice 添加 LoongArch 支持 - OSCHINA - 中文开源技术交流社区

根据 commit 的信息,为 LibreOffice 开源办公套件添加 LoongArch 支持包含 1630 行新的代码,其中包括从构建系统到数百行新的 C 代码变化。目前 LoongArch 对 LibreOffice 的支持只是针对 Linux 平台进行构建。

##1 切换到制作用户

  使用命令切换到新创建的用户:

```sh

su - lauser

注:使用“su”命令进行切换时加上“-”参数可以防止切换前的用户环境变量带到新用户环境中。

## 2 设置环境变量

```sh

export LDFLAGS="-Wl,-rpath-link=${SYSDIR}/sysroot/usr/lib64"

export PKG_CONFIG_SYSROOT_DIR=${SYSDIR}/sysroot

export PKG_CONFIG_PATH="${SYSDIR}/sysroot/usr/lib64/pkgconfig:${SYSDIR}/sysroot/usr/share/pkgconfig"

export COMMON_CONFIG="--prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib64 \

--build=${CROSS_HOST} --host=${CROSS_TARGET}"

export JOBS="-j8"

```

## LibreOffice

获取软件代码。

```sh

git clone https://git.libreoffice.org/core --depth 1

pushd core

git submodule init

git submodule update --depth 1

popd

mv core libreoffice-7.5-git

tar -czf ${DOWNLOADDIR}/libreoffice-7.5-git.tar.gz libreoffice-7.5-git

```

重点下面编译和安装。

```

tar xvf ${DOWNLOADDIR}/libreoffice-7.5-git.tar.gz -C ${BUILDDIR}

pushd ${BUILDDIR}/libreoffice-7.5-git

cp ${SYSDIR}/cross-tools/share/automake-1.16/config.* ./

aclocal

patch -Np1 -i ${DOWNLOADDIR}/libreoffice-7.5-for-clfs.patch

patch -Np1 -i ${DOWNLOADDIR}/libreoffice-7.5-libgpg-error-add-loongarch64.patch

patch -Np1 -i ${DOWNLOADDIR}/libreoffice-7.5-postgresql-disable_spinlock.patch

PKG_CONFIG_FOR_BUILD=/bin/pkg-config \

perl ./autogen.sh CC=${CROSS_TARGET}-gcc CXX=${CROSS_TARGET}-g \

--build=${CROSS_HOST} --host=${CROSS_TARGET} \

--prefix=/opt/libreoffice \

--with-lang="zh-CN" --with-vendor=Sunhaiyong \

--with-help --with-myspell-dicts \

--without-junit --without-system-dicts --disable-dconf --disable-odk \

--enable-release-build=yes --without-java \

--with-system-boost --with-system-curl --with-system-epoxy \

--with-system-expat --with-system-graphite --with-system-harfbuzz \

--with-system-icu --with-system-jpeg --with-system-lcms2 \

--with-system-libatomic_ops --with-system-libpng --with-system-libxml \

--with-system-nss --with-system-openssl \

--with-system-zlib --with-system-openjpeg \

LIBS="-lstdc " \

--with-boost-libdir=${SYSDIR}/sysroot/usr/lib64 \

--disable-coinmp --enable-python=no

ZIC=/usr/sbin/zic make build ${JOBS}

make DESTDIR=${PWD}/dest distro-pack-install

cp -a ${PWD}/dest/opt/libreoffice ${SYSDIR}/sysroot/opt/

mkdir -pv ${SYSDIR}/sysroot/usr/share/bash-completion/completions/

cp -a ${PWD}/dest/usr/share/bash-completion/completions/* ${SYSDIR}/sysroot/usr/share/bash-completion/completions/

cp -a ${PWD}/dest/opt/libreoffice/share/applications/*.desktop \

${SYSDIR}/sysroot/usr/share/applications/

mkdir -pv ${SYSDIR}/sysroot/usr/share/xdg/

cp -a ${PWD}/dest/opt/libreoffice/lib/libreoffice/share/xdg/*.desktop \

${SYSDIR}/sysroot/usr/share/xdg/

popd

尝试不代表成功,不尝试一定不会成功。

尝试构建基于LoongArch64架构Linux系统桌面办公软件libreoffice(尝试构建基于LoongArch64架构Linux系统桌面办公软件libreoffice)(2)

```

,