diff --git a/Makefile b/Makefile index 0c2be5a..6ea5620 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,8 @@ install: build config/ # Install binaries install -Dm755 build/bpm-* -t $(DESTDIR)$(BINDIR)/ # Install config files - install -Dm644 config/* -t $(DESTDIR)$(SYSCONFDIR)/bpm-utils/ + install -dm755 $(DESTDIR)$(SYSCONFDIR)/bpm-utils/ + cp -r config/* -t $(DESTDIR)$(SYSCONFDIR)/bpm-utils/ clean: rm -r build/ diff --git a/config/templates/cmake b/config/templates/cmake new file mode 100644 index 0000000..0d7c31f --- /dev/null +++ b/config/templates/cmake @@ -0,0 +1,42 @@ +# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package +# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE +# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT + +DOWNLOAD="https://wwww.my-url.com/file.tar.gz" +FILENAME="${DOWNLOAD##*/}" + +# The prepare function is executed in the root of the temp directory +# This function is used for downloading files and putting them into the correct location +prepare() { + wget "$DOWNLOAD" + tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE" +} + +# The build function is executed in the source directory +# This function is used to compile the source code +build() { + mkdir build + cd build + + cmake -DCMAKE_INSTALL_PREFIX=/usr .. + make +} + +# The check function is executed in the source directory +# This function is used to run tests to verify the package has been compiled correctly +check() { + cd build + + make test +} + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package() { + cd build + + make DESTDIR="$BPM_OUTPUT" install + + # Install package license + install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/$NAME/LICENSE +} diff --git a/config/source.default b/config/templates/gnu-configure similarity index 91% rename from config/source.default rename to config/templates/gnu-configure index 9ba34b7..3b95fbb 100644 --- a/config/source.default +++ b/config/templates/gnu-configure @@ -29,4 +29,7 @@ check() { # This function is used to move the compiled files into the output directory package() { make DESTDIR="$BPM_OUTPUT" install + + # Install package license + install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/$NAME/LICENSE } diff --git a/config/templates/gnu-make b/config/templates/gnu-make new file mode 100644 index 0000000..47edcd4 --- /dev/null +++ b/config/templates/gnu-make @@ -0,0 +1,34 @@ +# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package +# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE +# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT + +DOWNLOAD="https://wwww.my-url.com/file.tar.gz" +FILENAME="${DOWNLOAD##*/}" + +# The prepare function is executed in the root of the temp directory +# This function is used for downloading files and putting them into the correct location +prepare() { + wget "$DOWNLOAD" + tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE" +} + +# The build function is executed in the source directory +# This function is used to compile the source code +build() { + make PREFIX=/usr +} + +# The check function is executed in the source directory +# This function is used to run tests to verify the package has been compiled correctly +check() { + make check +} + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package() { + make DESTDIR="$BPM_OUTPUT" PREFIX=/usr install + + # Install package license + install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/$NAME/LICENSE +} diff --git a/config/templates/meson b/config/templates/meson new file mode 100644 index 0000000..16169d5 --- /dev/null +++ b/config/templates/meson @@ -0,0 +1,42 @@ +# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package +# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE +# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT + +DOWNLOAD="https://wwww.my-url.com/file.tar.gz" +FILENAME="${DOWNLOAD##*/}" + +# The prepare function is executed in the root of the temp directory +# This function is used for downloading files and putting them into the correct location +prepare() { + wget "$DOWNLOAD" + tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE" +} + +# The build function is executed in the source directory +# This function is used to compile the source code +build() { + mkdir build + cd build + + meson setup --prefix=/usr .. + meson compile +} + +# The check function is executed in the source directory +# This function is used to run tests to verify the package has been compiled correctly +check() { + cd build + + meson test +} + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package() { + cd build + + meson install --destdir="$BPM_OUTPUT" + + # Install package license + install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/$NAME/LICENSE +} diff --git a/config/templates/python-module b/config/templates/python-module new file mode 100644 index 0000000..9c442ea --- /dev/null +++ b/config/templates/python-module @@ -0,0 +1,34 @@ +# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package +# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE +# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT + +DOWNLOAD="https://wwww.my-url.com/file.tar.gz" +FILENAME="${DOWNLOAD##*/}" + +# The prepare function is executed in the root of the temp directory +# This function is used for downloading files and putting them into the correct location +prepare() { + wget "$DOWNLOAD" + tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE" +} + +# The build function is executed in the source directory +# This function is used to compile the source code +build() { + python3 -m build --wheel --no-isolation . +} + +# The check function is executed in the source directory +# This function is used to run tests to verify the package has been compiled correctly +check() { + # Python module testing command varies from module to module +} + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package() { + python3 -m installer --destdir="$BPM_OUTPUT" dist/*.whl + + # Install package license + install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/$NAME/LICENSE +} diff --git a/src/bpm-setup/main.go b/src/bpm-setup/main.go index 6007e87..f2d071f 100644 --- a/src/bpm-setup/main.go +++ b/src/bpm-setup/main.go @@ -18,7 +18,7 @@ var description = flag.String("d", "Default Package Description", "Set the descr var version = flag.String("v", "1.0", "Set the package version (Defaults to \"1.0\")") var url = flag.String("u", "", "Set the package URL (Optional)") var license = flag.String("l", "", "Set the package licenses (Optional)") -var template = flag.String("t", "source.default", "Set the package template (Defaults to \"source.default\")") +var template = flag.String("t", "gnu-configure", "Set the package template (Defaults to \"gnu-configure\")") var git = flag.Bool("g", true, "Create git repository (Defaults to true)") func main() { @@ -67,7 +67,7 @@ func help() { fmt.Println(" -v= | Set the package version (Defaults to \"1.0\")") fmt.Println(" -u= | Set the package URL (Optional)") fmt.Println(" -l= | Set the package licenses (Optional)") - fmt.Println(" -t=