redoconf: assorted minor fixes.
- libqt4.rc: add detection of the 'moc' command in $MOC. - libssl.rc: add detection script for openssl. - default.do.sh: provide a die() function to all .od files. It's just too useful to not have it (I haven't converted everything to it yet). - When building out/x/y.z, match against $S/default.z.od and $S/default.od if they exist. - *.list files (lists of source/object files to include in a binary) can now contain *.o files in addition to *.c, *.cc, etc. - rename compile() to _compile() to avoid polluting the namespace for scripts called from default.do.sh. - When building a .so file in the top level directory, no need to make a symlink of it into the top level directory. - link.od and link-shlib.od forgot to make use of the $xLIBS variable.
This commit is contained in:
parent
1e2fc9be8a
commit
49f85f2156
6 changed files with 62 additions and 23 deletions
|
|
@ -10,7 +10,7 @@ LIBS Extra libraries to always link against (eg. -lsocket)
|
||||||
STATIC Link libraries and binaries statically
|
STATIC Link libraries and binaries statically
|
||||||
CXX C++ compiler name (c++)
|
CXX C++ compiler name (c++)
|
||||||
CXXFLAGS Extra C++ compiler flags (eg. -O2 -g)
|
CXXFLAGS Extra C++ compiler flags (eg. -O2 -g)
|
||||||
LIBQT4 Extra linker options for 'QtCore'
|
LIBQT4 Extra linker options for 'QtGui'
|
||||||
LIBGTK2 Extra linker options for 'gtk+-2.0 gio-2.0 gdk-2.0 gdk-pixbuf-2.0'
|
LIBGTK2 Extra linker options for 'gtk+-2.0 gio-2.0 gdk-2.0 gdk-pixbuf-2.0'
|
||||||
LIBM Extra linker options for 'libm'
|
LIBM Extra linker options for 'libm'
|
||||||
LIBPNG Extra linker options for 'libpng'
|
LIBPNG Extra linker options for 'libpng'
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,11 @@ fi
|
||||||
NL="
|
NL="
|
||||||
"
|
"
|
||||||
|
|
||||||
|
die() {
|
||||||
|
echo Error: "$@" >&2
|
||||||
|
exit 99
|
||||||
|
}
|
||||||
|
|
||||||
_mkdir_of() {
|
_mkdir_of() {
|
||||||
local dir="${1%/*}"
|
local dir="${1%/*}"
|
||||||
[ "$dir" = "$1" ] ||
|
[ "$dir" = "$1" ] ||
|
||||||
|
|
@ -23,8 +28,10 @@ _dir1=${1%"$_base1"}
|
||||||
_missing=""
|
_missing=""
|
||||||
for d in "$S/$1.od" \
|
for d in "$S/$1.od" \
|
||||||
"$S/${_dir1}default.${_base1#*.}.od" \
|
"$S/${_dir1}default.${_base1#*.}.od" \
|
||||||
|
"$S/default.${_base1#*.}.od" \
|
||||||
"$REDOCONF/$1.od" \
|
"$REDOCONF/$1.od" \
|
||||||
"$REDOCONF/${_dir1}default.${_base1#*.}.od"; do
|
"$REDOCONF/${_dir1}default.${_base1#*.}.od" \
|
||||||
|
"$REDOCONF/default.${_base1#*.}.od"; do
|
||||||
if [ -e "$d" ]; then
|
if [ -e "$d" ]; then
|
||||||
redo-ifchange "$d"
|
redo-ifchange "$d"
|
||||||
_mkdir_of "$3"
|
_mkdir_of "$3"
|
||||||
|
|
@ -60,7 +67,7 @@ _pick_src() {
|
||||||
[ -e "$src.do" ] && return
|
[ -e "$src.do" ] && return
|
||||||
missing="$missing$NL$src"
|
missing="$missing$NL$src"
|
||||||
done
|
done
|
||||||
echo "default.do.sh: _pick_src: no source file found for '$1.*'" >&2
|
die "default.do.sh: _pick_src: no source file found for '$1.*'"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,7 +78,7 @@ _objlist() {
|
||||||
while read -r d; do
|
while read -r d; do
|
||||||
case $d in
|
case $d in
|
||||||
-*) ;;
|
-*) ;;
|
||||||
*.c|*.cc|*.cpp|*.cxx|*.C|*.c++)
|
*.c|*.cc|*.cpp|*.cxx|*.C|*.c++|*.o)
|
||||||
echo "$dir${d%.*}$suffix"
|
echo "$dir${d%.*}$suffix"
|
||||||
;;
|
;;
|
||||||
*) echo "$dir$d" ;;
|
*) echo "$dir$d" ;;
|
||||||
|
|
@ -86,7 +93,7 @@ _flaglist() {
|
||||||
done <"$1"
|
done <"$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
compile() {
|
_compile() {
|
||||||
redo-ifchange compile "$src" $dep
|
redo-ifchange compile "$src" $dep
|
||||||
rm -f "$1.deps"
|
rm -f "$1.deps"
|
||||||
_mkdir_of "$3"
|
_mkdir_of "$3"
|
||||||
|
|
@ -101,29 +108,41 @@ compile() {
|
||||||
redo-ifchange ${deps#*:}
|
redo-ifchange ${deps#*:}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_link() {
|
||||||
|
(
|
||||||
|
local o="$1" listf="$2"
|
||||||
|
redo-ifchange link "$listf"
|
||||||
|
files=$(_objlist .o "$listf")
|
||||||
|
xLIBS=$(_flaglist "$listf")
|
||||||
|
IFS="$NL"
|
||||||
|
redo-ifchange $files
|
||||||
|
xLIBS="$xLIBS" ./link "$o" $files
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
*.fpic.o)
|
*.fpic.o)
|
||||||
_pick_src "$S/${1%.fpic.o}"
|
_pick_src "$S/${1%.fpic.o}"
|
||||||
_add_missing
|
_add_missing
|
||||||
xCFLAGS="-fPIC" PCH="2" dep="$lang-fpic.precompile" compile "$@"
|
xCFLAGS="-fPIC" PCH="2" dep="$lang-fpic.precompile" _compile "$@"
|
||||||
exit # fast path: exit as early as possible
|
exit # fast path: exit as early as possible
|
||||||
;;
|
;;
|
||||||
*.o)
|
*.o)
|
||||||
_pick_src "$S/${1%.o}"
|
_pick_src "$S/${1%.o}"
|
||||||
_add_missing
|
_add_missing
|
||||||
xCFLAGS="" PCH="1" dep="$lang.precompile" compile "$@"
|
xCFLAGS="" PCH="1" dep="$lang.precompile" _compile "$@"
|
||||||
exit # fast path: exit as early as possible
|
exit # fast path: exit as early as possible
|
||||||
;;
|
;;
|
||||||
*.h.fpic.gch|*.hpp.fpic.gch)
|
*.h.fpic.gch|*.hpp.fpic.gch)
|
||||||
src="$S/${1%.fpic.gch}"
|
src="$S/${1%.fpic.gch}"
|
||||||
xCFLAGS="-fPIC" PCH="3" dep="" compile "$@"
|
xCFLAGS="-fPIC" PCH="3" dep="" _compile "$@"
|
||||||
# precompiled header is "unchanged" if its component
|
# precompiled header is "unchanged" if its component
|
||||||
# headers are unchanged.
|
# headers are unchanged.
|
||||||
cat ${deps#*:} | tee $1.stamp | redo-stamp
|
cat ${deps#*:} | tee $1.stamp | redo-stamp
|
||||||
;;
|
;;
|
||||||
*.h.gch|*.hpp.gch)
|
*.h.gch|*.hpp.gch)
|
||||||
src="$S/${1%.gch}"
|
src="$S/${1%.gch}"
|
||||||
xCFLAGS="" PCH="3" dep="" compile "$@"
|
xCFLAGS="" PCH="3" dep="" _compile "$@"
|
||||||
# precompiled header is "unchanged" if its component
|
# precompiled header is "unchanged" if its component
|
||||||
# headers are unchanged.
|
# headers are unchanged.
|
||||||
cat ${deps#*:} | tee $1.stamp | redo-stamp
|
cat ${deps#*:} | tee $1.stamp | redo-stamp
|
||||||
|
|
@ -146,8 +165,9 @@ case $1 in
|
||||||
IFS="$NL"
|
IFS="$NL"
|
||||||
redo-ifchange $files
|
redo-ifchange $files
|
||||||
xLIBS="$xLIBS" ./link-shlib "$1.$ver" $files
|
xLIBS="$xLIBS" ./link-shlib "$1.$ver" $files
|
||||||
ln -s "$(basename "$1.$ver")" "$3"
|
bname="$(basename "$1.$ver")"
|
||||||
ln -sf "$1.$ver" .
|
ln -s "$bname" "$3"
|
||||||
|
[ "$1.$ver" = "$bname" ] || ln -sf "$1.$ver" .
|
||||||
;;
|
;;
|
||||||
*.list|*.ver)
|
*.list|*.ver)
|
||||||
if [ -e "$S/$1" ]; then
|
if [ -e "$S/$1" ]; then
|
||||||
|
|
@ -155,7 +175,7 @@ case $1 in
|
||||||
_mkdir_of "$3"
|
_mkdir_of "$3"
|
||||||
cp "$S/$1" "$3"
|
cp "$S/$1" "$3"
|
||||||
else
|
else
|
||||||
echo "default.do.sh: no rule to build '$1'" >&2
|
die "default.do.sh: no rule to build '$1'"
|
||||||
exit 99
|
exit 99
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
@ -172,14 +192,15 @@ case $1 in
|
||||||
bin="${1%.exe}"
|
bin="${1%.exe}"
|
||||||
if [ -e "$S/$bin.list" -o -e "$S/$bin.list.od" ]; then
|
if [ -e "$S/$bin.list" -o -e "$S/$bin.list.od" ]; then
|
||||||
# a final program binary
|
# a final program binary
|
||||||
redo-ifchange link "$bin.list"
|
_link "$3" "$bin.list"
|
||||||
files=$(_objlist .o "$bin.list")
|
elif [ -e "$S/default.od" ]; then
|
||||||
xLIBS=$(_flaglist "$bin.list")
|
d="$S/default.od"
|
||||||
IFS="$NL"
|
redo-ifchange "$d"
|
||||||
redo-ifchange $files
|
_mkdir_of "$3"
|
||||||
xLIBS="$xLIBS" ./link "$3" $files
|
( PS4="$PS4[$d] "; . "$d" )
|
||||||
|
exit
|
||||||
else
|
else
|
||||||
echo "default.do.sh: no rule to build '$1' or '$1.list'" >&2
|
die "default.do.sh: no rule to build '$1' or '$1.list'"
|
||||||
exit 99
|
exit 99
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ if [ "$HAVE_SHLIB" = UNIX ]; then
|
||||||
-Wl,-soname,"\$ob" \\
|
-Wl,-soname,"\$ob" \\
|
||||||
\$LDFLAGS \$OPTFLAGS \\
|
\$LDFLAGS \$OPTFLAGS \\
|
||||||
"\$@" \\
|
"\$@" \\
|
||||||
\$LIBS
|
\$xLIBS \$LIBS
|
||||||
EOF
|
EOF
|
||||||
elif [ "$HAVE_SHLIB" = MACOS ]; then
|
elif [ "$HAVE_SHLIB" = MACOS ]; then
|
||||||
cat >$3 <<-EOF
|
cat >$3 <<-EOF
|
||||||
|
|
@ -37,7 +37,7 @@ elif [ "$HAVE_SHLIB" = MACOS ]; then
|
||||||
-install_name "\$ob" \\
|
-install_name "\$ob" \\
|
||||||
\$LDFLAGS \$OPTFLAGS \\
|
\$LDFLAGS \$OPTFLAGS \\
|
||||||
"\$@" \\
|
"\$@" \\
|
||||||
\$LIBS
|
\$xLIBS \$LIBS
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
if [ -z "$HAVE_SHLIB" ]; then
|
if [ -z "$HAVE_SHLIB" ]; then
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ cat >$3 <<-EOF
|
||||||
\$LINK -o "\$o" \\
|
\$LINK -o "\$o" \\
|
||||||
\$LDFLAGS \$OPTFLAGS \\
|
\$LDFLAGS \$OPTFLAGS \\
|
||||||
"\$@" \\
|
"\$@" \\
|
||||||
\$LIBS
|
\$xLIBS \$LIBS
|
||||||
EOF
|
EOF
|
||||||
chmod a+x "$3"
|
chmod a+x "$3"
|
||||||
redo-stamp <$3
|
redo-stamp <$3
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,14 @@ prog='
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
'
|
'
|
||||||
|
|
||||||
rc_pkg_detect LIBQT4 QtCore \
|
rc_pkg_detect LIBQT4 QtGui \
|
||||||
rc_compile cxx link "$prog"
|
rc_compile cxx link "$prog"
|
||||||
|
|
||||||
|
for d in "$MOC" moc-qt4 moc; do
|
||||||
|
if type "$d" >/dev/null 2>&1; then
|
||||||
|
rc_replaceln MOC "$d"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
rc_save
|
rc_save
|
||||||
|
|
|
||||||
10
redoconf/rc/libssl.rc.od
Normal file
10
redoconf/rc/libssl.rc.od
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
. ./redoconf.rc
|
||||||
|
rc_include rc/CC.rc rc/pkg-config.rc
|
||||||
|
|
||||||
|
prog="
|
||||||
|
#include <openssl/ssl.h>
|
||||||
|
"
|
||||||
|
|
||||||
|
rc_pkg_detect LIBSSL "libssl libcrypto" \
|
||||||
|
rc_compile cc link "$prog"
|
||||||
|
rc_save
|
||||||
Loading…
Add table
Add a link
Reference in a new issue