From: florian Date: Fri, 12 Dec 2008 14:51:12 +0000 (+0000) Subject: Add libinklevel (#4335), thanks Raphael X-Git-Url: http://207.154.207.93/?a=commitdiff_plain;h=d8232d1e79c39478926533bfacd1f49f2d43696f;p=packages.git Add libinklevel (#4335), thanks Raphael git-svn-id: svn://svn.openwrt.org/openwrt/packages@13614 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- diff --git a/libs/libinklevel/Makefile b/libs/libinklevel/Makefile new file mode 100644 index 000000000..3bf47c226 --- /dev/null +++ b/libs/libinklevel/Makefile @@ -0,0 +1,66 @@ +# +# Copyright (C) 2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id: Makefile 12228 2008-08-06 22:43:15Z nbd $ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=libinklevel +PKG_VERSION:=0.7.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/libinklevel +PKG_MD5SUM:=c7ccefec29d1d218d1aae240f6044fe1 + +include $(INCLUDE_DIR)/package.mk + +define Package/libinklevel + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=$(if $(WITH_PARPORT), +libieee1284) + TITLE:=Printers Ink Level Library + URL:=http://libinklevel.sourceforge.net/ +endef + +define Package/libinklevel/description + Libinklevel is a library for checking the ink level of your printer on a system which runs Linux. +endef + +TARGET_CFLAGS += $(FPIC) +TARGET_LIBS += $(if $(WITH_PARPORT), -lieee1284) + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + CC="$(TARGET_CC)" \ + CFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="$(TARGET_CPPFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + LIBS="$(TARGET_LIBS)" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(INSTALL_DATA) \ + $(PKG_INSTALL_DIR)/usr/include/inklevel.h \ + $(1)/usr/include/ + + $(INSTALL_DIR) $(1)/usr/lib + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/libinklevel.so* \ + $(1)/usr/lib/ +endef + +define Package/libinklevel/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/libinklevel.so* \ + $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,libinklevel)) diff --git a/libs/libinklevel/patches/001-makefile.patch b/libs/libinklevel/patches/001-makefile.patch new file mode 100644 index 000000000..b1a1bb266 --- /dev/null +++ b/libs/libinklevel/patches/001-makefile.patch @@ -0,0 +1,21 @@ +--- libinklevel-0.7.3.orig/Makefile 2008-12-10 17:09:05.052017664 +0100 ++++ libinklevel-0.7.3/Makefile 2008-12-10 19:40:44.904051107 +0100 +@@ -1,7 +1,7 @@ +-DESTDIR = +-PREFIX = /usr/local +-CFLAGS += -Wall -O2 -fPIC -DPIC -I. +-CC = gcc ++#DESTDIR = ++PREFIX = /usr ++#CFLAGS += -Wall -O2 -fPIC -DPIC -I. ++#CC = gcc + + all: libinklevel.so.4.0.7.3 + +@@ -36,5 +36,5 @@ libinklevel.so.4.0.7.3: canon.o d4lib.o + linux.o util.o + $(CC) $(CFLAGS) -shared -Wl,-soname,libinklevel.so.4 \ + -o libinklevel.so.4.0.7.3 canon.o d4lib.o epson_new.o \ +- hp_new.o libinklevel.o linux.o util.o -lc -lieee1284 ++ hp_new.o libinklevel.o linux.o util.o $(LIBS) + diff --git a/libs/libinklevel/patches/002-disable_parport.patch b/libs/libinklevel/patches/002-disable_parport.patch new file mode 100644 index 000000000..5b379b1ca --- /dev/null +++ b/libs/libinklevel/patches/002-disable_parport.patch @@ -0,0 +1,52 @@ +--- libinklevel-0.7.3.orig/linux.c 2008-12-10 17:09:05.052017664 +0100 ++++ libinklevel-0.7.3/linux.c 2008-12-10 17:19:59.362144646 +0100 +@@ -8,7 +8,9 @@ + + #include "inklevel.h" + ++#ifdef WITH_PARPORT + #include ++#endif + + #include + #include +@@ -30,7 +32,9 @@ int open_printer_device(const int port, + + int get_device_id(const int port, const char *device_file, + const int portnumber, char *device_id) { ++#ifdef WITH_PARPORT + struct parport_list parports; ++#endif + char tmp[BUFLEN]; + char device_file1[256]; + char device_file2[256]; +@@ -39,6 +43,7 @@ int get_device_id(const int port, const + char *c; + int realsize; + ++#ifdef WITH_PARPORT + if (port == PARPORT ) { + /* check if we have appropiate permissions */ + +@@ -71,7 +76,9 @@ int get_device_id(const int port, const + + return COULD_NOT_GET_DEVICE_ID; + +- } else if (port == USB || port == CUSTOM_USB) { ++ } else ++#endif ++ if (port == USB || port == CUSTOM_USB) { + + if (port == USB) { + sprintf(device_file1, "/dev/usb/lp%d", portnumber); +@@ -132,8 +139,10 @@ int open_printer_device(const int port, + if (port == USB) { + sprintf(device_file1, "/dev/usb/lp%d", portnumber); + sprintf(device_file2, "/dev/usblp%d", portnumber); ++#ifdef WITH_PARPORT + } else if (port == PARPORT) { + sprintf(device_file1, "/dev/lp%d", portnumber); ++#endif + } else if (port == CUSTOM_USB) { + strncpy(device_file1, device_file, 255); + device_file1[255] = '\0';