Skip to content

Commit

Permalink
Clean up a bunch of the versioning and variable mess; Fix pkg-config …
Browse files Browse the repository at this point in the history
…to not pass through libxml2 and other unrelated args; Snip lttoolbox_config.h
  • Loading branch information
TinoDidriksen committed May 7, 2020
1 parent 841a0e9 commit f3062b8
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 51 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ project(lttoolbox
LANGUAGES CXX C
)
set(VERSION ${PROJECT_VERSION})
set(MAJOR_VERSION ${PROJECT_VERSION_MAJOR})
set(API_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
set(SOVERSION 1.0.0)
set(PACKAGE_BUGREPORT "apertium-stuff@lists.sourceforge.net")
Expand Down Expand Up @@ -82,9 +83,9 @@ else()

# Generate pkg-config file
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_LIBDIR})
set(includedir ${CMAKE_INSTALL_INCLUDEDIR})
set(exec_prefix "\${prefix}")
set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
configure_file(lttoolbox.pc.in lttoolbox.pc @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/lttoolbox.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")
endif()
Expand Down
4 changes: 2 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS=-I m4

SUBDIRS = $(GENERIC_LIBRARY_NAME)
DIST_SUBDIRS = $(GENERIC_LIBRARY_NAME)
SUBDIRS = $(PACKAGE_NAME)
DIST_SUBDIRS = $(PACKAGE_NAME)

if HAVE_PYTHON_BINDINGS
SUBDIRS += python
Expand Down
40 changes: 14 additions & 26 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,35 +1,23 @@
AC_PREREQ(2.52)
AC_INIT([lttoolbox/lttoolbox.h], [3.5.2], [apertium-stuff@lists.sourceforge.net])

AC_CANONICAL_SYSTEM
m4_define([PKG_MAJOR_VERSION], [3])
m4_define([PKG_MINOR_VERSION], [5])
m4_define([PKG_PATCH_VERSION], [2])

GENERIC_LIBRARY_NAME=lttoolbox
AC_INIT([lttoolbox], [PKG_MAJOR_VERSION.PKG_MINOR_VERSION.PKG_PATCH_VERSION], [apertium-stuff@lists.sourceforge.net], [lttoolbox], [https://wiki.apertium.org/wiki/Lttoolbox])

# Release versioning
GENERIC_MAJOR_VERSION=3
GENERIC_MINOR_VERSION=5
GENERIC_MICRO_VERSION=2
VERSION=$PACKAGE_VERSION
MAJOR_VERSION=PKG_MAJOR_VERSION
API_VERSION=PKG_MAJOR_VERSION.PKG_MINOR_VERSION
SOVERSION=1:0:0

# API version (often = GENERIC_MAJOR_VERSION.GENERIC_MINOR_VERSION)
GENERIC_API_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION
AC_SUBST(GENERIC_API_VERSION)
AC_SUBST(GENERIC_MAJOR_VERSION)
AC_SUBST(PACKAGE_NAME)
AC_SUBST(PACKAGE_VERSION)
AC_SUBST(MAJOR_VERSION)
AC_SUBST(API_VERSION)
AC_SUBST(SOVERSION)

# Shared library versioning
GENERIC_LIBRARY_VERSION=1:0:0

AC_SUBST(GENERIC_LIBRARY_VERSION)
PACKAGE=$GENERIC_LIBRARY_NAME
AC_SUBST(GENERIC_LIBRARY_NAME)

GENERIC_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION.$GENERIC_MICRO_VERSION
GENERIC_RELEASE=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION
AC_SUBST(GENERIC_RELEASE)
AC_SUBST(GENERIC_VERSION)

VERSION=$GENERIC_VERSION

AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
AM_INIT_AUTOMAKE
AC_CONFIG_MACRO_DIR([m4])

AC_CANONICAL_HOST
Expand Down
4 changes: 2 additions & 2 deletions lttoolbox.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ includedir=@includedir@
Name: lttoolbox
Description: Augmented letter transducer tools for natural language processing
Version: @VERSION@
Libs: -L${libdir} -l@GENERIC_LIBRARY_NAME@@GENERIC_MAJOR_VERSION@ @LTTOOLBOX_LIBS@
Cflags: -I${includedir}/@GENERIC_LIBRARY_NAME@-@GENERIC_API_VERSION@ -I${libdir}/@GENERIC_LIBRARY_NAME@-@GENERIC_API_VERSION@/include @LTTOOLBOX_CFLAGS@
Libs: -L${libdir} -llttoolbox@MAJOR_VERSION@
Cflags: -I${includedir}/lttoolbox-@API_VERSION@
2 changes: 1 addition & 1 deletion lttoolbox/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ endif()
set(LibLttoolbox "lttoolbox${PROJECT_VERSION_MAJOR}-${API_VERSION}")
add_library(${LibLttoolbox} ${LIBLTTOOLBOX_SOURCES})
target_compile_definitions(${LibLttoolbox} PRIVATE LTTOOLBOX_EXPORTS)
set_target_properties(${LibLttoolbox} PROPERTIES SOVERSION ${SOVERSION})
set_target_properties(${LibLttoolbox} PROPERTIES SOVERSION ${SOVERSION} VERSION ${VERSION})
target_link_libraries(${LibLttoolbox} ${LIBXML2_LIBRARIES})

add_executable(lt-print lt_print.cc)
Expand Down
32 changes: 16 additions & 16 deletions lttoolbox/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ cc_sources = alphabet.cc att_compiler.cc compiler.cc compression.cc entry_token.
regexp_compiler.cc sorted_vector.cc state.cc transducer.cc \
trans_exe.cc xml_parse_util.cc tmx_compiler.cc

library_includedir = $(includedir)/$(GENERIC_LIBRARY_NAME)-$(GENERIC_API_VERSION)/$(GENERIC_LIBRARY_NAME)
library_includedir = $(includedir)/$(PACKAGE_NAME)-$(API_VERSION)/$(PACKAGE_NAME)
library_include_HEADERS = $(h_sources)

bin_PROGRAMS = lt-comp lt-proc lt-expand lt-tmxcomp lt-tmxproc lt-print lt-trim
instdir = lttoolbox

lib_LTLIBRARIES= liblttoolbox3.la
liblttoolbox3_la_SOURCES= $(h_sources) $(cc_sources)
liblttoolbox3_la_LDFLAGS= -version-info $(GENERIC_LIBRARY_VERSION) -release $(GENERIC_RELEASE)
liblttoolbox3_la_LDFLAGS= -version-info $(SOVERSION) -release $(API_VERSION)

lttoolboxdir = $(prefix)/share/lttoolbox
lttoolboxinclude = $(prefix)/include
Expand All @@ -28,32 +28,32 @@ lttoolboxlib = $(prefix)/lib
lttoolbox_DATA = dix.dtd dix.rng dix.rnc acx.rng xsd/dix.xsd xsd/acx.xsd

lt_print_SOURCES = lt_print.cc
lt_print_LDADD = liblttoolbox$(GENERIC_MAJOR_VERSION).la
lt_print_LDFLAGS = -llttoolbox$(GENERIC_MAJOR_VERSION) $(LTTOOLBOX_LIBS)
lt_print_LDADD = liblttoolbox$(MAJOR_VERSION).la
lt_print_LDFLAGS = -llttoolbox$(MAJOR_VERSION) $(LTTOOLBOX_LIBS)

lt_trim_SOURCES = lt_trim.cc
lt_trim_LDADD = liblttoolbox$(GENERIC_MAJOR_VERSION).la
lt_trim_LDFLAGS = -llttoolbox$(GENERIC_MAJOR_VERSION) $(LTTOOLBOX_LIBS)
lt_trim_LDADD = liblttoolbox$(MAJOR_VERSION).la
lt_trim_LDFLAGS = -llttoolbox$(MAJOR_VERSION) $(LTTOOLBOX_LIBS)

lt_comp_SOURCES = lt_comp.cc
lt_comp_LDADD = liblttoolbox$(GENERIC_MAJOR_VERSION).la
lt_comp_LDFLAGS = -llttoolbox$(GENERIC_MAJOR_VERSION) $(LTTOOLBOX_LIBS)
lt_comp_LDADD = liblttoolbox$(MAJOR_VERSION).la
lt_comp_LDFLAGS = -llttoolbox$(MAJOR_VERSION) $(LTTOOLBOX_LIBS)

lt_proc_SOURCES = lt_proc.cc
lt_proc_LDADD = liblttoolbox$(GENERIC_MAJOR_VERSION).la
lt_proc_LDFLAGS = -llttoolbox$(GENERIC_MAJOR_VERSION) $(LTTOOLBOX_LIBS)
lt_proc_LDADD = liblttoolbox$(MAJOR_VERSION).la
lt_proc_LDFLAGS = -llttoolbox$(MAJOR_VERSION) $(LTTOOLBOX_LIBS)

lt_expand_SOURCES = lt_expand.cc
lt_expand_LDADD = liblttoolbox$(GENERIC_MAJOR_VERSION).la
lt_expand_LDFLAGS = -llttoolbox$(GENERIC_MAJOR_VERSION) $(LTTOOLBOX_LIBS)
lt_expand_LDADD = liblttoolbox$(MAJOR_VERSION).la
lt_expand_LDFLAGS = -llttoolbox$(MAJOR_VERSION) $(LTTOOLBOX_LIBS)

lt_tmxcomp_SOURCES = lt_tmxcomp.cc
lt_tmxcomp_LDADD = liblttoolbox$(GENERIC_MAJOR_VERSION).la
lt_tmxcomp_LDFLAGS = -llttoolbox$(GENERIC_MAJOR_VERSION) $(LTTOOLBOX_LIBS)
lt_tmxcomp_LDADD = liblttoolbox$(MAJOR_VERSION).la
lt_tmxcomp_LDFLAGS = -llttoolbox$(MAJOR_VERSION) $(LTTOOLBOX_LIBS)

lt_tmxproc_SOURCES = lt_tmxproc.cc
lt_tmxproc_LDADD = liblttoolbox$(GENERIC_MAJOR_VERSION).la
lt_tmxproc_LDFLAGS = -llttoolbox$(GENERIC_MAJOR_VERSION) $(LTTOOLBOX_LIBS)
lt_tmxproc_LDADD = liblttoolbox$(MAJOR_VERSION).la
lt_tmxproc_LDFLAGS = -llttoolbox$(MAJOR_VERSION) $(LTTOOLBOX_LIBS)

#lt-validate-dictionary: Makefile.am validate-header.sh
# @echo "Creating lt-validate-dictionary script"
Expand Down
1 change: 0 additions & 1 deletion python/lttoolbox.i.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
%inline%{
#define SWIG_FILE_WITH_INIT
#include <lttoolbox/fst_processor.h>
#include <lttoolbox/lttoolbox_config.h>
#include <lttoolbox/my_stdio.h>
#include <lttoolbox/lt_locale.h>

Expand Down

0 comments on commit f3062b8

Please sign in to comment.