Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unilang: init at 0.13 #326527

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16845,6 +16845,12 @@
name = "Roland Conybeare";
keys = [ { fingerprint = "bw5Cr/4ul1C2UvxopphbZbFI1i5PCSnOmPID7mJ/Ogo"; } ];
};
rc-zb = {
name = "rczb";
email = "rc-zb@outlook.com";
github = "rc-zb";
githubId = 161540043;
};
rdnetto = {
email = "rdnetto@gmail.com";
github = "rdnetto";
Expand Down
115 changes: 115 additions & 0 deletions pkgs/by-name/un/unilang/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
lib,
stdenv,
fetchFromGitHub,
libffi,
qt5,
lld,
parallel,
pkg-config,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "unilang";
version = "0.13";

src = fetchFromGitHub {
rc-zb marked this conversation as resolved.
Show resolved Hide resolved
owner = "linuxdeepin";
repo = "unilang";
rev = "V" + finalAttrs.version;
hash = "sha256-GWY9FtbX3+FrxRSKWPcJKXm43tWF6AHggjaLr3YtN/8=";
fetchSubmodules = true;
};

nativeBuildInputs = [
lld
parallel
pkg-config
qt5.qtbase
qt5.qtdeclarative
qt5.wrapQtAppsHook
];

patchPhase = ''
runHook prePatch
# `std.txt` is a component of Unilang installation, and must be kept in the output.
substituteInPlace ./src/Main.cpp \
--replace-fail \"std.txt\" \"$out/lib/std.txt\"
# Trim the shabang.
sed --in-place --expression='1{/^#!/d}' ./build.sh
runHook postPatch
'';

postPatch = ''
# Trim the shabang.
sed --in-place --expression='1{/^#!/d}' ./test.sh
# Change the paths of test logs.
mkdir -p ./test
substituteInPlace ./test.sh \
--replace-fail =/tmp/out =$(pwd)/test/out.log \
--replace-fail =/tmp/err =$(pwd)/test/err.log
'';

buildPhase = ''
runHook preBuild
export Unilang_Output=$out/bin/unilang
export Unilang_BuildDir=$(pwd)/build/
export UNILANG_NO_LLVM=0; # LLVM-based JIT is disabled for lack of LLVM 7.
export LDFLAGS=-fuse-ld=lld
./build.sh
runHook postBuild
'';

installPhase = ''
runHook preInstall
mkdir -p $out/lib
cp ./std.txt $out/lib/
runHook postInstall
'';

doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
export UNILANG=$out/bin/unilang
./test.sh
runHook postInstallCheck
'';

qtWrapperArgs =
let
runtimeLibPath = lib.strings.makeLibraryPath [
libffi
qt5.qtbase
qt5.qtdeclarative
stdenv.cc.cc.lib
];
in
[ "--suffix LD_LIBRARY_PATH : ${runtimeLibPath}" ];

meta = {
description = "General purpose programming language";
longDescription = ''
Unilang is a general purpose programming language project proposed to
adapt to more effective and flexible development of desktop environment
applications.
'';
homepage = "https://github.com/linuxdeepin/unilang/";
changelog =
# Currently zh-CN only.
"https://github.com/linuxdeepin/unilang/raw/V${finalAttrs.version}/ReleaseNotes.zh-CN.md";
license = lib.licenses.bsd2Patent;
maintainers = with lib.maintainers; [ rc-zb ];
mainProgram = "unilang";
platforms = lib.platforms.linux;
};
})