Child pages
  • PBA-cbs bootstrapping of portable C++ project
Skip to end of metadata
Go to start of metadata

Setting up a portable C++ project still is a pain in the ass, especially if it shall be portable.

When trying to automate it in some way, we came to the conclusion that a full example in a public subversion repository is a good solutions because it's easy to use for you and easy to maintain for us.

HowTo ...

These are the steps for an ultra fast bootstrapping of a portable project relying on pba-cbs and our incarnation of the MinGW cross compilation toolchain.

Preparations

You need deb sources for pba (any-pba-1.0) and distro-mingw-5 (i.e. squeeze-mingw-5 or wheezy-mingw-5), see https://deb.clazzes.org.

For starters, You need to install the packages pba-cbs and subversion.

Retrieve the sceleton

Decide for the main name of your app:

MYAPPNAME="myapp"

Export our example from public svn:

# for a flat application project:
svn export "https://svn.clazzes.org/svn/pba/trunk/pba-helloworld-portable" $MYAPPNAME

# for a multi-module multi-program application project:
svn export "https://svn.clazzes.org/svn/pba/trunk/pba-hellobigworld-portable" $MYAPPNAME
 
# for a library project:
svn export "https://svn.clazzes.org/svn/pba/trunk/pba-hellolib-portable" $MYAPPNAME
Rename and search'n'replace

Rename some stuff and have the inlcude files adapted:

cd $MYAPPNAME
 
scripts/rename_main_files.sh $MYAPPNAME
 
rm scripts/rename_main_files.sh
Optional: Remove windows stuff

If you do not want windows binaries, remove it:

 

# Variant 1: Remove NSIS installer only. For libraries common despite cross compilation.
rm -rf nsis src/*.nsi

# Variant 2: Remove NSIS installer and mingw-5
rm -rf nsis src/*.nsi debian-mingw-5
# Variant 3: Remove all windows crossbuilding stuff
rm -rf nsis src/*.nsi src/include-mingw.mk src/*.rc debian-mingw* build/win*
$EDITOR build/Makefile
Adapt debian package meta infos

Change my name and e-mail to yours and adapt the description:

$EDITOR debian*/control debian*/changelog $(ls -1 src/*.pc.tmpl src/*.rc src/*.nsi src/*.h 2>/dev/null)

Do not forget to change the icon, too!

Update or remove the ReadMe

At least remove the link to this page ...

# edit ...
$EDITOR doc/ReadMe.txt
 
# ... or remove the file and the reference in debian*/rules
rm doc/ReadMe.txt
$EDITOR debian*/rules
Optional: Activate svn or another revision control system

Now (and before any build activity) is a very good time to put your project under subversion control:

svn add `pwd`

You might also want to fill svn:ignore properties of some directories:

scripts/set_svn_ignore.sh
Optional: Install required libs and build the package

To produce the debian packages, just:

# this needs sudo privileges
pba-builddeps -i
 
pba-build -u

# or dpkg-build*

To only build the linux packages or only the windows packages, add -o unix resp. -o mingw to the pba-commands.

Optional: Create Windows Installers

(Re)edit the .nsi script template and replace all instances of "Clazzes.org" with something of your choice:

$EDITOR src/*.nsi

Then "make" the nsis directory:

make -C nsis && ls -ltr nsis/*.exe
Optional multi-module/multi-program variant: Create Modules, Programs
# create module common
scripts/create_module.sh common
 
# create program foobar-daemon
scripts/create_program.sh foobar-daemon

Eclipse Hints

To create the Ecplise project, select File, New, Project..., C/C++, Makefile Project with existing code.

The recommended Build Configurations and their Build directories are:

# Debug
${ProjDirPath}/build/unix/debug
 
# Release
${ProjDirPath}/build/unix/release
 
# Win32
${ProjDirPath}/build/win32/release
 
# Win64
${ProjDirPath}/build/win64/release
  • No labels