• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/LPRng/DISTRIBUTIONS/FreeBSD-4.ports.sysutils.LPRng/
1#  FreeBSD LPRng Distribution Port Generation
2#       Patrick Powell
3#    Tue Jun  6 18:06:07 PDT 2000
4#
5#  The scripts in this directory largely automate the process
6#    of building a LPRng port or package for FreeBSD.  They
7#    a) ${MAKE} the pkg-plist and other files
8#    b) do a slew of regression tests, etc.
9#    c) make a port or package
10#
11#  Added targets for package/port/testers:
12#    All REPEAT ALL of these targets have security loopholes and should NOT
13#    be used on a system where other users are active.  You have been
14#    warned.
15#
16#   plist:    this makes the pkg-plist. It is assumed
17#             that you will do this on a standalone system, so
18#             it is not paranoid about testing for files, etc.
19#             You are warned.
20#   checkit:  you should use this target to (literally) checkit
21#             to ${MAKE} sure the package installs
22#   cleanit:  you should use this target to clean things up.
23#             This is the equivalent of 'distclean'
24#   packageit:  ${MAKE} a package, install it, clean it, abuse it,
25#             and otherwise torture test it.  Used for checking
26#             to ${MAKE} sure scripts work
27#   addit:    use pkg_add
28#   removeit: use pkg_delete
29#
30#Step 1: untar the distribution and then go the the FreeBSD support directory:
31#    tar zxvf LPRng-...tgz
32#    cd LPRng*/DI*/FR*
33#
34#Step 2: (For the VERY paranoid)
35#   read the rest of this Makefile!
36#	${MAKE} -f Makefile.build checkit
37#     this does all sorts of tests, etc.
38#   The final result is LPRng installed and a port made in this
39#   directory.
40#
41#Step 2: (For the blithely accepting)
42#   ${MAKE} -f Makefile.build plist
43#   ${MAKE} port
44#
45
46
47all:
48	@echo "checkit:  you should use this target to (literally) checkit"
49	@echo "		 to ${MAKE} sure the package installs and to generate a port."
50	@echo "		 Does:  make makesum plist deinstall reinstall package port"
51
52	@echo "cleanit:  you should use this target to clean things up."
53	@echo "		 This is the equivalent of 'distclean'"
54	@echo "packageit:  ${MAKE} a package, install it, clean it, abuse it,"
55	@echo "		 and otherwise torture test it.  Used for checking"
56	@echo "		 to ${MAKE} sure scripts work"
57	@echo "plist:    this makes the pkg-plist. It is assumed"
58	@echo "		 that you will do this on a standalone system, so"
59	@echo "		 it is not paranoid about testing for files, etc."
60	@echo "addit:    use pkg_add"
61	@echo "removeit: use pkg_delete"
62
63checkit:
64	-v=`pkg_info |grep ${PORTNAME} | sed -e 's/ .*//'`; pkg_delete $$v
65	${MAKE} clean makesum
66	${MAKE} -f Makefile.build plist
67	-${MAKE} deinstall
68	${MAKE} reinstall FORCE_PKG_REGISTER=YES
69	${MAKE} package FORCE_PKG_REGISTER=YES
70	${MAKE} deinstall
71	pkg_add ${DISTNAME}*z
72	pkg_delete ${DISTNAME}
73	${MAKE} -f Makefile.build port
74
75plist:
76	-${MAKE} deinstall
77	${MAKE} all
78	MAN1=`cd work/*/man; ls *1`; MAN5=`cd work/*/man; ls *5`; MAN8=`cd work/*/man; ls *8`; \
79	MAN1=`echo $$MAN1`; MAN5=`echo $$MAN5`; MAN8=`echo $$MAN8`; \
80	perl -spi \
81		-e "s/^MAN1=.*/MAN1=$$MAN1/;" \
82		-e "s/^MAN5=.*/MAN5=$$MAN5/;" \
83		-e "s/^MAN8=.*/MAN8=$$MAN8/;" \
84		Makefile
85	${MAKE} FORCE_PKG_REGISTER=YES VERBOSE_INSTALL="set -x" reinstall MAKEPACKAGE=YES  2>&1 |tee /tmp/install.log
86	sed -n -e "/\/man\//d" -e "/^\/usr\/bin\/install/s,.* ${PREFIX}/,,p" /tmp/install.log |sort >pkg-plist
87	sed -n -e "/\/usr\/bin\/install.*sample/s,.* ${PREFIX}/,,p" /tmp/install.log >>pkg-plist
88	sed -n -e "/\/usr\/bin\/install.*.sh/s,.* ${PREFIX}/,,p" /tmp/install.log >>pkg-plist
89	find ${DOCSDIR} -type f | sed -e 's,${DOCSDIR}/,%%PORTDOCS%%%%DOCSDIR%%/,' >>pkg-plist
90	echo '%%PORTDOCS%%@dirrm %%DOCSDIR%%/Reference' >>pkg-plist
91	echo '%%PORTDOCS%%@dirrm %%DOCSDIR%%/PrintingCookbook' >>pkg-plist
92	echo '%%PORTDOCS%%@dirrm %%DOCSDIR%%' >>pkg-plist
93
94# put the updated postinstall script into the package directory
95	if [ -f ${WRKSRC}/preremove ] ; then ${CP} ${WRKSRC}/preremove pkg-deinstall; fi
96	if [ -f ${WRKSRC}/postinstall ] ; then ${CP} ${WRKSRC}/postinstall pkg-install; fi
97
98	sed -e 's!DOCSDIR!${DOCSDIR}!' files-pkg-message >pkg-message
99	-${MAKE} deinstall
100
101# do the tests in the book.  But we cheat a bit
102packageit:
103	-${RM} -f *.*z
104	-${MAKE} deinstall
105	${MAKE} reinstall FORCE_PKG_REGISTER=YES
106	${MAKE} package
107	${MAKE} deinstall
108	pkg_add *.*z
109	pkg_delete ${DISTNAME}
110
111addit:
112	pkg_add ${DISTNAME}.*z
113removeit:
114	pkg_delete ${DISTNAME}
115
116port:
117	-pkg_delete ${DISTNAME}
118	rm -rf *.*z *.bak *.tbz2 /tmp/${PORTNAME}
119	mkdir /tmp/${PORTNAME}
120	-cp Makefile distinfo files-* pkg-* /tmp/${PORTNAME}
121	cd /tmp; shar ` find ${PORTNAME} -print` >${PORTNAME}.port ; rm -rf ${PORTNAME}
122	cd /tmp; sh ${PORTNAME}.port; cd ${PORTNAME}; ${MAKE} install
123
124cleanit:
125	rm -rf pkg-plist distinfo *.*z work
126	cp /dev/null pkg-plist
127
128TESTDIR=/tmp/DISTDIR
129test-fetch:
130	-rm -rf ${TESTDIR}
131	${MKDIR} ${TESTDIR}
132	(cd ${TESTDIR}; \
133	 for file in ${DISTFILES}; do \
134			md5 /usr/ports/distfiles/$${file}; \
135			for site in `${SORTED_MASTER_SITES_CMD}`; do \
136			    ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
137				DIR=${DIST_SUBDIR}; \
138				case $${file} in \
139				*/*)	${MKDIR} $${file%/*}; \
140						args="-o $${file} $${site}$${file}";; \
141				*)		args=$${site}$${file};; \
142				esac; \
143				if ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${args} ${FETCH_AFTER_ARGS}; then \
144					${ECHO_MSG} ">> OK $${file} from $${site}"; \
145					md5 $${file}; \
146				else \
147					${ECHO_MSG} ">> FAIL $${file} from $${site}";\
148				fi \
149			done; \
150	 done)
151
152.include "Makefile"
153