From f2be9bae390151bef10075f32a046343e9ecec84 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 19 Mar 2024 13:50:54 +0800 Subject: [PATCH] add nim (#3559) * add nim * install which on fedora --------- Co-authored-by: c8ef --- .github/workflows/fedora.yml | 2 +- packages/n/nim/xmake.lua | 40 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 packages/n/nim/xmake.lua diff --git a/.github/workflows/fedora.yml b/.github/workflows/fedora.yml index 8c555c3b3..94de85c5c 100644 --- a/.github/workflows/fedora.yml +++ b/.github/workflows/fedora.yml @@ -22,7 +22,7 @@ jobs: - name: Installation run: | uname -a - dnf -y install gfortran p7zip + dnf -y install gfortran p7zip which dnf -y install mesa-libGL-devel mesa-libGLU-devel dnf -y install @development-tools @rpm-development-tools dnf -y install copr-cli make gcc-c++ libatomic libcxx-devel diff --git a/packages/n/nim/xmake.lua b/packages/n/nim/xmake.lua new file mode 100644 index 000000000..1cbcd9c42 --- /dev/null +++ b/packages/n/nim/xmake.lua @@ -0,0 +1,40 @@ +package("nim") + set_kind("toolchain") + set_homepage("https://nim-lang.org/") + set_description("Nim is a statically typed compiled systems programming language") + + local precompiled = false + if is_host("windows") then + if os.arch() == "x86" then + add_urls("https://nim-lang.org/download/nim-$(version)_x32.zip") + add_versions("2.0.2", "d076d35fdab29baf83c66f1135a1fd607eb61d4c14037706f7be3ba58fb83d87") + precompiled = true + elseif os.arch() == "x64" then + add_urls("https://nim-lang.org/download/nim-$(version)_x64.zip") + add_versions("2.0.2", "948dbf8e3fdd1b5242e3d662fd25c50e9b2586e097be8a85c22d7db2bde70bad") + precompiled = true + end + end + if not precompiled then + add_urls("https://github.com/nim-lang/Nim/archive/refs/tags/v$(version).tar.gz") + add_versions("2.0.2", "2ca2f559d05e29f130cb4f319ebb93a98e7c0e2187716b17b2cb4e747f5ff798") + end + + on_install("@windows", "@msys", function (package) + os.cp("*", package:installdir()) + end) + + on_install("@windows|arm64", function (package) + os.vrunv("./build_all.bat", {}, {shell = true}) + os.cp("bin", package:installdir()) + end) + + on_install("@macosx", "@linux", function (package) + os.vrunv("./build_all.sh", {}, {shell = true}) + os.cp("bin", package:installdir()) + end) + + on_test(function (package) + os.vrun("nim --version") + os.vrun("nimble --version") + end)