diff --git a/thirdparty/glib/HPKBUILD b/thirdparty/glib/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..ad3dd0bdedbe60363babc25798811f53335755ad --- /dev/null +++ b/thirdparty/glib/HPKBUILD @@ -0,0 +1,110 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Contributor: 城meto +# Maintainer: 城meto +pkgname=glib +pkgver=2.77.1 +pkgrel=0 +pkgdesc="GLib is a general-purpose, portable utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a mainloop abstraction, and so on." +url="https://docs.gtk.org/glib/" +archs=("armeabi-v7a" "arm64-v8a") +license=("Apache 2.0" "CC0-1.0" "GPL-2.0" "LGPL-2.1" "LLVM" "old-glib" "MIT") +depends=("libffi" "pcre2") # 将依赖库独立编译 +makedepends=("meson" "ninja") + +# 原仓位置: https://github.com/GNOME/${pkgname}/archive/refs/tags/$pkgver.tar.gz, 因网络原因使用镜像 +source="https://gitee.com/lycium_pkg_mirror/glib.git" + +downloadpackage=false +autounpack=false +buildtools="meson" + +builddir=$pkgname-$pkgver +packagename=$pkgname-$pkgver.tar.gz + +buildhost=true +clonesrcflag=true +pkgconfigpath= + +prepare() { + # git clone对网络要求太高了,而且耗时长,这个版本使用压缩包 + if $clonesrcflag + then + git clone -b $pkgver $source $builddir + if [ $? -ne 0 ];then + return -1 + fi + git clone https://github.com/GNOME/gvdb.git $builddir/subprojects/gvdb + cd $builddir/subprojects/gvdb + git checkout --detach 0854af0fdb6d527a8d1999835ac2c5059976c210 + ret=$? + cd $OLDPWD + if [ $ret != 0 ];then + return -2 + fi + git clone --depth 1 --branch 0.4 https://github.com/frida/proxy-libintl.git $builddir/subprojects/proxy-libintl + if [ $? != 0 ];then + return -3 + fi + clonesrcflag=false + fi + + # meson 编译需要自己配置pkg_config_path 路径 + for depend in ${depends[@]} + do + dependpath=$LYCIUM_ROOT/usr/$depend/$ARCH/lib/pkgconfig + if [ ! -d ${dependpath} ] + then + continue + fi + pkgconfigpath=$pkgconfigpath"${dependpath}:" + done + pkgconfigpath=${pkgconfigpath%:*} + + cp $ARCH-cross-file.txt $builddir + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ohos_sdk_path=${OHOS_SDK//\//\\\/} + sed -i 's/ohos_sdk/'"$ohos_sdk_path"'/g' $ARCH-cross-file.txt + + # 需要设置pkg路径 + meson setup $ARCH-build --cross-file $ARCH-cross-file.txt \ + --pkg-config-path=$pkgconfigpath \ + --prefix=$LYCIUM_ROOT/usr/$pkgname/$ARCH > $ARCH-build/build.log 2>&1 + ninja -C $ARCH-build -v >> $ARCH-build/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + ninja -v -C $ARCH-build install >> build.log 2>&1 + # 还原 + unset pkgconfigpath + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # TODO +} + +# 清理环境 +cleanbuild() { + rm -rf ${PWD}/$builddir +} diff --git a/thirdparty/glib/SHA512SUM b/thirdparty/glib/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..609880d9976c775eb57ccbdcc8412092060032f1 --- /dev/null +++ b/thirdparty/glib/SHA512SUM @@ -0,0 +1 @@ +172ba4dab2a9331bba145a18b7ebd1662a91bb1ced5f7822e0d06f2851159fe1c9d518f7ddbebd30016da7ac84aef61cfcb88691f4106e4660db48b14ee6a511 glib-2.77.1.tar.gz diff --git a/thirdparty/glib/arm64-v8a-cross-file.txt b/thirdparty/glib/arm64-v8a-cross-file.txt new file mode 100644 index 0000000000000000000000000000000000000000..34ad3f25276acd1c3503e23ce42157e33c4375b3 --- /dev/null +++ b/thirdparty/glib/arm64-v8a-cross-file.txt @@ -0,0 +1,26 @@ +[binaries] +c = 'ohos_sdk/native/llvm/bin/aarch64-linux-ohos-clang' +cpp = 'ohos_sdk/native/llvm/bin/aarch64-linux-ohos-clang++' +ar = 'ohos_sdk/native/llvm/bin/llvm-ar' +strip = 'ohos_sdk/native/llvm/bin/llvm-strip' +ld = 'ohos_sdk/native/llvm/bin/ld.lld' +pkgconfig = '/usr/bin/pkg-config' + +[host_machine] +system = 'linux' +cpu_family = 'aarch64' +cpu = 'arm64-v8a' +endian = 'little' + +[properties] +needs_exe_wrapper = true +skip_sanity_check = true +sys_root = '' +platform = 'generic' +pkg_config_libdir = '' + +[built-in options] +c_args = ['-D__MUSL__=1', '-mfpu=neon'] +cpp_args = ['-D__MUSL__=1', '-mfpu=neon'] +c_link_args = [] +cpp_link_args = [] diff --git a/thirdparty/glib/armeabi-v7a-cross-file.txt b/thirdparty/glib/armeabi-v7a-cross-file.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b6e25f2eeb4d8fad8f02a2cb527e68f26461ef8 --- /dev/null +++ b/thirdparty/glib/armeabi-v7a-cross-file.txt @@ -0,0 +1,26 @@ +[binaries] +c = 'ohos_sdk/native/llvm/bin/arm-linux-ohos-clang' +cpp = 'ohos_sdk/native/llvm/bin/arm-linux-ohos-clang++' +ar = 'ohos_sdk/native/llvm/bin/llvm-ar' +strip = 'ohos_sdk/native/llvm/bin/llvm-strip' +ld = 'ohos_sdk/native/llvm/bin/ld.lld' +pkgconfig = '/usr/bin/pkg-config' + +[host_machine] +system = 'linux' +cpu_family = 'arm' +cpu = 'armeabi-v7a' +endian = 'little' + +[properties] +needs_exe_wrapper = true +skip_sanity_check = true +sys_root = '' +platform = 'generic' +pkg_config_libdir = '' + +[built-in options] +c_args = ['-fPIC', '-march=armv7a', '-mfloat-abi=softfp', '-mfpu=neon', '-D__MUSL__=1'] +cpp_args = ['-fPIC', '-march=armv7a', '-mfloat-abi=softfp', '-mfpu=neon', '-D__MUSL__=1'] +c_link_args = [] +cpp_link_args = [] diff --git a/thirdparty/pcre2/HPKBUILD b/thirdparty/pcre2/HPKBUILD index c1f8998edc4d1d54680f0c5be429d17260440063..766dd749324f6f6a2896d6735fe2817963fd4d6f 100755 --- a/thirdparty/pcre2/HPKBUILD +++ b/thirdparty/pcre2/HPKBUILD @@ -10,6 +10,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + # Contributor: 城meto # Maintainer: 城meto @@ -22,15 +23,24 @@ archs=("armeabi-v7a" "arm64-v8a") license=("BSD license") depends=() makedepends=() -source="https://github.com/PCRE2Project/$pkgname/archive/refs/tags/$pkgver.tar.gz" +# 原仓位置: https://github.com/PCRE2Project/$pkgname/archive/refs/tags/$pkgver.tar.gz, 因网络原因使用镜像 +source="https://gitee.com/lycium_pkg_mirror/pcre2.git" -autounpack=true -downloadpackage=true +autounpack=false +downloadpackage=false +clonesrcflag=true builddir=$pkgname-$pkgver packagename=$pkgname-$pkgver.tar.gz prepare() { + if [ $clonesrcflag == true ];then + git clone -b $pkgver $source $builddir + if [ $? -ne 0 ];then + return -1 + fi + clonesrcflag=false + fi mkdir -p $builddir/$ARCH-build }