annotate share/mk/zrouter.ports.mk @ 487:5616a3d38d8e

[mq]: cross-ports
author Aleksandr Rybalko <ray@ddteam.net>
date Fri, 02 Nov 2012 15:36:00 +0200
parents 91ceb933eeff
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
73
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
1 # Ports
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
2
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
3 # that may used for any platform
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
4 # we need only say cross-build to configure
487
5616a3d38d8e [mq]: cross-ports
Aleksandr Rybalko <ray@ddteam.net>
parents: 95
diff changeset
5 TARGET_ARCH=mips
5616a3d38d8e [mq]: cross-ports
Aleksandr Rybalko <ray@ddteam.net>
parents: 95
diff changeset
6 CFLAGS="-std=c99 -I${WORLDDESTDIR}/include"
73
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
7
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
8 _TARGET_DEFS = \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
9 TARGET_VENDOR=${TARGET_VENDOR} \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
10 TARGET_DEVICE=${TARGET_DEVICE} \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
11 FREEBSD_SRC_TREE=${FREEBSD_SRC_TREE} \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
12 TARGET_PROFILES="${TARGET_PROFILES}"
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
13
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
14
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
15
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
16 _TARGET_CROSS_DEFS = \
487
5616a3d38d8e [mq]: cross-ports
Aleksandr Rybalko <ray@ddteam.net>
parents: 95
diff changeset
17 PATH=/usr/mips-freebsd/usr/bin:${PATH} \
73
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
18 PKG_CONFIG_PATH=${WORLDDESTDIR}/libdata/pkgconfig/ \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
19 DISTDIR=${ZROUTER_OBJ}/distfiles/ \
487
5616a3d38d8e [mq]: cross-ports
Aleksandr Rybalko <ray@ddteam.net>
parents: 95
diff changeset
20 PKG_DBDIR=${WORLDDESTDIR}/libdata/var/db/pkg \
5616a3d38d8e [mq]: cross-ports
Aleksandr Rybalko <ray@ddteam.net>
parents: 95
diff changeset
21 TARGET_ARCH=mips \
73
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
22 NO_INSTALL_MANPAGES=yes \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
23 WITHOUT_CHECK=yes \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
24 NO_PKG_REGISTER=yes \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
25 NO_DEPENDS=yes \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
26 NOPORTDOCS=yes \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
27 BINOWN=ray \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
28 BINGRP=wheel \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
29 NOPORTEXAMPLES=yes \
487
5616a3d38d8e [mq]: cross-ports
Aleksandr Rybalko <ray@ddteam.net>
parents: 95
diff changeset
30 INSTALL=${ZROUTER_ROOT}/tools/install.sh \
73
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
31 ac_cv_func_malloc_0_nonnull=yes \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
32 ac_cv_func_realloc_0_nonnull=yes \
487
5616a3d38d8e [mq]: cross-ports
Aleksandr Rybalko <ray@ddteam.net>
parents: 95
diff changeset
33 AUTOTOOLS_LOCALBASE=/usr/local \
5616a3d38d8e [mq]: cross-ports
Aleksandr Rybalko <ray@ddteam.net>
parents: 95
diff changeset
34 LIBDIR+=${WORLDDESTDIR}/lib \
5616a3d38d8e [mq]: cross-ports
Aleksandr Rybalko <ray@ddteam.net>
parents: 95
diff changeset
35 LDADD+="-L${WORLDDESTDIR}/lib" \
5616a3d38d8e [mq]: cross-ports
Aleksandr Rybalko <ray@ddteam.net>
parents: 95
diff changeset
36 CXXFLAGS="-I${WORLDDESTDIR}/include -I${WORLDDESTDIR}/include/json"
73
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
37 # LIBTOOL=/usr/local/bin/libtool \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
38 # -ELIBTOOL
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
39
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
40 # ac_cv_func_malloc_0_nonnull=yes avoid "undefined reference to `rpl_malloc'"
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
41 # ac_cv_func_realloc_0_nonnull=yes avoid "undefined reference to `rpl_realloc'"
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
42
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
43 port-build:
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
44 mkdir -p ${WORLDDESTDIR}
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
45 @echo "----> Start building ports dependencies ..."
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
46 .for dir in ${WORLD_SUBDIRS_PORTS}
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
47 @echo "Start ${dir} port building..."
487
5616a3d38d8e [mq]: cross-ports
Aleksandr Rybalko <ray@ddteam.net>
parents: 95
diff changeset
48 mkdir -p ${WORLDDESTDIR}/libdata/var/db/pkg
73
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
49 cd ${ZROUTER_ROOT} ;${MAKE} ${_TARGET_DEFS} PORT_BUILD_DEPEND_CROSS=${dir} port-build-depend-cross
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
50 .endfor
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
51 @echo "----> Ports dependencies build done ..."
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
52
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
53
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
54 # Cross-compilation of dependency, build dependency must be built with host env
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
55 # LIB and RUN dependency should be builded with cross environment
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
56 # Else (FETCH, EXTRACT, PATCH, BUILD dependency) with host env
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
57
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
58 port-build-depend-cross:
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
59 .for dir in ${PORT_BUILD_DEPEND_CROSS}
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
60 @echo "--------> Start ${dir} port building ..."
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
61 @echo "------------> Test FETCH EXTRACT PATCH BUILD dependency for ${dir}..."
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
62 _DEPENDS=$$(cd ${dir} ; ${MAKE} -VFETCH_DEPENDS -VEXTRACT_DEPENDS -VPATCH_DEPENDS -VBUILD_DEPENDS) ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
63 if [ "x$${_DEPENDS}" != "x" ] ; then \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
64 echo "$${_DEPENDS}" ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
65 ${MAKE} -f /usr/ports/Mk/bsd.port.mk BUILD_DEPENDS="$${_DEPENDS}" depends ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
66 fi
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
67 @echo "------------> Test LIB dependency for ${dir}..."
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
68 @_DEPENDS=$$(cd ${dir} ; ${MAKE} -VLIB_DEPENDS) ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
69 echo "LIB_DEPENDS=$${_DEPENDS}" ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
70 for _DEP in $${_DEPENDS} ; do \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
71 _DEPTEST=$${_DEP%%:*} ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
72 echo "Test if $${_DEPTEST} present" ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
73 LIBNAME=$${_DEPTEST%.*} ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
74 LIBVER=$${_DEPTEST#*.} ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
75 if [ "$${LIBNAME}" = "$${LIBVER}" ] ; then LIBVER="" ; else LIBVER=".$${LIBVER}" ; fi ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
76 SONAME=lib$${LIBNAME}.so$${LIBVER} ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
77 echo Search for $${SONAME} ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
78 MATCHED_LIBS=$$(find ${WORLDDESTDIR}/lib ${WORLDDESTDIR}/usr/lib -name $${SONAME}) ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
79 _DEPPATH=$${_DEP#*:} ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
80 if [ -z $${MATCHED_LIBS} ] ; then \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
81 cd ${ZROUTER_ROOT} ; ${MAKE} ${_TARGET_DEFS} PORT_BUILD_DEPEND_CROSS=$${_DEPPATH} port-build-depend-cross ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
82 fi ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
83 done
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
84 @echo "------------> Test RUN dependency for ${dir}..."
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
85 @_DEPENDS=$$(cd ${dir} ; ${MAKE} -VRUN_DEPENDS) ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
86 echo "RUN_DEPENDS=$${_DEPENDS}" ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
87 for _DEP in $${_DEPENDS} ; do \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
88 _DEPTEST=$${_DEP%%:*} ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
89 echo "$${_DEPTEST} is pkg-config?" ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
90 if [ "$${_DEPTEST}" = "pkg-config" ] ; then continue ; fi ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
91 echo "Test if $${_DEPTEST} present" ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
92 _DEPPATH=$${_DEP#*:} ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
93 cd ${ZROUTER_ROOT} ; ${MAKE} ${_TARGET_DEFS} PORT_BUILD_DEPEND_CROSS=$${_DEPPATH} port-build-depend-cross ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
94 done
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
95 @echo "------------> Build ${dir}..."
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
96 @cd ${dir} ; ${MAKE} ${_TARGET_CROSS_DEFS} WRKDIR=${ZROUTER_OBJ}/ports/${dir} generate-plist
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
97 @PORT_PLIST=$$( cd ${dir} ; ${MAKE} ${_TARGET_CROSS_DEFS} WRKDIR=${ZROUTER_OBJ}/ports/${dir} -VTMPPLIST ) ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
98 PORT_STATUS=$$( ${ZROUTER_ROOT}/tools/checkdep.pl libs $${PORT_PLIST} ${WORLDDESTDIR} ) ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
99 if [ $${PORT_STATUS} -lt 50 ] ; then \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
100 echo "$${PORT_STATUS}% of files matched, do install" ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
101 rm -f ${ZROUTER_OBJ}/ports/${dir}/.install* ; \
487
5616a3d38d8e [mq]: cross-ports
Aleksandr Rybalko <ray@ddteam.net>
parents: 95
diff changeset
102 echo cd ${dir} ; echo ${MAKE} ${_TARGET_CROSS_DEFS} WRKDIR=${ZROUTER_OBJ}/ports/${dir} install CHROOTED=no DESTDIR=${WORLDDESTDIR} PREFIX=/; \
5616a3d38d8e [mq]: cross-ports
Aleksandr Rybalko <ray@ddteam.net>
parents: 95
diff changeset
103 cd ${dir} ; PATH=${FREEBSD_BUILD_ENV_PATH} ${MAKE} ${_TARGET_CROSS_DEFS} WRKDIR=${ZROUTER_OBJ}/ports/${dir} install CHROOTED=no DESTDIR=${WORLDDESTDIR} PREFIX=/ || \
73
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
104 ( ${MAKE} WRKDIR=${ZROUTER_OBJ}/ports/${dir} clean && \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
105 echo ${MAKE} WRKDIR=${ZROUTER_OBJ}/ports/${dir} configure && \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
106 ${MAKE} WRKDIR=${ZROUTER_OBJ}/ports/${dir} configure && \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
107 mv `${MAKE} WRKDIR=${ZROUTER_OBJ}/ports/${dir} -VPATCH_COOKIE` `${MAKE} ${_TARGET_CROSS_DEFS} WRKDIR=${ZROUTER_OBJ}/ports/${dir} -VPATCH_COOKIE` && \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
108 mv `${MAKE} WRKDIR=${ZROUTER_OBJ}/ports/${dir} -VEXTRACT_COOKIE` `${MAKE} ${_TARGET_CROSS_DEFS} WRKDIR=${ZROUTER_OBJ}/ports/${dir} -VEXTRACT_COOKIE` && \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
109 mv `${MAKE} WRKDIR=${ZROUTER_OBJ}/ports/${dir} -VCONFIGURE_COOKIE` `${MAKE} ${_TARGET_CROSS_DEFS} WRKDIR=${ZROUTER_OBJ}/ports/${dir} -VCONFIGURE_COOKIE` && \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
110 echo ${MAKE} ${_TARGET_CROSS_DEFS} WRKDIR=${ZROUTER_OBJ}/ports/${dir} all && \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
111 ${MAKE} ${_TARGET_CROSS_DEFS} WRKDIR=${ZROUTER_OBJ}/ports/${dir} all && \
487
5616a3d38d8e [mq]: cross-ports
Aleksandr Rybalko <ray@ddteam.net>
parents: 95
diff changeset
112 echo ${MAKE} ${_TARGET_CROSS_DEFS} WRKDIR=${ZROUTER_OBJ}/ports/${dir} install CHROOTED=no DESTDIR=${WORLDDESTDIR} PREFIX=/ && \
73
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
113 ${MAKE} ${_TARGET_CROSS_DEFS} WRKDIR=${ZROUTER_OBJ}/ports/${dir} install ) ; \
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
114 fi
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
115 .endfor
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
116 @echo "--------> Done building ${dir} port ..."
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
117
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
118
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
119 # Host tools required for extract, patch, configure, build etc.
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
120 # All dependency should be builded and installed with host environment
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
121 # so now we don`t care about dependency type.
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
122
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
123 port-build-depend-host:
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
124 @echo "Start PORTNAME port building..."
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
125 .for dir in ${PORT_BUILD_DEPEND_HOST}
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
126 @echo "---------> build/install/clean for port ${dir} as dependency with host environment"
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
127 cd ${dir} ; ${MAKE} install clean
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
128 @echo "---------> port ${dir} done (dependency)"
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
129 .endfor
1068cdce09a2 tidy up
ray@terran.dlink.ua
parents:
diff changeset
130