[Title] Modified to support MACOS build
authordonghee yang <donghee.yang@samsung.com>
Mon, 10 Jun 2013 23:41:28 +0000 (08:41 +0900)
committerdonghee yang <donghee.yang@samsung.com>
Mon, 10 Jun 2013 23:47:28 +0000 (08:47 +0900)
macos/build.xml [new file with mode: 0644]
makeDmg [new file with mode: 0755]
package/build.macos

diff --git a/macos/build.xml b/macos/build.xml
new file mode 100644 (file)
index 0000000..bdb25d3
--- /dev/null
@@ -0,0 +1,68 @@
+<project name="InstallManager" default="make_installmanager" basedir=".">\r
+  <description>\r
+         Install Manager for MacOS\r
+  </description>\r
+\r
+  <!--\r
+     set taskdef for jarbundler\r
+     You must :\r
+       - get this library at sourceforge.net/projects/jarbundler\r
+       - copy jarbundler-2.2.0.jar to /usr/share/ant/lib of your Mac\r
+  -->\r
+  <taskdef name="jarbundler" classname="net.sourceforge.jarbundler.JarBundler" />\r
+\r
+  <property name="IM_NAME" value="Tizen_SDK_Install"/>\r
+  <property name="MAC_ICON" value="mac_installer_icon.icns"/>\r
+  <property name="MAC_BACKGROUND" value="dmg_background_01.png"/>\r
+  <property name="IMAGE_PATH" value="../InstallManager_java/src/res/icons"/>\r
+  <condition property="ISFILE">\r
+        <available file="installmanager.conf"/>\r
+  </condition>\r
+\r
+  <target name="clean">\r
+    <delete dir="${APP_NAME}.app"/>\r
+    <delete file="${INSTALL_NAME}.dmg"/>\r
+  </target>\r
+\r
+  <target name="make_bundle">\r
+  <!--\r
+     Important option\r
+       - startOnMainThread must be 'true'\r
+       - workingdirectory must be set. Default must be '$APP_PACKAGE/Contents/Resources/Java' for installmanager.conf\r
+       - installmanager.conf must be located at workingdirectory.\r
+  -->  \r
+  <!-- to do later\r
+     Add dmg ICON\r
+        <copy file="${IMAGE_PATH}/${MAC_BACKGROUND}" todir="${basedir}" />\r
+  -->   \r
+    <copy file="${IMAGE_PATH}/${MAC_ICON}" todir="${basedir}" />\r
+    <jarbundler dir="." name="${APP_NAME}" mainclass="org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader" jar="InstallManager.jar"\r
+      verbose="true" startOnMainThread="true"\r
+      workingdirectory="$APP_PACKAGE/Contents/Resources/Java" icon ="${MAC_ICON}"\r
+      arguments="${ARGUMENT}"\r
+    > \r
+      <resourcefileset dir="." includes="*.conf"/>\r
+    </jarbundler>\r
+  </target>\r
+    \r
+  <target name="make_dmg">\r
+    <exec executable="hdiutil">\r
+      <arg line="create ./${DMG_NAME}.dmg -srcfolder ./&quot;${APP_NAME}.app&quot; -ov"/>\r
+    </exec>\r
+  </target>\r
+    \r
+  <target name="make_public">\r
+    <property name="ARGUMENT" value=""/>\r
+    <property name="APP_NAME" value="${IM_NAME}"/>\r
+    <property name="DMG_NAME" value="${INSTALL_NAME}"/>\r
+    <antcall target="clean"/>\r
+    <antcall target="make_bundle"/>\r
+    <antcall target="make_dmg"/>\r
+  </target>\r
+\r
+  <target name="make_installmanager">\r
+    <antcall target="make_public"/>\r
+  </target>\r
+\r
+</project>\r
+\r
diff --git a/makeDmg b/makeDmg
new file mode 100755 (executable)
index 0000000..a0dbefd
--- /dev/null
+++ b/makeDmg
@@ -0,0 +1,13 @@
+#!/bin/bash
+if [ "`which hdiutil 2>/dev/null`" ] ; then
+    echo "Checking hdiutil... OK"
+else
+    echo "Checking hdiutil... IS NOT INSTALLED"
+    exit 1
+fi
+
+# build exe
+cd ${SRCDIR}/bundle
+ant -DINSTALL_NAME=inst-manager
+cd ${SRCDIR}
+
index 1e45e17..bdfe87b 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/bash -ex
 buildDir="${SRCDIR}/build"
+bundleDir="${SRCDIR}/bundle"
 targetBinary="inst-manager"
 
 ##make config file
@@ -19,20 +20,8 @@ buildConfigFile() {
 buildInstallManager() {
        cd ${buildDir}
        case ${TARGET_OS} in
-        ubuntu-32|fedora-32|tizen-32)
-                       $SRCDIR/build.sh "linux-32"
-        ;;
-        ubuntu-64|fedora-64|tizen-64)
-                       $SRCDIR/build.sh "linux-64"
-        ;;
-        windows-32)
-                       $SRCDIR/build.sh "windows-32"
-               ;;
-        windows-64)
-                       $SRCDIR/build.sh "windows-64"
-        ;;
         macos-64)
-                       $SRCDIR/build.sh "macos-64"
+                       $SRCDIR/build.sh "macos"
         ;;
         *)
                        echo "The OS \"${TARGET_OS}\" is not supported yet!"
@@ -43,20 +32,8 @@ buildInstallManager() {
 }
 
 ##build installmanager.bin
-copyBinary() {
+buildExecutable() {
        case ${TARGET_OS} in
-        ubuntu-32|fedora-32|tizen-32)
-                       cp -rf $SRCDIR/InstallManager_java/dist/linux32/InstallManager.jar ${buildDir}/
-        ;;
-        ubuntu-64|fedora-64|tizen-64)
-                       cp -rf $SRCDIR/InstallManager_java/dist/linux64/InstallManager.jar ${buildDir}/
-        ;;
-        windows-32)
-                       cp -rf $SRCDIR/InstallManager_java/dist/windows32/InstallManager.jar ${buildDir}/
-               ;;
-        windows-64)
-                       cp -rf $SRCDIR/InstallManager_java/dist/windows64/InstallManager.jar ${buildDir}/
-        ;;
         macos-64)
                        cp -rf $SRCDIR/InstallManager_java/dist/macos/InstallManager.jar ${buildDir}/
         ;;
@@ -73,14 +50,32 @@ copyBinary() {
 }
 
 
+buildBundle() {
+       case ${TARGET_OS} in
+               macos-64)
+                       cp -rf $SRCDIR/InstallManager_java/dist/macos/InstallManager.jar ${bundleDir}/
+               ;;
+               *)
+                       echo "The OS \"${TARGET_OS}\" is not supported yet!"
+                       exit 1
+               ;;
+       esac
+       cp -rf ${SRCDIR}/macos/build.xml ${bundleDir}/
+       cp -rf ${buildDir}/installmanager.conf ${bundleDir}/
+       cd ${bundleDir}
+       ${SRCDIR}/makeDmg
+       cd ${SRCDIR}
+}
+
+
 clean()
 {
        rm -rf $SRCDIR/*.zip
        rm -rf $SRCDIR/*.tar.gz
        rm -rf $SRCDIR/InstallManager_java/dist
-       rm -rf $buildDir/*.bin
-       rm -rf $buildDir/*.conf
-       rm -rf $buildDir/*.jar
+       rm -rf $buildDir
+       rm -rf $bundleDir
 }
 
 
@@ -90,7 +85,10 @@ build()
        mkdir -p ${buildDir}
        buildConfigFile
        buildInstallManager
-       copyBinary
+       buildExecutable
+       rm -rf ${bundleDir}
+       mkdir -p ${bundleDir}
+       buildBundle
 }
 
 install()
@@ -100,4 +98,5 @@ install()
        mkdir -p $BINDIR 
 
        cp -r ${buildDir}/${targetBinary}.bin ${BINDIR}
+       cp -r ${bundleDir}/${targetBinary}.dmg ${BINDIR}
 }