[Tarantool-patches] [PATCH luajit 1/5] build: preserve the original build system
Sergey Kaplun
skaplun at tarantool.org
Tue Feb 9 14:38:52 MSK 2021
Hi, Igor!
Thanks for the patch!
LGTM, except 4 comments about memory profiler parser below.
On 02.02.21, Igor Munkin wrote:
> Since the build machinery is going to be ported to CMake there would be
> Makefile names clashing. This change renames the original build system
> (and a couple of auxiliary files requiring configuring) to keep all this
> machinery working.
>
> As a result of these changes one need to explicitly specify the Makefile
> in the build command:
> | make -f Makefile.original <options>
>
> Needed for tarantool/tarantool#4862
>
> Signed-off-by: Igor Munkin <imun at tarantool.org>
> ---
> Makefile => Makefile.original | 44 +++++++++++++--------
> etc/{luajit.pc => luajit.pc.in} | 4 +-
> src/{Makefile.dep => Makefile.dep.original} | 0
> src/{Makefile => Makefile.original} | 4 +-
> tools/luajit-parse-memprof | 9 -----
> tools/luajit-parse-memprof.in | 6 +++
> 6 files changed, 38 insertions(+), 29 deletions(-)
> rename Makefile => Makefile.original (85%)
> rename etc/{luajit.pc => luajit.pc.in} (91%)
> rename src/{Makefile.dep => Makefile.dep.original} (100%)
> rename src/{Makefile => Makefile.original} (99%)
> delete mode 100755 tools/luajit-parse-memprof
> create mode 100644 tools/luajit-parse-memprof.in
>
> diff --git a/Makefile b/Makefile.original
> similarity index 85%
> rename from Makefile
> rename to Makefile.original
> index 61967df..b85d4bf 100644
> --- a/Makefile
> +++ b/Makefile.original
> @@ -85,10 +85,10 @@ INSTALL_X= install -m 0755
<snipped>
> @@ -185,13 +185,25 @@ uninstall:
>
> ##############################################################################
>
> -amalg:
> +amalg: tools
> @echo "Building LuaJIT $(VERSION)"
> - $(MAKE) -C src amalg
> + $(MAKE) -C src -f Makefile.original amalg
>
> clean:
> - $(MAKE) -C src clean
> + $(RM) tools/$(FILE_TMEMPROF)
> + $(MAKE) -C src -f Makefile.original clean
>
> -.PHONY: all install amalg clean
> +tools: tools/$(FILE_TMEMPROF)
> +
> +# FIXME: This is an ugly hack to manually configure an auxiliary
> +# tools/luajit-parse-memprof. I hope this file will have gone away
1. I suggest the following rewording ("I hope" is too personal :)):
s/I hope this file will have gone away/This file should go away/
> +# in scope of https://github.com/tarantool/tarantool/issues/5688.
> +tools/$(FILE_TMEMPROF):
> + @sed -e "s|@LUAJIT_TOOLS_DIR@|$(realpath tools)|" \
> + -e "s|@LUAJIT_TOOLS_BIN@|$(realpath src/luajit)|" \
2. @LUAJIT_BIN@ looks more convenient, doesn't it?
> + $@.in > $@
> + @chmod +x $@
> +
> +.PHONY: all install amalg clean tools
>
> ##############################################################################
> diff --git a/etc/luajit.pc b/etc/luajit.pc.in
> similarity index 91%
> rename from etc/luajit.pc
> rename to etc/luajit.pc.in
> index a78f174..f32385d 100644
> --- a/etc/luajit.pc
> +++ b/etc/luajit.pc.in
> @@ -5,8 +5,8 @@ relver=0
<snipped>
> diff --git a/src/Makefile.dep b/src/Makefile.dep.original
> similarity index 100%
> rename from src/Makefile.dep
> rename to src/Makefile.dep.original
> diff --git a/src/Makefile b/src/Makefile.original
> similarity index 99%
> rename from src/Makefile
> rename to src/Makefile.original
> index 825b01c..502504c 100644
> --- a/src/Makefile
> +++ b/src/Makefile.original
<snipped>
> diff --git a/tools/luajit-parse-memprof b/tools/luajit-parse-memprof
> deleted file mode 100755
<snipped>
> diff --git a/tools/luajit-parse-memprof.in b/tools/luajit-parse-memprof.in
> new file mode 100644
> index 0000000..8867202
> --- /dev/null
> +++ b/tools/luajit-parse-memprof.in
> @@ -0,0 +1,6 @@
> +#!/bin/bash
> +#
> +# Launcher for memprof parser.
> +
> +LUA_PATH="@LUAJIT_TOOLS_DIR@/?.lua;;" \
> + @LUAJIT_TOOLS_BIN@ @LUAJIT_TOOLS_DIR@/memprof.lua $@
3. Unfortunately, your solution doesn't work for me:
| $ git log --oneline -n1
| 7badb7e (HEAD) build: preserve the original build system
| $ make -f Makefile.original -j
| ==== Building LuaJIT 2.1.0-beta3 ====
| ...
| ==== Successfully built LuaJIT 2.1.0-beta3 ====
Side note: I suppose it is nothing bad to add corresponding lines about
tools building. At least it simplifies build debugging.
Feel free to ignore.
| $ tools/luajit-parse-memprof /tmp/memprof_memleak.bin; echo -e "\n"; cat tools/luajit-parse-memprof
| tools/luajit-parse-memprof: line 5: /home/burii/reviews/luajit/cmake/tools/memprof.lua: Permission denied
|
| #!/bin/bash
| #
| # Launcher for memprof parser.
|
| LUA_PATH="/home/burii/reviews/luajit/cmake/tools/?.lua;;" \
| /home/burii/reviews/luajit/cmake/tools/memprof.lua $@
This patch is working for me. But I am not bash|make guru :).
| diff --git a/Makefile.original b/Makefile.original
| index b85d4bf..877398a 100644
| --- a/Makefile.original
| +++ b/Makefile.original
| @@ -199,8 +199,8 @@ tools: tools/$(FILE_TMEMPROF)
| # tools/luajit-parse-memprof. I hope this file will have gone away
| # in scope of https://github.com/tarantool/tarantool/issues/5688.
| tools/$(FILE_TMEMPROF):
| - @sed -e "s|@LUAJIT_TOOLS_DIR@|$(realpath tools)|" \
| - -e "s|@LUAJIT_TOOLS_BIN@|$(realpath src/luajit)|" \
| + @sed -e "s|@LUAJIT_TOOLS_DIR@|`realpath tools`|" \
| + -e "s|@LUAJIT_TOOLS_BIN@|`realpath src/luajit`|" \
| $@.in > $@
| @chmod +x $@
|
4. Please, create separate commit to tools-related changes.
Also, I suppose, it would be nice to add <tools/luajit-parse-memprof>
to <.gitignore> as far as it's generated. These lines may be confusing:
| $ git status
| HEAD detached at 7badb7e
| Untracked files:
| (use "git add <file>..." to include in what will be committed)
| tools/luajit-parse-memprof
> --
> 2.25.0
>
--
Best regards,
Sergey Kaplun
More information about the Tarantool-patches
mailing list