From: Blue Swirl <blauwirbel@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 4/6] libcaccard: update configure to build and use internal libcaccard
Date: Sun, 28 Nov 2010 09:42:05 +0000 [thread overview]
Message-ID: <AANLkTinv7Xs-twkUEmdUmp-NN3MBqQDk7RP4T9mXCgjS@mail.gmail.com> (raw)
In-Reply-To: <20101128091424.GA6599@playa.tlv.redhat.com>
On Sun, Nov 28, 2010 at 9:14 AM, Alon Levy <alevy@redhat.com> wrote:
> On Fri, Nov 26, 2010 at 06:50:07PM +0000, Blue Swirl wrote:
>> On Thu, Nov 25, 2010 at 4:22 PM, Alon Levy <alevy@redhat.com> wrote:
>> > Signed-off-by: Alon Levy <alevy@redhat.com>
>> > ---
>> > Makefile | 6 ++++--
>> > Makefile.objs | 5 +++++
>> > Makefile.target | 2 ++
>> > configure | 24 ++++++++++++++++++++++++
>> > libcaccard/Makefile | 18 ++++++++++++++++++
>> > 5 files changed, 53 insertions(+), 2 deletions(-)
>> > create mode 100644 libcaccard/Makefile
>> >
>> > diff --git a/Makefile b/Makefile
>> > index 4e120a2..e673bf1 100644
>> > --- a/Makefile
>> > +++ b/Makefile
>> > @@ -172,6 +172,8 @@ check-qlist: check-qlist.o qlist.o qint.o $(CHECK_PROG_DEPS)
>> > check-qfloat: check-qfloat.o qfloat.o $(CHECK_PROG_DEPS)
>> > check-qjson: check-qjson.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o qjson.o json-streamer.o json-lexer.o json-parser.o $(CHECK_PROG_DEPS)
>> >
>> > +QEMULIBS=libhw32 libhw64 libuser libdis libdis-user libcaccard
>> > +
>> > clean:
>> > # avoid old build problems by removing potentially incorrect old files
>> > rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
>> > @@ -183,7 +185,7 @@ clean:
>> > rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp
>> > rm -f trace-dtrace.h trace-dtrace.h-timestamp
>> > $(MAKE) -C tests clean
>> > - for d in $(ALL_SUBDIRS) libhw32 libhw64 libuser libdis libdis-user; do \
>> > + for d in $(ALL_SUBDIRS) $(QEMULIBS); do \
>> > if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
>> > rm -f $$d/qemu-options.def; \
>> > done
>> > @@ -194,7 +196,7 @@ distclean: clean
>> > rm -f roms/seabios/config.mak roms/vgabios/config.mak
>> > rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.dvi qemu-doc.fn qemu-doc.info qemu-doc.ky qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp qemu-doc.vr
>> > rm -f qemu-tech.info qemu-tech.aux qemu-tech.cp qemu-tech.dvi qemu-tech.fn qemu-tech.info qemu-tech.ky qemu-tech.log qemu-tech.pdf qemu-tech.pg qemu-tech.toc qemu-tech.tp qemu-tech.vr
>> > - for d in $(TARGET_DIRS) libhw32 libhw64 libuser libdis libdis-user; do \
>> > + for d in $(TARGET_DIRS) $(QEMULIBS); do \
>> > rm -rf $$d || exit 1 ; \
>> > done
>> >
>> > diff --git a/Makefile.objs b/Makefile.objs
>> > index 2059e89..82691c0 100644
>> > --- a/Makefile.objs
>> > +++ b/Makefile.objs
>> > @@ -297,6 +297,11 @@ user-obj-y += qemu-timer-common.o
>> > endif
>> > endif
>> >
>> > +######################################################################
>> > +# smartcard
>> > +
>> > +libcaccard-y = cac.o event.o passthru.o vcard.o vreader.o vcard_emul_nss.o vcard_emul_type.o card_7816.o
>> > +
>> > vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
>> >
>> > vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS)
>> > diff --git a/Makefile.target b/Makefile.target
>> > index 2800f47..7dd6932 100644
>> > --- a/Makefile.target
>> > +++ b/Makefile.target
>> > @@ -341,6 +341,8 @@ obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
>> >
>> > endif # CONFIG_SOFTMMU
>> >
>> > +obj-y += $(addprefix $(SRC_PATH)/libcaccard/, $(libcaccard-$(CONFIG_SMARTCARD)))
>> > +
>> > obj-y += $(addprefix ../, $(trace-obj-y))
>> > obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
>> >
>> > diff --git a/configure b/configure
>> > index fb9eac2..4b55904 100755
>> > --- a/configure
>> > +++ b/configure
>> > @@ -2130,6 +2130,25 @@ EOF
>> > fi
>> > fi
>> >
>> > +# check for libcaccard for smartcard support
>> > +if test "$smartcard" != "no" ; then
>> > + smartcard_cflags="-I\$(SRC_PATH)/libcaccard"
>> > + smartcard_libs="-L\$(SRC_PATH)/libcaccard -lcaccard"
>> > + libcaccard_libs=$($pkgconfig --libs nss 2>/dev/null)
>> > + libcaccard_cflags=$($pkgconfig --cflags nss)
>> > + # TODO - what's the minimal nss version we support?
>> > + if $pkgconfig --atleast-version=3.12.8 nss; then
>> > + smartcard="yes"
>> > + QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcaccard_cflags"
>> > + LIBS="$libcaccard_libs $LIBS"
>> > + else
>> > + if test "smartcard" = "yes" ; then
>> > + feature_not_found "smartcard"
>> > + fi
>> > + smartcard="no"
>> > + fi
>> > +fi
>> > +
>> > ##########################################
>> >
>> > ##########################################
>> > @@ -2956,6 +2975,11 @@ fi
>> > if test "$target_darwin_user" = "yes" ; then
>> > echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
>> > fi
>> > +if test "$smartcard" = "yes" ; then
>> > + echo "subdir-$target: subdir-libcaccard" >> $config_host_mak
>> > + echo "libcaccard_libs=$libcaccard_libs" >> $config_host_mak
>> > + echo "libcaccard_cflags=$libcaccard_cflags" >> $config_host_mak
>> > +fi
>> > list=""
>> > if test ! -z "$gdb_xml_files" ; then
>> > for x in $gdb_xml_files; do
>> > diff --git a/libcaccard/Makefile b/libcaccard/Makefile
>> > new file mode 100644
>> > index 0000000..a339af1
>> > --- /dev/null
>> > +++ b/libcaccard/Makefile
>> > @@ -0,0 +1,18 @@
>> > +include ../Makefile.objs
>> > +include ../config-host.mak
>> > +include ../config-all-devices.mak
>> > +include $(SRC_PATH)/rules.mak
>> > +
>> > +CFLAGS+=-fPIC
>> > +
>> > +libcaccard.so: $(libcaccard-y)
>> > + gcc -shared $(libcaccard_libs) -o $@ $^
>>
>> This is not going to work, the shared library would need to be shipped
>> with QEMU binaries, with a lot of hassle for no benefit. Just do it
>> like other libs do and add the objects to the list of linked files.
>
> If you'll notice the libcaccard-y define above, that's exactly what I'm doing. Both qemu and the vscclient (in libcaccard) are linked directly with that list of objects, like you said. Why the shard object too? because I intended to use it for external clients. I don't have an install rule yet, I thought I'll do that later.
But then -fPIC shouldn't be used for QEMU objects. Please see how
objects which are common to user and system emulators are compiled
with different set of flags.
next prev parent reply other threads:[~2010-11-28 9:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-25 16:22 [Qemu-devel] [PATCH 0/6] usb-ccid (v7) Alon Levy
2010-11-25 16:22 ` [Qemu-devel] [PATCH 1/6] usb-ccid: add CCID bus Alon Levy
2010-11-26 19:05 ` Blue Swirl
2010-11-28 9:58 ` Alon Levy
2010-11-28 10:53 ` Alon Levy
2010-11-28 12:10 ` Blue Swirl
2010-11-25 16:22 ` [Qemu-devel] [PATCH 2/6] ccid: add passthru card device Alon Levy
2010-11-25 16:22 ` [Qemu-devel] [PATCH 3/6] libcaccard: initial commit after coding style fixes Alon Levy
2010-11-25 16:22 ` [Qemu-devel] [PATCH 4/6] libcaccard: update configure to build and use internal libcaccard Alon Levy
2010-11-26 18:50 ` Blue Swirl
2010-11-28 9:14 ` Alon Levy
2010-11-28 9:42 ` Blue Swirl [this message]
2010-11-28 10:44 ` Alon Levy
2010-11-28 12:03 ` Blue Swirl
2010-11-28 12:06 ` Alon Levy
2010-11-25 16:22 ` [Qemu-devel] [PATCH 5/6] add ccid-card-emulated device (v2) Alon Levy
2010-11-25 16:22 ` [Qemu-devel] [PATCH 6/6] ccid: add docs Alon Levy
-- strict thread matches above, loose matches on Subject: below --
2010-11-28 14:46 [Qemu-devel] [PATCH 0/6] usb-ccid (v8) Alon Levy
2010-11-28 14:46 ` [Qemu-devel] [PATCH 4/6] libcaccard: update configure to build and use internal libcaccard Alon Levy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTinv7Xs-twkUEmdUmp-NN3MBqQDk7RP4T9mXCgjS@mail.gmail.com \
--to=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).