Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Help with ebuild for luarocks torch-opencv
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
archenroot
Apprentice
Apprentice


Joined: 13 Dec 2011
Posts: 218
Location: Lake Macha, Czech republic

PostPosted: Wed Jan 04, 2017 9:31 pm    Post subject: [SOLVED] Help with ebuild for luarocks torch-opencv Reply with quote

Hi guys, could someone help me with lua rock file conversion into ebuild file?

here is the build snippet from luarocks file:
Code:
build = {
   type = "command",
   build_command = [[
cmake -E make_directory build;
cd build;
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$(LUA_BINDIR)/.." -DCMAKE_INSTALL_PREFIX="$(PREFIX)";
$(MAKE) -j5
   ]],
   install_command = "cd build && $(MAKE) install -j5"
}


Whole file available at:
https://github.com/VisionLabs/torch-opencv/blob/master/cv-scm-1.rockspec
_________________
Emperor wants to control outer space Yoda wants to explore inner space that's the fundamental difference between good and bad sides of the Force


Last edited by archenroot on Tue Jan 17, 2017 1:22 pm; edited 2 times in total
Back to top
View user's profile Send private message
kikko
Apprentice
Apprentice


Joined: 29 Apr 2014
Posts: 276
Location: Milan, IT

PostPosted: Thu Jan 05, 2017 2:46 pm    Post subject: Reply with quote

Hi archenroot
I'll try to give you some hints... I'm not so expert in ebuild writing (expecially with cmake involved...), but I hope this can help you:
  • src_configure part
    Code:
    build = {
       type = "command",
       build_command = [[
    ignore this
    ------------------------
    Code:
    cmake -E make_directory build;
    This is equivalent to
    Code:
    mkdir build

    ------------------------
    Code:
    cd build;
    cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$(LUA_BINDIR)/.." -DCMAKE_INSTALL_PREFIX="$(PREFIX)";
    This seems to descend into the build directory and launch cmake on the upper folder :?
    You can try to do the same in the src_configure phase of your ebuild, maybe you can use the cmake utils eclass
    ------------------------
  • src_compile part
    Code:
    $(MAKE) -j5
    This will launch make -j5 from the build directory? I think emake can do the same (from src_compile)
    ------------------------
    Code:
       ]],
       install_command = "cd build && $(MAKE) install -j5"
    }
    Again, this will make install -j5 from build dir? You can try to set emake install in src_install

_________________
Regards

root is the root of all evil
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30923
Location: here

PostPosted: Thu Jan 05, 2017 2:47 pm    Post subject: Reply with quote

You can try to modify one of these ebuilds.
You need also add one of archenroot or TAJJADA overlay for have torch7-9999 that it's dependency of torch-opencv.
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
archenroot
Apprentice
Apprentice


Joined: 13 Dec 2011
Posts: 218
Location: Lake Macha, Czech republic

PostPosted: Fri Jan 06, 2017 11:18 am    Post subject: Reply with quote

Thanks for hints guys!

Actually I archenroot overlay is mine :P, there is still lots of work here :-)
_________________
Emperor wants to control outer space Yoda wants to explore inner space that's the fundamental difference between good and bad sides of the Force
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30923
Location: here

PostPosted: Fri Jan 06, 2017 12:06 pm    Post subject: Reply with quote

archenroot wrote:
Actually I archenroot overlay is mine :P, there is still lots of work here :-)

Ups sorry I've not seen that was same name :oops: .
I think you can copy one of existing torch-xxx-9999, you can use cmake-utils.eclass for cmake build
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
archenroot
Apprentice
Apprentice


Joined: 13 Dec 2011
Posts: 218
Location: Lake Macha, Czech republic

PostPosted: Fri Jan 06, 2017 7:44 pm    Post subject: Good choice Reply with quote

Ok, I will look into docs and will post the finished ebuild for you guys, if you can check.

This ebuild will also help me for all the utilities inside FBLuaLIB and THPP for multipath networking support in neural networks.

Thanks for suggestions.

Ladislav
_________________
Emperor wants to control outer space Yoda wants to explore inner space that's the fundamental difference between good and bad sides of the Force
Back to top
View user's profile Send private message
archenroot
Apprentice
Apprentice


Joined: 13 Dec 2011
Posts: 218
Location: Lake Macha, Czech republic

PostPosted: Sun Jan 08, 2017 12:08 am    Post subject: Finalized ebuilds ready for check Reply with quote

Hi guys,

if you will have minute, could you please check some finalized ebuilds. There is pure LUA only and LUA + C based LUA modules from Torch stack:
https://github.com/archenroot/gentoo-overlay/blob/master/dev-lua/torch-class/torch-class-9999.ebuild
https://github.com/archenroot/gentoo-overlay/blob/master/dev-lua/torch-cwrap/torch-cwrap-9999.ebuild
https://github.com/archenroot/gentoo-overlay/blob/master/dev-lua/torch-paths/torch-paths-9999.ebuild

Thanks for comments here.

2 things I still need more to understand:
    I am not sure about lua vs luajit - even when I switch USE flag to luajit, following command still returns the same directory:
    Code:
    -DLUADIR=$($(tc-getPKG_CONFIG) --variable INSTALL_LMOD $(usex luajit 'luajit' 'lua'))

    I am not sure if this is bug or expected behavior

    The mapping between variables retreived via pkg-config (INSTALL_LMOD, etc...) to LUA variables. But in this case it will be better to talk directly to Torch guys about their coding standards..


Again thanks for any hints and comments.

Ladislav
_________________
Emperor wants to control outer space Yoda wants to explore inner space that's the fundamental difference between good and bad sides of the Force
Back to top
View user's profile Send private message
kikko
Apprentice
Apprentice


Joined: 29 Apr 2014
Posts: 276
Location: Milan, IT

PostPosted: Mon Jan 09, 2017 12:02 pm    Post subject: Reply with quote

Hi archenroot,
I've already begun to look at the ebuilds, but first of all... why use the "COMMON_DEPEND" variable?
Since those ebuilds run using Lua, I think "lua|luajit" can fit into the RDEPEND variable directly (more info here)

Second: what are you trying to get using this:
Code:
LUADIR=$($(tc-getPKG_CONFIG) --variable INSTALL_LMOD $(usex luajit 'luajit' 'lua')
?

This LUADIR variable will vary in case of lua/luajit, is that so? If you run by hand
Code:
pkg-config --variable INSTALL_LMOD lua (or luajit)
which is the output?

Furthermore, I think you can avoid the forks (every "$(...)" will open a new subshell to execute the inner code) and use something like this instead
Code:
if use luajit; then
    LUADIR=$($(tc-getPKG_CONFIG) --variable INSTALL_LMOD luajit)
else #use lua
    LUADIR=$($(tc-getPKG_CONFIG) --variable INSTALL_LMOD lua)

instino ${LUADIR} ....

(this will avoid to fork in order to check if it's lua or luajit)
_________________
Regards

root is the root of all evil
Back to top
View user's profile Send private message
archenroot
Apprentice
Apprentice


Joined: 13 Dec 2011
Posts: 218
Location: Lake Macha, Czech republic

PostPosted: Tue Jan 10, 2017 9:41 am    Post subject: Thanks for hints Reply with quote

Thank you for your suggestions first of all!

1. Well, I studied Dev guide and also existing LUA ebuilds in Gentoo stable tree, where I found usage of COMMON_DEPEND in most cases used as:
Code:
COMMON_DEPEND=">=dev-lang/lua-5.1:="


I will read more on the link you provided me with.

2. In the moment LUA and LUAJIT directories are for both the same, but possibly could be separated in future, so I better split them from the very first moment. I totally agree that it has not big sense in the current situation with LUA subsystem :-)

3. Using if else to avoid the forks. I totaly agree and will change the ebuild in this way.

Thanks a lot again! :D
_________________
Emperor wants to control outer space Yoda wants to explore inner space that's the fundamental difference between good and bad sides of the Force
Back to top
View user's profile Send private message
archenroot
Apprentice
Apprentice


Joined: 13 Dec 2011
Posts: 218
Location: Lake Macha, Czech republic

PostPosted: Tue Jan 10, 2017 9:46 am    Post subject: Reply with quote

I also had an idea about creating some Gentoo wrapper for Luarocks. As soon as there are all these Lua applications/frameworks available in *.rock format, such wrapper could just execute it in Gentoo way, but not sure if that is good idea to investigate...
_________________
Emperor wants to control outer space Yoda wants to explore inner space that's the fundamental difference between good and bad sides of the Force
Back to top
View user's profile Send private message
archenroot
Apprentice
Apprentice


Joined: 13 Dec 2011
Posts: 218
Location: Lake Macha, Czech republic

PostPosted: Tue Jan 17, 2017 1:21 pm    Post subject: Reply with quote

Just posting here the completed build working:
https://github.com/archenroot/gentoo-overlay/blob/master/sci-libs/torch-opencv/torch-opencv-9999.ebuild
_________________
Emperor wants to control outer space Yoda wants to explore inner space that's the fundamental difference between good and bad sides of the Force
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum