aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua M. Boniface <joshua@boniface.me>2024-02-11 16:47:03 -0500
committerJoshua M. Boniface <joshua@boniface.me>2024-02-11 16:47:03 -0500
commite339eee1b9aeb0ce2000c4adb61c00f4c0d981fa (patch)
treeadf390a1fd9f7fb99d32ee41ae982fc5a8e953f3
parentAdd portable linux build (diff)
downloadjellyfin-packaging-e339eee1b9aeb0ce2000c4adb61c00f4c0d981fa.tar.gz
jellyfin-packaging-e339eee1b9aeb0ce2000c4adb61c00f4c0d981fa.tar.bz2
jellyfin-packaging-e339eee1b9aeb0ce2000c4adb61c00f4c0d981fa.zip
Combine all portable archive builds
-rwxr-xr-xbuild.py72
l---------linux/Dockerfile1
-rwxr-xr-xlinux/build.sh37
-rwxr-xr-xportable/build.sh18
4 files changed, 77 insertions, 51 deletions
diff --git a/build.py b/build.py
index 36bcbad..200b05a 100755
--- a/build.py
+++ b/build.py
@@ -55,9 +55,10 @@ def build_package_deb(jvers, btype, barch, bvers):
comment = f"Jellyfin release {jvers}, see https://github.com/jellyfin/jellyfin/releases/{jvers} for details."
else:
comment = f"Jellyin unstable release {jvers}."
+ jvers = jvers.replace('v', '')
changelog = changelog.format(
- package_version=jvers.replace('v', ''),
+ package_version=jvers,
package_build=f"{btype[:3]}{bvers.replace('.', '')}",
release_comment=comment,
release_date=format_datetime(localtime())
@@ -74,7 +75,7 @@ def build_package_deb(jvers, btype, barch, bvers):
os.system(f"docker run --rm --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{btype}:/dist --name {imagename} {imagename}")
-def build_package(jvers, btype, barch, bvers):
+def build_package_rpm(jvers, btype, barch, bvers):
pass
@@ -88,18 +89,55 @@ def build_linux(jvers, btype, barch, _bvers):
print(f"Invalid/unsupported arguments: {e}")
exit(1)
+ jvers = jvers.replace('v', '')
+
# Set the dockerfile
dockerfile = configurations[btype]["dockerfile"]
# Use a unique docker image name for consistency
imagename = f"{configurations[btype]['imagename']}-{jvers}_{barch}-{btype}"
+ # Set the archive type (tar-gz or zip)
+ archivetypes = f"{configurations[btype]['archivetypes']}"
+
# Build the dockerfile and packages
os.system(f"docker build --progress=plain --file {repo_root_dir}/{dockerfile} --tag {imagename} {repo_root_dir}")
- os.system(f"docker run --rm --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{btype}:/dist --env JVERS={jvers} --env PARCH={PARCH} --env DARCH={DARCH} --name {imagename} {imagename}")
+ os.system(f"docker run --rm --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{btype}:/dist --env JVERS={jvers} --env BTYPE={btype} --env PARCH={PARCH} --env DTYPE=linux --env DARCH={DARCH} --env ARCHIVE_TYPES={archivetypes} --name {imagename} {imagename}")
+
+
+def build_windows(jvers, btype, _barch, _bvers):
+ pass
+
+
+def build_macos(jvers, btype, barch, _bvers):
+ try:
+ PARCH = configurations[btype]['archmaps'][barch]['PARCH'] if barch in configurations[btype]['archmaps'].keys() else None
+ if PARCH is None:
+ raise ValueError(f"{barch} is not a valid {btype} {bvers} architecture in {configurations[btype]['archmaps'].keys()}")
+ DARCH = configurations[btype]['archmaps'][barch]['DARCH']
+ except Exception as e:
+ print(f"Invalid/unsupported arguments: {e}")
+ exit(1)
+
+ jvers = jvers.replace('v', '')
+
+ # Set the dockerfile
+ dockerfile = configurations[btype]["dockerfile"]
+
+ # Use a unique docker image name for consistency
+ imagename = f"{configurations[btype]['imagename']}-{jvers}_{barch}-{btype}"
+
+ # Set the archive type (tar-gz or zip)
+ archivetypes = f"{configurations[btype]['archivetypes']}"
+
+ # Build the dockerfile and packages
+ os.system(f"docker build --progress=plain --file {repo_root_dir}/{dockerfile} --tag {imagename} {repo_root_dir}")
+ os.system(f"docker run --rm --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{btype}:/dist --env JVERS={jvers} --env BTYPE={btype} --env PARCH={PARCH} --env DTYPE=osx --env DARCH={DARCH} --env ARCHIVE_TYPES={archivetypes} --name {imagename} {imagename}")
def build_portable(jvers, btype, _barch, _bvers):
+ jvers = jvers.replace('v', '')
+
# Set the dockerfile
dockerfile = configurations[btype]["dockerfile"]
@@ -111,7 +149,7 @@ def build_portable(jvers, btype, _barch, _bvers):
# Build the dockerfile and packages
os.system(f"docker build --progress=plain --file {repo_root_dir}/{dockerfile} --tag {imagename} {repo_root_dir}")
- os.system(f"docker run --rm --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{btype}:/dist --env JVERS={jvers} --env ARCHIVE_TYPES={archivetypes} --name {imagename} {imagename}")
+ os.system(f"docker run --rm --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{btype}:/dist --env JVERS={jvers} --env BTYPE={btype} --env ARCHIVE_TYPES={archivetypes} --name {imagename} {imagename}")
def build_docker(jvers, btype, _barch, _bvers):
@@ -132,6 +170,8 @@ def build_docker(jvers, btype, _barch, _bvers):
is_latest = False
version_suffix = False
+ jvers = jvers.replace('v', '')
+
# Set today's date in a convenient format for use as an image suffix
date = datetime.now().strftime("%Y%m%d-%H%M%S")
@@ -222,15 +262,16 @@ configurations = {
},
},
"fedora": {
- "def": build_package,
+ "def": build_package_rpm,
},
"centos": {
- "def": build_package,
+ "def": build_package_rpm,
},
"linux": {
"def": build_linux,
- "dockerfile": "linux/Dockerfile",
+ "dockerfile": "portable/Dockerfile",
"imagename": "jellyfin-builder",
+ "archivetypes": "tar",
"archmaps": {
"amd64": {
"PARCH": "amd64",
@@ -255,10 +296,23 @@ configurations = {
},
},
"windows": {
- "def": build_package,
+ "def": build_windows,
},
"macos": {
- "def": build_package,
+ "def": build_macos,
+ "dockerfile": "portable/Dockerfile",
+ "imagename": "jellyfin-builder",
+ "archivetypes": "tar",
+ "archmaps": {
+ "amd64": {
+ "PARCH": "amd64",
+ "DARCH": "x64",
+ },
+ "arm64": {
+ "PARCH": "arm64",
+ "DARCH": "arm64",
+ },
+ },
},
"portable": {
"def": build_portable,
diff --git a/linux/Dockerfile b/linux/Dockerfile
deleted file mode 120000
index 3bf4a35..0000000
--- a/linux/Dockerfile
+++ /dev/null
@@ -1 +0,0 @@
-../portable/Dockerfile \ No newline at end of file
diff --git a/linux/build.sh b/linux/build.sh
deleted file mode 100755
index 8af10ee..0000000
--- a/linux/build.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-
-#= Debian .deb builder
-
-set -o errexit
-set -o xtrace
-
-# Create the intermediate build dir
-BUILD_DIR="/build"
-mkdir -p ${BUILD_DIR}
-
-# Move to source directory
-pushd "${SOURCE_DIR}"
-
-# Build server
-pushd jellyfin-server
-dotnet publish Jellyfin.Server --configuration Release --self-contained --runtime linux-${DARCH} --output ${BUILD_DIR}/ -p:DebugSymbols=false -p:DebugType=none -p:UseAppHost=false
-popd
-
-# Build web
-pushd jellyfin-web
-npm ci --no-audit --unsafe-perm
-npm run build:production
-mv dist ${BUILD_DIR}/jellyfin-web
-popd
-
-mkdir -p "${ARTIFACT_DIR}/"
-
-pushd ${BUILD_DIR}
-tar -czf "${ARTIFACT_DIR}"/jellyfin_${JVERS}-${PARCH}.tar.gz .
-popd
-
-# Clean up any lingering artifacts
-make -f debian/rules clean
-rm -rf ${BUILD_DIR}
-
-popd
diff --git a/portable/build.sh b/portable/build.sh
index f8a3295..929327e 100755
--- a/portable/build.sh
+++ b/portable/build.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-#= Debian .deb builder
+#= Generic portable builder (portable, linux, macos, windows)
set -o errexit
set -o xtrace
@@ -14,7 +14,17 @@ pushd "${SOURCE_DIR}"
# Build server
pushd jellyfin-server
-dotnet publish Jellyfin.Server --configuration Release --output ${BUILD_DIR}/ -p:DebugSymbols=false -p:DebugType=none -p:UseAppHost=false
+case ${BTYPE} in
+ portable)
+ RUNTIME=""
+ APPHOST="-p:UseAppHost=false"
+ ;;
+ *)
+ RUNTIME="--self-contained --runtime ${DTYPE}-${DARCH}"
+ APPHOST="-p:UseAppHost=true"
+ ;;
+esac
+dotnet publish Jellyfin.Server --configuration Release ${RUNTIME} --output ${BUILD_DIR}/ -p:DebugSymbols=false -p:DebugType=none ${APPHOST}
popd
# Build web
@@ -30,10 +40,10 @@ pushd ${BUILD_DIR}
for ARCHIVE_TYPE in $( tr ',' '\n' <<<"${ARCHIVE_TYPES}" ); do
case ${ARCHIVE_TYPE} in
tar)
- tar -czf "${ARTIFACT_DIR}"/jellyfin_${JVERS}.tar.gz .
+ tar -czf "${ARTIFACT_DIR}"/jellyfin_${JVERS}-${PARCH}.tar.gz .
;;
zip)
- zip -qr "${ARTIFACT_DIR}"/jellyfin_${JVERS}.zip .
+ zip -qr "${ARTIFACT_DIR}"/jellyfin_${JVERS}-${PARCH}.zip .
;;
esac
done
bgstack15