From 6139e701e96f4319affda7e31777b1331b981874 Mon Sep 17 00:00:00 2001
From: Lorenzo Tilve <ltilve@igalia.com>
Date: Mon, 6 Mar 2017 20:49:22 +0100
Subject: [PATCH] Fix install paths and add arch support

---
 com.visualstudio.code.oss.json | 25 ++++++++++++++++++++++---
 vscode/Makefile                | 20 +++++---------------
 2 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/com.visualstudio.code.oss.json b/com.visualstudio.code.oss.json
index dabe8e5..4d59dba 100644
--- a/com.visualstudio.code.oss.json
+++ b/com.visualstudio.code.oss.json
@@ -52,14 +52,33 @@
             "build-options": {
                 "build-args": [
                     "--share=network"
-                ]
+                ],
+				"arch": {
+					"x86_64": {
+						"env": {
+							"FLATPAK_ARCH": "x86_64",
+							"VSCODE_ARCH": "x64"
+						}
+					},
+					"i386": {
+						"env": {
+							"FLATPAK_ARCH": "i386",
+							"VSCODE_ARCH": "ia32"
+						}
+					},
+					"arm" : {
+						"env": {
+							"FLATPAK_ARCH": "arm",
+							"VSCODE_ARCH": "arm"
+						}
+					}
+				}
             },
             "sources": [
                 {
                     "type": "git",
                     "url": "https://github.com/Microsoft/vscode",
-                    "branch": "release/1.10",
-                    "dest": "app"
+                    "branch": "release/1.10"
                 },
                 {
                     "type": "file",
diff --git a/vscode/Makefile b/vscode/Makefile
index 2421b36..33a59a8 100644
--- a/vscode/Makefile
+++ b/vscode/Makefile
@@ -1,22 +1,12 @@
 all:
-	set -x
 	# Install dependencies
-	cd app && ./scripts/npm.sh install && ./scripts/npm.sh install gm
+	./scripts/npm.sh install
+	./scripts/npm.sh install gm
 	# build vscode
-	cd app && ./node_modules/.bin/gulp "vscode-linux-ia32-prepare-flatpak" --max_old_space_size=4096;
+	./node_modules/.bin/gulp vscode-linux-${VSCODE_ARCH}-prepare-flatpak --max_old_space_size=4096
 
 install:
-	# Install Icons, appdata.xml and .desktop file
-	mkdir -p /export/share/
-	cp -r app/.build/linux/flatpak/i386/share/icons /export/
-	cp -r app/.build/linux/flatpak/i386/share/appdata /export/
-	cp -r app/.build/linux/flatpak/i386/share/applications /export/
-
-	# Make binary available
-	mkdir -p /app/bin
-	cp -r app/.build/linux/flatpak/i386/share/code-oss/bin/* /app/bin
-
-	# Add code-oss contents to the bundle
-	cp -a app/.build/linux/flatpak/i386/share/code-oss /app
+	cp -ar .build/linux/flatpak/${FLATPAK_ARCH}/* /app/
+	ln -sf /app/share/code-oss/bin/code-oss /app/bin/code-oss
 
 .PHONY: all install
-- 
GitLab