Skip to content

Commit 0bdcf01

Browse files
committed
Merge branch 'master' of github.com:jiegec/Termony
2 parents 3f6ffb3 + c0ec9bd commit 0bdcf01

43 files changed

Lines changed: 266 additions & 75 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/hnp.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: hnp-build
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
schedule:
8+
- cron: "0 2 * * *"
9+
10+
env:
11+
OHOS_SDK_RELEASE_VERSION: "5.1.0"
12+
OHOS_SDK_VERSION: "5.1.0.107"
13+
OHOS_SDK_HOME: ${{ github.workspace }}/ohos-sdk/linux
14+
15+
jobs:
16+
build-hnp:
17+
runs-on: ubuntu-24.04
18+
steps:
19+
- name: Update Apt Cache
20+
run: sudo apt update
21+
22+
- name: Free Disk Space (Ubuntu)
23+
uses: jlumbroso/free-disk-space@main
24+
with:
25+
# this might remove tools that are actually needed,
26+
# if set to "true" but frees about 6 GB
27+
tool-cache: true
28+
# all of these default to true, but feel free to set to
29+
# "false" if necessary for your workflow
30+
android: true
31+
dotnet: true
32+
haskell: true
33+
large-packages: true
34+
docker-images: true
35+
swap-storage: true
36+
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
with:
40+
submodules: recursive
41+
42+
- name: Install Dependencies
43+
run: |
44+
sudo apt install -y build-essential cmake curl wget unzip python3 libncurses-dev \
45+
git flex bison bash make autoconf libcurl4-openssl-dev tcl \
46+
gettext zip pigz
47+
48+
- name: Download OHOS SDK
49+
shell: bash
50+
run: |
51+
curl -OL https://repo.huaweicloud.com/openharmony/os/${OHOS_SDK_RELEASE_VERSION}-Release/ohos-sdk-windows_linux-public.tar.gz
52+
tar -xzf ohos-sdk-windows_linux-public.tar.gz
53+
rm ohos-sdk-windows_linux-public.tar.gz
54+
rm -rf ohos-sdk/{ohos,windows}
55+
pushd ohos-sdk/linux
56+
for file in $(find . -type f); do
57+
unzip $file && rm $file
58+
done
59+
popd
60+
61+
- name: Build hnp
62+
shell: bash
63+
run: |
64+
make -C build-hnp
65+
66+
- name: Upload hnp
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: hnp
70+
path: |
71+
build-hnp/*.hnp
72+
retention-days: 7

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM ubuntu:24.04
2+
3+
# Install dependencies
4+
RUN apt-get update && \
5+
apt install -y build-essential cmake curl wget unzip python3 libncurses-dev \
6+
git flex bison bash make autoconf libcurl4-openssl-dev tcl \
7+
gettext zip pigz
8+
9+
ENV OHOS_SDK_RELEASE_VERSION=5.1.0
10+
11+
# Install OHOS SDK
12+
RUN curl -OL https://repo.huaweicloud.com/openharmony/os/${OHOS_SDK_RELEASE_VERSION}-Release/ohos-sdk-windows_linux-public.tar.gz && \
13+
tar -xvf ohos-sdk-windows_linux-public.tar.gz -C /opt && \
14+
rm ohos-sdk-windows_linux-public.tar.gz && \
15+
rm -rf /opt/ohos-sdk/{ohos,windows} && \
16+
cd /opt/ohos-sdk/linux && \
17+
for file in $(find . -type f); do \
18+
unzip $file && rm $file; \
19+
done
20+
21+
# Set environment variables
22+
ENV OHOS_SDK_HOME=/opt/ohos-sdk/linux
23+
24+
CMD /bin/bash

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Terminal features:
9898
6. Run `./create-hnp.sh` to create hnp packages
9999
7. Run `./build-macos.sh`
100100
8. Run `./push.sh ./entry/build/default/outputs/default/entry-default-signed.hap`
101-
9. Input command in the text input of the application, press enter
101+
9. Try Termony on you HarmonyOS Computer
102102

103103
## Usage (if you are a Linux user):
104104

@@ -107,9 +107,9 @@ Terminal features:
107107
3. Setup code signing in DevEco-Studio, ignore warnings if any
108108
4. Setup DevEco Command Line Tools, and make sure `$TOOL_HOME` env var is a correct directory to SDK
109109
5. Run `./build-linux.sh -b` to create hnp packages
110-
6. Run `./build-linux.sh -s` to signing
111-
7. Run `./build-linux.sh -p`
112-
8. Input command in the text input of the application, press enter
110+
6. Run `./build-linux.sh -s` to sign the hap file
111+
7. Run `./build-linux.sh -p` to push and install Termony on your device
112+
8. Try Termony on you HarmonyOS Computer
113113

114114
## How does it work
115115

build-hnp/Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ PKGS=bash \
3838
expat \
3939
git \
4040
aria2 \
41-
gdb \
42-
xz
41+
xz \
42+
gdb
4343
STAMP=$(patsubst %,%/.stamp,$(PKGS))
4444

4545
all: copy
@@ -59,13 +59,13 @@ base.hnp: $(STAMP) utils/pbcopy utils/pbpaste
5959
cp utils/pbpaste sysroot/bin
6060
# let gcc work out of box
6161
mkdir -p sysroot/aarch64-unknown-linux-musl/lib
62-
cp $(TOOL_HOME)/sdk/default/openharmony/native/sysroot/usr/lib/aarch64-linux-ohos/crt1.o sysroot/aarch64-unknown-linux-musl/lib/crt1.o
63-
cp $(TOOL_HOME)/sdk/default/openharmony/native/sysroot/usr/lib/aarch64-linux-ohos/crti.o sysroot/aarch64-unknown-linux-musl/lib/crti.o
64-
cp $(TOOL_HOME)/sdk/default/openharmony/native/sysroot/usr/lib/aarch64-linux-ohos/crtn.o sysroot/aarch64-unknown-linux-musl/lib/crtn.o
65-
cp $(TOOL_HOME)/sdk/default/openharmony/native/llvm/lib/clang/15.0.4/lib/aarch64-linux-ohos/clang_rt.crtbegin.o sysroot/aarch64-unknown-linux-musl/lib/crtbegin.o
66-
cp $(TOOL_HOME)/sdk/default/openharmony/native/llvm/lib/clang/15.0.4/lib/aarch64-linux-ohos/clang_rt.crtend.o sysroot/aarch64-unknown-linux-musl/lib/crtend.o
67-
cp $(TOOL_HOME)/sdk/default/openharmony/native/llvm/lib/clang/15.0.4/lib/aarch64-linux-ohos/libclang_rt.builtins.a sysroot/aarch64-unknown-linux-musl/lib/libgcc.a
68-
# $(TOOL_HOME)/sdk/default/openharmony/toolchains/hnpcli pack -i sysroot -n base -v 1.0
62+
cp $(OHOS_SDK_HOME)/native/sysroot/usr/lib/aarch64-linux-ohos/crt1.o sysroot/aarch64-unknown-linux-musl/lib/crt1.o
63+
cp $(OHOS_SDK_HOME)/native/sysroot/usr/lib/aarch64-linux-ohos/crti.o sysroot/aarch64-unknown-linux-musl/lib/crti.o
64+
cp $(OHOS_SDK_HOME)/native/sysroot/usr/lib/aarch64-linux-ohos/crtn.o sysroot/aarch64-unknown-linux-musl/lib/crtn.o
65+
cp $(OHOS_SDK_HOME)/native/llvm/lib/clang/15.0.4/lib/aarch64-linux-ohos/clang_rt.crtbegin.o sysroot/aarch64-unknown-linux-musl/lib/crtbegin.o
66+
cp $(OHOS_SDK_HOME)/native/llvm/lib/clang/15.0.4/lib/aarch64-linux-ohos/clang_rt.crtend.o sysroot/aarch64-unknown-linux-musl/lib/crtend.o
67+
cp $(OHOS_SDK_HOME)/native/llvm/lib/clang/15.0.4/lib/aarch64-linux-ohos/libclang_rt.builtins.a sysroot/aarch64-unknown-linux-musl/lib/libgcc.a
68+
# $(OHOS_SDK_HOME)/toolchains/hnpcli pack -i sysroot -n base -v 1.0
6969
cp hnp.json sysroot
7070
rm -f base.hnp
7171
zip -r base.hnp sysroot

build-hnp/aria2/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ all: download/aria2-1.37.0.tar.gz
55
mkdir -p temp build
66
cd temp && tar xvf ../download/aria2-1.37.0.tar.gz
77
cd temp/aria2-1.37.0 && mkdir build
8-
cd temp/aria2-1.37.0 && ./configure --prefix=/data/app/base.org/base_1.0 --host aarch64-unknown-linux-musl --with-openssl --without-gnutls OPENSSL_CFLAGS="-D_FORTIFY_SOURCE=2" OPENSSL_LIBS="-lssl -lcrypto" --with-sysroot=$(TOOL_HOME)/sdk/default/openharmony/native/sysroot --enable-libaria2 --with-ca-bundle=/etc/ssl/certs/cacert.pem CFLAGS="-I$(shell pwd)/../sysroot/include -D_FORTIFY_SOURCE=2 -O2 -g -pipe -fstack-protector-strong -fno-omit-frame-pointer" CPPFLAGS="-I$(shell pwd)/../sysroot/include -D_FORTIFY_SOURCE=2" LDFLAGS="-L$(shell pwd)/../sysroot/lib"
8+
cd temp/aria2-1.37.0 && ./configure --prefix=/data/app/base.org/base_1.0 --host aarch64-unknown-linux-musl --with-openssl --without-gnutls OPENSSL_CFLAGS="-D_FORTIFY_SOURCE=2" OPENSSL_LIBS="-lssl -lcrypto" --with-sysroot=$(OHOS_SDK_HOME)/native/sysroot --enable-libaria2 --with-ca-bundle=/etc/ssl/certs/cacert.pem CFLAGS="-I$(shell pwd)/../sysroot/include -D_FORTIFY_SOURCE=2 -O2 -g -pipe -fstack-protector-strong -fno-omit-frame-pointer" CPPFLAGS="-I$(shell pwd)/../sysroot/include -D_FORTIFY_SOURCE=2" LDFLAGS="-L$(shell pwd)/../sysroot/lib"
99
cd temp/aria2-1.37.0 && make -j $(shell nproc) && make install DESTDIR=$(shell pwd)/build
1010
rm -v build/data/app/base.org/base_1.0/lib/*.la
1111
mkdir -p ../sysroot
12-
#$(TOOL_HOME)/sdk/default/openharmony/native/llvm/bin/llvm-strip build/data/app/base.org/base_1.0/bin/*
12+
#$(OHOS_SDK_HOME)/native/llvm/bin/llvm-strip build/data/app/base.org/base_1.0/bin/*
1313
cp -rfv build/data/app/base.org/base_1.0/. ../sysroot | tee file.lst
1414

1515
download/aria2-1.37.0.tar.gz:

build-hnp/binutils/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ all: download/binutils-2.44.tar.xz
88
cd temp/binutils-2.44/build && ../configure --disable-static --enable-shared --without-zstd --host aarch64-unknown-linux-musl
99
cd temp/binutils-2.44/build && make -j $(shell nproc)
1010
cd temp/binutils-2.44/build && make install DESTDIR=$(shell pwd)/build
11-
$(TOOL_HOME)/sdk/default/openharmony/native/llvm/bin/llvm-strip build/usr/local/bin/*
12-
$(TOOL_HOME)/sdk/default/openharmony/native/llvm/bin/llvm-strip build/usr/local/lib/*.so
13-
$(TOOL_HOME)/sdk/default/openharmony/native/llvm/bin/llvm-strip build/usr/local/aarch64-unknown-linux-musl/bin/*
11+
$(OHOS_SDK_HOME)/native/llvm/bin/llvm-strip build/usr/local/bin/*
12+
$(OHOS_SDK_HOME)/native/llvm/bin/llvm-strip build/usr/local/lib/*.so
13+
$(OHOS_SDK_HOME)/native/llvm/bin/llvm-strip build/usr/local/aarch64-unknown-linux-musl/bin/*
1414
mkdir -p ../sysroot
1515
rm -v build/usr/local/lib/*.la
1616
cp -rfv build/usr/local/. ../sysroot | tee file.lst

build-hnp/busybox/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ all: download/busybox-1.37.0.tar.bz2
2525
cd temp/busybox-1.37.0 && /usr/bin/sed -i.bak "s/if (setgid(gid))/\\/\\//" libbb/xfuncs_printf.c
2626
cd temp/busybox-1.37.0 && /usr/bin/sed -i.bak "s/setgid(rgid)/\\/\\//" libbb/appletlib.c
2727
cd temp/busybox-1.37.0 && /usr/bin/sed -i.bak "s/setuid(ruid)/\\/\\//" libbb/appletlib.c
28-
cd temp/busybox-1.37.0 && make -j $(shell nproc) CC=$(TOOL_HOME)/sdk/default/openharmony/native/llvm/bin/aarch64-unknown-linux-ohos-clang AR=$(TOOL_HOME)/sdk/default/openharmony/native/llvm/bin/llvm-ar CFLAGS="-Wno-int-conversion" busybox_unstripped
29-
$(TOOL_HOME)/sdk/default/openharmony/native/llvm/bin/llvm-strip temp/busybox-1.37.0/busybox_unstripped
28+
cd temp/busybox-1.37.0 && make -j $(shell nproc) CC=$(OHOS_SDK_HOME)/native/llvm/bin/aarch64-unknown-linux-ohos-clang AR=$(OHOS_SDK_HOME)/native/llvm/bin/llvm-ar CFLAGS="-Wno-int-conversion" busybox_unstripped
29+
$(OHOS_SDK_HOME)/native/llvm/bin/llvm-strip temp/busybox-1.37.0/busybox_unstripped
3030
mkdir -p ../sysroot/bin
3131
cp -v temp/busybox-1.37.0/busybox_unstripped ../sysroot/bin/busybox | tee file.lst
3232

build-hnp/c-ares/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ all: download/c-ares-1.34.5.tar.gz
33
mkdir -p temp build
44
cd temp && tar xvf ../download/c-ares-1.34.5.tar.gz
55
cd temp/c-ares-1.34.5 && mkdir build
6-
cd temp/c-ares-1.34.5/build && PKG_CONFIG=/usr/bin/false CFLAGS="-O2 -g -pipe -fstack-protector-strong -fno-omit-frame-pointer" CPPFLAGS="-I$(shell pwd)/../sysroot/include -D_FORTIFY_SOURCE=2" LDFLAGS="-L$(shell pwd)/../sysroot/lib" cmake ../ -DCARES_STATIC=OFF -DCARES_SHARED=ON -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DCMAKE_C_COMPILER=$(TOOL_HOME)/sdk/default/openharmony/native/llvm/bin/aarch64-unknown-linux-ohos-clang -DCMAKE_BUILD_TYPE=RelWithDebInfo
6+
cd temp/c-ares-1.34.5/build && PKG_CONFIG=/usr/bin/false CFLAGS="-O2 -g -pipe -fstack-protector-strong -fno-omit-frame-pointer" CPPFLAGS="-I$(shell pwd)/../sysroot/include -D_FORTIFY_SOURCE=2" LDFLAGS="-L$(shell pwd)/../sysroot/lib" cmake ../ -DCARES_STATIC=OFF -DCARES_SHARED=ON -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DCMAKE_C_COMPILER=$(OHOS_SDK_HOME)/native/llvm/bin/aarch64-unknown-linux-ohos-clang -DCMAKE_BUILD_TYPE=RelWithDebInfo
77
cd temp/c-ares-1.34.5/build && make -j $(shell nproc) && make install DESTDIR=$(shell pwd)/build
88
mkdir -p ../sysroot
9-
$(TOOL_HOME)/sdk/default/openharmony/native/llvm/bin/llvm-strip build/usr/local/lib/*.so
9+
$(OHOS_SDK_HOME)/native/llvm/bin/llvm-strip build/usr/local/lib/*.so
1010
cp -rfv build/usr/local/. ../sysroot | tee file.lst
1111

1212
download/c-ares-1.34.5.tar.gz:

build-hnp/curl/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ all: download/curl-8.14.1.tar.xz
66
cd temp && tar xvf ../download/curl-8.14.1.tar.xz
77
cd temp/curl-8.14.1 && PKG_CONFIG=/usr/bin/false ./configure --host aarch64-unknown-linux-musl --without-libssh --without-libssh2 --without-libpsl --with-libidn2 --enable-ares --without-nghttp2 --without-brotli --without-zstd --without-libgsasl --enable-shared --disable-static --disable-ldap --disable-ldaps --disable-rtsp --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smtp --disable-gopher --disable-manual --disable-unix-sockets --with-ca-path=/etc/ssl/certs --with-ca-bundle=/etc/ssl/certs/cacert.pem --disable-http-auth-gssnegotiate --disable-mqtt --disable-nls --disable-proxy --enable-optimize --with-ssl CFLAGS="-O2 -g -pipe -fstack-protector-strong -fno-omit-frame-pointer" CPPFLAGS="-I$(shell pwd)/../sysroot/include -D_FORTIFY_SOURCE=2"
88
cd temp/curl-8.14.1 && make -j $(shell nproc) && make install DESTDIR=$(shell pwd)/build
9-
$(TOOL_HOME)/sdk/default/openharmony/native/llvm/bin/llvm-strip build/usr/local/bin/curl
9+
$(OHOS_SDK_HOME)/native/llvm/bin/llvm-strip build/usr/local/bin/curl
1010
mkdir -p ../sysroot
1111
rm -v build/usr/local/lib/*.la
12-
$(TOOL_HOME)/sdk/default/openharmony/native/llvm/bin/llvm-strip build/usr/local/lib/*.so
12+
$(OHOS_SDK_HOME)/native/llvm/bin/llvm-strip build/usr/local/lib/*.so
1313
cp -rfv build/usr/local/. ../sysroot | tee file.lst
1414

1515
download/curl-8.14.1.tar.xz:

build-hnp/fastfetch/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ all: download/2.45.0.tar.gz
33
mkdir -p temp build
44
cd temp && tar xvf ../download/2.45.0.tar.gz
55
cd temp/fastfetch-2.45.0 && mkdir build && /usr/bin/sed -i.bak 's|FF_HAVE_UTMPX=1|FF_HAVE_UTMPX=0|g' CMakeLists.txt
6-
cd temp/fastfetch-2.45.0/build && PKG_CONFIG=/usr/bin/false cmake ../ -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DIS_MUSL=ON -DENABLE_PCIACCESS=ON -DENABLE_SQLITE3=OFF -DENABLE_VULKAN=ON -DCMAKE_C_COMPILER=$(TOOL_HOME)/sdk/default/openharmony/native/llvm/bin/aarch64-unknown-linux-ohos-clang -DCMAKE_CXX_COMPILER=$(TOOL_HOME)/sdk/default/openharmony/native/llvm/bin/aarch64-unknown-linux-ohos-clang -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_SYSROOT=$(TOOL_HOME)/sdk/default/openharmony/native/sysroot
6+
cd temp/fastfetch-2.45.0/build && PKG_CONFIG=/usr/bin/false cmake ../ -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DIS_MUSL=ON -DENABLE_PCIACCESS=ON -DENABLE_SQLITE3=OFF -DENABLE_VULKAN=ON -DCMAKE_C_COMPILER=$(OHOS_SDK_HOME)/native/llvm/bin/aarch64-unknown-linux-ohos-clang -DCMAKE_CXX_COMPILER=$(OHOS_SDK_HOME)/native/llvm/bin/aarch64-unknown-linux-ohos-clang -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_SYSROOT=$(OHOS_SDK_HOME)/native/sysroot
77
cd temp/fastfetch-2.45.0/build && make -j $(shell nproc) && make install DESTDIR=$(shell pwd)/build
88
mkdir -p ../sysroot
99
cp -rfv build/usr/local/. ../sysroot | tee file.lst

0 commit comments

Comments
 (0)