#!/bin/bash set -euo pipefail mkdir -p debian/patches/mips cp $PATCH_DIR/*.patch debian/patches/mips/ cat << 'EOF' >> debian/patches/series mips/mips32-support.patch mips/fpu.patch mips/less_mem.patch mips/mipsel_is_32.patch mips/mipsel_even_register_fix.patch EOF patch --no-backup-if-mismatch -p1 <<'PATCH' --- a/debian/rules +++ b/debian/rules @@ -13,7 +13,7 @@ ABI = $(shell awk '/^#define NODE_MODULE_VERSION [0-9]+/ {print $$3}' src/node_version.h) # archs -ARCHS := amd64 arm64 armel armhf i386 mips64el mips64r6el loong64 ppc64 ppc64el riscv64 s390x +ARCHS := amd64 arm64 armel armhf i386 mips mipsel mips64el mips64r6el loong64 ppc64 ppc64el riscv64 s390x # branch BRANCH := $(word 1, $(subst .,$(space), $(DEB_UPSTREAM_VERSION))) @@ -65,6 +65,8 @@ destCpu := $(or $(destCpu),$(if $(filter armel,$(DEB_HOST_ARCH)),arm)) destCpu := $(or $(destCpu),$(if $(filter armhf,$(DEB_HOST_ARCH)),arm)) destCpu := $(or $(destCpu),$(if $(filter aarch64,$(DEB_HOST_ARCH)),arm64)) +destCpu := $(or $(destCpu),$(if $(filter mips,$(DEB_HOST_ARCH)),mips)) +destCpu := $(or $(destCpu),$(if $(filter mipsel,$(DEB_HOST_ARCH)),mipsel)) destCpu := $(or $(destCpu),$(if $(filter mips64el,$(DEB_HOST_ARCH)),mips64el)) destCpu := $(or $(destCpu),$(if $(filter mips64r6el,$(DEB_HOST_ARCH)),mips64el)) destCpu := $(or $(destCpu),$(if $(filter loong64,$(DEB_HOST_ARCH)),loong64)) @@ -77,6 +79,10 @@ DEB_CONFIGURE_EXTRA_FLAGS += --dest-cpu=$(destCpu) endif +ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel)) +DEB_CONFIGURE_EXTRA_FLAGS += --with-mips-arch-variant=r1 --with-mips-fpu-mode=fpxx +endif + # mips32r1 or greater, detected at runtime ifeq (mips64el, $(DEB_HOST_ARCH)) DEB_CONFIGURE_EXTRA_FLAGS += --with-mips-arch-variant=rx --with-mips-fpu-mode=fp64 @@ -265,8 +271,6 @@ ifeq ($(DEB_HOST_ARCH_BITS),32) CFLAGS += -g1 CPPFLAGS += -g1 -DH_FLAGS += --max-parallel=1 -export JOBS = 1 else CFLAGS += -g CPPFLAGS += -g PATCH sed -i "s|i386 mips64el|i386 mips mipsel mips64el|" $PACKAGE_DSC debian/control sed -i "s|i386,mips64el|i386,mips,mipsel,mips64el|" $PACKAGE_DSC