On Sun, Nov 28, 2010 at 09:42:05AM +0000, Blue Swirl wrote: > On Sun, Nov 28, 2010 at 9:14 AM, Alon Levy <al...@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 <al...@redhat.com> wrote: > >> > Signed-off-by: Alon Levy <al...@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. >
ok, so maybe I should include a Makefile.external explicitly for external projects to build, and then just drop the -fPIC and libcaccard.so?