Skip to contentSkip to conversation

slang: fix static builds

PATCH New Vicente Olivert Riera 2 participants 6 messages Dec 9, 2014 – Dec 10, 2014

lore
Share & tools
lore
#0 lore raw

cover slang: fix static builds

- Rename current patches to follow the new name convention.
- Adapt upstream patches to allow building only the static library and a static version of slsh.
- Use specific build and install commands when doing static builds.

Vicente Olivert Riera (3):
slang: rename patches to follow the new name convention
slang: add adapted upstream patches for static builds
slang: use specific build and install commands for static builds

 ...ang-01-slsh-libs.patch => 0001-slsh-libs.patch} |    0
 ...nable-a-statically-linked-version-of-slsh.patch |  120 ++++++++++++++++++++
 ...-in-the-statically-linked-version-of-slsh.patch |  114 +++++++++++++++++++
 package/slang/slang.mk                             |    6 +
 4 files changed, 240 insertions(+), 0 deletions(-)
 rename package/slang/{slang-01-slsh-libs.patch => 0001-slsh-libs.patch} (100%)
 create mode 100644 package/slang/0002-Enable-a-statically-linked-version-of-slsh.patch
 create mode 100644 package/slang/0003-Disable-module-support-in-the-statically-linked-version-of-slsh.patch
#1 lore raw

PATCH 1/3 slang: rename patches to follow the new name convention

---
 ...ang-01-slsh-libs.patch => 0001-slsh-libs.patch} |    0
 1 files changed, 0 insertions(+), 0 deletions(-)
 rename package/slang/{slang-01-slsh-libs.patch => 0001-slsh-libs.patch} (100%)
package/slang/0001-slsh-libs.patch renamed from package/slang/slang-01-slsh-libs.patch +0 -0
similarity index 100%
rename from package/slang/slang-01-slsh-libs.patch
rename to package/slang/0001-slsh-libs.patch
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/3 slang: add adapted upstream patches for static builds

In reply to Vicente Olivert Riera

These are adapted upstream patches to make them apply on the version we are using in Buildroot, and also taking into account that we already have another patch which modifies the same file, so these patches would not apply as they are. Unnecessary parts of the upstream patches have been ingnored, such as changelogs or version changes.
The purpose of these patches are allowing the static library and a static version of slsh be built without building any dynamic bit. These patches will be included in the next release, so we can remove them when we do the next version bump.

---
 ...nable-a-statically-linked-version-of-slsh.patch |  120 ++++++++++++++++++++
 ...-in-the-statically-linked-version-of-slsh.patch |  114 +++++++++++++++++++
 2 files changed, 234 insertions(+), 0 deletions(-)
 create mode 100644 package/slang/0002-Enable-a-statically-linked-version-of-slsh.patch
 create mode 100644 package/slang/0003-Disable-module-support-in-the-statically-linked-version-of-slsh.patch
package/slang/0002-Enable-a-statically-linked-version-of-slsh.patch new file +120 -0
new file mode 100644
index 0000000..ee306a1
@@ -0,0 +1,120 @@
+Enable a statically-linked version of slsh to be built and installed
+
+Adapt an upstream patch to make it apply on 2.3.0. Unnecessary changes
+have been ignored.
+
+Repository: git://git.jedsoft.org/git/slang.git
+Commit ID: 3796db6fb94a2fc7fe2fb0b6918501b69a4d3a02
+Author: John E. Davis <[email protected]>
+
+Signed-off-by: Vicente Olivert Riera <[email protected]>
+---
+diff -rup a/autoconf/Makefile.in b/autoconf/Makefile.in
+--- a/autoconf/Makefile.in	2014-09-18 04:02:24.000000000 +0100
++++ b/autoconf/Makefile.in	2014-12-08 11:59:30.879313080 +0000
+@@ -41,16 +41,19 @@ src/Makefile: configure src/Makefile.in 
+ #
+ makefiles: Makefile slsh/Makefile modules/Makefile src/Makefile
+ help:
+-	@echo "make install : install a shared version of the library"
+-	@echo "make install-static : install a static version"
+-	@echo "make install-all : install both shared and static versions"
+-	@echo "make check : Build the library and run the regression tests"
++	@echo "make install ==> shared version of the library, slsh and modules"
++	@echo "make install-static ==> static version of the library and slsh; no modules"
++	@echo "make install-all ==> shared/static versions of the library/modules + shared slsh."
++	@echo "make install-modules ==> install the modules"
++	@echo "make check ==> Build the library and run the regression tests"
+ slang.pc: configure autoconf/slangpc.in
+ 	@echo "slang.pc needs to be updated -- rerun configure"
+ 	@exit 1
+ static: makefiles slang.pc
+ 	cd src; $(MAKE) static
+-	cd slsh; $(MAKE) all
++	cd slsh; $(MAKE) static
++modules:
++	cd modules; $(MAKE) all
+ elf: makefiles slang.pc
+ 	cd src; $(MAKE) elf
+ 	cd slsh; $(MAKE) all
+@@ -73,10 +76,11 @@ clean:
+ 	cd demo; $(MAKE) clean
+ install-static:
+ 	cd src; $(MAKE) install-static
++	cd slsh; $(MAKE) install-static
+ install-pkgconfig: slang.pc
+ 	$(MKINSDIR) $(DEST_PKGCONFIGDIR)
+ 	$(INSTALL_DATA) slang.pc $(DEST_PKGCONFIGDIR)/
+-install-elf:
++install-elf: install-pkgconfig
+ 	cd src; $(MAKE) install-elf
+ 	@echo Now installing slsh
+ 	cd slsh; $(MAKE) install
+@@ -86,7 +90,10 @@ install-elf:
+ 	@echo "On some systems, e.g., linux, you may also have to run ldconfig."
+ 	@echo ""
+ install: install-elf install-pkgconfig
+-install-all: install-elf install-static install-pkgconfig
++install-all: install-elf
++	cd src; $(MAKE) install-static
++install-modules:
++	cd modules; $(MAKE) install
+ install-links:
+ 	cd src; $(MAKE) install-links
+ #
+diff -rup a/slsh/Makefile.in b/slsh/Makefile.in
+--- a/slsh/Makefile.in	2014-12-08 11:52:51.303284637 +0000
++++ b/slsh/Makefile.in	2014-12-08 12:06:44.811939732 +0000
+@@ -16,7 +16,8 @@ SLANG_INST_INC	= -I at includedir@
+ SLANG_INST_LIB	= -L$(INST_LIB_DIR)
+ #---------------------------------------------------------------------------
+ SLANG_SRCINC	= -I at SRCDIR@
+-SLANG_SRCLIB	= -L at ELFDIR@
++SLANG_ELFLIB	= -L at ELFDIR@#  for dynamically linked
++SLANG_OBJLIB	= -L at OBJDIR@#  for statically linked
+ #---------------------------------------------------------------------------
+ OTHER_LIBS	= @TERMCAP@ @DYNAMIC_LINK_LIB@ @LIBS@ @M_LIB@
+ RPATH		= @RPATH@
+@@ -73,10 +74,12 @@ INST_LIBS = $(DEST_LIB_DIR) $(RPATH) $(S
+ DEFS = -DSLSH_CONF_DIR='"$(SLSH_CONF_DIR)"' -DSLSH_PATH='"$(SLSH_LIB_DIR)"' \
+  -DSLSH_CONF_DIR_ENV='$(SLSH_CONF_DIR_ENV)' -DSLSH_LIB_DIR_ENV='$(SLSH_LIB_DIR_ENV)' \
+  -DSLSH_PATH_ENV='$(SLSH_PATH_ENV)'
+-SRC_LIBS = $(SLANG_SRCLIB) -lslang $(READLINE_LIB) $(OTHER_LIBS)
++SRC_LIBS = $(SLANG_ELFLIB) -lslang $(READLINE_LIB) $(OTHER_LIBS)
++STATIC_SRC_LIBS = $(SLANG_OBJLIB) -lslang $(READLINE_LIB) $(OTHER_LIBS)
+ #
+ all: $(OBJDIR)/slsh_exe
+ slsh: $(OBJDIR)/slsh
++static: $(OBJDIR)/slsh_static
+ $(OBJDIR)/slsh_exe: $(OBJDIR)/slsh.o $(OBJDIR)/readline.o
+ 	$(CC) $(CFLAGS) $(OBJDIR)/slsh.o $(OBJDIR)/readline.o -o $(OBJDIR)/slsh_exe $(LDFLAGS) $(SRC_LIBS)
+ $(OBJDIR)/slsh: $(OBJDIR)/slsh.o $(OBJDIR)/readline.o
+@@ -85,6 +88,8 @@ $(OBJDIR)/slsh.o: $(OBJDIR) slsh.c slsh.
+ 	cd $(OBJDIR) && $(CC) $(SLANG_SRCINC) $(CFLAGS) -c $(DEFS) $(SRCDIR)/slsh.c
+ $(OBJDIR)/readline.o: $(OBJDIR) readline.c slsh.h config.h Makefile
+ 	cd $(OBJDIR) && $(CC) $(SLANG_SRCINC) $(CFLAGS) -c $(DEFS) -DUSE_GNU_READLINE=$(GNU_READLINE) $(SRCDIR)/readline.c
++$(OBJDIR)/slsh_static: $(OBJDIR)/slsh.o $(OBJDIR)/readline.o
++	$(CC) $(CFLAGS) $(OBJDIR)/slsh.o $(OBJDIR)/readline.o -o $(OBJDIR)/slsh_static $(LDFLAGS) $(STATIC_SRC_LIBS)
+ $(OBJDIR):
+ 	-$(MKINSDIR) $(OBJDIR)
+ config.h: ../src/config.h
+@@ -151,6 +156,12 @@ install: slsh install_directories instal
+ 	$(INSTALL_DATA) etc/slsh.rc $(DEST_SLSH_CONF_DIR)/
+ 	echo 'prepend_to_slang_load_path("$(SLSH_LOCALLIB_DIR)");' >> $(DEST_SLSH_CONF_DIR)/slsh.rc
+ 	$(INSTALL_DATA) doc/man/slsh.1 $(DEST_MAN_DIR)/
++install-static: static install_directories install_lib_files install_rline_files \
++ install_scripts install_help install_docs
++	$(INSTALL) $(OBJDIR)/slsh_static $(DEST_BIN_DIR)/slsh
++	$(INSTALL_DATA) etc/slsh.rc $(DEST_SLSH_CONF_DIR)/
++	echo 'prepend_to_slang_load_path("$(SLSH_LOCALLIB_DIR)");' >> $(DEST_SLSH_CONF_DIR)/slsh.rc
++	$(INSTALL_DATA) doc/man/slsh.1 $(DEST_MAN_DIR)/
+ #---------------------------------------------------------------------------
+ # Housekeeping
+ #---------------------------------------------------------------------------
+@@ -161,5 +172,5 @@ distclean: clean
+ #
+ .PHONY: all clean distclean symlinks slsh install install_directories \
+   install_lib_files install_rline_files install_scripts install_help \
+-  install_docs
++  install_docs install-static static
+ 
package/slang/0003-Disable-module-support-in-the-statically-linked-version-of-slsh.patch new file +114 -0

114 lines not on this page · raw message

Signature · 1 line
1.7.1
#3 lore raw

PATCH 3/3 slang: use specific build and install commands for static builds

In reply to Vicente Olivert Riera

Doing this we ensure that only the static library and a static version of slsh are built.

Fixes:
http://autobuild.buildroot.net/results/f12/f124ca3737baf5aca32029226805133d3544715c/

---
 package/slang/slang.mk |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
package/slang/slang.mk +6 -0
index 15b65b3..4dc9ad7 100644
@@ -48,4 +48,10 @@ ifeq ($(BR2_PACKAGE_READLINE),y)
 	SLANG_DEPENDENCIES += readline
 endif
 
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+	SLANG_MAKE_OPTS = static
+	SLANG_INSTALL_STAGING_OPTS = DESTDIR=$(STAGING_DIR) install-static
+	SLANG_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR) install-static
+endif
+
 $(eval $(autotools-package))
Signature · 1 line
1.7.1
#4 lore raw

cover slang: fix static builds

In reply to Vicente Olivert Riera

Dear Vicente Olivert Riera,

Quoted 9 lines · Vicente Olivert Riera

- Rename current patches to follow the new name convention.
- Adapt upstream patches to allow building only the static library and a static version of slsh.
- Use specific build and install commands when doing static builds.

Vicente Olivert Riera (3):
slang: rename patches to follow the new name convention
slang: add adapted upstream patches for static builds
slang: use specific build and install commands for static builds

All three patches applied, thanks. The last two patches could have been only one since they are both needed to fix the static linking problem.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

cover slang: fix static builds

Dear Thomas Petazzoni,

Quoted 8 lines · Thomas Petazzoni

Dear Vicente Olivert Riera,

Quoted 5 lines · Vicente Olivert Riera

- Rename current patches to follow the new name convention.
- Adapt upstream patches to allow building only the static library and a static version of slsh.
- Use specific build and install commands when doing static builds.

Quoted 7 lines
Quoted 4 lines

Vicente Olivert Riera (3):
slang: rename patches to follow the new name convention
slang: add adapted upstream patches for static builds
slang: use specific build and install commands for static builds

All three patches applied, thanks. The last two patches could have been only one since they are both needed to fix the static linking problem.

Well..., yeah, but it's easier to review, and the series is still bisectable :P

Cheers,

Signature · 5 lines
Vicente Olivert Riera
Graduate Software Engineer, MIPS Platforms
Imagination Technologies Limited
t: +44 (0)113 2429814
www.imgtec.com