From 3b7bed622a0b4c9cb6c41726d2db8aec3e770ef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20K=C3=BChling?= Date: Sun, 29 May 2011 13:55:53 +0200 Subject: [PATCH] new package: liballegro: a lightweight game and multimedia library --- liballegro/Makefile | 251 ++++++++++++++++++ liballegro/patches/010-shooter-gfx-mode.patch | 17 ++ 2 files changed, 268 insertions(+) create mode 100644 liballegro/Makefile create mode 100644 liballegro/patches/010-shooter-gfx-mode.patch diff --git a/liballegro/Makefile b/liballegro/Makefile new file mode 100644 index 0000000..4b96aa2 --- /dev/null +++ b/liballegro/Makefile @@ -0,0 +1,251 @@ +# +# Copyright (C) David Kuehling +# +# License GPLv2 or later. NO WARRANTY. +# +# OpenWRT package for the Allegro game and multimedia library + +include $(TOPDIR)/rules.mk + +PKG_NAME:=liballegro +PKG_VERSION:=4.4.2 +PKG_RELEASE:=1 +PKG_SOURCE:=allegro-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/alleg/allegro/$(PKG_VERSION) +PKG_BUILD_DIR = $(BUILD_DIR)/allegro-$(PKG_VERSION) +HOST_BUILD_DIR = $(BUILD_DIR_HOST)/allegro-$(PKG_VERSION) + +PKG_MD5SUM:=4db71b0460fc99926ae91d223199c2e6 +PKG_INSTALL:=1 + +PKG_FIXUP:=libtool +PKG_REMOVE_FILES:= + +PKG_BUILD_DEPENDS:=liballegro/host + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/liballegro/Default + SUBMENU:=Liballegro + SECTION:=libs + CATEGORY:=Libraries + TITLE:=The Allegro Game Programming Library + URL:=alleg.sf.net +# SUBMENU:=Editors +endef + +define Package/liballegro/Default/description +Allegro is a cross-platform library for computer games and multimedia +programming. +endef + +define Package/liballegro +$(call Package/liballegro/Default) + DEPENDS:= + TITLE+= (library) +endef + +define Package/liballegro/description +$(call Package/liballegro/Default/description) + This package contains the Allegro library +endef + +define Package/liballegro-data +$(call Package/liballegro/Default) + TITLE+= (data) +endef + +define Package/liballegro-data/description +$(call Package/liballegro/Default/description) + This package contains various data files that are used by the Allegro library. +endef + +define Package/liballegro-demo +$(call Package/liballegro/Default) + TITLE+= (demo) + DEPENDS:=+liballegro +endef + +define Package/liballegro-demo/description +$(call Package/liballegro/Default/description) + This package contains the Allegro demo game. +endef + +define Package/liballegro-setup +$(call Package/liballegro/Default) + TITLE+= (setup) + DEPENDS:=+liballegro +endef + +define Package/liballegro-setup/description +$(call Package/liballegro/Default/description) + This package contains the Allegro setup program +endef + +define Package/liballegro-utils +$(call Package/liballegro/Default) + TITLE+= (utils) +endef + +define Package/liballegro-utils/description +$(call Package/liballegro/Default/description) + This package contains the setup and test tool that ship with Allegro. +endef + +HOST_CONFIGURE_ARGS += +CONFIGURE_ARGS += + +TARGET_CPPFLAGS += + +define Build/Prepare + $(call Build/Prepare/Default) +endef + +HOST_CMAKE_FLAGS= \ + -DCMAKE_INSTALL_PREFIX=$(STAGING_DIR_HOST) \ + -DRT_LIBRARY= \ + -DDL_LIBRARY= \ + -DWANT_TOOLS=on \ + -DWANT_TESTS=off \ + -DWANT_MODULES=off \ + -DWANT_EXAMPLES=off \ + -DWANT_ALLEGROGL=off \ + -DWANT_LOADPNG=off \ + -DWANT_LOGG=off \ + -DWANT_JPGALLEG=off \ + -DWANT_X11=off \ + -DWANT_LINUX_CONSOLE=on \ + -DWANT_LINUX_FBCON=off \ + -DWANT_LINUX_VGA=off \ + -DWANT_LINUX_SVGALIB=off \ + -DWANT_ALSA=off \ + -DWANT_OSS=off \ + -DWANT_JACK=off \ + -DWANT_SGIAUDIO=off + +define Host/Configure + cd $(HOST_BUILD_DIR) && cmake $(HOST_CMAKE_FLAGS) . +endef + +## On the host, we only need to compile the allegro develpment tools: +## dat&friends +define Host/Compile + $(call Host/Compile/Default, VERBOSE=1 -j4) +endef + +define Host/Install + $(call Host/Install/Default) +# $(INSTALL_BIN) $(HOST_BUILD_DIR)/lib-src/make-docfile $(STAGING_DIR_HOST)/bin/liballegro-make-docfile +# $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/prefix-args $(STAGING_DIR_HOST)/bin/liballegro-prefix-args +endef + +# workaround for cmake.mk bug +ifneq ($(CONFIG_CCACHE),) + CMAKE_C_COMPILER:=ccache + CMAKE_CXX_COMPILER:=ccache +endif + +EXTRA_CFLAGS = -DSETUP_SCREEN_W=320 -DSETUP_SCREEN_H=240 +TARGET_LDFLAGS = -ldl -lrt + +CMAKE_OPTIONS = \ + -DRT_LIBRARY= \ + -DALLEGRO_USE_CONSTRUCTOR_EXITCODE=0 \ + -DRT_LIBRARY= \ + -DDL_LIBRARY= \ + -DWANT_TOOLS=on \ + -DWANT_TESTS=on \ + -DWANT_MODULES=on \ + -DWANT_EXAMPLES=on \ + -DWANT_ALLEGROGL=off \ + -DWANT_LOADPNG=on \ + -DWANT_LOGG=off \ + -DWANT_JPGALLEG=off \ + -DWANT_X11=off \ + -DWANT_LINUX_CONSOLE=on \ + -DWANT_LINUX_FBCON=on \ + -DWANT_LINUX_VGA=off \ + -DWANT_LINUX_SVGALIB=off \ + -DWANT_ALSA=on \ + -DWANT_OSS=off \ + -DWANT_JACK=off \ + -DWANT_SGIAUDIO=off + +MAKE_FLAGS += -j4 + +define Build/Configure + $(call Build/Configure/Default) +endef + +define Build/Compile + $(call Build/Compile/Default) + $(call Build/Compile/Default -C PKG_BUILD_DIR) +# ln -sf $(STAGING_DIR_HOST)/bin/liballegro-make-docfile $(PKG_BUILD_DIR)/lib-src/make-docfile +endef + +define Build/Install + $(call Build/Install/Default) + #$(INSTALL_DATA) ./files/... $(PKG_INSTALL_DIR)/usr/share/.. +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include/ + $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ + + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so* \ + $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \ + $(1)/usr/lib/pkgconfig/ +# $(SED) 's,-I$$$${includedir},,g' $(1)/usr/lib/pkgconfig/plplotd.pc +# $(SED) 's,-L$$$${libdir},,g' $(1)/usr/lib/pkgconfig/plplotd.pc +endef + +define Package/liballegro/install + $(INSTALL_DIR) $(1)/usr + $(CP) $(PKG_INSTALL_DIR)/usr/lib $(1)/usr +endef + +define Package/liballegro-data/install + $(INSTALL_DIR) $(1)/ + $(CP) $(PKG_INSTALL_DIR)/usr/share $(1)/usr +endef + +define Package/liballegro-demo/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_DIR) $(1)/usr/share/allegro/shooter + $(INSTALL_DIR) $(1)/usr/share/allegro/skater + $(CP) $(PKG_BUILD_DIR)/demos/shooter/shooter $(1)/usr/bin/ + $(CP) $(PKG_BUILD_DIR)/demos/shooter/demo.dat $(1)/usr/share/allegro/shooter/ + $(CP) $(PKG_BUILD_DIR)/demos/skater/skater $(1)/usr/bin/ + $(CP) $(PKG_BUILD_DIR)/demos/skater/demo.dat $(1)/usr/share/allegro/skater/ +endef + +define Package/liballegro-setup/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_DIR) $(1)/usr/share/allegro/ + $(CP) $(PKG_BUILD_DIR)/setup/setup $(1)/usr/bin/ + $(CP) $(PKG_BUILD_DIR)/setup/setup.dat $(1)/usr/share/allegro/ +endef + +define Package/liballegro-utils/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin $(1)/usr +endef + + +$(eval $(call HostBuild)) +$(eval $(call BuildPackage,liballegro)) +#$(eval $(call BuildPackage,liballegro-data)) +$(eval $(call BuildPackage,liballegro-demo)) +$(eval $(call BuildPackage,liballegro-setup)) +$(eval $(call BuildPackage,liballegro-utils)) + + +# The following comments configure the Emacs editor. Just ignore them. +# Local Variables: +# compile-command: "make -C ~/h/src/qi/openwrt-xburst package/liballegro/compile -j2 V=99" +# End: diff --git a/liballegro/patches/010-shooter-gfx-mode.patch b/liballegro/patches/010-shooter-gfx-mode.patch new file mode 100644 index 0000000..f300e1f --- /dev/null +++ b/liballegro/patches/010-shooter-gfx-mode.patch @@ -0,0 +1,17 @@ +Index: allegro-4.4.2/demos/shooter/demo.c +=================================================================== +--- allegro-4.4.2.orig/demos/shooter/demo.c 2011-05-29 12:56:58.000000000 +0200 ++++ allegro-4.4.2/demos/shooter/demo.c 2011-05-29 13:50:44.000000000 +0200 +@@ -90,9 +90,9 @@ + allegro_message("Error initialising joystick\n%s\n", allegro_error); + install_joystick(JOY_TYPE_NONE); + } +- +- if (set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0) != 0) { +- if (set_gfx_mode(GFX_SAFE, 320, 200, 0, 0) != 0) { ++ set_color_depth(32); ++ if (set_gfx_mode(GFX_AUTODETECT, 320, 240, 0, 0) != 0) { ++ if (set_gfx_mode(GFX_SAFE, 320, 240, 0, 0) != 0) { + set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); + allegro_message("Unable to set any graphic mode\n%s\n", + allegro_error);