OLD | NEW |
(Empty) | |
| 1 See also the yasm.gyp file for a description of the yasm build process. |
| 2 |
| 3 Instructions for recreating the yasm.gyp file. |
| 4 1) Get a clean version of the yasm source tree and copy it somewhere. The |
| 5 clean tree can be found at: |
| 6 |
| 7 src/third_party/yasm/source/yasm |
| 8 |
| 9 2) Run ./autogen.sh in your copy of the pristine source. Unlike ./configure, |
| 10 autogen.sh will dirty the tree regardless of where it is called from. |
| 11 |
| 12 3) Next, capture all the output from a build of yasm. We will use the build |
| 13 log as a reference for making the yasm.gyp file. |
| 14 |
| 15 make yasm > yasm_build_log 2> yasm_build_err |
| 16 |
| 17 4) Check yasm_build_err to see if there are any anomalies beyond yasm's |
| 18 compiler warnings. |
| 19 |
| 20 5) Grab the generated Makefile, libyasm-stdint.h, config.h, and put into |
| 21 the correct platform location. |
| 22 |
| 23 src/third_party/yasm/source/config/[platform] |
| 24 |
| 25 While we do not directly use the "Makefile" to build, it is needed by |
| 26 the "genmodule" subprogram as input for creating the available modules |
| 27 list. |
| 28 |
| 29 6) Make sure all the subprograms are represented in yasm.gyp. |
| 30 |
| 31 grep '^gcc' yasm_build_log | |
| 32 grep -v ' -DHAVE_CONFIG_H ' |
| 33 |
| 34 The yasm build creates a bunch of subprograms that in-turn generate |
| 35 more .c files in the build. Luckily the commands to generate the |
| 36 subprogram do not have -DHAVE_CONFIG_H as a cflag. |
| 37 |
| 38 From this list, make sure all the subprograms that are build have |
| 39 appropriate targets in the yasm.gyp. |
| 40 |
| 41 You will notice, when you get to the next step, that there are some |
| 42 .c source files that are compiled both for yasm, and for genperf. |
| 43 |
| 44 Those should go into the genperf_libs target so that they can be |
| 45 shared by the genperf and yasm targets. Find those files by appending |
| 46 |
| 47 | grep 'gp-' |
| 48 |
| 49 to the command above. |
| 50 |
| 51 7) Find all the source files used to build yasm proper. |
| 52 |
| 53 grep -E '^gcc' yasm_build_log | |
| 54 grep ' -DHAVE_CONFIG_H ' | |
| 55 awk '{print $NF }' | |
| 56 sed -e "s/'\.\/'\`//" | # Removes some garbage from the build line. |
| 57 sort -u | |
| 58 sed -e "s/\(.*\)/'\1',/" # Add quotes to each line. |
| 59 |
| 60 Reversing the -DHAVE_CONFIG_H filter from the command above should |
| 61 list the compile lines for yasm proper. |
| 62 |
| 63 This should get you close, but you will need to manually examine this |
| 64 list. However, some of the built products are still included in the |
| 65 command above. Generally, if the source file is in the root directory, |
| 66 it's a generated file. |
| 67 |
| 68 Inspect the current yasm.gyp for a list of the subprograms and their |
| 69 outputs. |
| 70 |
| 71 Update the sources list in the yasm target accordingly. Read step #9 |
| 72 as well if you update the source list to avoid problems. |
| 73 |
| 74 8) Update the actions for each of the subprograms. |
| 75 |
| 76 Here is the real fun. For each subprogram created, you will need to |
| 77 update the actions and rules in yasm.gyp that invoke the subprogram to |
| 78 generate the files needed by the rest of the build. |
| 79 |
| 80 I don't have any good succinct instructions for this. Grep the build |
| 81 log for each subprogram invocation (eg., "./genversion"), look at |
| 82 its command inputs and output, then verify our yasm.gyp does something |
| 83 similar. |
| 84 |
| 85 The good news is things likely only link or compile if this is done |
| 86 right so you'll know if there is a problem. |
| 87 |
| 88 Again, refer to the existing yasm.gyp for a guide to how the generated |
| 89 files are used. |
| 90 |
| 91 Here are a few gotchas: |
| 92 1) genmodule, by default, writes module.c into the current |
| 93 directory. This does not play nicely with gyp. We patch the |
| 94 source during build to allow specifying a specific output file. |
| 95 |
| 96 2) Most of the generated files, even though they are .c files, are |
| 97 #included by other files in the build. Make sure they end up |
| 98 in a directory that is in the include path for the build. |
| 99 One of <(shared_generated_dir) or <(generated_dir) should work. |
| 100 |
| 101 3) Some of the genperf output is #included while others need to be |
| 102 compiled directly. That is why there are 2 different rules for |
| 103 .gperf files in two targets. |
| 104 |
| 105 9) Check for python scripts that are run. |
| 106 |
| 107 grep python yasm_build_log |
| 108 |
| 109 Yasm uses python scripts to generate the assembly code description |
| 110 files in C++. Make sure to get these put into the gyp file properly as |
| 111 well. An example is gen_x86_insn.py for x86 assembly. |
| 112 |
| 113 Note that at least the gen_x86_insn.py script suffers from the same |
| 114 problem as genmacro in that it outputs to the current directory by |
| 115 default. The yasm.gyp build patches this file before invoking it to |
| 116 allow specifying an output directory. |
| 117 |
| 118 10) If all that's is finished, attempt to build....and cross your fingers. |
OLD | NEW |