Add iotivity.pc.in file and generate iotivity.pc file
authorRavi Nanjundappa <nravi.n@samsung.com>
Fri, 4 Sep 2015 10:55:09 +0000 (16:25 +0530)
committerJon A. Cruz <jonc@osg.samsung.com>
Fri, 18 Sep 2015 18:45:24 +0000 (18:45 +0000)
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 <nravi.n@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2378
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
SConstruct
build_common/SConscript
gbsbuild.sh
iotivity.pc.in [new file with mode: 0644]
resource/csdk/connectivity/build/tizen/gbsbuild.sh
resource/csdk/stack/samples/tizen/build/gbsbuild.sh

index bbe03d1..8db1ee4 100644 (file)
@@ -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')
+
index 4f0bf76..5626312 100644 (file)
@@ -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":
index 749da0a..a9451d9 100755 (executable)
@@ -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 (file)
index 0000000..03c8d3b
--- /dev/null
@@ -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}
index 0a61fc0..ac2ba58 100755 (executable)
@@ -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`
index d1747da..4214057 100644 (file)
@@ -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`