LINUX.ORG.RU

прошу помощи с созданием пакета для NixOS

 , , , ,


0

1

Нужно собрать ksh.

Написал вот такой вот ksh/default/nix:

{ stdenv, fetchurl, meson, ninja, fetchFromGitHub, gcc-unwrapped}:

stdenv.mkDerivation rec {
  name = "ksh-${version}";
  version = "93v";

  src = fetchFromGitHub {
    owner  = "att";
    repo   = "ast";
    rev    = "b8d88244ae87857e7bbd6da230ffbbc51165df70";
    sha256 = "12kf14n8vz36hnsy3wp6lnyv1841p7hcq25y1d78w532dil69lx9";
};

  doCheck = true;

#  unpackPhase = true;

  nativeBuildInputs = [ meson ninja gcc-unwrapped ];
  BuildInputs = [ meson ninja gcc-unwrapped ];

  meta = with stdenv.lib; {
    description = "KornShell Command And Programming Language";
    longDescription = ''
      The KornShell language was designed and developed by David G. Korn at
      AT&T Bell Laboratories. It is an interactive command language that
      provides access to the UNIX system and to many other systems, on the
      many different computers and workstations on which it is implemented. 
    '';
    homepage = http://www.kornshell.com/i;
    license = licenses.cpl;
    maintainers = with maintainers; [ ];
    platforms = platforms.all;
  };

  passthru = {
    shellPath = "/bin/ksh";
  };
}


В GitHub ksh (https://github.com/att/ast) сказано:


Building ksh requires the Meson build system. To build ksh execute these commands from the project root directory:

meson build
ninja -C build


You can add a --prefix flag followed by a path to the meson build command to specify where the binaries and libraries are installed. The default is /usr/local.

Installing

The ksh executable, helper libraries and man page can be installed with:

ninja -C build install



После запуска установки

$ nix-env -f . -iA ksh

Сборка начинается,
 meson build

отрабатывает. Затем появляется ошибка:

src/lib/libast/meson.build:20:0: ERROR:  File /build/source/build/src/lib/libast/comp/conftab.c does not exist.

A full log can be found at /build/source/build/meson-logs/meson-log.txt
builder for '/nix/store/2y1r2bpi0yjcpaw9fcygd9f7fzrd9xwv-ksh-93v.drv' failed with exit code 1
error: build of '/nix/store/2y1r2bpi0yjcpaw9fcygd9f7fzrd9xwv-ksh-93v.drv' failed


Все сообщения выводимые при сборке здесь: https://pastebin.com/8A20WxnS

Добраться до полного лога сборки /build/source/build/meson-logs/meson-log.txt не представляется возможным. Или я не знаю, как это сделать.

Пробовал провести сборку в VM с Ubuntu, там всё собирается без ошибок. С помощью strace узнал, что файл source/build/src/lib/libast/comp/conftab.c должен создаваться в процессе ninja -C, то есть meson отрабатывает нормально. Куда копать дальше я не знаю.

Deleted

Ответ на: комментарий от Deleted

Тупо скопипастил текст .nix файла для ksh. Этот вариант начал собираться, но вывалился с ошибкой

nmake --base --compile '--file=/build/source/src/cmd/nmake/Makerules.mk'
/bin/sh: nmake: not found
mamake [cmd/nmake]: *** exit code 127 making Makerules.mo
mamake: *** exit code 1 making cmd/nmake
package: make: errors making /build/source/arch/linux.i386-64/bin/nmake
package: make done at Sat Jan 5 20:32:23 UTC 2019 in /build/source/arch/linux.i386-64
installing
mv: cannot stat 'arch/linux.i386-64/bin/ksh': No such file or directory
builder for '/nix/store/2jrvxhm0k4zanah8bq7ay0wd1hd7w6mj-ksh-2012-08-01.drv' failed with exit code 1
error: build of '/nix/store/2jrvxhm0k4zanah8bq7ay0wd1hd7w6mj-ksh-2012-08-01.drv' failed


Не могу понять в каком пакете должен быть установлен nmake.

Deleted
()
Ответ на: комментарий от Deleted

Ну все. Сломалось :-( Года два назад еще собиралось

Deleted
()
Ответ на: комментарий от Deleted

добавь в свой вариант python и which в зависимости, продвинешься дальше

Deleted
()

Мимопробегал

Удивлён, что ksh перешёл не на богомерзкий CMake, а на более-менее нормальный Meson.

Так победим!

EXL ★★★★★
()

Шапку поправь сам. doCheck я убрал, потому что в тестах много FHS, они сфейлятся.

with import <nixpkgs> {}; 

stdenv.mkDerivation rec {
  name = "ksh-${version}";
  version = "93v";

  src = fetchFromGitHub {
    owner  = "att";
    repo   = "ast";
    rev    = "b8d88244ae87857e7bbd6da230ffbbc51165df70";
    sha256 = "12kf14n8vz36hnsy3wp6lnyv1841p7hcq25y1d78w532dil69lx9";
  };

  nativeBuildInputs = [ meson ninja which python ];

  meta = with stdenv.lib; {
    description = "KornShell Command And Programming Language";
    longDescription = ''
      The KornShell language was designed and developed by David G. Korn at
      AT&T Bell Laboratories. It is an interactive command language that
      provides access to the UNIX system and to many other systems, on the
      many different computers and workstations on which it is implemented. 
    '';
    homepage = http://www.kornshell.com/i;
    license = licenses.cpl;
    maintainers = with maintainers; [ ];
    platforms = platforms.all;
  };

  passthru = {
    shellPath = "/bin/ksh";
  };
}
Deleted
()
Ответ на: комментарий от Deleted

Спасибо! Вот такой код заработал:

{ stdenv, fetchurl, meson, ninja, fetchFromGitHub, gcc-unwrapped, which, python }:

with import <nixpkgs> {}; 

stdenv.mkDerivation rec {
  name = "ksh-${version}";
  version = "93v";

  src = fetchFromGitHub {
    owner  = "att";
    repo   = "ast";
    rev    = "b8d88244ae87857e7bbd6da230ffbbc51165df70";
    sha256 = "12kf14n8vz36hnsy3wp6lnyv1841p7hcq25y1d78w532dil69lx9";
  };

  nativeBuildInputs = [ meson ninja which python ];

  meta = with stdenv.lib; {
    description = "KornShell Command And Programming Language";
    longDescription = ''
      The KornShell language was designed and developed by David G. Korn at
      AT&T Bell Laboratories. It is an interactive command language that
      provides access to the UNIX system and to many other systems, on the
      many different computers and workstations on which it is implemented. 
    '';
    homepage = http://www.kornshell.com/i;
    license = licenses.cpl10;
    maintainers = with maintainers; [ ];
    platforms = platforms.all;
  };

  passthru = {
    shellPath = "/bin/ksh";
  };
}

Deleted
()
Ответ на: комментарий от NeXTSTEP

Они же на сандбоксы перешли по дефолту. Можно пробовать это

breakpointHook

This hook will make a build pause instead of stopping when a failure happen. It prevents nix from cleaning up the build environment immediatly and allows the user to attach to a build environment using the cntr command. On build error it will print the instruction that are neccessary for cntr. Installing cntr and running the command will provide shell access to the build sandbox of failed build. At /var/lib/cntr the sandbox filesystem is mounted. All commands and files of the system are still accessible within the shell. To execute commands from the sandbox use the cntr exec subcommand. Note that cntr also needs to be executed on the machine that is doing the build, which might be not the case when remote builders are enabled. cntr is only supported on linux based platforms.

Deleted
()
Ответ на: комментарий от Deleted

В апстрим закинуть не забудь.

Не бойся, это не бюрократы как в Debian, и не токсичные самодуры из Gentoo. В NixOS некоторые pull request принимают за час.

anonymous
()
Ответ на: комментарий от anonymous

Хорошо написано. Запилил Pull Request. Спасибо за ссылку.

Deleted
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.