blob: fb9128b13095a7e339f2bd70d1fa9287c30b2abb [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 makefile for libedit, a BSD-licensed
# alternative to libreadline.
BuildConfigSpecialized := No
BuildProductSpecialized := No
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
# Extract the source from the archive and apply patches, if any.
$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths)
# 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 \
CPPFLAGS="-I$(NCursesIncDir)" \
LDFLAGS="-L$(NCursesLibDir)" \
--build=$(HostTuple) \
--host=$(TargetTuple) \
--prefix=/usr \
--sysconfdir=/etc \
# 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) -C $(BuildDirectory) all
# Stage the build to a temporary installation area.
.PHONY: stage
stage: build | $(ResultDirectory)
$(MAKE) -C $(BuildDirectory) DESTDIR=$(ResultDirectory) install
-ln -s editline $(ResultDirectory)/usr/include/readline
-ln -s ../histedit.h $(ResultDirectory)/usr/include/readline/history.h
-ln -s $(ResultDirectory)/usr/lib/
-ln -s libedit.a $(ResultDirectory)/usr/lib/libreadline.a
quick-install: stage
tar -czC $(ResultDirectory)/usr/ . | ssh $(DeviceUser)@$(DeviceAddress) tar xvzC /usr
$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
include post.mak