OpenHarmony开发实战—SystemUI编译过程笔记

环境准备

系统必须为Ubuntu18.04或Ubuntu20.04

安装依赖

1 sudo apt-get update && sudo apt-get install binutils git git-lfs gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4 bc gnutls-bin python3.8 python3-pip ruby device-tree-compiler lib32stdc++6 lib32z1 libncurses5-dev libtinfo5 scons genext2fs abootimg -y

配置git

1 git config --global user.name "yourname"
2 git config --global user.email "your-email-address"
3 git config --global credential.helper store

其中的信息应该为你在gitee的信息

安装repo

1 cd ~
2 curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > bin/repo
3 chmod a+x bin/repo

配置环境变量

1 vim ~/.bashrc
2 # 在最后一行添加: export PATH="~/bin/repo:$PATH"
3 :wq
4 source ~/.bashrc

配置地址

1 pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests

检查node版本

node -v

node版本必须在14以上!

源码获取

创建项目文件夹

1 cd ~
2 mkdir ohos
3 cd ohos

同步代码

1 repo init -u https://gitee.com/ohos_port/manifest -b fajita-OpenHarmony-3.2-Release --no-repo-verify
2 repo sync -c
3 repo forall -c 'git lfs pull'

编译准备

执行prebuild脚本

1 cd ~/ohos
2 ./build/prebuilts_download.sh
 

 注释掉hap/build.sh内build_sdk函数内的第二个for循环,结果如下:

#!/bin/bash

# Copyright (c) 2022 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.

set -e

CUR_PATH=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)
BASE_PATH=$(dirname ${CUR_PATH})
ROOT_PATH=$(cd ${CUR_PATH}/../../.. && pwd) && cd -

arg_project=""
arg_sdk_path=""
arg_build_sdk="false"
arg_help="0"
arg_url=""
arg_branch=""
arg_npm=""
arg_out_path="${ROOT_PATH}/out/hap"
arg_sign_tool="${ROOT_PATH}/developtools/hapsigner/dist"
arg_p7b=""
arg_apl="normal"
arg_feature="hos_normal_app"
arg_profile="UnsgnedReleasedProfileTemplate.json"
arg_bundle_name=""

function print_help() {
  cat <<EOF
  use assembleHap [options] <mainclass> [args...]

EOF
}


function clear_dir(){
        if [ ! -d "$1" ]; then
                mkdir -p $1
        fi
}


function is_project_root(){
        if [[ -f $1"/build-profile.json5" && -f $1"/hvigorfile.js" ]]; then
                return 0
        else
                return 1
        fi
}

function build_sdk() {
        if [ -d ${ROOT_PATH}/out/sdk/packages/ohos-sdk/linux ]; then
                echo "ohos-sdk exists."
                return 0
        fi
        pushd ${ROOT_PATH}
     
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值