| @@ -1,43 +1,43 @@ | | | @@ -1,43 +1,43 @@ |
1 | Cross-compilation in pkgsrc (user's guide) -*- outline -*- | | 1 | Cross-compilation in pkgsrc (user's guide) -*- outline -*- |
2 | Taylor R. Campbell <riastradh@NetBSD.org> | | 2 | Taylor R. Campbell <riastradh@NetBSD.org> |
3 | | | 3 | |
4 | $NetBSD: HOWTO-use-crosscompile,v 1.3 2016/05/04 02:03:13 riastradh Exp $ | | 4 | $NetBSD: HOWTO-use-crosscompile,v 1.4 2016/05/04 02:05:22 riastradh Exp $ |
5 | | | 5 | |
6 | The following steps enable you to build binary packages for a machine | | 6 | The following steps enable you to build binary packages for a machine |
7 | architecture other than the one you are building on. For example, you | | 7 | architecture other than the one you are building on. For example, you |
8 | might use them on your beefy umpteen-core amd64-based build machine | | 8 | might use them on your beefy umpteen-core amd64-based build machine |
9 | (the `native' machine) to build packages for your feeble powerpc-based | | 9 | (the `native' machine) to build packages for your feeble powerpc-based |
10 | network appliance (the `target' machine). | | 10 | network appliance (the `target' machine). |
11 | | | 11 | |
12 | These instructions assume you use the conventional privileged paths: | | 12 | These instructions assume you use the conventional privileged paths: |
13 | /usr/src for the NetBSD source tree, /usr/obj for the NetBSD object | | 13 | /usr/src for the NetBSD source tree, /usr/obj for the NetBSD object |
14 | tree, and /usr/pkgsrc for the pkgsrc tree. If you want to do it | | 14 | tree, and /usr/pkgsrc for the pkgsrc tree. If you want to do it |
15 | unprivileged, see `* Unprivileged notes' below. | | 15 | unprivileged, see `* Unprivileged notes' below. |
16 | | | 16 | |
17 | XXX This currently works only for NetBSD. | | 17 | XXX This currently works only for NetBSD. |
18 | | | 18 | |
19 | * Build NetBSD tools and distribution for the target system | | 19 | * Build NetBSD tools and distribution for the target system |
20 | | | 20 | |
21 | Use build.sh to build NetBSD tools and a distribution, and remember | | 21 | Use build.sh to build NetBSD tools and a distribution, and remember |
22 | what the destdir and tooldir are -- you'll need them for pkgsrc's | | 22 | what the destdir and tooldir are -- you'll need them for pkgsrc's |
23 | mk.conf. | | 23 | mk.conf. |
24 | | | 24 | |
25 | $ cd /usr/src | | 25 | $ cd /usr/src |
26 | $ ./build.sh -m evbppc tools | | 26 | $ ./build.sh -m evbppc tools |
27 | $ ./build.sh -m evbppc distribution | | 27 | $ ./build.sh -m evbppc distribution |
28 | | | 28 | |
29 | By default, the destdir will be /usr/obj/destdir.evbppc, and the | | 29 | By default, the destdir will be /usr/obj/destdir.evbppc, and the |
30 | tooldir will be (say) /usr/obj/tooldir.NetBSD-6.1.amd64 if you're | | 30 | tooldir will be (say) /usr/obj/tooldir.NetBSD-6.1-amd64 if you're |
31 | running NetBSD 6.1 on amd64. | | 31 | running NetBSD 6.1 on amd64. |
32 | | | 32 | |
33 | * Set up mk.conf | | 33 | * Set up mk.conf |
34 | | | 34 | |
35 | In addition to whatever else you want in your mk.conf for pkgsrc, add: | | 35 | In addition to whatever else you want in your mk.conf for pkgsrc, add: |
36 | | | 36 | |
37 | # Cross-compile by default. | | 37 | # Cross-compile by default. |
38 | # | | 38 | # |
39 | # XXX This currently can't be set to `yes' on the command line, | | 39 | # XXX This currently can't be set to `yes' on the command line, |
40 | # which is a bug. | | 40 | # which is a bug. |
41 | USE_CROSS_COMPILE?= yes | | 41 | USE_CROSS_COMPILE?= yes |
42 | | | 42 | |
43 | # This is a kludge for cross-libtool. | | 43 | # This is a kludge for cross-libtool. |
| @@ -115,27 +115,27 @@ build a native package, you can run | | | @@ -115,27 +115,27 @@ build a native package, you can run |
115 | | | 115 | |
116 | XXX Note that currently you cannot omit USE_CROSS_COMPILE?=yes from | | 116 | XXX Note that currently you cannot omit USE_CROSS_COMPILE?=yes from |
117 | your mk.conf and pass USE_CROSS_COMPILE=yes on the make command line. | | 117 | your mk.conf and pass USE_CROSS_COMPILE=yes on the make command line. |
118 | This is a bug. | | 118 | This is a bug. |
119 | | | 119 | |
120 | * Unprivileged notes | | 120 | * Unprivileged notes |
121 | | | 121 | |
122 | I do all this stuff unprivileged in directories under my home | | 122 | I do all this stuff unprivileged in directories under my home |
123 | directory so that it's easy for me to nuke build products without | | 123 | directory so that it's easy for me to nuke build products without |
124 | messing with the package installations I use for development. | | 124 | messing with the package installations I use for development. |
125 | | | 125 | |
126 | NetBSD srcdir: ~/netbsd/current/src | | 126 | NetBSD srcdir: ~/netbsd/current/src |
127 | NetBSD objdir: ~/netbsd/current/obj.evbppc | | 127 | NetBSD objdir: ~/netbsd/current/obj.evbppc |
128 | NetBSD tooldir: ~/netbsd/current/obj.evbppc/tooldir.NetBSD-6.1.amd64 | | 128 | NetBSD tooldir: ~/netbsd/current/obj.evbppc/tooldir.NetBSD-6.1-amd64 |
129 | NetBSD destdir: ~/netbsd/current/obj.evbppc/destdir.evbppc | | 129 | NetBSD destdir: ~/netbsd/current/obj.evbppc/destdir.evbppc |
130 | pkgsrc: ~/pkgsrc/current/pkgsrc | | 130 | pkgsrc: ~/pkgsrc/current/pkgsrc |
131 | pkgsrc LOCALBASE: ~/pkgsrc/current/pkg | | 131 | pkgsrc LOCALBASE: ~/pkgsrc/current/pkg |
132 | | | 132 | |
133 | (~/netbsd/current/src and ~/pkgsrc/current/pkgsrc are actually | | 133 | (~/netbsd/current/src and ~/pkgsrc/current/pkgsrc are actually |
134 | read-only null mounts of ~/netbsd/current/src-cvs and | | 134 | read-only null mounts of ~/netbsd/current/src-cvs and |
135 | ~/pkgsrc/current/pkgsrc-cvs, respectively.) | | 135 | ~/pkgsrc/current/pkgsrc-cvs, respectively.) |
136 | | | 136 | |
137 | To build NetBSD, I run: | | 137 | To build NetBSD, I run: |
138 | | | 138 | |
139 | $ cd ~/netbsd/current/src | | 139 | $ cd ~/netbsd/current/src |
140 | $ ./build.sh -O ../obj.evbppc -U -u -m evbppc -j12 tools | | 140 | $ ./build.sh -O ../obj.evbppc -U -u -m evbppc -j12 tools |
141 | $ ./build.sh -O ../obj.evbppc -U -u -m evbppc -j12 distribution | | 141 | $ ./build.sh -O ../obj.evbppc -U -u -m evbppc -j12 distribution |