Skip to content

Commit

Permalink
git: apply config.prefix to paths
Browse files Browse the repository at this point in the history
see #15: Support configurable PREFIX
  • Loading branch information
rnpnr committed Oct 4, 2023
1 parent 4443276 commit 9d1c006
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
6 changes: 0 additions & 6 deletions pkg/git/config.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
#define DEFAULT_EDITOR "ed"
#define DEFAULT_GIT_TEMPLATE_DIR "share/git-core/templates"
#define DEFAULT_PAGER ""
#define ETC_GITATTRIBUTES "/etc/gitattributes"
#define ETC_GITCONFIG "/etc/gitconfig"
#define GIT_BUILT_FROM_COMMIT "43c8a30d150ecede9709c1f2527c8fba92c65f40"
#define GIT_EXEC_PATH "libexec/git-core"
#define GIT_HOST_CPU "unknown"
#define GIT_HTML_PATH "share/doc/git-doc"
#define GIT_INFO_PATH "share/info"
#define GIT_LOCALE_PATH "/share/locale"
#define GIT_MAN_PATH "share/man"
#define GIT_USER_AGENT "git/" GIT_VERSION
#define GIT_VERSION "2.42.0"
#define HAVE_ALLOCA_H
Expand Down
21 changes: 18 additions & 3 deletions pkg/git/gen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ build('hooklist', '$outdir/hook-list.h', {
'|', '$srcdir/generate-hooklist.sh', '$srcdir/Documentation/githooks.txt'
})

cc('setup.c', nil, {cflags=string.format(
[[$cflags '-D DEFAULT_GIT_TEMPLATE_DIR="%s/share/git-core/templates"']],
config.prefix)
})
cc('exec-cmd.c', nil, {cflags=string.format(
[[$cflags '-DFALLBACK_RUNTIME_PREFIX=""' '-D GIT_EXEC_PATH="%s/libexec/git-core"']],
config.prefix)
})
cc('exec-cmd.c', nil, {cflags=[[$cflags '-DFALLBACK_RUNTIME_PREFIX=""']]})
cc('common-main.c')
cc('http.c')
Expand Down Expand Up @@ -219,7 +227,7 @@ lib('libgit.a', [[
sequencer.c
serve.c
server-info.c
setup.c
setup.c.o
shallow.c
sideband.c
sigchain.c
Expand Down Expand Up @@ -361,7 +369,6 @@ local builtins = {
'get-tar-commit-id',
'grep',
'hash-object',
'help',
'hook',
'index-pack',
'init-db',
Expand Down Expand Up @@ -434,7 +441,15 @@ local builtins = {
'worktree',
'write-tree',
}
exe('git', {'git.c', 'common-main.c.o', expand{'builtin/', builtins, '.c'}, 'libgit.a.d'})

local docdefs = string.format([['-D GIT_INFO_PATH="%s/share/info"' ]]
.. [['-D GIT_MAN_PATH="%s/share/man"' ]]
.. [['-D GIT_HTML_PATH="%s/share/doc/git-doc"']],
config.prefix, config.prefix, config.prefix)

cc('git.c', nil, {cflags=[[$cflags ]] .. docdefs})
cc('builtin/help.c', nil, {cflags=[[$cflags ]] .. docdefs})
exe('git', {'git.c.o', 'common-main.c.o', 'builtin/help.c.o', expand{'builtin/', builtins, '.c'}, 'libgit.a.d'})
file('bin/git', '755', '$outdir/git')

local programs = {
Expand Down

0 comments on commit 9d1c006

Please sign in to comment.