Move utility source code to libuitil.a

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
David Oberhollenzer 2019-02-04 15:21:19 +01:00
parent 618aaf4278
commit 16f3e4d97c
17 changed files with 30 additions and 21 deletions

1
.gitignore vendored
View File

@ -15,5 +15,6 @@ missing
stamp-h1 stamp-h1
config.h config.h
*.o *.o
*.a
*~ *~
pkg pkg

View File

@ -3,20 +3,24 @@ ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = -I$(top_srcdir)/include -D_GNU_SOURCE AM_CPPFLAGS = -I$(top_srcdir)/include -D_GNU_SOURCE
AM_CFLAGS = $(WARN_CFLAGS) AM_CFLAGS = $(WARN_CFLAGS)
# application core # helper libraries
GLOBALHDR = include/pkgformat.h include/util.h include/pkgreader.h libutil_a_SOURCES = lib/util/input_file.c lib/util/mkdir_p.c lib/util/util.c
GLOBALHDR += include/compressor.h include/command.h include/pkgwriter.h libutil_a_SOURCES += include/util/util.h include/util/input_file.h
GLOBALHDR += include/image_entry.h include/pkgio.h include/input_file.h
MAIN = main/pkg.c main/util.c main/compressor.c main/command.c main/pkgreader.c # application core
GLOBALHDR = include/pkgformat.h include/pkgreader.h
GLOBALHDR += include/compressor.h include/command.h include/pkgwriter.h
GLOBALHDR += include/image_entry.h include/pkgio.h
MAIN = main/pkg.c main/compressor.c main/command.c main/pkgreader.c
MAIN += main/pkgwriter.c main/image_entry.c main/image_entry_sort.c MAIN += main/pkgwriter.c main/image_entry.c main/image_entry_sort.c
MAIN += main/mkdir_p.c main/pkgio_rd_image_entry.c main/pkg_unpack.c MAIN += main/pkgio_rd_image_entry.c main/pkg_unpack.c main/dump_toc.c
MAIN += main/input_file.c main/dump_toc.c
pkg_SOURCES = $(GLOBALHDR) $(MAIN) pkg_SOURCES = $(GLOBALHDR) $(MAIN)
pkg_CFLAGS = $(AM_CFLAGS) pkg_CFLAGS = $(AM_CFLAGS)
pkg_LDADD = pkg_LDADD = libutil.a
noinst_LIBRARIES = libutil.a
bin_PROGRAMS = pkg bin_PROGRAMS = pkg
EXTRA_DIST = autogen.sh EXTRA_DIST = autogen.sh

View File

@ -5,6 +5,7 @@ AM_INIT_AUTOMAKE([foreign dist-xz subdir-objects])
AM_SILENT_RULES([yes]) AM_SILENT_RULES([yes])
AC_PROG_CC AC_PROG_CC
AC_PROG_CC_C99 AC_PROG_CC_C99
AC_PROG_RANLIB
AC_PROG_INSTALL AC_PROG_INSTALL
m4_ifndef([PKG_PROG_PKG_CONFIG], m4_ifndef([PKG_PROG_PKG_CONFIG],

View File

@ -3,7 +3,7 @@
#include <errno.h> #include <errno.h>
#include <ctype.h> #include <ctype.h>
#include "input_file.h" #include "util/input_file.h"
static int prefetch_line(input_file_t *f) static int prefetch_line(input_file_t *f)
{ {

View File

@ -5,7 +5,7 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include "util.h" #include "util/util.h"
int mkdir_p(const char *path) int mkdir_p(const char *path)
{ {

View File

@ -2,7 +2,7 @@
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include "util.h" #include "util/util.h"
int canonicalize_name(char *filename) int canonicalize_name(char *filename)
{ {

View File

@ -7,12 +7,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "util/util.h"
#include "image_entry.h" #include "image_entry.h"
#include "pkgformat.h" #include "pkgformat.h"
#include "pkgreader.h" #include "pkgreader.h"
#include "command.h" #include "command.h"
#include "pkgio.h" #include "pkgio.h"
#include "util.h"
typedef enum { typedef enum {
DUMP_TOC = 0x01, DUMP_TOC = 0x01,

View File

@ -9,11 +9,12 @@
#include <stdio.h> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>
#include "util/util.h"
#include "image_entry.h" #include "image_entry.h"
#include "pkgreader.h" #include "pkgreader.h"
#include "command.h" #include "command.h"
#include "pkgio.h" #include "pkgio.h"
#include "util.h"
enum { enum {
INSTALL_MODE_INSTALL = 0, INSTALL_MODE_INSTALL = 0,

View File

@ -14,13 +14,14 @@
#include <ctype.h> #include <ctype.h>
#include <fcntl.h> #include <fcntl.h>
#include "util/input_file.h"
#include "util/util.h"
#include "image_entry.h" #include "image_entry.h"
#include "input_file.h"
#include "compressor.h" #include "compressor.h"
#include "pkgformat.h" #include "pkgformat.h"
#include "pkgwriter.h" #include "pkgwriter.h"
#include "command.h" #include "command.h"
#include "util.h"
typedef struct dependency_t { typedef struct dependency_t {
struct dependency_t *next; struct dependency_t *next;

View File

@ -4,10 +4,11 @@
#include <stdio.h> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>
#include "util/util.h"
#include "pkgreader.h" #include "pkgreader.h"
#include "command.h" #include "command.h"
#include "pkgio.h" #include "pkgio.h"
#include "util.h"
static const struct option long_opts[] = { static const struct option long_opts[] = {
{ "root", required_argument, NULL, 'r' }, { "root", required_argument, NULL, 'r' },

View File

@ -3,7 +3,6 @@
#include <stdio.h> #include <stdio.h>
#include "image_entry.h" #include "image_entry.h"
#include "util.h"
void image_entry_free(image_entry_t *ent) void image_entry_free(image_entry_t *ent)
{ {

View File

@ -7,7 +7,7 @@
#include <fcntl.h> #include <fcntl.h>
#include "pkgio.h" #include "pkgio.h"
#include "util.h" #include "util/util.h"
static int create_hierarchy(int dirfd, image_entry_t *list) static int create_hierarchy(int dirfd, image_entry_t *list)
{ {

View File

@ -4,7 +4,7 @@
#include <stdio.h> #include <stdio.h>
#include "pkgio.h" #include "pkgio.h"
#include "util.h" #include "util/util.h"
static int read_extra(pkg_reader_t *pkg, image_entry_t *ent) static int read_extra(pkg_reader_t *pkg, image_entry_t *ent)
{ {

View File

@ -7,7 +7,7 @@
#include <errno.h> #include <errno.h>
#include <ctype.h> #include <ctype.h>
#include "util.h" #include "util/util.h"
#include "pkgreader.h" #include "pkgreader.h"
#include "compressor.h" #include "compressor.h"

View File

@ -6,7 +6,7 @@
#include <errno.h> #include <errno.h>
#include "pkgwriter.h" #include "pkgwriter.h"
#include "util.h" #include "util/util.h"
struct pkg_writer_t { struct pkg_writer_t {
const char *path; const char *path;