Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>,
	Timur Safin <tsafin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH luajit 1/5] build: preserve the original build system
Date: Tue,  2 Feb 2021 23:57:41 +0300	[thread overview]
Message-ID: <b9eaa8146fdc237af7612307538044718ea96317.1612291495.git.imun@tarantool.org> (raw)
In-Reply-To: <cover.1612291495.git.imun@tarantool.org>

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@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
 INSTALL_F= install -m 0644
 UNINSTALL= $(RM)
 LDCONFIG= ldconfig -n
-SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" \
-            -e "s|^multilib=.*|multilib=$(MULTILIB)|"
-SED_TMEMPROF= sed -e "s|^TOOL_DIR=.*|TOOL_DIR=$(INSTALL_TOOLSLIB)|" \
-                  -e "s|^LUAJIT_BIN=.*|LUAJIT_BIN=$(INSTALL_T)|"
+SED_PC= sed -e "s|@LUAJIT_PC_PREFIX@|$(PREFIX)|" \
+            -e "s|@LUAJIT_PC_MULTILIB@|$(MULTILIB)|"
+SED_TMEMPROF= sed -e "s|@LUAJIT_TOOLS_DIR@|$(INSTALL_TOOLSLIB)|" \
+                  -e "s|@LUAJIT_TOOLS_BIN@|$(INSTALL_T)|"
 
 FILE_T= luajit
 FILE_A= libluajit.a
@@ -123,9 +123,9 @@ endif
 
 INSTALL_DEP= src/luajit
 
-default all $(INSTALL_DEP):
+default all $(INSTALL_DEP): tools
 	@echo "==== Building LuaJIT $(VERSION) ===="
-	$(MAKE) -C src
+	$(MAKE) -C src -f Makefile.original
 	@echo "==== Successfully built LuaJIT $(VERSION) ===="
 
 install: $(INSTALL_DEP)
@@ -140,17 +140,17 @@ install: $(INSTALL_DEP)
 	  $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT1) && \
 	  $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT2) || :
 	cd etc && $(INSTALL_F) $(FILE_MAN) $(INSTALL_MAN)
-	cd etc && $(SED_PC) $(FILE_PC) > $(FILE_PC).tmp && \
-	  $(INSTALL_F) $(FILE_PC).tmp $(INSTALL_PC) && \
-	  $(RM) $(FILE_PC).tmp
+	cd etc && $(SED_PC) $(FILE_PC).in > $(FILE_PC) && \
+	  $(INSTALL_F) $(FILE_PC) $(INSTALL_PC) && \
+	  $(RM) $(FILE_PC)
 	cd src && $(INSTALL_F) $(FILES_INC) $(INSTALL_INC)
 	cd src/jit && $(INSTALL_F) $(FILES_JITLIB) $(INSTALL_JITLIB)
 	cd tools/utils && $(INSTALL_F) $(FILES_UTILSLIB) $(INSTALL_UTILSLIB)
 	cd tools/memprof && $(INSTALL_F) $(FILES_MEMPROFLIB) $(INSTALL_MEMPROFLIB)
 	cd tools && $(INSTALL_F) $(FILES_TOOLSLIB) $(INSTALL_TOOLSLIB)
-	cd tools && $(SED_TMEMPROF) $(FILE_TMEMPROF) > $(FILE_TMEMPROF).tmp && \
-	  $(INSTALL_X) $(FILE_TMEMPROF).tmp $(INSTALL_TMEMPROF) && \
-	  $(RM) $(FILE_TMEMPROF).tmp
+	cd tools && $(SED_TMEMPROF) $(FILE_TMEMPROF).in > $(FILE_TMEMPROF) && \
+	  $(INSTALL_X) $(FILE_TMEMPROF) $(INSTALL_TMEMPROF) && \
+	  $(RM) $(FILE_TMEMPROF)
 	@echo "==== Successfully installed LuaJIT $(VERSION) to $(PREFIX) ===="
 	@echo ""
 	@echo "Note: the development releases deliberately do NOT install a symlink for luajit"
@@ -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
+# 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)|" \
+	     $@.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
 version=${majver}.${minver}.${relver}-beta3
 abiver=5.1
 
-prefix=/usr/local
-multilib=lib
+prefix=@LUAJIT_PC_PREFIX@
+multilib=@LUAJIT_PC_MULTILIB@
 exec_prefix=${prefix}
 libdir=${exec_prefix}/${multilib}
 libname=luajit-${abiver}
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
@@ -624,7 +624,7 @@ depend:
 	      -e "s|^\([^l ]\)|host/\1|" \
 	      -e "s| lj_target_\S*\.h| lj_target_*.h|g" \
 	      -e "s| lj_emit_\S*\.h| lj_emit_*.h|g" \
-	      -e "s| lj_asm_\S*\.h| lj_asm_*.h|g" >Makefile.dep
+	      -e "s| lj_asm_\S*\.h| lj_asm_*.h|g" >Makefile.dep.original
 	@for file in $(ALL_HDRGEN); do \
 	  test -s $$file || $(HOST_RM) $$file; \
 	  done
@@ -699,7 +699,7 @@ $(HOST_O): %.o: %.c
 	$(E) "HOSTCC    $@"
 	$(Q)$(HOST_CC) $(HOST_ACFLAGS) -c -o $@ $<
 
-include Makefile.dep
+include Makefile.dep.original
 
 ##############################################################################
 # Target file rules.
diff --git a/tools/luajit-parse-memprof b/tools/luajit-parse-memprof
deleted file mode 100755
index c814301..0000000
--- a/tools/luajit-parse-memprof
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-#
-# Launcher for memprof parser.
-
-# This two variables are replaced on installing.
-TOOL_DIR=$(dirname `readlink -f $0`)
-LUAJIT_BIN=$TOOL_DIR/../src/luajit
-
-LUA_PATH="$TOOL_DIR/?.lua;;" $LUAJIT_BIN $TOOL_DIR/memprof.lua $@
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 $@
-- 
2.25.0


  reply	other threads:[~2021-02-02 20:58 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02 20:57 [Tarantool-patches] [PATCH luajit 0/5] Self-sufficient LuaJIT testing environment Igor Munkin via Tarantool-patches
2021-02-02 20:57 ` Igor Munkin via Tarantool-patches [this message]
2021-02-04 22:53   ` [Tarantool-patches] [PATCH luajit 1/5] build: preserve the original build system Timur Safin via Tarantool-patches
2021-02-08 15:56     ` Igor Munkin via Tarantool-patches
2021-02-09 11:38   ` Sergey Kaplun via Tarantool-patches
2021-02-09 12:47     ` Igor Munkin via Tarantool-patches
2021-02-09 14:45       ` Sergey Kaplun via Tarantool-patches
2021-02-09 15:28         ` Igor Munkin via Tarantool-patches
2021-02-10  9:35           ` Sergey Kaplun via Tarantool-patches
2021-02-02 20:57 ` [Tarantool-patches] [PATCH luajit 2/5] build: replace GNU Make with CMake Igor Munkin via Tarantool-patches
2021-02-04 22:53   ` Timur Safin via Tarantool-patches
2021-02-08 15:56     ` Igor Munkin via Tarantool-patches
2021-02-09 13:55       ` Timur Safin via Tarantool-patches
2021-02-09 15:09         ` Igor Munkin via Tarantool-patches
2021-02-11 19:23   ` Sergey Kaplun via Tarantool-patches
2021-02-16 15:28     ` Igor Munkin via Tarantool-patches
2021-02-18  9:56       ` Sergey Kaplun via Tarantool-patches
2021-02-20 19:18         ` Igor Munkin via Tarantool-patches
2021-02-27 10:48           ` Sergey Kaplun via Tarantool-patches
2021-02-28 18:18             ` Igor Munkin via Tarantool-patches
2021-02-13  3:47   ` Sergey Kaplun via Tarantool-patches
2021-02-16 15:32     ` Igor Munkin via Tarantool-patches
2021-02-02 20:57 ` [Tarantool-patches] [PATCH luajit 3/5] test: run LuaJIT tests via CMake Igor Munkin via Tarantool-patches
2021-02-08 15:05   ` Timur Safin via Tarantool-patches
2021-02-08 16:29     ` Igor Munkin via Tarantool-patches
2021-02-09  8:16       ` Timur Safin via Tarantool-patches
2021-02-09  8:43         ` Igor Munkin via Tarantool-patches
2021-02-09 13:59           ` Timur Safin via Tarantool-patches
2021-02-09 15:10             ` Igor Munkin via Tarantool-patches
2021-02-14 18:48   ` Sergey Kaplun via Tarantool-patches
2021-02-19 19:04     ` Igor Munkin via Tarantool-patches
2021-02-27 13:50       ` Sergey Kaplun via Tarantool-patches
2021-02-28 18:18         ` Igor Munkin via Tarantool-patches
2021-02-02 20:57 ` [Tarantool-patches] [PATCH luajit 4/5] test: fix warnings found with luacheck in misclib* Igor Munkin via Tarantool-patches
     [not found]   ` <012f01d6fe1a$a2aa6890$e7ff39b0$@tarantool.org>
2021-02-08 15:57     ` Igor Munkin via Tarantool-patches
     [not found]     ` <2c495492-50f4-acfd-ad66-2cb44abb5fa1@tarantool.org>
2021-02-08 15:40       ` Sergey Bronnikov via Tarantool-patches
2021-02-08 15:58       ` Igor Munkin via Tarantool-patches
2021-02-14 19:16   ` Sergey Kaplun via Tarantool-patches
2021-02-16 15:29     ` Igor Munkin via Tarantool-patches
2021-02-16 16:36       ` Sergey Kaplun via Tarantool-patches
2021-02-02 20:57 ` [Tarantool-patches] [PATCH luajit 5/5] test: run luacheck static analysis via CMake Igor Munkin via Tarantool-patches
2021-02-04 22:52   ` Timur Safin via Tarantool-patches
2021-02-08 15:57     ` Igor Munkin via Tarantool-patches
2021-02-14 19:32   ` Sergey Kaplun via Tarantool-patches
2021-02-19 19:14     ` Igor Munkin via Tarantool-patches
2021-02-28 22:04 ` [Tarantool-patches] [PATCH luajit 0/5] Self-sufficient LuaJIT testing environment Igor Munkin via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b9eaa8146fdc237af7612307538044718ea96317.1612291495.git.imun@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imun@tarantool.org \
    --cc=skaplun@tarantool.org \
    --cc=tsafin@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 1/5] build: preserve the original build system' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox