From 094a497dd2dba1f47157e07d57f97c338a5ddaa0 Mon Sep 17 00:00:00 2001
From: Arch Librarian <arch@canonical.com>
Date: Mon, 20 Sep 2004 16:50:46 +0000
Subject: [PATCH] First draft of make system and name change to apt-pkg Author:
 jgg Date: 1998-07-12 23:58:20 GMT First draft of make system and name change
 to apt-pkg

---
 apt-pkg/algorithms.cc            |   8 +--
 apt-pkg/algorithms.h             |   8 +--
 apt-pkg/cacheiterators.h         |   6 +-
 apt-pkg/contrib/configuration.cc |   6 +-
 apt-pkg/contrib/configuration.h  |   4 +-
 apt-pkg/contrib/error.cc         |   6 +-
 apt-pkg/contrib/error.h          |   4 +-
 apt-pkg/contrib/fileutl.cc       |   8 +--
 apt-pkg/contrib/fileutl.h        |   4 +-
 apt-pkg/contrib/mmap.cc          |   8 +--
 apt-pkg/contrib/mmap.h           |   6 +-
 apt-pkg/deb/deblistparser.cc     |   8 +--
 apt-pkg/deb/deblistparser.h      |   6 +-
 apt-pkg/depcache.cc              |  10 +--
 apt-pkg/depcache.h               |   6 +-
 apt-pkg/init.cc                  |   4 +-
 apt-pkg/init.h                   |   4 +-
 apt-pkg/makefile                 |  38 ++++++++++++
 apt-pkg/orderlist.cc             |  12 ++--
 apt-pkg/orderlist.h              |   6 +-
 apt-pkg/packagemanager.cc        |  14 ++---
 apt-pkg/packagemanager.h         |   6 +-
 apt-pkg/pkgcache.cc              |  14 ++---
 apt-pkg/pkgcache.h               |  10 +--
 apt-pkg/pkgcachegen.cc           |  10 +--
 apt-pkg/pkgcachegen.h            |   6 +-
 apt-pkg/sourcelist.cc            |  12 ++--
 apt-pkg/sourcelist.h             |   6 +-
 apt-pkg/tagfile.cc               |  97 ++---------------------------
 apt-pkg/tagfile.h                |   6 +-
 apt-pkg/templates.cc             |   2 +-
 apt-pkg/version.cc               |   8 +--
 apt-pkg/version.h                |   4 +-
 buildlib/defaults.mak            | 101 +++++++++++++++++++++++++++++++
 buildlib/library.mak             |  61 +++++++++++++++++++
 35 files changed, 316 insertions(+), 203 deletions(-)
 create mode 100644 apt-pkg/makefile
 create mode 100644 buildlib/defaults.mak
 create mode 100644 buildlib/library.mak

diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index e4bc99a28..ce0c41efd 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: algorithms.cc,v 1.2 1998/07/12 01:25:59 jgg Exp $
+// $Id: algorithms.cc,v 1.3 1998/07/12 23:58:20 jgg Exp $
 /* ######################################################################
 
    Algorithms - A set of misc algorithms
@@ -9,10 +9,10 @@
 									/*}}}*/
 // Include Files							/*{{{*/
 #ifdef __GNUG__
-#pragma implementation "pkglib/algorithms.h"
+#pragma implementation "apt-pkg/algorithms.h"
 #endif 
-#include <pkglib/algorithms.h>
-#include <pkglib/error.h>
+#include <apt-pkg/algorithms.h>
+#include <apt-pkg/error.h>
 #include <iostream.h>
 									/*}}}*/
 
diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h
index 0dd77d940..d6078b2cb 100644
--- a/apt-pkg/algorithms.h
+++ b/apt-pkg/algorithms.h
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: algorithms.h,v 1.1 1998/07/07 04:17:00 jgg Exp $
+// $Id: algorithms.h,v 1.2 1998/07/12 23:58:22 jgg Exp $
 /* ######################################################################
 
    Algorithms - A set of misc algorithms
@@ -22,11 +22,11 @@
 #define PKGLIB_ALGORITHMS_H
 
 #ifdef __GNUG__
-#pragma interface "pkglib/algorithms.h"
+#pragma interface "apt-pkg/algorithms.h"
 #endif 
 
-#include <pkglib/packagemanager.h>
-#include <pkglib/depcache.h>
+#include <apt-pkg/packagemanager.h>
+#include <apt-pkg/depcache.h>
 
 class pkgSimulate : public pkgPackageManager
 {
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index d382e4b98..390c923b9 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: cacheiterators.h,v 1.5 1998/07/12 01:26:00 jgg Exp $
+// $Id: cacheiterators.h,v 1.6 1998/07/12 23:58:23 jgg Exp $
 /* ######################################################################
    
    Cache Iterators - Iterators for navigating the cache structure
@@ -24,7 +24,7 @@
    that has the depends pointer as a member. The provide iterator has the
    same system.
    
-   This header is not user includable, please use pkglib/pkgcache.h
+   This header is not user includable, please use apt-pkg/pkgcache.h
    
    ##################################################################### */
 									/*}}}*/
@@ -33,7 +33,7 @@
 #define PKGLIB_CACHEITERATORS_H
 
 #ifdef __GNUG__
-#pragma interface "pkglib/cacheiterators.h"
+#pragma interface "apt-pkg/cacheiterators.h"
 #endif 
 
 // Package Iterator
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc
index 7694330f9..72b654b01 100644
--- a/apt-pkg/contrib/configuration.cc
+++ b/apt-pkg/contrib/configuration.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: configuration.cc,v 1.2 1998/07/09 05:12:33 jgg Exp $
+// $Id: configuration.cc,v 1.3 1998/07/12 23:58:44 jgg Exp $
 /* ######################################################################
 
    Configuration Class
@@ -13,9 +13,9 @@
 									/*}}}*/
 // Include files							/*{{{*/
 #ifdef __GNUG__
-#pragma implementation "pkglib/configuration.h"
+#pragma implementation "apt-pkg/configuration.h"
 #endif
-#include <pkglib/configuration.h>
+#include <apt-pkg/configuration.h>
 #include <strutl.h>
 
 #include <stdio.h>
diff --git a/apt-pkg/contrib/configuration.h b/apt-pkg/contrib/configuration.h
index bd06f5e37..9229a0f66 100644
--- a/apt-pkg/contrib/configuration.h
+++ b/apt-pkg/contrib/configuration.h
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: configuration.h,v 1.2 1998/07/09 05:12:34 jgg Exp $
+// $Id: configuration.h,v 1.3 1998/07/12 23:58:45 jgg Exp $
 /* ######################################################################
 
    Configuration Class
@@ -25,7 +25,7 @@
 #define PKGLIB_CONFIGURATION_H
 
 #ifdef __GNUG__
-#pragma interface "pkglib/configuration.h"
+#pragma interface "apt-pkg/configuration.h"
 #endif 
 
 #include <string>
diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc
index d1ea1b87b..d31aaf1b1 100644
--- a/apt-pkg/contrib/error.cc
+++ b/apt-pkg/contrib/error.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: error.cc,v 1.2 1998/07/07 04:17:10 jgg Exp $
+// $Id: error.cc,v 1.3 1998/07/12 23:58:46 jgg Exp $
 /* ######################################################################
    
    Global Erorr Class - Global error mechanism
@@ -15,7 +15,7 @@
 									/*}}}*/
 // Include Files							/*{{{*/
 #ifdef __GNUG__
-#pragma implementation "pkglib/error.h"
+#pragma implementation "apt-pkg/error.h"
 #endif 
 
 #include <errno.h>
@@ -23,7 +23,7 @@
 #include <string.h>
 #include <stdarg.h>
 
-#include <pkglib/error.h>
+#include <apt-pkg/error.h>
    									/*}}}*/
 
 GlobalError *_error = new GlobalError;
diff --git a/apt-pkg/contrib/error.h b/apt-pkg/contrib/error.h
index 06367592b..5d015c417 100644
--- a/apt-pkg/contrib/error.h
+++ b/apt-pkg/contrib/error.h
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: error.h,v 1.2 1998/07/07 04:17:11 jgg Exp $
+// $Id: error.h,v 1.3 1998/07/12 23:58:47 jgg Exp $
 /* ######################################################################
    
    Global Erorr Class - Global error mechanism
@@ -42,7 +42,7 @@
 #define PKGLIB_ERROR_H
 
 #ifdef __GNUG__
-#pragma interface "pkglib/error.h"
+#pragma interface "apt-pkg/error.h"
 #endif 
 
 #include <string>
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 29b12bef1..1b087696d 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: fileutl.cc,v 1.3 1998/07/07 04:17:12 jgg Exp $
+// $Id: fileutl.cc,v 1.4 1998/07/12 23:58:48 jgg Exp $
 /* ######################################################################
    
    File Utilities
@@ -15,10 +15,10 @@
 									/*}}}*/
 // Include Files							/*{{{*/
 #ifdef __GNUG__
-#pragma implementation "pkglib/fileutl.h"
+#pragma implementation "apt-pkg/fileutl.h"
 #endif 
-#include <pkglib/fileutl.h>
-#include <pkglib/error.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/error.h>
 
 #include <unistd.h>
 #include <sys/stat.h>
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index aa2d2ee2e..3328ce2b4 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: fileutl.h,v 1.2 1998/07/07 04:17:13 jgg Exp $
+// $Id: fileutl.h,v 1.3 1998/07/12 23:58:49 jgg Exp $
 /* ######################################################################
    
    File Utilities
@@ -23,7 +23,7 @@
 #define PKGLIB_FILEUTL_H
 
 #ifdef __GNUG__
-#pragma interface "pkglib/fileutl.h"
+#pragma interface "apt-pkg/fileutl.h"
 #endif 
 
 #include <string>
diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc
index c0cc13f00..ccb706eab 100644
--- a/apt-pkg/contrib/mmap.cc
+++ b/apt-pkg/contrib/mmap.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: mmap.cc,v 1.4 1998/07/07 04:17:14 jgg Exp $
+// $Id: mmap.cc,v 1.5 1998/07/12 23:58:50 jgg Exp $
 /* ######################################################################
    
    MMap Class - Provides 'real' mmap or a faked mmap using read().
@@ -22,12 +22,12 @@
 									/*}}}*/
 // Include Files							/*{{{*/
 #ifdef __GNUG__
-#pragma implementation "pkglib/mmap.h"
+#pragma implementation "apt-pkg/mmap.h"
 #endif 
 
 #define _BSD_SOURCE
-#include <pkglib/mmap.h>
-#include <pkglib/error.h>
+#include <apt-pkg/mmap.h>
+#include <apt-pkg/error.h>
 
 #include <sys/mman.h>
 #include <sys/stat.h>
diff --git a/apt-pkg/contrib/mmap.h b/apt-pkg/contrib/mmap.h
index 55feda741..0e80c15d2 100644
--- a/apt-pkg/contrib/mmap.h
+++ b/apt-pkg/contrib/mmap.h
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: mmap.h,v 1.3 1998/07/07 04:17:15 jgg Exp $
+// $Id: mmap.h,v 1.4 1998/07/12 23:58:51 jgg Exp $
 /* ######################################################################
    
    MMap Class - Provides 'real' mmap or a faked mmap using read().
@@ -27,11 +27,11 @@
 #define PKGLIB_MMAP_H
 
 #ifdef __GNUG__
-#pragma interface "pkglib/mmap.h"
+#pragma interface "apt-pkg/mmap.h"
 #endif
 
 #include <string>
-#include <pkglib/fileutl.h>
+#include <apt-pkg/fileutl.h>
 
 class MMap
 {
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 3c82ee51d..7587760b5 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: deblistparser.cc,v 1.5 1998/07/09 05:12:37 jgg Exp $
+// $Id: deblistparser.cc,v 1.6 1998/07/12 23:58:52 jgg Exp $
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
@@ -10,9 +10,9 @@
    ##################################################################### */
 									/*}}}*/
 // Include Files							/*{{{*/
-#include <pkglib/deblistparser.h>
-#include <pkglib/error.h>
-#include <pkglib/configuration.h>
+#include <apt-pkg/deblistparser.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/configuration.h>
 #include <strutl.h>
 
 #include <system.h>
diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h
index c7a97c16a..63e78a988 100644
--- a/apt-pkg/deb/deblistparser.h
+++ b/apt-pkg/deb/deblistparser.h
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: deblistparser.h,v 1.3 1998/07/05 05:34:01 jgg Exp $
+// $Id: deblistparser.h,v 1.4 1998/07/12 23:58:54 jgg Exp $
 /* ######################################################################
    
    Debian Package List Parser - This implements the abstract parser 
@@ -12,8 +12,8 @@
 #ifndef PKGLIB_DEBLISTPARSER_H
 #define PKGLIB_DEBLISTPARSER_H
 
-#include <pkglib/pkgcachegen.h>
-#include <pkglib/tagfile.h>
+#include <apt-pkg/pkgcachegen.h>
+#include <apt-pkg/tagfile.h>
 
 class debListParser : public pkgCacheGenerator::ListParser
 {
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index a7784c0a5..71a0d02a2 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: depcache.cc,v 1.1 1998/07/07 04:17:01 jgg Exp $
+// $Id: depcache.cc,v 1.2 1998/07/12 23:58:24 jgg Exp $
 /* ######################################################################
 
    Dependency Cache - Caches Dependency information.
@@ -9,12 +9,12 @@
 									/*}}}*/
 // Include Files							/*{{{*/
 #ifdef __GNUG__
-#pragma implementation "pkglib/depcache.h"
+#pragma implementation "apt-pkg/depcache.h"
 #endif
-#include <pkglib/depcache.h>
+#include <apt-pkg/depcache.h>
 
-#include <pkglib/version.h>
-#include <pkglib/error.h>
+#include <apt-pkg/version.h>
+#include <apt-pkg/error.h>
 									/*}}}*/
 
 // DepCache::pkgDepCache - Constructors					/*{{{*/
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index 39ed215b2..6cb8c1187 100644
--- a/apt-pkg/depcache.h
+++ b/apt-pkg/depcache.h
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: depcache.h,v 1.2 1998/07/12 01:26:01 jgg Exp $
+// $Id: depcache.h,v 1.3 1998/07/12 23:58:25 jgg Exp $
 /* ######################################################################
 
    DepCache - Dependency Extension data for the cache
@@ -40,10 +40,10 @@
 #define PKGLIB_DEPCACHE_H
 
 #ifdef __GNUG__
-#pragma interface "pkglib/depcache.h"
+#pragma interface "apt-pkg/depcache.h"
 #endif
 
-#include <pkglib/pkgcache.h>
+#include <apt-pkg/pkgcache.h>
 
 class pkgDepCache : public pkgCache
 {
diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc
index 5dd7b58aa..a93e65c1a 100644
--- a/apt-pkg/init.cc
+++ b/apt-pkg/init.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: init.cc,v 1.1 1998/07/09 05:12:27 jgg Exp $
+// $Id: init.cc,v 1.2 1998/07/12 23:58:26 jgg Exp $
 /* ######################################################################
 
    Init - Initialize the package library
@@ -8,7 +8,7 @@
    ##################################################################### */
 									/*}}}*/
 // Include files							/*{{{*/
-#include <pkglib/init.h>
+#include <apt-pkg/init.h>
 									/*}}}*/
 
 // pkglibInitialize - Initialize the configuration class		/*{{{*/
diff --git a/apt-pkg/init.h b/apt-pkg/init.h
index bd03dd10d..ecfe702d4 100644
--- a/apt-pkg/init.h
+++ b/apt-pkg/init.h
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: init.h,v 1.1 1998/07/09 05:12:27 jgg Exp $
+// $Id: init.h,v 1.2 1998/07/12 23:58:27 jgg Exp $
 /* ######################################################################
 
    Init - Initialize the package library
@@ -14,7 +14,7 @@
 #ifndef PKGLIB_INIT_H
 #define PKGLIB_INIT_H
 
-#include <pkglib/configuration.h>
+#include <apt-pkg/configuration.h>
 
 bool pkglibInitialize(Configuration &Cnf);
 
diff --git a/apt-pkg/makefile b/apt-pkg/makefile
new file mode 100644
index 000000000..f6a5d003c
--- /dev/null
+++ b/apt-pkg/makefile
@@ -0,0 +1,38 @@
+# -*- make -*-
+BASE=..
+
+# Header location
+SUBDIRS = deb contrib
+HEADER_TARGETDIRS = apt-pkg
+
+# Bring in the default rules
+include ../buildlib/defaults.mak
+
+# The library name
+LIBRARY=apt-pkg
+MAJOR=2
+MINOR=0.0
+
+# Source code for the contributed non-core things
+SOURCE = contrib/mmap.cc contrib/error.cc contrib/strutl.cc \
+         contrib/configuration.cc
+	 
+# Source code for the main library
+SOURCE+= pkgcache.cc version.cc fileutl.cc pkgcachegen.cc depcache.cc \
+         orderlist.cc tagfile.cc sourcelist.cc packagemanager.cc \
+	 algorithms.cc init.cc templates.cc
+	 
+# Source code for the debian specific components	 
+SOURCE+= deb/deblistparser.cc
+
+# Public apt-pkg header files
+HEADERS = algorithms.h depcache.h mmap.h pkgcachegen.h cacheiterators.h \
+          error.h orderlist.h sourcelist.h configuration.h fileutl.h \
+          packagemanager.h tagfile.h deblistparser.h init.h pkgcache.h \
+          version.h
+HEADERS := $(addprefix apt-pkg/,$(HEADERS))
+
+# Private header files
+HEADERS+= strutl.h system.h
+
+include $(LIBRARY_H)
diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc
index f79a063bd..85d35d5a1 100644
--- a/apt-pkg/orderlist.cc
+++ b/apt-pkg/orderlist.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: orderlist.cc,v 1.1 1998/07/07 04:17:01 jgg Exp $
+// $Id: orderlist.cc,v 1.2 1998/07/12 23:58:28 jgg Exp $
 /* ######################################################################
 
    Order List - Represents and Manipulates an ordered list of packages.
@@ -50,12 +50,12 @@
 									/*}}}*/
 // Include Files							/*{{{*/
 #ifdef __GNUG__
-#pragma implementation "pkglib/orderlist.h"
+#pragma implementation "apt-pkg/orderlist.h"
 #endif 
-#include <pkglib/orderlist.h>
-#include <pkglib/depcache.h>
-#include <pkglib/error.h>
-#include <pkglib/version.h>
+#include <apt-pkg/orderlist.h>
+#include <apt-pkg/depcache.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/version.h>
 									/*}}}*/
 
 pkgOrderList *pkgOrderList::Me = 0;
diff --git a/apt-pkg/orderlist.h b/apt-pkg/orderlist.h
index 0dc8a5038..2065fc4c8 100644
--- a/apt-pkg/orderlist.h
+++ b/apt-pkg/orderlist.h
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: orderlist.h,v 1.1 1998/07/07 04:17:01 jgg Exp $
+// $Id: orderlist.h,v 1.2 1998/07/12 23:58:29 jgg Exp $
 /* ######################################################################
 
    Order List - Represents and Manipulates an ordered list of packages.
@@ -18,10 +18,10 @@
 #define PKGLIB_ORDERLIST_H
 
 #ifdef __GNUG__
-#pragma interface "pkglib/orderlist.h"
+#pragma interface "apt-pkg/orderlist.h"
 #endif 
 
-#include <pkglib/pkgcache.h>
+#include <apt-pkg/pkgcache.h>
 
 class pkgDepCache;
 class pkgOrderList
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index afe5fc176..1780dff09 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: packagemanager.cc,v 1.3 1998/07/12 01:26:02 jgg Exp $
+// $Id: packagemanager.cc,v 1.4 1998/07/12 23:58:30 jgg Exp $
 /* ######################################################################
 
    Package Manager - Abstacts the package manager
@@ -14,13 +14,13 @@
 									/*}}}*/
 // Include Files							/*{{{*/
 #ifdef __GNUG__
-#pragma implementation "pkglib/packagemanager.h"
+#pragma implementation "apt-pkg/packagemanager.h"
 #endif
-#include <pkglib/packagemanager.h>
-#include <pkglib/orderlist.h>
-#include <pkglib/depcache.h>
-#include <pkglib/error.h>
-#include <pkglib/version.h>
+#include <apt-pkg/packagemanager.h>
+#include <apt-pkg/orderlist.h>
+#include <apt-pkg/depcache.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/version.h>
 									/*}}}*/
 
 // PM::PackageManager - Constructor					/*{{{*/
diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h
index 5f1b34635..a097712a3 100644
--- a/apt-pkg/packagemanager.h
+++ b/apt-pkg/packagemanager.h
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: packagemanager.h,v 1.2 1998/07/09 05:41:13 jgg Exp $
+// $Id: packagemanager.h,v 1.3 1998/07/12 23:58:31 jgg Exp $
 /* ######################################################################
 
    Package Manager - Abstacts the package manager
@@ -25,11 +25,11 @@
 #define PKGLIB_PACKAGEMANAGER_H
 
 #ifdef __GNUG__
-#pragma interface "pkglib/packagemanager.h"
+#pragma interface "apt-pkg/packagemanager.h"
 #endif
 
 #include <string>
-#include <pkglib/pkgcache.h>
+#include <apt-pkg/pkgcache.h>
 
 class pkgAquire;
 class pkgDepCache;
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index b8af6b5e4..20590e971 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -1,11 +1,11 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: pkgcache.cc,v 1.6 1998/07/12 01:26:04 jgg Exp $
+// $Id: pkgcache.cc,v 1.7 1998/07/12 23:58:32 jgg Exp $
 /* ######################################################################
    
    Package Cache - Accessor code for the cache
    
-   Please see doc/pkglib/cache.sgml for a more detailed description of 
+   Please see doc/apt-pkg/cache.sgml for a more detailed description of 
    this format. Also be sure to keep that file up-to-date!!
    
    This is the general utility functions for cache managment. They provide
@@ -21,12 +21,12 @@
 									/*}}}*/
 // Include Files							/*{{{*/
 #ifdef __GNUG__
-#pragma implementation "pkglib/pkgcache.h"
-#pragma implementation "pkglib/cacheiterators.h"
+#pragma implementation "apt-pkg/pkgcache.h"
+#pragma implementation "apt-pkg/cacheiterators.h"
 #endif 
-#include <pkglib/pkgcache.h>
-#include <pkglib/version.h>
-#include <pkglib/error.h>
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/version.h>
+#include <apt-pkg/error.h>
 #include <system.h>
 
 #include <string>
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index 852949b1f..5ff29cfb4 100644
--- a/apt-pkg/pkgcache.h
+++ b/apt-pkg/pkgcache.h
@@ -1,11 +1,11 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: pkgcache.h,v 1.5 1998/07/07 04:17:03 jgg Exp $
+// $Id: pkgcache.h,v 1.6 1998/07/12 23:58:33 jgg Exp $
 /* ######################################################################
    
    Cache - Structure definitions for the cache file
    
-   Please see doc/pkglib/cache.sgml for a more detailed description of 
+   Please see doc/apt-pkg/cache.sgml for a more detailed description of 
    this format. Also be sure to keep that file up-to-date!!
    
    Clients should always use the CacheIterators classes for access to the
@@ -21,12 +21,12 @@
 #define PKGLIB_PKGCACHE_H
 
 #ifdef __GNUG__
-#pragma interface "pkglib/pkgcache.h"
+#pragma interface "apt-pkg/pkgcache.h"
 #endif 
 
 #include <string>
 #include <time.h>
-#include <pkglib/mmap.h>
+#include <apt-pkg/mmap.h>
 
 class pkgCache
 {
@@ -258,7 +258,7 @@ struct pkgCache::StringItem
    unsigned long NextItem;      // StringItem
 };
 
-#include <pkglib/cacheiterators.h>
+#include <apt-pkg/cacheiterators.h>
 
 inline pkgCache::PkgIterator pkgCache::PkgBegin() 
        {return PkgIterator(*this);};
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index 3e37c74f3..e0f8f3a19 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: pkgcachegen.cc,v 1.8 1998/07/09 05:12:27 jgg Exp $
+// $Id: pkgcachegen.cc,v 1.9 1998/07/12 23:58:34 jgg Exp $
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
@@ -11,12 +11,12 @@
 									/*}}}*/
 // Include Files							/*{{{*/
 #ifdef __GNUG__
-#pragma implementation "pkglib/pkgcachegen.h"
+#pragma implementation "apt-pkg/pkgcachegen.h"
 #endif
 
-#include <pkglib/pkgcachegen.h>
-#include <pkglib/error.h>
-#include <pkglib/version.h>
+#include <apt-pkg/pkgcachegen.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/version.h>
 #include <strutl.h>
 
 #include <sys/stat.h>
diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h
index c883828eb..0a4881057 100644
--- a/apt-pkg/pkgcachegen.h
+++ b/apt-pkg/pkgcachegen.h
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: pkgcachegen.h,v 1.4 1998/07/07 04:17:05 jgg Exp $
+// $Id: pkgcachegen.h,v 1.5 1998/07/12 23:58:35 jgg Exp $
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
@@ -14,10 +14,10 @@
 #define PKGLIB_PKGCACHEGEN_H
 
 #ifdef __GNUG__
-#pragma interface "pkglib/pkgcachegen.h"
+#pragma interface "apt-pkg/pkgcachegen.h"
 #endif 
 
-#include <pkglib/pkgcache.h>
+#include <apt-pkg/pkgcache.h>
 
 class pkgCacheGenerator
 {
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc
index bce3e5990..f9de99584 100644
--- a/apt-pkg/sourcelist.cc
+++ b/apt-pkg/sourcelist.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: sourcelist.cc,v 1.2 1998/07/09 05:12:28 jgg Exp $
+// $Id: sourcelist.cc,v 1.3 1998/07/12 23:58:36 jgg Exp $
 /* ######################################################################
 
    List of Sources
@@ -9,13 +9,13 @@
 									/*}}}*/
 // Include Files							/*{{{*/
 #ifdef __GNUG__
-#pragma implementation "pkglib/sourcelist.h"
+#pragma implementation "apt-pkg/sourcelist.h"
 #endif
 
-#include <pkglib/sourcelist.h>
-#include <pkglib/error.h>
-#include <pkglib/fileutl.h>
-#include <pkglib/configuration.h>
+#include <apt-pkg/sourcelist.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/configuration.h>
 #include <strutl.h>
 
 #include <fstream.h>
diff --git a/apt-pkg/sourcelist.h b/apt-pkg/sourcelist.h
index 43739fbcd..57a648b97 100644
--- a/apt-pkg/sourcelist.h
+++ b/apt-pkg/sourcelist.h
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: sourcelist.h,v 1.2 1998/07/09 05:12:31 jgg Exp $
+// $Id: sourcelist.h,v 1.3 1998/07/12 23:58:38 jgg Exp $
 /* ######################################################################
 
    SourceList - Manage a list of sources
@@ -17,10 +17,10 @@
 #include <string>
 #include <vector>
 #include <iostream.h>
-#include <pkglib/pkgcache.h>
+#include <apt-pkg/pkgcache.h>
 
 #ifdef __GNUG__
-#pragma interface "pkglib/sourcelist.h"
+#pragma interface "apt-pkg/sourcelist.h"
 #endif
 
 class pkgAquire;
diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc
index aaef3da8b..42a44453f 100644
--- a/apt-pkg/tagfile.cc
+++ b/apt-pkg/tagfile.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: tagfile.cc,v 1.6 1998/07/09 05:12:32 jgg Exp $
+// $Id: tagfile.cc,v 1.7 1998/07/12 23:58:39 jgg Exp $
 /* ######################################################################
 
    Fast scanner for RFC-822 type header information
@@ -12,12 +12,12 @@
 									/*}}}*/
 // Include Files							/*{{{*/
 #ifdef __GNUG__
-#pragma implementation "pkglib/tagfile.h"
+#pragma implementation "apt-pkg/tagfile.h"
 #endif
 
-#include <pkglib/tagfile.h>
-#include <pkglib/error.h>
-#include <pkglib/init.h>
+#include <apt-pkg/tagfile.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/init.h>
 
 #include <string>
 #include <stdio.h>
@@ -153,90 +153,3 @@ bool pkgTagSection::Find(const char *Tag,const char *&Start,
    return false;
 }
 									/*}}}*/
-
-#include <pkglib/pkgcachegen.h>
-#include <pkglib/deblistparser.h>
-
-int main(int argc,char *argv[])
-{
-   pkglibInitialize(*_config);
-   cout << _config->Find("APT::arch") << endl;
-   cout << _config->FindDir("DIR::Etc::sourcelist") << endl;
-   
-   {
-      File CacheF("./cache",File::WriteEmpty);
-      DynamicMMap Map(CacheF,MMap::Public);
-      pkgCacheGenerator Gen(Map);
-
-      for (int I = 1; I != argc; I++)
-      {
-	 cout << "Merging in " << argv[I] << endl;
-	 File F(argv[I],File::ReadOnly);
-	 Gen.SelectFile(argv[I]);
-	 debListParser Parser(F);
-	 Gen.MergeList(Parser);
-      }      
-   }
-/*
-   {
-      File CacheF("./cache",File::WriteExists);
-      MMap Map(CacheF,MMap::Public | MMap::ReadOnly);
-      pkgCache Cache(Map);
-      for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
-      {
-	 cout << "Package: " << I.Name() << endl;
-	 for (pkgCache::VerIterator V = I.VersionList(); V.end() == false; V++)
-	 {
-	    cout << "Version: " << V.VerStr() << endl;
-	    cout << "Size: " << V->Size << endl;
-	    cout << "Installed-Size: " << V->InstalledSize << endl;
-	    cout << "Section: " << V.Section() << endl;
-	    cout << "Priority: " << Cache.Priority(V->Priority) << endl;
-	    
-	    pkgCache::PrvIterator P = V.ProvidesList();
-	    if (P.end() == false)
-	    {
-	       cout << "Provides: ";
-	       for (; P.end() == false; P++)
-		  cout << P.Name() << ", ";
-	       cout << endl;
-	    }	    
-	 }
-	 cout << endl;
-      }
-   }
-*/   
-#if 0 
-   pkgTagSection I;
-   while (Test.Step(I) == true)
-   {
-      const char *Start;
-      const char *End;
-      if (I.Find("Package",Start,End) == false)
-      {
-	 cout << "Failed" << endl;
-	 continue;
-      }
-      
-      cout << "Package: " << string(Start,End - Start) << endl;
-      
-/*      for (const char *I = Start; I < End; I++)
-      {
-	 const char *Begin = I;
-	 bool Number = true;
-	 while (isspace(*I) == 0 && ispunct(*I) == 0 && I < End)
-	 {
-	    if (isalpha(*I) != 0)
-	       Number = false;
-	    I++;
-	 }
-	 if (Number == false)
-	    cout << string(Begin,I-Begin) << endl;	 
-	 while ((isspace(*I) != 0 || ispunct(*I) != 0) && I < End)
-	    I++;
-	 I--;
-      }      */
-   }
-#endif   
-   _error->DumpErrors();
-}
diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h
index c1fffcf13..097eb73bd 100644
--- a/apt-pkg/tagfile.h
+++ b/apt-pkg/tagfile.h
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: tagfile.h,v 1.3 1998/07/07 04:17:07 jgg Exp $
+// $Id: tagfile.h,v 1.4 1998/07/12 23:58:40 jgg Exp $
 /* ######################################################################
 
    Fast scanner for RFC-822 type header information
@@ -22,10 +22,10 @@
 #define PKGLIB_TAGFILE_H
 
 #ifdef __GNUG__
-#pragma interface "pkglib/tagfile.h"
+#pragma interface "apt-pkg/tagfile.h"
 #endif 
 
-#include <pkglib/fileutl.h>
+#include <apt-pkg/fileutl.h>
 
 class pkgTagSection
 {
diff --git a/apt-pkg/templates.cc b/apt-pkg/templates.cc
index 0f86bde9a..1e7d202c9 100644
--- a/apt-pkg/templates.cc
+++ b/apt-pkg/templates.cc
@@ -1,5 +1,5 @@
 /* All template instances are explicly declared here */
 
-#include <pkglib/sourcelist.h>
+#include <apt-pkg/sourcelist.h>
 
 template vector<pkgSourceList::Item>;
diff --git a/apt-pkg/version.cc b/apt-pkg/version.cc
index 7eb85726c..9f245a9e7 100644
--- a/apt-pkg/version.cc
+++ b/apt-pkg/version.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: version.cc,v 1.3 1998/07/07 04:17:08 jgg Exp $
+// $Id: version.cc,v 1.4 1998/07/12 23:58:42 jgg Exp $
 /* ######################################################################
 
    Version - Version string 
@@ -18,11 +18,11 @@
 									/*}}}*/
 // Include Files							/*{{{*/
 #ifdef __GNUG__
-#pragma implementation "pkglib/version.h"
+#pragma implementation "apt-pkg/version.h"
 #endif 
 
-#include <pkglib/version.h>
-#include <pkglib/pkgcache.h>
+#include <apt-pkg/version.h>
+#include <apt-pkg/pkgcache.h>
 
 #include <stdlib.h>
 									/*}}}*/
diff --git a/apt-pkg/version.h b/apt-pkg/version.h
index 3ced5d3e4..b263d7c90 100644
--- a/apt-pkg/version.h
+++ b/apt-pkg/version.h
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: version.h,v 1.2 1998/07/07 04:17:09 jgg Exp $
+// $Id: version.h,v 1.3 1998/07/12 23:58:43 jgg Exp $
 /* ######################################################################
 
    Version - Version string 
@@ -16,7 +16,7 @@
 #define PKGLIB_VERSION_H
 
 #ifdef __GNUG__
-#pragma interface "pkglib/version.h"
+#pragma interface "apt-pkg/version.h"
 #endif 
 
 #include <string>
diff --git a/buildlib/defaults.mak b/buildlib/defaults.mak
new file mode 100644
index 000000000..b268c4b9b
--- /dev/null
+++ b/buildlib/defaults.mak
@@ -0,0 +1,101 @@
+# -*- make -*-
+
+# This file configures the default environment for the make system
+# The way it works is fairly simple, each module is defined in it's
+# own *.mak file. It expects a set of variables to be set to values
+# for it to operate as expected. When included the module generates
+# the requested rules based on the contents of its control variables.
+
+# This works out very well and allows a good degree of flexability.
+# To accomidate some of the features we introduce the concept of 
+# local variables. To do this we use the 'Computed Names' feature of
+# gmake. Each module declares a LOCAL scope and access it with,
+#   $($(LOCAL)-VAR)
+# This works very well but it is important to rembember that within
+# a rule the LOCAL var is unavailble, it will have to be constructed
+# from the information in the rule invokation. For stock rules like 
+# clean this is simple, we use a local clean rule called clean/$(LOCAL)
+# and then within the rule $(@F) gets back $(LOCAL)! Other rules will
+# have to use some other mechanism (filter perhaps?) The reason such
+# lengths are used is so that each directory can contain several 'instances'
+# of any given module
+
+# A build directory is used by default, all generated items get put into
+# there. However unlike automake this is not done with a VPATH build
+# (vpath builds break the distinction between #include "" and #include <>)
+# but by explicly setting the BUILD variable. Make is invoked from
+# within the source itself which is much more compatible with compilation
+# environments.
+
+ifndef BUILD
+BUILD=$(BASE)/build
+endif
+
+# Base definitions
+INCLUDE := $(BUILD)/include
+BIN := $(BUILD)/bin
+LIB := $(BIN)
+OBJ := $(BUILD)/obj
+DEP := $(OBJ)
+
+# Module types
+LIBRARY_H=$(BASE)/buildlib/library.mak
+
+# Source location control
+# SUBDIRS specifies sub components of the module that
+# may be located in subdrictories of the source dir. 
+# This should be declared before including this file
+SUBDIRS+=
+
+# Header file control. 
+# TARGETDIRS indicitates all of the locations that public headers 
+# will be published to.
+# This should be declared before including this file
+HEADER_TARGETDIRS+=
+
+# Options
+CXX = c++
+CC = cc
+CPPFLAGS+= -I$(INCLUDE)
+CXXFLAGS+= -Wall -g -fno-implicit-templates  -fno-exceptions
+PICFLAGS+= -fPIC -DPIC
+LFLAGS+= 
+INLINEDEPFLAG = -MD
+
+# Phony rules. Other things hook these by appending to the dependency
+# list
+.PHONY: headers library clean veryclean all binary program
+all: binary
+binary: library program
+headers library clean veryclean program:
+
+# Header file control. We want all published interface headers to go
+# into the build directory from thier source dirs. We setup some
+# search paths here
+vpath %.h $(SUBDIRS)
+$(INCLUDE)/%.h $(addprefix $(INCLUDE)/,$(addsuffix /%.h,$(HEADER_TARGETDIRS))) : %.h
+	cp $< $@
+
+# Dependency generation. We want to generate a .d file using gnu cpp.
+# For GNU systems the compiler can spit out a .d file while it is compiling,
+# this is specified with the INLINEDEPFLAG. Other systems might have a 
+# makedep program that can be called after compiling, that's illistrated
+# by the DEPFLAG case.
+# Compile rules are expected to call this macro after calling the compiler
+ ifdef INLINEDEPFLAG
+ define DoDep
+	sed -e "1s/.*:/$(subst /,\\/,$@):/" $(basename $(@F)).d > $(DEP)/$(basename $(@F)).d
+	-rm -f $(basename $(@F)).d
+ endef
+else
+ ifdef DEPFLAG
+  define DoDep
+	$(CXX) $(DEPFLAG) $(CPPFLAGS) -o $@ $<
+	sed -e "1s/.*:/$(subst /,\\/,$@):/" $(basename $(@F)).d > $(DEP)/$(basename $(@F)).d
+	-rm -f $(basename $(@F)).d
+  endef
+ else
+  define DoDep
+  endef
+ endif
+endif	
diff --git a/buildlib/library.mak b/buildlib/library.mak
new file mode 100644
index 000000000..1b814875f
--- /dev/null
+++ b/buildlib/library.mak
@@ -0,0 +1,61 @@
+# -*- make -*-
+
+# This creates a shared library.
+
+# Input
+# $(SOURCE) - The source code to use
+# $(HEADERS) - Exported header files and private header files
+# $(LIBRARY) - The name of the library without lib or .so 
+# $(MAJOR) - The major version number of this library
+# $(MINOR) - The minor version number of this library
+
+# All output is writtin to .opic files in the build directory to
+# signify the PIC output.
+
+# See defaults.mak for information about LOCAL
+
+# Some local definitions
+LOCAL := lib$(LIBRARY).so.$(MAJOR).$(MINOR)
+$(LOCAL)-OBJS := $(addprefix $(OBJ)/,$(addsuffix .opic,$(notdir $(basename $(SOURCE)))))
+$(LOCAL)-DEP := $(addprefix $(DEP)/,$(addsuffix .d,$(notdir $(basename $(SOURCE)))))
+$(LOCAL)-HEADERS := $(addprefix $(INCLUDE)/,$(HEADERS))
+$(LOCAL)-SONAME := lib$(LIBRARY).so.$(MAJOR)
+
+# Install the command hooks
+headers: $($(LOCAL)-HEADERS)
+library: $(LIB)/lib$(LIBRARY).so $(LIB)/lib$(LIBRARY).so.$(MAJOR)
+clean: clean/$(LOCAL)
+veryclean: veryclean/$(LOCAL)
+
+# The clean rules
+.PHONY: clean/$(LOCAL) veryclean/$(LOCAL)
+clean/$(LOCAL):
+	-rm -f $($(@F)-OBJS) $($(@F)-DEP)
+veryclean/$(LOCAL): clean/$(LOCAL)
+	-rm -f $($(@F)-HEADERS) $(LIB)/lib$(LIBRARY).so*
+
+# Build rules for the two symlinks
+.PHONY: $(LIB)/lib$(LIBRARY).so.$(MAJOR) $(LIB)/lib$(LIBRARY).so
+$(LIB)/lib$(LIBRARY).so.$(MAJOR): $(LIB)/lib$(LIBRARY).so.$(MAJOR).$(MINOR)
+	ln -sf $(<F) $@
+$(LIB)/lib$(LIBRARY).so: $(LIB)/lib$(LIBRARY).so.$(MAJOR).$(MINOR)
+	ln -sf $(<F) $@
+	
+# The binary build rule
+$(LIB)/lib$(LIBRARY).so.$(MAJOR).$(MINOR): $($(LOCAL)-HEADERS) $($(LOCAL)-OBJS)
+	echo Building shared library $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(PICFLAGS) $(LFLAGS) -o $@ \
+	   -Wl,-soname -Wl,$($(@F)-SONAME) -shared $(filter %.opic,$^)
+
+# Compilation rules
+vpath %.cc $(SUBDIRS)
+$(OBJ)/%.opic: %.cc
+	echo Compiling $< to $@
+	$(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) $(PICFLAGS) -o $@ $<
+	$(DoDep)
+
+# Include the dependencies that are available
+The_DFiles = $(wildcard $($(LOCAL)-DEP))
+ifneq ($(words $(The_DFiles)),0)
+include $(The_DFiles)
+endif 
-- 
2.47.2