Bug 691887 - use shared library instead static
Summary: use shared library instead static
Status: RESOLVED WONTFIX
Alias: None
Product: MuPDF
Classification: Unclassified
Component: mupdf (show other bugs)
Version: unspecified
Hardware: PC Linux
: P4 major
Assignee: Tor Andersson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-13 17:24 UTC by Pavel Zhukov
Modified: 2013-06-11 13:52 UTC (History)
2 users (show)

See Also:
Customer:
Word Size: ---


Attachments
patch to use shared libraries (3.22 KB, application/octet-stream)
2011-01-13 17:24 UTC, Pavel Zhukov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Zhukov 2011-01-13 17:24:13 UTC
Created attachment 7129 [details]
patch to use shared libraries

I'm fedora packager and I'm tring to build mupdf for Fedora.
Packager have to use shared libraries instead static. 
So, please update Makefile (configure if possible) to fix this. 
https://bugzilla.redhat.com/669311
Currently I'm using patch (in attachment).
Comment 1 Tor Andersson 2011-02-02 16:22:13 UTC
We do not intend to support building MuPDF as a shared library. Shared libraries are a lot more trouble than they are worth. If you are willing to take on the task of maintaining a shared library build for Fedora, I will not object, but please bear in mind that any such patches will not make it into the upstream sources.
Comment 2 Pavel Zhukov 2011-02-02 21:02:41 UTC
ok. I'll not build mupdf for fedora.Because I do not intend to support building MuPDF as a static library. Using static libs in Fedora is not recommended.
Comment 3 Michael Weber 2013-06-08 10:56:09 UTC
What's your point against shared libs? The resulting bins are dynamically linked against freetype/X11/ anyway. (Gentoo does not split libmupdf and mupdf, so the mu* bins will always match corresponding libfitz.

My approach to build shared libs:
-redefine LIB_FITZ and the rule to create it and pass the -fpic via XCFLAGS
    my_soname=libfitz.so.1.2
    sed -e "\$a\$(FITZ_LIB):" \
        -e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname -Wl,${my_soname} -o \$@ \$^" \
        -e "/^FITZ_LIB :=/s:=.*:= build/debug/${my_soname}:" \                     
        -i Makefile || die
    make XCFLAGS=-fpic

The static libs are created in a different copy of the source tree.
And you can archive a real static binary by having static-libs of the deps and pass XLIBS="-static"

    cp -a "${S}" "${S}"-static || die
    #add missing Libs.private for xcb and freetype
    sed -e 's:\(pkg-config --libs\):\1 --static:' \                            
        -e '/^SYS_X11_LIBS :=/s:\(.*\):\1 -lpthread:' \
        -e '/^SYS_FREETYPE_LIBS :=/s:\(.*\):\1 -lbz2:' \
        -i "${S}"-static/Makerules || die
    make -C "${S}"-static XLIBS="-static"

The combined Gentoo ebuild (version 9999) can be found at 
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-text/mupdf/
Comment 4 Michael Weber 2013-06-11 13:52:30 UTC
(In reply to comment #3)
>         -e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname
> -Wl,${my_soname} -o \$@ \$^" \

one extra \$(LIBS) at the end, and to fail on problems: -Wl,--no-undefined.