Fix problem when source (build) directory is not present
[hvlinux.git] / functions / ipkg
index b30a2e7..ca159bd 100644 (file)
@@ -79,9 +79,13 @@ hvconfig()
 # Default build function
 hvbuild()
 {
-    cd ${BUILD_DIR}
     ${HVMAKE}
-    ${HVMAKE} install
+
+    if [ -n "${INSTALL_DIR}" ]; then
+        ${HVMAKE} DESTDIR=${INSTALL_DIR} install
+    else
+        ${HVMAKE} install
+    fi
 }
 
 # Default patch applying function
@@ -210,6 +214,9 @@ ipkg_script()
         hvconfig_post
     fi
 
+    if [ -d ${BUILD_DIR} ]; then
+        cd ${BUILD_DIR}
+    fi
     hvbuild
 
     # Execute post-build function if applicable