Bug 572878: Preserve file name when passing file to be signed

Do this by using a temp dir to store the unsigned files in rather
than mangling the name

Change-Id: I25d3b1fbb5751f8615266168a919990d9111204c
diff --git a/core/org.eclipse.cdt.core.native/native_src/Makefile b/core/org.eclipse.cdt.core.native/native_src/Makefile
index 5247d7c..1e43b75 100644
--- a/core/org.eclipse.cdt.core.native/native_src/Makefile
+++ b/core/org.eclipse.cdt.core.native/native_src/Makefile
@@ -73,11 +73,13 @@
 WIN_TO_SIGN=$(OS_DIR_WIN32_X86_64)/starter.exe \
 	$(OS_DIR_WIN32_X86_64)/spawner.dll \
 	$(OS_DIR_WIN32_X86_64)/pty.dll
+TMPDIR := $(shell mktemp -d -t production-XXXXXXXXXX)
 production: $(MAC_TO_SIGN) $(WIN_TO_SIGN)
-	$(foreach tosign,$(MAC_TO_SIGN) $(WIN_TO_SIGN),mv $(tosign) unsigned-$(tosign) &&) true
-	$(foreach tosign,$(MAC_TO_SIGN),curl -f --silent --show-error -o $(tosign) -F file=@unsigned-$(tosign) https://cbi.eclipse.org/macos/codesign/sign &&) true
-	$(foreach tosign,$(WIN_TO_SIGN),curl -f --silent --show-error -o $(tosign) -F file=@unsigned-$(tosign) https://cbi.eclipse.org/authenticode/sign   &&) true
-	$(foreach tosign,$(MAC_TO_SIGN) $(WIN_TO_SIGN),rm unsigned-$(tosign) &&) true
+	$(foreach tosign,$(MAC_TO_SIGN) $(WIN_TO_SIGN),mv $(tosign) $(TMPDIR)$(tosign) &&) true
+	$(foreach tosign,$(MAC_TO_SIGN),curl -f --silent --show-error -o $(tosign) -F file=@$(TMPDIR)$(tosign) https://cbi.eclipse.org/macos/codesign/sign &&) true
+	$(foreach tosign,$(WIN_TO_SIGN),curl -f --silent --show-error -o $(tosign) -F file=@$(TMPDIR)$(tosign) https://cbi.eclipse.org/authenticode/sign   &&) true
+	$(foreach tosign,$(MAC_TO_SIGN) $(WIN_TO_SIGN),rm $(TMPDIR)$(tosign) &&) true
+	rmdir $(TMPDIR)
 
 
 # Windows x86_64
diff --git a/native/org.eclipse.cdt.native.serial/native_src/Makefile b/native/org.eclipse.cdt.native.serial/native_src/Makefile
index b663a61..4df473c 100644
--- a/native/org.eclipse.cdt.native.serial/native_src/Makefile
+++ b/native/org.eclipse.cdt.native.serial/native_src/Makefile
@@ -49,11 +49,13 @@
 
 MAC_TO_SIGN=$(OS_DIR)/macosx/x86_64/libserial.jnilib
 WIN_TO_SIGN=$(OS_DIR)/win32/x86_64/serial.dll
+TMPDIR := $(shell mktemp -d -t production-XXXXXXXXXX)
 production: $(MAC_TO_SIGN) $(WIN_TO_SIGN)
-	$(foreach tosign,$(MAC_TO_SIGN) $(WIN_TO_SIGN),mv $(tosign) unsigned-$(tosign) &&) true
-	$(foreach tosign,$(MAC_TO_SIGN),curl -f --silent --show-error -o $(tosign) -F file=@unsigned-$(tosign) https://cbi.eclipse.org/macos/codesign/sign &&) true
-	$(foreach tosign,$(WIN_TO_SIGN),curl -f --silent --show-error -o $(tosign) -F file=@unsigned-$(tosign) https://cbi.eclipse.org/authenticode/sign   &&) true
-	$(foreach tosign,$(MAC_TO_SIGN) $(WIN_TO_SIGN),rm unsigned-$(tosign) &&) true
+	$(foreach tosign,$(MAC_TO_SIGN) $(WIN_TO_SIGN),mv $(tosign) $(TMPDIR)$(tosign) &&) true
+	$(foreach tosign,$(MAC_TO_SIGN),curl -f --silent --show-error -o $(tosign) -F file=@$(TMPDIR)$(tosign) https://cbi.eclipse.org/macos/codesign/sign &&) true
+	$(foreach tosign,$(WIN_TO_SIGN),curl -f --silent --show-error -o $(tosign) -F file=@$(TMPDIR)$(tosign) https://cbi.eclipse.org/authenticode/sign   &&) true
+	$(foreach tosign,$(MAC_TO_SIGN) $(WIN_TO_SIGN),rm $(TMPDIR)$(tosign) &&) true
+	rmdir $(TMPDIR)
 
 
 rebuild: clean all