| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
OPENCC_PREFIX=`pkg-config --variable=prefix opencc` |
| 4 |
|
| 5 |
if [[ "$?" != 0 ]] || [[ -z OPENCC_PREFIX ]]; then |
| 6 |
echo "Cannot find opencc prefix" |
| 7 |
fi |
| 8 |
|
| 9 |
cat > opencc-profile-name.cpp <<EOF |
| 10 |
#include <fcitx-utils/i18n.h> |
| 11 |
|
| 12 |
namespace { |
| 13 |
[[maybe_unused]] constexpr std::string_view OpenCCProfileName[] = { |
| 14 |
EOF |
| 15 |
|
| 16 |
for profile in `find "$OPENCC_PREFIX"/share/opencc -name "*.json"`; do |
| 17 |
PROFILE_NAME=`jq -r -e ".name" $profile` |
| 18 |
if [[ "$?" != 0 ]]; then |
| 19 |
continue |
| 20 |
fi |
| 21 |
echo " NC_(\"OpenCC Profile\", \"$PROFILE_NAME\")," >> opencc-profile-name.cpp |
| 22 |
done |
| 23 |
|
| 24 |
cat >> opencc-profile-name.cpp <<EOF |
| 25 |
}; |
| 26 |
} |
| 27 |
EOF |