Modify script to include only necessary .pc file
authorSangYoun Kwak <sy.kwak@samsung.com>
Tue, 21 May 2024 12:39:13 +0000 (21:39 +0900)
committerSangYoun Kwak <sy.kwak@samsung.com>
Tue, 21 May 2024 12:39:13 +0000 (21:39 +0900)
Previously, rootstrap generation script copied every .pc files in the
pkgconfig path but it is not valid since there are some packages which
installed by dependencies. Those packages should not be included in the
.pc file, so the script is modified to copy .pc files which are in the
necessary packages.

Change-Id: Ifb9baa2541e00500341930618fa58c2abdd788d4
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
script/rootstrap_gen_1.0.sh

index a5f002f4a46bb7b5e750f11bc2d294c78ec7871c..226ed603582ff5f8770dd87ebee625572e42141a 100755 (executable)
@@ -193,6 +193,7 @@ function copy_header_and_so()
 
        if [[ "${ALL}" == "*" ]] || [[ "${INTERNAL}" == true ]]; then
                log "ALL(*) and internal is not supported"
+               return 1
        else
                log "+ copy necessary files .."
                for i in $(xmlstarlet sel -t -m "//necessary/file" -o "." -v "text()" -o " " -n  ${xml_file}); do
@@ -216,27 +217,32 @@ function copy_header_and_so()
                log "Error Occurred Copy file .... "  1>&2
                exit $ERROR_NOT_EXIST_FILE
        fi
+
+       return 0
 }
 
 function copy_package_config()
 {
        local src_dir=$1
        local dest_dir=$2
+       local xml_file=$3
 
        log "***************** $FUNCNAME *****************"
        log "+ source directory : ${src_dir}"
        log "+ destination dierctory : ${dest_dir}"
+       log "+ xml source file : ${xml_file}"
 
-       if [[ ! -d "${src_dir}/usr/lib/pkgconfig" ]]; then
-               log "+ no pkgconfig directory(${src_dir}/usr/lib/pkgconfig)"
+       local pc_fname="$(xmlstarlet sel -t -v '//rootstrap/@name' ${item}).pc"
+       local src_pc_file_path="${src_dir}/usr/lib/pkgconfig/${pc_fname}"
+       local dest_pc_path="${dest_dir}/usr/lib/pkgconfig"
+
+       if [[ ! -f "${src_pc_file_path}" ]]; then
+               log "+ no pkgconfig file(${src_pc_file_path})"
                return 1
        fi
 
-       cd ${src_dir}
-       local dest_path="${dest_dir}/usr/lib/pkgconfig"
-       mkdir -p ${dest_path}
-       cp -P -R ./usr/lib/pkgconfig/* "${dest_path}"
-       cd -
+       mkdir -p ${dest_pc_path}
+       cp -P "${src_pc_file_path}" "${dest_pc_path}/."
 }
 
 function check_prerequisite()
@@ -417,11 +423,16 @@ do
 
     #copy only header & so to dest
     copy_header_and_so ${BUILD_REQUIRED_INSTALLED_PATH} ${GBS_BUILDROOT} ${item}
+    if [[ $? -ne 0 ]]; then
+        echo "Failed to copy_header_and_so for ${item}, skip."
+        continue
+    fi
+
+    copy_package_config ${BUILD_REQUIRED_INSTALLED_PATH} ${GBS_BUILDROOT} ${item}
 
     #get build option from xml
     #get_build_option $item
 done #finish copy header & library
-copy_package_config ${BUILD_REQUIRED_INSTALLED_PATH} ${GBS_BUILDROOT}
 
 ##################################################################
 #postlink for delete needed field from Library