DVX_GUI/src/installer/pkgBuild.h
2026-09-29 17:03:51 -05:00

55 lines
2.4 KiB
C

// The MIT License (MIT)
//
// Copyright (C) 2026 Scott Duensing
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
// pkgBuild.h -- building the DVX package on the build machine (the
// dvxpkg tool and the host tests; see pkgFormat.h)
#ifndef PKG_BUILD_H
#define PKG_BUILD_H
#include "pkgFormat.h"
#include <stdbool.h>
#include <stdint.h>
// Longest message the functions below return
#define PKG_BUILD_ERR_MAX 400
// The CD form: outPath = the program at exePath, the ZIP, and a header
// (disk 1 of 1).
bool pkgBuildAppended(const char *exePath, const char *zipPath, const char *outPath, char *err, int32_t errSize);
// What a finished ZIP holds: set ID, file count and unpacked size (the
// part fields are left 0).
bool pkgBuildInfo(const char *zipPath, PkgHeaderT *info, char *err, int32_t errSize);
// The floppy form: cut the ZIP into outDir/DVX.P01, DVX.P02, ... where
// DVX.P01 takes at most firstRoom bytes (what is left on disk 1 beside
// SETUP.EXE) and every other part at most diskRoom (headers included).
// Returns the number of disks, or -1 with a reason in err.
int32_t pkgBuildSplit(const char *zipPath, const char *outDir, uint32_t firstRoom, uint32_t diskRoom, char *err, int32_t errSize);
// ZIP every file and folder under folder (sorted by name, best
// compression, sizes in the local headers). Every name must be DOS 8.3.
bool pkgBuildZip(const char *folder, const char *zipPath, char *err, int32_t errSize);
#endif // PKG_BUILD_H