##
## Distro: debian_9
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_debian_9_DOCKER_IMAGE_NAME:=jami-packaging-debian_9$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_debian_9_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_debian_9_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_debian_9 = 

PACKAGE_debian_9_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=debian_9 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/debian_9:/opt/output \
    -t $(DOCKER_EXTRA_ARGS)  \
    $(PACKAGE_debian_9_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_debian_9:
	if [ ! -z $(QEMU_STATIC_debian_9) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_debian_9) qemu-static/; fi

$(PACKAGE_debian_9_DOCKER_IMAGE_FILE): QEMU_STATIC_debian_9 docker/Dockerfile_debian_9
	docker build \
        -t $(PACKAGE_debian_9_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_debian_9  \
        $(CURDIR)
	touch $(PACKAGE_debian_9_DOCKER_IMAGE_FILE)

packages/debian_9:
	mkdir -p packages/debian_9

packages/debian_9/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/debian_9 $(PACKAGE_debian_9_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_9_DOCKER_RUN_COMMAND)
	touch packages/debian_9/*

.PHONY: package-debian_9
package-debian_9: packages/debian_9/$(DEBIAN_DSC_FILENAME)

.PHONY: package-debian_9-interactive
package-debian_9-interactive: DOCKER_EXTRA_ARGS = -i
package-debian_9-interactive: $(RELEASE_TARBALL_FILENAME) packages/debian_9 $(PACKAGE_debian_9_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_9_DOCKER_RUN_COMMAND) bash

##
## Distro: debian_9_i386
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_debian_9_i386_DOCKER_IMAGE_NAME:=jami-packaging-debian_9_i386$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_debian_9_i386_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_debian_9_i386_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_debian_9_i386 = 

PACKAGE_debian_9_i386_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=debian_9_i386 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/debian_9_i386:/opt/output \
    -t $(DOCKER_EXTRA_ARGS)  \
    $(PACKAGE_debian_9_i386_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_debian_9_i386:
	if [ ! -z $(QEMU_STATIC_debian_9_i386) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_debian_9_i386) qemu-static/; fi

$(PACKAGE_debian_9_i386_DOCKER_IMAGE_FILE): QEMU_STATIC_debian_9_i386 docker/Dockerfile_debian_9_i386
	docker build \
        -t $(PACKAGE_debian_9_i386_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_debian_9_i386  \
        $(CURDIR)
	touch $(PACKAGE_debian_9_i386_DOCKER_IMAGE_FILE)

packages/debian_9_i386:
	mkdir -p packages/debian_9_i386

packages/debian_9_i386/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/debian_9_i386 $(PACKAGE_debian_9_i386_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_9_i386_DOCKER_RUN_COMMAND)
	touch packages/debian_9_i386/*

.PHONY: package-debian_9_i386
package-debian_9_i386: packages/debian_9_i386/$(DEBIAN_DSC_FILENAME)

.PHONY: package-debian_9_i386-interactive
package-debian_9_i386-interactive: DOCKER_EXTRA_ARGS = -i
package-debian_9_i386-interactive: $(RELEASE_TARBALL_FILENAME) packages/debian_9_i386 $(PACKAGE_debian_9_i386_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_9_i386_DOCKER_RUN_COMMAND) bash

##
## Distro: debian_9_armhf
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_debian_9_armhf_DOCKER_IMAGE_NAME:=jami-packaging-debian_9_armhf$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_debian_9_armhf_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_debian_9_armhf_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_debian_9_armhf = qemu-arm-static

PACKAGE_debian_9_armhf_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=debian_9_armhf \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/debian_9_armhf:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_debian_9_armhf_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_debian_9_armhf:
	if [ ! -z $(QEMU_STATIC_debian_9_armhf) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_debian_9_armhf) qemu-static/; fi

$(PACKAGE_debian_9_armhf_DOCKER_IMAGE_FILE): QEMU_STATIC_debian_9_armhf docker/Dockerfile_debian_9_armhf
	docker build \
        -t $(PACKAGE_debian_9_armhf_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_debian_9_armhf  \
        $(CURDIR)
	touch $(PACKAGE_debian_9_armhf_DOCKER_IMAGE_FILE)

packages/debian_9_armhf:
	mkdir -p packages/debian_9_armhf

packages/debian_9_armhf/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/debian_9_armhf $(PACKAGE_debian_9_armhf_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_9_armhf_DOCKER_RUN_COMMAND)
	touch packages/debian_9_armhf/*

.PHONY: package-debian_9_armhf
package-debian_9_armhf: packages/debian_9_armhf/$(DEBIAN_DSC_FILENAME)

.PHONY: package-debian_9_armhf-interactive
package-debian_9_armhf-interactive: DOCKER_EXTRA_ARGS = -i
package-debian_9_armhf-interactive: $(RELEASE_TARBALL_FILENAME) packages/debian_9_armhf $(PACKAGE_debian_9_armhf_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_9_armhf_DOCKER_RUN_COMMAND) bash

##
## Distro: debian_9_arm64
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_debian_9_arm64_DOCKER_IMAGE_NAME:=jami-packaging-debian_9_arm64$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_debian_9_arm64_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_debian_9_arm64_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_debian_9_arm64 = qemu-aarch64-static

PACKAGE_debian_9_arm64_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=debian_9_arm64 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/debian_9_arm64:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_debian_9_arm64_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_debian_9_arm64:
	if [ ! -z $(QEMU_STATIC_debian_9_arm64) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_debian_9_arm64) qemu-static/; fi

$(PACKAGE_debian_9_arm64_DOCKER_IMAGE_FILE): QEMU_STATIC_debian_9_arm64 docker/Dockerfile_debian_9_arm64
	docker build \
        -t $(PACKAGE_debian_9_arm64_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_debian_9_arm64  \
        $(CURDIR)
	touch $(PACKAGE_debian_9_arm64_DOCKER_IMAGE_FILE)

packages/debian_9_arm64:
	mkdir -p packages/debian_9_arm64

packages/debian_9_arm64/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/debian_9_arm64 $(PACKAGE_debian_9_arm64_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_9_arm64_DOCKER_RUN_COMMAND)
	touch packages/debian_9_arm64/*

.PHONY: package-debian_9_arm64
package-debian_9_arm64: packages/debian_9_arm64/$(DEBIAN_DSC_FILENAME)

.PHONY: package-debian_9_arm64-interactive
package-debian_9_arm64-interactive: DOCKER_EXTRA_ARGS = -i
package-debian_9_arm64-interactive: $(RELEASE_TARBALL_FILENAME) packages/debian_9_arm64 $(PACKAGE_debian_9_arm64_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_9_arm64_DOCKER_RUN_COMMAND) bash

##
## Distro: debian_9_oci
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_debian_9_oci_DOCKER_IMAGE_NAME:=jami-packaging-debian_9_oci$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_debian_9_oci_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_debian_9_oci_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_debian_9_oci = 

PACKAGE_debian_9_oci_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_OCI_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=debian_9_oci \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/debian_9_oci:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) -e OVERRIDE_PACKAGING_DIR=$(DEBIAN_OCI_PKG_DIR) \
    $(PACKAGE_debian_9_oci_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_debian_9_oci:
	if [ ! -z $(QEMU_STATIC_debian_9_oci) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_debian_9_oci) qemu-static/; fi

$(PACKAGE_debian_9_oci_DOCKER_IMAGE_FILE): QEMU_STATIC_debian_9_oci docker/Dockerfile_debian_9
	docker build \
        -t $(PACKAGE_debian_9_oci_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_debian_9  \
        $(CURDIR)
	touch $(PACKAGE_debian_9_oci_DOCKER_IMAGE_FILE)

packages/debian_9_oci:
	mkdir -p packages/debian_9_oci

packages/debian_9_oci/$(DEBIAN_OCI_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/debian_9_oci $(PACKAGE_debian_9_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_9_oci_DOCKER_RUN_COMMAND)
	touch packages/debian_9_oci/*

.PHONY: package-debian_9_oci
package-debian_9_oci: packages/debian_9_oci/$(DEBIAN_OCI_DSC_FILENAME)

.PHONY: package-debian_9_oci-interactive
package-debian_9_oci-interactive: DOCKER_EXTRA_ARGS = -i
package-debian_9_oci-interactive: $(RELEASE_TARBALL_FILENAME) packages/debian_9_oci $(PACKAGE_debian_9_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_9_oci_DOCKER_RUN_COMMAND) bash

##
## Distro: debian_9_i386_oci
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_debian_9_i386_oci_DOCKER_IMAGE_NAME:=jami-packaging-debian_9_i386_oci$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_debian_9_i386_oci_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_debian_9_i386_oci_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_debian_9_i386_oci = 

PACKAGE_debian_9_i386_oci_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_OCI_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=debian_9_i386_oci \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/debian_9_i386_oci:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) -e OVERRIDE_PACKAGING_DIR=$(DEBIAN_OCI_PKG_DIR) \
    $(PACKAGE_debian_9_i386_oci_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_debian_9_i386_oci:
	if [ ! -z $(QEMU_STATIC_debian_9_i386_oci) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_debian_9_i386_oci) qemu-static/; fi

$(PACKAGE_debian_9_i386_oci_DOCKER_IMAGE_FILE): QEMU_STATIC_debian_9_i386_oci docker/Dockerfile_debian_9_i386
	docker build \
        -t $(PACKAGE_debian_9_i386_oci_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_debian_9_i386  \
        $(CURDIR)
	touch $(PACKAGE_debian_9_i386_oci_DOCKER_IMAGE_FILE)

packages/debian_9_i386_oci:
	mkdir -p packages/debian_9_i386_oci

packages/debian_9_i386_oci/$(DEBIAN_OCI_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/debian_9_i386_oci $(PACKAGE_debian_9_i386_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_9_i386_oci_DOCKER_RUN_COMMAND)
	touch packages/debian_9_i386_oci/*

.PHONY: package-debian_9_i386_oci
package-debian_9_i386_oci: packages/debian_9_i386_oci/$(DEBIAN_OCI_DSC_FILENAME)

.PHONY: package-debian_9_i386_oci-interactive
package-debian_9_i386_oci-interactive: DOCKER_EXTRA_ARGS = -i
package-debian_9_i386_oci-interactive: $(RELEASE_TARBALL_FILENAME) packages/debian_9_i386_oci $(PACKAGE_debian_9_i386_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_9_i386_oci_DOCKER_RUN_COMMAND) bash

##
## Distro: debian_9_armhf_oci
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_debian_9_armhf_oci_DOCKER_IMAGE_NAME:=jami-packaging-debian_9_armhf_oci$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_debian_9_armhf_oci_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_debian_9_armhf_oci_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_debian_9_armhf_oci = qemu-arm-static

PACKAGE_debian_9_armhf_oci_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_OCI_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=debian_9_armhf_oci \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/debian_9_armhf_oci:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) -e OVERRIDE_PACKAGING_DIR=$(DEBIAN_OCI_PKG_DIR) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_debian_9_armhf_oci_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_debian_9_armhf_oci:
	if [ ! -z $(QEMU_STATIC_debian_9_armhf_oci) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_debian_9_armhf_oci) qemu-static/; fi

$(PACKAGE_debian_9_armhf_oci_DOCKER_IMAGE_FILE): QEMU_STATIC_debian_9_armhf_oci docker/Dockerfile_debian_9_armhf
	docker build \
        -t $(PACKAGE_debian_9_armhf_oci_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_debian_9_armhf  \
        $(CURDIR)
	touch $(PACKAGE_debian_9_armhf_oci_DOCKER_IMAGE_FILE)

packages/debian_9_armhf_oci:
	mkdir -p packages/debian_9_armhf_oci

packages/debian_9_armhf_oci/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/debian_9_armhf_oci $(PACKAGE_debian_9_armhf_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_9_armhf_oci_DOCKER_RUN_COMMAND)
	touch packages/debian_9_armhf_oci/*

.PHONY: package-debian_9_armhf_oci
package-debian_9_armhf_oci: packages/debian_9_armhf_oci/$(DEBIAN_DSC_FILENAME)

.PHONY: package-debian_9_armhf_oci-interactive
package-debian_9_armhf_oci-interactive: DOCKER_EXTRA_ARGS = -i
package-debian_9_armhf_oci-interactive: $(RELEASE_TARBALL_FILENAME) packages/debian_9_armhf_oci $(PACKAGE_debian_9_armhf_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_9_armhf_oci_DOCKER_RUN_COMMAND) bash

##
## Distro: debian_9_arm64_oci
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_debian_9_arm64_oci_DOCKER_IMAGE_NAME:=jami-packaging-debian_9_arm64_oci$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_debian_9_arm64_oci_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_debian_9_arm64_oci_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_debian_9_arm64_oci = qemu-aarch64-static

PACKAGE_debian_9_arm64_oci_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_OCI_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=debian_9_arm64_oci \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/debian_9_arm64_oci:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) -e OVERRIDE_PACKAGING_DIR=$(DEBIAN_OCI_PKG_DIR) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_debian_9_arm64_oci_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_debian_9_arm64_oci:
	if [ ! -z $(QEMU_STATIC_debian_9_arm64_oci) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_debian_9_arm64_oci) qemu-static/; fi

$(PACKAGE_debian_9_arm64_oci_DOCKER_IMAGE_FILE): QEMU_STATIC_debian_9_arm64_oci docker/Dockerfile_debian_9_arm64
	docker build \
        -t $(PACKAGE_debian_9_arm64_oci_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_debian_9_arm64  \
        $(CURDIR)
	touch $(PACKAGE_debian_9_arm64_oci_DOCKER_IMAGE_FILE)

packages/debian_9_arm64_oci:
	mkdir -p packages/debian_9_arm64_oci

packages/debian_9_arm64_oci/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/debian_9_arm64_oci $(PACKAGE_debian_9_arm64_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_9_arm64_oci_DOCKER_RUN_COMMAND)
	touch packages/debian_9_arm64_oci/*

.PHONY: package-debian_9_arm64_oci
package-debian_9_arm64_oci: packages/debian_9_arm64_oci/$(DEBIAN_DSC_FILENAME)

.PHONY: package-debian_9_arm64_oci-interactive
package-debian_9_arm64_oci-interactive: DOCKER_EXTRA_ARGS = -i
package-debian_9_arm64_oci-interactive: $(RELEASE_TARBALL_FILENAME) packages/debian_9_arm64_oci $(PACKAGE_debian_9_arm64_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_9_arm64_oci_DOCKER_RUN_COMMAND) bash

##
## Distro: debian_10
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_debian_10_DOCKER_IMAGE_NAME:=jami-packaging-debian_10$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_debian_10_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_debian_10_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_debian_10 = 

PACKAGE_debian_10_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=debian_10 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/debian_10:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_debian_10_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_debian_10:
	if [ ! -z $(QEMU_STATIC_debian_10) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_debian_10) qemu-static/; fi

$(PACKAGE_debian_10_DOCKER_IMAGE_FILE): QEMU_STATIC_debian_10 docker/Dockerfile_debian_10
	docker build \
        -t $(PACKAGE_debian_10_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_debian_10  \
        $(CURDIR)
	touch $(PACKAGE_debian_10_DOCKER_IMAGE_FILE)

packages/debian_10:
	mkdir -p packages/debian_10

packages/debian_10/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/debian_10 $(PACKAGE_debian_10_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_10_DOCKER_RUN_COMMAND)
	touch packages/debian_10/*

.PHONY: package-debian_10
package-debian_10: packages/debian_10/$(DEBIAN_DSC_FILENAME)

.PHONY: package-debian_10-interactive
package-debian_10-interactive: DOCKER_EXTRA_ARGS = -i
package-debian_10-interactive: $(RELEASE_TARBALL_FILENAME) packages/debian_10 $(PACKAGE_debian_10_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_10_DOCKER_RUN_COMMAND) bash

##
## Distro: debian_10_i386
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_debian_10_i386_DOCKER_IMAGE_NAME:=jami-packaging-debian_10_i386$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_debian_10_i386_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_debian_10_i386_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_debian_10_i386 = 

PACKAGE_debian_10_i386_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=debian_10_i386 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/debian_10_i386:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_debian_10_i386_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_debian_10_i386:
	if [ ! -z $(QEMU_STATIC_debian_10_i386) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_debian_10_i386) qemu-static/; fi

$(PACKAGE_debian_10_i386_DOCKER_IMAGE_FILE): QEMU_STATIC_debian_10_i386 docker/Dockerfile_debian_10_i386
	docker build \
        -t $(PACKAGE_debian_10_i386_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_debian_10_i386  \
        $(CURDIR)
	touch $(PACKAGE_debian_10_i386_DOCKER_IMAGE_FILE)

packages/debian_10_i386:
	mkdir -p packages/debian_10_i386

packages/debian_10_i386/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/debian_10_i386 $(PACKAGE_debian_10_i386_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_10_i386_DOCKER_RUN_COMMAND)
	touch packages/debian_10_i386/*

.PHONY: package-debian_10_i386
package-debian_10_i386: packages/debian_10_i386/$(DEBIAN_DSC_FILENAME)

.PHONY: package-debian_10_i386-interactive
package-debian_10_i386-interactive: DOCKER_EXTRA_ARGS = -i
package-debian_10_i386-interactive: $(RELEASE_TARBALL_FILENAME) packages/debian_10_i386 $(PACKAGE_debian_10_i386_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_10_i386_DOCKER_RUN_COMMAND) bash

##
## Distro: debian_10_armhf
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_debian_10_armhf_DOCKER_IMAGE_NAME:=jami-packaging-debian_10_armhf$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_debian_10_armhf_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_debian_10_armhf_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_debian_10_armhf = qemu-arm-static

PACKAGE_debian_10_armhf_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=debian_10_armhf \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/debian_10_armhf:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_debian_10_armhf_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_debian_10_armhf:
	if [ ! -z $(QEMU_STATIC_debian_10_armhf) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_debian_10_armhf) qemu-static/; fi

$(PACKAGE_debian_10_armhf_DOCKER_IMAGE_FILE): QEMU_STATIC_debian_10_armhf docker/Dockerfile_debian_10_armhf
	docker build \
        -t $(PACKAGE_debian_10_armhf_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_debian_10_armhf  \
        $(CURDIR)
	touch $(PACKAGE_debian_10_armhf_DOCKER_IMAGE_FILE)

packages/debian_10_armhf:
	mkdir -p packages/debian_10_armhf

packages/debian_10_armhf/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/debian_10_armhf $(PACKAGE_debian_10_armhf_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_10_armhf_DOCKER_RUN_COMMAND)
	touch packages/debian_10_armhf/*

.PHONY: package-debian_10_armhf
package-debian_10_armhf: packages/debian_10_armhf/$(DEBIAN_DSC_FILENAME)

.PHONY: package-debian_10_armhf-interactive
package-debian_10_armhf-interactive: DOCKER_EXTRA_ARGS = -i
package-debian_10_armhf-interactive: $(RELEASE_TARBALL_FILENAME) packages/debian_10_armhf $(PACKAGE_debian_10_armhf_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_10_armhf_DOCKER_RUN_COMMAND) bash

##
## Distro: debian_10_arm64
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_debian_10_arm64_DOCKER_IMAGE_NAME:=jami-packaging-debian_10_arm64$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_debian_10_arm64_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_debian_10_arm64_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_debian_10_arm64 = qemu-aarch64-static

PACKAGE_debian_10_arm64_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=debian_10_arm64 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/debian_10_arm64:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_debian_10_arm64_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_debian_10_arm64:
	if [ ! -z $(QEMU_STATIC_debian_10_arm64) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_debian_10_arm64) qemu-static/; fi

$(PACKAGE_debian_10_arm64_DOCKER_IMAGE_FILE): QEMU_STATIC_debian_10_arm64 docker/Dockerfile_debian_10_arm64
	docker build \
        -t $(PACKAGE_debian_10_arm64_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_debian_10_arm64  \
        $(CURDIR)
	touch $(PACKAGE_debian_10_arm64_DOCKER_IMAGE_FILE)

packages/debian_10_arm64:
	mkdir -p packages/debian_10_arm64

packages/debian_10_arm64/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/debian_10_arm64 $(PACKAGE_debian_10_arm64_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_10_arm64_DOCKER_RUN_COMMAND)
	touch packages/debian_10_arm64/*

.PHONY: package-debian_10_arm64
package-debian_10_arm64: packages/debian_10_arm64/$(DEBIAN_DSC_FILENAME)

.PHONY: package-debian_10_arm64-interactive
package-debian_10_arm64-interactive: DOCKER_EXTRA_ARGS = -i
package-debian_10_arm64-interactive: $(RELEASE_TARBALL_FILENAME) packages/debian_10_arm64 $(PACKAGE_debian_10_arm64_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_10_arm64_DOCKER_RUN_COMMAND) bash

##
## Distro: debian_10_oci
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_debian_10_oci_DOCKER_IMAGE_NAME:=jami-packaging-debian_10_oci$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_debian_10_oci_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_debian_10_oci_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_debian_10_oci = 

PACKAGE_debian_10_oci_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_OCI_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=debian_10_oci \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/debian_10_oci:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) -e OVERRIDE_PACKAGING_DIR=$(DEBIAN_OCI_PKG_DIR) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_debian_10_oci_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_debian_10_oci:
	if [ ! -z $(QEMU_STATIC_debian_10_oci) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_debian_10_oci) qemu-static/; fi

$(PACKAGE_debian_10_oci_DOCKER_IMAGE_FILE): QEMU_STATIC_debian_10_oci docker/Dockerfile_debian_10
	docker build \
        -t $(PACKAGE_debian_10_oci_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_debian_10  \
        $(CURDIR)
	touch $(PACKAGE_debian_10_oci_DOCKER_IMAGE_FILE)

packages/debian_10_oci:
	mkdir -p packages/debian_10_oci

packages/debian_10_oci/$(DEBIAN_OCI_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/debian_10_oci $(PACKAGE_debian_10_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_10_oci_DOCKER_RUN_COMMAND)
	touch packages/debian_10_oci/*

.PHONY: package-debian_10_oci
package-debian_10_oci: packages/debian_10_oci/$(DEBIAN_OCI_DSC_FILENAME)

.PHONY: package-debian_10_oci-interactive
package-debian_10_oci-interactive: DOCKER_EXTRA_ARGS = -i
package-debian_10_oci-interactive: $(RELEASE_TARBALL_FILENAME) packages/debian_10_oci $(PACKAGE_debian_10_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_10_oci_DOCKER_RUN_COMMAND) bash

##
## Distro: debian_10_i386_oci
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_debian_10_i386_oci_DOCKER_IMAGE_NAME:=jami-packaging-debian_10_i386_oci$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_debian_10_i386_oci_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_debian_10_i386_oci_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_debian_10_i386_oci = 

PACKAGE_debian_10_i386_oci_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_OCI_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=debian_10_i386_oci \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/debian_10_i386_oci:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) -e OVERRIDE_PACKAGING_DIR=$(DEBIAN_OCI_PKG_DIR) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_debian_10_i386_oci_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_debian_10_i386_oci:
	if [ ! -z $(QEMU_STATIC_debian_10_i386_oci) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_debian_10_i386_oci) qemu-static/; fi

$(PACKAGE_debian_10_i386_oci_DOCKER_IMAGE_FILE): QEMU_STATIC_debian_10_i386_oci docker/Dockerfile_debian_10_i386
	docker build \
        -t $(PACKAGE_debian_10_i386_oci_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_debian_10_i386  \
        $(CURDIR)
	touch $(PACKAGE_debian_10_i386_oci_DOCKER_IMAGE_FILE)

packages/debian_10_i386_oci:
	mkdir -p packages/debian_10_i386_oci

packages/debian_10_i386_oci/$(DEBIAN_OCI_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/debian_10_i386_oci $(PACKAGE_debian_10_i386_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_10_i386_oci_DOCKER_RUN_COMMAND)
	touch packages/debian_10_i386_oci/*

.PHONY: package-debian_10_i386_oci
package-debian_10_i386_oci: packages/debian_10_i386_oci/$(DEBIAN_OCI_DSC_FILENAME)

.PHONY: package-debian_10_i386_oci-interactive
package-debian_10_i386_oci-interactive: DOCKER_EXTRA_ARGS = -i
package-debian_10_i386_oci-interactive: $(RELEASE_TARBALL_FILENAME) packages/debian_10_i386_oci $(PACKAGE_debian_10_i386_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_10_i386_oci_DOCKER_RUN_COMMAND) bash

##
## Distro: debian_10_armhf_oci
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_debian_10_armhf_oci_DOCKER_IMAGE_NAME:=jami-packaging-debian_10_armhf_oci$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_debian_10_armhf_oci_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_debian_10_armhf_oci_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_debian_10_armhf_oci = qemu-arm-static

PACKAGE_debian_10_armhf_oci_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_OCI_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=debian_10_armhf_oci \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/debian_10_armhf_oci:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) -e OVERRIDE_PACKAGING_DIR=$(DEBIAN_OCI_PKG_DIR) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_debian_10_armhf_oci_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_debian_10_armhf_oci:
	if [ ! -z $(QEMU_STATIC_debian_10_armhf_oci) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_debian_10_armhf_oci) qemu-static/; fi

$(PACKAGE_debian_10_armhf_oci_DOCKER_IMAGE_FILE): QEMU_STATIC_debian_10_armhf_oci docker/Dockerfile_debian_10_armhf
	docker build \
        -t $(PACKAGE_debian_10_armhf_oci_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_debian_10_armhf  \
        $(CURDIR)
	touch $(PACKAGE_debian_10_armhf_oci_DOCKER_IMAGE_FILE)

packages/debian_10_armhf_oci:
	mkdir -p packages/debian_10_armhf_oci

packages/debian_10_armhf_oci/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/debian_10_armhf_oci $(PACKAGE_debian_10_armhf_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_10_armhf_oci_DOCKER_RUN_COMMAND)
	touch packages/debian_10_armhf_oci/*

.PHONY: package-debian_10_armhf_oci
package-debian_10_armhf_oci: packages/debian_10_armhf_oci/$(DEBIAN_DSC_FILENAME)

.PHONY: package-debian_10_armhf_oci-interactive
package-debian_10_armhf_oci-interactive: DOCKER_EXTRA_ARGS = -i
package-debian_10_armhf_oci-interactive: $(RELEASE_TARBALL_FILENAME) packages/debian_10_armhf_oci $(PACKAGE_debian_10_armhf_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_10_armhf_oci_DOCKER_RUN_COMMAND) bash

##
## Distro: debian_10_arm64_oci
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_debian_10_arm64_oci_DOCKER_IMAGE_NAME:=jami-packaging-debian_10_arm64_oci$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_debian_10_arm64_oci_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_debian_10_arm64_oci_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_debian_10_arm64_oci = qemu-aarch64-static

PACKAGE_debian_10_arm64_oci_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_OCI_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=debian_10_arm64_oci \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/debian_10_arm64_oci:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) -e OVERRIDE_PACKAGING_DIR=$(DEBIAN_OCI_PKG_DIR) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_debian_10_arm64_oci_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_debian_10_arm64_oci:
	if [ ! -z $(QEMU_STATIC_debian_10_arm64_oci) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_debian_10_arm64_oci) qemu-static/; fi

$(PACKAGE_debian_10_arm64_oci_DOCKER_IMAGE_FILE): QEMU_STATIC_debian_10_arm64_oci docker/Dockerfile_debian_10_arm64
	docker build \
        -t $(PACKAGE_debian_10_arm64_oci_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_debian_10_arm64  \
        $(CURDIR)
	touch $(PACKAGE_debian_10_arm64_oci_DOCKER_IMAGE_FILE)

packages/debian_10_arm64_oci:
	mkdir -p packages/debian_10_arm64_oci

packages/debian_10_arm64_oci/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/debian_10_arm64_oci $(PACKAGE_debian_10_arm64_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_10_arm64_oci_DOCKER_RUN_COMMAND)
	touch packages/debian_10_arm64_oci/*

.PHONY: package-debian_10_arm64_oci
package-debian_10_arm64_oci: packages/debian_10_arm64_oci/$(DEBIAN_DSC_FILENAME)

.PHONY: package-debian_10_arm64_oci-interactive
package-debian_10_arm64_oci-interactive: DOCKER_EXTRA_ARGS = -i
package-debian_10_arm64_oci-interactive: $(RELEASE_TARBALL_FILENAME) packages/debian_10_arm64_oci $(PACKAGE_debian_10_arm64_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_debian_10_arm64_oci_DOCKER_RUN_COMMAND) bash

##
## Distro: raspbian_10_armhf
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_raspbian_10_armhf_DOCKER_IMAGE_NAME:=jami-packaging-raspbian_10_armhf$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_raspbian_10_armhf_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_raspbian_10_armhf_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_raspbian_10_armhf = 

PACKAGE_raspbian_10_armhf_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=raspbian_10_armhf \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/raspbian_10_armhf:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_raspbian_10_armhf_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_raspbian_10_armhf:
	if [ ! -z $(QEMU_STATIC_raspbian_10_armhf) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_raspbian_10_armhf) qemu-static/; fi

$(PACKAGE_raspbian_10_armhf_DOCKER_IMAGE_FILE): QEMU_STATIC_raspbian_10_armhf docker/Dockerfile_raspbian_10_armhf
	docker build \
        -t $(PACKAGE_raspbian_10_armhf_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_raspbian_10_armhf  \
        $(CURDIR)
	touch $(PACKAGE_raspbian_10_armhf_DOCKER_IMAGE_FILE)

packages/raspbian_10_armhf:
	mkdir -p packages/raspbian_10_armhf

packages/raspbian_10_armhf/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/raspbian_10_armhf $(PACKAGE_raspbian_10_armhf_DOCKER_IMAGE_FILE)
	$(PACKAGE_raspbian_10_armhf_DOCKER_RUN_COMMAND)
	touch packages/raspbian_10_armhf/*

.PHONY: package-raspbian_10_armhf
package-raspbian_10_armhf: packages/raspbian_10_armhf/$(DEBIAN_DSC_FILENAME)

.PHONY: package-raspbian_10_armhf-interactive
package-raspbian_10_armhf-interactive: DOCKER_EXTRA_ARGS = -i
package-raspbian_10_armhf-interactive: $(RELEASE_TARBALL_FILENAME) packages/raspbian_10_armhf $(PACKAGE_raspbian_10_armhf_DOCKER_IMAGE_FILE)
	$(PACKAGE_raspbian_10_armhf_DOCKER_RUN_COMMAND) bash

##
## Distro: raspbian_10_armhf_oci
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_raspbian_10_armhf_oci_DOCKER_IMAGE_NAME:=jami-packaging-raspbian_10_armhf_oci$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_raspbian_10_armhf_oci_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_raspbian_10_armhf_oci_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_raspbian_10_armhf_oci = 

PACKAGE_raspbian_10_armhf_oci_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_OCI_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=raspbian_10_armhf_oci \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/raspbian_10_armhf_oci:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) -e OVERRIDE_PACKAGING_DIR=$(DEBIAN_OCI_PKG_DIR) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_raspbian_10_armhf_oci_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_raspbian_10_armhf_oci:
	if [ ! -z $(QEMU_STATIC_raspbian_10_armhf_oci) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_raspbian_10_armhf_oci) qemu-static/; fi

$(PACKAGE_raspbian_10_armhf_oci_DOCKER_IMAGE_FILE): QEMU_STATIC_raspbian_10_armhf_oci docker/Dockerfile_raspbian_10_armhf
	docker build \
        -t $(PACKAGE_raspbian_10_armhf_oci_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_raspbian_10_armhf  \
        $(CURDIR)
	touch $(PACKAGE_raspbian_10_armhf_oci_DOCKER_IMAGE_FILE)

packages/raspbian_10_armhf_oci:
	mkdir -p packages/raspbian_10_armhf_oci

packages/raspbian_10_armhf_oci/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/raspbian_10_armhf_oci $(PACKAGE_raspbian_10_armhf_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_raspbian_10_armhf_oci_DOCKER_RUN_COMMAND)
	touch packages/raspbian_10_armhf_oci/*

.PHONY: package-raspbian_10_armhf_oci
package-raspbian_10_armhf_oci: packages/raspbian_10_armhf_oci/$(DEBIAN_DSC_FILENAME)

.PHONY: package-raspbian_10_armhf_oci-interactive
package-raspbian_10_armhf_oci-interactive: DOCKER_EXTRA_ARGS = -i
package-raspbian_10_armhf_oci-interactive: $(RELEASE_TARBALL_FILENAME) packages/raspbian_10_armhf_oci $(PACKAGE_raspbian_10_armhf_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_raspbian_10_armhf_oci_DOCKER_RUN_COMMAND) bash

##
## Distro: ubuntu_18.04
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_ubuntu_18.04_DOCKER_IMAGE_NAME:=jami-packaging-ubuntu_18.04$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_ubuntu_18.04_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_ubuntu_18.04_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_ubuntu_18.04 = 

PACKAGE_ubuntu_18.04_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=ubuntu_18.04 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/ubuntu_18.04:/opt/output \
    -t $(DOCKER_EXTRA_ARGS)  \
    $(PACKAGE_ubuntu_18.04_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_ubuntu_18.04:
	if [ ! -z $(QEMU_STATIC_ubuntu_18.04) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_ubuntu_18.04) qemu-static/; fi

$(PACKAGE_ubuntu_18.04_DOCKER_IMAGE_FILE): QEMU_STATIC_ubuntu_18.04 docker/Dockerfile_ubuntu_18.04
	docker build \
        -t $(PACKAGE_ubuntu_18.04_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_ubuntu_18.04  \
        $(CURDIR)
	touch $(PACKAGE_ubuntu_18.04_DOCKER_IMAGE_FILE)

packages/ubuntu_18.04:
	mkdir -p packages/ubuntu_18.04

packages/ubuntu_18.04/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/ubuntu_18.04 $(PACKAGE_ubuntu_18.04_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_18.04_DOCKER_RUN_COMMAND)
	touch packages/ubuntu_18.04/*

.PHONY: package-ubuntu_18.04
package-ubuntu_18.04: packages/ubuntu_18.04/$(DEBIAN_DSC_FILENAME)

.PHONY: package-ubuntu_18.04-interactive
package-ubuntu_18.04-interactive: DOCKER_EXTRA_ARGS = -i
package-ubuntu_18.04-interactive: $(RELEASE_TARBALL_FILENAME) packages/ubuntu_18.04 $(PACKAGE_ubuntu_18.04_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_18.04_DOCKER_RUN_COMMAND) bash

##
## Distro: ubuntu_18.04_i386
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_ubuntu_18.04_i386_DOCKER_IMAGE_NAME:=jami-packaging-ubuntu_18.04_i386$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_ubuntu_18.04_i386_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_ubuntu_18.04_i386_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_ubuntu_18.04_i386 = 

PACKAGE_ubuntu_18.04_i386_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=ubuntu_18.04_i386 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/ubuntu_18.04_i386:/opt/output \
    -t $(DOCKER_EXTRA_ARGS)  \
    $(PACKAGE_ubuntu_18.04_i386_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_ubuntu_18.04_i386:
	if [ ! -z $(QEMU_STATIC_ubuntu_18.04_i386) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_ubuntu_18.04_i386) qemu-static/; fi

$(PACKAGE_ubuntu_18.04_i386_DOCKER_IMAGE_FILE): QEMU_STATIC_ubuntu_18.04_i386 docker/Dockerfile_ubuntu_18.04_i386
	docker build \
        -t $(PACKAGE_ubuntu_18.04_i386_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_ubuntu_18.04_i386  \
        $(CURDIR)
	touch $(PACKAGE_ubuntu_18.04_i386_DOCKER_IMAGE_FILE)

packages/ubuntu_18.04_i386:
	mkdir -p packages/ubuntu_18.04_i386

packages/ubuntu_18.04_i386/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/ubuntu_18.04_i386 $(PACKAGE_ubuntu_18.04_i386_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_18.04_i386_DOCKER_RUN_COMMAND)
	touch packages/ubuntu_18.04_i386/*

.PHONY: package-ubuntu_18.04_i386
package-ubuntu_18.04_i386: packages/ubuntu_18.04_i386/$(DEBIAN_DSC_FILENAME)

.PHONY: package-ubuntu_18.04_i386-interactive
package-ubuntu_18.04_i386-interactive: DOCKER_EXTRA_ARGS = -i
package-ubuntu_18.04_i386-interactive: $(RELEASE_TARBALL_FILENAME) packages/ubuntu_18.04_i386 $(PACKAGE_ubuntu_18.04_i386_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_18.04_i386_DOCKER_RUN_COMMAND) bash

##
## Distro: ubuntu_18.04_oci
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_ubuntu_18.04_oci_DOCKER_IMAGE_NAME:=jami-packaging-ubuntu_18.04_oci$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_ubuntu_18.04_oci_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_ubuntu_18.04_oci_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_ubuntu_18.04_oci = 

PACKAGE_ubuntu_18.04_oci_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_OCI_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=ubuntu_18.04_oci \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/ubuntu_18.04_oci:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) -e OVERRIDE_PACKAGING_DIR=$(DEBIAN_OCI_PKG_DIR) \
    $(PACKAGE_ubuntu_18.04_oci_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_ubuntu_18.04_oci:
	if [ ! -z $(QEMU_STATIC_ubuntu_18.04_oci) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_ubuntu_18.04_oci) qemu-static/; fi

$(PACKAGE_ubuntu_18.04_oci_DOCKER_IMAGE_FILE): QEMU_STATIC_ubuntu_18.04_oci docker/Dockerfile_ubuntu_18.04
	docker build \
        -t $(PACKAGE_ubuntu_18.04_oci_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_ubuntu_18.04  \
        $(CURDIR)
	touch $(PACKAGE_ubuntu_18.04_oci_DOCKER_IMAGE_FILE)

packages/ubuntu_18.04_oci:
	mkdir -p packages/ubuntu_18.04_oci

packages/ubuntu_18.04_oci/$(DEBIAN_OCI_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/ubuntu_18.04_oci $(PACKAGE_ubuntu_18.04_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_18.04_oci_DOCKER_RUN_COMMAND)
	touch packages/ubuntu_18.04_oci/*

.PHONY: package-ubuntu_18.04_oci
package-ubuntu_18.04_oci: packages/ubuntu_18.04_oci/$(DEBIAN_OCI_DSC_FILENAME)

.PHONY: package-ubuntu_18.04_oci-interactive
package-ubuntu_18.04_oci-interactive: DOCKER_EXTRA_ARGS = -i
package-ubuntu_18.04_oci-interactive: $(RELEASE_TARBALL_FILENAME) packages/ubuntu_18.04_oci $(PACKAGE_ubuntu_18.04_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_18.04_oci_DOCKER_RUN_COMMAND) bash

##
## Distro: ubuntu_18.04_i386_oci
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_ubuntu_18.04_i386_oci_DOCKER_IMAGE_NAME:=jami-packaging-ubuntu_18.04_i386_oci$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_ubuntu_18.04_i386_oci_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_ubuntu_18.04_i386_oci_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_ubuntu_18.04_i386_oci = 

PACKAGE_ubuntu_18.04_i386_oci_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_OCI_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=ubuntu_18.04_i386_oci \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/ubuntu_18.04_i386_oci:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) -e OVERRIDE_PACKAGING_DIR=$(DEBIAN_OCI_PKG_DIR) \
    $(PACKAGE_ubuntu_18.04_i386_oci_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_ubuntu_18.04_i386_oci:
	if [ ! -z $(QEMU_STATIC_ubuntu_18.04_i386_oci) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_ubuntu_18.04_i386_oci) qemu-static/; fi

$(PACKAGE_ubuntu_18.04_i386_oci_DOCKER_IMAGE_FILE): QEMU_STATIC_ubuntu_18.04_i386_oci docker/Dockerfile_ubuntu_18.04_i386
	docker build \
        -t $(PACKAGE_ubuntu_18.04_i386_oci_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_ubuntu_18.04_i386  \
        $(CURDIR)
	touch $(PACKAGE_ubuntu_18.04_i386_oci_DOCKER_IMAGE_FILE)

packages/ubuntu_18.04_i386_oci:
	mkdir -p packages/ubuntu_18.04_i386_oci

packages/ubuntu_18.04_i386_oci/$(DEBIAN_OCI_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/ubuntu_18.04_i386_oci $(PACKAGE_ubuntu_18.04_i386_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_18.04_i386_oci_DOCKER_RUN_COMMAND)
	touch packages/ubuntu_18.04_i386_oci/*

.PHONY: package-ubuntu_18.04_i386_oci
package-ubuntu_18.04_i386_oci: packages/ubuntu_18.04_i386_oci/$(DEBIAN_OCI_DSC_FILENAME)

.PHONY: package-ubuntu_18.04_i386_oci-interactive
package-ubuntu_18.04_i386_oci-interactive: DOCKER_EXTRA_ARGS = -i
package-ubuntu_18.04_i386_oci-interactive: $(RELEASE_TARBALL_FILENAME) packages/ubuntu_18.04_i386_oci $(PACKAGE_ubuntu_18.04_i386_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_18.04_i386_oci_DOCKER_RUN_COMMAND) bash

##
## Distro: ubuntu_19.10
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_ubuntu_19.10_DOCKER_IMAGE_NAME:=jami-packaging-ubuntu_19.10$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_ubuntu_19.10_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_ubuntu_19.10_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_ubuntu_19.10 = 

PACKAGE_ubuntu_19.10_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=ubuntu_19.10 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/ubuntu_19.10:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_ubuntu_19.10_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_ubuntu_19.10:
	if [ ! -z $(QEMU_STATIC_ubuntu_19.10) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_ubuntu_19.10) qemu-static/; fi

$(PACKAGE_ubuntu_19.10_DOCKER_IMAGE_FILE): QEMU_STATIC_ubuntu_19.10 docker/Dockerfile_ubuntu_19.10
	docker build \
        -t $(PACKAGE_ubuntu_19.10_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_ubuntu_19.10  \
        $(CURDIR)
	touch $(PACKAGE_ubuntu_19.10_DOCKER_IMAGE_FILE)

packages/ubuntu_19.10:
	mkdir -p packages/ubuntu_19.10

packages/ubuntu_19.10/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/ubuntu_19.10 $(PACKAGE_ubuntu_19.10_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_19.10_DOCKER_RUN_COMMAND)
	touch packages/ubuntu_19.10/*

.PHONY: package-ubuntu_19.10
package-ubuntu_19.10: packages/ubuntu_19.10/$(DEBIAN_DSC_FILENAME)

.PHONY: package-ubuntu_19.10-interactive
package-ubuntu_19.10-interactive: DOCKER_EXTRA_ARGS = -i
package-ubuntu_19.10-interactive: $(RELEASE_TARBALL_FILENAME) packages/ubuntu_19.10 $(PACKAGE_ubuntu_19.10_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_19.10_DOCKER_RUN_COMMAND) bash

##
## Distro: ubuntu_19.10_i386
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_ubuntu_19.10_i386_DOCKER_IMAGE_NAME:=jami-packaging-ubuntu_19.10_i386$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_ubuntu_19.10_i386_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_ubuntu_19.10_i386_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_ubuntu_19.10_i386 = 

PACKAGE_ubuntu_19.10_i386_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=ubuntu_19.10_i386 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/ubuntu_19.10_i386:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_ubuntu_19.10_i386_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_ubuntu_19.10_i386:
	if [ ! -z $(QEMU_STATIC_ubuntu_19.10_i386) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_ubuntu_19.10_i386) qemu-static/; fi

$(PACKAGE_ubuntu_19.10_i386_DOCKER_IMAGE_FILE): QEMU_STATIC_ubuntu_19.10_i386 docker/Dockerfile_ubuntu_19.10_i386
	docker build \
        -t $(PACKAGE_ubuntu_19.10_i386_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_ubuntu_19.10_i386  \
        $(CURDIR)
	touch $(PACKAGE_ubuntu_19.10_i386_DOCKER_IMAGE_FILE)

packages/ubuntu_19.10_i386:
	mkdir -p packages/ubuntu_19.10_i386

packages/ubuntu_19.10_i386/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/ubuntu_19.10_i386 $(PACKAGE_ubuntu_19.10_i386_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_19.10_i386_DOCKER_RUN_COMMAND)
	touch packages/ubuntu_19.10_i386/*

.PHONY: package-ubuntu_19.10_i386
package-ubuntu_19.10_i386: packages/ubuntu_19.10_i386/$(DEBIAN_DSC_FILENAME)

.PHONY: package-ubuntu_19.10_i386-interactive
package-ubuntu_19.10_i386-interactive: DOCKER_EXTRA_ARGS = -i
package-ubuntu_19.10_i386-interactive: $(RELEASE_TARBALL_FILENAME) packages/ubuntu_19.10_i386 $(PACKAGE_ubuntu_19.10_i386_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_19.10_i386_DOCKER_RUN_COMMAND) bash

##
## Distro: ubuntu_19.10_oci
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_ubuntu_19.10_oci_DOCKER_IMAGE_NAME:=jami-packaging-ubuntu_19.10_oci$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_ubuntu_19.10_oci_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_ubuntu_19.10_oci_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_ubuntu_19.10_oci = 

PACKAGE_ubuntu_19.10_oci_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_OCI_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=ubuntu_19.10_oci \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/ubuntu_19.10_oci:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) -e OVERRIDE_PACKAGING_DIR=$(DEBIAN_OCI_PKG_DIR) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_ubuntu_19.10_oci_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_ubuntu_19.10_oci:
	if [ ! -z $(QEMU_STATIC_ubuntu_19.10_oci) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_ubuntu_19.10_oci) qemu-static/; fi

$(PACKAGE_ubuntu_19.10_oci_DOCKER_IMAGE_FILE): QEMU_STATIC_ubuntu_19.10_oci docker/Dockerfile_ubuntu_19.10
	docker build \
        -t $(PACKAGE_ubuntu_19.10_oci_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_ubuntu_19.10  \
        $(CURDIR)
	touch $(PACKAGE_ubuntu_19.10_oci_DOCKER_IMAGE_FILE)

packages/ubuntu_19.10_oci:
	mkdir -p packages/ubuntu_19.10_oci

packages/ubuntu_19.10_oci/$(DEBIAN_OCI_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/ubuntu_19.10_oci $(PACKAGE_ubuntu_19.10_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_19.10_oci_DOCKER_RUN_COMMAND)
	touch packages/ubuntu_19.10_oci/*

.PHONY: package-ubuntu_19.10_oci
package-ubuntu_19.10_oci: packages/ubuntu_19.10_oci/$(DEBIAN_OCI_DSC_FILENAME)

.PHONY: package-ubuntu_19.10_oci-interactive
package-ubuntu_19.10_oci-interactive: DOCKER_EXTRA_ARGS = -i
package-ubuntu_19.10_oci-interactive: $(RELEASE_TARBALL_FILENAME) packages/ubuntu_19.10_oci $(PACKAGE_ubuntu_19.10_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_19.10_oci_DOCKER_RUN_COMMAND) bash

##
## Distro: ubuntu_19.10_i386_oci
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_ubuntu_19.10_i386_oci_DOCKER_IMAGE_NAME:=jami-packaging-ubuntu_19.10_i386_oci$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_ubuntu_19.10_i386_oci_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_ubuntu_19.10_i386_oci_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_ubuntu_19.10_i386_oci = 

PACKAGE_ubuntu_19.10_i386_oci_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_OCI_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=ubuntu_19.10_i386_oci \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/ubuntu_19.10_i386_oci:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) -e OVERRIDE_PACKAGING_DIR=$(DEBIAN_OCI_PKG_DIR) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_ubuntu_19.10_i386_oci_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_ubuntu_19.10_i386_oci:
	if [ ! -z $(QEMU_STATIC_ubuntu_19.10_i386_oci) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_ubuntu_19.10_i386_oci) qemu-static/; fi

$(PACKAGE_ubuntu_19.10_i386_oci_DOCKER_IMAGE_FILE): QEMU_STATIC_ubuntu_19.10_i386_oci docker/Dockerfile_ubuntu_19.10_i386
	docker build \
        -t $(PACKAGE_ubuntu_19.10_i386_oci_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_ubuntu_19.10_i386  \
        $(CURDIR)
	touch $(PACKAGE_ubuntu_19.10_i386_oci_DOCKER_IMAGE_FILE)

packages/ubuntu_19.10_i386_oci:
	mkdir -p packages/ubuntu_19.10_i386_oci

packages/ubuntu_19.10_i386_oci/$(DEBIAN_OCI_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/ubuntu_19.10_i386_oci $(PACKAGE_ubuntu_19.10_i386_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_19.10_i386_oci_DOCKER_RUN_COMMAND)
	touch packages/ubuntu_19.10_i386_oci/*

.PHONY: package-ubuntu_19.10_i386_oci
package-ubuntu_19.10_i386_oci: packages/ubuntu_19.10_i386_oci/$(DEBIAN_OCI_DSC_FILENAME)

.PHONY: package-ubuntu_19.10_i386_oci-interactive
package-ubuntu_19.10_i386_oci-interactive: DOCKER_EXTRA_ARGS = -i
package-ubuntu_19.10_i386_oci-interactive: $(RELEASE_TARBALL_FILENAME) packages/ubuntu_19.10_i386_oci $(PACKAGE_ubuntu_19.10_i386_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_19.10_i386_oci_DOCKER_RUN_COMMAND) bash

##
## Distro: ubuntu_20.04
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_ubuntu_20.04_DOCKER_IMAGE_NAME:=jami-packaging-ubuntu_20.04$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_ubuntu_20.04_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_ubuntu_20.04_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_ubuntu_20.04 = 

PACKAGE_ubuntu_20.04_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=ubuntu_20.04 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/ubuntu_20.04:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_ubuntu_20.04_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_ubuntu_20.04:
	if [ ! -z $(QEMU_STATIC_ubuntu_20.04) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_ubuntu_20.04) qemu-static/; fi

$(PACKAGE_ubuntu_20.04_DOCKER_IMAGE_FILE): QEMU_STATIC_ubuntu_20.04 docker/Dockerfile_ubuntu_20.04
	docker build \
        -t $(PACKAGE_ubuntu_20.04_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_ubuntu_20.04  \
        $(CURDIR)
	touch $(PACKAGE_ubuntu_20.04_DOCKER_IMAGE_FILE)

packages/ubuntu_20.04:
	mkdir -p packages/ubuntu_20.04

packages/ubuntu_20.04/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/ubuntu_20.04 $(PACKAGE_ubuntu_20.04_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_20.04_DOCKER_RUN_COMMAND)
	touch packages/ubuntu_20.04/*

.PHONY: package-ubuntu_20.04
package-ubuntu_20.04: packages/ubuntu_20.04/$(DEBIAN_DSC_FILENAME)

.PHONY: package-ubuntu_20.04-interactive
package-ubuntu_20.04-interactive: DOCKER_EXTRA_ARGS = -i
package-ubuntu_20.04-interactive: $(RELEASE_TARBALL_FILENAME) packages/ubuntu_20.04 $(PACKAGE_ubuntu_20.04_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_20.04_DOCKER_RUN_COMMAND) bash

##
## Distro: ubuntu_20.04_oci
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_ubuntu_20.04_oci_DOCKER_IMAGE_NAME:=jami-packaging-ubuntu_20.04_oci$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_ubuntu_20.04_oci_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_ubuntu_20.04_oci_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_ubuntu_20.04_oci = 

PACKAGE_ubuntu_20.04_oci_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_OCI_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=ubuntu_20.04_oci \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/ubuntu_20.04_oci:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) -e OVERRIDE_PACKAGING_DIR=$(DEBIAN_OCI_PKG_DIR) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_ubuntu_20.04_oci_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_ubuntu_20.04_oci:
	if [ ! -z $(QEMU_STATIC_ubuntu_20.04_oci) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_ubuntu_20.04_oci) qemu-static/; fi

$(PACKAGE_ubuntu_20.04_oci_DOCKER_IMAGE_FILE): QEMU_STATIC_ubuntu_20.04_oci docker/Dockerfile_ubuntu_20.04
	docker build \
        -t $(PACKAGE_ubuntu_20.04_oci_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_ubuntu_20.04  \
        $(CURDIR)
	touch $(PACKAGE_ubuntu_20.04_oci_DOCKER_IMAGE_FILE)

packages/ubuntu_20.04_oci:
	mkdir -p packages/ubuntu_20.04_oci

packages/ubuntu_20.04_oci/$(DEBIAN_OCI_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/ubuntu_20.04_oci $(PACKAGE_ubuntu_20.04_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_20.04_oci_DOCKER_RUN_COMMAND)
	touch packages/ubuntu_20.04_oci/*

.PHONY: package-ubuntu_20.04_oci
package-ubuntu_20.04_oci: packages/ubuntu_20.04_oci/$(DEBIAN_OCI_DSC_FILENAME)

.PHONY: package-ubuntu_20.04_oci-interactive
package-ubuntu_20.04_oci-interactive: DOCKER_EXTRA_ARGS = -i
package-ubuntu_20.04_oci-interactive: $(RELEASE_TARBALL_FILENAME) packages/ubuntu_20.04_oci $(PACKAGE_ubuntu_20.04_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_20.04_oci_DOCKER_RUN_COMMAND) bash

##
## Distro: ubuntu_20.10
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_ubuntu_20.10_DOCKER_IMAGE_NAME:=jami-packaging-ubuntu_20.10$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_ubuntu_20.10_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_ubuntu_20.10_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_ubuntu_20.10 = 

PACKAGE_ubuntu_20.10_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=ubuntu_20.10 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/ubuntu_20.10:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_ubuntu_20.10_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_ubuntu_20.10:
	if [ ! -z $(QEMU_STATIC_ubuntu_20.10) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_ubuntu_20.10) qemu-static/; fi

$(PACKAGE_ubuntu_20.10_DOCKER_IMAGE_FILE): QEMU_STATIC_ubuntu_20.10 docker/Dockerfile_ubuntu_20.10
	docker build \
        -t $(PACKAGE_ubuntu_20.10_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_ubuntu_20.10  \
        $(CURDIR)
	touch $(PACKAGE_ubuntu_20.10_DOCKER_IMAGE_FILE)

packages/ubuntu_20.10:
	mkdir -p packages/ubuntu_20.10

packages/ubuntu_20.10/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/ubuntu_20.10 $(PACKAGE_ubuntu_20.10_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_20.10_DOCKER_RUN_COMMAND)
	touch packages/ubuntu_20.10/*

.PHONY: package-ubuntu_20.10
package-ubuntu_20.10: packages/ubuntu_20.10/$(DEBIAN_DSC_FILENAME)

.PHONY: package-ubuntu_20.10-interactive
package-ubuntu_20.10-interactive: DOCKER_EXTRA_ARGS = -i
package-ubuntu_20.10-interactive: $(RELEASE_TARBALL_FILENAME) packages/ubuntu_20.10 $(PACKAGE_ubuntu_20.10_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_20.10_DOCKER_RUN_COMMAND) bash

##
## Distro: ubuntu_20.10_oci
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_ubuntu_20.10_oci_DOCKER_IMAGE_NAME:=jami-packaging-ubuntu_20.10_oci$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_ubuntu_20.10_oci_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_ubuntu_20.10_oci_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_ubuntu_20.10_oci = 

PACKAGE_ubuntu_20.10_oci_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_OCI_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=ubuntu_20.10_oci \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/ubuntu_20.10_oci:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) -e OVERRIDE_PACKAGING_DIR=$(DEBIAN_OCI_PKG_DIR) --privileged --security-opt apparmor=docker-default \
    $(PACKAGE_ubuntu_20.10_oci_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_ubuntu_20.10_oci:
	if [ ! -z $(QEMU_STATIC_ubuntu_20.10_oci) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_ubuntu_20.10_oci) qemu-static/; fi

$(PACKAGE_ubuntu_20.10_oci_DOCKER_IMAGE_FILE): QEMU_STATIC_ubuntu_20.10_oci docker/Dockerfile_ubuntu_20.10
	docker build \
        -t $(PACKAGE_ubuntu_20.10_oci_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_ubuntu_20.10  \
        $(CURDIR)
	touch $(PACKAGE_ubuntu_20.10_oci_DOCKER_IMAGE_FILE)

packages/ubuntu_20.10_oci:
	mkdir -p packages/ubuntu_20.10_oci

packages/ubuntu_20.10_oci/$(DEBIAN_OCI_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/ubuntu_20.10_oci $(PACKAGE_ubuntu_20.10_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_20.10_oci_DOCKER_RUN_COMMAND)
	touch packages/ubuntu_20.10_oci/*

.PHONY: package-ubuntu_20.10_oci
package-ubuntu_20.10_oci: packages/ubuntu_20.10_oci/$(DEBIAN_OCI_DSC_FILENAME)

.PHONY: package-ubuntu_20.10_oci-interactive
package-ubuntu_20.10_oci-interactive: DOCKER_EXTRA_ARGS = -i
package-ubuntu_20.10_oci-interactive: $(RELEASE_TARBALL_FILENAME) packages/ubuntu_20.10_oci $(PACKAGE_ubuntu_20.10_oci_DOCKER_IMAGE_FILE)
	$(PACKAGE_ubuntu_20.10_oci_DOCKER_RUN_COMMAND) bash

##
## Distro: fedora_31
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_fedora_31_DOCKER_IMAGE_NAME:=jami-packaging-fedora_31$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_fedora_31_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_fedora_31_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_fedora_31 = 

PACKAGE_fedora_31_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=fedora_31 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/fedora_31:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --security-opt seccomp=./docker/profile-seccomp-fedora_28.json --privileged \
    $(PACKAGE_fedora_31_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_fedora_31:
	if [ ! -z $(QEMU_STATIC_fedora_31) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_fedora_31) qemu-static/; fi

$(PACKAGE_fedora_31_DOCKER_IMAGE_FILE): QEMU_STATIC_fedora_31 docker/Dockerfile_fedora_31
	docker build \
        -t $(PACKAGE_fedora_31_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_fedora_31  \
        $(CURDIR)
	touch $(PACKAGE_fedora_31_DOCKER_IMAGE_FILE)

packages/fedora_31:
	mkdir -p packages/fedora_31

packages/fedora_31/.packages-built: $(RELEASE_TARBALL_FILENAME) packages/fedora_31 $(PACKAGE_fedora_31_DOCKER_IMAGE_FILE)
	$(PACKAGE_fedora_31_DOCKER_RUN_COMMAND)
	touch packages/fedora_31/*

.PHONY: package-fedora_31
package-fedora_31: packages/fedora_31/.packages-built

.PHONY: package-fedora_31-interactive
package-fedora_31-interactive: DOCKER_EXTRA_ARGS = -i
package-fedora_31-interactive: $(RELEASE_TARBALL_FILENAME) packages/fedora_31 $(PACKAGE_fedora_31_DOCKER_IMAGE_FILE)
	$(PACKAGE_fedora_31_DOCKER_RUN_COMMAND) bash

##
## Distro: fedora_31_i386
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_fedora_31_i386_DOCKER_IMAGE_NAME:=jami-packaging-fedora_31_i386$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_fedora_31_i386_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_fedora_31_i386_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_fedora_31_i386 = 

PACKAGE_fedora_31_i386_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=fedora_31_i386 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/fedora_31_i386:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --security-opt seccomp=./docker/profile-seccomp-fedora_28.json --privileged \
    $(PACKAGE_fedora_31_i386_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_fedora_31_i386:
	if [ ! -z $(QEMU_STATIC_fedora_31_i386) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_fedora_31_i386) qemu-static/; fi

$(PACKAGE_fedora_31_i386_DOCKER_IMAGE_FILE): QEMU_STATIC_fedora_31_i386 docker/Dockerfile_fedora_31_i386
	docker build \
        -t $(PACKAGE_fedora_31_i386_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_fedora_31_i386  \
        $(CURDIR)
	touch $(PACKAGE_fedora_31_i386_DOCKER_IMAGE_FILE)

packages/fedora_31_i386:
	mkdir -p packages/fedora_31_i386

packages/fedora_31_i386/.packages-built: $(RELEASE_TARBALL_FILENAME) packages/fedora_31_i386 $(PACKAGE_fedora_31_i386_DOCKER_IMAGE_FILE)
	$(PACKAGE_fedora_31_i386_DOCKER_RUN_COMMAND)
	touch packages/fedora_31_i386/*

.PHONY: package-fedora_31_i386
package-fedora_31_i386: packages/fedora_31_i386/.packages-built

.PHONY: package-fedora_31_i386-interactive
package-fedora_31_i386-interactive: DOCKER_EXTRA_ARGS = -i
package-fedora_31_i386-interactive: $(RELEASE_TARBALL_FILENAME) packages/fedora_31_i386 $(PACKAGE_fedora_31_i386_DOCKER_IMAGE_FILE)
	$(PACKAGE_fedora_31_i386_DOCKER_RUN_COMMAND) bash

##
## Distro: fedora_32
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_fedora_32_DOCKER_IMAGE_NAME:=jami-packaging-fedora_32$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_fedora_32_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_fedora_32_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_fedora_32 = 

PACKAGE_fedora_32_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=fedora_32 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/fedora_32:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --security-opt seccomp=./docker/profile-seccomp-fedora_28.json --privileged \
    $(PACKAGE_fedora_32_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_fedora_32:
	if [ ! -z $(QEMU_STATIC_fedora_32) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_fedora_32) qemu-static/; fi

$(PACKAGE_fedora_32_DOCKER_IMAGE_FILE): QEMU_STATIC_fedora_32 docker/Dockerfile_fedora_32
	docker build \
        -t $(PACKAGE_fedora_32_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_fedora_32  \
        $(CURDIR)
	touch $(PACKAGE_fedora_32_DOCKER_IMAGE_FILE)

packages/fedora_32:
	mkdir -p packages/fedora_32

packages/fedora_32/.packages-built: $(RELEASE_TARBALL_FILENAME) packages/fedora_32 $(PACKAGE_fedora_32_DOCKER_IMAGE_FILE)
	$(PACKAGE_fedora_32_DOCKER_RUN_COMMAND)
	touch packages/fedora_32/*

.PHONY: package-fedora_32
package-fedora_32: packages/fedora_32/.packages-built

.PHONY: package-fedora_32-interactive
package-fedora_32-interactive: DOCKER_EXTRA_ARGS = -i
package-fedora_32-interactive: $(RELEASE_TARBALL_FILENAME) packages/fedora_32 $(PACKAGE_fedora_32_DOCKER_IMAGE_FILE)
	$(PACKAGE_fedora_32_DOCKER_RUN_COMMAND) bash

##
## Distro: fedora_32_i386
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_fedora_32_i386_DOCKER_IMAGE_NAME:=jami-packaging-fedora_32_i386$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_fedora_32_i386_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_fedora_32_i386_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_fedora_32_i386 = 

PACKAGE_fedora_32_i386_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=fedora_32_i386 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/fedora_32_i386:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --security-opt seccomp=./docker/profile-seccomp-fedora_28.json --privileged \
    $(PACKAGE_fedora_32_i386_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_fedora_32_i386:
	if [ ! -z $(QEMU_STATIC_fedora_32_i386) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_fedora_32_i386) qemu-static/; fi

$(PACKAGE_fedora_32_i386_DOCKER_IMAGE_FILE): QEMU_STATIC_fedora_32_i386 docker/Dockerfile_fedora_32_i386
	docker build \
        -t $(PACKAGE_fedora_32_i386_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_fedora_32_i386  \
        $(CURDIR)
	touch $(PACKAGE_fedora_32_i386_DOCKER_IMAGE_FILE)

packages/fedora_32_i386:
	mkdir -p packages/fedora_32_i386

packages/fedora_32_i386/.packages-built: $(RELEASE_TARBALL_FILENAME) packages/fedora_32_i386 $(PACKAGE_fedora_32_i386_DOCKER_IMAGE_FILE)
	$(PACKAGE_fedora_32_i386_DOCKER_RUN_COMMAND)
	touch packages/fedora_32_i386/*

.PHONY: package-fedora_32_i386
package-fedora_32_i386: packages/fedora_32_i386/.packages-built

.PHONY: package-fedora_32_i386-interactive
package-fedora_32_i386-interactive: DOCKER_EXTRA_ARGS = -i
package-fedora_32_i386-interactive: $(RELEASE_TARBALL_FILENAME) packages/fedora_32_i386 $(PACKAGE_fedora_32_i386_DOCKER_IMAGE_FILE)
	$(PACKAGE_fedora_32_i386_DOCKER_RUN_COMMAND) bash

##
## Distro: fedora_33
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_fedora_33_DOCKER_IMAGE_NAME:=jami-packaging-fedora_33$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_fedora_33_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_fedora_33_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_fedora_33 = 

PACKAGE_fedora_33_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=fedora_33 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/fedora_33:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --security-opt seccomp=./docker/profile-seccomp-fedora_28.json --privileged \
    $(PACKAGE_fedora_33_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_fedora_33:
	if [ ! -z $(QEMU_STATIC_fedora_33) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_fedora_33) qemu-static/; fi

$(PACKAGE_fedora_33_DOCKER_IMAGE_FILE): QEMU_STATIC_fedora_33 docker/Dockerfile_fedora_33
	docker build \
        -t $(PACKAGE_fedora_33_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_fedora_33  \
        $(CURDIR)
	touch $(PACKAGE_fedora_33_DOCKER_IMAGE_FILE)

packages/fedora_33:
	mkdir -p packages/fedora_33

packages/fedora_33/.packages-built: $(RELEASE_TARBALL_FILENAME) packages/fedora_33 $(PACKAGE_fedora_33_DOCKER_IMAGE_FILE)
	$(PACKAGE_fedora_33_DOCKER_RUN_COMMAND)
	touch packages/fedora_33/*

.PHONY: package-fedora_33
package-fedora_33: packages/fedora_33/.packages-built

.PHONY: package-fedora_33-interactive
package-fedora_33-interactive: DOCKER_EXTRA_ARGS = -i
package-fedora_33-interactive: $(RELEASE_TARBALL_FILENAME) packages/fedora_33 $(PACKAGE_fedora_33_DOCKER_IMAGE_FILE)
	$(PACKAGE_fedora_33_DOCKER_RUN_COMMAND) bash

##
## Distro: fedora_33_i386
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_fedora_33_i386_DOCKER_IMAGE_NAME:=jami-packaging-fedora_33_i386$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_fedora_33_i386_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_fedora_33_i386_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_fedora_33_i386 = 

PACKAGE_fedora_33_i386_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=fedora_33_i386 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/fedora_33_i386:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --security-opt seccomp=./docker/profile-seccomp-fedora_28.json --privileged \
    $(PACKAGE_fedora_33_i386_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_fedora_33_i386:
	if [ ! -z $(QEMU_STATIC_fedora_33_i386) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_fedora_33_i386) qemu-static/; fi

$(PACKAGE_fedora_33_i386_DOCKER_IMAGE_FILE): QEMU_STATIC_fedora_33_i386 docker/Dockerfile_fedora_33_i386
	docker build \
        -t $(PACKAGE_fedora_33_i386_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_fedora_33_i386  \
        $(CURDIR)
	touch $(PACKAGE_fedora_33_i386_DOCKER_IMAGE_FILE)

packages/fedora_33_i386:
	mkdir -p packages/fedora_33_i386

packages/fedora_33_i386/.packages-built: $(RELEASE_TARBALL_FILENAME) packages/fedora_33_i386 $(PACKAGE_fedora_33_i386_DOCKER_IMAGE_FILE)
	$(PACKAGE_fedora_33_i386_DOCKER_RUN_COMMAND)
	touch packages/fedora_33_i386/*

.PHONY: package-fedora_33_i386
package-fedora_33_i386: packages/fedora_33_i386/.packages-built

.PHONY: package-fedora_33_i386-interactive
package-fedora_33_i386-interactive: DOCKER_EXTRA_ARGS = -i
package-fedora_33_i386-interactive: $(RELEASE_TARBALL_FILENAME) packages/fedora_33_i386 $(PACKAGE_fedora_33_i386_DOCKER_IMAGE_FILE)
	$(PACKAGE_fedora_33_i386_DOCKER_RUN_COMMAND) bash

##
## Distro: rhel_8
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_rhel_8_DOCKER_IMAGE_NAME:=jami-packaging-rhel_8$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_rhel_8_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_rhel_8_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_rhel_8 = 

PACKAGE_rhel_8_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=rhel_8 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/rhel_8:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --security-opt seccomp=./docker/profile-seccomp-fedora_28.json --privileged \
    $(PACKAGE_rhel_8_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_rhel_8:
	if [ ! -z $(QEMU_STATIC_rhel_8) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_rhel_8) qemu-static/; fi

$(PACKAGE_rhel_8_DOCKER_IMAGE_FILE): QEMU_STATIC_rhel_8 docker/Dockerfile_rhel_8
	docker build \
        -t $(PACKAGE_rhel_8_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_rhel_8 --build-arg PASS=${PASS} \
        $(CURDIR)
	touch $(PACKAGE_rhel_8_DOCKER_IMAGE_FILE)

packages/rhel_8:
	mkdir -p packages/rhel_8

packages/rhel_8/.packages-built: $(RELEASE_TARBALL_FILENAME) packages/rhel_8 $(PACKAGE_rhel_8_DOCKER_IMAGE_FILE)
	$(PACKAGE_rhel_8_DOCKER_RUN_COMMAND)
	touch packages/rhel_8/*

.PHONY: package-rhel_8
package-rhel_8: packages/rhel_8/.packages-built

.PHONY: package-rhel_8-interactive
package-rhel_8-interactive: DOCKER_EXTRA_ARGS = -i
package-rhel_8-interactive: $(RELEASE_TARBALL_FILENAME) packages/rhel_8 $(PACKAGE_rhel_8_DOCKER_IMAGE_FILE)
	$(PACKAGE_rhel_8_DOCKER_RUN_COMMAND) bash

##
## Distro: opensuse-leap_15.1
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_opensuse-leap_15.1_DOCKER_IMAGE_NAME:=jami-packaging-opensuse-leap_15.1$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_opensuse-leap_15.1_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_opensuse-leap_15.1_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_opensuse-leap_15.1 = 

PACKAGE_opensuse-leap_15.1_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=opensuse-leap_15.1 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/opensuse-leap_15.1:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --security-opt seccomp=./docker/profile-seccomp-fedora_28.json --privileged \
    $(PACKAGE_opensuse-leap_15.1_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_opensuse-leap_15.1:
	if [ ! -z $(QEMU_STATIC_opensuse-leap_15.1) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_opensuse-leap_15.1) qemu-static/; fi

$(PACKAGE_opensuse-leap_15.1_DOCKER_IMAGE_FILE): QEMU_STATIC_opensuse-leap_15.1 docker/Dockerfile_opensuse-leap_15.1
	docker build \
        -t $(PACKAGE_opensuse-leap_15.1_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_opensuse-leap_15.1  \
        $(CURDIR)
	touch $(PACKAGE_opensuse-leap_15.1_DOCKER_IMAGE_FILE)

packages/opensuse-leap_15.1:
	mkdir -p packages/opensuse-leap_15.1

packages/opensuse-leap_15.1/.packages-built: $(RELEASE_TARBALL_FILENAME) packages/opensuse-leap_15.1 $(PACKAGE_opensuse-leap_15.1_DOCKER_IMAGE_FILE)
	$(PACKAGE_opensuse-leap_15.1_DOCKER_RUN_COMMAND)
	touch packages/opensuse-leap_15.1/*

.PHONY: package-opensuse-leap_15.1
package-opensuse-leap_15.1: packages/opensuse-leap_15.1/.packages-built

.PHONY: package-opensuse-leap_15.1-interactive
package-opensuse-leap_15.1-interactive: DOCKER_EXTRA_ARGS = -i
package-opensuse-leap_15.1-interactive: $(RELEASE_TARBALL_FILENAME) packages/opensuse-leap_15.1 $(PACKAGE_opensuse-leap_15.1_DOCKER_IMAGE_FILE)
	$(PACKAGE_opensuse-leap_15.1_DOCKER_RUN_COMMAND) bash

##
## Distro: opensuse-leap_15.2
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_opensuse-leap_15.2_DOCKER_IMAGE_NAME:=jami-packaging-opensuse-leap_15.2$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_opensuse-leap_15.2_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_opensuse-leap_15.2_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_opensuse-leap_15.2 = 

PACKAGE_opensuse-leap_15.2_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=opensuse-leap_15.2 \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/opensuse-leap_15.2:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --security-opt seccomp=./docker/profile-seccomp-fedora_28.json --privileged \
    $(PACKAGE_opensuse-leap_15.2_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_opensuse-leap_15.2:
	if [ ! -z $(QEMU_STATIC_opensuse-leap_15.2) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_opensuse-leap_15.2) qemu-static/; fi

$(PACKAGE_opensuse-leap_15.2_DOCKER_IMAGE_FILE): QEMU_STATIC_opensuse-leap_15.2 docker/Dockerfile_opensuse-leap_15.2
	docker build \
        -t $(PACKAGE_opensuse-leap_15.2_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_opensuse-leap_15.2  \
        $(CURDIR)
	touch $(PACKAGE_opensuse-leap_15.2_DOCKER_IMAGE_FILE)

packages/opensuse-leap_15.2:
	mkdir -p packages/opensuse-leap_15.2

packages/opensuse-leap_15.2/.packages-built: $(RELEASE_TARBALL_FILENAME) packages/opensuse-leap_15.2 $(PACKAGE_opensuse-leap_15.2_DOCKER_IMAGE_FILE)
	$(PACKAGE_opensuse-leap_15.2_DOCKER_RUN_COMMAND)
	touch packages/opensuse-leap_15.2/*

.PHONY: package-opensuse-leap_15.2
package-opensuse-leap_15.2: packages/opensuse-leap_15.2/.packages-built

.PHONY: package-opensuse-leap_15.2-interactive
package-opensuse-leap_15.2-interactive: DOCKER_EXTRA_ARGS = -i
package-opensuse-leap_15.2-interactive: $(RELEASE_TARBALL_FILENAME) packages/opensuse-leap_15.2 $(PACKAGE_opensuse-leap_15.2_DOCKER_IMAGE_FILE)
	$(PACKAGE_opensuse-leap_15.2_DOCKER_RUN_COMMAND) bash

##
## Distro: opensuse-tumbleweed
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_opensuse-tumbleweed_DOCKER_IMAGE_NAME:=jami-packaging-opensuse-tumbleweed$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_opensuse-tumbleweed_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_opensuse-tumbleweed_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_opensuse-tumbleweed = 

PACKAGE_opensuse-tumbleweed_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=opensuse-tumbleweed \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/opensuse-tumbleweed:/opt/output \
    -t $(DOCKER_EXTRA_ARGS) --security-opt seccomp=./docker/profile-seccomp-fedora_28.json --privileged \
    $(PACKAGE_opensuse-tumbleweed_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_opensuse-tumbleweed:
	if [ ! -z $(QEMU_STATIC_opensuse-tumbleweed) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_opensuse-tumbleweed) qemu-static/; fi

$(PACKAGE_opensuse-tumbleweed_DOCKER_IMAGE_FILE): QEMU_STATIC_opensuse-tumbleweed docker/Dockerfile_opensuse-tumbleweed
	docker build \
        -t $(PACKAGE_opensuse-tumbleweed_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_opensuse-tumbleweed  \
        $(CURDIR)
	touch $(PACKAGE_opensuse-tumbleweed_DOCKER_IMAGE_FILE)

packages/opensuse-tumbleweed:
	mkdir -p packages/opensuse-tumbleweed

packages/opensuse-tumbleweed/.packages-built: $(RELEASE_TARBALL_FILENAME) packages/opensuse-tumbleweed $(PACKAGE_opensuse-tumbleweed_DOCKER_IMAGE_FILE)
	$(PACKAGE_opensuse-tumbleweed_DOCKER_RUN_COMMAND)
	touch packages/opensuse-tumbleweed/*

.PHONY: package-opensuse-tumbleweed
package-opensuse-tumbleweed: packages/opensuse-tumbleweed/.packages-built

.PHONY: package-opensuse-tumbleweed-interactive
package-opensuse-tumbleweed-interactive: DOCKER_EXTRA_ARGS = -i
package-opensuse-tumbleweed-interactive: $(RELEASE_TARBALL_FILENAME) packages/opensuse-tumbleweed $(PACKAGE_opensuse-tumbleweed_DOCKER_IMAGE_FILE)
	$(PACKAGE_opensuse-tumbleweed_DOCKER_RUN_COMMAND) bash

##
## Distro: gentoo
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_gentoo_DOCKER_IMAGE_NAME:=jami-packaging-gentoo$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_gentoo_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_gentoo_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_gentoo = 

PACKAGE_gentoo_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=gentoo \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/gentoo:/opt/output \
    -t $(DOCKER_EXTRA_ARGS)  \
    $(PACKAGE_gentoo_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_gentoo:
	if [ ! -z $(QEMU_STATIC_gentoo) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_gentoo) qemu-static/; fi

$(PACKAGE_gentoo_DOCKER_IMAGE_FILE): QEMU_STATIC_gentoo docker/Dockerfile_gentoo
	docker build \
        -t $(PACKAGE_gentoo_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_gentoo  \
        $(CURDIR)
	touch $(PACKAGE_gentoo_DOCKER_IMAGE_FILE)

packages/gentoo:
	mkdir -p packages/gentoo

packages/gentoo/.packages-built: $(RELEASE_TARBALL_FILENAME) packages/gentoo $(PACKAGE_gentoo_DOCKER_IMAGE_FILE)
	$(PACKAGE_gentoo_DOCKER_RUN_COMMAND)
	touch packages/gentoo/*

.PHONY: package-gentoo
package-gentoo: packages/gentoo/.packages-built

.PHONY: package-gentoo-interactive
package-gentoo-interactive: DOCKER_EXTRA_ARGS = -i
package-gentoo-interactive: $(RELEASE_TARBALL_FILENAME) packages/gentoo $(PACKAGE_gentoo_DOCKER_IMAGE_FILE)
	$(PACKAGE_gentoo_DOCKER_RUN_COMMAND) bash

##
## Distro: snap
##

# We don't simply use jami-packaging-distro as the docker image name because
# we want to be able to build multiple versions of the same distro at the
# same time and it could result in race conditions on the machine as we would
# overwrite the docker image of other builds.
#
# This does not impact caching as the docker daemon does not care about the image
# names, just about the contents of the Dockerfile.
PACKAGE_snap_DOCKER_IMAGE_NAME:=jami-packaging-snap$(RING_PACKAGING_IMAGE_SUFFIX)
PACKAGE_snap_DOCKER_IMAGE_FILE:=.docker-image-$(PACKAGE_snap_DOCKER_IMAGE_NAME)
DOCKER_EXTRA_ARGS =
QEMU_STATIC_snap = 

PACKAGE_snap_DOCKER_RUN_COMMAND = docker run \
    --rm \
    -e RELEASE_VERSION=$(RELEASE_VERSION) \
    -e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \
    -e DEBIAN_VERSION=$(DEBIAN_VERSION) \
    -e DEBIAN_PACKAGING_OVERRIDE= \
    -e CURRENT_UID=$(CURRENT_UID) \
    -e CURRENT_GID=$(CURRENT_GID) \
    -e DISTRIBUTION=snap \
    -v $(CURDIR):/opt/ring-project-ro:ro \
    -v $(CURDIR)/packages/snap:/opt/output \
    -t $(DOCKER_EXTRA_ARGS)  \
    $(PACKAGE_snap_DOCKER_IMAGE_NAME)

# FIXME: dirty qemu-static hack required because our Jenkis node runs Docker 17
# Remove all the qemu-static / QEMU-STATIC stuff as soon as we get Docker 18 +
QEMU_STATIC_snap:
	if [ ! -z $(QEMU_STATIC_snap) ]; then mkdir -p qemu-static && cp -af /usr/bin/$(QEMU_STATIC_snap) qemu-static/; fi

$(PACKAGE_snap_DOCKER_IMAGE_FILE): QEMU_STATIC_snap docker/Dockerfile_snap
	docker build \
        -t $(PACKAGE_snap_DOCKER_IMAGE_NAME) \
        -f docker/Dockerfile_snap  \
        $(CURDIR)
	touch $(PACKAGE_snap_DOCKER_IMAGE_FILE)

packages/snap:
	mkdir -p packages/snap

packages/snap/.packages-built: $(RELEASE_TARBALL_FILENAME) packages/snap $(PACKAGE_snap_DOCKER_IMAGE_FILE)
	$(PACKAGE_snap_DOCKER_RUN_COMMAND)
	touch packages/snap/*

.PHONY: package-snap
package-snap: packages/snap/.packages-built

.PHONY: package-snap-interactive
package-snap-interactive: DOCKER_EXTRA_ARGS = -i
package-snap-interactive: $(RELEASE_TARBALL_FILENAME) packages/snap $(PACKAGE_snap_DOCKER_IMAGE_FILE)
	$(PACKAGE_snap_DOCKER_RUN_COMMAND) bash

