[libst2205] - Add missing BuildRequires: gd-devel - Fix building when libst2205-devel is not already installed

Hans de Goede jwrdegoede at fedoraproject.org
Tue Feb 22 09:17:15 UTC 2011


commit f50db8c393115fe7c61fba5df2d5c8529092eb11
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Tue Feb 22 10:17:39 2011 +0100

    - Add missing BuildRequires: gd-devel
    - Fix building when libst2205-devel is not already installed

 .gitignore                               |    1 +
 libst2205.spec                           |   99 ++++++++++++++++++++++++++++++
 sources                                  |    1 +
 st2205tool-1.4.3-no-exit.patch           |   46 ++++++++++++++
 st2205tool-1.4.3-width-height-swap.patch |   14 ++++
 5 files changed, 161 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..012da8c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/st2205tool-1.4.3.tar.gz
diff --git a/libst2205.spec b/libst2205.spec
new file mode 100644
index 0000000..ae51f17
--- /dev/null
+++ b/libst2205.spec
@@ -0,0 +1,99 @@
+Name:           libst2205
+Version:        1.4.3
+Release:        2%{?dist}
+Summary:        Library for accessing the display of hacked st2205 photo frames
+Group:          System Environment/Libraries
+License:        GPLv3+
+URL:            http://picframe.spritesserver.nl/wiki/index.php
+# Note the st2205tool includes tools to actually hack the pictureframe, this is
+# something which should only be done by experienced techies and which we
+# should not package. We do want to package the lib (which also is the only
+# thing make install installs), hence the packagename is libst2205.
+Source0:        http://www.neophob.com/files/st2205tool-1.4.3.tar.gz
+Patch0:         st2205tool-1.4.3-no-exit.patch
+Patch1:         st2205tool-1.4.3-width-height-swap.patch
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires:  gd-devel
+
+%description
+It is possible to flash digital photo frames with the st2205 chip-sets with
+a modified firmware, which allows one to display real time images on the
+display of the frame from a PC. This package contains a library for accessing
+the display from the PC, for st2205 frames with the hacked firmware.
+
+
+%package        devel
+Summary:        Development files for %{name}
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description    devel
+The %{name}-devel package contains libraries and header files for
+developing applications that use %{name}.
+
+
+%package tools
+Summary:        Tools for %{name}
+Group:          Development/Libraries
+Requires:       %{name} = %{version}-%{release}
+
+%description tools
+This package contains the st2205 set picture utility which can be used to
+display a (properly sized) PNG file on a supported picture frames display.
+
+
+%prep
+%setup -q -n st2205tool
+%patch0 -p1
+%patch1 -p1
+
+
+%build
+make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS -fPIC" -C libst2205
+make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS -I../libst2205" -C setpic
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+# make install does not support DESTDIR nor PREFIX, DIY
+mkdir -p $RPM_BUILD_ROOT%{_bindir}
+mkdir -p $RPM_BUILD_ROOT%{_libdir}
+mkdir -p $RPM_BUILD_ROOT%{_includedir}
+install -m 755 setpic/setpic $RPM_BUILD_ROOT%{_bindir}/st2205-setpic
+install -m 755 libst2205/libst2205.so $RPM_BUILD_ROOT%{_libdir}/libst2205.so.1
+ln -s libst2205.so.1 $RPM_BUILD_ROOT%{_libdir}/libst2205.so
+install -p -m 644 libst2205/st2205.h $RPM_BUILD_ROOT%{_includedir}
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%defattr(-,root,root,-)
+%doc LICENSE
+%{_libdir}/%{name}.so.1
+
+%files devel
+%defattr(-,root,root,-)
+%doc %{name}/readme.txt
+%{_includedir}/st2205.h
+%{_libdir}/%{name}.so
+
+%files tools
+%defattr(-,root,root,-)
+%{_bindir}/st2205-setpic
+
+
+%changelog
+* Sun Feb 19 2011 Hans de Goede <hdegoede at redhat.com> - 1.4.3-2
+- Add missing BuildRequires: gd-devel
+- Fix building when libst2205-devel is not already installed
+
+* Sat Feb 19 2011 Hans de Goede <hdegoede at redhat.com> - 1.4.3-1
+- Initial Fedora package
diff --git a/sources b/sources
index e69de29..3572f15 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+c87f05a5f692e869d2d050aa3d4fd6c5  st2205tool-1.4.3.tar.gz
diff --git a/st2205tool-1.4.3-no-exit.patch b/st2205tool-1.4.3-no-exit.patch
new file mode 100644
index 0000000..d509135
--- /dev/null
+++ b/st2205tool-1.4.3-no-exit.patch
@@ -0,0 +1,46 @@
+diff -up st2205tool/libst2205/st2205.c~ st2205tool/libst2205/st2205.c
+--- st2205tool/libst2205/st2205.c~	2009-01-28 22:34:09.000000000 +0100
++++ st2205tool/libst2205/st2205.c	2011-02-20 10:04:21.926572083 +0100
+@@ -355,11 +355,6 @@ static void pcf8833_send_partial(st2205_
+ 					p = adddata(h->buff, p, (tr)&0xff);
+ 					x++; //because we handle 2 pixels at a time
+ 				break;
+-				default:
+-					fprintf(stderr, "libst2205: Unknown bpp for this display: %i\n", h->bpp);
+-					//TODO: do not exit here, library should just send error to app
+-					exit(1);
+-				break;
+ 			}
+ 		}
+ 	}
+@@ -497,6 +492,7 @@ st2205_handle *st2205_open(const char *d
+ 			fprintf(stderr, "Unknown version %hhi\n", b->version);
+ 		close(fd);
+ 		free_aligned(buff, BUFF_SIZE);
++		free(r);
+ 		return NULL;	
+ 	}
+ 
+@@ -509,7 +505,21 @@ st2205_handle *st2205_open(const char *d
+ 	r->oldpix = NULL;
+ 	r->offx   = b->offx;
+ 	r->offy   = b->offy;
+-	
++
++	/* Verify bpp */
++	switch (r->bpp) {
++	case 24:
++	case 16:
++	case 12:
++		break;
++	default:
++		fprintf(stderr, "libst2205: Unknown bpp for this display: %i\n", r->bpp);
++		close(fd);
++		free_aligned(buff, BUFF_SIZE);
++		free(r);
++		return NULL;
++	}
++
+ 	DPRINT("libst2205: detected device, %ix%i, %i bpp.\n", r->width, r->height, r->bpp);
+ 	
+ 	return r;
diff --git a/st2205tool-1.4.3-width-height-swap.patch b/st2205tool-1.4.3-width-height-swap.patch
new file mode 100644
index 0000000..38e56c7
--- /dev/null
+++ b/st2205tool-1.4.3-width-height-swap.patch
@@ -0,0 +1,14 @@
+diff -up st2205tool/setpic/main.c~ st2205tool/setpic/main.c
+--- st2205tool/setpic/main.c~	2008-01-22 00:53:24.000000000 +0100
++++ st2205tool/setpic/main.c	2011-02-20 10:05:54.659573470 +0100
+@@ -53,8 +53,8 @@ int sendpic(st2205_handle *h, char* file
+ 	return 0;
+     }
+ 
+-    for (y=0; y<h->width; y++) {
+-	for (x=0; x<h->height; x++) {
++    for (y=0; y<h->height; y++) {
++	for (x=0; x<h->width; x++) {
+ 	    c = gdImageGetPixel(im, x, y);
+ 	    if (gdImageTrueColor(im) ) {
+ 		r=gdTrueColorGetRed(c);


More information about the scm-commits mailing list