aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoryzrh <yzrh@noema.org>2020-12-31 18:43:29 +0000
committeryzrh <yzrh@noema.org>2020-12-31 18:45:02 +0000
commit3bd7ea7520e13f5fabcfadb1a7630398bc1dca6d (patch)
tree1f8336f75ee871574e37abbe49ddbaafcf7e88fc /src
parent1f62c53da6edc5a82a1e0eceb401b2274cd4a0d1 (diff)
downloadmelon-3bd7ea7520e13f5fabcfadb1a7630398bc1dca6d.tar.gz
melon-3bd7ea7520e13f5fabcfadb1a7630398bc1dca6d.tar.zst
Improve portability.
Diffstat (limited to 'src')
-rw-r--r--src/GNUmakefile28
-rw-r--r--src/Makefile17
-rw-r--r--src/cnki.h2
-rw-r--r--src/cnki_hn.c4
-rw-r--r--src/pdf_cnki.c2
5 files changed, 17 insertions, 36 deletions
diff --git a/src/GNUmakefile b/src/GNUmakefile
deleted file mode 100644
index 1263005..0000000
--- a/src/GNUmakefile
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Copyright (c) 2020, yzrh <yzrh@noema.org>
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-
-src != ls *.c
-obj = ${src:.c=.o}
-
-PREFIX = /usr/local
-
-CFLAGS = -O3 -march=native -pipe -Wall
-LDFLAGS = -Wl,-O3 -lcrypto -lz -Wl,--as-needed
-
-all: ${obj}
- ${CC} ${LDFLAGS} -o melon $^
-
-clean:
- rm -f melon ${obj}
-
-install:
- install -d ${PREFIX}/bin
- install melon ${PREFIX}/bin/
-
-deinstall:
- rm -f ${PREFIX}/bin/melon
-
-.PHONY: all clean install deinstall
diff --git a/src/Makefile b/src/Makefile
index eb62818..f8c1e34 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -4,16 +4,25 @@
# SPDX-License-Identifier: Apache-2.0
#
-src != ls *.c
+src = melon.c iconv.c zlib.c \
+ cnki_caj.c cnki_hn.c cnki_kdh.c cnki_outline_tree.c \
+ cnki_pdf.c cnki_xml.c cnki_zlib.c cnki.c \
+ pdf_cnki.c pdf_get.c pdf_parser.c pdf_writer.c pdf.c
+inc = extern.h version.h iconv.h zlib.h \
+ cnki.h pdf_cnki.h pdf.h
+
obj = ${src:.c=.o}
PREFIX = /usr/local
CFLAGS = -O3 -march=native -pipe -flto=thin -Wall
-LDFLAGS = -Wl,-O3 -lcrypto -lz -Wl,--as-needed
+LDFLAGS = -Wl,-O3 -lcrypto -liconv -lz -Wl,--as-needed
+
+CFLAGS += -I/usr/local/include
+LDFLAGS += -L/usr/local/lib
-all: ${obj}
- ${CC} ${LDFLAGS} -o melon $>
+all: ${obj} ${inc}
+ ${CC} ${LDFLAGS} -o melon ${obj}
clean:
rm -f melon ${obj}
diff --git a/src/cnki.h b/src/cnki.h
index cf5a818..30557c1 100644
--- a/src/cnki.h
+++ b/src/cnki.h
@@ -45,7 +45,7 @@ typedef struct _object_outline_tree_t {
} object_outline_tree_t;
typedef enum _hn_code {
- CCITTFAX,
+ JBIG,
DCT_0,
DCT_1, /* Inverted */
JBIG2,
diff --git a/src/cnki_hn.c b/src/cnki_hn.c
index d402c0c..f6a4c24 100644
--- a/src/cnki_hn.c
+++ b/src/cnki_hn.c
@@ -172,7 +172,7 @@ cnki_hn(cnki_t **param)
conv_src[0] = buf[i + 7];
conv_src[1] = buf[i + 6];
- conv_size = 512;
+ conv_size = 6;
if (strconv(&conv_dst, "UTF-16BE",
conv_src, "GB18030", &conv_size) == 0) {
@@ -202,7 +202,7 @@ cnki_hn(cnki_t **param)
conv_src[0] = ptr->text[i + 3];
conv_src[1] = ptr->text[i + 2];
- conv_size = 512;
+ conv_size = 6;
if (strconv(&conv_dst, "UTF-16BE",
conv_src, "GB18030", &conv_size) == 0) {
diff --git a/src/pdf_cnki.c b/src/pdf_cnki.c
index d69797b..6e5f810 100644
--- a/src/pdf_cnki.c
+++ b/src/pdf_cnki.c
@@ -42,7 +42,7 @@ _outline(pdf_object_t **pdf, object_outline_tree_t **outline_tree, int id, int *
strcat(dictionary, "<<\n");
- size = 512;
+ size = 514;
str = NULL;
if (strconv(&str, "UTF-16BE",