gen.lua (8820B)
1 cflags({ 2 '-include $dir/config.h', 3 '-I $srcdir', 4 '-I $srcdir/compat/regex', 5 '-I $outdir', 6 '-isystem $builddir/pkg/net/curl/include', 7 '-isystem $builddir/pkg/libs/zlib/include', 8 }) 9 10 pkg.deps = { 11 '$outdir/command-list.h', 12 '$outdir/config-list.h', 13 '$outdir/hook-list.h', 14 'pkg/net/curl/headers', 15 'pkg/libs/zlib/headers', 16 } 17 18 rule('cmdlist', 'cd $srcdir && ./generate-cmdlist.sh $$OLDPWD/$in >$$OLDPWD/$out') 19 build('cmdlist', '$outdir/command-list.h', { 20 '$srcdir/command-list.txt', 21 '|', '$srcdir/generate-cmdlist.sh', expand({'$srcdir/Documentation/', lines('commands.txt')}), 22 }) 23 24 rule('configlist', 'cd $srcdir && ./generate-configlist.sh >$$OLDPWD/$out') 25 build('configlist', '$outdir/config-list.h', { 26 '|', '$srcdir/generate-configlist.sh', expand({'$srcdir/Documentation/', lines('configs.txt')}), 27 }) 28 29 rule('hooklist', 'cd $srcdir && ./generate-hooklist.sh >$$OLDPWD/$out') 30 build('hooklist', '$outdir/hook-list.h', { 31 '|', '$srcdir/generate-hooklist.sh', '$srcdir/Documentation/githooks.txt' 32 }) 33 34 cc('exec-cmd.c', nil, {cflags=string.format([[$cflags '-DFALLBACK_RUNTIME_PREFIX="%s"']], config.prefix)}) 35 cc('common-main.c') 36 cc('http.c') 37 cc('compat/regex/regex.c', nil, {cflags='$cflags -DGAWK -DNO_MBSUPPORT'}) 38 39 -- src/Makefile:/^LIB_OBJS.\+= 40 lib('libgit.a', [[ 41 abspath.c 42 add-interactive.c 43 add-patch.c 44 advice.c 45 alias.c 46 alloc.c 47 apply.c 48 archive-tar.c 49 archive-zip.c 50 archive.c 51 attr.c 52 base85.c 53 bisect.c 54 blame.c 55 blob.c 56 bloom.c 57 branch.c 58 bulk-checkin.c 59 bundle-uri.c 60 bundle.c 61 cache-tree.c 62 cbtree.c 63 chdir-notify.c 64 checkout.c 65 chunk-format.c 66 color.c 67 column.c 68 combine-diff.c 69 commit-graph.c 70 commit-reach.c 71 commit.c 72 compat/nonblock.c 73 compat/obstack.c 74 compat/qsort_s.c 75 compat/regex/regex.c.o 76 compat/terminal.c 77 compat/zlib-uncompress2.c 78 config.c 79 connect.c 80 connected.c 81 convert.c 82 copy.c 83 credential.c 84 csum-file.c 85 ctype.c 86 date.c 87 decorate.c 88 delta-islands.c 89 diagnose.c 90 diff-delta.c 91 diff-merges.c 92 diff-lib.c 93 diff-no-index.c 94 diff.c 95 diffcore-break.c 96 diffcore-delta.c 97 diffcore-order.c 98 diffcore-pickaxe.c 99 diffcore-rename.c 100 diffcore-rotate.c 101 dir-iterator.c 102 dir.c 103 editor.c 104 entry.c 105 environment.c 106 ewah/bitmap.c 107 ewah/ewah_bitmap.c 108 ewah/ewah_io.c 109 ewah/ewah_rlw.c 110 exec-cmd.c.o 111 fetch-negotiator.c 112 fetch-pack.c 113 fmt-merge-msg.c 114 fsck.c 115 fsmonitor.c 116 fsmonitor-ipc.c 117 fsmonitor-settings.c 118 gettext.c 119 git-zlib.c 120 gpg-interface.c 121 graph.c 122 grep.c 123 hash-lookup.c 124 hashmap.c 125 help.c 126 hex-ll.c 127 hex.c 128 hook.c 129 ident.c 130 json-writer.c 131 kwset.c 132 levenshtein.c 133 line-log.c 134 line-range.c 135 linear-assignment.c 136 list-objects-filter-options.c 137 list-objects-filter.c 138 list-objects.c 139 lockfile.c 140 log-tree.c 141 ls-refs.c 142 mailinfo.c 143 mailmap.c 144 match-trees.c 145 mem-pool.c 146 merge-blobs.c 147 merge-ll.c 148 merge-ort.c 149 merge-ort-wrappers.c 150 merge-recursive.c 151 merge.c 152 midx.c 153 name-hash.c 154 negotiator/default.c 155 negotiator/noop.c 156 negotiator/skipping.c 157 notes-cache.c 158 notes-merge.c 159 notes-utils.c 160 notes.c 161 object-file.c 162 object-name.c 163 object.c 164 oid-array.c 165 oidmap.c 166 oidset.c 167 oidtree.c 168 pack-bitmap-write.c 169 pack-bitmap.c 170 pack-check.c 171 pack-mtimes.c 172 pack-objects.c 173 pack-revindex.c 174 pack-write.c 175 packfile.c 176 pager.c 177 parallel-checkout.c 178 parse-options-cb.c 179 parse-options.c 180 parse.c 181 patch-delta.c 182 patch-ids.c 183 path.c 184 pathspec.c 185 pkt-line.c 186 preload-index.c 187 pretty.c 188 prio-queue.c 189 progress.c 190 promisor-remote.c 191 prompt.c 192 protocol.c 193 protocol-caps.c 194 prune-packed.c 195 quote.c 196 range-diff.c 197 reachable.c 198 read-cache.c 199 rebase-interactive.c 200 rebase.c 201 ref-filter.c 202 reflog-walk.c 203 reflog.c 204 refs.c 205 refs/debug.c 206 refs/files-backend.c 207 refs/iterator.c 208 refs/packed-backend.c 209 refs/ref-cache.c 210 refspec.c 211 remote.c 212 replace-object.c 213 repo-settings.c 214 repository.c 215 rerere.c 216 reset.c 217 resolve-undo.c 218 revision.c 219 run-command.c 220 send-pack.c 221 sequencer.c 222 serve.c 223 server-info.c 224 setup.c 225 shallow.c 226 sideband.c 227 sigchain.c 228 sparse-index.c 229 split-index.c 230 stable-qsort.c 231 statinfo.c 232 strbuf.c 233 streaming.c 234 string-list.c 235 strmap.c 236 strvec.c 237 sub-process.c 238 submodule-config.c 239 submodule.c 240 symlinks.c 241 tag.c 242 tempfile.c 243 thread-utils.c 244 tmp-objdir.c 245 trace.c 246 trace2.c 247 trace2/( 248 tr2_cfg.c 249 tr2_cmd_name.c 250 tr2_ctr.c 251 tr2_dst.c 252 tr2_sid.c 253 tr2_sysenv.c 254 tr2_tbuf.c 255 tr2_tgt_event.c 256 tr2_tgt_normal.c 257 tr2_tgt_perf.c 258 tr2_tls.c 259 tr2_tmr.c 260 ) 261 trailer.c 262 transport-helper.c 263 transport.c 264 tree-diff.c 265 tree-walk.c 266 tree.c 267 unpack-trees.c 268 upload-pack.c 269 url.c 270 urlmatch.c 271 usage.c 272 userdiff.c 273 utf8.c 274 varint.c 275 version.c 276 versioncmp.c 277 walker.c 278 wildmatch.c 279 worktree.c 280 wrapper.c 281 write-or-die.c 282 ws.c 283 wt-status.c 284 xdiff-interface.c 285 286 unix-socket.c 287 unix-stream-server.c 288 289 compat/simple-ipc/(ipc-shared.c ipc-unix-socket.c) 290 291 sha1dc_git.c 292 sha1dc/sha1.c 293 sha1dc/ubc_check.c 294 295 sha256/block/sha256.c 296 297 compat/linux/procinfo.c 298 299 libxdiff.a 300 $builddir/pkg/libs/zlib/libz.a 301 ]]) 302 303 -- src/Makefile:/^XDIFF_OBJS.\+= 304 lib('libxdiff.a', [[xdiff/( 305 xdiffi.c 306 xemit.c 307 xhistogram.c 308 xmerge.c 309 xpatience.c 310 xprepare.c 311 xutils.c 312 )]]) 313 314 -- src/Makefile:/^BUILTIN_OBJS.\+= 315 local builtins = { 316 'add', 317 'am', 318 'annotate', 319 'apply', 320 'archive', 321 'bisect', 322 'blame', 323 'branch', 324 'bugreport', 325 'bundle', 326 'cat-file', 327 'check-attr', 328 'check-ignore', 329 'check-mailmap', 330 'check-ref-format', 331 'checkout--worker', 332 'checkout-index', 333 'checkout', 334 'clean', 335 'clone', 336 'column', 337 'commit-graph', 338 'commit-tree', 339 'commit', 340 'config', 341 'count-objects', 342 'credential-cache--daemon', 343 'credential-cache', 344 'credential-store', 345 'credential', 346 'describe', 347 'diagnose', 348 'diff-files', 349 'diff-index', 350 'diff-tree', 351 'diff', 352 'difftool', 353 'fast-export', 354 'fast-import', 355 'fetch-pack', 356 'fetch', 357 'fmt-merge-msg', 358 'for-each-ref', 359 'for-each-repo', 360 'fsck', 361 'fsmonitor--daemon', 362 'gc', 363 'get-tar-commit-id', 364 'grep', 365 'hash-object', 366 'help', 367 'hook', 368 'index-pack', 369 'init-db', 370 'interpret-trailers', 371 'log', 372 'ls-files', 373 'ls-remote', 374 'ls-tree', 375 'mailinfo', 376 'mailsplit', 377 'merge-base', 378 'merge-file', 379 'merge-index', 380 'merge-ours', 381 'merge-recursive', 382 'merge-tree', 383 'merge', 384 'mktag', 385 'mktree', 386 'multi-pack-index', 387 'mv', 388 'name-rev', 389 'notes', 390 'pack-objects', 391 'pack-redundant', 392 'pack-refs', 393 'patch-id', 394 'prune-packed', 395 'prune', 396 'pull', 397 'push', 398 'range-diff', 399 'read-tree', 400 'rebase', 401 'receive-pack', 402 'reflog', 403 'remote-ext', 404 'remote-fd', 405 'remote', 406 'repack', 407 'replace', 408 'replay', 409 'rerere', 410 'reset', 411 'rev-list', 412 'rev-parse', 413 'revert', 414 'rm', 415 'send-pack', 416 'shortlog', 417 'show-branch', 418 'show-index', 419 'show-ref', 420 'sparse-checkout', 421 'stash', 422 'stripspace', 423 'submodule--helper', 424 'symbolic-ref', 425 'tag', 426 'unpack-file', 427 'unpack-objects', 428 'update-index', 429 'update-ref', 430 'update-server-info', 431 'upload-archive', 432 'upload-pack', 433 'var', 434 'verify-commit', 435 'verify-pack', 436 'verify-tag', 437 'worktree', 438 'write-tree', 439 } 440 441 exe('git', {'git.c', 'common-main.c.o', expand({'builtin/', builtins, '.c'}), 'libgit.a.d'}) 442 file('bin/git', '755', '$outdir/git') 443 444 local programs = { 445 -- src/Makefile:/^PROGRAM_OBJS./+= 446 {'daemon'}, 447 {'http-backend'}, 448 {'imap-send', {'imap-send.c', 'http.c.o', '$builddir/pkg/net/curl/libcurl.a.d'}}, 449 {'sh-i18n--envsubst'}, 450 {'shell'}, 451 452 {'remote-http', {'remote-curl.c', 'http.c.o', 'http-walker.c', '$builddir/pkg/net/curl/libcurl.a.d'}}, 453 } 454 455 for _, prog in ipairs(programs) do 456 local name, srcs = prog[1], prog[2] 457 exe('git-'..name, {srcs or name..'.c', 'common-main.c.o', 'libgit.a.d'}) 458 file('libexec/git-core/git-'..name, '755', '$outdir/git-'..name) 459 end 460 461 for _, remote in ipairs({'https', 'ftp', 'ftps'}) do 462 sym('libexec/git-core/git-remote-'..remote, 'git-remote-http') 463 end 464 465 local scripts = { 466 -- src/Makefile:/^SCRIPT_SH.\+= 467 {'difftool--helper', '755'}, 468 {'filter-branch', '755'}, 469 {'merge-octopus', '755'}, 470 {'merge-one-file', '755'}, 471 {'merge-resolve', '755'}, 472 {'mergetool', '755'}, 473 {'quiltimport', '755'}, 474 {'request-pull', '755'}, 475 {'submodule', '755'}, 476 {'web--browse', '755'}, 477 478 -- src/Makefile:/^SCRIPT_LIB.\+= 479 {'mergetool--lib', '644'}, 480 {'sh-i18n', '644'}, 481 {'sh-setup', '644'}, 482 } 483 484 rule('sh_gen', 'sed -f $dir/sh_gen.sed $in >$out') 485 for _, script in ipairs(scripts) do 486 local name, mode = script[1], script[2] 487 build('sh_gen', '$outdir/git-'..name, {'$srcdir/git-'..name..'.sh', '|', '$dir/sh_gen.sed'}) 488 file('libexec/git-core/git-'..name, mode, '$outdir/git-'..name) 489 end 490 491 sym('bin/git-shell', '../libexec/git-core/git-shell') 492 for _, name in ipairs({'git-receive-pack', 'git-upload-archive', 'git-upload-pack'}) do 493 sym('bin/'..name, 'git') 494 end 495 496 -- templates 497 dir('share/git-core/templates/branches', '755') 498 file('share/git-core/templates/description', '644', '$srcdir/templates/this--description') 499 file('share/git-core/templates/info/exclude', '644', '$srcdir/templates/info--exclude') 500 -- Skip the sample hooks and install an empty directory instead. 501 dir('share/git-core/templates/hooks', '755') 502 503 man(expand({'man/', lines('man.txt')})) 504 505 fetch('local')