From f8b35b7b9a9de4df6369c248f6a5f779ba709d33 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 22 Oct 2006 20:43:01 +0000 Subject: [PATCH] added autopackage-related files git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42250 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- distrib/autopackage/Readme.txt | 13 ++ distrib/autopackage/makeautopackage | 51 ++++++ distrib/autopackage/sample/README | 29 ++++ .../autopackage/sample/autopackage/default.apspec | 99 +++++++++++ distrib/autopackage/sample/minimal.bkl | 21 +++ distrib/autopackage/sample/minimal.cpp | 182 +++++++++++++++++++++ distrib/autopackage/wxgtk.apspec.in | 93 +++++++++++ docs/changes.txt | 5 + 8 files changed, 493 insertions(+) create mode 100644 distrib/autopackage/Readme.txt create mode 100644 distrib/autopackage/makeautopackage create mode 100644 distrib/autopackage/sample/README create mode 100644 distrib/autopackage/sample/autopackage/default.apspec create mode 100644 distrib/autopackage/sample/minimal.bkl create mode 100644 distrib/autopackage/sample/minimal.cpp create mode 100644 distrib/autopackage/wxgtk.apspec.in diff --git a/distrib/autopackage/Readme.txt b/distrib/autopackage/Readme.txt new file mode 100644 index 0000000..061b5e2 --- /dev/null +++ b/distrib/autopackage/Readme.txt @@ -0,0 +1,13 @@ + wxWidgets Autopackage + ===================== + + This directory contains the wxGTK autopackage of the latest + stable release. + + An autopackage is an archive containing compiled binaries + which aims to be distribution-neutral and as much as compatible + as possible with linux systems. + + For more info see http://www.autopackage.org. + + diff --git a/distrib/autopackage/makeautopackage b/distrib/autopackage/makeautopackage new file mode 100644 index 0000000..f2cb43d --- /dev/null +++ b/distrib/autopackage/makeautopackage @@ -0,0 +1,51 @@ +#!/bin/bash +# Author: Francesco Montorsi + +rootdir=../.. +thisdir=distrib/autopackage +currloc="http://biolpc22.york.ac.uk/pub/autopackage/wxgtk/" + +function reminder +{ + echo = REMINDER =================================================== + echo Now that the autopackage has been built successfully, remember + echo to upload the .meta, .package and .xml files to the + echo " $currloc" + echo folder. + echo ============================================================== +} + +function build_package +{ + me=`basename $0` + cd $rootdir + if [[ ! -f "config.status" ]]; then + echo $me: Running a fake configure just to create a config.status + echo $me: with a valid PACKAGE_VERSION set... please wait. + ./configure >/dev/null 2>&1 + fi + + if [[ "$1" = "--help" ]]; then + makeinstaller $@ + exit 0 + fi + + # this will automatically update wxgtk.apspec from wxgtk.apspec.in + # using config.status script + makeinstaller $@ $thisdir/wxgtk.apspec + + if [[ "$?" = "0" ]]; then + mv *.package *.xml *.meta $thisdir >/dev/null 2>&1 + reminder + fi +} + +function clean_previous +{ + rm -f wxgtk.apspec # this was generated from wxgtk.apspec.in + rm -f *.xml *.package *.meta +} + + +clean_previous +build_package $@ diff --git a/distrib/autopackage/sample/README b/distrib/autopackage/sample/README new file mode 100644 index 0000000..388abf0 --- /dev/null +++ b/distrib/autopackage/sample/README @@ -0,0 +1,29 @@ + + A simple autopackaged wxWidgets application + ============================================================================== + + This directory contains the minimal wxWidgets sample program, a bakefile, + and an Autopackage spec file; this file shows you how to use them to create + the release of a wxWidgets-based application for Linux. + + For more info about Autopackage refer to: + http://autopackage.org + + A generic quick-start guide for non-wxWidgets based applications is at: + http://autopackage.org/developer-quickstart.html + + + Assuming you already have downloaded wxGTK port of wxWidgets, compiled it and + installed it, you need to install Autopackage and bakefile. + Search http://autopackage.org and http://bakefile.sourceforge.net for the download + page and grab the latest release. + + Once you've got your development environment ready, just do from your shell: + + bakefile -f gnu minimal.bkl # to create the GNUmakefile for our app + makeinstaller # to create the Autopackage for our app + + Yes: it's so easy. Now try to run "package install wxminimal-1.0-1.x86.package' and + admire your brand-new distro-neutral installer for Linux. + + diff --git a/distrib/autopackage/sample/autopackage/default.apspec b/distrib/autopackage/sample/autopackage/default.apspec new file mode 100644 index 0000000..acbb2d2 --- /dev/null +++ b/distrib/autopackage/sample/autopackage/default.apspec @@ -0,0 +1,99 @@ +# -*-shell-script-*- + +# RCS-ID: $Id$ +# Author: Francesco Montorsi +# Purpose: A minimal Autopackage SPEC file which can be used as template +# for creating autopackages of wxWidgets-based applications. +# See http://www.autopackage.org for more information about Autopackage. +# +# IMPORTANT: this spec file requires Autopackage 1.2 or later. + + +# Notes about [Meta] section: +# - if your project uses configure, you can use the @PACKAGE_VERSION@ string instead +# of a fixed value for the "SoftwareVersion:" key: + +[Meta] +RootName: @site.org/appname:$SOFTWAREVERSION +DisplayName: wxWidgets-based minimal program +ShortName: wxminimal +Maintainer: The wxWidgets Developers +Packager: Anonymous +Summary: wxMinimal is an example minimal program based on wxGTK. +URL: http://www.site.org/ +License: wxWindows license +SoftwareVersion: 1.0 +AutopackageTarget: 1.2 +Revision: 1 +PackageVersion: 1 +PackageFileName: $SHORTNAME-$SOFTWAREVERSION-$PACKAGEVERSION.x86.package + + +[BuildPrepare] +# if you need to link your executable with some static libraries, whose +# order to the linker is important, then you should add a regexp matching +# the name of that libraries using this env var: +export APBUILD_RESOLVE_LIBPATH=".*mywxbasedlib.*" + +# libraries used by wxWidgets like tiff and expat should always be linked +# statically (as they broke ABI recently - 9/2006)... +export APBUILD_STATIC="tiff expat" + +# build in release mode against a stable release of wxGTK. +# The wxGTK builds present in linux distributions are always compiled in +# multilib, shared, unicode, release mode. +# Thus your project needs to be compiled in release, unicode mode, too. +# + +# run the commands to build your package using apbuild's tool instead of +# the standard GCC compiler: +make CXX="apg++" CPP="apgcc" +make install prefix=$build_root + +# NB: if your project uses a configure script then you probably want to use +# the prepareBuild autopackage API instead: +# +# prepareBuild --disable-debug --enable-unicode --with-wxdir=/some/path/to/wxGTK/2.6.x +# + + +[BuildUnprepare] +make clean + +# NB: if your project uses a configure script then you probably want to use +# the unprepareBuild autopackage API instead + + +[Imports] +echo '*' | import + + +[Prepare] +# Check for dependencies which are dynamically linked to your projects; you don't +# need to check for statically linked projects. + +# Now you need to check for presence of wxGTK libraries; that's done using: +# require @wxwidgets.org/wxgtk 26.0 +# +# NOTE: the interface version that you specify must be in form A.B where A is +# the major##minor version of wxGTK. This is because binary compatibility +# of wxGTK libraries are reserved only among different releases of the +# same major and minor versions. +# So that if you need at least wxGTK 2.6.3, you should e.g. use the +# "require @wxwidgets.org/wxgtk 26.3" command +# +require @wxwidgets.org/wxgtk 26.0 + +# wxGTK requires GTK+ 2.0 but you don't need to add the: +# require @gtk.org/gtk 2.0 +# check to your apspec - if wxGTK is installed, also GTK is. + + + +[Install] +# Put your installation script here +installExe bin/minimal + +[Uninstall] +# Usually just the following line is enough to uninstall everything +uninstallFromLog diff --git a/distrib/autopackage/sample/minimal.bkl b/distrib/autopackage/sample/minimal.bkl new file mode 100644 index 0000000..4750ba7 --- /dev/null +++ b/distrib/autopackage/sample/minimal.bkl @@ -0,0 +1,21 @@ + + + + + + + + + gui + on + dynamic + + minimal.cpp + + core + base + + $(BINDIR) + + + diff --git a/distrib/autopackage/sample/minimal.cpp b/distrib/autopackage/sample/minimal.cpp new file mode 100644 index 0000000..4825c00 --- /dev/null +++ b/distrib/autopackage/sample/minimal.cpp @@ -0,0 +1,182 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: minimal.cpp +// Purpose: Minimal wxWindows sample +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +// for all others, include the necessary headers (this file is usually all you +// need because it includes almost all "standard" wxWindows headers) +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +// ---------------------------------------------------------------------------- +// resources +// ---------------------------------------------------------------------------- + + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +// Define a new application type, each program should derive a class from wxApp +class MyApp : public wxApp +{ +public: + // override base class virtuals + // ---------------------------- + + // this one is called on application startup and is a good place for the app + // initialization (doing it here and not in the ctor allows to have an error + // return: if OnInit() returns false, the application terminates) + virtual bool OnInit(); +}; + +// Define a new frame type: this is going to be our main frame +class MyFrame : public wxFrame +{ +public: + // ctor(s) + MyFrame(const wxString& title); + + // event handlers (these functions should _not_ be virtual) + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + +private: + // any class wishing to process wxWindows events must use this macro + DECLARE_EVENT_TABLE() +}; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// IDs for the controls and the menu commands +enum +{ + // menu items + Minimal_Quit = wxID_EXIT, + + // it is important for the id corresponding to the "About" command to have + // this standard value as otherwise it won't be handled properly under Mac + // (where it is special and put into the "Apple" menu) + Minimal_About = wxID_ABOUT +}; + +// ---------------------------------------------------------------------------- +// event tables and other macros for wxWindows +// ---------------------------------------------------------------------------- + +// the event tables connect the wxWindows events with the functions (event +// handlers) which process them. It can be also done at run-time, but for the +// simple menu events like this the static method is much simpler. +BEGIN_EVENT_TABLE(MyFrame, wxFrame) + EVT_MENU(Minimal_Quit, MyFrame::OnQuit) + EVT_MENU(Minimal_About, MyFrame::OnAbout) +END_EVENT_TABLE() + +// Create a new application object: this macro will allow wxWindows to create +// the application object during program execution (it's better than using a +// static object for many reasons) and also implements the accessor function +// wxGetApp() which will return the reference of the right type (i.e. MyApp and +// not wxApp) +IMPLEMENT_APP(MyApp) + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// the application class +// ---------------------------------------------------------------------------- + +// 'Main program' equivalent: the program execution "starts" here +bool MyApp::OnInit() +{ + // create the main application window + MyFrame *frame = new MyFrame(_T("Minimal wxWindows App")); + + // and show it (the frames, unlike simple controls, are not shown when + // created initially) + frame->Show(true); + + // success: wxApp::OnRun() will be called which will enter the main message + // loop and the application will run. If we returned false here, the + // application would exit immediately. + return true; +} + +// ---------------------------------------------------------------------------- +// main frame +// ---------------------------------------------------------------------------- + +// frame constructor +MyFrame::MyFrame(const wxString& title) + : wxFrame(NULL, wxID_ANY, title) +{ + // set the frame icon + +#if wxUSE_MENUS + // create a menu bar + wxMenu *menuFile = new wxMenu; + + // the "About" item should be in the help menu + wxMenu *helpMenu = new wxMenu; + helpMenu->Append(Minimal_About, _T("&About...\tF1"), _T("Show about dialog")); + + menuFile->Append(Minimal_Quit, _T("E&xit\tAlt-X"), _T("Quit this program")); + + // now append the freshly created menu to the menu bar... + wxMenuBar *menuBar = new wxMenuBar(); + menuBar->Append(menuFile, _T("&File")); + menuBar->Append(helpMenu, _T("&Help")); + + // ... and attach this menu bar to the frame + SetMenuBar(menuBar); +#endif // wxUSE_MENUS + +#if wxUSE_STATUSBAR + // create a status bar just for fun (by default with 1 pane only) + CreateStatusBar(2); + SetStatusText(_T("Welcome to wxWindows!")); +#endif // wxUSE_STATUSBAR +} + + +// event handlers + +void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) +{ + // true is to force the frame to close + Close(true); +} + +void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) +{ + wxString msg; + msg.Printf( _T("This is the About dialog of the minimal sample.\n") + _T("Welcome to %s"), wxVERSION_STRING); + + wxMessageBox(msg, _T("About Minimal"), wxOK | wxICON_INFORMATION, this); +} diff --git a/distrib/autopackage/wxgtk.apspec.in b/distrib/autopackage/wxgtk.apspec.in new file mode 100644 index 0000000..c407d68 --- /dev/null +++ b/distrib/autopackage/wxgtk.apspec.in @@ -0,0 +1,93 @@ +# -*-shell-script-*- + +# +# NOTE1: +# This apspec provides wxGTK locales and compiled libraries only; +# it does not provide headers nor wx-config since this package is not +# targeted to developers but rather end-users of wx-based applications. +# Also, making a -devel autopackage wouldn't be very useful given the +# big number of possible configurations for building wxWidgets... +# +# NOTE2: +# This wxGTK autopackage contains wx libraries built in +# Unicode, shared, multilib, release mode. +# This is because: +# 1) UNICODE is better than ansi +# 2) Autopackages of a library only have sense when shipping with SHARED libraries +# 3) MULTILIB builds of wxWidgets are the default and suggested build mode +# 4) Released applications should use RELEASE builds of wxWidgets not debug ones! +# + + +[Meta] +RootName: @wxwidgets.org/wxgtk:$SOFTWAREVERSION +DisplayName: wxGTK port of wxWidgets +ShortName: wxgtk +Maintainer: Francesco Montorsi +Packager: Francesco Montorsi +Summary: Library for cross-platform GUI programming (gtk2-unicode-release port) +URL: http://www.wxwidgets.org/ +License: wxWidgets license +SoftwareVersion: @PACKAGE_VERSION@ +PackageVersion: 1 +AutopackageTarget: 1.2 +Type: Library +Revision: 1 +Compression: bzip2 +PackageFileName: $SHORTNAME-$SOFTWAREVERSION-$PACKAGEVERSION.x86.package + +# The interface of this port is majorminor.release; for more info about the interface version +# look at the wxGTK skeleton. +# NOTE: there *must* be no dot between the major and minor digits. +InterfaceVersion: `getMajor $SOFTWAREVERSION``getMinor $SOFTWAREVERSION`.`getMicro $SOFTWAREVERSION` + + +[BuildPrepare] +export APBUILD_STATIC="tiff expat" +export APBUILD_BOGUS_DEPS="Xi Xrandr Xcursor Xrender Xinerama" # not really needed + +# For info why we give --enable-unicode --enable-shared --disable-debug options see note2 at beginning +# of this file. +# The --disable-dependency-tracking --disable-precomp-headers are because these things confuse apgcc. +# The --with-libtiff=builtin --with-expat=builtin are because we want wxWidgets not to use the system's +# version of these libraries: tiff has recently broken its ABI and must be linked statically, expat is +# not always available. +prepareBuild --enable-unicode --enable-shared --disable-debug --with-gtk --disable-dependency-tracking --disable-precomp-headers --with-opengl --with-gtk --with-libtiff=builtin --with-expat=builtin + +[BuildUnprepare] +unprepareBuild + + +[Imports] + +# remove stuff useless to final binary users: headers, wxwin.m4 and bakefile presets +rm -rf include share/aclocal share/bakefile + +# this imports also some symlink which won't be used... +# anyway symlinks give no problems since they won't be installed so it's not necessary +# to complicate this section to exclude them... +bash +echo '*' | import + + +[Prepare] +# GTK+2 is the only requirement +require @gtk.org/gtk 2.0 + + +[Install] +# install wxrc-$SOFTWAREVERSION and its symbolic link +installExe bin/wxrc* + +# install shared libraries (not symlinks - they are recreated by installLib!) +installLib lib/*.so.*.*.* + +# install wx's things which goes in lib\ but are not libraries +copyFiles lib/wx/* "$PREFIX/lib/wx" + +# install locales +installLocale share/locale + + +[Uninstall] +uninstallFromLog diff --git a/docs/changes.txt b/docs/changes.txt index 724aaf6..8fe3516 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -94,6 +94,11 @@ All: "Events generated by the user vs programmatically generated events" paragraph in the "Event handling overview" topic for more info +Unix Ports: + +- Added autopackage for wxGTK and an example of using autopackage for a wx + program (Francesco Montorsi) + All (GUI): - Support for right-to-left text layout (started by Diaa Sami during Google Summer of -- 2.7.4