[AD] 4.3.10plus build system

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hello!

I've been working on merging AGL's and Allegro's build system last night so here are the results. This is only for unix but, from what I've seen, it will be even easier on Windows because there is no autotools. I don't think I can do much for other systems.

What the user needs to do in order to build and install Allegro + AGL:
./configure
make
make install

To build an program using Allegro and AGL the user would need to do the same as before merging the build system. i.e. They act like separate libs after installed.


How it is done:

- fix.sh
It just calls addons/allegrogl/finx.sh at the end.

- The configure script
There is a new option called --with-allegrogl. If not given it defaults to "auto". If "auto" then AGL is enabled if GL/gl.h, GL/glx.h and GL/glu.h header files are present on the system. Values "yes" and "no" do not perform any test. [review: should we perform more advanced test, like try to compile and link a little OpenGL program to test or OpenGL presence?] [review: should probably make it foolproof if --with-x=no was given or similar] When AGL is detected, current directory is changed to addons/allegrogl/ and configure script is run, intercepting allegro's configure script. Looks fine to me.


- makefiles
There is a new makefile in addons/allegrogl/make/ called makefile.add which defines all targets to be run from allegro's makefile. Added just some new targets to allegro's makefile.in. AGL's makefile.unx tweaked to link with not-yet-installed allegro.


All in all, small modifications have been done to the build system and it should be easy to add new addons following these patterns.


--
Milan Mimica
http://sparklet.sf.net
Index: addons/allegrogl/configure.in
===================================================================
--- addons/allegrogl/configure.in	(revision 9569)
+++ addons/allegrogl/configure.in	(working copy)
@@ -137,10 +137,6 @@
 fi
 
 
-dnl Check Allegro is installed
-AM_PATH_ALLEGRO([4.2.0], ,AC_MSG_ERROR([AllegroGL requires Allegro >= 4.2.0 to be installed!]))
-
-
 CPPFLAGS="$allegro_CFLAGS $CPPFLAGS"
 
 
@@ -154,7 +150,6 @@
 AC_SUBST(LIB_PATH_U)
 AC_SUBST(LIB_LINKS_U)
 AC_SUBST(SHARED)
-AC_SUBST(ALLEGRO_CONFIG)
 
 dnl Additional substitutions for the generic driver
 
Index: addons/allegrogl/fix.sh
===================================================================
--- addons/allegrogl/fix.sh	(revision 9569)
+++ addons/allegrogl/fix.sh	(working copy)
@@ -15,14 +15,6 @@
 
 mkdir -p obj/unix/debug obj/unix/release lib/unix
 
-echo Done.
-echo
-echo "Run './configure' to configure ('./configure --help' for help)."
-echo "Then run 'make' to build, and 'make install' to install."
-echo
-echo "(If this is a CVS version, you must run 'autoconf' to generate the"
-echo "configure script.)"
-echo
 }
 
 proc_fix()
Index: addons/allegrogl/make/makefile.add
===================================================================
--- addons/allegrogl/make/makefile.add	(revision 0)
+++ addons/allegrogl/make/makefile.add	(revision 0)
@@ -0,0 +1,18 @@
+# makefile that is included into allegro's main makefile
+allegrogl_lib:
+	$(MAKE) -C addons/allegrogl/ lib
+
+allegrogl_install:
+	$(MAKE) -C addons/allegrogl/ install
+
+allegrogl_clean:
+	$(MAKE) -C addons/allegrogl/ clean
+
+allegrogl_distclean:
+	$(MAKE) -C addons/allegrogl/ distclean
+
+allegrogl_uninstall:
+	$(MAKE) -C addons/allegrogl/ uninstall
+
+allegrogl_programs:
+	 $(MAKE) -C addons/allegrogl/ examples
Index: addons/allegrogl/make/makefile.unx
===================================================================
--- addons/allegrogl/make/makefile.unx	(revision 9569)
+++ addons/allegrogl/make/makefile.unx	(working copy)
@@ -23,7 +23,7 @@
 LDFLAGS = @LDFLAGS@ -L$(LIB_DIR)
 DEFS = @DEFS@
 LIB_BUILDER = @LIB_BUILDER@
-ALLEGRO_CONFIG = @ALLEGRO_CONFIG@
+ALLEGRO_CONFIG = ../../allegro-config
 
 # Programs
 CC = @CC@
@@ -52,6 +52,9 @@
 GENERAL_LIB_OBJS = $(addprefix $(OBJ_DIR)/, $(notdir $(C_SOURCE:.c=.o)))
 EXAMPLES = $(addprefix $(EXAMPLE_DIR)/, $(EXAMP_SOURCE:.c= ))
 
+ALLEGRO_INCLUDE = -I../../include
+
+
 #-----------------------------------#
 # --- Objects for common targets ---#
 
@@ -83,9 +86,9 @@
 endif
 
 ifdef DEBUGALLEG
-	LDLIBS += `$(ALLEGRO_CONFIG) --libs debug` $(LIBS)
+	LDLIBS +=  -L../../lib/unix `$(ALLEGRO_CONFIG) --libs debug` $(LIBS)
 else
-	LDLIBS += `$(ALLEGRO_CONFIG) --libs` $(LIBS)
+	LDLIBS +=  -L../../lib/unix `$(ALLEGRO_CONFIG) --libs` $(LIBS)
 endif
 
 ifdef MESABUILD
@@ -106,6 +109,8 @@
 	endif
 endif
 
+CPPFLAGS += $(ALLEGRO_INCLUDE)
+
 .PHONY: all
 .PRECIOUS: %.o
 
Index: addons/allegrogl/make/makefile.lst
===================================================================
--- addons/allegrogl/make/makefile.lst	(revision 9569)
+++ addons/allegrogl/make/makefile.lst	(working copy)
@@ -19,7 +19,6 @@
 all: examples lib
 	@echo -
 	@echo Success!
-	@echo Now run 'make install' to install AllegroGL.
 
 
 #----------------------------------#
Index: makefile.in
===================================================================
--- makefile.in	(revision 9564)
+++ makefile.in	(working copy)
@@ -93,6 +93,18 @@
 ALLEGRO_LIB_TARGETS = @ALLEGRO_LIB_TARGETS@
 ALLEGRO_MODULE_TARGETS = @ALLEGRO_MODULE_TARGETS@
 
+WITH_ALLEGROGL = @WITH_ALLEGROGL@
+
+ifdef WITH_ALLEGROGL
+	ADDON_INSTALL_TARGETS += allegrogl_install
+	ADDON_UNINSTALL_TARGETS += allegrogl_uninstall
+	ADDON_CLEAN_TARGETS += allegrogl_clean
+	ADDON_VERYCLEAN_TARGETS += allegrogl_veryclean
+	ADDON_LIB_TARGETS += allegrogl_lib
+	ADDON_EXE_TARGETS += allegrogl_programs
+endif
+
+
 PLUGIN_LIB = @PLUGIN_LIB@
 obj_unix_plugins_h = $(OBJDIR)/plugins.h
 
@@ -119,7 +131,10 @@
 @SET_MAKE@
 
 
+# -------- include addons' targets -------
+include addons/allegrogl/make/makefile.add
 
+
 # -------- list of sources for libraries and programs --------
 
 include $(srcdir)/makefile.lst
@@ -350,19 +365,21 @@
 
 ifdef CROSSCOMPILE
 
-full-build: lib modules programs
+full-build: lib modules addons programs
 
 else
 
-full-build: lib modules programs docs
+full-build: lib modules addons programs docs
 
 endif
 
 lib: $(ALLEGRO_LIB_TARGETS)
 
+addons: $(ADDON_LIB_TARGETS)
+
 modules: $(ALLEGRO_MODULE_TARGETS)
 
-programs: $(ALLEGRO_EXE_TARGETS)
+programs: $(ALLEGRO_EXE_TARGETS) $(ADDON_EXE_TARGETS)
 
 suid: $(ALLEGRO_EXE_TARGETS)
 	chown root.allegro $?
@@ -404,7 +421,7 @@
 
 # -------- rules for deleting the generated files --------
 
-clean:
+clean: $(ADDON_CLEAN_TARGETS)
 
    define RM_OBJ_CLEAN_FILES
       $(foreach file, $(OBJ_CLEAN_FILES), rm -f $(file)
@@ -419,7 +436,7 @@
 	$(RM_OBJ_CLEAN_FILES)
 	$(RM_OTHER_CLEAN_FILES)
 
-distclean: clean
+distclean: clean $(ADDON_DISTCLEAN_TARGETS)
 
    define RM_DISTCLEAN_FILES
       $(foreach file, $(DISTCLEAN_FILES) $(ALLEGRO_LIB_X_EXES), rm -f $(file)
@@ -428,7 +445,7 @@
 
 	$(RM_DISTCLEAN_FILES)
 
-veryclean: distclean
+veryclean: distclean 
 
    define RM_VERYCLEAN_FILES
       $(foreach file, $(VERYCLEAN_FILES), rm -f $(file)
@@ -442,11 +459,9 @@
 	rm -f configure include/allegro/platform/alunixac.hin
 	rm -rf autom4te*
 
-
-
 # -------- rules for installing the files --------
 
-install: $(INSTALL_TARGETS)
+install: $(INSTALL_TARGETS) $(ADDON_INSTALL_TARGETS)
 
 mini-install: install-headers install-lib
 	@echo "Your end-user version of Allegro is now installed"
@@ -590,7 +605,7 @@
 
 # -------- rules for uninstalling the files --------
 
-uninstall: uninstall-lib uninstall-modules uninstall-headers uninstall-programs uninstall-info uninstall-man uninstall-misc
+uninstall: uninstall-lib uninstall-modules uninstall-headers uninstall-programs uninstall-info uninstall-man uninstall-misc $(ADDON_UNINSTALL_TARGETS)
 	@echo
 	@echo "All gone. Don't you feel sad now?"
 	@echo
@@ -706,7 +721,7 @@
 install-gzipped-info install-bzipped-info install-man install-gzipped-man \
 install-bzipped-man depend \
 uninstall uninstall-lib uninstall-modules uninstall-headers \
-uninstall-programs uninstall-info uninstall-man
+uninstall-programs uninstall-info uninstall-man addons
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
Index: configure.in
===================================================================
--- configure.in	(revision 9564)
+++ configure.in	(working copy)
@@ -160,6 +160,44 @@
 
 #-----------------------------------------------------------------------------#
 
+#-----------------------------------------------------------------------------#
+#
+# Addons
+#
+
+dnl With AllegroGL addon
+AC_ARG_ENABLE(allegrogl,
+[  --with-allegrogl[=x]      build AllegroGL addon library [default=auto]],
+test "X$enableval" != "Xno" && allegro_with_allegrogl=yes,
+allegro_with_allegrogl=auto)
+
+if test "X$allegro_with_allegrogl" = "Xauto"; then
+  AC_CHECK_HEADERS([GL/gl.h GL/glx.h GL/glu.h],
+                   [allegro_with_allegrogl=yes],
+                   [allegro_with_allegrogl=no],,)
+fi
+
+if test "X$allegro_with_allegrogl" = "Xyes"; then
+  _addons="AllegroGL $_addons"
+  echo ""
+  echo "Running AllegroGL configure script..."
+  echo ""
+  cd addons/allegrogl/
+  ./configure
+  cd ../../
+  echo ""
+  echo "... Continuing with Allegro configure script..."
+  echo ""
+  WITH_ALLEGROGL=yes
+fi
+
+if test -z "$_addons"; then
+  _addons="none"
+fi
+
+
+#-----------------------------------------------------------------------------#
+
 dnl Test for processor type.
 ALLEGRO_ACTEST_PROCESSOR_TYPE
 
@@ -325,6 +363,7 @@
 AC_SUBST(PROG_LDFLAGS)
 AC_SUBST(LIB_TO_LINK)
 AC_SUBST(LINK_WITH_STATIC_LIBS)
+AC_SUBST(WITH_ALLEGROGL)
 
 dnl Which libraries to build (static, shared, normal, debugging, profiling)?
 ALLEGRO_LIB_TARGETS=
@@ -886,6 +925,7 @@
  Generated code: $_code_features
  Generated libraries:$_libraries
  Compiled programs: $_programs
+ With addons: $_addons
  $_warnmode
  $_x11
  $_linux_console
@@ -978,6 +1018,8 @@
 AC_OUTPUT(makefile:makefile.in allegro-config:misc/allegro-config.in,
   [test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h])
 
+chmod a+x allegro-config
+
 dnl The makefile doesn't work with non-GNU make so test for its presence.
 if ${MAKE-make} -v -f /dev/null 2>/dev/null | grep -i "gnu" >/dev/null; then
   gnu_make="yes"
Index: fix.sh
===================================================================
--- fix.sh	(revision 9564)
+++ fix.sh	(working copy)
@@ -167,4 +167,9 @@
    esac
 fi
 
+# run fix.sh for addons
+cd addons/allegrogl/
+./fix.sh $1
+cd ../../
+
 echo "Done!"


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/