# Custom MongoDB Package Builder

## Overview

This project builds a custom MongoDB 8.0.4 server `.deb` package for Ubuntu distributions (Focal and Jammy). It uses the `mongod` binary from the `axcient/mongo-avx` repository and applies specific metadata and configuration adjustments to create a distributable package.

The resulting package is compatible with older CPUs that do not support AVX or AVX2 instructions.

It is also possible to build a different type of package that supports olders CPUs, like core2 duo. These CPUs lack SSE.4_2 instruction. To build this package, use the `build.sh` script with the `core2` argument.

---

## Source

The mongod source code, `mongod` binary and its patches are sourced from the following repositories:
- **Axcient Mongo-AVX Repository**: [https://github.com/Axcient/mongo-avx](https://github.com/Axcient/mongo-avx)
- **Official MongoDB Repository**: https://github.com/mongodb/mongo. The source code is licensed under the Server Side Public License (SSPL) v1.
---

## Metadata Files

The following metadata files are included in the package:

- **`DEBIAN/control`**: Defines package metadata such as name, version, dependencies, and description.
- **`DEBIAN/copyright`**: Contains copyright and licensing information.
- **`usr/share/doc/mongodb-org-server/LICENSE-Community.txt`**: The license file for the MongoDB Community Edition.
- **`usr/share/doc/mongodb-org-server/README`**: A README file with additional information about the package.

---

## Dockerfiles

The project includes Dockerfiles to automate the build process:

- **`Dockerfile-focal`**: Builds the package for Ubuntu 20.04 (Focal).
- **`Dockerfile-jammy`**: Builds the package for Ubuntu 22.04 (Jammy).
- **`Dockerfile-focal-core2`**: Builds the package for Ubuntu 20.04 (Focal) with support for older CPUs like Core2 Duo.
- **`Dockerfile-jammy-core2`**: Builds the package for Ubuntu 22.04 (Jammy) with support for older CPUs like Core2 Duo.

---

## Build Instructions

To build the Docker image and generate the `.deb` package, use the following command:

```sh
./build.sh "<REVISION>" <DISTRIBUTION> <CPU>
```

For example, to build for Ubuntu 20.04 with AVX support:

```sh
./build.sh "8.0.4" "focal" nehalem
```

To build for Ubuntu 22.04 with core2 support:

```sh
./build.sh "8.0.4" "jammy" core2
```