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
18 See also the yasm.gyp file for a description of the yasm build process.
20 Instructions for recreating the yasm.gyp file.
21 1) Get a clean version of the yasm source tree. The clean tree can be found
24 src/third_party/yasm/source/yasm
26 2) Run configure on the pristine source from a different directory (eg.,
27 /tmp/yasm_build). Running configure from another directory will keep
28 the source tree clean.
30 3) Next, capture all the output from a build of yasm. We will use the build
31 log as a reference for making the yasm.gyp file.
33 make yasm > yasm_build_log 2> yasm_build_err
35 4) Check yasm_build_err to see if there are any anomalies beyond yasm's
38 5) Grab the generated Makefile, libyasm-stdint.h, config.h, and put into
39 the correct platform location. For android platform, copy the files
40 generated for linux, but make sure that ENABLE_NLS is not defined to
41 allow mac host compiles to work. For ios, copy the files from mac.
43 src/third_party/yasm/source/config/[platform]
45 While we do not directly use the "Makefile" to build, it is needed by
46 the "genmodule" subprogram as input for creating the available modules
49 6) Make sure all the subprograms are represented in yasm.gyp.
51 grep '^gcc' yasm_build_log |
52 grep -v ' -DHAVE_CONFIG_H '
54 The yasm build creates a bunch of subprograms that in-turn generate
55 more .c files in the build. Luckily the commands to generate the
56 subprogram do not have -DHAVE_CONFIG_H as a cflag.
58 From this list, make sure all the subprograms that are build have
59 appropriate targets in the yasm.gyp.
61 You will notice, when you get to the next step, that there are some
62 .c source files that are compiled both for yasm, and for genperf.
64 Those should go into the genperf_libs target so that they can be
65 shared by the genperf and yasm targets. Find those files by appending
71 7) Find all the source files used to build yasm proper.
73 grep -E '^gcc' yasm_build_log |
74 grep ' -DHAVE_CONFIG_H ' |
76 sed -e "s/'\.\/'\`//" | # Removes some garbage from the build line.
78 sed -e "s/\(.*\)/'\1',/" # Add quotes to each line.
80 Reversing the -DHAVE_CONFIG_H filter from the command above should
81 list the compile lines for yasm proper.
83 This should get you close, but you will need to manually examine this
84 list. However, some of the built products are still included in the
85 command above. Generally, if the source file is in the root directory,
86 it's a generated file.
88 Inspect the current yasm.gyp for a list of the subprograms and their
91 Update the sources list in the yasm target accordingly. Read step #9
92 as well if you update the source list to avoid problems.
94 8) Update the actions for each of the subprograms.
96 Here is the real fun. For each subprogram created, you will need to
97 update the actions and rules in yasm.gyp that invoke the subprogram to
98 generate the files needed by the rest of the build.
100 I don't have any good succinct instructions for this. Grep the build
101 log for each subprogram invocation (eg., "./genversion"), look at
102 its command inputs and output, then verify our yasm.gyp does something
105 The good news is things likely only link or compile if this is done
106 right so you'll know if there is a problem.
108 Again, refer to the existing yasm.gyp for a guide to how the generated
111 Here are a few gotchas:
112 1) genmodule, by default, writes module.c into the current
113 directory. This does not play nicely with gyp. We patch the
114 source during build to allow specifying a specific output file.
116 2) Most of the generated files, even though they are .c files, are
117 #included by other files in the build. Make sure they end up
118 in a directory that is in the include path for the build.
119 One of <(shared_generated_dir) or <(generated_dir) should work.
121 3) Some of the genperf output is #included while others need to be
122 compiled directly. That is why there are 2 different rules for
123 .gperf files in two targets.
125 9) Check for python scripts that are run.
127 grep python yasm_build_log
129 Yasm uses python scripts to generate the assembly code description
130 files in C++. Make sure to get these put into the gyp file properly as
131 well. An example is gen_x86_insn.py for x86 assembly.
133 Note that at least the gen_x86_insn.py script suffers from the same
134 problem as genmacro in that it outputs to the current directory by
135 default. The yasm.gyp build patches this file before invoking it to
136 allow specifying an output directory.
138 10) If all that's is finished, attempt to build....and cross your fingers.