Most of the way to having a desirable ./configure && make setup

Tries to simplify a lot of the configure code.  This is mostly because I
found what I expected the previous configure setup to do wasn't quite
what it was doing.

Also supports a --with-python3 option.
This commit is contained in:
Christopher Allan Webber 2014-10-08 12:55:44 -05:00
parent 9421705a70
commit 96f9c530ea
4 changed files with 147 additions and 33 deletions

View File

@ -24,8 +24,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_SEPARATOR = @PATH_SEPARATOR@
PYTHON = @PYTHON@ PYTHON = @PYTHON@
VIRTUALENV = @VIRTUALENV@ VIRTUALENV = @VIRTUALENV@
SPHINXBUILD = @SPHINXBUILD@
POSTGRES = @POSTGRES@
SHELL = @SHELL@ SHELL = @SHELL@
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
@ -43,14 +41,18 @@ srcdir = @srcdir@
abs_srcdir = @abs_srcdir@ abs_srcdir = @abs_srcdir@
datadir = @datadir@ datadir = @datadir@
datarootdir = @datarootdir@ datarootdir = @datarootdir@
pythondir = @pythondir@
pyexecdir = @pyexecdir@
pkgdatadir = $(datadir)/@PACKAGE_NAME@ pkgdatadir = $(datadir)/@PACKAGE_NAME@
pkgincludedir = $(includedir)/@PACKAGE_NAME@ pkgincludedir = $(includedir)/@PACKAGE_NAME@
pkgpythondir = @pkgpythondir@
pkgpyexecdir = @pkgpyexecdir@
PYTHONPATH = $(pythondir)$(PATH_SEPARATOR)$(DESTDIR)$(pythondir) PYTHONPATH = $(pythondir)$(PATH_SEPARATOR)$(DESTDIR)$(pythondir)
# pkgpythondir = @pkgpythondir@
# pkgpyexecdir = @pkgpyexecdir@
# pythondir = @pythondir@
# pyexecdir = @pyexecdir@
# SPHINXBUILD = @SPHINXBUILD@
# POSTGRES = @POSTGRES@
# Maybe add a virtualenv prefix to a command # Maybe add a virtualenv prefix to a command
ifneq ($(VIRTUALENV),no) ifneq ($(VIRTUALENV),no)
# virtualenv specified to be included by config (default) # virtualenv specified to be included by config (default)
@ -80,9 +82,11 @@ installdirs i18n virtualenv
all: develop all: develop
develop: develop: $(maybe_venv_dep) i18n
echo "nothin yet" echo "nothin yet"
# base-configs: paste.ini mediagoblin.example.ini
install: installdirs install: installdirs
$(maybe_venved_python) $(srcdir)/setup.py install --prefix=$(DESTDIR)$(prefix) $(maybe_venved_python) $(srcdir)/setup.py install --prefix=$(DESTDIR)$(prefix)
@ -98,6 +102,10 @@ ifneq ($(VIRTUALENV),no)
./bin/python setup.py develop --upgrade ./bin/python setup.py develop --upgrade
virtualenv: bin/python virtualenv: bin/python
clean-virtualenv:
rm -rf ./bin/
rm -rf ./lib/
endif endif
# setup.py doesn't (yet) support an uninstall command, so until it does, you # setup.py doesn't (yet) support an uninstall command, so until it does, you
@ -123,6 +131,8 @@ distclean:
rm -rvf $(srcdir)/autom4te.cache rm -rvf $(srcdir)/autom4te.cache
rm -v $(srcdir)/aclocal.m4 rm -v $(srcdir)/aclocal.m4
rm -v $(srcdir)/Makefile rm -v $(srcdir)/Makefile
rm -v $(srcdir)/env
# You can either use the setup.py sdist command or you can roll your own here # You can either use the setup.py sdist command or you can roll your own here
dist: dist:

View File

@ -46,7 +46,7 @@ dnl 2) package version (i.e. 1.2)
dnl 3) bug/info/project email address (i.e. bug-foo@gnu.org) dnl 3) bug/info/project email address (i.e. bug-foo@gnu.org)
dnl---- dnl----
dnl dnl
AC_INIT([mediagoblin], [0.4.0.dev], [cwebber@gnu.org]) AC_INIT([mediagoblin], [0.7.1.dev], [cwebber@gnu.org])
dnl---- dnl----
@ -69,6 +69,27 @@ dnl
dnl In this section, we check for the presence of important commands dnl In this section, we check for the presence of important commands
dnl and programs. dnl and programs.
AC_ARG_WITH([python3],
[AS_HELP_STRING([--with-python3], [Set up to use Python 3 by default.])],
[],
[with_python3=no])
AS_IF([test "x$with_python3" != xno],
AC_CHECK_PROGS([PYTHON], [python3.3], [none])
AS_IF([test "x$PYTHON" = xnone],
[AC_MSG_FAILURE(
[--with-python3 given but no acceptable python3 (3.3) could be found])]),
AC_CHECK_PROGS([PYTHON], [python2.7 python2.6], [none])
AS_IF([test "x$PYTHON" = xnone],
[AC_MSG_FAILURE(
[No acceptable pythons (2.7, 2.6) could be found])]))
dnl--A bit simpler python init----------------------------------------
dnl Expect python2.7 or python2.6 unless --with-python3 is given.
dnl----
dnl--PC_INIT---------------------------------------------------------- dnl--PC_INIT----------------------------------------------------------
dnl This is the only required macro. Its primary function is to find dnl This is the only required macro. Its primary function is to find
dnl a Python interpreter that is compatible with the package and set dnl a Python interpreter that is compatible with the package and set
@ -85,8 +106,7 @@ dnl series and the max is in the 3.0 series, non-existent
dnl releases (2.8 & 2.9) will be correctly skipped. dnl releases (2.8 & 2.9) will be correctly skipped.
dnl---- dnl----
dnl dnl
dnl PC_INIT([2.7], [3.3.1]) dnl PC_INIT([3.3], [3.4])
dnl--PC_PROG_PYTHON--------------------------------------------------- dnl--PC_PROG_PYTHON---------------------------------------------------
dnl This macro provides a means of finding a Python interpreter. dnl This macro provides a means of finding a Python interpreter.
@ -113,10 +133,10 @@ dnl you require a specific version, you can do something like the
dnl following example. dnl following example.
dnl---- dnl----
dnl dnl
PC_PYTHON_PROG_PYTHON_CONFIG([python2-config]) dnl PC_PYTHON_PROG_PYTHON_CONFIG([python2-config])
if [[ "x$PYTHON_CONFIG" == "x" ]]; then dnl if [[ "x$PYTHON_CONFIG" == "x" ]]; then
PC_PYTHON_PROG_PYTHON_CONFIG([$PYTHON-config]) dnl PC_PYTHON_PROG_PYTHON_CONFIG([$PYTHON-config])
fi dnl fi
dnl---- dnl----
dnl With the following set of macros, we implement an option dnl With the following set of macros, we implement an option
@ -151,10 +171,10 @@ dnl print a warning. If the program uses some other documentation
dnl system, you can do something similar with it. dnl system, you can do something similar with it.
dnl---- dnl----
dnl dnl
# Check for sphinx-build dnl # Check for sphinx-build
AC_CHECK_PROGS([SPHINXBUILD], [sphinx-build sphinx-build3 sphinx-build2], [no]) dnl AC_CHECK_PROGS([SPHINXBUILD], [sphinx-build sphinx-build3 sphinx-build2], [no])
AS_IF([test "x$SPHINXBUILD" = xno], dnl AS_IF([test "x$SPHINXBUILD" = xno],
AC_MSG_WARN(sphinx-build is required to build documentation)) dnl AC_MSG_WARN(sphinx-build is required to build documentation))
dnl---- dnl----
@ -165,11 +185,14 @@ dnl
AC_PROG_MKDIR_P AC_PROG_MKDIR_P
AC_PROG_INSTALL AC_PROG_INSTALL
# Check for a supported database program dnl########################################
AC_PATH_PROG([SQLITE], [sqlite3]) dnl Database stuff... maybe restore this? #
AC_PATH_PROG([POSTGRES], [psql]) dnl########################################
AS_IF([test "x$SQLITE" = x -a "x$POSTGRES" = "x"], dnl # Check for a supported database program
[AC_MSG_ERROR([SQLite or PostgreSQL is required])]) dnl AC_PATH_PROG([SQLITE], [sqlite3])
dnl AC_PATH_PROG([POSTGRES], [psql])
dnl AS_IF([test "x$SQLITE" = x -a "x$POSTGRES" = "x"],
dnl [AC_MSG_ERROR([SQLite or PostgreSQL is required])])
dnl################################# dnl#################################
@ -239,7 +262,7 @@ dnl provide compatibility with GNU Makefile specifications, allowing
dnl the user to change the prefix from the commandline. dnl the user to change the prefix from the commandline.
dnl---- dnl----
dnl dnl
PC_PYTHON_SITE_PACKAGE_DIR dnl PC_PYTHON_SITE_PACKAGE_DIR
dnl--PC_PYTHON_CHECK_EXEC_DIR------------------------------------------ dnl--PC_PYTHON_CHECK_EXEC_DIR------------------------------------------
@ -254,7 +277,7 @@ dnl Same as PC_PYTHON_SITE_PACKAGE_DIR but for $exec-prefix. Stored in
dnl pkgpyexecdir dnl pkgpyexecdir
dnl---- dnl----
dnl dnl
PC_PYTHON_EXEC_PACKAGE_DIR dnl PC_PYTHON_EXEC_PACKAGE_DIR
dnl############################### dnl###############################
@ -270,13 +293,13 @@ dnl
dnl PC_PYTHON_CHECK_MODULE([foo]) dnl PC_PYTHON_CHECK_MODULE([foo])
# Check for python-lxml module dnl # Check for python-lxml module
PC_PYTHON_CHECK_MODULE([lxml], [], dnl PC_PYTHON_CHECK_MODULE([lxml], [],
[AC_MSG_ERROR([python-lxml is required])]) dnl [AC_MSG_ERROR([python-lxml is required])])
dnl
# Check for the Python Imaging Library dnl # Check for the Python Imaging Library
PC_PYTHON_CHECK_MODULE([Image], [], dnl PC_PYTHON_CHECK_MODULE([Image], [],
[AC_MSG_ERROR([Python Imaging Library is required])]) dnl [AC_MSG_ERROR([Python Imaging Library is required])])
dnl--PC_PYTHON_CHECK_FUNC([PYTHON-MODULE], [FUNCTION], [ARGS], dnl--PC_PYTHON_CHECK_FUNC([PYTHON-MODULE], [FUNCTION], [ARGS],
@ -402,7 +425,7 @@ dnl
dnl PC_PYTHON_CHECK_ABI_FLAGS dnl PC_PYTHON_CHECK_ABI_FLAGS
dnl--MediaGoblin specific variables ---------------------------------- dnl--MediaGoblin specific commands/variables ------------------------
dnl######### dnl#########

81
paste.py2.ini Normal file
View File

@ -0,0 +1,81 @@
# If you want to make changes to this file, first copy it to
# paste_local.ini, then make the changes there.
[DEFAULT]
# Set to true to enable web-based debugging messages and etc.
debug = false
[pipeline:main]
# pipeline = errors mediagoblin
pipeline = mediagoblin
[app:mediagoblin]
use = egg:mediagoblin#app
config = %(here)s/mediagoblin_local.ini %(here)s/mediagoblin.ini
# static paths
/mgoblin_media = %(here)s/user_dev/media/public
/mgoblin_static = %(here)s/mediagoblin/static
/theme_static = %(here)s/user_dev/theme_static
/plugin_static = %(here)s/user_dev/plugin_static
[loggers]
keys = root
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = INFO
handlers = console
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-7.7s [%(name)s] %(message)s
[filter:errors]
use = egg:mediagoblin#errors
debug = false
##############################
# Server configuration options
##############################
# The server that is run by default.
# By default, should only be accessable locally
[server:main]
use = egg:Paste#http
host = 127.0.0.1
port = 6543
#######################
# Helper server configs
# ---------------------
# If you are configuring the paste config manually, you can remove
# these.
# Use this if you want to run on port 6543 and have MediaGoblin be
# viewable externally
[server:broadcast]
use = egg:Paste#http
host = 0.0.0.0
port = 6543
# Use this if you want to connect via fastcgi
[server:fcgi]
use = egg:flup#fcgi_fork
host = %(fcgi_host)s
port = %(fcgi_port)s
[server:http]
use = egg:Paste#http
host = %(http_host)s
port = %(http_port)s