| @@ -1,89 +1,91 @@ | | | @@ -1,89 +1,91 @@ |
1 | # $NetBSD: options.mk,v 1.2 2008/04/25 20:33:08 bjs Exp $ | | 1 | # $NetBSD: options.mk,v 1.3 2008/04/27 09:43:12 tnn Exp $ |
2 | | | 2 | |
3 | PKG_OPTIONS_VAR= PKG_OPTIONS.MesaLib | | 3 | PKG_OPTIONS_VAR= PKG_OPTIONS.MesaLib |
4 | PKG_SUPPORTED_OPTIONS= mesa-execmem-mmap | | 4 | PKG_SUPPORTED_OPTIONS= mesa-execmem-mmap |
5 | | | 5 | |
6 | # Assembler code build configurations | | 6 | # Assembler code build configurations |
7 | .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" | | 7 | .if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64") && \ |
| | | 8 | ${OPSYS} != "SunOS" |
8 | PKG_SUPPORTED_OPTIONS+= ${MACHINE_ARCH} | | 9 | PKG_SUPPORTED_OPTIONS+= ${MACHINE_ARCH} |
9 | PKG_SUGGESTED_OPTIONS+= ${MACHINE_ARCH} | | 10 | PKG_SUGGESTED_OPTIONS+= ${MACHINE_ARCH} |
10 | .endif | | 11 | .endif |
11 | ### | | 12 | ### |
12 | ### XXX Prior to this patch, Mesa only allocated executable memory | | 13 | ### XXX Prior to this patch, Mesa only allocated executable memory |
13 | ### with mmap(2) and PROT_EXEC on linux. On e.g. OpenBSD and NetBSD, | | 14 | ### with mmap(2) and PROT_EXEC on linux. On e.g. OpenBSD and NetBSD, |
14 | ### pages which absolutely required PROT_EXEC were allocated using | | 15 | ### pages which absolutely required PROT_EXEC were allocated using |
15 | ### malloc(3). You may wonder why it only worked on Linux. Answer: | | 16 | ### malloc(3). You may wonder why it only worked on Linux. Answer: |
16 | ### the code was excluded with '#ifdef __linux__'! "Porting" this | | 17 | ### the code was excluded with '#ifdef __linux__'! "Porting" this |
17 | ### [to BSD platforms] involved adding three lines of [preprocessor] | | 18 | ### [to BSD platforms] involved adding three lines of [preprocessor] |
18 | ### code (see patch-ap if you're curious). | | 19 | ### code (see patch-ap if you're curious). |
19 | ### | | 20 | ### |
20 | ### Please do note hack (NetBSD-only for now) I added to wire down | | 21 | ### Please do note hack (NetBSD-only for now) I added to wire down |
21 | ### this memory by setting the MESA_EXECMEM_MMAP environment variable; | | 22 | ### this memory by setting the MESA_EXECMEM_MMAP environment variable; |
22 | ### you probably don't want it paged out. MAP_WIRED is probably | | 23 | ### you probably don't want it paged out. MAP_WIRED is probably |
23 | ### overkill--I will revisit this at a later date. | | 24 | ### overkill--I will revisit this at a later date. |
24 | ### | | 25 | ### |
25 | ### You may also define MESA_EXECMEM_HEAP_SIZE in your build | | 26 | ### You may also define MESA_EXECMEM_HEAP_SIZE in your build |
26 | ### environment to adjust the size of the anonymous executable | | 27 | ### environment to adjust the size of the anonymous executable |
27 | ### memory pool (in bytes). The default is 10MB (huge?). | | 28 | ### memory pool (in bytes). The default is 10MB (huge?). |
28 | ### | | 29 | ### |
29 | ### Here's the bottom line: IF YOUR PLATFORM DOES NOT HAVE AN | | 30 | ### Here's the bottom line: IF YOUR PLATFORM DOES NOT HAVE AN |
30 | ### EXECUTABLE HEAP, YOU RUN THE RISK OF MANY SEGMENTATION FAULTS | | 31 | ### EXECUTABLE HEAP, YOU RUN THE RISK OF MANY SEGMENTATION FAULTS |
31 | ### UNLESS THIS OPTION IS ENABLED. If enabling this option results in | | 32 | ### UNLESS THIS OPTION IS ENABLED. If enabling this option results in |
32 | ### build failure, please do file a PR. Thanks to Owain Ainsworth | | 33 | ### build failure, please do file a PR. Thanks to Owain Ainsworth |
33 | ### <oga@openbsd.org> for discovering this. | | 34 | ### <oga@openbsd.org> for discovering this. |
34 | ### | | 35 | ### |
35 | ### --bjs (04/23/08) | | 36 | ### --bjs (04/23/08) |
36 | ### | | 37 | ### |
37 | .if (!empty(OPSYS:M*BSD) || ${OPSYS} == "DragonFly" || ${OPSYS} == "Linux") | | 38 | .if (!empty(OPSYS:M*BSD) || ${OPSYS} == "DragonFly" || ${OPSYS} == "Linux") |
38 | PKG_SUGGESTED_OPTIONS= mesa-execmem-mmap | | 39 | PKG_SUGGESTED_OPTIONS= mesa-execmem-mmap |
39 | .endif | | 40 | .endif |
40 | ### | | 41 | ### |
41 | ### XXX There are [probably] others, but let's not get crazy just yet. | | 42 | ### XXX There are [probably] others, but let's not get crazy just yet. |
42 | ### This will take a while to test for the myriad platforms we | | 43 | ### This will take a while to test for the myriad platforms we |
43 | ### support. | | 44 | ### support. |
44 | ### | | 45 | ### |
45 | .if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" || \ | | 46 | .if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" || \ |
46 | ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc" || \ | | 47 | ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc" || \ |
47 | ${MACHINE_ARCH} == "sparc64") && \ | | 48 | ${MACHINE_ARCH} == "sparc64") && \ |
48 | (${OPSYS} == "NetBSD" || ${OPSYS} == "FreeBSD" || ${OPSYS} == "OpenBSD") | | 49 | (${OPSYS} == "NetBSD" || ${OPSYS} == "FreeBSD" || ${OPSYS} == "OpenBSD") |
49 | PKG_SUPPORTED_OPTIONS+= dri | | 50 | PKG_SUPPORTED_OPTIONS+= dri |
50 | .endif | | 51 | .endif |
51 | ### | | 52 | ### |
52 | ### XXX OpenGL still works fine with the software fallback. As of now, | | 53 | ### XXX OpenGL still works fine with the software fallback. As of now, |
53 | ### I think this is a good way to see which bugs surface before the | | 54 | ### I think this is a good way to see which bugs surface before the |
54 | ### next release branch. Upgrading the X server to the 1.4 branch | | 55 | ### next release branch. Upgrading the X server to the 1.4 branch |
55 | ### is advised given that it's glx/glcore modules are built from | | 56 | ### is advised given that it's glx/glcore modules are built from |
56 | ### Mesa 6.5.3 (a development release). | | 57 | ### Mesa 6.5.3 (a development release). |
57 | ### | | 58 | ### |
58 | .if !empty(MACHINE_PLATFORM:MNetBSD-[4-9]*-[ix]86*) | | 59 | .if !empty(MACHINE_PLATFORM:MNetBSD-[4-9]*-[ix]86*) |
59 | PKG_SUGGESTED_OPTIONS+= dri | | 60 | PKG_SUGGESTED_OPTIONS+= dri |
60 | .endif | | 61 | .endif |
61 | | | 62 | |
62 | .include "../../mk/bsd.options.mk" | | 63 | .include "../../mk/bsd.options.mk" |
63 | ### | | 64 | ### |
64 | ### XXX Yes, this is a bit overly verbose; with Mesa, that can't hurt much. | | 65 | ### XXX Yes, this is a bit overly verbose; with Mesa, that can't hurt much. |
65 | ### | | 66 | ### |
66 | .if !empty(PKG_OPTIONS:Mi386) || !empty(PKG_OPTIONS:Mx86_64) | | 67 | .if (!empty(PKG_OPTIONS:Mi386) || !empty(PKG_OPTIONS:Mx86_64)) && \ |
| | | 68 | ${OPSYS} != "SunOS" |
67 | BUILD_TARGET_SUFFIX= -${MACHINE_ARCH} | | 69 | BUILD_TARGET_SUFFIX= -${MACHINE_ARCH} |
68 | .else | | 70 | .else |
69 | BUILD_TARGET_SUFFIX= # empty | | 71 | BUILD_TARGET_SUFFIX= # empty |
70 | .endif | | 72 | .endif |
71 | | | 73 | |
72 | .if !empty(PKG_OPTIONS:Mdri) | | 74 | .if !empty(PKG_OPTIONS:Mdri) |
73 | BUILD_TARGET= pkgsrc-dri${BUILD_TARGET_SUFFIX} | | 75 | BUILD_TARGET= pkgsrc-dri${BUILD_TARGET_SUFFIX} |
74 | PLIST.dri= # empty | | 76 | PLIST.dri= # empty |
75 | . include "../../graphics/MesaLib/dri.mk" | | 77 | . include "../../graphics/MesaLib/dri.mk" |
76 | .else | | 78 | .else |
77 | BUILD_TARGET= pkgsrc${BUILD_TARGET_SUFFIX} | | 79 | BUILD_TARGET= pkgsrc${BUILD_TARGET_SUFFIX} |
78 | PLIST.nodri= # empty | | 80 | PLIST.nodri= # empty |
79 | .endif | | 81 | .endif |
80 | ### | | 82 | ### |
81 | ### XXX This is the default heap size. Would there be an occasion to | | 83 | ### XXX This is the default heap size. Would there be an occasion to |
82 | ### change it? It seems large, so we should investigate further. | | 84 | ### change it? It seems large, so we should investigate further. |
83 | ### | | 85 | ### |
84 | MESA_EXECMEM_HEAPSIZE?= 10485760 | | 86 | MESA_EXECMEM_HEAPSIZE?= 10485760 |
85 | | | 87 | |
86 | .if !empty(PKG_OPTIONS:Mmesa-execmem-mmap) | | 88 | .if !empty(PKG_OPTIONS:Mmesa-execmem-mmap) |
87 | CFLAGS+= -DMESA_EXECMEM_MMAP | | 89 | CFLAGS+= -DMESA_EXECMEM_MMAP |
88 | CFLAGS+= -DEXEC_HEAP_SIZE=${MESA_EXECMEM_HEAPSIZE:M[0-9]*:Q} | | 90 | CFLAGS+= -DEXEC_HEAP_SIZE=${MESA_EXECMEM_HEAPSIZE:M[0-9]*:Q} |
89 | .endif | | 91 | .endif |