blob: db6a414dd9710a7d5bdbca36e0a1d13f69e45854 [file] [log] [blame] [edit]
#
# 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 makefile for libedit, a BSD-licensed
# alternative to libreadline.
#
BuildConfigSpecialized := No
BuildProductSpecialized := No
EnableParallel = Yes
include pre.mak
PackageName := libedit
PackageExtension := tar.gz
PackageSeparator := -
PackagePatchArgs := -p1
PackageArchive := $(PackageName).$(PackageExtension)
PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion)/
PackageBuildMakefile = $(call GenerateBuildPaths,Makefile)
CleanPaths += $(PackageLicenseFile)
NCursesDir := sw/tps/ncurses
NCursesIncDir = $(call GenerateResultPaths,$(NCursesDir),usr/include)
NCursesLibDir = $(call GenerateResultPaths,$(NCursesDir),usr/lib)
all: $(PackageDefaultGoal)
# Generate the package license contents.
$(PackageSourceDir)/COPYING: source
$(PackageLicenseFile): $(PackageSourceDir)/COPYING
$(copy-result)
# Extract the source from the archive and apply patches, if any.
$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths)
$(expand-and-patch-package)
# Prepare the sources.
.PHONY: source
source: | $(PackageSourceDir)
# Patch the sources, if necessary.
.PHONY: patch
patch: source
# Generate the package build makefile.
$(PackageBuildMakefile): | $(PackageSourceDir) $(BuildDirectory)
$(Verbose)cd $(BuildDirectory) && \
$(CURDIR)/$(PackageSourceDir)/configure \
CC="$(CC)" CXX="$(CXX)" AR=$(AR) RANLIB=$(RANLIB) STRIP=$(STRIP) \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
CPPFLAGS="-I$(NCursesIncDir)" \
LDFLAGS="-L$(NCursesLibDir)" \
--build=$(HostTuple) \
--host=$(TargetTuple) \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var
# Configure the source for building.
#
# Avahi uses and, in fact, requires pkg-config to set-up LDFLAGS and
# CFLAGS for LIBDAEMON even though these are explicitly provided on
# the configure command line above as prescribed in the "how to
# configure WITHOUT pkg-config" instructions.
#
# Unfortunately, some site Linux systems are quite old and have a
# version of pkg-config that avahi refuses to work with.
# Consequently, we place $(HostBinDir) first in the path to ensure
# that the project-local version of pkg-config is detected and used
# rather than a host- or site-local version.
configure: PATH := $(HostBinDir):$(PATH)
.PHONY: configure
configure: source $(PackageBuildMakefile)
# Build the source.
.PHONY: build
build: configure
$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) all
# Stage the build to a temporary installation area.
.PHONY: stage
stage: build | $(ResultDirectory)
$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) DESTDIR=$(ResultDirectory) install
-ln -s editline $(ResultDirectory)/usr/include/readline
-ln -s ../histedit.h $(ResultDirectory)/usr/include/readline/history.h
-ln -s libedit.so $(ResultDirectory)/usr/lib/libreadline.so
-ln -s libedit.a $(ResultDirectory)/usr/lib/libreadline.a
DeviceUser:=root
quick-install: stage
tar -czC $(ResultDirectory)/usr/ . | ssh $(DeviceUser)@$(DeviceAddress) tar xvzC /usr
clean:
$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
include post.mak