forked from apenwarr/redo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs/cookbook/redoconf-simple: a simple redoconf C++ project.
This is a little simpler than the docs/cookbook/c project, which doesn't actually have a doc yet because there was too much to explain. I think I might make that a follow-on cookbook chapter, for people who have read this simple one. I think this doc is maybe a little too long; I intended it to be "here's what you do to get started" but it turned into "here's what you do to get started, and why it works, in excruciating detail." Not quite sure how to fix. (Also updated some other parts of the docs to refer to redoconf as a real thing now instead of a "maybe someone should write this" thing.)
- Loading branch information
Showing
26 changed files
with
1,025 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ have a copy of redo. | |
|
||
Nowadays, redo is good enough for real production use, and some people | ||
are using it for real work. That said, it has | ||
not reached version 1.0 and there are surely still bugs. | ||
not reached version 1.0 and there are always going to be bugs. | ||
|
||
If you run into a problem, it's really helpful if you report it to the | ||
mailing list below (with or without subscribing first). We really want to | ||
|
@@ -29,21 +29,21 @@ Small feature additions are also welcome, but you might want to ask on the | |
mailing list before you start working on it. The code is still evolving and | ||
might not be the same by the time you submit your pull request. | ||
|
||
The best things you can do for redo are: | ||
Contributions to [redoconf](/cookbook/redoconf-simple/) are very welcome. | ||
For example, you might want to contribute detectors for new libraries or | ||
compilers. | ||
|
||
Some of the best things you can do for redo are: | ||
|
||
- Convert your projects to using it. Without users, no project is | ||
successful. | ||
|
||
- Build new infrastructure around redo, especially things to make it easier | ||
for people to get started. For example, an automake-like tool that filled | ||
in default redo build rules for common program types would probably be | ||
very popular. | ||
|
||
- Convince your favourite OS distro to build and include (up to date!) redo | ||
packages. | ||
packages. We especially need someone to help with getting redo included | ||
in debian. | ||
|
||
- Help proofreading this documentation, and send patches or pull requests | ||
with improvements. | ||
with improvements and additions. | ||
|
||
- Join the mailing list (below) to discuss design changes or bugs. | ||
|
||
|
@@ -52,7 +52,7 @@ The best things you can do for redo are: | |
|
||
# Mailing list | ||
|
||
You should join the `[email protected]` mailing list. | ||
You should join the `[email protected]` mailing list! | ||
|
||
You can find the mailing list archives here: | ||
<http://groups.google.com/group/redo-list> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/out | ||
/out.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Run from the source dir. | ||
# | ||
# We'll make sure the out/ dir exists and that | ||
# a C++ compiler is available, then redo out/all, | ||
# which is implemented in the file all.od. | ||
# | ||
# Note that a "normal" project might not have an all.do | ||
# at all; the end user would be expected to make an | ||
# output dir, run ../configure, and then redo from there. | ||
# But we want this file to build as part of the redo | ||
# examples, so there needs to be a toplevel all.do in | ||
# each example. | ||
# | ||
. ./skip-if-no-cxx.sh | ||
redo-ifchange out/all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Precompiled header. | ||
// | ||
// Include your most commonly used, but least | ||
// frequently changing, header files here, to | ||
// speed up compilation. | ||
#ifndef __ALL_HPP | ||
|
||
#include <string> | ||
#include <iostream> | ||
|
||
#endif // __ALL_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# This script gets called from inside the out/ | ||
# directory when someone runs "redo" or "redo all". | ||
redo-ifchange hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Specify which redoconf modules to use when building | ||
# our program. | ||
# | ||
# The rc_include function is available in every *.od | ||
# script in a redoconf project. | ||
rc_include \ | ||
rc/CXX.required.rc \ | ||
rc/Wextra.rc \ | ||
rc/all.hpp.precompiled.rc \ | ||
rc/openssl__ssl.h.rc \ | ||
rc/openssl__opensslv.h.rc \ | ||
rc/libssl.rc \ | ||
rc/libm.rc | ||
|
||
# We'll link *all* our binaries with the detected | ||
# $LIBSSL by default. We rc_included rc/libssl.rc | ||
# instead of rc/libssl.required.rc, so if it's | ||
# not available, this line won't add any | ||
# libraries. It'll be up to the program to check | ||
# for HAVE_LIBSSL before trying to call it. | ||
# | ||
# If we wanted to only link $LIBSSL into certain | ||
# binaries, we would include $LIBSSL explicitly in | ||
# the .list.od file for those binaries. Since we're | ||
# putting it here, it doesn't have to be in the .list | ||
# file. | ||
rc_appendln LIBS "$LIBSSL" | ||
|
||
# Combine all the redoconf settings we've collected | ||
# above, and write them to $3 (all.rc). all.rc is | ||
# a special .rc file that is used when generating | ||
# the automatic ./compile and ./link scripts, among | ||
# others. | ||
rc_save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
rm -f *~ .*~ | ||
rm -rf out out.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
S="$(dirname "$0")" | ||
. "$S/redoconf/configure.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Automatically generated by redoconf/_all.rc.od - do not edit | ||
ARCH Architecture prefix for output (eg. i686-w64-mingw32-) | ||
CC C compiler name (cc) | ||
CPPFLAGS Extra C preprocessor flags (eg. -I... -D...) | ||
CFLAGS Extra C compiler flags (eg. -O2 -g) | ||
OPTFLAGS C/C++ compiler flag overrides (eg. -g0) | ||
LINK Linker name (cc) | ||
LDFLAGS Extra linker options (eg. -s -static) | ||
LIBS Extra libraries to always link against (eg. -lsocket) | ||
STATIC Link libraries and binaries statically | ||
LIBSSL Extra linker options for 'libssl libcrypto' | ||
LIBM Extra linker options for 'libm' | ||
CXX C++ compiler name (c++) | ||
CXXFLAGS Extra C++ compiler flags (eg. -O2 -g) | ||
PREFIX Change installation prefix (usually /usr/local) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Ensure that an out/ directory exists and that | ||
# it has been configured (ie. ../configure has been run). | ||
[ -d out ] || (mkdir out && cd out && ../configure) | ||
|
||
# By declaring a dependency on this file *after* running | ||
# configure, we can tell redo that reconfiguration is | ||
# needed if this file ever disappears (for example, if | ||
# the whole out/ directory disappears). | ||
redo-ifchange out/default.do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "all.hpp" | ||
#include "ssltest.h" | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
cout << "Hello, world!" | ||
<< endl | ||
<< "libssl version " | ||
<< hex << libssl_version() | ||
<< endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
rc_include all.rc | ||
|
||
# We include $LIBM here just as example of how to | ||
# specify an auto-detected library as part of the | ||
# linker settings for a binary. We don't actually | ||
# use it for anything. Note that $LIBM was detected | ||
# up above in the rc_include, because all.rc depends | ||
# on rc/libm.rc. If the library is not available, | ||
# $LIBM will be blank. | ||
cat <<-EOF | ||
hello.cc | ||
ssltest.c | ||
$LIBM | ||
EOF |
Oops, something went wrong.