From c1e2597c1a2e3edc9493889b7c29b93dcccb782a Mon Sep 17 00:00:00 2001 From: Guido Draheim Date: Sat, 23 May 2009 12:38:06 +0000 Subject: [PATCH] fix SDL_rwops example / installation diverted to new polaces --- ChangeLog | 19 ++++++++++++++ SDL/Makefile.am | 58 ++++++++++++------------------------------- SDL/SDL_rwops_zzcat.c | 10 ++++---- zziplib.spec | 28 ++++++++++++++++++--- 4 files changed, 64 insertions(+), 51 deletions(-) diff --git a/ChangeLog b/ChangeLog index a5ca5b8..01b8a8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2009-05-23 guidod + * SDL/Makefile.am - remove dependency on zzip-config (and sdl-config) + which do not exist any since quite a time - instead use pkg-config + > Thanks to Michael Sterret for bringing it up + * SDL/SDL_rwops_zzcat.c: the SDL_rwops example was fixed, as the + nmemb/size of the sdl-read call were swapped over. The testsdl + self check (based on zzcatsdl) works OK. + * SDL/Makefile.am - the targe installation paths for the example + was fixed to include/SDL_rwops_zzip - additionally there is now + an SDL_rwops_zzip.pc pkgconfig script that will refer to the new + location (it had been previously installed in include/SDL, ouch). + * Note that the old zzip-sdl pkgconfig-files are gone now. Given that the + example was not quite working, it is improbable that anyone had + been using them in real code, so there's nothing breaking here. + * create a new package SDL_rwops-devel in zziplib.spec that will catch + the example code, SDL_rwops_zzip includes and SDL_rwops_zzip pkgconfig + * append "make check" and "make test-sdl" to zziplib.spec for minimal + pre-installation check. + 2009-05-22 guidod * docs/Makefile.am: break a dual target into two lines as suggested by ticket:2405440 diff --git a/SDL/Makefile.am b/SDL/Makefile.am index 9cd9db1..b8f739e 100644 --- a/SDL/Makefile.am +++ b/SDL/Makefile.am @@ -1,28 +1,19 @@ AUTOMAKE_OPTIONS = 1.4 foreign AUTOTOOL_VERSION=autoconf-2.52 automake-1.5 libtool-1.4.2 -sdldir = ${pkgdatadir}/SDL -sdl_DATA = SDL_rwops_zzip.c SDL_rwops_zzip.h +zzipsdldir = ${includedir}/SDL_rwops_zzip +zzipsdl_DATA = SDL_rwops_zzip.c SDL_rwops_zzip.h EXTRA_DIST = $(sdl_DATA) check_PROGRAMS = zzcatsdl -zzcatsdl_SOURCES = SDL_rwops_zzcat.c -zzcatsdl_LDFLAGS = `sdl-config --libs` `./zzip-config --libs` -zzcatsdl_cflags = `sdl-config --cflags` `./zzip-config --cflags` - -SDL_rwops_zzip.$(OBJEXT) : zzip-config @srcdir@/SDL_rwops_zzip.c - $(COMPILE) $(zzcatsdl_cflags) -c @srcdir@/SDL_rwops_zzip.c -o $@ -SDL_rwops_zzcat.$(OBJEXT) : zzip-config @srcdir@/SDL_rwops_zzcat.c - $(COMPILE) $(zzcatsdl_cflags) -c @srcdir@/SDL_rwops_zzcat.c -o $@ -zzcatsdl$(EXEEXT): SDL_rwops_zzip.$(OBJEXT) SDL_rwops_zzcat.$(OBJEXT) - $(LINK) SDL_rwops_zzip.$(OBJEXT) SDL_rwops_zzcat.$(OBJEXT) \ - $(zzcatsdl_LDFLAGS) -o $@ - -zzip-config : ../bins/zzip-config - sed -e 's:includedir=.*:includedir=..:' \ - -e 's:libdir=.*:libdir=../zzip:' $? > $@ - chmod +x $@ +zzcatsdl_SOURCES = SDL_rwops_zzcat.c SDL_rwops_zzip.c +ZZIP_CFLAGS= `PKG_CONFIG_PATH=../zzip; pkg-config zziplib --cflags` +ZZIP_LIBS= `PKG_CONFIG_PATH=../zzip; pkg-config zziplib --libs` +SDL_CFLAGS= `pkg-config sdl --cflags` +SDL_LIBS= `pkg-config sdl --libs` +CFLAGS= -I$(srcdir) $(ZZIP_CFLAGS) $(SDL_CFLAGS) +LIBS= $(ZZIP_LIBS) $(SDL_LIBS) test.zip : @top_srcdir@/test/test.zip $(LN_S) $? $@ @@ -33,36 +24,19 @@ testsdl test-sdl : test.zip zzcatsdl$(EXEEXT) sdl : all install-sdl : install-data # and not the binary -### if it wouldn't be for the zzip-config then we could write it like this -# zzcatsdl_SOURCES = SDL_rwops_zzcat.c SDL_rwops_zzip.c -# zzcatsdl_LDADD = `sdl-config --libs` `zzip-config --libs` -# CFLAGS = `sdl-config --cflags` `zzip-config --cflags` -### - CLEANFILES = *.pc *.omf # ---------------------------------------------------------------------- # we do not install a library, so this about equivalent to some SDL.pc pkgconfigdir=$(libdir)/pkgconfig -pkgconfig_HEADERS= zzip-sdl-config.pc zzip-sdl-rwops.pc +pkgconfig_HEADERS= SDL_rwops_zzip.pc ERRNULL= 2>/dev/null -zzip-sdl-config.pc : Makefile - @ echo "prefix="`sdl-config --prefix $(ERRNULL)` >$@ - @ echo "sdl_static_libs="`sdl-config --static-libs $(ERRNULL)` >>$@ - @ echo "sdl_libs="`sdl-config --libs $(ERRNULL)` >>$@ - @ echo "sdl_cflags="`sdl-config --cflags $(ERRNULL)` >>$@ - @ echo " " >>$@ - @ echo "Name: zzip-sdl-config" >>$@ - @ echo "Version: "`sdl-config --version $(ERRNULL)` >>$@ - @ echo "Description: SDL Config (for ZZipLib)" >>$@ - echo 'Libs: $${sdl_libs}' >>$@ - echo 'Cflags: $${sdl_cflags}' >>$@ -zzip-sdl-rwops.pc : Makefile - @ echo 'zzipdatadir=$(pkgdatadir)' >$@ - @ echo 'zzipsdlrwops=$${zzipdatadir}/SDL' >>$@ +SDL_rwops_zzip.pc : Makefile + @ echo 'prefix=$(prefix)' >$@ + @ echo 'zzipsdldir=$(zzipsdldir)' >>$@ @ echo " " >>$@ - @ echo "Name: zzip-sdl-rwops" >>$@ + @ echo "Name: SDL_rwops_zzip" >>$@ @ echo "Version: $(VERSION)" >>$@ @ echo "Description: SDL_rwops for ZZipLib" >>$@ - echo 'Requires: zzip-sdl-config, zziplib' >>$@ - echo 'Cflags: -I$${zzipsdlrwops}' >>$@ + echo 'Requires: sdl, zziplib' >>$@ + echo 'Cflags: -I$${zzipsdldir}' >>$@ diff --git a/SDL/SDL_rwops_zzcat.c b/SDL/SDL_rwops_zzcat.c index 8df2685..d8706b1 100644 --- a/SDL/SDL_rwops_zzcat.c +++ b/SDL/SDL_rwops_zzcat.c @@ -12,7 +12,7 @@ int main (int argc, char** argv) { - static const char usage[] = + static const char usage[] = " zzcat ... \n" " - prints the file to stdout. the file can be a normal file\n" " or an inflated part of a zip-archive \n" @@ -24,7 +24,7 @@ int main (int argc, char** argv) printf (usage); exit (0); } - + for (argn=1; argn < argc; argn++) { SDL_RWops* rwops; @@ -39,7 +39,7 @@ int main (int argc, char** argv) int n; /* read chunks of 16 bytes into buf and print them to stdout */ - while (0 < (n = SDL_RWread(rwops, buf, 16, 1))) + while (0 < (n = SDL_RWread(rwops, buf, 1, 16))) { buf[n] = '\0'; # ifdef STDOUT_FILENO @@ -49,13 +49,13 @@ int main (int argc, char** argv) # endif } - if (n == -1) + if (n == -1) perror (argv[argn]); SDL_RWclose (rwops); } } - + return 0; } diff --git a/zziplib.spec b/zziplib.spec index 7ff7a4f..838a24a 100644 --- a/zziplib.spec +++ b/zziplib.spec @@ -1,7 +1,7 @@ %define lib lib010 Summary: ZZipLib - libZ-based ZIP-access Library Name: zziplib -Version: 0.13.52 +Version: 0.13.53 Release: 1 License: LGPL Group: Development/Libraries @@ -45,6 +45,12 @@ Group: Development/Libraries Requires: zziplib-%lib = %version # Requires: pkgconfig (not yet) +%package SDL_rwops-devel +Summary: ZZipLib - Development Files for SDL_rwops +Group: Development/Libraries +Requires: zziplib-%lib = %version +Requires: pkgconfig + %description : zziplib provides read access to zipped files in a zip-archive, : using compression based solely on free algorithms provided by zlib. @@ -70,6 +76,12 @@ Requires: zziplib-%lib = %version these are the header files needed to develop programs using zziplib. there are test binaries to hint usage of the library in user programs. +%description SDL_rwops-devel + : zziplib provides read access to zipped files in a zip-archive, + : using compression based solely on free algorithms provided by zlib. + these are example headers and implementation along with a pkgconfig + script that allows to easily use zziplib through SDL_rwops calls. + %prep #' %setup @@ -88,6 +100,8 @@ sh configure --prefix=%{_prefix} \ %build %__make %{?jobs:-j%jobs} +%__make check +%__make test-sdl %__make %{?jobs:-j%jobs} zzip64-build %__make %{?jobs:-j%jobs} doc @@ -99,6 +113,7 @@ sh configure --prefix=%{_prefix} \ %__make zzip-postinstall %__make install-doc DESTDIR=%{buildroot} %__make install-mans DESTDIR=%{buildroot} +%__make install-sdl DESTDIR=%{buildroot} %clean %__rm -rf %{buildroot} @@ -131,8 +146,13 @@ test ! -f %_bindir/scrollkeeper-update || %_bindir/scrollkeeper-update %{_libdir}/lib*.so %{_libdir}/lib*.a %{_libdir}/lib*.la - %{_libdir}/pkgconfig/* -%dir %{_datadir}/%{name} - %{_datadir}/%{name}/* + %{_libdir}/pkgconfig/zzip* %{_datadir}/aclocal/%{name}*.m4 %{_mandir}/man3/* + +%files SDL_rwops-devel + %defattr(-,root,root) + %{_libdir}/pkgconfig/SDL*zzip* +%dir %{_includedir}/SDL_rwops_zzip + %{_includedir}/SDL_rwops_zzip/* + -- 2.40.0