Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -1,8 +1,8 @@ include extra.mk -SUBDIRS = src ${TESTS} +SUBDIRS = src utils ${TESTS} DISTCLEAN = aclocal.m4 \ autom4te.cache \ buildsys.mk \ config.h \ config.log \ @@ -10,31 +10,10 @@ extra.mk \ objfw-config include buildsys.mk -install-extra: - for i in objfw-config objfw-compile; do \ - ${INSTALL_STATUS}; \ - if ${MKDIR_P} ${DESTDIR}${bindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${bindir}/$$i; then \ - ${INSTALL_OK}; \ - else \ - ${INSTALL_FAILED}; \ - fi \ - done - -uninstall-extra: - for i in objfw-config objfw-compile; do \ - if test -f ${DESTDIR}${bindir}/$$i; then \ - if rm -f ${DESTDIR}${bindir}/$$i; then \ - ${DELETE_OK}; \ - else \ - ${DELETE_FAILED}; \ - fi \ - fi \ - done - tarball: V=$$(fgrep VERSION= objfw-config.in | sed 's/VERSION="\(.*\)"/\1/'); \ V2=$$(fgrep AC_INIT configure.ac | \ sed 's/AC_INIT([^,]*,\([^,]*\),.*/\1/' | sed 's/ //'); \ V3=$$(fgrep -A1 CFBundleVersion Info.plist | tail -1 | \ Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -403,15 +403,15 @@ dnl and add OBJCPPFLAGS to CPPFLAGS, thus we need to AC_SUBST these ourself AC_SUBST(CPP) AC_SUBST(CPPFLAGS) AC_SUBST(PACKAGE, ObjFW) -AC_CONFIG_FILES([buildsys.mk extra.mk objfw-config]) +AC_CONFIG_FILES([buildsys.mk extra.mk utils/objfw-config]) AC_CONFIG_HEADERS([config.h src/objfw-defs.h]) AC_OUTPUT if test x"$objc_runtime" = x"GNU"; then echo echo "Warning: You are using GNU libobjc! Support for GNU libobjc will " echo "be dropped in the next version! You should upgrade to ObjFW-RT" echo "(the ObjFW runtime) instead!" fi DELETED objfw-compile Index: objfw-compile ================================================================== --- objfw-compile +++ objfw-compile @@ -1,94 +0,0 @@ -#!/bin/sh -if ! which objfw-config 2>&1 >/dev/null; then - echo "You need to have ObjFW and objfw-config installed!" - exit 1 -fi - -CPPFLAGS="$CPPFLAGS $(objfw-config --cppflags)" -OBJC="$(objfw-config --objc)" -OBJCFLAGS="$OBJCFLAGS $(objfw-config --objcflags)" -LIBS="$LIBS $(objfw-config --libs)" -LDFLAGS="$LDFLAGS $(objfw-config --ldflags)" - -if test x"$1" = "x" -o x"$2" = "x"; then - echo "Syntax: objfw-compile outname source1.m source2.m ..." - exit 1 -fi - -status_compiling() { - printf "\033[K\033[0;33mCompiling \033[1;33m$1\033[0;33m...\033[0m\r" -} -status_compiled() { - printf "\033[K\033[0;32mSuccessfully compiled \033[1;32m$1\033[0;32m." - printf "\033[0m\n" -} -status_compile_failed() { - printf "\033[K\033[0;31mFailed to compile \033[1;31m$1\033[0;31m!" - printf "\033[0m\n" - exit $2 -} -status_linking() { - printf "\033[K\033[0;33mLinking \033[1;33m$1\033[0;33m...\033[0m\r" -} -status_linked() { - printf "\033[K\033[0;32mSuccessfully linked \033[1;32m$1\033[0;32m." - printf "\033[0m\n" -} -status_link_failed() { - printf "\033[K\033[0;31mFailed to link \033[1;31m$1\033[0;31m!" - printf "\033[0m\n" - exit $2 -} - -out="$1" -objs="" -link="no" -shift - -case "$out" in - *.c | *.C | *.cpp | *.cxx | *.C | *.h | *.m | *.mm | *.M) - echo "The first paramter must be the output name!" 1>&2 - exit 1 - ;; -esac - -while test x"$1" != "x"; do - case "$1" in - *.m) - obj="${1%.m}.o" - objs="$objs $obj" - build="no" - deps=$($OBJC -E -M $CPPFLAGS $ENV_CPPFLAGS $1 | \ - sed 's/.*: //' | sed 's/\\//g') - - if test -f "$obj"; then - for dep in $deps; do - test "$dep" -nt $obj && build="yes" - done - else - build="yes" - fi - - if test x"$build" = x"yes"; then - link="yes" - status_compiling $1 - $OBJC $CPPFLAGS $OBJCFLAGS -c -o $obj $1 || \ - status_compile_failed $1 $? - status_compiled $1 - fi - ;; - *) - echo "Only .m files can be compiled!" 1>&2 - exit 1 - ;; - esac - - shift -done - -if test ! -f "$out" -o x"$link" = x"yes"; then - status_linking $out - $OBJC -o $out $objs $LIBS $ENV_LIBS $LDFLAGS $ENV_LDFLAGS || \ - status_link_failed $out $? - status_linked $out -fi DELETED objfw-config.in Index: objfw-config.in ================================================================== --- objfw-config.in +++ objfw-config.in @@ -1,82 +0,0 @@ -#!/bin/sh -prefix="@prefix@" -exec_prefix="@exec_prefix@" -libdir="@libdir@" -CFLAGS="" -CPPFLAGS="-I@includedir@" -CXXFLAGS="" -OBJC="@OBJC@" -OBJCFLAGS="@GNU_RUNTIME@ -fexceptions -fobjc-exceptions" -OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstString" -OBJCFLAGS="$OBJCFLAGS @NO_CONST_CFSTRINGS@ @NO_WARN_UNUSED@ @ATOMIC_OBJCFLAGS@" -LDFLAGS="" -LDFLAGS_RPATH="@LDFLAGS_RPATH@" -LIBS="-L${libdir} -lobjfw @LIBS@" -VERSION="0.3-dev" - -show_help() { - cat <<__EOF__ -objfw-config: Available arguments are: - - --all Outputs all flags + libs - --cflags Outputs the required CFLAGS - --cppflags Outputs the required CPPFLAGS - --cxxflags Outputs the required CXXFLAGS - --objc Outputs the OBJC used to compile ObjFW - --objcflags Outputs the required OBJCFLAGS - --ldflags Outputs the required LDFLAGS - --rpath Outputs LDFLAGS for using rpath - --libs Outputs the required LIBS - --version Outputs the installed version -__EOF__ - exit 0 -} - -test -z "$1" && show_help - -while test ! -z "$1"; do - case "$1" in - --all) - echo "$CFLAGS" - echo "$CPPFLAGS" - echo "$CXXFLAGS" - echo "$OBJCFLAGS" - echo "$LDFLAGS" - echo "$RPATH_LDFLAGS" - echo "$LIBS" - ;; - --cflags) - echo "$CFLAGS" - ;; - --cppflags) - echo "$CPPFLAGS" - ;; - --cxxflags) - echo "$CXXFLAGS" - ;; - --objc) - echo "$OBJC" - ;; - --objcflags) - echo "$OBJCFLAGS" - ;; - --libs) - echo "$LIBS" - ;; - --ldflags) - echo "$LDFLAGS" - ;; - --rpath) - echo "$LDFLAGS_RPATH" - ;; - --version) - echo "$VERSION" - ;; - *) - echo "Invalid option: $1" 1>&2 - exit 1 - ;; - esac - - shift -done ADDED utils/Makefile Index: utils/Makefile ================================================================== --- utils/Makefile +++ utils/Makefile @@ -0,0 +1,22 @@ +include ../buildsys.mk + +install-extra: + for i in objfw-config objfw-compile; do \ + ${INSTALL_STATUS}; \ + if ${MKDIR_P} ${DESTDIR}${bindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${bindir}/$$i; then \ + ${INSTALL_OK}; \ + else \ + ${INSTALL_FAILED}; \ + fi \ + done + +uninstall-extra: + for i in objfw-config objfw-compile; do \ + if test -f ${DESTDIR}${bindir}/$$i; then \ + if rm -f ${DESTDIR}${bindir}/$$i; then \ + ${DELETE_OK}; \ + else \ + ${DELETE_FAILED}; \ + fi \ + fi \ + done ADDED utils/objfw-compile Index: utils/objfw-compile ================================================================== --- utils/objfw-compile +++ utils/objfw-compile @@ -0,0 +1,94 @@ +#!/bin/sh +if ! which objfw-config 2>&1 >/dev/null; then + echo "You need to have ObjFW and objfw-config installed!" + exit 1 +fi + +CPPFLAGS="$CPPFLAGS $(objfw-config --cppflags)" +OBJC="$(objfw-config --objc)" +OBJCFLAGS="$OBJCFLAGS $(objfw-config --objcflags)" +LIBS="$LIBS $(objfw-config --libs)" +LDFLAGS="$LDFLAGS $(objfw-config --ldflags)" + +if test x"$1" = "x" -o x"$2" = "x"; then + echo "Syntax: objfw-compile outname source1.m source2.m ..." + exit 1 +fi + +status_compiling() { + printf "\033[K\033[0;33mCompiling \033[1;33m$1\033[0;33m...\033[0m\r" +} +status_compiled() { + printf "\033[K\033[0;32mSuccessfully compiled \033[1;32m$1\033[0;32m." + printf "\033[0m\n" +} +status_compile_failed() { + printf "\033[K\033[0;31mFailed to compile \033[1;31m$1\033[0;31m!" + printf "\033[0m\n" + exit $2 +} +status_linking() { + printf "\033[K\033[0;33mLinking \033[1;33m$1\033[0;33m...\033[0m\r" +} +status_linked() { + printf "\033[K\033[0;32mSuccessfully linked \033[1;32m$1\033[0;32m." + printf "\033[0m\n" +} +status_link_failed() { + printf "\033[K\033[0;31mFailed to link \033[1;31m$1\033[0;31m!" + printf "\033[0m\n" + exit $2 +} + +out="$1" +objs="" +link="no" +shift + +case "$out" in + *.c | *.C | *.cpp | *.cxx | *.C | *.h | *.m | *.mm | *.M) + echo "The first paramter must be the output name!" 1>&2 + exit 1 + ;; +esac + +while test x"$1" != "x"; do + case "$1" in + *.m) + obj="${1%.m}.o" + objs="$objs $obj" + build="no" + deps=$($OBJC -E -M $CPPFLAGS $ENV_CPPFLAGS $1 | \ + sed 's/.*: //' | sed 's/\\//g') + + if test -f "$obj"; then + for dep in $deps; do + test "$dep" -nt $obj && build="yes" + done + else + build="yes" + fi + + if test x"$build" = x"yes"; then + link="yes" + status_compiling $1 + $OBJC $CPPFLAGS $OBJCFLAGS -c -o $obj $1 || \ + status_compile_failed $1 $? + status_compiled $1 + fi + ;; + *) + echo "Only .m files can be compiled!" 1>&2 + exit 1 + ;; + esac + + shift +done + +if test ! -f "$out" -o x"$link" = x"yes"; then + status_linking $out + $OBJC -o $out $objs $LIBS $ENV_LIBS $LDFLAGS $ENV_LDFLAGS || \ + status_link_failed $out $? + status_linked $out +fi ADDED utils/objfw-config.in Index: utils/objfw-config.in ================================================================== --- utils/objfw-config.in +++ utils/objfw-config.in @@ -0,0 +1,82 @@ +#!/bin/sh +prefix="@prefix@" +exec_prefix="@exec_prefix@" +libdir="@libdir@" +CFLAGS="" +CPPFLAGS="-I@includedir@" +CXXFLAGS="" +OBJC="@OBJC@" +OBJCFLAGS="@GNU_RUNTIME@ -fexceptions -fobjc-exceptions" +OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstString" +OBJCFLAGS="$OBJCFLAGS @NO_CONST_CFSTRINGS@ @NO_WARN_UNUSED@ @ATOMIC_OBJCFLAGS@" +LDFLAGS="" +LDFLAGS_RPATH="@LDFLAGS_RPATH@" +LIBS="-L${libdir} -lobjfw @LIBS@" +VERSION="0.3-dev" + +show_help() { + cat <<__EOF__ +objfw-config: Available arguments are: + + --all Outputs all flags + libs + --cflags Outputs the required CFLAGS + --cppflags Outputs the required CPPFLAGS + --cxxflags Outputs the required CXXFLAGS + --objc Outputs the OBJC used to compile ObjFW + --objcflags Outputs the required OBJCFLAGS + --ldflags Outputs the required LDFLAGS + --rpath Outputs LDFLAGS for using rpath + --libs Outputs the required LIBS + --version Outputs the installed version +__EOF__ + exit 0 +} + +test -z "$1" && show_help + +while test ! -z "$1"; do + case "$1" in + --all) + echo "$CFLAGS" + echo "$CPPFLAGS" + echo "$CXXFLAGS" + echo "$OBJCFLAGS" + echo "$LDFLAGS" + echo "$RPATH_LDFLAGS" + echo "$LIBS" + ;; + --cflags) + echo "$CFLAGS" + ;; + --cppflags) + echo "$CPPFLAGS" + ;; + --cxxflags) + echo "$CXXFLAGS" + ;; + --objc) + echo "$OBJC" + ;; + --objcflags) + echo "$OBJCFLAGS" + ;; + --libs) + echo "$LIBS" + ;; + --ldflags) + echo "$LDFLAGS" + ;; + --rpath) + echo "$LDFLAGS_RPATH" + ;; + --version) + echo "$VERSION" + ;; + *) + echo "Invalid option: $1" 1>&2 + exit 1 + ;; + esac + + shift +done