From: Ravi Nanjundappa Date: Fri, 4 Sep 2015 10:55:09 +0000 (+0530) Subject: Add iotivity.pc.in file and generate iotivity.pc file X-Git-Tag: 1.0.0-RC1^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4cf398310404f01a2f5044edf78b7858d1e00133;p=contrib%2Fiotivity.git Add iotivity.pc.in file and generate iotivity.pc file This patch addresses the second part of IOT-524. The current changes include adding a new iotivity.pc.in file and generating the iotivity.pc file using .pc.in file. Making the relevant changes in gbsbuild.sh files to include iotivity.pc.in file during tizen builds. Change-Id: Ie3ed7ccdf6e29d427362d0bb2b85439508997b6b Signed-off-by: Ravi Nanjundappa Reviewed-on: https://gerrit.iotivity.org/gerrit/2378 Tested-by: jenkins-iotivity Reviewed-by: Jon A. Cruz --- diff --git a/SConstruct b/SConstruct index bbe03d1..8db1ee4 100644 --- a/SConstruct +++ b/SConstruct @@ -70,3 +70,6 @@ env.PrintTargets() if target_os == 'arduino': env.UploadHelp() +# to install the generated pc file into custome prefix location +env.UserInstallTargetPCFile('iotivity.pc', 'iotivity.pc') + diff --git a/build_common/SConscript b/build_common/SConscript index 4f0bf76..5626312 100644 --- a/build_common/SConscript +++ b/build_common/SConscript @@ -119,10 +119,10 @@ if target_os in targets_support_cc: if target_os in ['android', 'arduino']: # Android/Arduino always uses GNU compiler regardless of the host env = Environment(variables = help_vars, - tools = ['gnulink', 'gcc', 'g++', 'ar', 'as'] + tools = ['gnulink', 'gcc', 'g++', 'ar', 'as', 'textfile'] ) else: - env = Environment(variables = help_vars, TARGET_ARCH = target_arch, TARGET_OS = target_os, PREFIX = GetOption('prefix')) + env = Environment(variables = help_vars, tools = ['default', 'textfile'], TARGET_ARCH = target_arch, TARGET_OS = target_os, PREFIX = GetOption('prefix')) Help(help_vars.GenerateHelpText(env)) @@ -227,6 +227,14 @@ def __installheader(ienv, targets, dir, name): i_n = ienv.Install(env.get('BUILD_DIR'), targets) ienv.Alias("install", i_n) +def __installpcfile(ienv, targets, name): + user_prefix = env.get('PREFIX') + if user_prefix: + i_n = ienv.Install(user_prefix + '/lib/pkgconfig', targets) + else: + i_n = ienv.Install(env.get('BUILD_DIR'), targets) + ienv.Alias("install", i_n) + def __append_target(ienv, name, targets = None): if targets: env.Alias(name, targets) @@ -253,12 +261,27 @@ env.AddMethod(__install, 'InstallTarget') env.AddMethod(__installlib, 'UserInstallTargetLib') env.AddMethod(__installbin, 'UserInstallTargetBin') env.AddMethod(__installheader, 'UserInstallTargetHeader') +env.AddMethod(__installpcfile, 'UserInstallTargetPCFile') env.SetDir(env.GetLaunchDir()) env['ROOT_DIR']=env.GetLaunchDir()+'/..' Export('env') ###################################################################### +# Scons to generate the iotivity.pc file from iotivity.pc.in file +###################################################################### +pc_file = env.get('SRC_DIR') + '/iotivity.pc.in' + +user_prefix = env.get('PREFIX') + +if user_prefix: + pc_vars = {'\@PREFIX\@': user_prefix, '\@EXEC_PREFIX\@':user_prefix, '\@VERSION\@':'0.9.2'} +else: + pc_vars = {'\@PREFIX\@': env.get('BUILD_DIR'), '\@EXEC_PREFIX\@': env.get('BUILD_DIR'), '\@VERSION\@':'0.9.2'} + +env.Substfile(pc_file, SUBST_DICT = pc_vars) + +###################################################################### # Link scons to Yocto cross-toolchain ONLY when target_os is yocto ###################################################################### if target_os == "yocto": diff --git a/gbsbuild.sh b/gbsbuild.sh index 749da0a..a9451d9 100755 --- a/gbsbuild.sh +++ b/gbsbuild.sh @@ -32,6 +32,9 @@ cp ./tools/tizen/*.spec ./tmp/packaging cp ./SConstruct ./tmp cp ./tools/tizen/*.rpm ./tmp cp ./tools/tizen/.gbs.conf ./tmp + +cp -R $sourcedir/iotivity.pc.in $sourcedir/tmp + cd $sourcedir/tmp echo `pwd` diff --git a/iotivity.pc.in b/iotivity.pc.in new file mode 100644 index 0000000..03c8d3b --- /dev/null +++ b/iotivity.pc.in @@ -0,0 +1,14 @@ +# Package Information for pkg-config + +prefix=@PREFIX@ +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include/ + +Name: iotivity +Description: IoTivity is an open source reference implementation of the OIC standard specifications. +Version: @VERSION@ +URL: https://www.iotivity.org +Requires: +Libs: -L${libdir} -lBMISensor -lc_common -loctbstack -lcoap -lpmimpl -lconnectivity_abstraction -lppm -lcpluff -lDiscomfortIndexSensor -lrcs_client -lmosquitto -lmosquittopp -lSSMCore -loc_logger_core -lSSMSDK -loc_logger -loc -lTGMSDKLibrary -locsrm +Cflags: -I${includedir} diff --git a/resource/csdk/connectivity/build/tizen/gbsbuild.sh b/resource/csdk/connectivity/build/tizen/gbsbuild.sh index 0a61fc0..ac2ba58 100755 --- a/resource/csdk/connectivity/build/tizen/gbsbuild.sh +++ b/resource/csdk/connectivity/build/tizen/gbsbuild.sh @@ -73,6 +73,8 @@ cd $sourcedir/build_common/ cp -R ./iotivityconfig/* $sourcedir/tmp/iotivityconfig/ cp -R ./SConscript $sourcedir/tmp/ +cp -R $sourcedir/iotivity.pc.in $sourcedir/tmp/ + cd $sourcedir/tmp echo `pwd` diff --git a/resource/csdk/stack/samples/tizen/build/gbsbuild.sh b/resource/csdk/stack/samples/tizen/build/gbsbuild.sh index d1747da..4214057 100644 --- a/resource/csdk/stack/samples/tizen/build/gbsbuild.sh +++ b/resource/csdk/stack/samples/tizen/build/gbsbuild.sh @@ -61,6 +61,8 @@ cd $sourcedir/build_common/ cp -R ./iotivityconfig/* $sourcedir/tmp/iotivityconfig/ cp -R ./SConscript $sourcedir/tmp/ +cp -R $sourcedir/iotivity.pc.in $sourcedir/tmp/ + cd $sourcedir/tmp echo `pwd`