pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/45047: pkgtools/pkg_install minix support



The following reply was made to PR pkg/45047; it has been noted by GNATS.

From: Thomas Cort <tcort%minix3.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: pkg/45047: pkgtools/pkg_install minix support
Date: Tue, 19 Jul 2011 09:07:03 -0400

 After submitting the original patch, Minix got a new C library and headers.
 The C library and headers were ported from NetBSD. The caused us to make a
 change (disabling db in libnbcompat). An updated patch follows.
 
 Patch Summary:
 
  * Since Minix's new NetBSD-based C library has the db stuff, we pass
    the --disable-db parameter to libnbcompat's configure script. Other
    systems still pass --enable-db.
 
  * When ${OPSYS} = Minix, add "-larchive -lbz2 -lz" to LIBS. Without
    explicitly listing the libraries, linking fails with undefined
    reference errors.
 
  * Add a normalisation function to build a proper release string. On
    Minix, the "3.2.0" release is represented as release "3" version "2.0".
 
  * Check for gar and ar since some Minix systems use GNU ar (gar) instead
    of ar.
 
 diff --git a/pkgtools/pkg_install/Makefile b/pkgtools/pkg_install/Makefile
 index 392093c..ace0688 100644
 --- a/pkgtools/pkg_install/Makefile
 +++ b/pkgtools/pkg_install/Makefile
 @@ -28,7 +28,7 @@ CONFIGURE_ARGS+=     --with-pkgdbdir=${PKG_DBDIR:Q}
  
  USE_FEATURES=         nbcompat
  
 -NBCOMPAT_CONFIGURE_ARGS+=     --enable-bsd-getopt --enable-db
 +NBCOMPAT_CONFIGURE_ARGS+=     --enable-bsd-getopt
  
  SKIP_AUDIT_PACKAGES=  yes
  NO_PKGTOOLS_REQD_CHECK=       yes
 @@ -86,6 +86,12 @@ VERSION!=           ${AWK} '/PKGTOOLS_VERSION/ {print $$3}' 
\
  # raw format appeared in libarchive 2.8.
  BUILDLINK_API_DEPENDS.libarchive+=    libarchive>=2.8.0
  
 +.if ${OPSYS} == "Minix"
 +NBCOMPAT_CONFIGURE_ARGS+=     --disable-db
 +.else
 +NBCOMPAT_CONFIGURE_ARGS+=     --enable-db
 +.endif
 +
  .include "../../archivers/bzip2/builtin.mk"
  .include "../../archivers/libarchive/builtin.mk"
  .include "../../devel/zlib/builtin.mk"
 @@ -142,6 +148,10 @@ LIBS+=            -larchive
  CPPFLAGS+=    -I${WRKDIR}/libfetch
  LDFLAGS+=     -L${WRKDIR}/libfetch
  
 +.  if ${OPSYS} == "Minix"
 +LIBS+=                -larchive -lbz2 -lz
 +.  endif
 +
  CONFIGURE_ENV+=       LIBS=${LIBS:Q}
  
  do-extract:
 diff --git a/pkgtools/pkg_install/files/add/perform.c 
b/pkgtools/pkg_install/files/add/perform.c
 index aa3dff3..c87aa5b 100644
 --- a/pkgtools/pkg_install/files/add/perform.c
 +++ b/pkgtools/pkg_install/files/add/perform.c
 @@ -858,18 +860,63 @@ pkg_register_depends(struct pkg_task *pkg)
        free(text);
  }
  
 +#ifdef __minix
 +static int
 +normalise_version(char *release, char *version)
 +{
 +      char actual_version[50];
 +      int l1, l2;
 +
 +      if (release == NULL || version == NULL) {
 +              warnx("release or version information not present");
 +              return -1;
 +      }
 +
 +      l1 = strlen(release);
 +      l2 = strlen(version);
 +
 +      if (l1 + l2 + 2 >= sizeof(actual_version)) {
 +              warnx("not enough space to normalise version");
 +              return -1;
 +      }
 +
 +      if (l1 > 0 && l2 > 0) {
 +              snprintf(actual_version, sizeof(actual_version),
 +                      "%s.%s", release, version);
 +      } else if (strlen(release) > 0) {
 +              strncpy(actual_version, release, sizeof(actual_version)-1);
 +      } else if (strlen(version) > 0) {
 +              strncpy(actual_version, version, sizeof(actual_version)-1);
 +      } else {
 +              warnx("cannot determine version information");
 +              return -1;
 +      }
 +
 +      strcpy(release, actual_version);
 +      version[0] = '\0';
 +
 +      return 0;
 +}
 +#endif
 +
  /*
   * Reduce the result from uname(3) to a canonical form.
   */
 -static void
 +static int
  normalise_platform(struct utsname *host_name)
  {
 +      int rc = 0;
 +
  #ifdef NUMERIC_VERSION_ONLY
        size_t span;
  
        span = strspn(host_name->release, "0123456789.");
        host_name->release[span] = '\0';
  #endif
 +#ifdef __minix
 +      rc = normalise_version(host_name->release, host_name->version);
 +#endif
 +      return rc;
  }
  
  /*
 @@ -892,7 +939,9 @@ check_platform(struct pkg_task *pkg)
                }
        }
  
 -      normalise_platform(&host_uname);
 +      if (normalise_platform(&host_uname)) {
 +              return -1;
 +      }
  
        if (OverrideMachine != NULL)
                effective_arch = OverrideMachine;
 diff --git a/pkgtools/pkg_install/files/configure.ac 
b/pkgtools/pkg_install/files/configure.ac
 index ece6517..74da9ff 100644
 --- a/pkgtools/pkg_install/files/configure.ac
 +++ b/pkgtools/pkg_install/files/configure.ac
 @@ -16,7 +16,7 @@ AC_PROG_CC
  AC_PROG_INSTALL
  AC_PROG_LN_S
  AC_PROG_RANLIB
 -AC_CHECK_PROG(AR, ar, ar)
 +AC_CHECK_PROGS(AR, [gar ar])
  
  AC_PATH_PROG(CHMOD, chmod)
  AC_PATH_PROG(CMP, cmp)
 


Home | Main Index | Thread Index | Old Index