3
0
Fork 0
forked from mirrors/nixpkgs

xar: fix cross compilation

This commit is contained in:
Andrew Childs 2020-11-19 16:30:16 +09:00
parent 2931a2e1d5
commit 1fc0499569
3 changed files with 193 additions and 5 deletions

View file

@ -0,0 +1,95 @@
From a14be07c0aae3bf6f732d1ca5f625ba375702121 Mon Sep 17 00:00:00 2001
From: Andrew Childs <andrew.childs@bibo.com.ph>
Date: Sun, 15 Nov 2020 19:12:33 +0900
Subject: [PATCH 1/2] Add useless descriptions to AC_DEFINE
Removes autoheader warnings.
---
configure.ac | 42 +++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/configure.ac b/configure.ac
index 812b5ff..358ab89 100644
--- a/configure.ac
+++ b/configure.ac
@@ -210,48 +210,48 @@ AC_CHECK_MEMBERS([struct stat.st_flags])
AC_CHECK_SIZEOF(uid_t)
if test $ac_cv_sizeof_uid_t = "4"; then
-AC_DEFINE(UID_STRING, RId32)
-AC_DEFINE(UID_CAST, (uint32_t))
+AC_DEFINE([UID_STRING], RId32, [UID_STRING])
+AC_DEFINE([UID_CAST], (uint32_t), [UID_CAST])
elif test $ac_cv_sizeof_uid_t = "8"; then
-AC_DEFINE(UID_STRING, PRId64)
-AC_DEFINE(UID_CAST, (uint64_t))
+AC_DEFINE([UID_STRING], PRId64, [UID_STRING])
+AC_DEFINE([UID_CAST], (uint64_t), [UID_CAST])
else
AC_ERROR(can not detect the size of your system's uid_t type)
fi
AC_CHECK_SIZEOF(gid_t)
if test $ac_cv_sizeof_gid_t = "4"; then
-AC_DEFINE(GID_STRING, PRId32)
-AC_DEFINE(GID_CAST, (uint32_t))
+AC_DEFINE([GID_STRING], PRId32, [GID_STRING])
+AC_DEFINE([GID_CAST], (uint32_t), [GID_CAST])
elif test $ac_cv_sizeof_gid_t = "8"; then
-AC_DEFINE(GID_STRING, PRId64)
-AC_DEFINE(GID_CAST, (uint64_t))
+AC_DEFINE([GID_STRING], PRId64, [GID_STRING])
+AC_DEFINE([GID_CAST], (uint64_t), [GID_CAST])
else
AC_ERROR(can not detect the size of your system's gid_t type)
fi
AC_CHECK_SIZEOF(ino_t)
if test $ac_cv_sizeof_ino_t = "4"; then
-AC_DEFINE(INO_STRING, PRId32)
-AC_DEFINE(INO_HEXSTRING, PRIx32)
-AC_DEFINE(INO_CAST, (uint32_t))
+AC_DEFINE([INO_STRING], PRId32, [INO_STRING])
+AC_DEFINE([INO_HEXSTRING], PRIx32, [INO_HEXSTRING])
+AC_DEFINE([INO_CAST], (uint32_t), [INO_CAST])
elif test $ac_cv_sizeof_ino_t = "8"; then
-AC_DEFINE(INO_STRING, PRId64)
-AC_DEFINE(INO_HEXSTRING, PRIx64)
-AC_DEFINE(INO_CAST, (uint64_t))
+AC_DEFINE([INO_STRING], PRId64, [INO_STRING])
+AC_DEFINE([INO_HEXSTRING], PRIx64, [INO_HEXSTRING])
+AC_DEFINE([INO_CAST], (uint64_t), [INO_CAST])
else
AC_ERROR(can not detect the size of your system's ino_t type)
fi
AC_CHECK_SIZEOF(dev_t)
if test $ac_cv_sizeof_dev_t = "4"; then
-AC_DEFINE(DEV_STRING, PRId32)
-AC_DEFINE(DEV_HEXSTRING, PRIx32)
-AC_DEFINE(DEV_CAST, (uint32_t))
+AC_DEFINE([DEV_STRING], PRId32, [DEV_STRING])
+AC_DEFINE([DEV_HEXSTRING], PRIx32, [DEV_HEXSTRING])
+AC_DEFINE([DEV_CAST], (uint32_t), [DEV_CAST])
elif test $ac_cv_sizeof_dev_t = "8"; then
-AC_DEFINE(DEV_STRING, PRId64)
-AC_DEFINE(DEV_HEXSTRING, PRIx64)
-AC_DEFINE(DEV_CAST, (uint64_t))
+AC_DEFINE([DEV_STRING], PRId64, [DEV_STRING])
+AC_DEFINE([DEV_HEXSTRING], PRIx64, [DEV_HEXSTRING])
+AC_DEFINE([DEV_CAST], (uint64_t), [DEV_CAST])
else
AC_ERROR(can not detect the size of your system's dev_t type)
fi
@@ -261,7 +261,7 @@ AC_CHECK_LIB(acl, acl_get_file)
dnl Check for paths
AC_PREFIX_DEFAULT(/usr/local)
-AC_CHECK_FUNC([asprintf], AC_DEFINE([HAVE_ASPRINTF]))
+AC_CHECK_FUNC([asprintf], AC_DEFINE([HAVE_ASPRINTF], [], [HAVE_ASPRINTF]))
dnl
dnl Configure libxml2.
--
2.28.0

View file

@ -0,0 +1,89 @@
From 276833851657c85651c053ee16b8e1a8dc768a50 Mon Sep 17 00:00:00 2001
From: Andrew Childs <andrew.childs@bibo.com.ph>
Date: Sun, 15 Nov 2020 19:12:56 +0900
Subject: [PATCH 2/2] Use pkg-config for libxml2
---
configure.ac | 66 +++++++++-------------------------------------------
1 file changed, 11 insertions(+), 55 deletions(-)
diff --git a/configure.ac b/configure.ac
index 358ab89..984a694 100644
--- a/configure.ac
+++ b/configure.ac
@@ -268,61 +268,17 @@ dnl Configure libxml2.
dnl
LIBXML2_VERSION_MIN=2.6.11
-have_libxml2="1"
-
-AC_ARG_WITH([xml2-config], [ --with-xml2-config libxml2 config program],
-if test "x${with_xml2_config}" = "xno" ; then
- XML2_CONFIG=
-else
- XML2_CONFIG="${with_xml2_config}"
-fi
-,
- XML2_CONFIG=
-)
-if test "x${XML2_CONFIG}" != "x" ; then
- if test ! -x "${XML2_CONFIG}" ; then
- AC_MSG_ERROR([Unusable or missing xml2-config: ${XML2_CONFIG}])
- fi
-else
- AC_PATH_PROG([XML2_CONFIG], [xml2-config], , [${PATH}])
- if test "x${XML2_CONFIG}" = "x" ; then
- AC_MSG_ERROR([Cannot configure without xml2-config])
- fi
-fi
-
-dnl Make sure the version of libxml2 found is sufficient.
-AC_MSG_CHECKING([for libxml >= ${LIBXML2_VERSION_MIN}])
-LIBXML2_FOUND=`2>&1 ${XML2_CONFIG} --version`
-LIBXML2_MAJOR=`echo ${LIBXML2_FOUND} | tr . " " | awk '{print $1}'`
-LIBXML2_MINOR=`echo ${LIBXML2_FOUND} | tr . " " | awk '{print $2}' | tr a-z " " |awk '{print $1}'`
-LIBXML2_BRANCH=`echo ${LIBXML2_FOUND} | tr . " " | awk '{print $3}' | tr a-z " " |awk '{print $1}'`
-if test "x${LIBXML2_BRANCH}" = "x" ; then
- LIBXML2_BRANCH=0
-fi
-LIBXML2_MAJOR_MIN=`echo ${LIBXML2_VERSION_MIN} | tr . " " | awk '{print $1}'`
-LIBXML2_MINOR_MIN=`echo ${LIBXML2_VERSION_MIN} | tr . " " | awk '{print $2}'`
-LIBXML2_BRANCH_MIN=`echo ${LIBXML2_VERSION_MIN} | tr . " " | awk '{print $3}'`
-if test ${LIBXML2_MAJOR} -gt ${LIBXML2_MAJOR_MIN} \
- -o ${LIBXML2_MAJOR} -eq ${LIBXML2_MAJOR_MIN} \
- -a ${LIBXML2_MINOR} -gt ${LIBXML2_MINOR_MIN} \
- -o ${LIBXML2_MAJOR} -eq ${LIBXML2_MAJOR_MIN} \
- -a ${LIBXML2_MINOR} -eq ${LIBXML2_MINOR_MIN} \
- -a ${LIBXML2_BRANCH} -ge $LIBXML2_BRANCH_MIN ; then
- AC_MSG_RESULT([${LIBXML2_MAJOR}.${LIBXML2_MINOR}.${LIBXML2_BRANCH}])
- have_libxml2="1"
- CPPFLAGS="${CPPFLAGS} `${XML2_CONFIG} --cflags`"
- LIBS="${LIBS} `${XML2_CONFIG} --libs`"
-else
- AC_MSG_RESULT([no])
- have_libxml2="0"
-fi
-if test "x${have_libxml2}" = "x1" ; then
- dnl Final sanity check, to make sure that xmlwriter is present.
- AC_CHECK_HEADER([libxml/xmlwriter.h], , [have_libxml2="0"])
-fi
-if test "x${have_libxml2}" = "x0" ; then
- AC_MSG_ERROR([Cannot build without libxml2])
-fi
+PKG_PROG_PKG_CONFIG
+
+PKG_CHECK_MODULES(LIBXML2_PKGCONFIG, [libxml-2.0 >= ${LIBXML2_VERSION_MIN}],
+ [
+ have_libxml2=1
+ CPPFLAGS="${CPPFLAGS} ${LIBXML2_PKGCONFIG_CFLAGS}"
+ LIBS="${LIBS} ${LIBXML2_PKGCONFIG_LIBS}"
+ ],
+ [
+ have_libxml2=0
+ ])
dnl
dnl Configure libcrypto (part of OpenSSL).
--
2.28.0

View file

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, libxml2, xz, openssl, zlib, bzip2, fts, autoconf }:
{ lib, stdenv, fetchurl, pkg-config, libxml2, xz, openssl, zlib, bzip2, fts, autoreconfHook }:
stdenv.mkDerivation rec {
version = "1.6.1";
@ -9,16 +9,20 @@ stdenv.mkDerivation rec {
sha256 = "0ghmsbs6xwg1092v7pjcibmk5wkyifwxw6ygp08gfz25d2chhipf";
};
buildInputs = [ libxml2 xz openssl zlib bzip2 fts autoconf ];
nativeBuildInputs = [ autoreconfHook pkg-config ];
buildInputs = [ libxml2 xz openssl zlib bzip2 fts ];
prePatch = ''
patches = [
./0001-Add-useless-descriptions-to-AC_DEFINE.patch
./0002-Use-pkg-config-for-libxml2.patch
];
postPatch = ''
substituteInPlace configure.ac \
--replace 'OpenSSL_add_all_ciphers' 'OPENSSL_init_crypto' \
--replace 'openssl/evp.h' 'openssl/crypto.h'
'';
preConfigure = "./autogen.sh";
meta = {
homepage = "https://mackyle.github.io/xar/";
description = "Extensible Archiver";