replace lots of manual install commands with INSTALL_* variables
[openwrt/svn-archive/archive.git] / utils / mgetty / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=mgetty
12 PKG_VERSION:=1.1.35
13 PKG_XVERSION:=Feb22
14 PKG_RELEASE:=1
15
16 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
17 PKG_SOURCE:=$(PKG_NAME)$(PKG_VERSION)-$(PKG_XVERSION).tar.gz
18 PKG_SOURCE_URL:=ftp://alpha.greenie.net/pub/mgetty/source/1.1
19 PKG_MD5SUM:=6805f8e31423bb777be80e3a856001cb
20 PKG_CAT:=zcat
21
22 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
23
24 include $(INCLUDE_DIR)/package.mk
25
26 define Package/mgetty
27 SECTION:=utils
28 CATEGORY:=Utilities
29 TITLE:=A data/fax solution for your analog modem
30 DESCRIPTION:=A data/fax solution for your analog modem.
31 endef
32
33 define Build/Configure
34 cp $(PKG_BUILD_DIR)/policy.h-dist $(PKG_BUILD_DIR)/policy.h
35 echo "#define AUTO_PPP" >> $(PKG_BUILD_DIR)/policy.h
36 echo "#undef FAX_NOTIFY_PROGRAM" >> $(PKG_BUILD_DIR)/policy.h
37 echo "#define FAX_NOTIFY_PROGRAM \"/usr/lib/mgetty+sendfax/new_fax\"" >> $(PKG_BUILD_DIR)/policy.h
38 echo "#undef DATA_FLOW" >> $(PKG_BUILD_DIR)/policy.h
39 echo "#define DATA_FLOW FLOW_HARD" >> $(PKG_BUILD_DIR)/policy.h
40 echo "#undef DEVICE_GROUP" >> $(PKG_BUILD_DIR)/policy.h
41 echo "#undef DEVICE_OWNER" >> $(PKG_BUILD_DIR)/policy.h
42 echo "#define DEVICE_OWNER \"root\"" >> $(PKG_BUILD_DIR)/policy.h
43 echo "#undef FAXREC_FLOW" >> $(PKG_BUILD_DIR)/policy.h
44 echo "#define FAXREC_FLOW FLOW_SOFT" >> $(PKG_BUILD_DIR)/policy.h
45 echo "#undef FAXSEND_FLOW" >> $(PKG_BUILD_DIR)/policy.h
46 echo "#define FAXSEND_FLOW FLOW_SOFT" >> $(PKG_BUILD_DIR)/policy.h
47 endef
48
49 #FIXME: don't manually install, use upstream Makefile instead
50 define Build/Compile
51 rm -rf $(PKG_INSTALL_DIR)
52 mkdir -p $(PKG_INSTALL_DIR)/usr/bin
53 mkdir -p $(PKG_INSTALL_DIR)/usr/sbin
54 mkdir -p $(PKG_INSTALL_DIR)/usr/lib/mgetty+sendfax
55 mkdir -p $(PKG_INSTALL_DIR)/etc/mgetty+sendfax
56 $(MAKE) -C $(PKG_BUILD_DIR) \
57 mksed
58 $(MAKE) -C $(PKG_BUILD_DIR) \
59 $(TARGET_CONFIGURE_OPTS) \
60 CFLAGS="$(TARGET_CFLAGS)" \
61 prefix="$(PKG_INSTALL_DIR)/usr" \
62 CONFDIR=/etc/mgetty+sendfax \
63 bin-all
64 $(CP) $(PKG_BUILD_DIR)/mgetty $(PKG_INSTALL_DIR)/usr/sbin
65 $(CP) $(PKG_BUILD_DIR)/sendfax $(PKG_INSTALL_DIR)/usr/sbin
66 $(CP) $(PKG_BUILD_DIR)/fax/faxrunqd $(PKG_INSTALL_DIR)/usr/sbin
67 chmod 755 $(PKG_INSTALL_DIR)/usr/sbin/*
68 $(CP) $(PKG_BUILD_DIR)/fax/faxq-helper $(PKG_INSTALL_DIR)/usr/lib/mgetty+sendfax
69 chmod u+s $(PKG_INSTALL_DIR)/usr/lib/mgetty+sendfax/faxq-helper
70 $(CP) $(PKG_BUILD_DIR)/fax/cour25n.pbm $(PKG_INSTALL_DIR)/usr/lib/mgetty+sendfax
71 $(CP) $(PKG_BUILD_DIR)/fax/cour25.pbm $(PKG_INSTALL_DIR)/usr/lib/mgetty+sendfax
72 $(CP) $(PKG_BUILD_DIR)/fax/faxq $(PKG_INSTALL_DIR)/usr/bin
73 $(CP) $(PKG_BUILD_DIR)/fax/faxrm $(PKG_INSTALL_DIR)/usr/bin
74 $(CP) $(PKG_BUILD_DIR)/fax/faxrunq $(PKG_INSTALL_DIR)/usr/bin
75 $(CP) $(PKG_BUILD_DIR)/fax/faxspool $(PKG_INSTALL_DIR)/usr/bin
76 $(CP) $(PKG_BUILD_DIR)/g3/g32pbm $(PKG_INSTALL_DIR)/usr/bin
77 (cd $(PKG_INSTALL_DIR)/usr/bin;\
78 ln -snf g32pbm g3topbm;\
79 );
80 $(CP) $(PKG_BUILD_DIR)/g3/g3cat $(PKG_INSTALL_DIR)/usr/bin
81 $(CP) $(PKG_BUILD_DIR)/g3/pbm2g3 $(PKG_INSTALL_DIR)/usr/bin
82 $(CP) $(PKG_BUILD_DIR)/g3/sff2g3 $(PKG_INSTALL_DIR)/usr/bin
83 chmod 755 $(PKG_INSTALL_DIR)/usr/bin/*
84 # Installation into /etc
85 $(CP) $(PKG_BUILD_DIR)/dialin.config $(PKG_INSTALL_DIR)/etc/mgetty+sendfax
86 $(CP) $(PKG_BUILD_DIR)/fax/faxheader $(PKG_INSTALL_DIR)/etc/mgetty+sendfax
87 $(CP) $(PKG_BUILD_DIR)/faxrunq.config $(PKG_INSTALL_DIR)/etc/mgetty+sendfax
88 $(CP) $(PKG_BUILD_DIR)/fax/faxspool.rules $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/faxspool.rules.sample
89 $(PKG_BUILD_DIR)/sedscript < $(PKG_BUILD_DIR)/login.cfg.in > $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/login.config
90 $(PKG_BUILD_DIR)/sedscript < $(PKG_BUILD_DIR)/mgetty.cfg.in > $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/mgetty.config
91 $(PKG_BUILD_DIR)/sedscript < $(PKG_BUILD_DIR)/sendfax.cfg.in > $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/sendfax.config
92 endef
93
94 define Package/mgetty/install
95 $(INSTALL_DIR) $(1)/usr/bin
96 $(INSTALL_BIN) \
97 $(PKG_INSTALL_DIR)/usr/bin/faxq \
98 $(PKG_INSTALL_DIR)/usr/bin/faxrm \
99 $(PKG_INSTALL_DIR)/usr/bin/faxrunq \
100 $(PKG_INSTALL_DIR)/usr/bin/faxspool \
101 $(PKG_INSTALL_DIR)/usr/bin/g32pbm \
102 $(PKG_INSTALL_DIR)/usr/bin/g3cat \
103 $(PKG_INSTALL_DIR)/usr/bin/pbm2g3 \
104 $(PKG_INSTALL_DIR)/usr/bin/sff2g3 \
105 $(1)/usr/bin/
106 $(INSTALL_DIR) $(1)/usr/sbin
107 $(INSTALL_BIN) \
108 $(PKG_INSTALL_DIR)/usr/sbin/mgetty \
109 $(PKG_INSTALL_DIR)/usr/sbin/sendfax \
110 $(PKG_INSTALL_DIR)/usr/sbin/faxrunqd \
111 $(1)/usr/sbin/
112 $(INSTALL_DIR) $(1)/usr/lib/mgetty+sendfax
113 install -m4755 \
114 $(PKG_INSTALL_DIR)/usr/lib/mgetty+sendfax/faxq-helper \
115 $(1)/usr/lib/mgetty+sendfax/
116 install -m644 \
117 $(PKG_INSTALL_DIR)/usr/lib/mgetty+sendfax/cour25n.pbm \
118 $(PKG_INSTALL_DIR)/usr/lib/mgetty+sendfax/cour25.pbm \
119 $(1)/usr/lib/mgetty+sendfax/
120 $(INSTALL_DIR) $(1)/etc/mgetty+sendfax
121 install -m600 \
122 $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/dialin.config \
123 $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/faxheader \
124 $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/faxrunq.config \
125 $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/faxspool.rules.sample \
126 $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/login.config \
127 $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/mgetty.config \
128 $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/sendfax.config \
129 $(1)/etc/mgetty+sendfax/
130 endef
131
132 $(eval $(call BuildPackage,mgetty))