Skip to content

Commit

Permalink
Skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
spl237 committed Feb 13, 2020
0 parents commit 6b2a8bc
Show file tree
Hide file tree
Showing 13 changed files with 780 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
*.o
*.so
*.la
*.a
*.gmo
*.lo
*.desktop
*.log
*.pot
.dirstamp
configure
config.guess
config.h
config.h.in
config.h.in~
config.log
config.status
config.sub
Makefile
Makefile.in
POTFILES
LINGUAS
po/.intltool-merge-cache
po/stamp-it
aclocal.m4
ar-lib
compile
depcomp
install-sh
libtool
ltmain.sh
missing
stamp-h1
.deps/
.libs/
autom4te.cache/
m4/
autoreconf.*
*.substvars
debian/files
debian/debhelper-build-stamp
debian/.debhelper/
debian/piagnostics/
piagnostics
12 changes: 12 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Process this file with automake to produce Makefile.in

ACLOCAL_AMFLAGS= -I m4

SUBDIRS = src data po

EXTRA_DIST = \
autogen.sh \
piagnostics.pc.in

install-data-local:
@$(NORMAL_INSTALL)
3 changes: 3 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This is an application to run tests on Raspberry Pi hardware.

To build, run ./autogen.sh, then ./configure and make.
6 changes: 6 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /bin/sh
set -ex
test -d m4 || mkdir m4
autoreconf -i -f
intltoolize -c --automake --force
rm -rf autom4te.cache
192 changes: 192 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
AC_PREREQ(2.53)
AC_CONFIG_MACRO_DIR([m4])
AC_INIT(piagnostics,1.0,http://raspberrypi.org/)
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects no-dist-gzip dist-xz])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])

# Support silent build rules. Disable by either passing --disable-silent-rules
# to configure or passing V=1 to make
AM_SILENT_RULES([yes])

# Force to dynamic
AC_DISABLE_STATIC

# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
IT_PROG_INTLTOOL([0.40.0], [no-xml])
AM_PROG_CC_C_O
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])

#Initialize libtool
LT_PREREQ([2.2])
LT_INIT

# Checks for libraries.
pkg_modules="$pkg_modules gtk+-3.0 >= 3.24.0"

PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
AC_SUBST(PACKAGE_CFLAGS)
AC_SUBST(PACKAGE_LIBS)

pkg_modules="x11"
PKG_CHECK_MODULES(X11, [$pkg_modules])
AC_SUBST(X11_LIBS)

AC_ARG_ENABLE(more_warnings,
[AC_HELP_STRING([--enable-more-warnings],
[Add more warnings @<:@default=no@:>@])],
[enable_more_warnings="${enableval}"],
[enable_more_warnings=no]
)

if test x"$enable_more_warnings" = x"yes"; then
ADDITIONAL_FLAGS="-Wall -Werror=all -Werror=format -Werror=implicit-function-declaration -Werror=implicit-int -Werror=missing-braces -Werror=parentheses -Werror=return-type -Werror=strict-aliasing -Werror=switch -Wuninitialized -Werror=unused-label -Werror=unused-value -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Werror=missing-declarations -Wredundant-decls -Wmissing-noreturn -Wpointer-arith -Wcast-align -Wwrite-strings -Werror=inline -Werror=format-nonliteral -Wformat-nonliteral -Werror=format-security -Wformat-security -Winit-self -Werror=missing-include-dirs -Werror=undef -Werror=aggregate-return -Wmissing-format-attribute -Werror=nested-externs -fno-strict-aliasing -fmessage-length=0 -Wp,-D_FORTIFY_SOURCE=2 -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES"
fi
AC_SUBST(ADDITIONAL_FLAGS)

PACKAGE_CFLAGS="$PACKAGE_CFLAGS $ADDITIONAL_FLAGS"
PACKAGE_LIBS="$PACKAGE_LIBS"

dnl linker tweaking
# The function of the link flag --as-needed is to prevent unnecesary linking.
# Example: A -> B -> C
# Normally, A would link to B and also depend on C, this is of cource
# unnecesary. In this situation, however we do need to link to C, so this
# must be done explicitly. This flag comes in handy when a library ABI
# is changed, minimizing the amount of recompilations needed.
AC_MSG_CHECKING([whether $LD accepts --as-needed])
case `$LD --as-needed -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
LDFLAGS="$LDFLAGS -Wl,--as-needed"
AC_MSG_RESULT([yes])
;;
*)
AC_MSG_RESULT([no])
;;
esac

dnl linker optimizations
AC_MSG_CHECKING([whether $LD accepts -O1])
case `$LD -O1 -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
LDFLAGS="$LDFLAGS -Wl,-O1"
AC_MSG_RESULT([yes])
;;
*)
AC_MSG_RESULT([no])
;;
esac
AC_MSG_CHECKING([whether $LD accepts -Bsymbolic-functions])
case `$LD -Bsymbolic-functions -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
AC_MSG_RESULT([yes])
;;
*)
AC_MSG_RESULT([no])
;;
esac
AC_MSG_CHECKING([whether $LD accepts --sort-common])
case `$LD --sort-common -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
LDFLAGS="$LDFLAGS -Wl,--sort-common"
AC_MSG_RESULT([yes])
;;
*)
AC_MSG_RESULT([no])
;;
esac

dnl FIXME: filter for undefined symbols in plugins
# when passing "-z defs" to linker, we would better to make sure
# there are no undefined references. However, we intend not to
# fix at the moment since we don't have spin-off libraray containing
# the necessary functions.
if test ! -z "$LDFLAGS"; then
LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-Wl,-z,defs//'`
fi

# Checks for header files.
AC_PATH_X
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_STRUCT_TM

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_STRFTIME
AC_CHECK_FUNCS([bzero memset mkdir setlocale strchr])

dnl check for menu-cache versions 0.4.x since no macro MENU_CACHE_CHECK_VERSION
dnl is available in those versions
LIBS_save="${LIBS}"
LIBS="${LIBS} ${MENU_CACHE_LIBS}"
AC_CHECK_FUNCS(menu_cache_dir_list_children)
LIBS="${LIBS_save}"

# Generate po/LINGUAS on the fly rather than relying on translators
# to maintain it manually. This also overcome the problem that Transifex
# cannot add a language to po/LINGUAS if a new po file is submitted.
rm -f $srcdir/po/LINGUAS
for po_file in `ls $srcdir/po/*.po | sort`;
do
lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"`
echo $lang >> $srcdir/po/LINGUAS
done

GETTEXT_PACKAGE=piagnostics
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])

AM_GLIB_GNU_GETTEXT

AC_ARG_ENABLE(debug,
[AC_HELP_STRING([--enable-debug],
[enable debug support @<:@default=no@:>@])],
[enable_debug="${enableval}"],
[enable_debug=no]
)
if test "$enable_debug" = "yes"; then
# turn on debug and disable optimization
CPPFLAGS="$CPPFLAGS -DG_ENABLE_DEBUG -O0 -g"
case "$CC" in
gcc*)
CPPFLAGS="$CPPFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration"
;;
*)
;;
esac
dnl Be more strict on portability
#CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=700"
else
# turn off glib debug checks
CPPFLAGS="$CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
fi

dnl Fix invalid sysconfdir when --prefix=/usr
if test `eval "echo $sysconfdir"` = /usr/etc
then
sysconfdir=/etc
fi

AC_DEFINE([HAVE_STRVERSCMP], [1], [Has strverscmp function])
AC_DEFINE([strlcpy(dst, src, n)],[((size_t)snprintf(dst, n, "%s", src))],[Replacement strlcpy function])

AC_CONFIG_FILES([
Makefile
src/Makefile
data/Makefile
po/Makefile.in
])
AC_OUTPUT
18 changes: 18 additions & 0 deletions data/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
uidir = $(datadir)/piagnostics

ui_in_files = piagnostics.ui

ui_DATA = $(ui_in_files)

desktopdir=/usr/share/applications

desktop_in_files= \
piagnostics.desktop.in \
$(NULL)
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@

EXTRA_DIST = $(ui_in_files) \
$(desktop_in_files) \
$(desktop_DATA) \
$(NULL)
10 changes: 10 additions & 0 deletions data/piagnostics.desktop.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Desktop Entry]
Type=Application
_Name=Raspberry Pi Diagnostics
_GenericName=Raspberry Pi Diagnostics
_Comment=Test the Raspberry Pi hardware
Icon=rpi
Exec=piagnostics
NotShowIn=GNOME;XFCE;
StartupNotify=true
Categories=Utility;
Loading

0 comments on commit 6b2a8bc

Please sign in to comment.