[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Introduce wrapper package of linuxbrew into Debian



Hi Gianfranco Costamagna,

On Sun, 2015-08-16 at 07:26 +0000, Gianfranco Costamagna wrote:
> yes, this is not a problem, and this is already done locally (manually) by many
> folks.
> 
> But who will take care of "packaging bug x for package y installed with linuxbrew?"

Such "packaging bug" is upstream bug, and is handled by Homebrew 
and Linuxbrew upstream. And files made that trouble was not provided
by Debian package ......

After the Linuxbrew maintainer updated linuxbrew or fixed bugs
of linuxbrew, users run brew update to trigger git to pull
updated contents.

> as a maintainer I would like to avoid people opening bugs against my packages
> if the bugs are in the linuxbrew packaging recipes.

I think the same with you, as the problem is from files that lives
outside of Debian package.

> I meant, where "brew install x" will put the x installed files?

Well, here is an example which installs openssl with linuxbrew:

$ brew list openssl
/home/lumin/.linuxbrew/Cellar/openssl/1.0.2d_1/bin/c_rehash
/home/lumin/.linuxbrew/Cellar/openssl/1.0.2d_1/bin/openssl
/home/lumin/.linuxbrew/Cellar/openssl/1.0.2d_1/include/openssl/ (75 files)
/home/lumin/.linuxbrew/Cellar/openssl/1.0.2d_1/lib/engines/ (12 files)
/home/lumin/.linuxbrew/Cellar/openssl/1.0.2d_1/lib/pkgconfig/ (3 files)
/home/lumin/.linuxbrew/Cellar/openssl/1.0.2d_1/lib/ (6 files)
/home/lumin/.linuxbrew/Cellar/openssl/1.0.2d_1/share/man/ (1542 files)

Contents of every package installed by linuxbrew are stored at
.linuxbrew/Cellar/ and are separated by package name:

$ pwd
/home/lumin/.linuxbrew/Cellar
$ ls -F
jpeg/  makedepend/  openssl/  pkg-config/  unzip/  zlib/

Besides, linuxbrew will symlink executables, libs, dev-files into
.linuxbrew/{bin,lib,include} directories, e.g.

.linuxbrew/lib $ ls -Fl

total 4
lrwxrwxrwx 1 lumin lumin   38 Aug 17 05:27 engines -> ../Cellar/openssl/1.0.2d_1/lib/engines/
lrwxrwxrwx 1 lumin lumin   12 Aug 17 06:20 libcanyoufindme.so -> libcrypto.so
lrwxrwxrwx 1 lumin lumin   12 Aug 17 06:19 libccrr.so -> libcrypto.so
lrwxrwxrwx 1 lumin lumin   42 Aug 17 05:27 libcrypto.a -> ../Cellar/openssl/1.0.2d_1/lib/libcrypto.a
lrwxrwxrwx 1 lumin lumin   43 Aug 17 05:27 libcrypto.so -> ../Cellar/openssl/1.0.2d_1/lib/libcrypto.so
lrwxrwxrwx 1 lumin lumin   49 Aug 17 05:27 libcrypto.so.1.0.0 -> ../Cellar/openssl/1.0.2d_1/lib/libcrypto.so.1.0.0

> You install a library x, and you want to link with your code z,
> how do you make your build system aware of x location?
> 
> assuming x is installed somewhere in home/.linuxbrew/.apps/x/usr/lib/libx.so

We can confirm that GCC and LD with default configuration 
will never grab user's home for headers and libs except specified.
Hence in order to "make build system aware of x location",
we must pass -I -L -l arguments to compilers.

Please take a look at this example profile added several minutes ago:
http://anonscm.debian.org/cgit/users/cdluminate-guest/linuxbrew-wrapper.git/tree/debian/example/profile
This is my idea for handling that issue.

For example if I want to compile a small program [1], which
should be linked with brew-installed openssl:

$ source that example profile
$ gcc md5bin.c -I$BREW_INCLUDE -L$BREW_LIB -lcanyoufindme
( here I symlinked libcanyoufindme.so -> libcrypto.so to )
( make sure it is not linked with my system openssl.     )

And it just works.
the wrapped BREW_LIB and BREW_INCLUDE are more convenient
than hardcoded -L -l and -I arguments.

> Do the user need to override build flags to make "x" found by the compiler?

As following example, users should append extra flags to compiler,
and the way showed above is currently the simplest way I know.

> Nope, I mean the answer above. Installing a user package is fine, just install it
> and find the binary file to run it
> 
> Installing a library is not so trivial, because you need to make your compiler
> aware of the location and use it.

With this wrapper the only thing user need to do is to add ENV into there
.bashrc .zshrc or profile. (sed'ing user's rc files is extremely bad)
the BREW_INCLUDE and BREW_LIB is my solution on this library problem.

> Thanks to you for packaging it!

Just for fun :-)
Please note that, the updated package was uploaded to mentors:
http://mentors.debian.net/package/linuxbrew-wrapper
http://mentors.debian.net/debian/pool/main/l/linuxbrew-wrapper/linuxbrew-wrapper_20150804-1.dsc

> I really would like to have something brew similar to linux,
> but I would like to create a mess for other packages, and screw
> up the user system :)

Maybe even worse when making Linux From Scratch ...

Thank you Gianfranco Costamagna :-)


[1] small program which need libcrypto.so from openssl
----------------------------------------------------
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/md5.h>

int
main (int argc, char **argv)
{
	char md[16];
	unsigned char * string = "Debian";
	MD5 (string, strlen(string), (unsigned char *)md);
	write (1, md, 16);
	return 0;
}
-------------------------------------------------------------

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: