From 987f14ab2343ae32bbeaa02fbdc34dfb235f8f7c Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Thu, 9 Jun 2016 10:04:23 +0800 Subject: [PATCH] libunwind: initial version 1.1 The package Makefile was based on work at link [1] with the following changes 1. Disable minidebuginfo support thus no dependency on liblzma 2. Add 2 patches for building against musl-libc and building with mips16 enabled 3. Add LICENSE and DEPENDS info, etc. [1] https://github.com/rpi-openwrt/rpi-packages/tree/master/libs/libunwind Signed-off-by: Yousong Zhou --- package/libs/libunwind/Makefile | 53 +++++++++++++++++++ .../libunwind/patches/001-disable-tests.patch | 22 ++++++++ .../002-fix-building-getcontext_S.patch | 19 +++++++ ...03-fix-missing-ef_reg-defs-with-musl.patch | 47 ++++++++++++++++ 4 files changed, 141 insertions(+) create mode 100644 package/libs/libunwind/Makefile create mode 100644 package/libs/libunwind/patches/001-disable-tests.patch create mode 100644 package/libs/libunwind/patches/002-fix-building-getcontext_S.patch create mode 100644 package/libs/libunwind/patches/003-fix-missing-ef_reg-defs-with-musl.patch diff --git a/package/libs/libunwind/Makefile b/package/libs/libunwind/Makefile new file mode 100644 index 0000000000..ec19656ec9 --- /dev/null +++ b/package/libs/libunwind/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2008-2013 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=libunwind +PKG_VERSION:=1.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://download.savannah.gnu.org/releases/libunwind +PKG_MD5SUM:=fb4ea2f6fbbe45bf032cd36e586883ce +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +PKG_LICENSE:=X11 +PKG_LICENSE_FILES:=LICENSE + +PKG_MAINTAINER:=Yousong Zhou + +include $(INCLUDE_DIR)/package.mk + +define Package/libunwind + SECTION:=libs + CATEGORY:=Libraries + TITLE:=The libunwind project + URL:=http://www.nongnu.org/libunwind/ + DEPENDS:=@(mips||mipsel||powerpc||i386||x86_64) +endef + +define Package/libunwind/description + Libunwind defines a portable and efficient C programming interface (API) to determine the call-chain of a program. +endef + +CONFIGURE_ARGS += --enable-minidebuginfo=no + +define Package/libunwind/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libunwin*.so* $(1)/usr/lib/ +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libunwin*.so* $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* $(1)/usr/lib/pkgconfig/ +endef + +$(eval $(call BuildPackage,libunwind)) diff --git a/package/libs/libunwind/patches/001-disable-tests.patch b/package/libs/libunwind/patches/001-disable-tests.patch new file mode 100644 index 0000000000..9700fea477 --- /dev/null +++ b/package/libs/libunwind/patches/001-disable-tests.patch @@ -0,0 +1,22 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -36,7 +36,7 @@ + + nodist_include_HEADERS = include/libunwind-common.h + +-SUBDIRS = src tests doc ++SUBDIRS = src doc + + noinst_HEADERS = include/dwarf.h include/dwarf_i.h include/dwarf-eh.h \ + include/compiler.h include/libunwind_i.h include/mempool.h \ +--- a/Makefile.in ++++ b/Makefile.in +@@ -313,7 +313,7 @@ + $(am__append_7) $(am__append_8) $(am__append_9) \ + $(am__append_10) + nodist_include_HEADERS = include/libunwind-common.h +-SUBDIRS = src tests doc ++SUBDIRS = src doc + noinst_HEADERS = include/dwarf.h include/dwarf_i.h include/dwarf-eh.h \ + include/compiler.h include/libunwind_i.h include/mempool.h \ + include/remote.h \ diff --git a/package/libs/libunwind/patches/002-fix-building-getcontext_S.patch b/package/libs/libunwind/patches/002-fix-building-getcontext_S.patch new file mode 100644 index 0000000000..10b1dd1d90 --- /dev/null +++ b/package/libs/libunwind/patches/002-fix-building-getcontext_S.patch @@ -0,0 +1,19 @@ +diff -uprN a/src/mips/getcontext.S b/src/mips/getcontext.S +--- a/src/mips/getcontext.S 2012-10-06 12:54:38.000000000 +0800 ++++ b/src/mips/getcontext.S 2016-06-08 13:35:25.033051679 +0800 +@@ -24,12 +24,12 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + #include "offsets.h" +-#include + + .text ++ .set nomips16 + + #if _MIPS_SIM == _ABIO32 +-# if __BYTE_ORDER == __BIG_ENDIAN ++# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + # define OFFSET 4 + # else + # define OFFSET 0 + diff --git a/package/libs/libunwind/patches/003-fix-missing-ef_reg-defs-with-musl.patch b/package/libs/libunwind/patches/003-fix-missing-ef_reg-defs-with-musl.patch new file mode 100644 index 0000000000..465abb4ce0 --- /dev/null +++ b/package/libs/libunwind/patches/003-fix-missing-ef_reg-defs-with-musl.patch @@ -0,0 +1,47 @@ +diff -uprN a/include/libunwind-mips.h b/include/libunwind-mips.h +--- a/include/libunwind-mips.h 2012-10-06 12:54:38.000000000 +0800 ++++ b/include/libunwind-mips.h 2016-06-08 13:55:55.029436442 +0800 +@@ -111,6 +111,42 @@ typedef enum + } + mips_regnum_t; + ++#ifndef __GLIBC__ ++#include ++ ++/* musl as of 1.1.14 does not export these */ ++#define EF_REG0 6 ++#define EF_REG1 7 ++#define EF_REG2 8 ++#define EF_REG3 9 ++#define EF_REG4 10 ++#define EF_REG5 11 ++#define EF_REG6 12 ++#define EF_REG7 13 ++#define EF_REG8 14 ++#define EF_REG9 15 ++#define EF_REG10 16 ++#define EF_REG11 17 ++#define EF_REG12 18 ++#define EF_REG13 19 ++#define EF_REG14 20 ++#define EF_REG15 21 ++#define EF_REG16 22 ++#define EF_REG17 23 ++#define EF_REG18 24 ++#define EF_REG19 25 ++#define EF_REG20 26 ++#define EF_REG21 27 ++#define EF_REG22 28 ++#define EF_REG23 29 ++#define EF_REG24 30 ++#define EF_REG25 31 ++#define EF_REG28 34 ++#define EF_REG29 35 ++#define EF_REG30 36 ++#define EF_REG31 37 ++#endif ++ + typedef enum + { + UNW_MIPS_ABI_O32, +