Project import
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..23f2acc
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,132 @@
+#
+# Copyright (c) 2011 Nest Labs, Inc.
+# All rights reserved.
+#
+# This document is the property of Nest. It is considered
+# confidential and proprietary information.
+#
+# This document may not be reproduced or transmitted in any form,
+# in whole or in part, without the express written permission of
+# Nest.
+#
+# Description:
+# This file is for crda, the Central Regulatory Domain Agent
+# for wireless drivers to determine the regulatory domain
+# channel and power settings for a given region.
+#
+
+
+include pre.mak
+
+PackageName := crda
+
+PackageExtension := tar.bz2
+PackageSeparator := -
+
+PackagePatchArgs := -p1
+
+PackageArchive := $(PackageName).$(PackageExtension)
+PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion)
+
+PackageBuildMakefile = $(call GenerateBuildPaths,Makefile)
+
+LicenseSourceFile := LICENSE
+LicenseSourcePath := $(addprefix $(PackageSourceDir)/,$(LicenseSourceFile))
+
+CleanPaths += $(PackageLicenseFile)
+
+GcryptDir := sw/tps/libgcrypt
+GcryptIncDir := $(call GenerateResultPaths,$(GcryptDir),usr/include)
+GcryptLibDir := $(call GenerateResultPaths,$(GcryptDir),usr/lib)
+
+GpgErrorDir := sw/tps/libgpg-error
+GpgErrorIncDir := $(call GenerateResultPaths,$(GpgErrorDir),usr/include)
+GpgErrorLibDir := $(call GenerateResultPaths,$(GpgErrorDir),usr/lib)
+
+NetlinkDir := sw/tps/libnl
+NetlinkIncDir := $(call GenerateResultPaths,$(NetlinkDir),usr/include)
+NetlinkLibDir := $(call GenerateResultPaths,$(NetlinkDir),usr/lib)
+
+SOURCEDIRS = $(PackageSourceDir)
+$(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure
+
+all: $(PackageDefaultGoal)
+
+# Generate the package license contents.
+
+$(LicenseSourcePath): $(BuildDirectory)/source
+
+$(PackageLicenseFile): $(LicenseSourcePath)
+ $(copy-result)
+
+# Extract the source from the archive and apply patches, if any.
+
+$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths)
+ $(expand-and-patch-package)
+
+# Prepare the sources.
+
+$(BuildDirectory)/source: | $(PackageSourceDir)
+ $(Verbose)touch $@
+
+# Patch the sources, if necessary.
+
+$(BuildDirectory)/patch: $(BuildDirectory)/source
+ $(Verbose)touch $@
+
+# Generate the package build makefile.
+#
+# Configure the source for building.
+
+$(BuildDirectory)/configure: $(BuildDirectory)/source | $(PackageSourceDir) $(BuildDirectory)
+ $(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory))
+ $(Verbose)touch $@
+
+# Build the source.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+$(BuildDirectory)/build: $(BuildDirectory)/configure | $(BuildDirectory)
+ $(Verbose)unset MAKEFLAGS && \
+ $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \
+ CC="$(CC)" CXX="$(CXX)" AR=$(AR) NM=$(NM) RANLIB=$(RANLIB) STRIP=$(STRIP) \
+ INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
+ NLLIBNAME="libnl-2.0" \
+ NLCFLAGS="$(call ToolGenerateIncludeArgument,$(NetlinkIncDir))" \
+ NLLDFLAGS="-L$(NetlinkLibDir)" \
+ GCRYPTCFLAGS="$(call ToolGenerateIncludeArgument,$(GcryptIncDir)) \
+ $(call ToolGenerateIncludeArgument,$(GpgErrorIncDir))" \
+ GCRYPTLDFLAGS="-L$(GcryptLibDir) -Wl,-rpath-link -Wl,$(GcryptLibDir) \
+ -Wl,-rpath-link -Wl,$(GpgErrorLibDir)" \
+ all_noverify
+ $(Verbose)touch $@
+
+# Stage the build to a temporary installation area.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+$(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory)
+ $(Verbose)unset MAKEFLAGS && \
+ $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \
+ CC="$(CC)" CXX="$(CXX)" AR=$(AR) NM=$(NM) RANLIB=$(RANLIB) STRIP=$(STRIP) \
+ INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
+ NLLIBNAME="libnl-2.0" \
+ NLCFLAGS="$(call ToolGenerateIncludeArgument,$(NetlinkIncDir))" \
+ NLLDFLAGS="-L$(NetlinkLibDir)" \
+ GCRYPTCFLAGS="$(call ToolGenerateIncludeArgument,$(GcryptIncDir)) \
+ $(call ToolGenerateIncludeArgument,$(GpgErrorIncDir))" \
+ GCRYPTLDFLAGS="-L$(GcryptLibDir) -Wl,-rpath-link -Wl,$(GcryptLibDir) \
+ -Wl,-rpath-link -Wl,$(GpgErrorLibDir)" \
+ DESTDIR=$(ResultDirectory) \
+ install
+ $(Verbose)touch $@
+
+.PHONY: stage
+stage: $(BuildDirectory)/stage
+
+clean:
+ $(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
+ $(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
+ $(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
+
+include post.mak
diff --git a/crda.patches/crda-50.description b/crda.patches/crda-50.description
new file mode 100644
index 0000000..b5165b9
--- /dev/null
+++ b/crda.patches/crda-50.description
@@ -0,0 +1,2 @@
+This patch allows the package builder to specify the gcrypt version
+being built against, externally.
diff --git a/crda.patches/crda-50.patch b/crda.patches/crda-50.patch
new file mode 100644
index 0000000..af0b5e1
--- /dev/null
+++ b/crda.patches/crda-50.patch
@@ -0,0 +1,14 @@
+diff -aruN a/Makefile b/Makefile
+--- a/Makefile 2011-08-09 16:36:19.000000000 -0700
++++ b/Makefile 2011-12-19 11:10:07.548686490 -0800
+@@ -36,8 +36,8 @@
+ reglib.o: keys-ssl.c
+
+ else
+-CFLAGS += -DUSE_GCRYPT
+-LDLIBS += -lgcrypt
++CFLAGS += $(GCRYPTCFLAGS) -DUSE_GCRYPT
++LDLIBS += $(GCRYPTLDFLAGS) -lgcrypt
+
+ reglib.o: keys-gcrypt.c
+
diff --git a/crda.patches/crda-51.description b/crda.patches/crda-51.description
new file mode 100644
index 0000000..23ba3ef
--- /dev/null
+++ b/crda.patches/crda-51.description
@@ -0,0 +1,2 @@
+This patch allows the package builder to specify the libnl version
+being built against externally to pkg-config.
diff --git a/crda.patches/crda-51.patch b/crda.patches/crda-51.patch
new file mode 100644
index 0000000..200400e
--- /dev/null
+++ b/crda.patches/crda-51.patch
@@ -0,0 +1,85 @@
+diff -aruN a/Makefile b/Makefile
+--- a/Makefile 2011-08-09 16:36:19.000000000 -0700
++++ b/Makefile 2011-12-19 11:10:07.548686490 -0800
+@@ -45,32 +45,64 @@
+ MKDIR ?= mkdir -p
+ INSTALL ?= install
+
+-NL1FOUND := $(shell pkg-config --atleast-version=1 libnl-1 && echo Y)
+-NL2FOUND := $(shell pkg-config --atleast-version=2 libnl-2.0 && echo Y)
+-NL3FOUND := $(shell pkg-config --atleast-version=3 libnl-3.0 && echo Y)
++ifdef NLLIBNAME
++
++NLLIBS += -lnl
++
++ifeq ($(NLLIBNAME),libnl-1)
++NL1FOUND := Y
++endif
++
++ifeq ($(NLLIBNAME),libnl-2.0)
++NL2FOUND := Y
++endif
++
++ifeq ($(NLLIBNAME),libnl-3.0)
++NL3FOUND := Y
++endif
++
++ifdef NLCFLAGS
++CFLAGS += $(NLCFLAGS)
++endif
++
++ifdef NLLDFLAGS
++LDFLAGS += $(NLLDFLAGS)
++endif
++
++else
++NL1FOUND := $(shell $(PKG_CONFIG) --atleast-version=1 libnl-1 && echo Y)
++NL2FOUND := $(shell $(PKG_CONFIG) --atleast-version=2 libnl-2.0 && echo Y)
++NL3FOUND := $(shell $(PKG_CONFIG) --atleast-version=3 libnl-3.0 && echo Y)
++
++ifeq ($(NL1FOUND),Y)
++NLLIBNAME = libnl-1
++endif
++
++ifeq ($(NL2FOUND),Y)
++NLLIBNAME = libnl-2.0
++endif
+
+ ifeq ($(NL3FOUND),Y)
+-CFLAGS += -DCONFIG_LIBNL30
+-NLLIBS += -lnl-genl
+ NLLIBNAME = libnl-3.0
+-else
+- ifeq ($(NL2FOUND),Y)
+- CFLAGS += -DCONFIG_LIBNL20
+- NLLIBS += -lnl-genl
+- NLLIBNAME = libnl-2.0
+- else
+- ifeq ($(NL1FOUND),Y)
+- NLLIBNAME = libnl-1
+- endif
+- endif
+ endif
+
+ ifeq ($(NLLIBNAME),)
+ $(error Cannot find development files for any supported version of libnl)
+ endif
+
+-NLLIBS += `pkg-config --libs $(NLLIBNAME)`
+-CFLAGS += `pkg-config --cflags $(NLLIBNAME)`
++NLLIBS += $(shell $(PKG_CONFIG) --libs $(NLLIBNAME))
++CFLAGS += $(shell $(PKG_CONFIG) --cflags $(NLLIBNAME))
++endif
++
++ifeq ($(NL2FOUND),Y)
++CFLAGS += -DCONFIG_LIBNL20
++NLLIBS += -lnl-genl
++endif
++
++ifeq ($(NL3FOUND),Y)
++CFLAGS += -DCONFIG_LIBNL30
++NLLIBS += -lnl-genl
++endif
+
+ ifeq ($(V),1)
+ Q=
diff --git a/crda.patches/crda-52.description b/crda.patches/crda-52.description
new file mode 100644
index 0000000..d8b7d58
--- /dev/null
+++ b/crda.patches/crda-52.description
@@ -0,0 +1 @@
+Use /usr/bin/python instead of /usr/bin/env python to prevent build errors with nest-python setup in your environment.
diff --git a/crda.patches/crda-52.patch b/crda.patches/crda-52.patch
new file mode 100644
index 0000000..02428dd
--- /dev/null
+++ b/crda.patches/crda-52.patch
@@ -0,0 +1,9 @@
+diff -Naur a/utils/key2pub.py b/utils/key2pub.py
+--- a/utils/key2pub.py 2011-08-09 16:36:19.000000000 -0700
++++ b/utils/key2pub.py 2015-07-09 11:57:12.351953057 -0700
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/python
+
+ import sys
+ try:
diff --git a/crda.tar.bz2 b/crda.tar.bz2
new file mode 100644
index 0000000..b915f10
--- /dev/null
+++ b/crda.tar.bz2
Binary files differ
diff --git a/crda.url b/crda.url
new file mode 100644
index 0000000..08fd7ae
--- /dev/null
+++ b/crda.url
@@ -0,0 +1 @@
+http://linuxwireless.org/download/crda/crda-1.1.2.tar.bz2
diff --git a/crda.version b/crda.version
new file mode 100644
index 0000000..45a1b3f
--- /dev/null
+++ b/crda.version
@@ -0,0 +1 @@
+1.1.2