From 675c4caa09ef9f85bf0300500b0e9b12b59ab886 Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Tue, 6 Jan 2009 10:44:49 +0000 Subject: [PATCH] Add multiple version support, everything is now suffixed with MAJOR.MINOR, this will allow users on unix to install and operate different versions of aegisub a$ the same time. Note: auto3 linking is broken it will be fixed in the next commit as it's unrelated to these changes. Originally committed to SVN as r2659. --- aegisub/Makefile.am | 2 +- aegisub/aegisublocale.cpp | 6 ++++- aegisub/standard_paths.cpp | 5 +++++ auto3/Makefile.am | 4 ++-- automation/Makefile.am | 2 +- configure.in | 46 +++++++++++++++++++++++++++++++++----- 6 files changed, 54 insertions(+), 11 deletions(-) diff --git a/aegisub/Makefile.am b/aegisub/Makefile.am index cfdf7c250..48bc151b5 100644 --- a/aegisub/Makefile.am +++ b/aegisub/Makefile.am @@ -115,7 +115,7 @@ endif if HAVE_AUTO3_LUA AUTO3_LUA = auto4_auto3.cpp -aegisub_LDADD += -L$(srcdir)/../auto3 -laegisub-auto3 +aegisub_LDADD += -L$(srcdir)/../auto3 -laegisub-auto3-2.1 endif if HAVE_HUNSPELL diff --git a/aegisub/aegisublocale.cpp b/aegisub/aegisublocale.cpp index d1134aa7a..d76230b2d 100644 --- a/aegisub/aegisublocale.cpp +++ b/aegisub/aegisublocale.cpp @@ -66,10 +66,14 @@ void AegisubLocale::Init(int language) { if (locale) delete locale; curCode = language; locale = new wxLocale(language); + #ifdef __WINDOWS__ locale->AddCatalogLookupPathPrefix(StandardPaths::DecodePath(_T("?data/locale/"))); -#endif locale->AddCatalog(_T("aegisub")); +#else + locale->AddCatalog(_T(GETTEXT_PACKAGE)); +#endif + locale->AddCatalog(_T("wxstd")); setlocale(LC_NUMERIC, "C"); setlocale(LC_CTYPE, "C"); diff --git a/aegisub/standard_paths.cpp b/aegisub/standard_paths.cpp index b749ab533..648e71ce1 100644 --- a/aegisub/standard_paths.cpp +++ b/aegisub/standard_paths.cpp @@ -64,7 +64,12 @@ StandardPaths::StandardPaths() { // Get paths wxString dataDir = paths.GetDataDir(); +#ifdef __WINDOWS__ wxString userDir = paths.GetUserDataDir(); +#else + wxString userDir = paths.GetUserDataDir() + _T("-") + _T(AEGISUB_VERSION_DATA); +// wxString userDir = wxString::Format(_T("%s-%s"), paths.GetUserDataDir(), AEGISUB_VERSION_DATA); +#endif wxString tempDir = paths.GetTempDir(); // Set paths diff --git a/auto3/Makefile.am b/auto3/Makefile.am index 43c1d7680..8c4b2cee0 100644 --- a/auto3/Makefile.am +++ b/auto3/Makefile.am @@ -3,8 +3,8 @@ if HAVE_AUTO3_LUA AM_CFLAGS = -DAUTO3LIB @LUA50_CFLAGS@ AM_LDFLAGS = @LUA50_LDFLAGS@ -lib_LTLIBRARIES = libaegisub-auto3.la -libaegisub_auto3_la_SOURCES = auto3.c +lib_LTLIBRARIES = libaegisub-auto3-2.1.la +libaegisub_auto3_2_1_la_SOURCES = auto3.c noinst_HEADERS = auto3.h endif diff --git a/automation/Makefile.am b/automation/Makefile.am index b71cd2f2f..23cc64a30 100644 --- a/automation/Makefile.am +++ b/automation/Makefile.am @@ -1,5 +1,5 @@ automationdir = $(aegisubdatadir)/automation -share_docdir = $(docdir) +share_docdir = $(aegisubdocdir) # share/ data_general= \ diff --git a/configure.in b/configure.in index 4e2cb026b..906ac24fe 100644 --- a/configure.in +++ b/configure.in @@ -7,7 +7,7 @@ m4_define([aegisub_version_major], [2]) m4_define([aegisub_version_minor], [1]) m4_define([aegisub_version_revision], [6]) m4_define([aegisub_version], [aegisub_version_major.aegisub_version_minor.aegisub_version_revision-dev]) - +m4_define([aegisub_version_data], [aegisub_version_major.aegisub_version_minor]) ################### # Required packages @@ -83,18 +83,51 @@ AC_C_BIGENDIAN( ######################## # Configurable variables ######################## -aegisubdatadir="$datadir/aegisub" -AC_SUBST(aegisubdatadir) +m4_define([aegisub_version_major], [2]) +m4_define([aegisub_version_minor], [1]) +m4_define([aegisub_version_revision], [6]) +m4_define([aegisub_version], [aegisub_version_major.aegisub_version_minor.aegisub_version_revision-dev]) +m4_define([aegisub_version_data], [aegisub_version_major.aegisub_version_minor]) +AEGISUB_VERSION_MAJOR=aegisub_version_major +AEGISUB_VERSION_MINOR=aegisub_version_minor +AEGISUB_VERSION=aegisub_version +AEGISUB_VERSION_DATA=aegisub_version_data + +AC_DEFINE_UNQUOTED(AEGISUB_VERSION_DATA, ["$AEGISUB_VERSION_DATA"], [Data path suffix.]) + + +aegisubdatadir="$datadir/$PACKAGE/aegisub_version_data" +aegisubdocdir="$datadir/doc/$PACKAGE/aegisub_version_data" +AEGISUB_COMMAND="aegisub-aegisub_version_data" + +AC_SUBST(aegisubdatadir) +AC_SUBST(aegisubdocdir) +AC_SUBST(AEGISUB_COMMAND) + + +AC_ARG_WITH(desktop-dir, [ --with-desktop-dir=PATH desktop file locations (default: PREFIX/share)]) + if test -z "$with_desktop_dir" ; then + DESKTOP_DATADIR=$with_desktop_dir +else + DESKTOP_DATADIR="$datadir" +fi + +AM_CONDITIONAL(DESKTOP_DATADIR, test "$with_desktop_dir" != "no") +AC_SUBST(DESKTOP_DATADIR) + + +# If a user doesn't supply --prefix then it is set to NONE so we +# set it to $ac_default_prefix if it hasn't been supplied. if test "$prefix" = "NONE"; then prefix="$ac_default_prefix" fi + # Install prefix used by wxStandardPaths::SetInstallPrefix. AC_DEFINE_UNQUOTED([INSTALL_PREFIX], ["$prefix"], [Default install prefix, or --prefix.]) AC_ARG_WITH(build-credit, [ --with-build-credit=NAME Build credit shown in the program title.], [use_build_credit="yes"]) - AC_MSG_CHECKING([whether BUILD_CREDIT has been set]) if test "$use_build_credit" = "yes"; then if test "$with_build_credit" = "yes" || test -z "$with_build_credit"; then @@ -949,10 +982,11 @@ fi AC_PROG_INTLTOOL AM_GLIB_GNU_GETTEXT -GETTEXT_PACKAGE=aegisub +GETTEXT_PACKAGE="aegisub${AEGISUB_VERSION_MAJOR}${AEGISUB_VERSION_MINOR}" + AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", - [The prefix for our gettext translation domains.]) + [The basename for our gettext translation domains.]) ####################################################################