2 URL: http://www.tortall.net/projects/yasm/
4 License: 2-clause or 3-clause BSD licensed, with the exception of bitvect, which is triple-licensed under the Artistic license, GPL, and LGPL
5 License File: source/patched-yasm/COPYING
6 License Android Compatible: yes
9 With these patches merged:
10 * https://github.com/yasm/yasm/commit/a2cbb10ee1b90b73647667ac849c74d65761d412
11 * https://github.com/yasm/yasm/commit/01ab853e68ef8aeded716d6f5b34895200f66a51
12 * https://github.com/yasm/yasm/commit/82fafa7b5619e702c8681c959ade0746498e3cbc
13 * https://github.com/yasm/yasm/commit/2bd66514b6b100887c19d8598da38347b3cff40e
14 * https://github.com/yasm/yasm/commit/ab19547382660d81e0b4a0232dccb38f44c52a36
15 * https://github.com/yasm/yasm/commit/9728322335cba96500861ef766b1546d096e5600
19 See also the yasm.gyp file for a description of the yasm build process.
21 Instructions for recreating the yasm.gyp file.
22 1) Get a clean version of the yasm source tree. The clean tree can be found
25 src/third_party/yasm/source/yasm
27 2) Run configure on the pristine source from a different directory (eg.,
28 /tmp/yasm_build). Running configure from another directory will keep
29 the source tree clean.
31 3) Next, capture all the output from a build of yasm. We will use the build
32 log as a reference for making the yasm.gyp file.
34 make yasm > yasm_build_log 2> yasm_build_err
36 4) Check yasm_build_err to see if there are any anomalies beyond yasm's
39 5) Grab the generated Makefile, libyasm-stdint.h, config.h, and put into
40 the correct platform location. For android platform, copy the files
41 generated for linux, but make sure that ENABLE_NLS is not defined to
42 allow mac host compiles to work. For ios, copy the files from mac.
44 src/third_party/yasm/source/config/[platform]
46 While we do not directly use the "Makefile" to build, it is needed by
47 the "genmodule" subprogram as input for creating the available modules
50 6) Make sure all the subprograms are represented in yasm.gyp.
52 grep '^gcc' yasm_build_log |
53 grep -v ' -DHAVE_CONFIG_H '
55 The yasm build creates a bunch of subprograms that in-turn generate
56 more .c files in the build. Luckily the commands to generate the
57 subprogram do not have -DHAVE_CONFIG_H as a cflag.
59 From this list, make sure all the subprograms that are build have
60 appropriate targets in the yasm.gyp.
62 You will notice, when you get to the next step, that there are some
63 .c source files that are compiled both for yasm, and for genperf.
65 Those should go into the genperf_libs target so that they can be
66 shared by the genperf and yasm targets. Find those files by appending
72 7) Find all the source files used to build yasm proper.
74 grep -E '^gcc' yasm_build_log |
75 grep ' -DHAVE_CONFIG_H ' |
77 sed -e "s/'\.\/'\`//" | # Removes some garbage from the build line.
79 sed -e "s/\(.*\)/'\1',/" # Add quotes to each line.
81 Reversing the -DHAVE_CONFIG_H filter from the command above should
82 list the compile lines for yasm proper.
84 This should get you close, but you will need to manually examine this
85 list. However, some of the built products are still included in the
86 command above. Generally, if the source file is in the root directory,
87 it's a generated file.
89 Inspect the current yasm.gyp for a list of the subprograms and their
92 Update the sources list in the yasm target accordingly. Read step #9
93 as well if you update the source list to avoid problems.
95 8) Update the actions for each of the subprograms.
97 Here is the real fun. For each subprogram created, you will need to
98 update the actions and rules in yasm.gyp that invoke the subprogram to
99 generate the files needed by the rest of the build.
101 I don't have any good succinct instructions for this. Grep the build
102 log for each subprogram invocation (eg., "./genversion"), look at
103 its command inputs and output, then verify our yasm.gyp does something
106 The good news is things likely only link or compile if this is done
107 right so you'll know if there is a problem.
109 Again, refer to the existing yasm.gyp for a guide to how the generated
112 Here are a few gotchas:
113 1) genmodule, by default, writes module.c into the current
114 directory. This does not play nicely with gyp. We patch the
115 source during build to allow specifying a specific output file.
117 2) Most of the generated files, even though they are .c files, are
118 #included by other files in the build. Make sure they end up
119 in a directory that is in the include path for the build.
120 One of <(shared_generated_dir) or <(generated_dir) should work.
122 3) Some of the genperf output is #included while others need to be
123 compiled directly. That is why there are 2 different rules for
124 .gperf files in two targets.
126 9) Check for python scripts that are run.
128 grep python yasm_build_log
130 Yasm uses python scripts to generate the assembly code description
131 files in C++. Make sure to get these put into the gyp file properly as
132 well. An example is gen_x86_insn.py for x86 assembly.
134 Note that at least the gen_x86_insn.py script suffers from the same
135 problem as genmacro in that it outputs to the current directory by
136 default. The yasm.gyp build patches this file before invoking it to
137 allow specifying an output directory.
139 10) Recreate the 'AdditionalOptions!': [ '/analyze' ] block so that VC++
140 /analyze builds won't fail.
142 11) If all that's is finished, attempt to build....and cross your fingers.