1Name: yasm
2URL: http://www.tortall.net/projects/yasm/
3Version: 1.3.0
4License: 2-clause or 3-clause BSD licensed, with the exception of bitvect, which is triple-licensed under the Artistic license, GPL, and LGPL
5License File: source/patched-yasm/COPYING
6License Android Compatible: yes
7Security Critical: no
8
9Source: http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
10SHA-512: 572d3b45568b10f58e48f1188c2d6bcbdd16429c8afaccc8c6d37859b45635e1
11         06885d679e41d0bee78c23822108c7ae75aa7475eed5ba58057e0a6fe1b68645
12
13With these patches applied:
14* deterministic.diff: make yasm deterministic.
15* deterministic-2.diff: remove timestamps from generated files.
16* genmodule.diff: add an optional output argument to genmodule.
17* genperf.diff: make genperf silent on non-fatal errors.
18
19
20See also the BUILD.gn file for a description of the yasm build process.
21
22Instructions for recreating the BUILD.gn file.
23  1) Update yasm and re-apply the patches.
24
25  2) Make a copy of source in a different directory (e.g., /tmp/yasm_build) and
26     run configure. Using another directory will keep the source tree clean. An
27     out-of-tree build does not appear to work reliably as of yasm 1.3.0.
28
29  3) Next, capture all the output from a build of yasm.  We will use the build
30     log as a reference for BUILD.gn.
31
32       make yasm > yasm_build_log 2> yasm_build_err
33
34  4) Check yasm_build_err to see if there are any anomalies beyond yasm's
35     compiler warnings.
36
37  5) Grab the generated libyasm-stdint.h and config.h and put into the correct
38     platform location.
39
40       src/third_party/yasm/source/config/[platform]
41
42     For android platform, copy the files generated for linux, but make sure
43     that ENABLE_NLS is not defined to allow mac host compiles to work.  For
44     ios, copy the files from mac.  For win, copy the libyasm-stdint.h from
45     linux and fix up config.h.
46
47     Find the YASM_MODULES line in the generated Makefile and update
48     src/third_party/yasm/source/config/Makefile. It is needed by the
49     "genmodule" subprogram as input for creating the available modules list.
50
51  6) Make sure all the subprograms are represented in BUILD.gn.
52
53       grep -w gcc yasm_build_log  |
54       grep -v ' -DHAVE_CONFIG_H '
55
56     The yasm build creates a bunch of subprograms that in-turn generate
57     more .c files in the build. Luckily the commands to generate the
58     subprogram do not have -DHAVE_CONFIG_H as a cflag.
59
60     From this list, make sure all the subprograms that are build have
61     appropriate targets in the BUILD.gn.
62
63     You will notice, when you get to the next step, that there are some
64     .c source files that are compiled both for yasm, and for genperf.
65
66     Those should go into the yasm_utils target so that they can be shared by
67     the genperf and yasm targets. Find the files used by genperf by appending
68
69       | grep 'gp-'
70
71     to the command above. Then grep for them without the 'gp-' prefix to see if
72     they are used in yasm as well.
73
74  7) Find all the source files used to build yasm proper.
75
76       grep -w gcc yasm_build_log  |
77       grep ' -DHAVE_CONFIG_H ' |
78       sed -e 's/[&\\]*$//' |  # Remove any trailing '&&'s and '\'s.
79       awk '{print $NF }' |
80       sed -e "s/'\.\/'\`//" |  # Removes some garbage from the build line.
81       sort -u |
82       sed -e 's/\(.*\)/      "source\/patched-yasm\/\1",/'
83
84     Reversing the -DHAVE_CONFIG_H filter from the command above should
85     list the compile lines for yasm proper.
86
87     This should get you close, but you will need to manually examine this
88     list.  However, some of the built products are still included in the
89     command above.  Generally, if the source file is in the root directory,
90     it's a generated file.  Also remove the sources in the yasm_utils target.
91
92     Inspect the current BUILD.gn for a list of the subprograms and their
93     outputs.
94
95     Update the sources list in the yasm target accordingly.  Read step #9
96     as well if you update the source list to avoid problems.
97
98  8) Update the actions for each of the subprograms.
99
100     Here is the real fun.  For each subprogram created, you will need to
101     update the actions and rules in BUILD.gn that invoke the subprogram to
102     generate the files needed by the rest of the build.
103
104     I don't have any good succinct instructions for this.  Grep the build
105     log for each subprogram invocation (eg., "./genversion"), look at
106     its command inputs and output, then verify our BUILD.gn does something
107     similar.
108
109     The good news is things likely only link or compile if this is done
110     right so you'll know if there is a problem.
111
112     Again, refer to the existing BUILD.gn for a guide to how the generated
113     files are used.
114
115     Here are a few gotchas:
116       1) genmodule, by default, writes module.c into the current
117          directory.  This does not play nicely with gn.  We have a patch
118          to allow specifying a specific output file.
119
120       2) Most of the generated files, even though they are .c files, are
121          #included by other files in the build.  Make sure they end up
122          in yasm_gen_include_dir.
123
124       3) Some of the genperf output is #included while others need to be
125          compiled directly.  That is why there are 2 different rules for
126          .gperf files in two targets.
127
128  9) If all that's is finished, attempt to build....and cross your fingers.
129