• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright (c) 2024 Huawei Device Co., Ltd.
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15set -e
16
17# 定义 JSON 文件路径
18JSON_FILE="build-tex.json"
19TEX_SOURCE_DIR="../../hyph-utf8/tex/generic/hyph-utf8/patterns/tex"
20HPB_OUT_DIR="./out_hpb"
21
22# 检查 jq 是否安装
23if ! command -v jq &> /dev/null
24then
25    echo "jq could not be found, please install jq to proceed."
26    exit
27fi
28
29# 编译可执行文件
30g++ -g -Wall ../src/hyphen-build/hyphen_pattern_processor.cpp -o transform
31
32# 读取 JSON 文件并遍历数组,获取每个对象的 language 字段
33jq -c '.[]' "$JSON_FILE" | while read -r item; do
34    FILENAME=$(echo "$item" | jq -r '.filename')
35    echo "filename: $FILENAME"
36    ./transform "$TEX_SOURCE_DIR/$FILENAME" "$HPB_OUT_DIR"
37done
38
39