2 # This Makefile helps create the directory structure on ftp-master,
3 # making staging builds a bit more sane.
5 # You probably do not want to use this. Really.
6 # You have been warned.
10 # Don't use this unless you know why you're using it.
15 .include "${.CURDIR}/Makefile"
18 FTPDIR?= ${RELEASEDIR}/ftp-stage
19 .if exists(${RELEASEDIR})
20 STAGE_TARGETS?= iso-images-stage
23 .if (defined(EMBEDDED_TARGET) && !empty(EMBEDDED_TARGET)) || (defined(EMBEDDEDBUILD) && !empty(EMBEDDEDBUILD))
24 . if ${TARGET} == "arm" || ${EMBEDDED_TARGET} == "arm"
30 .if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE" || ${BRANCH:MALPHA*} != ""
32 TLD?= ${FTPDIR}/snapshots
33 . if !defined(SVNREVISION) || empty(SVNREVISION)
34 . for _D in /usr/bin /usr/local/bin
35 . for _S in svnversion svnliteversion
36 . if exists(${_D}/${_S})
37 SVNVERSION?= ${_D}/${_S}
41 . if exists(${SVNVERSION}) && !empty(SVNVERSION)
42 SVNREVISION!= ${SVNVERSION} ${WORLDDIR}/Makefile
44 . endif # !defined(SVNREVISION)
45 . if !defined(BUILDDATE) || empty(BUILDDATE)
46 . if exists(${.CURDIR}/${.OBJDIR}/dist/base/bin/sh)
47 BUILDDATE!= cd ${.CURDIR} && date -j -f '%s' $$(stat -f "%c" ${.OBJDIR}/dist/base/bin/sh) +%Y%m%d
49 BUILDDATE!= date +%Y%m%d
52 _SNAP_SUFFIX:= ${BUILDDATE}-r${SVNREVISION}
56 TLD?= ${FTPDIR}/releases
59 .if defined(EMBEDDED) && !empty(EMBEDDED)
60 . if ${TARGET} == "arm" && ${TARGET_ARCH} == "armv6"
61 . if !defined(BOARDNAME) && empty(BOARDNAME)
62 BOARDNAME:= ${KERNCONF}
66 . if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE" || ${BRANCH:MALPHA*} != ""
73 .if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
74 STAGE_TARGETS+= vm-images-stage
75 VM_DIR= ${TLD}/VM-IMAGES/${REVISION}-${BRANCH}/${TARGET_ARCH}
78 CLEANFILES+= ${STAGE_TARGETS}
79 CHECKSUM_FILES?= SHA512 SHA256
80 SNAP_SUFFIX!= echo ${_SNAP_SUFFIX:S,^-,,1} | tr -d ' '
81 ISO_DIR= ${TLD}/${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}
82 FTP_DIR= ${TLD}/${TARGET}/${TARGET_ARCH}/${REVISION}-${BRANCH}
89 mkdir -p ${TLD}/ISO-IMAGES/${REVISION}
90 .if defined(SNAPSHOT) && !empty(SNAPSHOT)
91 cd ${RELEASEDIR} && rm -f CHECKSUM.*
92 . for IMAGE in ${IMAGES}
93 . if defined(EMBEDDED) && !empty(EMBEDDED)
94 . if defined(OLDNAME) && !empty(OLDNAME)
95 @# arm/armv6 IMX6 -> WANDBOARD, for example.
97 mv ${OSRELEASE}-${OLDNAME}.${IMAGE}.xz \
98 ${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz
100 cd ${RELEASEDIR} && \
101 mv ${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz \
102 ${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}.${IMAGE}.xz
103 cp -p ${RELEASEDIR}/${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}.${IMAGE}.xz \
104 ${ISO_DIR}/${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}.${IMAGE}.xz
105 cd ${TLD}/ISO-IMAGES/${REVISION} && \
107 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}.${IMAGE}.xz
108 . endif # not embedded
109 . if exists(${RELEASEDIR}/${OSRELEASE}-${IMAGE})
110 cd ${RELEASEDIR} && \
111 mv ${OSRELEASE}-${IMAGE} \
112 ${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}
113 cp -p ${RELEASEDIR}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE} \
114 ${ISO_DIR}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}
115 cd ${TLD}/ISO-IMAGES/${REVISION} && \
117 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}
119 . if exists(${RELEASEDIR}/${OSRELEASE}-${IMAGE}.xz)
120 cd ${RELEASEDIR} && \
121 mv ${OSRELEASE}-${IMAGE}.xz \
122 ${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}.xz
123 cp -p ${RELEASEDIR}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}.xz \
124 ${ISO_DIR}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}.xz
125 cd ${TLD}/ISO-IMAGES/${REVISION} && \
127 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}.xz
129 . endfor # images loop
130 cd ${RELEASEDIR} && rm -f CHECKSUM.*
131 . for CHECKSUM in ${CHECKSUM_FILES}
132 . if defined(EMBEDDED) && !empty(EMBEDDED)
133 cd ${RELEASEDIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \
134 CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}
135 cp -p ${RELEASEDIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX} \
136 ${ISO_DIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}
137 cd ${TLD}/ISO-IMAGES/${REVISION} && \
139 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}
140 . else # not embedded
141 cd ${RELEASEDIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \
142 CHECKSUM.${CHECKSUM}-${OSRELEASE}-${SNAP_SUFFIX}
143 cp -p ${RELEASEDIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${SNAP_SUFFIX} \
144 ${ISO_DIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${SNAP_SUFFIX}
145 cd ${TLD}/ISO-IMAGES/${REVISION} && \
147 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${SNAP_SUFFIX}
149 . endfor # checksum files
151 . for IMAGE in ${IMAGES}
152 . if defined(EMBEDDED) && !empty(EMBEDDED)
153 . if defined(OLDNAME) && !empty(OLDNAME)
154 @# arm/armv6 IMX6 -> WANDBOARD, for example.
155 cd ${RELEASEDIR} && \
156 mv ${OSRELEASE}-${OLDNAME}.${IMAGE}.xz \
157 ${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz
159 cp -p ${RELEASEDIR}/${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz \
160 ${ISO_DIR}/${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz
161 cd ${TLD}/ISO-IMAGES/${REVISION} && \
163 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz
164 . endif # not embedded
165 . if exists(${RELEASEDIR}/${OSRELEASE}-${IMAGE})
166 cd ${RELEASEDIR} && \
167 cp -p ${RELEASEDIR}/${OSRELEASE}-${IMAGE} \
168 ${ISO_DIR}/${OSRELEASE}-${IMAGE}
169 cd ${TLD}/ISO-IMAGES/${REVISION} && \
171 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${IMAGE}
173 . if exists(${RELEASEDIR}/${OSRELEASE}-${IMAGE}.xz)
174 cp -p ${RELEASEDIR}/${OSRELEASE}-${IMAGE}.xz \
175 ${ISO_DIR}/${OSRELEASE}-${IMAGE}.xz
176 cd ${TLD}/ISO-IMAGES/${REVISION} && \
178 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${IMAGE}.xz
180 . endfor # images loop
181 cd ${RELEASEDIR} && rm -f CHECKSUM.*
182 . for CHECKSUM in ${CHECKSUM_FILES}
183 . if defined(EMBEDDED) && !empty(EMBEDDED)
184 cd ${RELEASEDIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \
185 CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}
186 cp -p ${RELEASEDIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME} \
187 ${ISO_DIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}
188 cd ${TLD}/ISO-IMAGES/${REVISION} && \
190 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}
191 . else # not embedded
192 cd ${RELEASEDIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \
193 CHECKSUM.${CHECKSUM}-${OSRELEASE}
194 cp -p ${RELEASEDIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE} \
195 ${ISO_DIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}
196 cd ${TLD}/ISO-IMAGES/${REVISION} && \
198 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/CHECKSUM.${CHECKSUM}-${OSRELEASE}
200 . endfor # checksum files
202 .if exists(${RELEASEDIR}/ftp)
204 cp -p ${RELEASEDIR}/ftp/*.txz ${RELEASEDIR}/ftp/MANIFEST ${FTP_DIR}
205 cd ${TLD}/${TARGET} && \
206 ln -s ${TARGET_ARCH}/${REVISION}-${BRANCH} \
207 ${REVISION}-${BRANCH}
212 .if defined(SNAPSHOT) && !empty(SNAPSHOT)
213 . if exists(${VM_DIR}/Latest)
214 rm -rf ${VM_DIR}/Latest
216 mkdir -p ${VM_DIR}/Latest
217 mkdir -p ${VM_DIR}/${BUILDDATE}
218 . for VMFORMAT in ${VMFORMATS}
219 cd ${RELEASEDIR}/vmimages && \
220 mv ${OSRELEASE}.${VMFORMAT}.xz \
221 ${OSRELEASE}-${SNAP_SUFFIX}.${VMFORMAT}.xz
222 cp -p ${RELEASEDIR}/vmimages/${OSRELEASE}-${SNAP_SUFFIX}.${VMFORMAT}.xz \
223 ${VM_DIR}/${BUILDDATE}/${OSRELEASE}-${SNAP_SUFFIX}.${VMFORMAT}.xz
224 cd ${VM_DIR}/Latest && \
225 ln -s ../${BUILDDATE}/${OSRELEASE}-${SNAP_SUFFIX}.${VMFORMAT}.xz \
226 ${OSRELEASE}.${VMFORMAT}.xz
228 cd ${RELEASEDIR}/vmimages && rm -f CHECKSUM.*
229 . for CHECKSUM in ${CHECKSUM_FILES}
230 cd ${RELEASEDIR}/vmimages && \
231 ${CHECKSUM:tl} ${OSRELEASE}* > CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX}
232 cp -p ${RELEASEDIR}/vmimages/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} \
233 ${VM_DIR}/${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX}
234 cd ${VM_DIR}/Latest && \
235 ln -s ../${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} \
239 . if exists(${VM_DIR}/Latest)
240 rm -rf ${VM_DIR}/Latest
242 mkdir -p ${VM_DIR}/Latest
243 . for VMFORMAT in ${VMFORMATS}
244 cp -p ${RELEASEDIR}/vmimages/${OSRELEASE}.${VMFORMAT}.xz \
245 ${VM_DIR}/Latest/${OSRELEASE}.${VMFORMAT}.xz
247 . for CHECKSUM in ${CHECKSUM_FILES}
248 cp -p ${RELEASEDIR}/vmimages/CHECKSUM.${CHECKSUM} \
249 ${VM_DIR}/Latest/CHECKSUM.${CHECKSUM}
253 ftp-stage: remove-old-bits ${STAGE_TARGETS}