mail-notification

Fork of Jean-Yves Lefort's mail-notification, a tray icon to notify of new mail
git clone https://code.djc.id.au/git/mail-notification/

jb (3593B) - raw

      1 #!/bin/sh
      2 #
      3 # JB, the Jean-Yves Lefort's Build System
      4 # Copyright (C) 2008 Jean-Yves Lefort <jylefort@brutele.be>
      5 #
      6 # This program is free software; you can redistribute it and/or modify
      7 # it under the terms of the GNU General Public License as published by
      8 # the Free Software Foundation; either version 3 of the License, or
      9 # (at your option) any later version.
     10 #
     11 # This program is distributed in the hope that it will be useful,
     12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 # GNU General Public License for more details.
     15 #
     16 # You should have received a copy of the GNU General Public License along
     17 # with this program; if not, write to the Free Software Foundation, Inc.,
     18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
     19 
     20 maintainer_cflags="-g -fstrict-aliasing -Wall -Werror \
     21 -Wformat-y2k \
     22 -Wformat-security \
     23 -Wno-format-zero-length \
     24 -Wno-unused-parameter \
     25 -Wfloat-equal \
     26 -Wdeclaration-after-statement \
     27 -Wendif-labels \
     28 -Wpointer-arith \
     29 -Wcast-align \
     30 -Waggregate-return \
     31 -Wmissing-noreturn \
     32 -Wmissing-format-attribute \
     33 -Wpacked \
     34 -Wredundant-decls \
     35 -Wnested-externs \
     36 -Winline \
     37 -Wno-pointer-sign \
     38 -Wshadow"
     39 
     40 if test -z $jb_cc; then
     41 	jb_cc=cc
     42 fi
     43 
     44 if test -n $enable_maintainer_mode; then
     45 	jb_cflags="$jb_cflags $maintainer_cflags"
     46 fi
     47 
     48 if test -f jbsrc/jb.c; then
     49 	build=false
     50 
     51 	jb_c_sources=
     52 	for f in jb-action.c jb-compile-options.c jb-config.c jb-feature.c jb-group.c jb-install-options.c jb-main.c jb-resource.c jb-tests.c jb-util.c jb-variable.c; do
     53 		jb_c_sources="$jb_c_sources jbsrc/lib/src/core/$f"
     54 	done
     55 
     56 	jb_h_sources=
     57 	for f in jb-action.h jb-compile-options.h jb-config.h jb-decls.h jb-feature.h jb-group.h jb-install-options.h jb-main.h jb-resource.h jb-tests.h jb.h jb-util.h jb-variable.h; do
     58 		jb_h_sources="$jb_h_sources jbsrc/lib/src/core/$f"
     59 	done
     60 
     61 	jb_c_package_sources=
     62 	jb_h_package_sources=
     63 
     64 	# core includes
     65 	for f in `grep "^#jb_include <.*>" jbsrc/jb.c | sed -e 's|^#jb_include <\(.*\)>|\1|'`; do
     66 		jb_c_package_sources="$jb_c_package_sources jbsrc/lib/src/extras/$f.c"
     67 		jb_h_package_sources="$jb_h_package_sources jbsrc/lib/src/extras/$f.h"
     68 	done
     69 
     70 	# package includes
     71 	for f in `grep "^#jb_include \".*\"" jbsrc/jb.c | sed -e 's|^#jb_include "\(.*\)"|\1|'`; do
     72 		jb_c_package_sources="$jb_c_package_sources jbsrc/$f.c"
     73 		jb_h_package_sources="$jb_h_package_sources jbsrc/$f.h"
     74 	done
     75 
     76 	if test -f build/jbsrc/jb; then
     77 		for f in jbsrc/jb.c $jb_c_sources $jb_h_sources $jb_c_package_sources $jb_h_package_sources; do
     78 			if test $f -nt build/jbsrc/jb; then
     79 				build=true
     80 				break
     81 			fi
     82 		done
     83 	else
     84 		build=true
     85 	fi
     86 
     87 	if test $build = true; then
     88 		echo "building jb..."
     89 
     90 		mkdir -p build/jbsrc || exit 1
     91 
     92 		if ! gobject_cflags_libs=`pkg-config --cflags --libs 'gobject-2.0 >= 2.8.0' 2>/dev/null`; then
     93 			echo "ERROR: the GLib library was not found" >&2
     94 			exit 1
     95 		fi
     96 
     97 		sed -e 's|^#jb_include ["<]\(.*\)[">]|#include "\1.h"|' \
     98 			jbsrc/jb.c > build/jbsrc/jb.c || exit 1
     99 
    100 		if ! $jb_cc \
    101 			-o build/jbsrc/jb \
    102 			-Ijbsrc/lib/src/core -Ijbsrc/lib/src/extras -Ijbsrc \
    103 			-DG_LOG_DOMAIN="\"jb\"" \
    104 			-DJB_SOURCES="\"$jb_c_sources $jb_h_sources\"" \
    105 			-DJB_PACKAGE_SOURCES="\"$jb_c_package_sources $jb_h_package_sources\"" \
    106 			$gobject_cflags_libs \
    107 			$jb_cflags \
    108 			$jb_cppflags \
    109 			$jb_ldflags \
    110 			build/jbsrc/jb.c \
    111 			$jb_c_sources \
    112 			$jb_c_package_sources \
    113 			$jb_libs; then
    114 			echo "ERROR: cannot build jb" >&2
    115 			exit 1
    116 		fi
    117 	fi
    118 
    119 	exec build/jbsrc/jb "$@"
    120 else
    121 	echo "ERROR: jb must be run from the toplevel directory" >&2
    122 	exit 1
    123 fi