From 01359a31212f55fa52c55972e003dda5893e4c2b Mon Sep 17 00:00:00 2001
From: nico <nico@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Date: Tue, 27 Sep 2005 08:09:45 +0000
Subject: [PATCH] build shared daemons, add codepages, remove cups printing
 support

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@1994 3c298f89-4303-0410-b956-a3cf2f4a3e73
---
 openwrt/package/samba/Config.in               |  8 +-
 openwrt/package/samba/Makefile                | 84 ++++++++++++++++---
 .../package/samba/ipkg/samba-client.control   |  3 +-
 openwrt/package/samba/ipkg/samba.control      |  4 +-
 4 files changed, 79 insertions(+), 20 deletions(-)

diff --git a/openwrt/package/samba/Config.in b/openwrt/package/samba/Config.in
index b2a6f866e..55f0ee4a1 100644
--- a/openwrt/package/samba/Config.in
+++ b/openwrt/package/samba/Config.in
@@ -1,12 +1,11 @@
 config BR2_COMPILE_SAMBA
 	bool
 	default n
-	depends BR2_PACKAGE_SAMBA || BR2_PACKAGE_SAMBA_CLIENT
+	depends BR2_PACKAGE_SAMBA || BR2_PACKAGE_SAMBA_CLIENT || BR2_PACKAGE_SMBFS
 
 config BR2_PACKAGE_SAMBA
 	tristate "samba - NetBIOS/SMB file and print server"
-#	default m if CONFIG_DEVEL
-	default n
+	default m if CONFIG_DEVEL
 	select BR2_COMPILE_SAMBA
 	help
 	 The Samba software suite is a collection of programs that implements the 
@@ -21,8 +20,7 @@ config BR2_PACKAGE_SAMBA
 
 config BR2_PACKAGE_SAMBA_CLIENT
 	tristate "samba-client - NetBIOS/SMB simple client"
-#	default m if CONFIG_DEVEL
-	default n
+	default m if CONFIG_DEVEL
 	select BR2_COMPILE_SAMBA
 	help
 	 The Samba software suite is a collection of programs that implements the 
diff --git a/openwrt/package/samba/Makefile b/openwrt/package/samba/Makefile
index 5491f151d..7a083b3a4 100644
--- a/openwrt/package/samba/Makefile
+++ b/openwrt/package/samba/Makefile
@@ -17,12 +17,49 @@ include $(TOPDIR)/package/rules.mk
 $(eval $(call PKG_template,SAMBA,samba,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
 $(eval $(call PKG_template,SAMBA_CLIENT,samba-client,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
 
-$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
-	(cd $(PKG_BUILD_DIR)/source; \
+$(PKG_BUILD_DIR)/.configured:
+	touch $@
+
+$(PKG_BUILD_DIR)/.built:
+	rm -rf $(PKG_INSTALL_DIR)
+	mkdir -p $(PKG_INSTALL_DIR)
+	(cd $(PKG_BUILD_DIR)/source ; rm -rf config.{cache,status} ; \
+		./configure \
+			--program-prefix="" \
+			--program-suffix="" \
+			--prefix=/usr \
+			--exec-prefix=/usr \
+			--bindir=/usr/bin \
+			--datadir=/usr/share \
+			--includedir=/usr/include \
+			--infodir=/usr/share/info \
+			--libdir=/usr/lib \
+			--libexecdir=/usr/lib \
+			--localstatedir=/var/log/samba \
+			--mandir=/usr/share/man \
+			--sbindir=/usr/sbin \
+			--sysconfdir=/etc/samba \
+			$(DISABLE_LARGEFILE) \
+			$(DISABLE_NLS) \
+			--with-lockdir=/var/run/samba \
+			--with-privatedir=/etc/samba \
+	);
+	$(MAKE) -C $(PKG_BUILD_DIR)/source \
+		bin/make_smbcodepage bin/make_unicodemap
+	(cd $(PKG_BUILD_DIR)/source/bin ; \
+		mv -f make_smbcodepage make_smbcodepage.old ; \
+		mv -f make_unicodemap make_unicodemap.old ; \
+	);
+
+	$(MAKE) -C $(PKG_BUILD_DIR)/source \
+		clean
+
+	(cd $(PKG_BUILD_DIR)/source; rm -rf config.{cache,status}; \
 		$(TARGET_CONFIGURE_OPTS) \
 		CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE -DNDEBUG -DSHMEM_SIZE=524288 -Dfcntl=fcntl64" \
 		CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
 		LDFLAGS="-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \
+		ac_cv_lib_cups_httpConnect=no \
 		ac_cv_sizeof_int=4 \
 		ac_cv_sizeof_long=4 \
 		ac_cv_sizeof_short=2 \
@@ -82,14 +119,31 @@ $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
 			$(DISABLE_NLS) \
 			--with-lockdir=/var/run/samba \
 			--with-privatedir=/etc/samba \
-			--enable-cups \
 	);
-	touch $@
-
-$(PKG_BUILD_DIR)/.built:
 	$(MAKE) -C $(PKG_BUILD_DIR)/source \
 		$(TARGET_CONFIGURE_OPTS) \
-		all
+		CODEPAGEDIR="/usr/share/samba" \
+		all shared
+	(cd $(PKG_BUILD_DIR)/source/bin ; \
+		mv -f make_smbcodepage.old make_smbcodepage ; touch make_smbcodepage ; \
+		mv -f make_unicodemap.old make_unicodemap ; touch make_unicodemap ; \
+	);
+	mkdir -p $(PKG_INSTALL_DIR)/usr/share/samba
+	mkdir -p $(PKG_INSTALL_DIR)/var/log
+	$(MAKE) -C $(PKG_BUILD_DIR)/source \
+		BASEDIR="$(PKG_INSTALL_DIR)/usr" \
+		BINDIR="$(PKG_INSTALL_DIR)/usr/bin" \
+		SBINDIR="$(PKG_INSTALL_DIR)/usr/bin" \
+		LIBDIR="$(PKG_INSTALL_DIR)/usr/lib" \
+		VARDIR="$(PKG_INSTALL_DIR)/var/log/samba" \
+		MANDIR="$(PKG_INSTALL_DIR)/usr/share/man" \
+		CONFIGDIR="$(PKG_INSTALL_DIR)/etc/samba" \
+		PRIVATEDIR="$(PKG_INSTALL_DIR)/etc/samba" \
+		SWATDIR="$(PKG_INSTALL_DIR)/usr/swat" \
+		LOCKDIR="$(PKG_INSTALL_DIR)/var/run/samba" \
+		SAMBABOOK="$(PKG_INSTALL_DIR)/usr/swat/using_samba" \
+		CODEPAGEDIR="$(PKG_INSTALL_DIR)/usr/share/samba" \
+		install
 	touch $@
 
 $(IPKG_SAMBA):
@@ -98,18 +152,24 @@ $(IPKG_SAMBA):
 	install -d -m0755 $(IDIR_SAMBA)/etc/samba
 	install -m0644 ./files/smb.conf $(IDIR_SAMBA)/etc/samba/smb.conf
 	install -d -m0755 $(IDIR_SAMBA)/usr/bin
-	install -m0755 $(PKG_BUILD_DIR)/source/bin/smbpasswd $(IDIR_SAMBA)/usr/bin/
+	install -m0755 $(PKG_BUILD_DIR)/source/bin/smbpasswd.shared $(IDIR_SAMBA)/usr/bin/smbpasswd
+	install -d -m0755 $(IDIR_SAMBA)/usr/lib
+	install -m0755 $(PKG_BUILD_DIR)/source/bin/libsmb.so $(IDIR_SAMBA)/usr/lib/
 	install -d -m0755 $(IDIR_SAMBA)/usr/sbin
-	install -m0755 $(PKG_BUILD_DIR)/source/bin/{n,s}mbd $(IDIR_SAMBA)/usr/sbin/
+	install -m0755 $(PKG_BUILD_DIR)/source/bin/nmbd.shared $(IDIR_SAMBA)/usr/sbin/nmbd
+	install -m0755 $(PKG_BUILD_DIR)/source/bin/smbd.shared $(IDIR_SAMBA)/usr/sbin/smbd
+	install -d -m0755 $(IDIR_SAMBA)/usr/share/samba
+	install -m0644 $(PKG_INSTALL_DIR)/usr/share/samba/codepage.{437,850} $(IDIR_SAMBA)/usr/share/samba/
 	$(RSTRIP) $(IDIR_SAMBA)
 	$(IPKG_BUILD) $(IDIR_SAMBA) $(PACKAGE_DIR)
 
 $(IPKG_SAMBA_CLIENT):
 	install -d -m0755 $(IDIR_SAMBA_CLIENT)/usr/bin
-	install -m0755 $(PKG_BUILD_DIR)/source/bin/smbclient $(IDIR_SAMBA_CLIENT)/usr/bin/
+	install -m0755 $(PKG_INSTALL_DIR)/usr/bin/smbclient $(IDIR_SAMBA_CLIENT)/usr/bin/
 	$(RSTRIP) $(IDIR_SAMBA_CLIENT)
 	$(IPKG_BUILD) $(IDIR_SAMBA_CLIENT) $(PACKAGE_DIR)
 
 mostlyclean:
-	make -C $(PKG_BUILD_DIR) clean
-	rm $(PKG_BUILD_DIR)/.built
+	-$(MAKE) -C $(PKG_BUILD_DIR) clean
+	rm -f $(PKG_BUILD_DIR)/.built
+
diff --git a/openwrt/package/samba/ipkg/samba-client.control b/openwrt/package/samba/ipkg/samba-client.control
index d829a7a0c..a9418efea 100644
--- a/openwrt/package/samba/ipkg/samba-client.control
+++ b/openwrt/package/samba/ipkg/samba-client.control
@@ -1,6 +1,7 @@
 Package: samba-client
 Priority: optional
 Section: net
-Maintainer: Oliver Ertl <oliver@ertl-net.net>, OpenWrt Developers Team <bugs@openwrt.org>
+Maintainer: OpenWrt Developers Team <bugs@openwrt.org>, Oliver Ertl <oliver@ertl-net.net>
 Source: http://openwrt.org/cgi-bin/viewcvs.cgi/openwrt/package/samba/
+Depends:
 Description: NetBIOS/SMB client
diff --git a/openwrt/package/samba/ipkg/samba.control b/openwrt/package/samba/ipkg/samba.control
index 01419db13..961c23f7a 100644
--- a/openwrt/package/samba/ipkg/samba.control
+++ b/openwrt/package/samba/ipkg/samba.control
@@ -1,7 +1,7 @@
 Package: samba
 Priority: optional
 Section: net
-Maintainer: Oliver Ertl <oliver@ertl-net.net>, OpenWrt Developers Team <bugs@openwrt.org>
+Maintainer: OpenWrt Developers Team <bugs@openwrt.org>, Oliver Ertl <oliver@ertl-net.net>
 Source: http://openwrt.org/cgi-bin/viewcvs.cgi/openwrt/package/samba/
+Depends:
 Description: NetBIOS/SMB file and print server
-Depends: cups
-- 
2.20.1