blob: b56f6ca975d17e6f4f8c767234ef9a73674f2b8d [file] [log] [blame]
#
# Copyright (c) 2010-2011 Nest, 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 the make file for the Netscape Portable Runtime,
# (NSPR), providing a platform-neutral API for system level and
# libc like functions.
#
include pre.mak
PackageName := nspr
PackageExtension := tar.gz
PackageSeparator := -
PackagePatchArgs := -p1
PackageArchive := $(PackageName).$(PackageExtension)
PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion)
PackageBuildMakefile = $(call GenerateBuildPaths,Makefile)
LicenseSourceFile := $(PackageSourceDir)/mozilla/nsprpub/pr/include/nspr.h
CleanPaths += $(PackageLicenseFile)
ifeq ($(BUILD_FEATURE_SIMULATOR), 1)
ENABLE_64BIT_NSPR = --enable-64bit
endif
SOURCEDIRS = $(PackageSourceDir)
$(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure
all: $(PackageDefaultGoal)
# Generate the package license contents.
$(LicenseSourceFile): $(BuildDirectory)/source
$(PackageLicenseFile): $(LicenseSourceFile)
$(Verbose)$(SED) -n -e '/^\/\* \*\*\*\*\* BEGIN LICENSE BLOCK \*\*\*\*\*$$/,/\*\/$$/{;p;/\*\/$$/q;}' < $< > $@
# Extract the source from the archive and apply patches, if any.
$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths)
$(expand-and-patch-package)
# Prepare the sources.
$(BuildDirectory)/source: | $(PackageSourceDir) $(BuildDirectory)
$(Verbose)touch $@
# Patch the sources, if necessary.
$(BuildDirectory)/patch: $(BuildDirectory)/source | $(BuildDirectory)
$(Verbose)touch $@
# Generate the package build makefile.
# Configure the source for building.
$(BuildDirectory)/configure: $(BuildDirectory)/source | $(PackageSourceDir) $(BuildDirectory)
$(Verbose)cd $(BuildDirectory) && \
CC="$(CC) $(CPPOPTFLAGS)" CXX="$(CXX) $(CPPOPTFLAGS)" AR=$(AR) RANLIB=$(RANLIB) STRIP=$(STRIP) \
CPPFLAGS="$(call ToolGenerateIncludeArgument,$(LinuxIncludePath))" \
$(CURDIR)/$(PackageSourceDir)/mozilla/nsprpub/configure \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
--build=$(HostTuple) \
--target=$(TargetTuple) \
$(NsprPackageOptions) \
--prefix=$(addprefix $(LibPrefixConfigOption),/usr) \
--sysconfdir=$(addprefix $(LibPrefixConfigOption),/etc) \
--localstatedir=$(addprefix $(LibPrefixConfigOption),/var) \
$(ENABLE_64BIT_NSPR) \
--disable-static
$(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) export
$(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) $(BuildDirectory)
$(Verbose)unset MAKEFLAGS && \
$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) $(call GenerateLibraryDestinationArgument,$(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