public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Finding the SONAME for bzip2
@ 2010-10-13 15:15 Al
  2010-10-13 15:50 ` R: " Marco Atzeri
  2010-10-13 17:04 ` Charles Wilson
  0 siblings, 2 replies; 7+ messages in thread
From: Al @ 2010-10-13 15:15 UTC (permalink / raw)
  To: cygwin

Hello,

I want to adapt the Makefile of bzip2 for cygwin and I want to
understand enough of what I am doing.

This are the lines of interest from the Linux Makefile:

BIGFILES=-D_FILE_OFFSET_BITS=64
CFLAGS+=-fpic -fPIC -Wall -Winline $(BIGFILES)
SOEXT=so
SONAME=libbz2.${SOEXT}.1
SOLDFLAGS=-shared -Wl,-soname -Wl,$(SONAME)

$(CC) $(LDFLAGS) $(SOLDFLAGS) -o libbz2.${SOEXT}.1.0.5 $(OBJS)
$(CC) $(LDFLAGS) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.${SOEXT}.1.0.5


What would by the appropriate adaption for Cygwin?

I would try with this as a bare minimum, but then I loose all the versioning:

CFLAGS+=-Wall
SONAME=
SOLDFLAGS=-shared

$(CC) $(LDFLAGS) $(SOLDFLAGS) -o cygbz2.dll $(OBJS)
$(CC) $(LDFLAGS) $(CFLAGS) -o bzip2-shared bzip2.c cygbz2.dll

Then the cygwin doc [1] suggests some other flags but no soname at all:

gcc -shared -o cyg${module}.dll \
    -Wl,--out-implib=lib${module}.dll.a \
    -Wl,--export-all-symbols \
    -Wl,--enable-auto-import \
    -Wl,--whole-archive ${old_libs} \
    -Wl,--no-whole-archive ${dependency_libs}

Al

[1] http://www.cygwin.com/cygwin-ug-net/dll.html

-- 
Caution crosser:  Runnig Gentoo/Prefix on Cygwin/Vista.
All stupid questions are related to that context.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* R: Finding the SONAME for bzip2
  2010-10-13 15:15 Finding the SONAME for bzip2 Al
@ 2010-10-13 15:50 ` Marco Atzeri
  2010-10-13 16:03   ` Al
  2010-10-13 17:04 ` Charles Wilson
  1 sibling, 1 reply; 7+ messages in thread
From: Marco Atzeri @ 2010-10-13 15:50 UTC (permalink / raw)
  To: cygwin

--- Mer 13/10/10, Al  ha scritto:

> Hello,
> 
> I want to adapt the Makefile of bzip2 for cygwin and I want
> to
> understand enough of what I am doing.

have you checked the bzip2 source package for cygwin ?
I presume the mantainer already solved it

> 
> This are the lines of interest from the Linux Makefile:
> 
> BIGFILES=-D_FILE_OFFSET_BITS=64
> CFLAGS+=-fpic -fPIC -Wall -Winline $(BIGFILES)
> SOEXT=so
> SONAME=libbz2.${SOEXT}.1
> SOLDFLAGS=-shared -Wl,-soname -Wl,$(SONAME)
> 
> $(CC) $(LDFLAGS) $(SOLDFLAGS) -o libbz2.${SOEXT}.1.0.5
> $(OBJS)

usually we should have
             -o cygbz2-1.dll

(as you can see on libbz2_1 package)

as the version is before the .dll
due to some windows limitations ;-)

> $(CC) $(LDFLAGS) $(CFLAGS) -o bzip2-shared bzip2.c
> libbz2.${SOEXT}.1.0.5
> 
> 
> What would by the appropriate adaption for Cygwin?
> 
> I would try with this as a bare minimum, but then I loose
> all the versioning:
> 
> CFLAGS+=-Wall
> SONAME=
> SOLDFLAGS=-shared
> 
> $(CC) $(LDFLAGS) $(SOLDFLAGS) -o cygbz2.dll $(OBJS)
> $(CC) $(LDFLAGS) $(CFLAGS) -o bzip2-shared bzip2.c
> cygbz2.dll
> 
> Then the cygwin doc [1] suggests some other flags but no
> soname at all:
> 
> gcc -shared -o cyg${module}.dll \
>     -Wl,--out-implib=lib${module}.dll.a \
>     -Wl,--export-all-symbols \
>     -Wl,--enable-auto-import \
>     -Wl,--whole-archive ${old_libs} \
>     -Wl,--no-whole-archive ${dependency_libs}
> 
> Al
> 
> [1] http://www.cygwin.com/cygwin-ug-net/dll.html
> 






--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Finding the SONAME for bzip2
  2010-10-13 15:50 ` R: " Marco Atzeri
@ 2010-10-13 16:03   ` Al
  2010-10-13 17:23     ` Charles Wilson
  0 siblings, 1 reply; 7+ messages in thread
From: Al @ 2010-10-13 16:03 UTC (permalink / raw)
  To: cygwin

> have you checked the bzip2 source package for cygwin ?
> I presume the mantainer already solved it

Yes, I did. He adapted a different Makefile than I plan to use, so I
didn't want to dig to deep into his solution. He uses a big patch for
the main makefile.

However, bzip2 gives the alternative option to use a second Makefile
as addon to the main Makefile. It ships already with
Makefile-libbz2_so and Makefile-libbz2_dylib. I want to create
something like Makefile-cygbz2.

Then I want to anderstand the overall policy for cygwin to be able to
port bigger packages. bzip2 is very small. By this it is a good
candidate to understand the procedure.

Al

-- 
Caution crosser:  Runnig Gentoo/Prefix on Cygwin/Vista.
All stupid questions are related to that context.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Finding the SONAME for bzip2
  2010-10-13 15:15 Finding the SONAME for bzip2 Al
  2010-10-13 15:50 ` R: " Marco Atzeri
@ 2010-10-13 17:04 ` Charles Wilson
  2010-10-13 17:15   ` Al
  1 sibling, 1 reply; 7+ messages in thread
From: Charles Wilson @ 2010-10-13 17:04 UTC (permalink / raw)
  To: cygwin

On 10/13/2010 11:15 AM, Al wrote:
> Hello,
> 
> I want to adapt the Makefile of bzip2 for cygwin and I want to
> understand enough of what I am doing.
> 
> This are the lines of interest from the Linux Makefile:

Why don't you download the cygwin -src package for bzip2, and see how it
works?

http://mirrors.kernel.org/sourceware/cygwin/release/bzip2/bzip2-1.0.5-10-src.tar.bz2

--
Chuck

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Finding the SONAME for bzip2
  2010-10-13 17:04 ` Charles Wilson
@ 2010-10-13 17:15   ` Al
  0 siblings, 0 replies; 7+ messages in thread
From: Al @ 2010-10-13 17:15 UTC (permalink / raw)
  To: cygwin

> Why don't you download the cygwin -src package for bzip2, and see how it
> works?

Hello Chuck, please see my answer to Marco.

Al

-- 
Caution crosser:  Runnig Gentoo/Prefix on Cygwin/Vista.
All stupid questions are related to that context.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Finding the SONAME for bzip2
  2010-10-13 16:03   ` Al
@ 2010-10-13 17:23     ` Charles Wilson
  2010-10-13 18:19       ` Al
  0 siblings, 1 reply; 7+ messages in thread
From: Charles Wilson @ 2010-10-13 17:23 UTC (permalink / raw)
  To: cygwin

On 10/13/2010 12:02 PM, Al wrote:
>> have you checked the bzip2 source package for cygwin ?
>> I presume the mantainer already solved it
> 
> Yes, I did. He adapted a different Makefile than I plan to use, so I
> didn't want to dig to deep into his solution. He uses a big patch for
> the main makefile.

The bulk of that patch is concerned with the 'make install' rules. The
next complication was because I wanted to allow simultaneous builds of
both the static and shared libraries -- and to build separate test progs
for each, and to RUN both test sets as part of 'make check'.

It's only a tiny portion of the changes that are needed for building the
shared library itself, and you should be able to figure out which bits
those are by inspection.

> However, bzip2 gives the alternative option to use a second Makefile
> as addon to the main Makefile. It ships already with
> Makefile-libbz2_so and Makefile-libbz2_dylib. I want to create
> something like Makefile-cygbz2.

Those are old and probably bit-rotted.  Debian doesn't use it:
http://patch-tracker.debian.org/patch/misc/view/bzip2/1.0.5-6/Makefile

Although fedora does:
http://pkgs.fedoraproject.org/gitweb/?p=bzip2.git;a=blob;f=bzip2.spec;h=31e2f48c42b70d2f363101b9e5afd5e440abf475;hb=HEAD

with changes:
http://pkgs.fedoraproject.org/gitweb/?p=bzip2.git;a=blob;f=bzip2-1.0.4-cflags.patch;h=209d738e2b20580234d376077b8c6f843dce3a0c;hb=HEAD
http://pkgs.fedoraproject.org/gitweb/?p=bzip2.git;a=blob;f=bzip2-1.0.4-saneso.patch;h=6b3430cfdac5bf4fa37734b25326b102ca251bc4;hb=HEAD

> Then I want to anderstand the overall policy for cygwin to be able to
> port bigger packages. bzip2 is very small. By this it is a good
> candidate to understand the procedure.

Actually, bzip2 and zlib are very poor candidates. Most larger projects
do NOT use hand-rolled Makefiles, especially when they are trying to
build shared libraries on multiple platforms. Instead, they use make
file generators or other build systems, that hide the complexity (and
work around the deficiencies).

E.g. autoconf+automake+libtool, or cmake, etc.

These toolsets already know how to build shared libs on cygwin, and a
whole lot more.

Since most projects you will encounter already use build tools like
these, you would get more 'bang for your buck' by learning how to use
THEM to build shared libs on cygwin, since that knowledge will apply to
a much larger class of candidate packages.

For a simple, basic example, take a look at jpeg (the newer versions, 8b
and above, use the autotools; prior to that they used...well, nevermind.
It used to be very strange.)

http://mirrors.kernel.org/sourceware/cygwin/release/jpeg/jpeg-8b-1-src.tar.bz2

--
Chuck

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Finding the SONAME for bzip2
  2010-10-13 17:23     ` Charles Wilson
@ 2010-10-13 18:19       ` Al
  0 siblings, 0 replies; 7+ messages in thread
From: Al @ 2010-10-13 18:19 UTC (permalink / raw)
  To: cygwin

Thank you Charles,

> The bulk of that patch is concerned with the 'make install' rules. The

Yes, the installation goes only have the way. I also found at least
two bugs affecting Cygwin, one similar to a zlib bug. In case of zlib
I tried to report 2 bugs upstream. It seems they have no bugtracker
and the mailing list is a closed society. At that point I gave up. To
justify, why you want to report a bug, is too much.

> Actually, bzip2 and zlib are very poor candidates. Most larger projects

It's always the poor candidate that brings us back to the roots. :-)

> Since most projects you will encounter already use build tools like
> these, you would get more 'bang for your buck' by learning how to use
> THEM to build shared libs on cygwin, since that knowledge will apply to
> a much larger class of candidate packages.

Well, I use dozends of packages, that simply work. But a car with
three wheels still can't drive. I need to acquire the skills to fix
the tiny rest.

Al

-- 
Caution crosser:  Runnig Gentoo/Prefix on Cygwin/Vista.
All stupid questions are related to that context.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-10-13 18:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-13 15:15 Finding the SONAME for bzip2 Al
2010-10-13 15:50 ` R: " Marco Atzeri
2010-10-13 16:03   ` Al
2010-10-13 17:23     ` Charles Wilson
2010-10-13 18:19       ` Al
2010-10-13 17:04 ` Charles Wilson
2010-10-13 17:15   ` Al

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).