[go: nahoru, domu]

Skip to content

Commit

Permalink
Add device tree compiler
Browse files Browse the repository at this point in the history
This patch adds a package description for the device tree compiler

Signed-off-by: Andy Gross <andy.gross@linaro.org>
  • Loading branch information
Andy Gross committed Jun 5, 2017
1 parent db3a8ee commit ddd0c5b
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
34 changes: 34 additions & 0 deletions dtc/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Maintainer: Andy Gross <andy.gross@linaro.org>

pkgname=dtc
pkgver=1.4.4
pkgrel=1
pkgdesc="Device Tree Compiler"
arch=('i686' 'x86_64')
url="https://git.kernel.org/pub/scm/utils/dtc/dtc/git"
license=('GPL2')
groups=('base')

source=("https://git.kernel.org/pub/scm/utils/dtc/dtc.git/snapshot/${pkgname}-${pkgver}.tar.gz"
fpic.patch)
sha256sums=('2f2c0bf4d84763595953885bdcd2159b0b85410018c8ba48cc31b3d6e443e4d8'
'72c5f92003c3120ee2400939aaf2c0ebc372fc9c922c6ae07b6be8b0c2470a74')

prepare() {
cd "${srcdir}/${pkgname}-${pkgver}"
patch -p1 -i "${srcdir}/fpic.patch"
}

build() {
cd "${srcdir}/${pkgname}-${pkgver}"
make
}

package() {
cd "${srcdir}/${pkgname}-${pkgver}"
make PREFIX= DESTDIR="${pkgdir}/usr" install

# license
install -Dm644 ${srcdir}/${pkgname}-${pkgver}/README.license ${pkgdir}/usr/share/licenses/${pkgname}/README.license
}

62 changes: 62 additions & 0 deletions dtc/fpic.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
diff -Naur dtc-1.4.4/Makefile newdtc/Makefile
--- dtc-1.4.4/Makefile 2017-03-09 18:17:23.000000000 -0600
+++ newdtc/Makefile 2017-06-05 11:26:46.093781900 -0500
@@ -18,7 +18,7 @@
CPPFLAGS = -I libfdt -I .
WARNINGS = -Wall -Wpointer-arith -Wcast-qual -Wnested-externs \
-Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wshadow
-CFLAGS = -g -Os -fPIC -Werror $(WARNINGS)
+CFLAGS = -g -Os -Werror $(WARNINGS)

BISON = bison
LEX = flex
@@ -31,14 +31,19 @@
INCLUDEDIR = $(PREFIX)/include

HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
- sed -e 's/\(cygwin\).*/cygwin/')
+ sed -e 's/\(cygwin|msys\).*/\1/')
+
+ifneq ($(HOSTOS),$(filter $(HOSTOS),msys cygwin))
+COMPILE_OPTIONS += -fPIC
+SHAREDLIB_LINK_OPTIONS += -fPIC
+endif

ifeq ($(HOSTOS),darwin)
SHAREDLIB_EXT=dylib
-SHAREDLIB_LINK_OPTIONS=-dynamiclib -Wl,-install_name -Wl,
+SHAREDLIB_LINK_OPTIONS+=-dynamiclib -Wl,-install_name -Wl,
else
SHAREDLIB_EXT=so
-SHAREDLIB_LINK_OPTIONS=-shared -Wl,--version-script=$(LIBFDT_version) -Wl,-soname,
+SHAREDLIB_LINK_OPTIONS+=-shared -Wl,--version-script=$(LIBFDT_version) -Wl,-soname,
endif

#
@@ -259,7 +264,7 @@

%.o: %.c
@$(VECHO) CC $@
- $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(COMPILE_OPTIONS) -o $@ -c $<

%.o: %.S
@$(VECHO) AS $@
@@ -279,7 +284,7 @@

%.s: %.c
@$(VECHO) CC -S $@
- $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -S $<
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(COMPILE_OPTIONS) -o $@ -S $<

%.a:
@$(VECHO) AR $@
@@ -287,7 +292,7 @@

$(LIBFDT_lib):
@$(VECHO) LD $@
- $(CC) $(LDFLAGS) -fPIC $(SHAREDLIB_LINK_OPTIONS)$(LIBFDT_soname) -o $(LIBFDT_lib) $^
+ $(CC) $(LDFLAGS) $(SHAREDLIB_LINK_OPTIONS)$(LIBFDT_soname) -o $(LIBFDT_lib) $^

%.lex.c: %.l
@$(VECHO) LEX $@

0 comments on commit ddd0c5b

Please sign in to comment.