diff options
author | lloyd <[email protected]> | 2014-01-07 12:37:54 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-01-07 12:37:54 +0000 |
commit | 7d18f8b444b3a7976b6f18bf74fa582fab69d2fe (patch) | |
tree | 9baf348d5ca3e17ab270fc727a64d82a5c223ac0 | |
parent | 14ea6e48d1ed916b2e36a16eb44862a89fb1fd3c (diff) |
Make the shared library an included fragment like python
Renamed make target to gmake because I'm pretty sure += and
ifdef on variables is gmake specific.
-rwxr-xr-x | configure.py | 16 | ||||
-rw-r--r-- | src/build-data/makefile/gmake.in (renamed from src/build-data/makefile/unix_shr.in) | 45 | ||||
-rw-r--r-- | src/build-data/makefile/nmake.in | 2 | ||||
-rw-r--r-- | src/build-data/makefile/python.in | 3 | ||||
-rw-r--r-- | src/build-data/makefile/shared.in | 10 | ||||
-rw-r--r-- | src/build-data/makefile/unix.in | 110 |
6 files changed, 44 insertions, 142 deletions
diff --git a/configure.py b/configure.py index eb2b64824..1f407ee54 100755 --- a/configure.py +++ b/configure.py @@ -5,7 +5,7 @@ Configuration program for botan (http://botan.randombit.net/) (C) 2009,2010,2011,2012,2013,2014 Jack Lloyd Distributed under the terms of the Botan license -Tested with CPython 2.6, 2.7, 3.1 and PyPy 1.5 +Tested with CPython 2.6, 2.7, 3.2 and PyPy 1.5 Python 2.5 works if you change the exception catching syntax: perl -pi -e 's/except (.*) as (.*):/except $1, $2:/g' configure.py @@ -1192,6 +1192,8 @@ def create_template_vars(build_config, options, modules, cc, arch, osinfo): 'target_cpu_defines': make_cpp_macros(arch.defines(options)), + 'botan_include_dir': build_config.botan_include_dir, + 'include_files': makefile_list(build_config.public_headers), 'lib_objs': makefile_list( @@ -1244,7 +1246,15 @@ def create_template_vars(build_config, options, modules, cc, arch, osinfo): 'python_version': options.python_version } - vars["python_makefile"] = process_template('src/build-data/makefile/python.in', vars) + if options.build_shared_lib: + vars["shared_makefile"] = process_template('src/build-data/makefile/shared.in', vars) + else: + vars["shared_makefile"] = "" + + if options.boost_python: + vars["python_makefile"] = process_template('src/build-data/makefile/python.in', vars) + else: + vars["python_makefile"] = "" return vars @@ -1474,7 +1484,7 @@ def setup_build(build_config, options, template_vars): if style == 'nmake': return 'nmake.in' elif style == 'unix': - return ('unix_shr.in' if options.build_shared_lib else 'unix.in') + return ('gmake.in') else: raise Exception('Unknown makefile style "%s"' % (style)) diff --git a/src/build-data/makefile/unix_shr.in b/src/build-data/makefile/gmake.in index cf4fd7fec..b5d14a601 100644 --- a/src/build-data/makefile/unix_shr.in +++ b/src/build-data/makefile/gmake.in @@ -5,22 +5,22 @@ APP_OPT = %{app_opt} LANG_FLAGS = %{lang_flags} WARN_FLAGS = %{warn_flags} SO_OBJ_FLAGS = %{shared_flags} -SO_LINK_CMD = %{so_link} -LINK_TO = %{link_to} +LIB_LINKS_TO = %{link_to} +APP_LINKS_TO = $(LIB_LINKS_TO) -lboost_regex -lboost_thread -LIB_FLAGS = $(SO_OBJ_FLAGS) $(LANG_FLAGS) $(LIB_OPT) $(WARN_FLAGS) +LIB_FLAGS = $(SO_OBJ_FLAGS) $(LANG_FLAGS) $(LIB_OPT) $(WARN_FLAGS) APP_FLAGS = $(LANG_FLAGS) $(APP_OPT) $(WARN_FLAGS) # Version Numbers VERSION = %{version} -SERIES = %{version_major}.%{version_minor} +BRANCH = %{version_major}.%{version_minor} # Installation Settings DESTDIR = %{prefix} BINDIR = $(DESTDIR)/bin LIBDIR = $(DESTDIR)/%{libdir} -HEADERDIR = $(DESTDIR)/%{includedir}/botan-$(SERIES)/botan +HEADERDIR = $(DESTDIR)/%{includedir}/botan-$(BRANCH)/botan DOCDIR = $(DESTDIR)/%{docdir}/botan-$(VERSION) PKGCONF_DIR = $(LIBDIR)/pkgconfig @@ -43,16 +43,18 @@ RM = @rm -f RM_R = @rm -rf # Targets -APP = %{app_prefix}botan -LIBRARIES = $(STATIC_LIB) $(SHARED_LIB) +APP = %{app_prefix}botan +LIBRARIES = $(STATIC_LIB) LIBNAME = %{lib_prefix}libbotan -STATIC_LIB = $(LIBNAME)-$(SERIES).a +STATIC_LIB = $(LIBNAME)-$(BRANCH).a + +LIBPATH = botan-$(BRANCH) all: $(APP) # File Lists -HEADERS = %{include_files} +INCLUDE_DIR = %{botan_include_dir} LIBOBJS = %{lib_objs} @@ -64,31 +66,20 @@ APPOBJS = %{app_objs} %{app_build_cmds} # Link Commands +%{shared_makefile} + $(APP): $(LIBRARIES) $(APPOBJS) - $(CXX) $(LDFLAGS) $(APPOBJS) $(SHARED_LIB) $(LINK_TO) -lboost_regex -lboost_thread -o $(APP) + $(CXX) $(LDFLAGS) $(APPOBJS) -L. -l$(LIBPATH) $(APP_LINKS_TO) -o $(APP) $(STATIC_LIB): $(LIBOBJS) $(RM) $(STATIC_LIB) $(AR) $(STATIC_LIB) $(LIBOBJS) $(RANLIB) $(STATIC_LIB) -SONAME = $(LIBNAME)-$(SERIES).%{so_suffix}.%{so_abi_rev} -SHARED_LIB = $(SONAME).%{version_patch} -SYMLINK = $(LIBNAME)-$(SERIES).%{so_suffix} - -$(SHARED_LIB): $(LIBOBJS) - $(SO_LINK_CMD) $(LDFLAGS) $(LIBOBJS) -o $(SHARED_LIB) $(LINK_TO) - $(LN) $(SHARED_LIB) $(SONAME) - $(LN) $(SHARED_LIB) $(SYMLINK) - %{python_makefile} # Fake Targets -.PHONY = docs clean distclean install static shared - -static: $(STATIC_LIB) - -shared: $(SHARED_LIB) +.PHONY = docs clean distclean install docs: %{build_doc_commands} @@ -103,20 +94,22 @@ distclean: clean $(RM) botan_all.cpp botan_all.h install: $(LIBRARIES) docs - $(ECHO) "Installing Botan into $(DESTDIR)... " $(MKDIR_INSTALL) $(DOCDIR) $(COPY_R) %{doc_output_dir}/* $(DOCDIR) $(MKDIR_INSTALL) $(HEADERDIR) - for i in $(HEADERS); do \ + for i in $(INCLUDE_DIR)/*.h; do \ $(INSTALL_CMD_DATA) $$i $(HEADERDIR); \ done $(MKDIR_INSTALL) $(LIBDIR) $(INSTALL_CMD_DATA) $(STATIC_LIB) $(LIBDIR) + + ifdef $(SHARED_LIB) $(INSTALL_CMD_EXEC) $(SHARED_LIB) $(LIBDIR) $(CD) $(LIBDIR); $(LN) $(SHARED_LIB) $(SYMLINK) $(CD) $(LIBDIR); $(LN) $(SHARED_LIB) $(SONAME) + endif $(MKDIR_INSTALL) $(BINDIR) $(INSTALL_CMD_EXEC) $(CONFIG_SCRIPT) $(BINDIR) diff --git a/src/build-data/makefile/nmake.in b/src/build-data/makefile/nmake.in index 3fbbf8263..392684214 100644 --- a/src/build-data/makefile/nmake.in +++ b/src/build-data/makefile/nmake.in @@ -33,8 +33,6 @@ RMDIR = @rmdir ### File Lists APP = botan -HEADERS = %{include_files} - LIBOBJS = %{lib_objs} APPOBJS = %{app_objs} diff --git a/src/build-data/makefile/python.in b/src/build-data/makefile/python.in index 5b1d2379d..f6e49ee75 100644 --- a/src/build-data/makefile/python.in +++ b/src/build-data/makefile/python.in @@ -1,4 +1,5 @@ +# Build commands for Python wrapper PYTHON_ROOT = /usr/lib/python%{python_version}/config PYTHON_INC = -I/usr/include/python%{python_version} PYTHON_SITE_PACKAGE_DIR = /usr/lib/python%{python_version}/site-packages/ @@ -17,7 +18,7 @@ PYTHON_FLAGS = $(LANG_FLAGS) $(WARN_FLAGS) $(SO_OBJ_FLAGS) -Os -ftemplate-dept $(BOTAN_PYTHON_MODDIR)/_botan.so: $(PYTHON_OBJS) cp %{python_dir}/*.py $(BOTAN_PYTHON_MODDIR) - $(CXX) -shared -Wl,-soname,$@ $(PYTHON_OBJS) -L. -L$(PYTHON_ROOT) $(LDFLAGS) -lbotan-$(SERIES) -lboost_python-%{python_version} -o $@ + $(CXX) -shared -Wl,-soname,$@ $(PYTHON_OBJS) -L. -L$(PYTHON_ROOT) $(LDFLAGS) -lbotan-$(BRANCH) -lboost_python-%{python_version} -o $@ install_python: mkdir -p $(PYTHON_SITE_PACKAGE_DIR)/botan diff --git a/src/build-data/makefile/shared.in b/src/build-data/makefile/shared.in new file mode 100644 index 000000000..f4116cce4 --- /dev/null +++ b/src/build-data/makefile/shared.in @@ -0,0 +1,10 @@ +SONAME = $(LIBNAME)-$(BRANCH).%{so_suffix}.%{so_abi_rev} +SHARED_LIB = $(SONAME).%{version_patch} +SYMLINK = $(LIBNAME)-$(BRANCH).%{so_suffix} + +$(SHARED_LIB): $(LIBOBJS) + %{so_link} $(LDFLAGS) $(LIBOBJS) $(LIB_LINKS_TO) -o $(SHARED_LIB) + $(LN) $(SHARED_LIB) $(SONAME) + $(LN) $(SHARED_LIB) $(SYMLINK) + +LIBRARIES += $(SHARED_LIB) diff --git a/src/build-data/makefile/unix.in b/src/build-data/makefile/unix.in deleted file mode 100644 index a32cd30b3..000000000 --- a/src/build-data/makefile/unix.in +++ /dev/null @@ -1,110 +0,0 @@ -# Compiler Options -CXX = %{cc} -LIB_OPT = %{lib_opt} -APP_OPT = %{app_opt} -LANG_FLAGS = %{lang_flags} -WARN_FLAGS = %{warn_flags} -LINK_TO = %{link_to} - -LIB_FLAGS = $(LANG_FLAGS) $(LIB_OPT) $(WARN_FLAGS) -APP_FLAGS = $(LANG_FLAGS) $(APP_OPT) $(WARN_FLAGS) - -# Version Numbers -VERSION = %{version} -SERIES = %{version_major}.%{version_minor} - -# Installation Settings -DESTDIR = %{prefix} - -BINDIR = $(DESTDIR)/bin -LIBDIR = $(DESTDIR)/%{libdir} -HEADERDIR = $(DESTDIR)/%{includedir}/botan-$(SERIES)/botan -DOCDIR = $(DESTDIR)/%{docdir}/botan-$(VERSION) -PKGCONF_DIR = $(LIBDIR)/pkgconfig - -CONFIG_SCRIPT = %{botan_config} -PKGCONFIG = %{botan_pkgconfig} - -# Aliases for Common Programs -AR = %{ar_command} -COPY = cp -COPY_R = cp -r -CD = @cd -ECHO = @echo -INSTALL_CMD_EXEC = %{install_cmd_exec} -INSTALL_CMD_DATA = %{install_cmd_data} -LN = ln -fs -MKDIR = @mkdir -MKDIR_INSTALL = @umask 022; mkdir -p -m 755 -RANLIB = %{ranlib_command} -RM = @rm -f -RM_R = @rm -rf - -# Targets -APP = %{app_prefix}botan -LIBRARIES = $(STATIC_LIB) - -LIBNAME = %{lib_prefix}libbotan -STATIC_LIB = $(LIBNAME)-$(SERIES).a - -all: $(APP) - -# File Lists - -HEADERS = %{include_files} - -LIBOBJS = %{lib_objs} - -APPOBJS = %{app_objs} - -# Build Commands -%{lib_build_cmds} - -%{app_build_cmds} - -# Link Commands -$(APP): $(LIBRARIES) $(APPOBJS) - $(CXX) $(APPOBJS) $(STATIC_LIB) $(LINK_TO) -o $(APP) - -$(STATIC_LIB): $(LIBOBJS) - $(RM) $(STATIC_LIB) - $(AR) $(STATIC_LIB) $(LIBOBJS) - $(RANLIB) $(STATIC_LIB) - -%{python_makefile} - -# Fake Targets -.PHONY = docs clean distclean install static - -static: $(STATIC_LIB) - -docs: -%{build_doc_commands} - -clean: - $(RM_R) %{build_dir}/lib/* %{build_dir}/tests/* - $(RM) $(LIBRARIES) $(SYMLINK) $(APP) - -distclean: clean - $(RM_R) %{build_dir} - $(RM) Makefile* $(CONFIG_SCRIPT) $(PKGCONFIG) - $(RM) botan_all.cpp botan_all.h - -install: $(LIBRARIES) docs - $(ECHO) "Installing Botan into $(DESTDIR)... " - $(MKDIR_INSTALL) $(DOCDIR) - $(COPY_R) %{doc_output_dir}/* $(DOCDIR) - - $(MKDIR_INSTALL) $(HEADERDIR) - for i in $(HEADERS); do \ - $(INSTALL_CMD_DATA) $$i $(HEADERDIR); \ - done - - $(MKDIR_INSTALL) $(LIBDIR) - $(INSTALL_CMD_DATA) $(STATIC_LIB) $(LIBDIR) - - $(MKDIR_INSTALL) $(BINDIR) - $(INSTALL_CMD_EXEC) $(CONFIG_SCRIPT) $(BINDIR) - - $(MKDIR_INSTALL) $(PKGCONF_DIR) - $(INSTALL_CMD_DATA) $(PKGCONFIG) $(PKGCONF_DIR) |