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