Skip to content

Commit

Permalink
Switch to automake and overhaul build.
Browse files Browse the repository at this point in the history
The BSD Makefile was getting crufty, and due to differences between
NetBSD and pkgsrc bootstrap-mk-files it was never consistent with
regards to things like WARNS handling.  There were also ugly hacks
required in pkgsrc to get around it including mk.conf etc.

Take the opportunity to clean up the build process.  All of the
dependencies must now be specified, so that have exactly the correct
library and header paths for each.  Rename some of the options to be
consistent, and update the macros in the code accordingly.

Minor changes include using regular sed instead of finding particular
versions (we use plain flags so have no special requirements), building
and installing the manual page correctly, and removing linking against
libbz2 and libz that have not been used for a long time.
  • Loading branch information
Jonathan Perkin committed May 25, 2020
1 parent a620e4f commit a0c974c
Show file tree
Hide file tree
Showing 14 changed files with 4,620 additions and 521 deletions.
84 changes: 84 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#
# Copyright (c) 2020 Jonathan Perkin <[email protected]>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

bin_PROGRAMS= pkgin

#
# External source files imported from elsewhere.
#
openssh_SOURCES= external/progressmeter.c
pkg_install_SOURCES= external/automatic.c external/dewey.c
pkg_install_SOURCES+= external/fexec.c external/opattern.c external/pkgdb.c
pkg_install_SOURCES+= external/var.c external/xwrapper.c

pkgin_SOURCES= actions.c autoremove.c depends.c download.c fsops.c impact.c
pkgin_SOURCES+= main.c order.c pkg_check.c pkg_infos.c pkg_install.c
pkgin_SOURCES+= pkg_str.c pkgindb.c pkgindb_queries.c pkglist.c preferred.c
pkgin_SOURCES+= selection.c sqlite_callbacks.c summary.c tools.c
pkgin_SOURCES+= $(openssh_SOURCES) $(pkg_install_SOURCES)

#
# Conditional sources.
#
if !HAVE_HUMANIZE_NUMBER
pkgin_SOURCES+= external/humanize_number.c
endif

#
# Pull in library dependencies.
#
pkgin_CPPFLAGS= $(LIBARCHIVE_INCLUDES)
pkgin_LDADD= $(LIBARCHIVE_LDFLAGS) $(LIBARCHIVE_LIBS)

pkgin_CPPFLAGS+= $(LIBFETCH_INCLUDES)
pkgin_LDADD+= $(LIBFETCH_LDFLAGS) $(LIBFETCH_LIBS)

pkgin_CPPFLAGS+= $(OPENSSL_INCLUDES)
pkgin_LDADD+= $(OPENSSL_LDFLAGS) $(OPENSSL_LIBS)

pkgin_CPPFLAGS+= $(SQLITE3_INCLUDES)
pkgin_LDADD+= $(SQLITE3_LDFLAGS) $(SQLITE3_LIBS)

#
# Required defines.
#
pkgin_CPPFLAGS+= -DMACHINE_ARCH=\""$(MACHINE_ARCH)"\"
pkgin_CPPFLAGS+= -DPKGIN_DBDIR=\""$(PKGIN_DBDIR)"\"
pkgin_CPPFLAGS+= -DPKGIN_VERSION=\""$(VERSION)"\"
pkgin_CPPFLAGS+= -DPKG_INSTALL_DIR=\""$(PKG_INSTALL_DIR)"\"
pkgin_CPPFLAGS+= -DPKG_SYSCONFDIR=\""$(sysconfdir)"\"
pkgin_CPPFLAGS+= -DPREFIX=\""$(prefix)"\"

#
# Manual pages.
#
man1_MANS= pkgin.1
nodist_pkgin_SOURCES= pkgin.1
pkgin.1: pkgin.1.in
@sed -e 's,/var/db/pkgin,$(PKGIN_DBDIR),g' \
-e 's,/usr/pkg/etc,$(sysconfdir),g' $^ >$@
#
# Generated sources.
#
nodist_pkgin_SOURCES+= pkgindb_create.h
pkgindb_create.h: Makefile
@echo "/* Automatically generated, DO NOT EDIT */" >$@
@echo "#define CREATE_DRYDB \" \\" >>$@
@sed -e 's/$$/ \\/' -e 's/\"/\\\"/g' pkgin.sql >>$@
@echo '"' >>$@

BUILT_SOURCES= $(nodist_pkgin_SOURCES)
CLEANFILES= $(BUILT_SOURCES)
Loading

0 comments on commit a0c974c

Please sign in to comment.