| Lorenz Brun | ddd6caf | 2021-03-04 17:16:04 +0100 | [diff] [blame] | 1 | # proto-file: build/bazel_cc_fix/ccfixspec/ccfixspec.proto | 
 | 2 | # proto-message: CCFixSpec | 
 | 3 |  | 
 | 4 | # Note: As of 5.10 upstream doesn't build on any Linux distro I tried. You have to patch xfs.h to include its own headers | 
 | 5 | # and not the system ones to get it to build. Revert this patch before running bazel_cc_fix as it interferes with the | 
 | 6 | # auto-rewriting. | 
 | 7 |  | 
 | 8 | # To regenerate the patch, run the following in the checked-out xfsprogs repo | 
 | 9 | # make configure | 
 | 10 | # ./configure | 
 | 11 | # nice intercept-build make -j$(nproc) mkfs | 
 | 12 |  | 
 | 13 | # And the following in the monorepo root | 
 | 14 | # bazel run //build/bazel_cc_fix -- -workspace $path_to_repo -compilation_db $path_to_repo/compile_commands.json -spec third_party/xfsprogs/cc_fix_spec.prototxt | 
 | 15 |  | 
 | 16 | # Resolve libuuid to our util_linux workspace | 
 | 17 | replace { | 
 | 18 |   type: SYSTEM | 
 | 19 |   from: "uuid/uuid.h" | 
 | 20 |   to: "libuuid/src/uuid.h" | 
 | 21 | } | 
 | 22 |  | 
 | 23 | # Resolve libblkid to our util_linux workspace | 
 | 24 | replace { | 
 | 25 |   type: SYSTEM | 
 | 26 |   from: "blkid/blkid.h" | 
 | 27 |   to: "blkid.h" | 
 | 28 | } | 
 | 29 |  | 
 | 30 | # Resolve libinih to our inih workspace | 
 | 31 | replace { | 
 | 32 |   type: SYSTEM | 
 | 33 |   from: "ini.h" | 
 | 34 |   to: "ini.h" | 
 | 35 | } | 
 | 36 |  | 
 | 37 | replace { | 
 | 38 |   type: SYSTEM | 
 | 39 |   from: "xfs/handle.h", | 
 | 40 |   to: "include/handle.h", | 
 | 41 | } | 
 | 42 |  | 
 | 43 | # Force xfsprogs to use their own headers instead of the ones of the installed (!!) xfsprogs | 
 | 44 | replace { | 
 | 45 |   type: SYSTEM, | 
 | 46 |   from: "xfs/xfs_fs.h", | 
 | 47 |   to: "libxfs/xfs_fs.h" | 
 | 48 | } | 
 | 49 | replace { | 
 | 50 |   type: SYSTEM, | 
 | 51 |   from: "xfs/xfs_types.h", | 
 | 52 |   to: "libxfs/xfs_types.h" | 
 | 53 | } | 
 | 54 | replace { | 
 | 55 |   type: SYSTEM | 
 | 56 |   from: "xfs/" | 
 | 57 |   to: "include/" | 
 | 58 | } | 
 | 59 |  | 
 | 60 | # platform_defs.h is generated and cannot be placed in include/ as targets depend on random | 
 | 61 | # things in there. Fix up all includes to instead point to the workspace root where it will be | 
 | 62 | # generated. | 
 | 63 | generated_file { | 
 | 64 |   path: "include/platform_defs.h" | 
 | 65 | } | 
 | 66 | replace { | 
 | 67 |   type: WORKSPACE | 
 | 68 |   from: "include/platform_defs.h" | 
 | 69 |   to: "platform_defs.h" | 
 | 70 | } | 
 | 71 |  | 
 | 72 | # Properly include CRC32 generated file which is also generated in the wrong place | 
 | 73 | generated_file { | 
 | 74 |   path: "libfrog/crc32table.h" | 
 | 75 | } | 
 | 76 | replace { | 
 | 77 |   type: WORKSPACE | 
 | 78 |   from: "libfrog/crc32table.h" | 
 | 79 |   to: "crc32table.h" | 
 | 80 | } |