@@ -37,7 +37,7 @@ binary_names=( "utiluti" )
3737pkg_name=" $product_name "
3838identifier=" com.scriptingosx.${product_name} "
3939min_os_version=" 11.5"
40- install_location=" /usr/local/bin/ "
40+ install_location=" /"
4141
4242
4343# don't modify below here
@@ -66,7 +66,6 @@ if [[ ! -d $build_dir ]]; then
6666 exit 3
6767fi
6868
69-
7069binary_source_path=" ${build_dir} /apple/Products/Release/${binary_names[1]} "
7170
7271if [[ ! -e $binary_source_path ]]; then
@@ -82,10 +81,26 @@ if [[ $version == "" ]]; then
8281 exit 5
8382fi
8483
84+ # generate man page
85+ if ! swift package plugin generate-manual; then
86+ echo " error generating man page"
87+ exit 11
88+ fi
89+
90+ manpage_source_path=" ${build_dir} /plugins/GenerateManual/outputs/${binary_names[1]} /${binary_names[1]} .1"
91+
92+ if [[ ! -e $manpage_source_path ]]; then
93+ echo " cannot find manpage at $manpage_source_path "
94+ exit 11
95+ fi
96+
8597component_path=" ${build_dir} /${pkg_name} .pkg"
8698product_path=" ${build_dir} /${pkg_name} -${version} .pkg"
8799pkgroot=" ${build_dir} /pkgroot"
88100
101+ binary_location=" ${pkgroot} /usr/local/bin/"
102+ manpage_location=" ${pkgroot} /usr/local/share/man/man1/"
103+
89104echo
90105echo " ### Signing, Packaging and Notarizing '$product_name '"
91106echo " Version: $version "
@@ -98,18 +113,22 @@ if [[ ! -d $pkgroot ]]; then
98113 mkdir -p $pkgroot
99114fi
100115
116+ mkdir -p $binary_location
117+ mkdir -p $manpage_location
118+
119+ # copy and sign the binaries
120+
101121for binary in ${binary_names} ; do
102122 binary_source_path=" ${build_dir} /apple/Products/Release/${binary} "
103123
104124 if [[ ! -f $binary_source_path ]]; then
105- echo " can't find binary at $binary_path "
125+ echo " can't find binary at $binary_source_path "
106126 exit 6
107127 fi
108128
109- cp $binary_source_path $pkgroot
110- # scripts_dir="$SRCROOT/scripts"
129+ cp $binary_source_path $binary_location
111130
112- binary_path=$pkgroot / $ binary
131+ binary_path=${binary_location} / ${ binary}
113132
114133 # sign the binary
115134 echo
@@ -126,6 +145,11 @@ for binary in ${binary_names}; do
126145
127146done
128147
148+ # copy the manpage
149+ echo
150+ echo " copying man page"
151+ cp $manpage_source_path $manpage_location
152+
129153# create the component pkg
130154echo
131155echo " ### building component pkg file"
0 commit comments