discount: fix cross and enable pkgconfig file

This commit is contained in:
Jürgen Buchmüller 2018-01-01 19:50:27 +01:00
parent 633b974ce0
commit a6cfd7536d
3 changed files with 171 additions and 7 deletions

View file

@ -0,0 +1,133 @@
Replace the compile time check for the scalar types required
to replace BYTE, WORD and DWORD with stdint.h types.
--- configure.inc 2017-01-19 03:42:06.000000000 +0100
+++ configure.inc 2018-01-01 18:49:05.494530670 +0100
@@ -895,86 +895,28 @@
rc=1
LOGN "defining WORD & DWORD scalar types"
-
-# --- is this needed anymore? ---
-# if AC_QUIET AC_CHECK_HEADERS WinDef.h; then
-# # windows machine; BYTE, WORD, DWORD already
-# # defined
-#
-# for x in $@; do
-# case "$x" in
-# sub)AC_SUB DWORD DWORD
-# AC_SUB WORD WORD
-# AC_SUB BYTE BYTE
-# ;;
-# *)
-# echo "#include <WinDef.h>" >> "$__cwd"/config.h
-# ;;
-# esac
-# done
-# TLOG " (defined in WinDef.h)"
-# return 0
-# fi
-
- cat > ngc$$.c << EOF
-#include <stdio.h>
-#include <string.h>
-
-int pound_define = 1;
-
-void
-say(char *w, char *v)
-{
- printf(pound_define ? "#define %s %s\n"
- : "s:@%s@:%s:g\n", w, v);
-}
-
-main(argc, argv)
-char **argv;
-{
- unsigned long v_long;
- unsigned int v_int;
- unsigned short v_short;
-
- if ( argc > 1 && strcmp(argv[1], "sub") == 0 )
- pound_define = 0;
-
- if (sizeof v_long == 4)
- say("DWORD", "unsigned long");
- else if (sizeof v_int == 4)
- say("DWORD", "unsigned int");
- else
- exit(1);
-
- if (sizeof v_int == 2)
- say("WORD", "unsigned int");
- else if (sizeof v_short == 2)
- say("WORD", "unsigned short");
- else
- exit(2);
- say("BYTE", "unsigned char");
- exit(0);
-}
-EOF
- if $AC_CC ngc$$.c -o ngc$$; then
- while [ "$1" ]; do
- case "$1" in
- sub)if ./ngc$$ sub >> "$__cwd"/config.sub; then
- rc=0
- fi;;
- *) if ./ngc$$ >> "$__cwd"/config.h; then
- rc=0
- fi ;;
- esac
- shift
- done
- if [ "$rc" != 0 ]; then
- if ./ngc$$ >> "$__cwd"/config.h; then
- rc=1
- fi
- fi
- fi
- __remove ngc$$ ngc$$.c
+
+ while [ "$1" ]; do
+ case "$1" in
+ sub) # substitution strings for BYTE, WORD, DWORD
+ echo "s:@DWORD@:uint32_t:g" >> "$__cwd"/config.sub
+ echo "s:@WORD@:uint16_t:g" >> "$__cwd"/config.sub
+ echo "s:@BYTE@:uint8_t:g" >> "$__cwd"/config.sub
+ rc=0
+ ;;
+ hdr) # config.h definitions for BYTE, WORD, DWORD
+ echo "#include <stdint.h>" >> "$__cwd"/config.h
+ echo "#define BYTE uint8_t" >> "$__cwd"/config.h
+ echo "#define WORD uint16_t" >> "$__cwd"/config.h
+ echo "#define DWORD uint32_t" >> "$__cwd"/config.h
+ rc=0
+ ;;
+ *) # unknown parameter
+ LOGN "(unknown: $1)"
+ ;;
+ esac
+ shift
+ done
case "$rc" in
0) TLOG "" ;;
*) AC_FAIL " ** FAILED **" ;;
@@ -1548,7 +1548,7 @@
}
EOF
- $AC_CC -o config.sed ngc$$.c
+ cc -o config.sed ngc$$.c
status=$?
rm -f ngc$$.c
--- mkdio.h.in 2017-01-19 03:42:06.000000000 +0100
+++ mkdio.h.in 2018-01-01 18:52:22.871544747 +0100
@@ -2,6 +2,7 @@
#define _MKDIO_D
#include <stdio.h>
+#include <stdint.h>
typedef void MMIOT;

View file

@ -0,0 +1,35 @@
Compile tools to be run on the host using cc instead of $(CC).
Ideally the patch would introduce $(CC_FOR_BUILD) instead while
for Void we know that cc is going to work.
--- Makefile.in 2017-01-19 03:42:06.000000000 +0100
+++ Makefile.in 2018-01-01 19:33:18.233719865 +0100
@@ -1,5 +1,5 @@
CC=@CC@ -I.
-LFLAGS=-L.
+LFLAGS=@LDFLAGS@ -L.
CFLAGS=@CFLAGS@
AR=@AR@
RANLIB=@RANLIB@
@@ -83,6 +83,9 @@
blocktags: mktags
./mktags > blocktags
+mktags: mktags.c
+ cc -o $@ $<
+
# example programs
@THEME@theme: theme.o $(MKDLIB) mkdio.h
@THEME@ $(CC) $(CFLAGS) $(LFLAGS) -o theme theme.o pgm_options.o -lmarkdown @LIBS@
@@ -115,9 +118,9 @@
done
cols: tools/cols.c config.h
- $(CC) -o cols tools/cols.c
+ cc -o cols tools/cols.c
echo: tools/echo.c config.h
- $(CC) -o echo tools/echo.c
+ cc -o echo tools/echo.c
clean:
rm -f $(PGMS) $(TESTFRAMEWORK) $(SAMPLE_PGMS) *.o

View file

@ -1,10 +1,10 @@
# Template file for 'discount'
pkgname=discount
version=2.2.2
revision=1
revision=2
build_style=configure
configure_script="./configure.sh"
configure_args="--prefix=/usr --shared"
configure_args="--prefix=/usr --shared --pkg-config"
short_desc="C implementation of John Gruber's Markdown"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="3-clause-BSD"
@ -12,11 +12,6 @@ homepage="http://www.pell.portland.or.us/~orc/Code/discount"
distfiles="${homepage}/${pkgname}-${version}.tar.bz2"
checksum=ec7916731e3ef8516336333f8b7aa9e2af51e57c0017b1e03fa43f1ba6978f64
nocross="http://build.voidlinux.eu/builders/armv7l_builder/builds/22221/steps/shell_3/logs/stdio"
post_extract() {
sed -i '/^LFLAGS/s/$/ $(LDFLAGS)/' Makefile.in
}
do_install() {
make DESTDIR=${DESTDIR} install install.man
vlicense COPYRIGHT
@ -27,6 +22,7 @@ discount-devel_package() {
pkg_install() {
vmove usr/include
vmove usr/lib/*.so
vmove usr/lib/pkgconfig
vmove usr/share/man/man3
}
}