Skip to content

Commit 6e8d869

Browse files
committedApr 30, 2024
Update the scripts from DeforaOS configure
1 parent 664efa1 commit 6e8d869

File tree

4 files changed

+125
-101
lines changed

4 files changed

+125
-101
lines changed
 

‎data/pkgconfig.sh

+99-85
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
#$Id$
3-
#Copyright (c) 2011-2020 Pierre Pronchery <khorben@defora.org>
3+
#Copyright (c) 2011-2022 Pierre Pronchery <khorben@defora.org>
44
#
55
#Redistribution and use in source and binary forms, with or without
66
#modification, are permitted provided that the following conditions are met:
@@ -31,7 +31,7 @@ DEVNULL="/dev/null"
3131
PROGNAME="pkgconfig.sh"
3232
#executables
3333
DEBUG="_debug"
34-
INSTALL="install -m 0644"
34+
INSTALL="install"
3535
MKDIR="mkdir -m 0755 -p"
3636
RM="rm -f"
3737
SED="sed"
@@ -40,6 +40,101 @@ SED="sed"
4040

4141

4242
#functions
43+
#pkgconfig
44+
_pkgconfig()
45+
{
46+
#check the variables
47+
if [ -z "$PACKAGE" ]; then
48+
_error "The PACKAGE variable needs to be set"
49+
return $?
50+
fi
51+
if [ -z "$VERSION" ]; then
52+
_error "The VERSION variable needs to be set"
53+
return $?
54+
fi
55+
[ -z "$BINDIR" ] && BINDIR="$PREFIX/bin"
56+
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
57+
[ -z "$INCLUDEDIR" ] && INCLUDEDIR="$PREFIX/include"
58+
[ -z "$LIBDIR" ] && LIBDIR="$PREFIX/lib"
59+
[ -z "$LIBEXECDIR" ] && LIBEXECDIR="$PREFIX/libexec"
60+
[ -z "$MANDIR" ] && MANDIR="$DATADIR/man"
61+
[ -z "$SBINDIR" ] && SBINDIR="$PREFIX/sbin"
62+
if [ -z "$SYSCONFDIR" ]; then
63+
SYSCONFDIR="$PREFIX/etc"
64+
[ "$PREFIX" = "/usr" ] && SYSCONFDIR="/etc"
65+
fi
66+
PKGCONFIG="$PREFIX/lib/pkgconfig"
67+
68+
while [ $# -gt 0 ]; do
69+
target="$1"
70+
shift
71+
72+
#clean
73+
[ "$clean" -ne 0 ] && continue
74+
75+
#uninstall
76+
if [ "$uninstall" -eq 1 ]; then
77+
$DEBUG $RM -- "$PKGCONFIG/$target" || return 2
78+
continue
79+
fi
80+
81+
#install
82+
if [ "$install" -eq 1 ]; then
83+
source="${target#$OBJDIR}"
84+
$DEBUG $MKDIR -- "$PKGCONFIG" || return 2
85+
mode="-m 0644"
86+
basename="$source"
87+
if [ "${source##*/}" != "$source" ]; then
88+
basename="${source##*/}"
89+
fi
90+
$DEBUG $INSTALL $mode "$target" "$PKGCONFIG/$basename" \
91+
|| return 2
92+
continue
93+
fi
94+
95+
#portability
96+
RPATH=
97+
if [ "$PREFIX" != "/usr" ]; then
98+
RPATH="-Wl,-rpath-link,\${libdir} -Wl,-rpath,\${libdir}"
99+
case $(uname -s) in
100+
"Darwin")
101+
RPATH="-Wl,-rpath,\${libdir}"
102+
;;
103+
"SunOS")
104+
RPATH="-Wl,-R\${libdir}"
105+
;;
106+
esac
107+
fi
108+
109+
#create
110+
source="${target#$OBJDIR}"
111+
source="${source}.in"
112+
([ -z "$OBJDIR" ] || $DEBUG $MKDIR -- "${target%/*}") \
113+
|| return 2
114+
$DEBUG $SED -e "s;@VENDOR@;$VENDOR;g" \
115+
-e "s;@PACKAGE@;$PACKAGE;g" \
116+
-e "s;@VERSION@;$VERSION;g" \
117+
-e "s;@PREFIX@;$PREFIX;g" \
118+
-e "s;@BINDIR@;$BINDIR;g" \
119+
-e "s;@DATADIR@;$DATADIR;g" \
120+
-e "s;@INCLUDEDIR@;$INCLUDEDIR;g" \
121+
-e "s;@LIBDIR@;$LIBDIR;g" \
122+
-e "s;@LIBEXECDIR@;$LIBEXECDIR;g" \
123+
-e "s;@MANDIR@;$MANDIR;g" \
124+
-e "s;@PWD@;$PWD;g" \
125+
-e "s;@RPATH@;$RPATH;g" \
126+
-e "s;@SBINDIR@;$SBINDIR;g" \
127+
-e "s;@SYSCONFDIR@;$SYSCONFDIR;g" \
128+
-- "$source" > "$target"
129+
if [ $? -ne 0 ]; then
130+
$RM -- "$target" 2> "$DEVNULL"
131+
return 2
132+
fi
133+
done
134+
return 0
135+
}
136+
137+
43138
#debug
44139
_debug()
45140
{
@@ -94,91 +189,10 @@ while getopts "ciuO:P:" name; do
94189
esac
95190
done
96191
shift $(($OPTIND - 1))
97-
if [ $# -lt 0 ]; then
192+
if [ $# -lt 1 ]; then
98193
_usage
99194
exit $?
100195
fi
101196

102-
#check the variables
103-
if [ -z "$PACKAGE" ]; then
104-
_error "The PACKAGE variable needs to be set"
105-
exit $?
106-
fi
107-
if [ -z "$VERSION" ]; then
108-
_error "The VERSION variable needs to be set"
109-
exit $?
110-
fi
111-
[ -z "$BINDIR" ] && BINDIR="$PREFIX/bin"
112-
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
113-
[ -z "$INCLUDEDIR" ] && INCLUDEDIR="$PREFIX/include"
114-
[ -z "$LIBDIR" ] && LIBDIR="$PREFIX/lib"
115-
[ -z "$LIBEXECDIR" ] && LIBEXECDIR="$PREFIX/libexec"
116-
[ -z "$MANDIR" ] && MANDIR="$DATADIR/man"
117-
if [ -z "$SYSCONFDIR" ]; then
118-
SYSCONFDIR="$PREFIX/etc"
119-
[ "$PREFIX" = "/usr" ] && SYSCONFDIR="/etc"
120-
fi
121-
122-
PKGCONFIG="$PREFIX/lib/pkgconfig"
123197
exec 3>&1
124-
while [ $# -gt 0 ]; do
125-
target="$1"
126-
shift
127-
128-
#clean
129-
[ "$clean" -ne 0 ] && continue
130-
131-
#uninstall
132-
if [ "$uninstall" -eq 1 ]; then
133-
$DEBUG $RM -- "$PKGCONFIG/$target" || exit 2
134-
continue
135-
fi
136-
137-
#install
138-
if [ "$install" -eq 1 ]; then
139-
source="${target#$OBJDIR}"
140-
$DEBUG $MKDIR -- "$PKGCONFIG" || exit 2
141-
basename="$source"
142-
if [ "${source##*/}" != "$source" ]; then
143-
basename="${source##*/}"
144-
fi
145-
$DEBUG $INSTALL "$target" "$PKGCONFIG/$basename"|| exit 2
146-
continue
147-
fi
148-
149-
#portability
150-
RPATH=
151-
if [ "$PREFIX" != "/usr" ]; then
152-
RPATH="-Wl,-rpath-link,\${libdir} -Wl,-rpath,\${libdir}"
153-
case $(uname -s) in
154-
"Darwin")
155-
RPATH="-Wl,-rpath,\${libdir}"
156-
;;
157-
"SunOS")
158-
RPATH="-Wl,-R\${libdir}"
159-
;;
160-
esac
161-
fi
162-
163-
#create
164-
source="${target#$OBJDIR}"
165-
source="${source}.in"
166-
([ -z "$OBJDIR" ] || $DEBUG $MKDIR -- "${target%/*}") || exit 2
167-
$DEBUG $SED -e "s;@PACKAGE@;$PACKAGE;g" \
168-
-e "s;@VERSION@;$VERSION;g" \
169-
-e "s;@PREFIX@;$PREFIX;g" \
170-
-e "s;@BINDIR@;$BINDIR;g" \
171-
-e "s;@DATADIR@;$DATADIR;g" \
172-
-e "s;@INCLUDEDIR@;$INCLUDEDIR;g" \
173-
-e "s;@LIBDIR@;$LIBDIR;g" \
174-
-e "s;@LIBEXECDIR@;$LIBEXECDIR;g" \
175-
-e "s;@MANDIR@;$MANDIR;g" \
176-
-e "s;@PWD@;$PWD;g" \
177-
-e "s;@RPATH@;$RPATH;g" \
178-
-e "s;@SYSCONFDIR@;$SYSCONFDIR;g" \
179-
-- "$source" > "$target"
180-
if [ $? -ne 0 ]; then
181-
$DEBUG $RM -- "$target"
182-
exit 2
183-
fi
184-
done
198+
_pkgconfig "$@"

‎doc/docbook.sh

+15-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
#$Id$
3-
#Copyright (c) 2012-2021 Pierre Pronchery <khorben@defora.org>
3+
#Copyright (c) 2012-2024 Pierre Pronchery <khorben@defora.org>
44
#
55
#Redistribution and use in source and binary forms, with or without
66
#modification, are permitted provided that the following conditions are met:
@@ -28,14 +28,17 @@
2828
CONFIGSH="${0%/docbook.sh}/../config.sh"
2929
PREFIX="/usr/local"
3030
PROGNAME="docbook.sh"
31+
XSL_HTML="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"
32+
XSL_MAN="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
33+
XSL_PDF="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"
3134
#executables
3235
DEBUG="_debug"
3336
FOP="fop"
3437
INSTALL="install -m 0644"
3538
MKDIR="mkdir -m 0755 -p"
3639
RM="rm -f"
37-
XMLLINT="xmllint --nonet --xinclude"
38-
XSLTPROC="xsltproc --nonet --xinclude"
40+
XMLLINT="xmllint --noent --nonet --xinclude --path ${PWD}"
41+
XSLTPROC="xsltproc --nonet --xinclude --path ${PWD}"
3942

4043
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
4144

@@ -60,26 +63,28 @@ _docbook()
6063
ext="${ext##.}"
6164
case "$ext" in
6265
html)
63-
XSL="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"
66+
XSL="$XSL_HTML"
6467
[ -f "${source%.*}.xsl" ] && XSL="${source%.*}.xsl"
6568
[ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl"
6669
if [ -f "${target%.*}.css.xml" ]; then
67-
XSLTPROC="$XSLTPROC --param custom.css.source \"${target%.*}.css.xml\" --param generate.css.header 1"
70+
XSLTPROC_PARAMS="--param custom.css.source \"${target%.*}.css.xml\" --param generate.css.header 1"
6871
elif [ -f "${source%.*}.css.xml" ]; then
69-
XSLTPROC="$XSLTPROC --param custom.css.source \"${source%.*}.css.xml\" --param generate.css.header 1"
72+
XSLTPROC_PARAMS="--param custom.css.source \"${source%.*}.css.xml\" --param generate.css.header 1"
73+
else
74+
XSLTPROC_PARAMS=
7075
fi
71-
$DEBUG $XSLTPROC -o "$target" "$XSL" "$source"
76+
$DEBUG $XSLTPROC $XSLTPROC_PARAMS -o "$target" "$XSL" "$source"
7277
;;
7378
pdf)
74-
XSL="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"
79+
XSL="$XSL_PDF"
7580
[ -f "${source%.*}.xsl" ] && XSL="${source%.*}.xsl"
7681
[ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl"
7782
$DEBUG $XSLTPROC -o "${target%.*}.fo" "$XSL" "$source" &&
7883
$DEBUG $FOP -fo "${target%.*}.fo" -pdf "$target"
7984
$RM -- "${target%.*}.fo"
8085
;;
8186
1|2|3|4|5|6|7|8|9)
82-
XSL="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
87+
XSL="$XSL_MAN"
8388
$DEBUG $XSLTPROC -o "$target" "$XSL" "$source"
8489
;;
8590
*)
@@ -170,7 +175,7 @@ while [ $# -gt 0 ]; do
170175
source="${target#$OBJDIR}"
171176
source="${source%.*}.xml"
172177
xpath="string(/refentry/refmeta/manvolnum)"
173-
section=$($XMLLINT --xpath "$xpath" "$source")
178+
section=$($DEBUG $XMLLINT --xpath "$xpath" "$source")
174179
if [ $? -eq 0 -a -n "$section" ]; then
175180
instdir="$MANDIR/html$section"
176181
fi

‎tests/fixme.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
#$Id$
3-
#Copyright (c) 2017-2021 Pierre Pronchery <khorben@defora.org>
3+
#Copyright (c) 2017-2022 Pierre Pronchery <khorben@defora.org>
44
#
55
#Redistribution and use in source and binary forms, with or without
66
#modification, are permitted provided that the following conditions are met:
@@ -95,7 +95,7 @@ _fixme_callback()
9595
echo "_fixme_callback_asm"
9696
return 0
9797
;;
98-
c|cc|cpp|cxx|h|js|v)
98+
c|cc|cpp|cxx|go|h|js|v)
9999
echo "_fixme_callback_c"
100100
return 0
101101
;;
@@ -122,7 +122,7 @@ _fixme_callback()
122122
echo "_fixme_callback_python"
123123
return 0
124124
;;
125-
"<html"*|"<?xml"*)
125+
"<!DOCTYPE"*|"<!doctype"*|"<HTML"*|"<html"*|"<?xml"*)
126126
echo "_fixme_callback_xml"
127127
return 0
128128
;;

‎tools/subst.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
#$Id$
3-
#Copyright (c) 2012-2020 Pierre Pronchery <khorben@defora.org>
3+
#Copyright (c) 2012-2022 Pierre Pronchery <khorben@defora.org>
44
#
55
#Redistribution and use in source and binary forms, with or without
66
#modification, are permitted provided that the following conditions are met:
@@ -29,18 +29,19 @@ CONFIGSH="${0%/subst.sh}/../config.sh"
2929
PREFIX="/usr/local"
3030
BINDIR=
3131
DATADIR=
32+
DEVNULL="/dev/null"
3233
INCLUDEDIR=
3334
LDSO=
3435
LIBDIR=
3536
LIBEXECDIR=
3637
MANDIR=
3738
PROGNAME="subst.sh"
39+
SBINDIR=
3840
SYSCONFDIR=
3941
#executables
4042
CHMOD="chmod"
4143
DATE="date"
4244
DEBUG="_debug"
43-
DEVNULL="/dev/null"
4445
INSTALL="install"
4546
MKDIR="mkdir -m 0755 -p"
4647
RM="rm -f"
@@ -85,6 +86,7 @@ _subst()
8586
SYSCONFDIR="$PREFIX/etc"
8687
[ "$PREFIX" = "/usr" ] && SYSCONFDIR="/etc"
8788
fi
89+
[ -z "$SBINDIR" ] && SBINDIR="$PREFIX/sbin"
8890

8991
while [ $# -gt 0 ]; do
9092
target="$1"
@@ -115,7 +117,8 @@ _subst()
115117
source="${source}.in"
116118
([ -z "$OBJDIR" ] || $DEBUG $MKDIR -- "${target%/*}") \
117119
|| return 2
118-
$DEBUG $SED -e "s;@PACKAGE@;$PACKAGE;g" \
120+
$DEBUG $SED -e "s;@VENDOR@;$VENDOR;g" \
121+
-e "s;@PACKAGE@;$PACKAGE;g" \
119122
-e "s;@VERSION@;$VERSION;g" \
120123
-e "s;@PREFIX@;$PREFIX;g" \
121124
-e "s;@BINDIR@;$BINDIR;g" \
@@ -127,6 +130,7 @@ _subst()
127130
-e "s;@LIBEXECDIR@;$LIBEXECDIR;g" \
128131
-e "s;@MANDIR@;$MANDIR;g" \
129132
-e "s;@PWD@;$PWD;g" \
133+
-e "s;@SBINDIR@;$SBINDIR;g" \
130134
-e "s;@SYSCONFDIR@;$SYSCONFDIR;g" \
131135
-- "$source" > "$target"
132136
if [ $? -ne 0 ]; then
@@ -139,6 +143,7 @@ _subst()
139143
return 0
140144
}
141145

146+
142147
#debug
143148
_debug()
144149
{

0 commit comments

Comments
 (0)