ee306a1d565740e440dc52e632ea24089b6aee90
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / slang / 0002-Enable-a-statically-linked-version-of-slsh.patch
1 Enable a statically-linked version of slsh to be built and installed
2
3 Adapt an upstream patch to make it apply on 2.3.0. Unnecessary changes
4 have been ignored.
5
6 Repository: git://git.jedsoft.org/git/slang.git
7 Commit ID: 3796db6fb94a2fc7fe2fb0b6918501b69a4d3a02
8 Author: John E. Davis <jed@jedsoft.org>
9
10 Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
11 ---
12 diff -rup a/autoconf/Makefile.in b/autoconf/Makefile.in
13 --- a/autoconf/Makefile.in      2014-09-18 04:02:24.000000000 +0100
14 +++ b/autoconf/Makefile.in      2014-12-08 11:59:30.879313080 +0000
15 @@ -41,16 +41,19 @@ src/Makefile: configure src/Makefile.in 
16  #
17  makefiles: Makefile slsh/Makefile modules/Makefile src/Makefile
18  help:
19 -       @echo "make install : install a shared version of the library"
20 -       @echo "make install-static : install a static version"
21 -       @echo "make install-all : install both shared and static versions"
22 -       @echo "make check : Build the library and run the regression tests"
23 +       @echo "make install ==> shared version of the library, slsh and modules"
24 +       @echo "make install-static ==> static version of the library and slsh; no modules"
25 +       @echo "make install-all ==> shared/static versions of the library/modules + shared slsh."
26 +       @echo "make install-modules ==> install the modules"
27 +       @echo "make check ==> Build the library and run the regression tests"
28  slang.pc: configure autoconf/slangpc.in
29         @echo "slang.pc needs to be updated -- rerun configure"
30         @exit 1
31  static: makefiles slang.pc
32         cd src; $(MAKE) static
33 -       cd slsh; $(MAKE) all
34 +       cd slsh; $(MAKE) static
35 +modules:
36 +       cd modules; $(MAKE) all
37  elf: makefiles slang.pc
38         cd src; $(MAKE) elf
39         cd slsh; $(MAKE) all
40 @@ -73,10 +76,11 @@ clean:
41         cd demo; $(MAKE) clean
42  install-static:
43         cd src; $(MAKE) install-static
44 +       cd slsh; $(MAKE) install-static
45  install-pkgconfig: slang.pc
46         $(MKINSDIR) $(DEST_PKGCONFIGDIR)
47         $(INSTALL_DATA) slang.pc $(DEST_PKGCONFIGDIR)/
48 -install-elf:
49 +install-elf: install-pkgconfig
50         cd src; $(MAKE) install-elf
51         @echo Now installing slsh
52         cd slsh; $(MAKE) install
53 @@ -86,7 +90,10 @@ install-elf:
54         @echo "On some systems, e.g., linux, you may also have to run ldconfig."
55         @echo ""
56  install: install-elf install-pkgconfig
57 -install-all: install-elf install-static install-pkgconfig
58 +install-all: install-elf
59 +       cd src; $(MAKE) install-static
60 +install-modules:
61 +       cd modules; $(MAKE) install
62  install-links:
63         cd src; $(MAKE) install-links
64  #
65 diff -rup a/slsh/Makefile.in b/slsh/Makefile.in
66 --- a/slsh/Makefile.in  2014-12-08 11:52:51.303284637 +0000
67 +++ b/slsh/Makefile.in  2014-12-08 12:06:44.811939732 +0000
68 @@ -16,7 +16,8 @@ SLANG_INST_INC        = -I@includedir@
69  SLANG_INST_LIB = -L$(INST_LIB_DIR)
70  #---------------------------------------------------------------------------
71  SLANG_SRCINC   = -I@SRCDIR@
72 -SLANG_SRCLIB   = -L@ELFDIR@
73 +SLANG_ELFLIB   = -L@ELFDIR@#  for dynamically linked
74 +SLANG_OBJLIB   = -L@OBJDIR@#  for statically linked
75  #---------------------------------------------------------------------------
76  OTHER_LIBS     = @TERMCAP@ @DYNAMIC_LINK_LIB@ @LIBS@ @M_LIB@
77  RPATH          = @RPATH@
78 @@ -73,10 +74,12 @@ INST_LIBS = $(DEST_LIB_DIR) $(RPATH) $(S
79  DEFS = -DSLSH_CONF_DIR='"$(SLSH_CONF_DIR)"' -DSLSH_PATH='"$(SLSH_LIB_DIR)"' \
80   -DSLSH_CONF_DIR_ENV='$(SLSH_CONF_DIR_ENV)' -DSLSH_LIB_DIR_ENV='$(SLSH_LIB_DIR_ENV)' \
81   -DSLSH_PATH_ENV='$(SLSH_PATH_ENV)'
82 -SRC_LIBS = $(SLANG_SRCLIB) -lslang $(READLINE_LIB) $(OTHER_LIBS)
83 +SRC_LIBS = $(SLANG_ELFLIB) -lslang $(READLINE_LIB) $(OTHER_LIBS)
84 +STATIC_SRC_LIBS = $(SLANG_OBJLIB) -lslang $(READLINE_LIB) $(OTHER_LIBS)
85  #
86  all: $(OBJDIR)/slsh_exe
87  slsh: $(OBJDIR)/slsh
88 +static: $(OBJDIR)/slsh_static
89  $(OBJDIR)/slsh_exe: $(OBJDIR)/slsh.o $(OBJDIR)/readline.o
90         $(CC) $(CFLAGS) $(OBJDIR)/slsh.o $(OBJDIR)/readline.o -o $(OBJDIR)/slsh_exe $(LDFLAGS) $(SRC_LIBS)
91  $(OBJDIR)/slsh: $(OBJDIR)/slsh.o $(OBJDIR)/readline.o
92 @@ -85,6 +88,8 @@ $(OBJDIR)/slsh.o: $(OBJDIR) slsh.c slsh.
93         cd $(OBJDIR) && $(CC) $(SLANG_SRCINC) $(CFLAGS) -c $(DEFS) $(SRCDIR)/slsh.c
94  $(OBJDIR)/readline.o: $(OBJDIR) readline.c slsh.h config.h Makefile
95         cd $(OBJDIR) && $(CC) $(SLANG_SRCINC) $(CFLAGS) -c $(DEFS) -DUSE_GNU_READLINE=$(GNU_READLINE) $(SRCDIR)/readline.c
96 +$(OBJDIR)/slsh_static: $(OBJDIR)/slsh.o $(OBJDIR)/readline.o
97 +       $(CC) $(CFLAGS) $(OBJDIR)/slsh.o $(OBJDIR)/readline.o -o $(OBJDIR)/slsh_static $(LDFLAGS) $(STATIC_SRC_LIBS)
98  $(OBJDIR):
99         -$(MKINSDIR) $(OBJDIR)
100  config.h: ../src/config.h
101 @@ -151,6 +156,12 @@ install: slsh install_directories instal
102         $(INSTALL_DATA) etc/slsh.rc $(DEST_SLSH_CONF_DIR)/
103         echo 'prepend_to_slang_load_path("$(SLSH_LOCALLIB_DIR)");' >> $(DEST_SLSH_CONF_DIR)/slsh.rc
104         $(INSTALL_DATA) doc/man/slsh.1 $(DEST_MAN_DIR)/
105 +install-static: static install_directories install_lib_files install_rline_files \
106 + install_scripts install_help install_docs
107 +       $(INSTALL) $(OBJDIR)/slsh_static $(DEST_BIN_DIR)/slsh
108 +       $(INSTALL_DATA) etc/slsh.rc $(DEST_SLSH_CONF_DIR)/
109 +       echo 'prepend_to_slang_load_path("$(SLSH_LOCALLIB_DIR)");' >> $(DEST_SLSH_CONF_DIR)/slsh.rc
110 +       $(INSTALL_DATA) doc/man/slsh.1 $(DEST_MAN_DIR)/
111  #---------------------------------------------------------------------------
112  # Housekeeping
113  #---------------------------------------------------------------------------
114 @@ -161,5 +172,5 @@ distclean: clean
115  #
116  .PHONY: all clean distclean symlinks slsh install install_directories \
117    install_lib_files install_rline_files install_scripts install_help \
118 -  install_docs
119 +  install_docs install-static static
120