Compare commits
23 Commits
khorben/gt
...
master
Author | SHA1 | Date | |
---|---|---|---|
e7f13cc3ca | |||
ba8e67add5 | |||
91503c14cd | |||
984634cf87 | |||
b76674e414 | |||
8b8769970c | |||
269cd67a57 | |||
e637b8c995 | |||
e5b205bc11 | |||
e29a6a18d9 | |||
57226cb4b2 | |||
aac2af926c | |||
63084f226c | |||
7fd37d6f92 | |||
06cc9c9ec5 | |||
7a28896e5b | |||
5701c605f5 | |||
618dab4472 | |||
0055fda87f | |||
14b8ac2fb2 | |||
592aa42055 | |||
6fee9d8017 | |||
48cd0b8aa8 |
27
.github/workflows/deforaos-c-ci_ubuntu-latest.yml
vendored
Normal file
27
.github/workflows/deforaos-c-ci_ubuntu-latest.yml
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
name: DeforaOS C CI (ubuntu-latest)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: bootstrap libSystem
|
||||||
|
run: git clone https://github.com/DeforaOS/libSystem.git libSystem && for dir in include data src; do (cd libSystem/$dir && make PREFIX="$HOME/opt/DeforaOS" CCSHARED="cc -shared" install); done
|
||||||
|
- name: bootstrap configure
|
||||||
|
run: git clone https://github.com/DeforaOS/configure.git configure && (cd configure/src && PKG_CONFIG_PATH="$HOME/opt/DeforaOS/lib/pkgconfig" make PREFIX="$HOME/opt/DeforaOS" CCSHARED="cc -shared" install)
|
||||||
|
- name: configure
|
||||||
|
run: $HOME/opt/DeforaOS/bin/configure -p "$HOME/opt/DeforaOS"
|
||||||
|
- name: make
|
||||||
|
run: PKG_CONFIG_PATH="$HOME/opt/DeforaOS/lib/pkgconfig" make CCSHARED="cc -shared"
|
||||||
|
- name: make tests
|
||||||
|
run: PKG_CONFIG_PATH="$HOME/opt/DeforaOS/lib/pkgconfig" make CCSHARED="cc -shared" tests
|
||||||
|
- name: make distcheck
|
||||||
|
run: PKG_CONFIG_PATH="$HOME/opt/DeforaOS/lib/pkgconfig" make CCSHARED="cc -shared" distcheck
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#$Id$
|
#$Id$
|
||||||
#Copyright (c) 2011-2020 Pierre Pronchery <khorben@defora.org>
|
#Copyright (c) 2011-2022 Pierre Pronchery <khorben@defora.org>
|
||||||
#
|
#
|
||||||
#Redistribution and use in source and binary forms, with or without
|
#Redistribution and use in source and binary forms, with or without
|
||||||
#modification, are permitted provided that the following conditions are met:
|
#modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -31,7 +31,7 @@ DEVNULL="/dev/null"
|
||||||
PROGNAME="pkgconfig.sh"
|
PROGNAME="pkgconfig.sh"
|
||||||
#executables
|
#executables
|
||||||
DEBUG="_debug"
|
DEBUG="_debug"
|
||||||
INSTALL="install -m 0644"
|
INSTALL="install"
|
||||||
MKDIR="mkdir -m 0755 -p"
|
MKDIR="mkdir -m 0755 -p"
|
||||||
RM="rm -f"
|
RM="rm -f"
|
||||||
SED="sed"
|
SED="sed"
|
||||||
|
@ -40,6 +40,101 @@ SED="sed"
|
||||||
|
|
||||||
|
|
||||||
#functions
|
#functions
|
||||||
|
#pkgconfig
|
||||||
|
_pkgconfig()
|
||||||
|
{
|
||||||
|
#check the variables
|
||||||
|
if [ -z "$PACKAGE" ]; then
|
||||||
|
_error "The PACKAGE variable needs to be set"
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
if [ -z "$VERSION" ]; then
|
||||||
|
_error "The VERSION variable needs to be set"
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
[ -z "$BINDIR" ] && BINDIR="$PREFIX/bin"
|
||||||
|
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
|
||||||
|
[ -z "$INCLUDEDIR" ] && INCLUDEDIR="$PREFIX/include"
|
||||||
|
[ -z "$LIBDIR" ] && LIBDIR="$PREFIX/lib"
|
||||||
|
[ -z "$LIBEXECDIR" ] && LIBEXECDIR="$PREFIX/libexec"
|
||||||
|
[ -z "$MANDIR" ] && MANDIR="$DATADIR/man"
|
||||||
|
[ -z "$SBINDIR" ] && SBINDIR="$PREFIX/sbin"
|
||||||
|
if [ -z "$SYSCONFDIR" ]; then
|
||||||
|
SYSCONFDIR="$PREFIX/etc"
|
||||||
|
[ "$PREFIX" = "/usr" ] && SYSCONFDIR="/etc"
|
||||||
|
fi
|
||||||
|
PKGCONFIG="$PREFIX/lib/pkgconfig"
|
||||||
|
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
target="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
#clean
|
||||||
|
[ "$clean" -ne 0 ] && continue
|
||||||
|
|
||||||
|
#uninstall
|
||||||
|
if [ "$uninstall" -eq 1 ]; then
|
||||||
|
$DEBUG $RM -- "$PKGCONFIG/$target" || return 2
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
#install
|
||||||
|
if [ "$install" -eq 1 ]; then
|
||||||
|
source="${target#$OBJDIR}"
|
||||||
|
$DEBUG $MKDIR -- "$PKGCONFIG" || return 2
|
||||||
|
mode="-m 0644"
|
||||||
|
basename="$source"
|
||||||
|
if [ "${source##*/}" != "$source" ]; then
|
||||||
|
basename="${source##*/}"
|
||||||
|
fi
|
||||||
|
$DEBUG $INSTALL $mode "$target" "$PKGCONFIG/$basename" \
|
||||||
|
|| return 2
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
#portability
|
||||||
|
RPATH=
|
||||||
|
if [ "$PREFIX" != "/usr" ]; then
|
||||||
|
RPATH="-Wl,-rpath-link,\${libdir} -Wl,-rpath,\${libdir}"
|
||||||
|
case $(uname -s) in
|
||||||
|
"Darwin")
|
||||||
|
RPATH="-Wl,-rpath,\${libdir}"
|
||||||
|
;;
|
||||||
|
"SunOS")
|
||||||
|
RPATH="-Wl,-R\${libdir}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
#create
|
||||||
|
source="${target#$OBJDIR}"
|
||||||
|
source="${source}.in"
|
||||||
|
([ -z "$OBJDIR" ] || $DEBUG $MKDIR -- "${target%/*}") \
|
||||||
|
|| return 2
|
||||||
|
$DEBUG $SED -e "s;@VENDOR@;$VENDOR;g" \
|
||||||
|
-e "s;@PACKAGE@;$PACKAGE;g" \
|
||||||
|
-e "s;@VERSION@;$VERSION;g" \
|
||||||
|
-e "s;@PREFIX@;$PREFIX;g" \
|
||||||
|
-e "s;@BINDIR@;$BINDIR;g" \
|
||||||
|
-e "s;@DATADIR@;$DATADIR;g" \
|
||||||
|
-e "s;@INCLUDEDIR@;$INCLUDEDIR;g" \
|
||||||
|
-e "s;@LIBDIR@;$LIBDIR;g" \
|
||||||
|
-e "s;@LIBEXECDIR@;$LIBEXECDIR;g" \
|
||||||
|
-e "s;@MANDIR@;$MANDIR;g" \
|
||||||
|
-e "s;@PWD@;$PWD;g" \
|
||||||
|
-e "s;@RPATH@;$RPATH;g" \
|
||||||
|
-e "s;@SBINDIR@;$SBINDIR;g" \
|
||||||
|
-e "s;@SYSCONFDIR@;$SYSCONFDIR;g" \
|
||||||
|
-- "$source" > "$target"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
$RM -- "$target" 2> "$DEVNULL"
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#debug
|
#debug
|
||||||
_debug()
|
_debug()
|
||||||
{
|
{
|
||||||
|
@ -94,91 +189,10 @@ while getopts "ciuO:P:" name; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
if [ $# -lt 0 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
_usage
|
_usage
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#check the variables
|
|
||||||
if [ -z "$PACKAGE" ]; then
|
|
||||||
_error "The PACKAGE variable needs to be set"
|
|
||||||
exit $?
|
|
||||||
fi
|
|
||||||
if [ -z "$VERSION" ]; then
|
|
||||||
_error "The VERSION variable needs to be set"
|
|
||||||
exit $?
|
|
||||||
fi
|
|
||||||
[ -z "$BINDIR" ] && BINDIR="$PREFIX/bin"
|
|
||||||
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
|
|
||||||
[ -z "$INCLUDEDIR" ] && INCLUDEDIR="$PREFIX/include"
|
|
||||||
[ -z "$LIBDIR" ] && LIBDIR="$PREFIX/lib"
|
|
||||||
[ -z "$LIBEXECDIR" ] && LIBEXECDIR="$PREFIX/libexec"
|
|
||||||
[ -z "$MANDIR" ] && MANDIR="$DATADIR/man"
|
|
||||||
if [ -z "$SYSCONFDIR" ]; then
|
|
||||||
SYSCONFDIR="$PREFIX/etc"
|
|
||||||
[ "$PREFIX" = "/usr" ] && SYSCONFDIR="/etc"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PKGCONFIG="$PREFIX/lib/pkgconfig"
|
|
||||||
exec 3>&1
|
exec 3>&1
|
||||||
while [ $# -gt 0 ]; do
|
_pkgconfig "$@"
|
||||||
target="$1"
|
|
||||||
shift
|
|
||||||
|
|
||||||
#clean
|
|
||||||
[ "$clean" -ne 0 ] && continue
|
|
||||||
|
|
||||||
#uninstall
|
|
||||||
if [ "$uninstall" -eq 1 ]; then
|
|
||||||
$DEBUG $RM -- "$PKGCONFIG/$target" || exit 2
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
#install
|
|
||||||
if [ "$install" -eq 1 ]; then
|
|
||||||
source="${target#$OBJDIR}"
|
|
||||||
$DEBUG $MKDIR -- "$PKGCONFIG" || exit 2
|
|
||||||
basename="$source"
|
|
||||||
if [ "${source##*/}" != "$source" ]; then
|
|
||||||
basename="${source##*/}"
|
|
||||||
fi
|
|
||||||
$DEBUG $INSTALL "$target" "$PKGCONFIG/$basename"|| exit 2
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
#portability
|
|
||||||
RPATH=
|
|
||||||
if [ "$PREFIX" != "/usr" ]; then
|
|
||||||
RPATH="-Wl,-rpath-link,\${libdir} -Wl,-rpath,\${libdir}"
|
|
||||||
case $(uname -s) in
|
|
||||||
"Darwin")
|
|
||||||
RPATH="-Wl,-rpath,\${libdir}"
|
|
||||||
;;
|
|
||||||
"SunOS")
|
|
||||||
RPATH="-Wl,-R\${libdir}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
#create
|
|
||||||
source="${target#$OBJDIR}"
|
|
||||||
source="${source}.in"
|
|
||||||
([ -z "$OBJDIR" ] || $DEBUG $MKDIR -- "${target%/*}") || exit 2
|
|
||||||
$DEBUG $SED -e "s;@PACKAGE@;$PACKAGE;g" \
|
|
||||||
-e "s;@VERSION@;$VERSION;g" \
|
|
||||||
-e "s;@PREFIX@;$PREFIX;g" \
|
|
||||||
-e "s;@BINDIR@;$BINDIR;g" \
|
|
||||||
-e "s;@DATADIR@;$DATADIR;g" \
|
|
||||||
-e "s;@INCLUDEDIR@;$INCLUDEDIR;g" \
|
|
||||||
-e "s;@LIBDIR@;$LIBDIR;g" \
|
|
||||||
-e "s;@LIBEXECDIR@;$LIBEXECDIR;g" \
|
|
||||||
-e "s;@MANDIR@;$MANDIR;g" \
|
|
||||||
-e "s;@PWD@;$PWD;g" \
|
|
||||||
-e "s;@RPATH@;$RPATH;g" \
|
|
||||||
-e "s;@SYSCONFDIR@;$SYSCONFDIR;g" \
|
|
||||||
-- "$source" > "$target"
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
$DEBUG $RM -- "$target"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#$Id$
|
#$Id$
|
||||||
#Copyright (c) 2012-2021 Pierre Pronchery <khorben@defora.org>
|
#Copyright (c) 2012-2024 Pierre Pronchery <khorben@defora.org>
|
||||||
#
|
#
|
||||||
#Redistribution and use in source and binary forms, with or without
|
#Redistribution and use in source and binary forms, with or without
|
||||||
#modification, are permitted provided that the following conditions are met:
|
#modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -28,14 +28,17 @@
|
||||||
CONFIGSH="${0%/docbook.sh}/../config.sh"
|
CONFIGSH="${0%/docbook.sh}/../config.sh"
|
||||||
PREFIX="/usr/local"
|
PREFIX="/usr/local"
|
||||||
PROGNAME="docbook.sh"
|
PROGNAME="docbook.sh"
|
||||||
|
XSL_HTML="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"
|
||||||
|
XSL_MAN="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
|
||||||
|
XSL_PDF="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"
|
||||||
#executables
|
#executables
|
||||||
DEBUG="_debug"
|
DEBUG="_debug"
|
||||||
FOP="fop"
|
FOP="fop"
|
||||||
INSTALL="install -m 0644"
|
INSTALL="install -m 0644"
|
||||||
MKDIR="mkdir -m 0755 -p"
|
MKDIR="mkdir -m 0755 -p"
|
||||||
RM="rm -f"
|
RM="rm -f"
|
||||||
XMLLINT="xmllint --nonet --xinclude"
|
XMLLINT="xmllint --noent --nonet --xinclude --path ${PWD}"
|
||||||
XSLTPROC="xsltproc --nonet --xinclude"
|
XSLTPROC="xsltproc --nonet --xinclude --path ${PWD}"
|
||||||
|
|
||||||
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
|
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
|
||||||
|
|
||||||
|
@ -60,18 +63,20 @@ _docbook()
|
||||||
ext="${ext##.}"
|
ext="${ext##.}"
|
||||||
case "$ext" in
|
case "$ext" in
|
||||||
html)
|
html)
|
||||||
XSL="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"
|
XSL="$XSL_HTML"
|
||||||
[ -f "${source%.*}.xsl" ] && XSL="${source%.*}.xsl"
|
[ -f "${source%.*}.xsl" ] && XSL="${source%.*}.xsl"
|
||||||
[ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl"
|
[ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl"
|
||||||
if [ -f "${target%.*}.css.xml" ]; then
|
if [ -f "${target%.*}.css.xml" ]; then
|
||||||
XSLTPROC="$XSLTPROC --param custom.css.source \"${target%.*}.css.xml\" --param generate.css.header 1"
|
XSLTPROC_PARAMS="--param custom.css.source \"${target%.*}.css.xml\" --param generate.css.header 1"
|
||||||
elif [ -f "${source%.*}.css.xml" ]; then
|
elif [ -f "${source%.*}.css.xml" ]; then
|
||||||
XSLTPROC="$XSLTPROC --param custom.css.source \"${source%.*}.css.xml\" --param generate.css.header 1"
|
XSLTPROC_PARAMS="--param custom.css.source \"${source%.*}.css.xml\" --param generate.css.header 1"
|
||||||
|
else
|
||||||
|
XSLTPROC_PARAMS=
|
||||||
fi
|
fi
|
||||||
$DEBUG $XSLTPROC -o "$target" "$XSL" "$source"
|
$DEBUG $XSLTPROC $XSLTPROC_PARAMS -o "$target" "$XSL" "$source"
|
||||||
;;
|
;;
|
||||||
pdf)
|
pdf)
|
||||||
XSL="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"
|
XSL="$XSL_PDF"
|
||||||
[ -f "${source%.*}.xsl" ] && XSL="${source%.*}.xsl"
|
[ -f "${source%.*}.xsl" ] && XSL="${source%.*}.xsl"
|
||||||
[ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl"
|
[ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl"
|
||||||
$DEBUG $XSLTPROC -o "${target%.*}.fo" "$XSL" "$source" &&
|
$DEBUG $XSLTPROC -o "${target%.*}.fo" "$XSL" "$source" &&
|
||||||
|
@ -79,7 +84,7 @@ _docbook()
|
||||||
$RM -- "${target%.*}.fo"
|
$RM -- "${target%.*}.fo"
|
||||||
;;
|
;;
|
||||||
1|2|3|4|5|6|7|8|9)
|
1|2|3|4|5|6|7|8|9)
|
||||||
XSL="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
|
XSL="$XSL_MAN"
|
||||||
$DEBUG $XSLTPROC -o "$target" "$XSL" "$source"
|
$DEBUG $XSLTPROC -o "$target" "$XSL" "$source"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -170,7 +175,7 @@ while [ $# -gt 0 ]; do
|
||||||
source="${target#$OBJDIR}"
|
source="${target#$OBJDIR}"
|
||||||
source="${source%.*}.xml"
|
source="${source%.*}.xml"
|
||||||
xpath="string(/refentry/refmeta/manvolnum)"
|
xpath="string(/refentry/refmeta/manvolnum)"
|
||||||
section=$($XMLLINT --xpath "$xpath" "$source")
|
section=$($DEBUG $XMLLINT --xpath "$xpath" "$source")
|
||||||
if [ $? -eq 0 -a -n "$section" ]; then
|
if [ $? -eq 0 -a -n "$section" ]; then
|
||||||
instdir="$MANDIR/html$section"
|
instdir="$MANDIR/html$section"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
vendor=Desktop
|
vendor=Desktop
|
||||||
package=libDesktop
|
package=libDesktop
|
||||||
version=0.4.0
|
version=0.4.2
|
||||||
config=ent,h,sh
|
config=ent,h,sh
|
||||||
|
|
||||||
subdirs=data,doc,include,src,tests,tools
|
subdirs=data,doc,include,src,tests,tools
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2012-2018 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2012-2024 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS Desktop libDesktop */
|
/* This file is part of DeforaOS Desktop libDesktop */
|
||||||
/* All rights reserved.
|
/* All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -28,7 +28,10 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <gdk/gdk.h>
|
||||||
|
#if defined(GDK_WINDOWING_X11)
|
||||||
# include <gdk/gdkx.h>
|
# include <gdk/gdkx.h>
|
||||||
|
#endif
|
||||||
#include "Desktop.h"
|
#include "Desktop.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,6 +41,7 @@
|
||||||
/* gdk_window_clear */
|
/* gdk_window_clear */
|
||||||
void gdk_window_clear(GdkWindow * window)
|
void gdk_window_clear(GdkWindow * window)
|
||||||
{
|
{
|
||||||
|
# if defined(GDK_WINDOWING_X11)
|
||||||
Display * display;
|
Display * display;
|
||||||
Window wid;
|
Window wid;
|
||||||
|
|
||||||
|
@ -46,6 +50,9 @@ void gdk_window_clear(GdkWindow * window)
|
||||||
gdk_error_trap_push();
|
gdk_error_trap_push();
|
||||||
XClearWindow(display, wid);
|
XClearWindow(display, wid);
|
||||||
gdk_error_trap_pop();
|
gdk_error_trap_pop();
|
||||||
|
# else
|
||||||
|
(void) window;
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
167
src/message.c
167
src/message.c
|
@ -1,5 +1,5 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2011-2020 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2011-2024 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS Desktop libDesktop */
|
/* This file is part of DeforaOS Desktop libDesktop */
|
||||||
/* All rights reserved.
|
/* All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -37,11 +37,17 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
#if defined(GDK_WINDOWING_X11)
|
||||||
# if GTK_CHECK_VERSION(3, 0, 0)
|
# if GTK_CHECK_VERSION(3, 0, 0)
|
||||||
# include <gtk/gtkx.h>
|
# include <gtk/gtkx.h>
|
||||||
# else
|
# else
|
||||||
# include <gdk/gdkx.h>
|
# include <gdk/gdkx.h>
|
||||||
# endif
|
# endif
|
||||||
|
#else
|
||||||
|
# include <sys/socket.h>
|
||||||
|
# include <sys/un.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <System.h>
|
#include <System.h>
|
||||||
#include "Desktop.h"
|
#include "Desktop.h"
|
||||||
|
|
||||||
|
@ -52,11 +58,17 @@
|
||||||
typedef struct _MessageCallback
|
typedef struct _MessageCallback
|
||||||
{
|
{
|
||||||
GtkWidget * window;
|
GtkWidget * window;
|
||||||
|
#if defined(GDK_WINDOWING_X11)
|
||||||
# if GTK_CHECK_VERSION(3, 0, 0)
|
# if GTK_CHECK_VERSION(3, 0, 0)
|
||||||
Atom atom;
|
Atom atom;
|
||||||
# else
|
# else
|
||||||
GtkWidget * widget;
|
GtkWidget * widget;
|
||||||
Window xwindow;
|
Window xwindow;
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
int socket;
|
||||||
|
GIOChannel * channel;
|
||||||
|
guint id;
|
||||||
#endif
|
#endif
|
||||||
DesktopMessageCallback callback;
|
DesktopMessageCallback callback;
|
||||||
void * data;
|
void * data;
|
||||||
|
@ -70,8 +82,13 @@ static size_t _callbacks_cnt = 0;
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
/* callbacks */
|
/* callbacks */
|
||||||
|
#if defined(GDK_WINDOWING_X11)
|
||||||
static GdkFilterReturn _desktop_message_on_callback(GdkXEvent * xevent,
|
static GdkFilterReturn _desktop_message_on_callback(GdkXEvent * xevent,
|
||||||
GdkEvent * event, gpointer data);
|
GdkEvent * event, gpointer data);
|
||||||
|
#else
|
||||||
|
static gboolean _desktop_message_on_connect(GIOChannel * channel,
|
||||||
|
GIOCondition condition, gpointer data);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* public */
|
/* public */
|
||||||
|
@ -82,10 +99,14 @@ int desktop_message_register(GtkWidget * window, char const * destination,
|
||||||
{
|
{
|
||||||
MessageCallback ** p;
|
MessageCallback ** p;
|
||||||
MessageCallback * mc;
|
MessageCallback * mc;
|
||||||
|
#if defined(GDK_WINDOWING_X11)
|
||||||
GdkWindow * gwindow;
|
GdkWindow * gwindow;
|
||||||
# if !GTK_CHECK_VERSION(3, 0, 0)
|
# if !GTK_CHECK_VERSION(3, 0, 0)
|
||||||
GdkAtom atom;
|
GdkAtom atom;
|
||||||
# endif
|
# endif
|
||||||
|
#else
|
||||||
|
(void) window;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "DEBUG: %s(%p, \"%s\", %p, %p)\n", __func__, window,
|
fprintf(stderr, "DEBUG: %s(%p, \"%s\", %p, %p)\n", __func__, window,
|
||||||
|
@ -99,6 +120,7 @@ int desktop_message_register(GtkWidget * window, char const * destination,
|
||||||
_callbacks[_callbacks_cnt++] = mc;
|
_callbacks[_callbacks_cnt++] = mc;
|
||||||
mc->callback = callback;
|
mc->callback = callback;
|
||||||
mc->data = data;
|
mc->data = data;
|
||||||
|
#if defined(GDK_WINDOWING_X11)
|
||||||
# if GTK_CHECK_VERSION(3, 0, 0)
|
# if GTK_CHECK_VERSION(3, 0, 0)
|
||||||
mc->atom = XInternAtom(gdk_x11_get_default_xdisplay(), destination,
|
mc->atom = XInternAtom(gdk_x11_get_default_xdisplay(), destination,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
@ -116,6 +138,50 @@ int desktop_message_register(GtkWidget * window, char const * destination,
|
||||||
mc->xwindow = GDK_WINDOW_XWINDOW(gwindow);
|
mc->xwindow = GDK_WINDOW_XWINDOW(gwindow);
|
||||||
atom = gdk_atom_intern(destination, FALSE);
|
atom = gdk_atom_intern(destination, FALSE);
|
||||||
gdk_add_client_message_filter(atom, _desktop_message_on_callback, mc);
|
gdk_add_client_message_filter(atom, _desktop_message_on_callback, mc);
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
GdkDisplay * display;
|
||||||
|
struct sockaddr_un addr;
|
||||||
|
|
||||||
|
display = gdk_display_get_default();
|
||||||
|
if((p = realloc(_callbacks, sizeof(*p) * (_callbacks_cnt + 1))) == NULL)
|
||||||
|
return -error_set_code(1, "%s", strerror(errno));
|
||||||
|
_callbacks = p;
|
||||||
|
if((mc = object_new(sizeof(*mc))) == NULL)
|
||||||
|
return -1;
|
||||||
|
_callbacks[_callbacks_cnt] = mc;
|
||||||
|
mc->callback = callback;
|
||||||
|
mc->data = data;
|
||||||
|
memset(&addr, 0, sizeof(addr));
|
||||||
|
addr.sun_family = AF_UNIX;
|
||||||
|
snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/%s-%s",
|
||||||
|
g_get_tmp_dir(), gdk_display_get_name(display),
|
||||||
|
destination);
|
||||||
|
addr.sun_len = sizeof(addr) - sizeof(addr.sun_path)
|
||||||
|
+ strlen(addr.sun_path) + 1;
|
||||||
|
if((mc->socket = socket(addr.sun_family, SOCK_STREAM, 0)) < 0)
|
||||||
|
return -error_set_code(1, "%s: %s", "socket", strerror(errno));
|
||||||
|
if(bind(mc->socket, (struct sockaddr *)&addr, sizeof(addr)) != 0)
|
||||||
|
{
|
||||||
|
error_set_code(1, "%s: %s: %s", "bind", addr.sun_path,
|
||||||
|
strerror(errno));
|
||||||
|
close(mc->socket);
|
||||||
|
unlink(addr.sun_path);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if(listen(mc->socket, 5) != 0)
|
||||||
|
{
|
||||||
|
error_set_code(1, "%s: %s: %s", "listen", addr.sun_path,
|
||||||
|
strerror(errno));
|
||||||
|
close(mc->socket);
|
||||||
|
unlink(addr.sun_path);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
mc->channel = g_io_channel_unix_new(mc->socket);
|
||||||
|
g_io_channel_set_encoding(mc->channel, NULL, NULL);
|
||||||
|
mc->id = g_io_add_watch(mc->channel, G_IO_IN,
|
||||||
|
_desktop_message_on_connect, NULL);
|
||||||
|
_callbacks_cnt++;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -125,12 +191,17 @@ int desktop_message_register(GtkWidget * window, char const * destination,
|
||||||
int desktop_message_send(char const * destination, uint32_t value1,
|
int desktop_message_send(char const * destination, uint32_t value1,
|
||||||
uint32_t value2, uint32_t value3)
|
uint32_t value2, uint32_t value3)
|
||||||
{
|
{
|
||||||
|
#if defined(GDK_WINDOWING_X11)
|
||||||
# if GTK_CHECK_VERSION(3, 0, 0)
|
# if GTK_CHECK_VERSION(3, 0, 0)
|
||||||
GdkDisplay * display;
|
GdkDisplay * display;
|
||||||
Display * xdisplay;
|
Display * xdisplay;
|
||||||
XEvent xev;
|
XEvent xev;
|
||||||
XClientMessageEvent * xcme = &xev.xclient;
|
XClientMessageEvent * xcme = &xev.xclient;
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
fprintf(stderr, "DEBUG: %s(%s, 0x%x, 0x%x, 0x%x)\n", __func__,
|
||||||
|
destination, value1, value2, value3);
|
||||||
|
# endif
|
||||||
display = gdk_display_get_default();
|
display = gdk_display_get_default();
|
||||||
xdisplay = gdk_x11_display_get_xdisplay(display);
|
xdisplay = gdk_x11_display_get_xdisplay(display);
|
||||||
memset(&xev, 0, sizeof(xev));
|
memset(&xev, 0, sizeof(xev));
|
||||||
|
@ -153,6 +224,10 @@ int desktop_message_send(char const * destination, uint32_t value1,
|
||||||
GdkEvent event;
|
GdkEvent event;
|
||||||
GdkEventClient * client = &event.client;
|
GdkEventClient * client = &event.client;
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
fprintf(stderr, "DEBUG: %s(%s, 0x%x, 0x%x, 0x%x)\n", __func__,
|
||||||
|
destination, value1, value2, value3);
|
||||||
|
# endif
|
||||||
atom = gdk_atom_intern(destination, FALSE);
|
atom = gdk_atom_intern(destination, FALSE);
|
||||||
memset(&event, 0, sizeof(event));
|
memset(&event, 0, sizeof(event));
|
||||||
client->type = GDK_CLIENT_EVENT;
|
client->type = GDK_CLIENT_EVENT;
|
||||||
|
@ -166,6 +241,42 @@ int desktop_message_send(char const * destination, uint32_t value1,
|
||||||
gdk_event_send_clientmessage_toall(&event);
|
gdk_event_send_clientmessage_toall(&event);
|
||||||
return 0;
|
return 0;
|
||||||
# endif
|
# endif
|
||||||
|
#else
|
||||||
|
GdkDisplay * display;
|
||||||
|
int fd;
|
||||||
|
struct sockaddr_un addr;
|
||||||
|
char buf[33];
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
fprintf(stderr, "DEBUG: %s(%s, 0x%x, 0x%x, 0x%x)\n", __func__,
|
||||||
|
destination, value1, value2, value3);
|
||||||
|
# endif
|
||||||
|
display = gdk_display_get_default();
|
||||||
|
memset(&addr, 0, sizeof(addr));
|
||||||
|
addr.sun_family = AF_UNIX;
|
||||||
|
snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/%s-%s",
|
||||||
|
g_get_tmp_dir(), gdk_display_get_name(display),
|
||||||
|
destination);
|
||||||
|
addr.sun_len = sizeof(addr) - sizeof(addr.sun_path)
|
||||||
|
+ strlen(addr.sun_path) + 1;
|
||||||
|
if((fd = socket(addr.sun_family, SOCK_STREAM, 0)) < 0)
|
||||||
|
return -error_set_code(1, "%s: %s", "socket", strerror(errno));
|
||||||
|
if(connect(fd, (struct sockaddr *)&addr, sizeof(addr)) != 0)
|
||||||
|
{
|
||||||
|
close(fd);
|
||||||
|
return -error_set_code(1, "%s: %s: %s", "connect",
|
||||||
|
addr.sun_path, strerror(errno));
|
||||||
|
}
|
||||||
|
snprintf(buf, sizeof(buf), "0x%x:0x%x:0x%x", value1, value2, value3);
|
||||||
|
if(send(fd, buf, strlen(buf), 0) != (ssize_t)strlen(buf))
|
||||||
|
{
|
||||||
|
close(fd);
|
||||||
|
return -error_set_code(1, "%s: %s: %s", "send", addr.sun_path,
|
||||||
|
strerror(errno));
|
||||||
|
}
|
||||||
|
close(fd);
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,7 +287,9 @@ void desktop_message_unregister(GtkWidget * window,
|
||||||
size_t i;
|
size_t i;
|
||||||
MessageCallback ** p;
|
MessageCallback ** p;
|
||||||
MessageCallback * mc;
|
MessageCallback * mc;
|
||||||
|
#if defined(GDK_WINDOWING_X11)
|
||||||
GdkWindow * w;
|
GdkWindow * w;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "DEBUG: %s(%p, %p)\n", __func__, callback, data);
|
fprintf(stderr, "DEBUG: %s(%p, %p)\n", __func__, callback, data);
|
||||||
|
@ -191,6 +304,7 @@ void desktop_message_unregister(GtkWidget * window,
|
||||||
}
|
}
|
||||||
if(i == _callbacks_cnt)
|
if(i == _callbacks_cnt)
|
||||||
return;
|
return;
|
||||||
|
#if defined(GDK_WINDOWING_X11)
|
||||||
# if GTK_CHECK_VERSION(3, 0, 0)
|
# if GTK_CHECK_VERSION(3, 0, 0)
|
||||||
w = (window != NULL) ? gtk_widget_get_window(window) : NULL;
|
w = (window != NULL) ? gtk_widget_get_window(window) : NULL;
|
||||||
# else
|
# else
|
||||||
|
@ -200,6 +314,14 @@ void desktop_message_unregister(GtkWidget * window,
|
||||||
# if !GTK_CHECK_VERSION(3, 0, 0)
|
# if !GTK_CHECK_VERSION(3, 0, 0)
|
||||||
if(mc->window == NULL)
|
if(mc->window == NULL)
|
||||||
gtk_widget_destroy(mc->widget);
|
gtk_widget_destroy(mc->widget);
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
if(mc->id > 0)
|
||||||
|
g_source_remove(mc->id);
|
||||||
|
if(mc->channel != NULL)
|
||||||
|
g_io_channel_unref(mc->channel);
|
||||||
|
if(mc->socket >= 0)
|
||||||
|
close(mc->socket);
|
||||||
#endif
|
#endif
|
||||||
object_delete(mc);
|
object_delete(mc);
|
||||||
p = &_callbacks[i];
|
p = &_callbacks[i];
|
||||||
|
@ -212,6 +334,7 @@ void desktop_message_unregister(GtkWidget * window,
|
||||||
|
|
||||||
/* private */
|
/* private */
|
||||||
/* callbacks */
|
/* callbacks */
|
||||||
|
#if defined(GDK_WINDOWING_X11)
|
||||||
/* desktop_message_on_callback */
|
/* desktop_message_on_callback */
|
||||||
static GdkFilterReturn _desktop_message_on_callback(GdkXEvent * xevent,
|
static GdkFilterReturn _desktop_message_on_callback(GdkXEvent * xevent,
|
||||||
GdkEvent * event, gpointer data)
|
GdkEvent * event, gpointer data)
|
||||||
|
@ -254,3 +377,45 @@ static GdkFilterReturn _desktop_message_on_callback(GdkXEvent * xevent,
|
||||||
desktop_message_unregister(mc->window, mc->callback, mc->data);
|
desktop_message_unregister(mc->window, mc->callback, mc->data);
|
||||||
return GDK_FILTER_REMOVE;
|
return GDK_FILTER_REMOVE;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
static gboolean _desktop_message_on_connect(GIOChannel * channel,
|
||||||
|
GIOCondition condition, gpointer data)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
MessageCallback * mc;
|
||||||
|
int fd;
|
||||||
|
char buf[33];
|
||||||
|
ssize_t len;
|
||||||
|
uint32_t value1;
|
||||||
|
uint32_t value2;
|
||||||
|
uint32_t value3;
|
||||||
|
(void) data;
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
fprintf(stderr, "DEBUG: %s()\n", __func__);
|
||||||
|
# endif
|
||||||
|
if(condition != G_IO_IN)
|
||||||
|
return FALSE;
|
||||||
|
for(i = 0; i < _callbacks_cnt; i++)
|
||||||
|
if(_callbacks[i]->channel == channel)
|
||||||
|
break;
|
||||||
|
if(i == _callbacks_cnt)
|
||||||
|
return FALSE;
|
||||||
|
mc = _callbacks[i];
|
||||||
|
if((fd = accept(mc->socket, NULL, NULL)) < 0)
|
||||||
|
/* XXX ignore these errors */
|
||||||
|
return TRUE;
|
||||||
|
len = recv(fd, buf, sizeof(buf) - 1, 0);
|
||||||
|
close(fd);
|
||||||
|
if(len > 0 && (size_t)len < sizeof(buf))
|
||||||
|
{
|
||||||
|
buf[len] = '\0';
|
||||||
|
if(sscanf(buf, "0x%x:0x%x:0x%x", &value1, &value2, &value3) == 3
|
||||||
|
&& mc->callback(mc->data, value1, value2,
|
||||||
|
value3) != 0)
|
||||||
|
desktop_message_unregister(mc->window, mc->callback,
|
||||||
|
mc->data);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
29
src/mime.c
29
src/mime.c
|
@ -1,5 +1,5 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2011-2020 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2011-2024 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS libDesktop */
|
/* This file is part of DeforaOS libDesktop */
|
||||||
/* All rights reserved.
|
/* All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -97,7 +97,16 @@ Mime * mime_new(GtkIconTheme * theme)
|
||||||
"/usr/pkg/share/mime/globs2",
|
"/usr/pkg/share/mime/globs2",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
char ** g = globs2;
|
char * globs[] =
|
||||||
|
{
|
||||||
|
DATADIR "/mime/globs",
|
||||||
|
"/usr/share/mime/globs",
|
||||||
|
"/usr/local/share/mime/globs",
|
||||||
|
"/usr/pkg/share/mime/globs",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
int priority = 1;
|
||||||
|
char ** g;
|
||||||
FILE * fp = NULL;
|
FILE * fp = NULL;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -116,14 +125,15 @@ Mime * mime_new(GtkIconTheme * theme)
|
||||||
if((fp = fopen(*g, "r")) != NULL)
|
if((fp = fopen(*g, "r")) != NULL)
|
||||||
break;
|
break;
|
||||||
if(fp == NULL)
|
if(fp == NULL)
|
||||||
{
|
for(g = globs, priority = 0; *g != NULL; g++)
|
||||||
error_set_code(1, "%s", "Could not load MIME globs");
|
if((fp = fopen(*g, "r")) != NULL)
|
||||||
object_delete(mime);
|
break;
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
mime->types = NULL;
|
mime->types = NULL;
|
||||||
mime->types_cnt = 0;
|
mime->types_cnt = 0;
|
||||||
_new_config(mime);
|
_new_config(mime);
|
||||||
|
if(fp == NULL)
|
||||||
|
/* XXX no globs could be loaded */
|
||||||
|
return mime;
|
||||||
while(fgets(buf, sizeof(buf), fp) != NULL)
|
while(fgets(buf, sizeof(buf), fp) != NULL)
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
|
@ -133,11 +143,16 @@ Mime * mime_new(GtkIconTheme * theme)
|
||||||
if(buf[0] == '#')
|
if(buf[0] == '#')
|
||||||
continue;
|
continue;
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
|
if(priority)
|
||||||
|
{
|
||||||
/* parse the priority */
|
/* parse the priority */
|
||||||
errno = 0;
|
errno = 0;
|
||||||
strtoul(buf, &p, 0);
|
strtoul(buf, &p, 0);
|
||||||
if(errno != 0 || *(p++) != ':')
|
if(errno != 0 || *(p++) != ':')
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
p = buf;
|
||||||
glob = strchr(p, ':');
|
glob = strchr(p, ':');
|
||||||
*(glob++) = '\0';
|
*(glob++) = '\0';
|
||||||
for(i = 0; i < mime->types_cnt; i++)
|
for(i = 0; i < mime->types_cnt; i++)
|
||||||
|
|
|
@ -597,7 +597,13 @@ int mimehandler_load_by_name(MimeHandler * handler, String const * name)
|
||||||
return ret;
|
return ret;
|
||||||
/* read through every XDG application folder */
|
/* read through every XDG application folder */
|
||||||
if((path = getenv("XDG_DATA_DIRS")) == NULL || strlen(path) == 0)
|
if((path = getenv("XDG_DATA_DIRS")) == NULL || strlen(path) == 0)
|
||||||
|
{
|
||||||
|
/* XXX avoid duplicates if PREFIX is "/usr/local" */
|
||||||
|
if(string_compare("/usr/local/share", DATADIR) != 0)
|
||||||
path = "/usr/local/share:" DATADIR ":/usr/share";
|
path = "/usr/local/share:" DATADIR ":/usr/share";
|
||||||
|
else
|
||||||
|
path = "/usr/local/share:/usr/share";
|
||||||
|
}
|
||||||
if((p = string_new(path)) == NULL)
|
if((p = string_new(path)) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
for(q = strtok_r(p, ":", &last); q != NULL;
|
for(q = strtok_r(p, ":", &last); q != NULL;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#$Id$
|
#$Id$
|
||||||
#Copyright (c) 2017-2021 Pierre Pronchery <khorben@defora.org>
|
#Copyright (c) 2017-2022 Pierre Pronchery <khorben@defora.org>
|
||||||
#
|
#
|
||||||
#Redistribution and use in source and binary forms, with or without
|
#Redistribution and use in source and binary forms, with or without
|
||||||
#modification, are permitted provided that the following conditions are met:
|
#modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -95,7 +95,7 @@ _fixme_callback()
|
||||||
echo "_fixme_callback_asm"
|
echo "_fixme_callback_asm"
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
c|cc|cpp|cxx|h|js|v)
|
c|cc|cpp|cxx|go|h|js|v)
|
||||||
echo "_fixme_callback_c"
|
echo "_fixme_callback_c"
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
@ -122,7 +122,7 @@ _fixme_callback()
|
||||||
echo "_fixme_callback_python"
|
echo "_fixme_callback_python"
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
"<html"*|"<?xml"*)
|
"<!DOCTYPE"*|"<!doctype"*|"<HTML"*|"<html"*|"<?xml"*)
|
||||||
echo "_fixme_callback_xml"
|
echo "_fixme_callback_xml"
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#$Id$
|
#$Id$
|
||||||
#Copyright (c) 2016-2018 Pierre Pronchery <khorben@defora.org>
|
#Copyright (c) 2016-2024 Pierre Pronchery <khorben@defora.org>
|
||||||
#This file is part of DeforaOS Desktop libDesktop
|
#This file is part of DeforaOS Desktop libDesktop
|
||||||
#Redistribution and use in source and binary forms, with or without
|
#Redistribution and use in source and binary forms, with or without
|
||||||
#modification, are permitted provided that the following conditions are met:
|
#modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -27,8 +27,11 @@
|
||||||
#variables
|
#variables
|
||||||
[ -n "$OBJDIR" ] || OBJDIR="./"
|
[ -n "$OBJDIR" ] || OBJDIR="./"
|
||||||
PROGNAME="tests.sh"
|
PROGNAME="tests.sh"
|
||||||
|
SYSTEM="$(uname -s)"
|
||||||
#executables
|
#executables
|
||||||
DATE="date"
|
DATE="date"
|
||||||
|
ECHO="echo"
|
||||||
|
[ "$SYSTEM" = "Darwin" ] && ECHO="/bin/echo"
|
||||||
|
|
||||||
|
|
||||||
#functions
|
#functions
|
||||||
|
@ -47,7 +50,7 @@ _run()
|
||||||
[ $# -eq 1 ] || sep=" "
|
[ $# -eq 1 ] || sep=" "
|
||||||
|
|
||||||
shift
|
shift
|
||||||
echo -n "$test:" 1>&2
|
$ECHO -n "$test:" 1>&2
|
||||||
(echo
|
(echo
|
||||||
echo "Testing: $test" "$@"
|
echo "Testing: $test" "$@"
|
||||||
testexe="./$test"
|
testexe="./$test"
|
||||||
|
@ -79,7 +82,7 @@ _test()
|
||||||
#usage
|
#usage
|
||||||
_usage()
|
_usage()
|
||||||
{
|
{
|
||||||
echo "Usage: $PROGNAME [-c][-P prefix]" 1>&2
|
echo "Usage: $PROGNAME [-c][-P prefix] target" 1>&2
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +95,7 @@ while getopts "cP:" name; do
|
||||||
clean=1
|
clean=1
|
||||||
;;
|
;;
|
||||||
P)
|
P)
|
||||||
#XXX ignored
|
#XXX ignored for compatibility
|
||||||
;;
|
;;
|
||||||
?)
|
?)
|
||||||
_usage
|
_usage
|
||||||
|
@ -107,7 +110,7 @@ if [ $# -ne 1 ]; then
|
||||||
fi
|
fi
|
||||||
target="$1"
|
target="$1"
|
||||||
|
|
||||||
[ "$clean" -ne 0 ] && exit 0
|
[ $clean -ne 0 ] && exit 0
|
||||||
|
|
||||||
tests="mime mimehandler pkgconfig.sh"
|
tests="mime mimehandler pkgconfig.sh"
|
||||||
failures=
|
failures=
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#$Id$
|
#$Id$
|
||||||
#Copyright (c) 2012-2020 Pierre Pronchery <khorben@defora.org>
|
#Copyright (c) 2012-2022 Pierre Pronchery <khorben@defora.org>
|
||||||
#
|
#
|
||||||
#Redistribution and use in source and binary forms, with or without
|
#Redistribution and use in source and binary forms, with or without
|
||||||
#modification, are permitted provided that the following conditions are met:
|
#modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -29,18 +29,19 @@ CONFIGSH="${0%/subst.sh}/../config.sh"
|
||||||
PREFIX="/usr/local"
|
PREFIX="/usr/local"
|
||||||
BINDIR=
|
BINDIR=
|
||||||
DATADIR=
|
DATADIR=
|
||||||
|
DEVNULL="/dev/null"
|
||||||
INCLUDEDIR=
|
INCLUDEDIR=
|
||||||
LDSO=
|
LDSO=
|
||||||
LIBDIR=
|
LIBDIR=
|
||||||
LIBEXECDIR=
|
LIBEXECDIR=
|
||||||
MANDIR=
|
MANDIR=
|
||||||
PROGNAME="subst.sh"
|
PROGNAME="subst.sh"
|
||||||
|
SBINDIR=
|
||||||
SYSCONFDIR=
|
SYSCONFDIR=
|
||||||
#executables
|
#executables
|
||||||
CHMOD="chmod"
|
CHMOD="chmod"
|
||||||
DATE="date"
|
DATE="date"
|
||||||
DEBUG="_debug"
|
DEBUG="_debug"
|
||||||
DEVNULL="/dev/null"
|
|
||||||
INSTALL="install"
|
INSTALL="install"
|
||||||
MKDIR="mkdir -m 0755 -p"
|
MKDIR="mkdir -m 0755 -p"
|
||||||
RM="rm -f"
|
RM="rm -f"
|
||||||
|
@ -85,6 +86,7 @@ _subst()
|
||||||
SYSCONFDIR="$PREFIX/etc"
|
SYSCONFDIR="$PREFIX/etc"
|
||||||
[ "$PREFIX" = "/usr" ] && SYSCONFDIR="/etc"
|
[ "$PREFIX" = "/usr" ] && SYSCONFDIR="/etc"
|
||||||
fi
|
fi
|
||||||
|
[ -z "$SBINDIR" ] && SBINDIR="$PREFIX/sbin"
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
target="$1"
|
target="$1"
|
||||||
|
@ -115,7 +117,8 @@ _subst()
|
||||||
source="${source}.in"
|
source="${source}.in"
|
||||||
([ -z "$OBJDIR" ] || $DEBUG $MKDIR -- "${target%/*}") \
|
([ -z "$OBJDIR" ] || $DEBUG $MKDIR -- "${target%/*}") \
|
||||||
|| return 2
|
|| return 2
|
||||||
$DEBUG $SED -e "s;@PACKAGE@;$PACKAGE;g" \
|
$DEBUG $SED -e "s;@VENDOR@;$VENDOR;g" \
|
||||||
|
-e "s;@PACKAGE@;$PACKAGE;g" \
|
||||||
-e "s;@VERSION@;$VERSION;g" \
|
-e "s;@VERSION@;$VERSION;g" \
|
||||||
-e "s;@PREFIX@;$PREFIX;g" \
|
-e "s;@PREFIX@;$PREFIX;g" \
|
||||||
-e "s;@BINDIR@;$BINDIR;g" \
|
-e "s;@BINDIR@;$BINDIR;g" \
|
||||||
|
@ -127,6 +130,7 @@ _subst()
|
||||||
-e "s;@LIBEXECDIR@;$LIBEXECDIR;g" \
|
-e "s;@LIBEXECDIR@;$LIBEXECDIR;g" \
|
||||||
-e "s;@MANDIR@;$MANDIR;g" \
|
-e "s;@MANDIR@;$MANDIR;g" \
|
||||||
-e "s;@PWD@;$PWD;g" \
|
-e "s;@PWD@;$PWD;g" \
|
||||||
|
-e "s;@SBINDIR@;$SBINDIR;g" \
|
||||||
-e "s;@SYSCONFDIR@;$SYSCONFDIR;g" \
|
-e "s;@SYSCONFDIR@;$SYSCONFDIR;g" \
|
||||||
-- "$source" > "$target"
|
-- "$source" > "$target"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
@ -139,6 +143,7 @@ _subst()
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#debug
|
#debug
|
||||||
_debug()
|
_debug()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user