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

wordgrinder: init at 0.6 #20607

Merged
merged 1 commit into from Nov 3, 2017
Merged

Conversation

matthiasbeyer
Copy link
Contributor

Does not build yet, as lua5.2 is not found. Can someone help me? I'm not sure why it isn't found here...

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@matthiasbeyer
Copy link
Contributor Author

I'm still interested here... can someone tell me how to properly bring lua in scope?

@ericsagnes
Copy link
Contributor

Does not build yet, as lua5.2 is not found. Can someone help me? I'm not sure why it isn't found here...

It seems that wordgrinder makefile is making some assumptions about where to find lua. Setting the correct environment variables might fix the problem.

@@ -0,0 +1,27 @@
{ stdenv, fetchurl, pkgs }:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer explicit dependencies over bringing pkgs.

version = "0.6";
name = "wordgrinder-${version}";

src = fetchurl {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fetchFromGitHub can be also used.

meta = {
homepage = "http://cowlark.com/wordgrinder";
description = "Text-based word processor";
license = stdenv.lib.licenses.mit; # not sure, though
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is MIT.

@matthiasbeyer
Copy link
Contributor Author

Well, now it builds but the tests do not run successfully... But I guess we can investigate a bit further now.

I also updates the package to latest master of the upstream repo, because master contains some changes to the build setup which make packaging a lot easier (IMHO). Also, the 0.6 release is old (2015) - I will update this package to a new release as soon as there is one and then follow the normal releases

If you're all okay with that.

@matthiasbeyer
Copy link
Contributor Author

Can someone help me here? I fail to bring lua in scope properly, it seems.

I just re-pushed the branch based on my latest master, ... and squashed the fixes.

@matthiasbeyer
Copy link
Contributor Author

backtrace, for the lazy:

[...]
CC .obj/lj_n/debug/src/c/lfs/lfs.o
LINK bin/wordgrinder-debug
TEST tests/apply-markup.lua
Lua error: [string "src/lua/_prologue.lua"]:54: read from undefined local 'loadstring'
stack traceback:
        [C]: in function 'error'
        [string "src/lua/_prologue.lua"]:54: in function '__index'
        [string "src/lua/xpattern.lua"]:27: in main chunk
make: *** [Makefile:470: .obj/lj_n/tests/apply-markup.lua.passed] Error 1
builder for ‘/nix/store/0pr46jf98ra525np4l9rrjwyvm5lsgj0-wordgrinder-2016-11-29.drv’ failed with exit code 2
error: build of ‘/nix/store/0pr46jf98ra525np4l9rrjwyvm5lsgj0-wordgrinder-2016-11-29.drv’ failed

@matthiasbeyer
Copy link
Contributor Author

Can someone give some love here? Maybe @ericsagnes ?

@c0bw3b
Copy link
Contributor

c0bw3b commented Mar 21, 2017

@matthiasbeyer I took a quick test at building this (v0.6).
It does find Lua lib and builds the bin by replacing your buildPhase with :

makeFlags = [
  "LUA_INCLUDE=${lua52Packages.lua}/include"
  "LUA_LIB=${lua52Packages.lua}/lib/liblua.so"
];

But then it fails running the tests (end of the Makefile) :

TEST tests/apply-markup.lua
Lua error: [string "src/lua/_prologue.lua"]:54: read from undefined local 'loadstring'
stack traceback:
        [C]: in function 'error'
        [string "src/lua/_prologue.lua"]:54: in function '__index'
        [string "src/lua/xpattern.lua"]:27: in main chunk
make: *** [Makefile:458: .obj/lj_n/tests/apply-markup.lua.passed] Error 1
builder for ‘/nix/store/f0hmpdaam62amw10mld7cqawvwr819yc-wordgrinder-0.6.drv’ failed with exit code 2
error: build of ‘/nix/store/f0hmpdaam62amw10mld7cqawvwr819yc-wordgrinder-0.6.drv’ failed

I haven't tried building the latest master though.

Plus : I'm pretty sure the generic builder already set --PREFIX=$out so the installPhase may be redundant.

@matthiasbeyer
Copy link
Contributor Author

After watching Bryan Lunduke talk about wordgrinder, I really want this to happen here.

And I guess I'm almost there, it just does not find Xft:

[...]
CC .obj/lj_n/release-x11/src/c/lua.o
CC .obj/lj_n/release-x11/src/c/word.o
CC .obj/lj_n/release-x11/src/c/screen.o
CC .obj/lj_n/release-x11/.obj/lj_n/luascripts.o
CC .obj/lj_n/release-x11/src/c/arch/unix/x11/x11.o
In file included from src/c/arch/unix/x11/x11.c:13:0:
src/c/arch/unix/x11/x11.h:10:21: fatal error: Xft/Xft.h: No such file or directory
 #include <Xft/Xft.h>
                     ^
compilation terminated.
make: *** [Makefile:360: .obj/lj_n/release-x11/src/c/arch/unix/x11/x11.o] Error 1
builder for ‘/nix/store/gwc952k40qb9w4jhrb0vgwixp6pfj18m-wordgrinder-2017-04-18.drv’ failed with exit code 2
error: build of ‘/nix/store/gwc952k40qb9w4jhrb0vgwixp6pfj18m-wordgrinder-2017-04-18.drv’ failed

@matthiasbeyer
Copy link
Contributor Author

Suggestions? Anyone?

@c0bw3b
Copy link
Contributor

c0bw3b commented Oct 15, 2017

This builds and runs both ncurses and X11 programs :

{ stdenv, fetchFromGitHub, pkgconfig, makeWrapper
, lua52Packages, libXft, ncurses, readline, zlib }:

stdenv.mkDerivation rec {
  name = "wordgrinder-${version}";
  version = "0.6-db14181";

  src = fetchFromGitHub {
    repo = "wordgrinder";
    owner = "davidgiven";
    rev = "db141815e8bd1da6e684a1142a59492e516f3041";
    sha256 = "1l1jqzcqiwnc8r1igfi7ay4pzzhdhss81znnmfr4rc1ia8bpdjc2";
  };
  
  makeFlags = [
    "PREFIX=$(out)"
    "LUA_INCLUDE=${lua52Packages.lua}/include"
    "LUA_LIB=${lua52Packages.lua}/lib/liblua.so"
  ];
  
  nativeBuildInputs = [ pkgconfig makeWrapper ];
  
  buildInputs = [
    libXft
    lua52Packages.lua
    ncurses
    readline
    zlib
  ];
  
  # To be able to find <Xft.h>
  NIX_CFLAGS_COMPILE = "-I${libXft.dev}/include/X11";
  
  # Binaries look for LuaFileSystem library (lfs.so) at runtime
  postInstall = ''
    wrapProgram $out/bin/wordgrinder --set LUA_CPATH "${lua52Packages.luafilesystem}/lib/lua/5.2/lfs.so";
    wrapProgram $out/bin/xwordgrinder --set LUA_CPATH "${lua52Packages.luafilesystem}/lib/lua/5.2/lfs.so";
  '';
  
  meta = with stdenv.lib; {
    description = "Text-based word processor";
    homepage = https://cowlark.com/wordgrinder;
    license = licenses.mit;
    maintainers = with maintainers; [ matthiasbeyer ];
    platforms = with stdenv.lib.platforms; linux;
  };
}

It's the latest commit before the author started using ninja-build but the program still says v0.6 once built. Hence the version name 0.6-db14181 in there.

@matthiasbeyer : you can take this and make it your own, I don't mind.
It's Sunday and I'm too lazy to push my own PR... :p

@matthiasbeyer
Copy link
Contributor Author

@c0bw3b I love you ❤️

I will test this out and push as soon as I tested it! Thank you very much!

@matthiasbeyer
Copy link
Contributor Author

It works beautifully and I can't wait to start using it! @c0bw3b ❤️

@matthiasbeyer
Copy link
Contributor Author

@ericsagnes @c0bw3b @falsifian ... this is still not merged? Can someone please merge this?

@dezgeg dezgeg merged commit 208fd87 into NixOS:master Nov 3, 2017
@matthiasbeyer matthiasbeyer deleted the add-wordgrinder branch November 3, 2017 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants