Skip to content

Commit

Permalink
feat: introduce autotools
Browse files Browse the repository at this point in the history
  • Loading branch information
idevat committed Nov 10, 2024
1 parent ab451e0 commit 6c9e223
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 34 deletions.
15 changes: 14 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,22 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

pcs-web-ui-node-modules-*.tar.xz
pcs-web-ui-*
.npmrc
.eslintcache

stamps*

Makefile
Makefile.in
aclocal.m4
autom4te.cache/
config.log
config.status
configure
configure~
missing
install-sh

/.dev
/.tmp
57 changes: 24 additions & 33 deletions Makefile → Makefile.am
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
NEXUS="https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org"
PROJECT_DIR=$(shell pwd)
APP_MODULES_DIR=$(shell realpath ${PROJECT_DIR}/packages/app/node_modules)
AUTOMAKE_OPTIONS = foreign

ifndef NEXUS_REPO
NEXUS_REPO=true
endif
SUBDIRS = .

ifndef NEXUS_CERT_PATH
NEXUS_CERT_PATH=""
endif
NEXUS = "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org"
PROJECT_DIR = $(shell pwd)
APP_MODULES_DIR = $(shell realpath ${PROJECT_DIR}/packages/app/node_modules)

PCSD_WEBUI_DIR = @PCSD_WEBUI_DIR@

app:
@./packages/app/.bin/check-assumptions.sh
Expand All @@ -28,10 +26,10 @@ modules-pack:
@ls -l ./*.tar.xz

modules-prepare:
@cd ./packages/app && echo y | .bin/modules-prepare.sh ${APP_MODULES_DIR}
@cd ./packages/app && echo y | .bin/modules-prepare.sh ${APP_MODULES_DIR}

modules-patch:
@cd ./packages/app && .bin/modules-patch.sh ${APP_MODULES_DIR}
@cd ./packages/app && .bin/modules-patch.sh ${APP_MODULES_DIR}

dev:
@cd ./packages/dev-backend && .bin/dev-backend.sh
Expand All @@ -51,22 +49,19 @@ clean:
rm pcs-web-ui-node-modules-*.tar.xz

init_nexus:
ifeq ($(NEXUS_CERT_PATH),"")
echo "Specify path of nexus certificate, please"
else
@[ "${NEXUS_CERT_PATH}" ] || ( \
echo "Specify path of nexus certificate via NEXUS_CERT_PATH parameter, please"; \
exit 1 )
@.bin/init_nexus.sh ./packages ${NEXUS} ${NEXUS_CERT_PATH}
endif



init:
ifeq ($(NEXUS_REPO),true)
@echo "Use \`make init NEXUS_REPO=false\` not to use the Nexus repo."
@.bin/init.sh ${NEXUS}
else
@echo "If you will need reinit with the Nexus repo run \`make init\`"
@.bin/init.sh
endif
@if [ "${NEXUS_REPO}" ] && [ "${NEXUS_REPO}" = "false" ]; then \
echo "Use \`make init NEXUS_REPO=false\` not to use the Nexus repo."; \
.bin/init.sh ${NEXUS}; \
else \
echo "If you will need reinit with the Nexus repo run \`make init\`"
.bin/init.sh
fi

check_sources:
@.bin/check-no-nexus.sh
Expand All @@ -78,17 +73,13 @@ fmt:
npx prettier "packages/app/src/" --write
packages/app/node_modules/.bin/eslint --fix --ext .js,.ts,.tsx packages/app/src/

_install:
ifndef PCSD_DIR
$(error PCSD_DIR has to be specified)
endif
@if test ! -d build; then echo "Run 'make build' first"; false; fi
mkdir -p $(PCSD_DIR)/public/ui
cp -r build/* $(PCSD_DIR)/public/ui

install: build _install
install-exec-local:
mkdir -p $(PCSD_WEBUI_DIR)/ui
cp -r build/* $(PCSD_WEBUI_DIR)

npm_install:
@.bin/npm_install.sh ./packages

all: build

.PHONY: test build
7 changes: 7 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
#
# Copyright (C) 2020 Red Hat, Inc. All rights reserved.
#

# Run this to generate all the initial makefiles, etc.
autoreconf -i -v && echo Now run ./configure and make
44 changes: 44 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.63])
AC_INIT([pcs-web-ui],
[0.1.19],
[[email protected]])

# dist-bzip2 dist-xz - which archivers try to use for distribution archive
# -Wno-portability - disables some warnings about code portability
# tar-pax - use tar with pax during creating archive to ensure keep permissions
AM_INIT_AUTOMAKE([dist-bzip2 dist-xz -Wno-portability tar-pax])


# Checks for programs.

# check stolen from gnulib/m4/gnu-make.m4
if ! ${MAKE-make} --version /cannot/make/this >/dev/null 2>&1; then
AC_MSG_ERROR([you don't seem to have GNU make; it is required])
fi
AC_PROG_INSTALL
AC_PROG_GREP
AC_PROG_SED
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P

# Checks for libraries.

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.


# this will catch both ID and ID_LIKE from os-release

PKG_CHECK_VAR([PCSD_WEBUI_DIR], [pcs], [webui_dir])
AC_SUBST([PCSD_WEBUI_DIR])


AC_CONFIG_FILES([Makefile
])
AC_OUTPUT

0 comments on commit 6c9e223

Please sign in to comment.