Received: from [140.186.70.92] (port=36678 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PMekH-0002C5-G2 for qemu-devel@nongnu.org; Sun, 28 Nov 2010 05:44:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PMekG-0007TW-13 for qemu-devel@nongnu.org; Sun, 28 Nov 2010 05:44:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:4880) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PMekF-0007TB-LP for qemu-devel@nongnu.org; Sun, 28 Nov 2010 05:44:35 -0500 Date: Sun, 28 Nov 2010 12:44:24 +0200 From: Alon Levy Subject: Re: [Qemu-devel] [PATCH 4/6] libcaccard: update configure to build and use internal libcaccard Message-ID: <20101128104424.GC6599@playa.tlv.redhat.com> References: <1290702170-3775-1-git-send-email-alevy@redhat.com> <1290702170-3775-5-git-send-email-alevy@redhat.com> <20101128091424.GA6599@playa.tlv.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel@nongnu.org On Sun, Nov 28, 2010 at 09:42:05AM +0000, Blue Swirl wrote: > On Sun, Nov 28, 2010 at 9:14 AM, Alon Levy 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 wrote: > >> > Signed-off-by: Alon Levy > >> > --- > >> > =A0Makefile =A0 =A0 =A0 =A0 =A0 =A0| =A0 =A06 ++++-- > >> > =A0Makefile.objs =A0 =A0 =A0 | =A0 =A05 +++++ > >> > =A0Makefile.target =A0 =A0 | =A0 =A02 ++ > >> > =A0configure =A0 =A0 =A0 =A0 =A0 | =A0 24 ++++++++++++++++++++++++ > >> > =A0libcaccard/Makefile | =A0 18 ++++++++++++++++++ > >> > =A05 files changed, 53 insertions(+), 2 deletions(-) > >> > =A0create 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 $(CH= ECK_PROG_DEPS) > >> > =A0check-qfloat: check-qfloat.o qfloat.o $(CHECK_PROG_DEPS) > >> > =A0check-qjson: check-qjson.o qfloat.o qint.o qdict.o qstring.o ql= ist.o qbool.o qjson.o json-streamer.o json-lexer.o json-parser.o $(CHECK_= PROG_DEPS) > >> > > >> > +QEMULIBS=3Dlibhw32 libhw64 libuser libdis libdis-user libcaccard > >> > + > >> > =A0clean: > >> > =A0# avoid old build problems by removing potentially incorrect ol= d files > >> > =A0 =A0 =A0 =A0rm -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: > >> > =A0 =A0 =A0 =A0rm -f trace-dtrace.dtrace trace-dtrace.dtrace-times= tamp > >> > =A0 =A0 =A0 =A0rm -f trace-dtrace.h trace-dtrace.h-timestamp > >> > =A0 =A0 =A0 =A0$(MAKE) -C tests clean > >> > - =A0 =A0 =A0 for d in $(ALL_SUBDIRS) libhw32 libhw64 libuser libd= is libdis-user; do \ > >> > + =A0 =A0 =A0 for d in $(ALL_SUBDIRS) $(QEMULIBS); do \ > >> > =A0 =A0 =A0 =A0if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; f= i; \ > >> > =A0 =A0 =A0 =A0rm -f $$d/qemu-options.def; \ > >> > =A0 =A0 =A0 =A0 done > >> > @@ -194,7 +196,7 @@ distclean: clean > >> > =A0 =A0 =A0 =A0rm -f roms/seabios/config.mak roms/vgabios/config.m= ak > >> > =A0 =A0 =A0 =A0rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-d= oc.dvi qemu-doc.fn qemu-doc.info qemu-doc.ky qemu-doc.log qemu-doc.pdf qe= mu-doc.pg qemu-doc.toc qemu-doc.tp qemu-doc.vr > >> > =A0 =A0 =A0 =A0rm -f qemu-tech.info qemu-tech.aux qemu-tech.cp qem= u-tech.dvi qemu-tech.fn qemu-tech.info qemu-tech.ky qemu-tech.log qemu-te= ch.pdf qemu-tech.pg qemu-tech.toc qemu-tech.tp qemu-tech.vr > >> > - =A0 =A0 =A0 for d in $(TARGET_DIRS) libhw32 libhw64 libuser libd= is libdis-user; do \ > >> > + =A0 =A0 =A0 for d in $(TARGET_DIRS) $(QEMULIBS); do \ > >> > =A0 =A0 =A0 =A0rm -rf $$d || exit 1 ; \ > >> > =A0 =A0 =A0 =A0 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 +=3D qemu-timer-common.o > >> > =A0endif > >> > =A0endif > >> > > >> > +#################################################################= ##### > >> > +# smartcard > >> > + > >> > +libcaccard-y =3D cac.o event.o passthru.o vcard.o vreader.o vcard= _emul_nss.o vcard_emul_type.o card_7816.o > >> > + > >> > =A0vl.o: QEMU_CFLAGS+=3D$(GPROF_CFLAGS) > >> > > >> > =A0vl.o: QEMU_CFLAGS+=3D$(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 +=3D $(addprefix $(HWDIR)/, $(hw-obj-y)) > >> > > >> > =A0endif # CONFIG_SOFTMMU > >> > > >> > +obj-y +=3D $(addprefix $(SRC_PATH)/libcaccard/, $(libcaccard-$(CO= NFIG_SMARTCARD))) > >> > + > >> > =A0obj-y +=3D $(addprefix ../, $(trace-obj-y)) > >> > =A0obj-$(CONFIG_GDBSTUB_XML) +=3D gdbstub-xml.o > >> > > >> > diff --git a/configure b/configure > >> > index fb9eac2..4b55904 100755 > >> > --- a/configure > >> > +++ b/configure > >> > @@ -2130,6 +2130,25 @@ EOF > >> > =A0 fi > >> > =A0fi > >> > > >> > +# check for libcaccard for smartcard support > >> > +if test "$smartcard" !=3D "no" ; then > >> > + =A0smartcard_cflags=3D"-I\$(SRC_PATH)/libcaccard" > >> > + =A0smartcard_libs=3D"-L\$(SRC_PATH)/libcaccard -lcaccard" > >> > + =A0libcaccard_libs=3D$($pkgconfig --libs nss 2>/dev/null) > >> > + =A0libcaccard_cflags=3D$($pkgconfig --cflags nss) > >> > + =A0# TODO - what's the minimal nss version we support? > >> > + =A0if $pkgconfig --atleast-version=3D3.12.8 nss; then > >> > + =A0 =A0smartcard=3D"yes" > >> > + =A0 =A0QEMU_CFLAGS=3D"$QEMU_CFLAGS $smartcard_cflags $libcaccard= _cflags" > >> > + =A0 =A0LIBS=3D"$libcaccard_libs $LIBS" > >> > + =A0else > >> > + =A0 =A0if test "smartcard" =3D "yes" ; then > >> > + =A0 =A0 =A0feature_not_found "smartcard" > >> > + =A0 =A0fi > >> > + =A0 =A0smartcard=3D"no" > >> > + =A0fi > >> > +fi > >> > + > >> > =A0########################################## > >> > > >> > =A0########################################## > >> > @@ -2956,6 +2975,11 @@ fi > >> > =A0if test "$target_darwin_user" =3D "yes" ; then > >> > =A0 echo "CONFIG_DARWIN_USER=3Dy" >> $config_target_mak > >> > =A0fi > >> > +if test "$smartcard" =3D "yes" ; then > >> > + =A0echo "subdir-$target: subdir-libcaccard" >> $config_host_mak > >> > + =A0echo "libcaccard_libs=3D$libcaccard_libs" >> $config_host_mak > >> > + =A0echo "libcaccard_cflags=3D$libcaccard_cflags" >> $config_host= _mak > >> > +fi > >> > =A0list=3D"" > >> > =A0if test ! -z "$gdb_xml_files" ; then > >> > =A0 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+=3D-fPIC > >> > + > >> > +libcaccard.so: $(libcaccard-y) > >> > + =A0 =A0 =A0 gcc -shared $(libcaccard_libs) -o $@ $^ > >> > >> This is not going to work, the shared library would need to be shipp= ed > >> 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? beca= use I intended to use it for external clients. I don't have an install ru= le yet, I thought I'll do that later. >=20 > 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. >=20 ok, so maybe I should include a Makefile.external explicitly for external= projects to build, and then just drop the -fPIC and libcaccard.so?