1+ #! /bin/sh
2+
3+ # Build the MSIX package for Git for Windows.
4+
5+ . " $( dirname " $0 " ) /../release-common.sh"
6+
7+ case " $MSYSTEM " in
8+ MINGW32) ARTIFACT_SUFFIX=" x86" ;;
9+ MINGW64) ARTIFACT_SUFFIX=" x64" ;;
10+ CLANGARM64) ARTIFACT_SUFFIX=arm64;;
11+ esac
12+
13+ # MSIX requires version in X.X.X.X format (numeric only)
14+ # Convert Git for Windows versions like "2.47.1.windows.1" to "2.47.1.1"
15+ # and test versions like "0-test" to "0.0.0.0"
16+ MSIX_VERSION=" $( echo " $VERSION " | sed -e ' s/\.windows\./\./' -e ' s/[^0-9.]//g' ) "
17+ # Ensure we have exactly 4 numeric segments
18+ while test " $( echo " $MSIX_VERSION " | tr -cd ' .' | wc -c) " -lt 3
19+ do
20+ MSIX_VERSION=" $MSIX_VERSION .0"
21+ done
22+
23+ TARGET=" $output_directory " /Git.GitforWindows_" $VERSION " _" $ARTIFACT_SUFFIX " .msix
24+
25+ # Generate MSIX asset images from SVG
26+ ASSETS_DIR=" $SCRIPT_PATH /Assets"
27+ mkdir -p " $ASSETS_DIR " ||
28+ die " Could not create Assets directory"
29+
30+ type rsvg-convert ||
31+ case " $ARCH " in
32+ i686) pacman -Sy --noconfirm mingw-w64-i686-librsvg;;
33+ x86_64) pacman -Sy --noconfirm mingw-w64-x86_64-librsvg;;
34+ aarch64) pacman -Sy --noconfirm mingw-w64-clang-aarch64-librsvg;;
35+ esac ||
36+ die " Could not install librsvg"
37+
38+ SVG_SOURCE=" $SCRIPT_PATH /../git-for-windows.svg"
39+ for spec in \
40+ LockScreenLogo.png:24 \
41+ LockScreenLogo.scale-200.png:48 \
42+ Square150x150Logo.png:150 \
43+ Square150x150Logo.scale-200.png:300 \
44+ Square44x44Logo.png:44 \
45+ Square44x44Logo.scale-200.png:88 \
46+ Square44x44Logo.targetsize-24_altform-unplated.png:24 \
47+ StoreLogo.png:50
48+ do
49+ name=" ${spec%%:* } "
50+ size=" ${spec##*: } "
51+ rsvg-convert -w " $size " -h " $size " " $SVG_SOURCE " \
52+ -o " $ASSETS_DIR /$name " ||
53+ die " Could not generate $name "
54+ done
55+
56+ prepare_root
57+
58+ init_etc_gitconfig
59+ generate_file_list " $@ "
60+ copy_dlls_to_libexec
61+ unpack_pdbs
62+
63+ # Find makeappx.exe from the Windows SDK
64+ MAKEAPPX=
65+ for sdk_dir in " /c/Program Files (x86)/Windows Kits/10/bin" /* /
66+ do
67+ case " $ARCH " in
68+ x86_64) sdk_arch=x64;;
69+ i686) sdk_arch=x86;;
70+ aarch64) sdk_arch=arm64;;
71+ esac
72+ if test -f " $sdk_dir$sdk_arch /makeappx.exe"
73+ then
74+ MAKEAPPX=" $sdk_dir$sdk_arch /makeappx.exe"
75+ fi
76+ done
77+ test -n " $MAKEAPPX " ||
78+ die " Could not find makeappx.exe in the Windows SDK"
79+
80+ # Create MSIX
81+
82+ MAPFILE=$SCRIPT_PATH /root/files.map
83+ MANIFESTIN=$SCRIPT_PATH /appxmanifest.xml.in
84+ MANIFESTOUT=$SCRIPT_PATH /root/appxmanifest.xml
85+
86+ echo " Create MSIX"
87+
88+ sed -e " s/@@VERSION@@/$MSIX_VERSION /g" < " $MANIFESTIN " > " $MANIFESTOUT "
89+
90+ echo " [Files]" > " $MAPFILE " &&
91+ echo " \" $( cygpath -aw " $SCRIPT_PATH " ) /root/appxmanifest.xml\" \" AppxManifest.xml\" " >> " $MAPFILE " &&
92+ echo " \" $( cygpath -aw " $SCRIPT_PATH " ) /root/bin/git.exe\" \" bin/git.exe\" " >> " $MAPFILE " &&
93+ echo " \" $( cygpath -aw " $SCRIPT_PATH " ) /root/bin/sh.exe\" \" bin/sh.exe\" " >> " $MAPFILE " &&
94+ echo " \" $( cygpath -aw " $SCRIPT_PATH " ) /root/bin/bash.exe\" \" bin/bash.exe\" " >> " $MAPFILE " &&
95+ echo " \" $( cygpath -aw " $SCRIPT_PATH " ) /Assets/LockScreenLogo.png\" \" Assets/LockScreenLogo.png\" " >> " $MAPFILE " &&
96+ echo " \" $( cygpath -aw " $SCRIPT_PATH " ) /Assets/LockScreenLogo.scale-200.png\" \" Assets/LockScreenLogo.scale-200.png\" " >> " $MAPFILE " &&
97+ echo " \" $( cygpath -aw " $SCRIPT_PATH " ) /Assets/Square150x150Logo.png\" \" Assets/Square150x150Logo.png\" " >> " $MAPFILE " &&
98+ echo " \" $( cygpath -aw " $SCRIPT_PATH " ) /Assets/Square150x150Logo.scale-200.png\" \" Assets/Square150x150Logo.scale-200.png\" " >> " $MAPFILE " &&
99+ echo " \" $( cygpath -aw " $SCRIPT_PATH " ) /Assets/Square44x44Logo.png\" \" Assets/Square44x44Logo.png\" " >> " $MAPFILE " &&
100+ echo " \" $( cygpath -aw " $SCRIPT_PATH " ) /Assets/Square44x44Logo.scale-200.png\" \" Assets/Square44x44Logo.scale-200.png\" " >> " $MAPFILE " &&
101+ echo " \" $( cygpath -aw " $SCRIPT_PATH " ) /Assets/Square44x44Logo.targetsize-24_altform-unplated.png\" \" Assets/Square44x44Logo.targetsize-24_altform-unplated.png\" " >> " $MAPFILE " &&
102+ echo " \" $( cygpath -aw " $SCRIPT_PATH " ) /Assets/StoreLogo.png\" \" Assets/StoreLogo.png\" " >> " $MAPFILE " &&
103+ MSYS_ROOT=" $( cygpath -aw /) " &&
104+ echo " $LIST " | while IFS= read -r entry; do
105+ winpath=" ${entry// \/ / \\ } "
106+ echo " \" $MSYS_ROOT \\ $winpath \" \" $winpath \" "
107+ done >> " $MAPFILE "
108+
109+ MSYS_NO_PATHCONV=1 " $MAKEAPPX " pack /v /o /f " $( cygpath -aw " $MAPFILE " ) " /p " $( cygpath -aw " $TARGET " ) " &&
110+ echo " Package created at $TARGET "
0 commit comments