diff options
author | CoprDistGit <infra@openeuler.org> | 2025-02-15 15:10:17 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2025-02-15 15:10:17 +0000 |
commit | 948fc374048c4df1a201ba54f8c0443c63a6fbe7 (patch) | |
tree | 770f6fed3c425b7e58d177eaa3bd9a614393034f | |
parent | 358985f4832836270d88f194846718fe75aa7996 (diff) |
automatic import of hello-cangjie-eur
-rw-r--r-- | hello_cangjie_eur.spec | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/hello_cangjie_eur.spec b/hello_cangjie_eur.spec index 0a05e69..696d430 100644 --- a/hello_cangjie_eur.spec +++ b/hello_cangjie_eur.spec @@ -6,6 +6,7 @@ License: MIT Source: https://github.com/stevending1st/%{name}/archive/refs/tags/v%{version}.tar.gz BuildRequires: wget, dnf-plugins-core, binutils, glibc-devel, gcc-c++, openssl +Requires(pre): wget %description A demo for Cangjie and Eur. @@ -18,8 +19,8 @@ A demo for Cangjie and Eur. %global download_url "https://cangjie-lang.cn/v1/files/auth/downLoad?nsId=142267&fileName=Cangjie-0.53.13-linux_x64.tar.gz&objectKey=6719f1eb3af6947e3c6af327" %endif -%ifarch aarch64 armv7hl armv7l -# 这里的指令仅在 ARM 架构下运行(这里包括了32位和64位) +%ifarch aarch64 +# 这里的指令仅在 ARM 架构下运行 %global download_url "https://cangjie-lang.cn/v1/files/auth/downLoad?nsId=142267&fileName=Cangjie-0.53.13-linux_aarch64.tar.gz&objectKey=6719f1ec3af6947e3c6af328" %endif @@ -51,6 +52,44 @@ cjpm install --root %{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch} rm -rf %{buildroot} +%pre +# 根据环境设置下载地址 +%ifarch x86_64 +# 这里的指令仅在 x86_64 架构下运行 + %global download_url "https://cangjie-lang.cn/v1/files/auth/downLoad?nsId=142267&fileName=Cangjie-0.53.13-linux_x64.tar.gz&objectKey=6719f1eb3af6947e3c6af327" +%endif + +%ifarch aarch64 +# 这里的指令仅在 ARM 架构下运行 + %global download_url "https://cangjie-lang.cn/v1/files/auth/downLoad?nsId=142267&fileName=Cangjie-0.53.13-linux_aarch64.tar.gz&objectKey=6719f1ec3af6947e3c6af328" +%endif + +cd %{_libdir} + +# 检查文件是否存在,并设置一个宏 +if [ ! -f %{_libdir}/Cangjie-0.53.13-linux.tar.gz ]; then + wget -O Cangjie-0.53.13-linux.tar.gz %{download_url} +fi + +tar xvf Cangjie-0.53.13-linux.tar.gz +rm -rf Cangjie-0.53.13-linux.tar.gz + +echo "source %{_libdir}/cangjie/envsetup.sh" >> ~/.bashrc + + +%post +echo "alias main='/usr/bin/%{name}'" >> ~/.bashrc + + +%postun +rm -rf %{_libdir}/cangjie +rm -rf /usr/bin/%{name} +rm -rf /bin/%{name} + +sed -i '\|source .*/cangjie/envsetup.sh|d' ~/.bashrc +sed -i "\|alias main='/usr/bin/%{name}'|d" ~/.bashrc + + %files # %license add-license-file-here # %doc add-docs-here @@ -61,3 +100,5 @@ rm -rf %{buildroot} %changelog * Thu Jan 02 2025 stevending1st <stevending1st@163.com> Project init. +* Sat Feb 15 2025 stevending1st <stevending1st@163.com> +Add pre, post and postun script. |